From 673aeb76d07f49f2b07792f813bc2a9fee212ab7 Mon Sep 17 00:00:00 2001 From: Michal Ostrowski Date: Wed, 20 Dec 2006 07:29:40 -0600 Subject: [POWERPC] Avoid calling get_irq_server() with a real, not virtual irq. We can use default_server when masking an interrupt vector. get_irq_server() assumes a virtual irq, so badness may happen if we give it a real one. Signed-off-by: Michal Ostrowski Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/pseries/xics.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'arch/powerpc/platforms/pseries') diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c index b5b2b1103de..81d172d6503 100644 --- a/arch/powerpc/platforms/pseries/xics.c +++ b/arch/powerpc/platforms/pseries/xics.c @@ -224,7 +224,6 @@ static void xics_unmask_irq(unsigned int virq) static void xics_mask_real_irq(unsigned int irq) { int call_status; - unsigned int server; if (irq == XICS_IPI) return; @@ -236,9 +235,9 @@ static void xics_mask_real_irq(unsigned int irq) return; } - server = get_irq_server(irq); /* Have to set XIVE to 0xff to be able to remove a slot */ - call_status = rtas_call(ibm_set_xive, 3, 1, NULL, irq, server, 0xff); + call_status = rtas_call(ibm_set_xive, 3, 1, NULL, irq, + default_server, 0xff); if (call_status != 0) { printk(KERN_ERR "xics_disable_irq: irq=%u: ibm_set_xive(0xff)" " returned %d\n", irq, call_status); -- cgit v1.2.3 From ab87e8dc88a7cae341c403547cea6b022f5ac023 Mon Sep 17 00:00:00 2001 From: Anton Blanchard Date: Tue, 9 Jan 2007 02:37:16 +1100 Subject: [POWERPC] Fix corruption in hcall9 It looks to me like we are corrupting r12 in the hcall9 function. Although we have r0 free we cant use offsets against it, so save away r12 in there instead. r12 holds the ninth return value from the hypervisor call, so without this fix, the caller will see the wrong value for the ninth element in the array that gets the return values. Signed-off-by: Anton Blanchard Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/pseries/hvCall.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'arch/powerpc/platforms/pseries') diff --git a/arch/powerpc/platforms/pseries/hvCall.S b/arch/powerpc/platforms/pseries/hvCall.S index c00cfed7af2..527da445aaa 100644 --- a/arch/powerpc/platforms/pseries/hvCall.S +++ b/arch/powerpc/platforms/pseries/hvCall.S @@ -145,6 +145,7 @@ _GLOBAL(plpar_hcall9) HVSC /* invoke the hypervisor */ + mr r0,r12 ld r12,STK_PARM(r4)(r1) std r4, 0(r12) std r5, 8(r12) @@ -154,7 +155,7 @@ _GLOBAL(plpar_hcall9) std r9, 40(r12) std r10,48(r12) std r11,56(r12) - std r12,64(r12) + std r0, 64(r12) HCALL_INST_POSTCALL -- cgit v1.2.3 From dc40127ca5c6e1da48d2b5f9d0c65b5795faac12 Mon Sep 17 00:00:00 2001 From: Anton Blanchard Date: Tue, 9 Jan 2007 02:43:02 +1100 Subject: [POWERPC] Fix bugs in the hypervisor call stats code There were a few issues with the HCALL_STATS code: - PURR cpu feature checks were backwards - We iterated one entry off the end of the hcall_stats array - Remove dead update_hcall_stats() function prototype I noticed one thing while debugging, and that is we call H_ENTER (to set up the MMU hashtable in early init) before we have done the cpu fixups. This means we will execute the PURR SPR reads even on a CPU that isnt capable of it. I wonder if we can move the CPU feature fixups earlier. Signed-off-by: Anton Blanchard Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/pseries/hvCall.S | 6 +++--- arch/powerpc/platforms/pseries/hvCall_inst.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'arch/powerpc/platforms/pseries') diff --git a/arch/powerpc/platforms/pseries/hvCall.S b/arch/powerpc/platforms/pseries/hvCall.S index 527da445aaa..5c7e3878989 100644 --- a/arch/powerpc/platforms/pseries/hvCall.S +++ b/arch/powerpc/platforms/pseries/hvCall.S @@ -26,7 +26,7 @@ BEGIN_FTR_SECTION; \ mfspr r0,SPRN_PURR; /* get PURR and */ \ std r0,STK_PARM(r6)(r1); /* save for later */ \ -END_FTR_SECTION_IFCLR(CPU_FTR_PURR); +END_FTR_SECTION_IFSET(CPU_FTR_PURR); /* * postcall is performed immediately before function return which @@ -43,7 +43,7 @@ BEGIN_FTR_SECTION; \ mfspr r8,SPRN_PURR; /* PURR after */ \ ld r6,STK_PARM(r6)(r1); /* PURR before */ \ subf r6,r6,r8; /* delta */ \ -END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \ +END_FTR_SECTION_IFSET(CPU_FTR_PURR); \ ld r5,STK_PARM(r5)(r1); /* timebase before */ \ subf r5,r5,r7; /* time delta */ \ \ @@ -66,7 +66,7 @@ BEGIN_FTR_SECTION; \ ld r7,HCALL_STAT_PURR(r4); /* PURR */ \ add r7,r7,r6; \ std r7,HCALL_STAT_PURR(r4); \ -END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \ +END_FTR_SECTION_IFSET(CPU_FTR_PURR); \ 1: #else #define HCALL_INST_PRECALL diff --git a/arch/powerpc/platforms/pseries/hvCall_inst.c b/arch/powerpc/platforms/pseries/hvCall_inst.c index 80181c4c49e..3ddc04925d5 100644 --- a/arch/powerpc/platforms/pseries/hvCall_inst.c +++ b/arch/powerpc/platforms/pseries/hvCall_inst.c @@ -34,7 +34,7 @@ DEFINE_PER_CPU(struct hcall_stats[HCALL_STAT_ARRAY_SIZE], hcall_stats); */ static void *hc_start(struct seq_file *m, loff_t *pos) { - if ((int)*pos < HCALL_STAT_ARRAY_SIZE) + if ((int)*pos < (HCALL_STAT_ARRAY_SIZE-1)) return (void *)(unsigned long)(*pos + 1); return NULL; @@ -57,7 +57,7 @@ static int hc_show(struct seq_file *m, void *p) struct hcall_stats *hs = (struct hcall_stats *)m->private; if (hs[h_num].num_calls) { - if (!cpu_has_feature(CPU_FTR_PURR)) + if (cpu_has_feature(CPU_FTR_PURR)) seq_printf(m, "%lu %lu %lu %lu\n", h_num<<2, hs[h_num].num_calls, hs[h_num].tb_total, -- cgit v1.2.3