Re: [PATCH 12/38] powerpc/booke: Provide exception macros with interrupt name

2012-03-21 Thread Scott Wood
On 03/21/2012 01:04 PM, Kumar Gala wrote:
 
 On Feb 28, 2012, at 6:09 PM, Alexander Graf wrote:
 
 From: Scott Wood scottw...@freescale.com

 DO_KVM will need to identify the particular exception type.

 There is an existing set of arbitrary numbers that Linux passes,
 but it's an undocumented mess that sort of corresponds to server/classic
 exception vectors but not really.
 
 So what do the new names correspond to?

The names are Linux-defined.  The values are IVOR numbers.

 What header is defining MACHINE_CHECK, BOOKE_INTERRUPT_EXTERNAL, etc
 (asm/kvm_asm.h)?

Yes, it's asm/kvm_asm.h at the moment.

It's actually BOOKE_INTERRUPT_MACHINE_CHECK, etc.  The exception macros
paste on BOOKE_INTERRUPT_ when they use it, to keep the macro users from
having to wrap lines even more often.

 If so we really should move these out of
 asm/kvm_asm.h and into something a bit more appropriate.

Yes, that was one of the things I had been planning to fix post-RFC.
Any preference what header it should be in?  asm/reg_booke.h seems to be
the least bad option of the existing headers -- or perhaps move
head_booke.h to arch/powerpc/include/asm.

Long-term it would also be nice for this to replace, rather than
supplement, the current numbers, though as Ben pointed out there are a
number of places throughout the code that will have to be fixed for that
to happen.

-Scott

--
To unsubscribe from this list: send the line unsubscribe kvm-ppc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 12/38] powerpc/booke: Provide exception macros with interrupt name

2012-03-21 Thread Kumar Gala

On Mar 21, 2012, at 1:19 PM, Scott Wood wrote:

 On 03/21/2012 01:04 PM, Kumar Gala wrote:
 
 On Feb 28, 2012, at 6:09 PM, Alexander Graf wrote:
 
 From: Scott Wood scottw...@freescale.com
 
 DO_KVM will need to identify the particular exception type.
 
 There is an existing set of arbitrary numbers that Linux passes,
 but it's an undocumented mess that sort of corresponds to server/classic
 exception vectors but not really.
 
 So what do the new names correspond to?
 
 The names are Linux-defined.  The values are IVOR numbers.
 
 What header is defining MACHINE_CHECK, BOOKE_INTERRUPT_EXTERNAL, etc
 (asm/kvm_asm.h)?
 
 Yes, it's asm/kvm_asm.h at the moment.
 
 It's actually BOOKE_INTERRUPT_MACHINE_CHECK, etc.  The exception macros
 paste on BOOKE_INTERRUPT_ when they use it, to keep the macro users from
 having to wrap lines even more often.
 
 If so we really should move these out of
 asm/kvm_asm.h and into something a bit more appropriate.
 
 Yes, that was one of the things I had been planning to fix post-RFC.
 Any preference what header it should be in?  asm/reg_booke.h seems to be
 the least bad option of the existing headers -- or perhaps move
 head_booke.h to arch/powerpc/include/asm.

asm/reg_booke.h seems the least painful right now.  head_booke.h is only used 
on 32-bit so that's not the best choice at this point.  We could create an 
asm/head_booke.h in addition to the one in arch/powerpc/kernel/

 Long-term it would also be nice for this to replace, rather than
 supplement, the current numbers, though as Ben pointed out there are a
 number of places throughout the code that will have to be fixed for that
 to happen.

Yeah, not too worried about that.  More just wanting it to be clear what one 
has to 'update' if adding support for a new exception.

- k--
To unsubscribe from this list: send the line unsubscribe kvm-ppc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 12/38] powerpc/booke: Provide exception macros with interrupt name

2012-02-28 Thread Alexander Graf
From: Scott Wood scottw...@freescale.com

DO_KVM will need to identify the particular exception type.

There is an existing set of arbitrary numbers that Linux passes,
but it's an undocumented mess that sort of corresponds to server/classic
exception vectors but not really.

Signed-off-by: Scott Wood scottw...@freescale.com
Signed-off-by: Alexander Graf ag...@suse.de
---
 arch/powerpc/kernel/head_44x.S   |   23 +--
 arch/powerpc/kernel/head_booke.h |   41 ++
 arch/powerpc/kernel/head_fsl_booke.S |   52 +-
 3 files changed, 68 insertions(+), 48 deletions(-)

diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S
index 7dd2981..d1192c5 100644
--- a/arch/powerpc/kernel/head_44x.S
+++ b/arch/powerpc/kernel/head_44x.S
@@ -248,10 +248,11 @@ _ENTRY(_start);
 
 interrupt_base:
/* Critical Input Interrupt */
-   CRITICAL_EXCEPTION(0x0100, CriticalInput, unknown_exception)
+   CRITICAL_EXCEPTION(0x0100, CRITICAL, CriticalInput, unknown_exception)
 
/* Machine Check Interrupt */
-   CRITICAL_EXCEPTION(0x0200, MachineCheck, machine_check_exception)
+   CRITICAL_EXCEPTION(0x0200, MACHINE_CHECK, MachineCheck, \
+  machine_check_exception)
MCHECK_EXCEPTION(0x0210, MachineCheckA, machine_check_exception)
 
/* Data Storage Interrupt */
@@ -261,7 +262,8 @@ interrupt_base:
INSTRUCTION_STORAGE_EXCEPTION
 
/* External Input Interrupt */
-   EXCEPTION(0x0500, ExternalInput, do_IRQ, EXC_XFER_LITE)
+   EXCEPTION(0x0500, BOOKE_INTERRUPT_EXTERNAL, ExternalInput, \
+ do_IRQ, EXC_XFER_LITE)
 
/* Alignment Interrupt */
ALIGNMENT_EXCEPTION
@@ -273,29 +275,32 @@ interrupt_base:
 #ifdef CONFIG_PPC_FPU
FP_UNAVAILABLE_EXCEPTION
 #else
-   EXCEPTION(0x2010, FloatingPointUnavailable, unknown_exception, 
EXC_XFER_EE)
+   EXCEPTION(0x2010, BOOKE_INTERRUPT_FP_UNAVAIL, \
+ FloatingPointUnavailable, unknown_exception, EXC_XFER_EE)
 #endif
/* System Call Interrupt */
START_EXCEPTION(SystemCall)
-   NORMAL_EXCEPTION_PROLOG
+   NORMAL_EXCEPTION_PROLOG(BOOKE_INTERRUPT_SYSCALL)
EXC_XFER_EE_LITE(0x0c00, DoSyscall)
 
/* Auxiliary Processor Unavailable Interrupt */
-   EXCEPTION(0x2020, AuxillaryProcessorUnavailable, unknown_exception, 
EXC_XFER_EE)
+   EXCEPTION(0x2020, BOOKE_INTERRUPT_AP_UNAVAIL, \
+ AuxillaryProcessorUnavailable, unknown_exception, EXC_XFER_EE)
 
/* Decrementer Interrupt */
DECREMENTER_EXCEPTION
 
/* Fixed Internal Timer Interrupt */
/* TODO: Add FIT support */
-   EXCEPTION(0x1010, FixedIntervalTimer, unknown_exception, EXC_XFER_EE)
+   EXCEPTION(0x1010, BOOKE_INTERRUPT_FIT, FixedIntervalTimer, \
+ unknown_exception, EXC_XFER_EE)
 
/* Watchdog Timer Interrupt */
/* TODO: Add watchdog support */
 #ifdef CONFIG_BOOKE_WDT
-   CRITICAL_EXCEPTION(0x1020, WatchdogTimer, WatchdogException)
+   CRITICAL_EXCEPTION(0x1020, WATCHDOG, WatchdogTimer, WatchdogException)
 #else
-   CRITICAL_EXCEPTION(0x1020, WatchdogTimer, unknown_exception)
+   CRITICAL_EXCEPTION(0x1020, WATCHDOG, WatchdogTimer, unknown_exception)
 #endif
 
/* Data TLB Error Interrupt */
diff --git a/arch/powerpc/kernel/head_booke.h b/arch/powerpc/kernel/head_booke.h
index fc921bf..06ab353 100644
--- a/arch/powerpc/kernel/head_booke.h
+++ b/arch/powerpc/kernel/head_booke.h
@@ -2,6 +2,8 @@
 #define __HEAD_BOOKE_H__
 
 #include asm/ptrace.h/* for STACK_FRAME_REGS_MARKER */
+#include asm/kvm_asm.h
+
 /*
  * Macros used for common Book-e exception handling
  */
@@ -28,7 +30,7 @@
  */
 #define THREAD_NORMSAVE(offset)(THREAD_NORMSAVES + (offset * 4))
 
-#define NORMAL_EXCEPTION_PROLOG
 \
+#define NORMAL_EXCEPTION_PROLOG(intno) 
 \
mtspr   SPRN_SPRG_WSCRATCH0, r10;   /* save one register */  \
mfspr   r10, SPRN_SPRG_THREAD;   \
stw r11, THREAD_NORMSAVE(0)(r10);\
@@ -113,7 +115,7 @@
  * registers as the normal prolog above. Instead we use a portion of the
  * critical/machine check exception stack at low physical addresses.
  */
-#define EXC_LEVEL_EXCEPTION_PROLOG(exc_level, exc_level_srr0, exc_level_srr1) \
+#define EXC_LEVEL_EXCEPTION_PROLOG(exc_level, intno, exc_level_srr0, 
exc_level_srr1) \
mtspr   SPRN_SPRG_WSCRATCH_##exc_level,r8;   \
BOOKE_LOAD_EXC_LEVEL_STACK(exc_level);/* r8 points to the exc_level 
stack*/ \
stw r9,GPR9(r8);/* save various registers  */\
@@ -162,12 +164,13 @@
SAVE_4GPRS(3, r11);  \
SAVE_2GPRS(7, r11)