From bea248fb30c3122ece8c34798527fac431c1d7b0 Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Thu, 30 Jun 2005 15:07:09 +1000 Subject: [PATCH] ppc64: Remove lpqueue pointer from the paca on iSeries The iSeries code keeps a pointer to the ItLpQueue in its paca struct. But all these pointers end up pointing to the one place, ie. xItLpQueue. So remove the pointer from the paca struct and just refer to xItLpQueue directly where needed. The only complication is that the spread_lpevents logic was implemented by having a NULL lpqueue pointer in the paca on CPUs that weren't supposed to process events. Instead we just compare the spread_lpevents value to the processor id to get the same behaviour. Signed-off-by: Michael Ellerman Acked-by: Stephen Rothwell Signed-off-by: Paul Mackerras --- include/asm-ppc64/paca.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include/asm-ppc64') diff --git a/include/asm-ppc64/paca.h b/include/asm-ppc64/paca.h index ae76cae1483..0146f51684e 100644 --- a/include/asm-ppc64/paca.h +++ b/include/asm-ppc64/paca.h @@ -20,7 +20,6 @@ #include #include #include -#include #include register struct paca_struct *local_paca asm("r13"); @@ -62,7 +61,6 @@ struct paca_struct { u16 paca_index; /* Logical processor number */ u32 default_decr; /* Default decrementer value */ - struct ItLpQueue *lpqueue_ptr; /* LpQueue handled by this CPU */ u64 kernel_toc; /* Kernel TOC address */ u64 stab_real; /* Absolute address of segment table */ u64 stab_addr; /* Virtual address of segment table */ -- cgit v1.2.3 From 1b19bc721416ae5bc813521d9e010a89f4816120 Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Thu, 30 Jun 2005 15:07:57 +1000 Subject: [PATCH] ppc64: Don't pass the pointers to xItLpQueue around Because there's only one ItLpQueue and we know where it is, ie. xItLpQueue, there's no point passing pointers to it it around all over the place. Signed-off-by: Michael Ellerman Acked-by: Stephen Rothwell Signed-off-by: Paul Mackerras --- include/asm-ppc64/iSeries/ItLpQueue.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include/asm-ppc64') diff --git a/include/asm-ppc64/iSeries/ItLpQueue.h b/include/asm-ppc64/iSeries/ItLpQueue.h index 393299e04d7..832497e3259 100644 --- a/include/asm-ppc64/iSeries/ItLpQueue.h +++ b/include/asm-ppc64/iSeries/ItLpQueue.h @@ -76,9 +76,9 @@ struct ItLpQueue { extern struct ItLpQueue xItLpQueue; -extern struct HvLpEvent *ItLpQueue_getNextLpEvent(struct ItLpQueue *); -extern int ItLpQueue_isLpIntPending(struct ItLpQueue *); -extern unsigned ItLpQueue_process(struct ItLpQueue *, struct pt_regs *); +extern struct HvLpEvent *ItLpQueue_getNextLpEvent(void); +extern int ItLpQueue_isLpIntPending(void); +extern unsigned ItLpQueue_process(struct pt_regs *); extern void ItLpQueue_clearValid(struct HvLpEvent *); #endif /* _ITLPQUEUE_H */ -- cgit v1.2.3 From 512d31d6a824a961f39b418f11480f678320e4f3 Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Thu, 30 Jun 2005 15:08:27 +1000 Subject: [PATCH] ppc64: Move initialisation of xItLpQueue into ItLpQueue.c The xItLpQueue is initalised manually in iSeries_setup_arch(). Move this code into ItLpQueue.c for a cleaner separation. Signed-off-by: Michael Ellerman Acked-by: Stephen Rothwell Signed-off-by: Paul Mackerras --- include/asm-ppc64/iSeries/ItLpQueue.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/asm-ppc64') diff --git a/include/asm-ppc64/iSeries/ItLpQueue.h b/include/asm-ppc64/iSeries/ItLpQueue.h index 832497e3259..de90feedbe1 100644 --- a/include/asm-ppc64/iSeries/ItLpQueue.h +++ b/include/asm-ppc64/iSeries/ItLpQueue.h @@ -80,5 +80,6 @@ extern struct HvLpEvent *ItLpQueue_getNextLpEvent(void); extern int ItLpQueue_isLpIntPending(void); extern unsigned ItLpQueue_process(struct pt_regs *); extern void ItLpQueue_clearValid(struct HvLpEvent *); +extern void setup_hvlpevent_queue(void); #endif /* _ITLPQUEUE_H */ -- cgit v1.2.3 From 0f6014b37e25e50724867c0a4127615427ec2a75 Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Thu, 30 Jun 2005 15:08:56 +1000 Subject: [PATCH] ppc64: Make two ItLpQueue related functions static External parties don't need to use ItLpQueue_getNextLpEvent() or ItLpQueue_clearValid(), they're internal to ItLpQueue.c Signed-off-by: Michael Ellerman Acked-by: Stephen Rothwell Signed-off-by: Paul Mackerras --- include/asm-ppc64/iSeries/ItLpQueue.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include/asm-ppc64') diff --git a/include/asm-ppc64/iSeries/ItLpQueue.h b/include/asm-ppc64/iSeries/ItLpQueue.h index de90feedbe1..be1cb7f3f88 100644 --- a/include/asm-ppc64/iSeries/ItLpQueue.h +++ b/include/asm-ppc64/iSeries/ItLpQueue.h @@ -76,10 +76,8 @@ struct ItLpQueue { extern struct ItLpQueue xItLpQueue; -extern struct HvLpEvent *ItLpQueue_getNextLpEvent(void); extern int ItLpQueue_isLpIntPending(void); extern unsigned ItLpQueue_process(struct pt_regs *); -extern void ItLpQueue_clearValid(struct HvLpEvent *); extern void setup_hvlpevent_queue(void); #endif /* _ITLPQUEUE_H */ -- cgit v1.2.3 From a61874648d14450f4d397489527998e3dd1119de Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Thu, 30 Jun 2005 15:15:32 +1000 Subject: [PATCH] ppc64: Rename xItLpQueue to hvlpevent_queue The xItLpQueue is a queue of HvLpEvents that we're given by the Hypervisor. Rename xItLpQueue to hvlpevent_queue and make the type struct hvlpevent_queue. Signed-off-by: Michael Ellerman Acked-by: Stephen Rothwell Signed-off-by: Paul Mackerras --- include/asm-ppc64/iSeries/ItLpQueue.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/asm-ppc64') diff --git a/include/asm-ppc64/iSeries/ItLpQueue.h b/include/asm-ppc64/iSeries/ItLpQueue.h index be1cb7f3f88..bebfb364f55 100644 --- a/include/asm-ppc64/iSeries/ItLpQueue.h +++ b/include/asm-ppc64/iSeries/ItLpQueue.h @@ -41,7 +41,7 @@ struct HvLpEvent; #define LpEventMaxSize 256 #define LpEventAlign 64 -struct ItLpQueue { +struct hvlpevent_queue { /* * The xSlicCurEventPtr is the pointer to the next event stack entry * that will become valid. The OS must peek at this entry to determine @@ -74,7 +74,7 @@ struct ItLpQueue { u64 xLpIntCountByType[9]; // 0x38-0x7F Event counts by type }; -extern struct ItLpQueue xItLpQueue; +extern struct hvlpevent_queue hvlpevent_queue; extern int ItLpQueue_isLpIntPending(void); extern unsigned ItLpQueue_process(struct pt_regs *); -- cgit v1.2.3 From 937b31b114b5540f456ce1566aae67e02db41f2c Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Thu, 30 Jun 2005 15:15:42 +1000 Subject: [PATCH] ppc64: Rename ItLpQueue_* functions to hvlpevent_queue_* Now that we've renamed the xItLpQueue structure, rename the functions that operate on it also. Signed-off-by: Michael Ellerman Acked-by: Stephen Rothwell Signed-off-by: Paul Mackerras --- include/asm-ppc64/iSeries/ItLpQueue.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/asm-ppc64') diff --git a/include/asm-ppc64/iSeries/ItLpQueue.h b/include/asm-ppc64/iSeries/ItLpQueue.h index bebfb364f55..f0f24a39ff6 100644 --- a/include/asm-ppc64/iSeries/ItLpQueue.h +++ b/include/asm-ppc64/iSeries/ItLpQueue.h @@ -76,8 +76,8 @@ struct hvlpevent_queue { extern struct hvlpevent_queue hvlpevent_queue; -extern int ItLpQueue_isLpIntPending(void); -extern unsigned ItLpQueue_process(struct pt_regs *); +extern int hvlpevent_is_pending(void); +extern unsigned process_hvlpevents(struct pt_regs *); extern void setup_hvlpevent_queue(void); #endif /* _ITLPQUEUE_H */ -- cgit v1.2.3 From 74889802a1585af4e1652f0cb853ac22a65816a4 Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Thu, 30 Jun 2005 15:15:53 +1000 Subject: [PATCH] ppc64: Don't count number of events processed for caller Currently we count the number of lpevents processed in 3 seperate places. One of these counters is never read, so just remove it. This means hvlpevent_queue_process() no longer needs to return the number of events processed. Signed-off-by: Michael Ellerman Acked-by: Stephen Rothwell Signed-off-by: Paul Mackerras --- include/asm-ppc64/iSeries/ItLpQueue.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/asm-ppc64') diff --git a/include/asm-ppc64/iSeries/ItLpQueue.h b/include/asm-ppc64/iSeries/ItLpQueue.h index f0f24a39ff6..6ba74c0d910 100644 --- a/include/asm-ppc64/iSeries/ItLpQueue.h +++ b/include/asm-ppc64/iSeries/ItLpQueue.h @@ -77,7 +77,7 @@ struct hvlpevent_queue { extern struct hvlpevent_queue hvlpevent_queue; extern int hvlpevent_is_pending(void); -extern unsigned process_hvlpevents(struct pt_regs *); +extern void process_hvlpevents(struct pt_regs *); extern void setup_hvlpevent_queue(void); #endif /* _ITLPQUEUE_H */ -- cgit v1.2.3 From ed094150bdeb6eca691f1b7a05bd34d4d1a95488 Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Thu, 30 Jun 2005 15:16:09 +1000 Subject: [PATCH] ppc64: Simplify counting of lpevents, remove lpevent_count from paca Currently there's a per-cpu count of lpevents processed, a per-queue (ie. global) total count, and a count by event type. Replace all that with a count by event for each cpu. We only need to add it up int the proc code. Signed-off-by: Michael Ellerman Acked-by: Stephen Rothwell Signed-off-by: Paul Mackerras --- include/asm-ppc64/iSeries/ItLpQueue.h | 2 -- include/asm-ppc64/paca.h | 1 - 2 files changed, 3 deletions(-) (limited to 'include/asm-ppc64') diff --git a/include/asm-ppc64/iSeries/ItLpQueue.h b/include/asm-ppc64/iSeries/ItLpQueue.h index 6ba74c0d910..51db08852db 100644 --- a/include/asm-ppc64/iSeries/ItLpQueue.h +++ b/include/asm-ppc64/iSeries/ItLpQueue.h @@ -70,8 +70,6 @@ struct hvlpevent_queue { u8 xIndex; // 0x28 unique sequential index. u8 xSlicRsvd[3]; // 0x29-2b u32 xInUseWord; // 0x2C - u64 xLpIntCount; // 0x30 Total Lp Int msgs processed - u64 xLpIntCountByType[9]; // 0x38-0x7F Event counts by type }; extern struct hvlpevent_queue hvlpevent_queue; diff --git a/include/asm-ppc64/paca.h b/include/asm-ppc64/paca.h index 0146f51684e..2f0f36f73d3 100644 --- a/include/asm-ppc64/paca.h +++ b/include/asm-ppc64/paca.h @@ -89,7 +89,6 @@ struct paca_struct { u64 next_jiffy_update_tb; /* TB value for next jiffy update */ u64 saved_r1; /* r1 save for RTAS calls */ u64 saved_msr; /* MSR saved here by enter_rtas */ - u32 lpevent_count; /* lpevents processed */ u8 proc_enabled; /* irq soft-enable flag */ /* not yet used */ -- cgit v1.2.3 From 719d1cd86780c156f954fc34f34481adac197aec Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Thu, 30 Jun 2005 15:17:02 +1000 Subject: [PATCH] ppc64: Replace custom locking code with a spinlock The hvlpevent_queue (formally ItLpQueue) has a member called xInUseWord which is used for serialising access to the queue. Because it's a word (ie. 32 bit) there's a custom 32-bit version of test_and_set_bit() or thereabouts in ItLpQueue.c. The xInUseWord is not shared with they hypervisor, so we can replace it with a spinlock and remove the custom code. There is also another locking mechanism (ItLpQueueInProcess). This is redundant because it's only manipulated while the lock's held. Remove it. Signed-off-by: Michael Ellerman Acked-by: Stephen Rothwell Signed-off-by: Paul Mackerras --- include/asm-ppc64/iSeries/ItLpQueue.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/asm-ppc64') diff --git a/include/asm-ppc64/iSeries/ItLpQueue.h b/include/asm-ppc64/iSeries/ItLpQueue.h index 51db08852db..69b26ad7413 100644 --- a/include/asm-ppc64/iSeries/ItLpQueue.h +++ b/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; -- cgit v1.2.3