|
@@ -1,7 +1,7 @@
|
|
/*
|
|
/*
|
|
* ItLpQueue.c
|
|
* ItLpQueue.c
|
|
* Copyright (C) 2001 Mike Corrigan IBM Corporation
|
|
* Copyright (C) 2001 Mike Corrigan IBM Corporation
|
|
- *
|
|
|
|
|
|
+ *
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
@@ -74,21 +74,21 @@ unsigned long ItLpQueueInProcess = 0;
|
|
|
|
|
|
static struct HvLpEvent * get_next_hvlpevent(void)
|
|
static struct HvLpEvent * get_next_hvlpevent(void)
|
|
{
|
|
{
|
|
- struct HvLpEvent * nextLpEvent =
|
|
|
|
|
|
+ struct HvLpEvent * nextLpEvent =
|
|
(struct HvLpEvent *)hvlpevent_queue.xSlicCurEventPtr;
|
|
(struct HvLpEvent *)hvlpevent_queue.xSlicCurEventPtr;
|
|
- if ( nextLpEvent->xFlags.xValid ) {
|
|
|
|
|
|
+ if (nextLpEvent->xFlags.xValid) {
|
|
/* rmb() needed only for weakly consistent machines (regatta) */
|
|
/* rmb() needed only for weakly consistent machines (regatta) */
|
|
rmb();
|
|
rmb();
|
|
/* Set pointer to next potential event */
|
|
/* Set pointer to next potential event */
|
|
hvlpevent_queue.xSlicCurEventPtr += ((nextLpEvent->xSizeMinus1 +
|
|
hvlpevent_queue.xSlicCurEventPtr += ((nextLpEvent->xSizeMinus1 +
|
|
- LpEventAlign ) /
|
|
|
|
- LpEventAlign ) *
|
|
|
|
|
|
+ LpEventAlign) /
|
|
|
|
+ LpEventAlign) *
|
|
LpEventAlign;
|
|
LpEventAlign;
|
|
/* Wrap to beginning if no room at end */
|
|
/* Wrap to beginning if no room at end */
|
|
if (hvlpevent_queue.xSlicCurEventPtr > hvlpevent_queue.xSlicLastValidEventPtr)
|
|
if (hvlpevent_queue.xSlicCurEventPtr > hvlpevent_queue.xSlicLastValidEventPtr)
|
|
hvlpevent_queue.xSlicCurEventPtr = hvlpevent_queue.xSlicEventStackPtr;
|
|
hvlpevent_queue.xSlicCurEventPtr = hvlpevent_queue.xSlicEventStackPtr;
|
|
}
|
|
}
|
|
- else
|
|
|
|
|
|
+ else
|
|
nextLpEvent = NULL;
|
|
nextLpEvent = NULL;
|
|
|
|
|
|
return nextLpEvent;
|
|
return nextLpEvent;
|
|
@@ -107,23 +107,23 @@ int hvlpevent_is_pending(void)
|
|
return next_event->xFlags.xValid | hvlpevent_queue.xPlicOverflowIntPending;
|
|
return next_event->xFlags.xValid | hvlpevent_queue.xPlicOverflowIntPending;
|
|
}
|
|
}
|
|
|
|
|
|
-static void hvlpevent_clear_valid( struct HvLpEvent * event )
|
|
|
|
|
|
+static void hvlpevent_clear_valid(struct HvLpEvent * event)
|
|
{
|
|
{
|
|
/* Clear the valid bit of the event
|
|
/* Clear the valid bit of the event
|
|
* Also clear bits within this event that might
|
|
* Also clear bits within this event that might
|
|
* look like valid bits (on 64-byte boundaries)
|
|
* look like valid bits (on 64-byte boundaries)
|
|
- */
|
|
|
|
- unsigned extra = (( event->xSizeMinus1 + LpEventAlign ) /
|
|
|
|
- LpEventAlign ) - 1;
|
|
|
|
- switch ( extra ) {
|
|
|
|
- case 3:
|
|
|
|
|
|
+ */
|
|
|
|
+ unsigned extra = ((event->xSizeMinus1 + LpEventAlign) /
|
|
|
|
+ LpEventAlign) - 1;
|
|
|
|
+ switch (extra) {
|
|
|
|
+ case 3:
|
|
((struct HvLpEvent*)((char*)event+3*LpEventAlign))->xFlags.xValid=0;
|
|
((struct HvLpEvent*)((char*)event+3*LpEventAlign))->xFlags.xValid=0;
|
|
- case 2:
|
|
|
|
|
|
+ case 2:
|
|
((struct HvLpEvent*)((char*)event+2*LpEventAlign))->xFlags.xValid=0;
|
|
((struct HvLpEvent*)((char*)event+2*LpEventAlign))->xFlags.xValid=0;
|
|
- case 1:
|
|
|
|
|
|
+ case 1:
|
|
((struct HvLpEvent*)((char*)event+1*LpEventAlign))->xFlags.xValid=0;
|
|
((struct HvLpEvent*)((char*)event+1*LpEventAlign))->xFlags.xValid=0;
|
|
- case 0:
|
|
|
|
- ;
|
|
|
|
|
|
+ case 0:
|
|
|
|
+ ;
|
|
}
|
|
}
|
|
mb();
|
|
mb();
|
|
event->xFlags.xValid = 0;
|
|
event->xFlags.xValid = 0;
|
|
@@ -136,7 +136,7 @@ void process_hvlpevents(struct pt_regs *regs)
|
|
/* If we have recursed, just return */
|
|
/* If we have recursed, just return */
|
|
if ( !set_inUse() )
|
|
if ( !set_inUse() )
|
|
return;
|
|
return;
|
|
-
|
|
|
|
|
|
+
|
|
if (ItLpQueueInProcess == 0)
|
|
if (ItLpQueueInProcess == 0)
|
|
ItLpQueueInProcess = 1;
|
|
ItLpQueueInProcess = 1;
|
|
else
|
|
else
|
|
@@ -144,35 +144,35 @@ void process_hvlpevents(struct pt_regs *regs)
|
|
|
|
|
|
for (;;) {
|
|
for (;;) {
|
|
nextLpEvent = get_next_hvlpevent();
|
|
nextLpEvent = get_next_hvlpevent();
|
|
- if ( nextLpEvent ) {
|
|
|
|
- /* Call appropriate handler here, passing
|
|
|
|
|
|
+ if (nextLpEvent) {
|
|
|
|
+ /* Call appropriate handler here, passing
|
|
* a pointer to the LpEvent. The handler
|
|
* a pointer to the LpEvent. The handler
|
|
* must make a copy of the LpEvent if it
|
|
* must make a copy of the LpEvent if it
|
|
* needs it in a bottom half. (perhaps for
|
|
* needs it in a bottom half. (perhaps for
|
|
* an ACK)
|
|
* an ACK)
|
|
- *
|
|
|
|
- * Handlers are responsible for ACK processing
|
|
|
|
|
|
+ *
|
|
|
|
+ * Handlers are responsible for ACK processing
|
|
*
|
|
*
|
|
* The Hypervisor guarantees that LpEvents will
|
|
* The Hypervisor guarantees that LpEvents will
|
|
* only be delivered with types that we have
|
|
* only be delivered with types that we have
|
|
* registered for, so no type check is necessary
|
|
* registered for, so no type check is necessary
|
|
* here!
|
|
* here!
|
|
- */
|
|
|
|
- if ( nextLpEvent->xType < HvLpEvent_Type_NumTypes )
|
|
|
|
|
|
+ */
|
|
|
|
+ if (nextLpEvent->xType < HvLpEvent_Type_NumTypes)
|
|
__get_cpu_var(hvlpevent_counts)[nextLpEvent->xType]++;
|
|
__get_cpu_var(hvlpevent_counts)[nextLpEvent->xType]++;
|
|
- if ( nextLpEvent->xType < HvLpEvent_Type_NumTypes &&
|
|
|
|
- lpEventHandler[nextLpEvent->xType] )
|
|
|
|
|
|
+ if (nextLpEvent->xType < HvLpEvent_Type_NumTypes &&
|
|
|
|
+ lpEventHandler[nextLpEvent->xType])
|
|
lpEventHandler[nextLpEvent->xType](nextLpEvent, regs);
|
|
lpEventHandler[nextLpEvent->xType](nextLpEvent, regs);
|
|
else
|
|
else
|
|
printk(KERN_INFO "Unexpected Lp Event type=%d\n", nextLpEvent->xType );
|
|
printk(KERN_INFO "Unexpected Lp Event type=%d\n", nextLpEvent->xType );
|
|
-
|
|
|
|
- hvlpevent_clear_valid( nextLpEvent );
|
|
|
|
- } else if ( hvlpevent_queue.xPlicOverflowIntPending )
|
|
|
|
|
|
+
|
|
|
|
+ hvlpevent_clear_valid(nextLpEvent);
|
|
|
|
+ } else if (hvlpevent_queue.xPlicOverflowIntPending)
|
|
/*
|
|
/*
|
|
* No more valid events. If overflow events are
|
|
* No more valid events. If overflow events are
|
|
* pending process them
|
|
* pending process them
|
|
*/
|
|
*/
|
|
- HvCallEvent_getOverflowLpEvents( hvlpevent_queue.xIndex);
|
|
|
|
|
|
+ HvCallEvent_getOverflowLpEvents(hvlpevent_queue.xIndex);
|
|
else
|
|
else
|
|
break;
|
|
break;
|
|
}
|
|
}
|