From 889980b8e3fcc901aaf05b5974c8ed375cfce5c7 Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Thu, 30 Jun 2005 15:17:02 +1000 Subject: [PATCH] --- yaml --- r: 4032 b: refs/heads/master c: 719d1cd86780c156f954fc34f34481adac197aec h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/arch/ppc64/kernel/ItLpQueue.c | 38 ++------------------- trunk/include/asm-ppc64/iSeries/ItLpQueue.h | 2 +- 3 files changed, 4 insertions(+), 38 deletions(-) diff --git a/[refs] b/[refs] index d53c3f7280f3..c830deb1add0 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: ffe1b7e14e6b606bd84cab564aa2f481dbd4e418 +refs/heads/master: 719d1cd86780c156f954fc34f34481adac197aec diff --git a/trunk/arch/ppc64/kernel/ItLpQueue.c b/trunk/arch/ppc64/kernel/ItLpQueue.c index a4f32cbf5297..4231861288a3 100644 --- a/trunk/arch/ppc64/kernel/ItLpQueue.c +++ b/trunk/arch/ppc64/kernel/ItLpQueue.c @@ -42,35 +42,8 @@ static char *event_types[HvLpEvent_Type_NumTypes] = { "Virtual I/O" }; -static __inline__ int set_inUse(void) -{ - int t; - u32 * inUseP = &hvlpevent_queue.xInUseWord; - - __asm__ __volatile__("\n\ -1: lwarx %0,0,%2 \n\ - cmpwi 0,%0,0 \n\ - li %0,0 \n\ - bne- 2f \n\ - addi %0,%0,1 \n\ - stwcx. %0,0,%2 \n\ - bne- 1b \n\ -2: eieio" - : "=&r" (t), "=m" (hvlpevent_queue.xInUseWord) - : "r" (inUseP), "m" (hvlpevent_queue.xInUseWord) - : "cc"); - - return t; -} - -static __inline__ void clear_inUse(void) -{ - hvlpevent_queue.xInUseWord = 0; -} - /* Array of LpEvent handler functions */ extern LpEventHandler lpEventHandler[HvLpEvent_Type_NumTypes]; -unsigned long ItLpQueueInProcess = 0; static struct HvLpEvent * get_next_hvlpevent(void) { @@ -144,14 +117,9 @@ void process_hvlpevents(struct pt_regs *regs) struct HvLpEvent * event; /* If we have recursed, just return */ - if ( !set_inUse() ) + if (!spin_trylock(&hvlpevent_queue.lock)) return; - if (ItLpQueueInProcess == 0) - ItLpQueueInProcess = 1; - else - BUG(); - for (;;) { event = get_next_hvlpevent(); if (event) { @@ -187,9 +155,7 @@ void process_hvlpevents(struct pt_regs *regs) break; } - ItLpQueueInProcess = 0; - mb(); - clear_inUse(); + spin_unlock(&hvlpevent_queue.lock); } static int set_spread_lpevents(char *str) diff --git a/trunk/include/asm-ppc64/iSeries/ItLpQueue.h b/trunk/include/asm-ppc64/iSeries/ItLpQueue.h index 51db08852dba..69b26ad74135 100644 --- a/trunk/include/asm-ppc64/iSeries/ItLpQueue.h +++ b/trunk/include/asm-ppc64/iSeries/ItLpQueue.h @@ -69,7 +69,7 @@ struct hvlpevent_queue { char *xSlicEventStackPtr; // 0x20 u8 xIndex; // 0x28 unique sequential index. u8 xSlicRsvd[3]; // 0x29-2b - u32 xInUseWord; // 0x2C + spinlock_t lock; }; extern struct hvlpevent_queue hvlpevent_queue;