Remove KVM_HANDLER macro.
Subsystems (2)
PATCH 1/5 Remove KVM_HANDLER macro.
Replace KVM_HANDLER macro by kvm_trampoline_handler() function. Codes define by KVM_HANDLER marco will be extracted by kvm_trampoline_handler install loop.
--- arch/powerpc/kvm/booke_interrupts.S | 32 ++++++-------------------------- arch/powerpc/kvm/powerpc.c | 6 +++++- include/asm-powerpc/kvm_host.h | 1 + 3 files changed, 12 insertions(+), 27 deletions(-)
arch/powerpc/kvm/booke_interrupts.S +6 -26
@@ -39,36 +39,19 @@ #define HOST_STACK_SIZE (((HOST_MIN_STACK_SIZE + 15) / 16) * 16) /* Align. */ #define HOST_STACK_LR (HOST_STACK_SIZE + 4) /* In caller stack frame. */ -.macro KVM_HANDLER ivor_nr -_GLOBAL(kvm_trampoline_handler_\ivor_nr) +_GLOBAL(kvm_trampoline_handler) /* Get pointer to vcpu and record exit number. */ mtspr SPRN_SPRG0, r4 mfspr r4, SPRN_SPRG1 stw r5, VCPU_GPR(r5)(r4) - li r5, \ivor_nr + li r5, 0 /* The SIMM field of this instruction will be replaced + * at install time by ivor_nr. + */ /* This branch is fixed up at install time to jump to * kvm_trampoline_resume_host(). */ b . -.endm - -_GLOBAL(kvm_trampoline_start) - -KVM_HANDLER PPC44x_INTERRUPT_CRITICAL -KVM_HANDLER PPC44x_INTERRUPT_MACHINE_CHECK -KVM_HANDLER PPC44x_INTERRUPT_DATA_STORAGE -KVM_HANDLER PPC44x_INTERRUPT_INST_STORAGE -KVM_HANDLER PPC44x_INTERRUPT_EXTERNAL -KVM_HANDLER PPC44x_INTERRUPT_ALIGNMENT -KVM_HANDLER PPC44x_INTERRUPT_PROGRAM -KVM_HANDLER PPC44x_INTERRUPT_FP_UNAVAIL -KVM_HANDLER PPC44x_INTERRUPT_SYSCALL -KVM_HANDLER PPC44x_INTERRUPT_AP_UNAVAIL -KVM_HANDLER PPC44x_INTERRUPT_DECREMENTER -KVM_HANDLER PPC44x_INTERRUPT_FIT -KVM_HANDLER PPC44x_INTERRUPT_WATCHDOG -KVM_HANDLER PPC44x_INTERRUPT_DTLB_MISS -KVM_HANDLER PPC44x_INTERRUPT_ITLB_MISS -KVM_HANDLER PPC44x_INTERRUPT_DEBUG +_GLOBAL(kvm_trampoline_handler_len) + .long . - kvm_trampoline_handler #define NEED_INST_MASK ((1<<PPC44x_INTERRUPT_PROGRAM) | \ (1<<PPC44x_INTERRUPT_DTLB_MISS))
@@ -208,9 +191,6 @@ _GLOBAL(kvm_trampoline_resume_guest) _GLOBAL(kvm_trampoline_resume_guest_len) .long . - kvm_trampoline_resume_guest -_GLOBAL(kvm_trampoline_handler_len) - .long kvm_trampoline_handler_1 - kvm_trampoline_handler_0 - /* Registers: * SPRG0: guest r4
arch/powerpc/kvm/powerpc.c +5 -1
@@ -466,7 +466,7 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) ivorlist[15 ] =mfspr (SPRN_IVOR15 );for (i =0 ; i <16 ; i++) {memcpy (handlers + ivorlist[i], - kvm_trampoline_start + i * kvm_trampoline_handler_len, + &kvm_trampoline_handler, kvm_trampoline_handler_len); }
@@ -484,9 +484,13 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id)/* Manually fix up the handler branches, since we moved the code away * from its link address. */ for (i =0 ; i <16 ; i++) { +unsigned long *lir5;unsigned long *branch; + lir5 = handlers + ivorlist[i] + kvm_trampoline_handler_len + -8 ; branch = handlers + ivorlist[i] + kvm_trampoline_handler_len -4 ; + *lir5 |= i &0xffff ; *branch |= resume_host - (void *)branch; }
include/asm-powerpc/kvm_host.h +1 -0
@@ -143,6 +143,7 @@ enum emulation_result {extern int __kvmppc_vcpu_run (struct kvm_run *kvm_run,struct kvm_vcpu *vcpu); +extern unsigned long *kvm_trampoline_handler;extern char kvm_trampoline_start[];extern void kvm_trampoline_resume_host (void );extern unsigned long kvm_trampoline_resume_host_len;
Signature · 11 lines
1.5.2 ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ kvm-ppc-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Quoted 3 lines · Zhang Wei
Replace
KVM_HANDLERmacro bykvm_trampoline_handler()function. Codes define byKVM_HANDLERmarco will be extracted bykvm_trampoline_handlerinstall loop.
I got rid of the trampoline stuff in the last patch I sent out, so this doesn't apply any more.
Signature · 12 lines
Hollis Blanchard IBM Linux Technology Center ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ kvm-ppc-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Quoted 100 lines · Zhang Wei
Replace
KVM_HANDLERmacro bykvm_trampoline_handler()function. Codes define byKVM_HANDLERmarco will be extracted bykvm_trampoline_handlerinstall loop.Signed-off-by Zhang Wei <[email protected]>--- arch/powerpc/kvm/booke_interrupts.S | 32 ++++++-------------------------- arch/powerpc/kvm/powerpc.c | 6 +++++- include/asm-powerpc/kvm_host.h | 1 + 3 files changed, 12 insertions(+), 27 deletions(-)arch/powerpc/kvm/booke_interrupts.S +6
-26@@ -39,36 +39,19 @@ #define HOST_STACK_SIZE (((HOST_MIN_STACK_SIZE + 15) / 16) * 16) /* Align. */ #define HOST_STACK_LR (HOST_STACK_SIZE + 4) /* In caller stack frame. */ -.macro KVM_HANDLER ivor_nr -_GLOBAL(kvm_trampoline_handler_\ivor_nr) +_GLOBAL(kvm_trampoline_handler) /* Get pointer to vcpu and record exit number. */ mtspr SPRN_SPRG0, r4 mfspr r4, SPRN_SPRG1 stw r5, VCPU_GPR(r5)(r4) - li r5, \ivor_nr + li r5, 0 /* The SIMM field of this instruction will be replaced + * at install time by ivor_nr. + */ /* This branch is fixed up at install time to jump to * kvm_trampoline_resume_host(). */ b . -.endm - -_GLOBAL(kvm_trampoline_start) - -KVM_HANDLER PPC44x_INTERRUPT_CRITICAL -KVM_HANDLER PPC44x_INTERRUPT_MACHINE_CHECK -KVM_HANDLER PPC44x_INTERRUPT_DATA_STORAGE -KVM_HANDLER PPC44x_INTERRUPT_INST_STORAGE -KVM_HANDLER PPC44x_INTERRUPT_EXTERNAL -KVM_HANDLER PPC44x_INTERRUPT_ALIGNMENT -KVM_HANDLER PPC44x_INTERRUPT_PROGRAM -KVM_HANDLER PPC44x_INTERRUPT_FP_UNAVAIL -KVM_HANDLER PPC44x_INTERRUPT_SYSCALL -KVM_HANDLER PPC44x_INTERRUPT_AP_UNAVAIL -KVM_HANDLER PPC44x_INTERRUPT_DECREMENTER -KVM_HANDLER PPC44x_INTERRUPT_FIT -KVM_HANDLER PPC44x_INTERRUPT_WATCHDOG -KVM_HANDLER PPC44x_INTERRUPT_DTLB_MISS -KVM_HANDLER PPC44x_INTERRUPT_ITLB_MISS -KVM_HANDLER PPC44x_INTERRUPT_DEBUG +_GLOBAL(kvm_trampoline_handler_len) + .long . - kvm_trampoline_handler #define NEED_INST_MASK ((1<<PPC44x_INTERRUPT_PROGRAM) | \ (1<<PPC44x_INTERRUPT_DTLB_MISS))@@ -208,9 +191,6 @@ _GLOBAL(kvm_trampoline_resume_guest) _GLOBAL(kvm_trampoline_resume_guest_len) .long . - kvm_trampoline_resume_guest -_GLOBAL(kvm_trampoline_handler_len) - .long kvm_trampoline_handler_1 - kvm_trampoline_handler_0 - /* Registers: * SPRG0: guest r4arch/powerpc/kvm/powerpc.c +5
-1@@ -466,7 +466,7 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) ivorlist[15 ] =mfspr (SPRN_IVOR15 );for (i =0 ; i <16 ; i++) {memcpy (handlers + ivorlist[i], - kvm_trampoline_start + i * kvm_trampoline_handler_len, + &kvm_trampoline_handler, kvm_trampoline_handler_len); }@@ -484,9 +484,13 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id)/* Manually fix up the handler branches, since we moved the code away * from its link address. */ for (i =0 ; i <16 ; i++) { +unsigned long *lir5;unsigned long *branch; + lir5 = handlers + ivorlist[i] + kvm_trampoline_handler_len + -8 ; branch = handlers + ivorlist[i] + kvm_trampoline_handler_len -4 ; + *lir5 |= i &0xffff ; *branch |= resume_host - (void *)branch; }include/asm-powerpc/kvm_host.h +0
-0
include/asm-powerpc/kvm_host.h enum emulation_result { · line 149
Quoted 7 lines
include/asm-powerpc/kvm_host.h +1
-0@@ -143,6 +143,7 @@ enum emulation_result {extern int __kvmppc_vcpu_run (struct kvm_run *kvm_run,struct kvm_vcpu *vcpu); +extern unsigned long *kvm_trampoline_handler;extern char kvm_trampoline_start[];extern void kvm_trampoline_resume_host (void );extern unsigned long kvm_trampoline_resume_host_len;
Actually, this patch could still apply with some renaming.
However, now that we've gotten away from binary patching the branch instruction, I'm not eager to go back to that with the "li" instruction. Each handler is only 24 bytes, so I'm not that worried about duplicating them, and the readability and simplicity are better with the duplication.
Signature · 12 lines
Hollis Blanchard IBM Linux Technology Center ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ kvm-ppc-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Hi, Hollis,
Quoted 131 lines
-----Original Message-----
From: Hollis Blanchard [mailto:[email protected]]
Sent: Tuesday, January 29, 2008 12:16 PM
To: Zhang Wei
Cc: [email protected]
Subject: Re: [kvm-ppc-devel] [PATCH 1/5] RemoveKVM_HANDLERmacro.Quoted 7 lines · Zhang Wei
Replace
KVM_HANDLERmacro bykvm_trampoline_handler()function. Codes define byKVM_HANDLERmarco will be extracted bykvm_trampoline_handlerinstall loop.Signed-off-by Zhang Wei <[email protected]>--- arch/powerpc/kvm/booke_interrupts.S | 32++++++--------------------------
Review
Quoted 5 lines
arch/powerpc/kvm/powerpc.c | 6 +++++- include/asm-powerpc/kvm_host.h | 1 + 3 files changed, 12 insertions(+), 27 deletions(-)(quoted diff) +0
-0
b/arch/powerpc/kvm/booke_interrupts.Sarch/powerpc/kvm/booke_interrupts.S line 39
Quoted 5 lines
index 45131cc..ec5f071 100644
arch/powerpc/kvm/booke_interrupts.S +0
-0@@ -39,36 +39,19 @@ #define HOST_STACK_SIZE (((HOST_MIN_STACK_SIZE + 15) / 16)* 16) /* Align. */
arch/powerpc/kvm/booke_interrupts.S line 40
Quoted 1 line
arch/powerpc/kvm/booke_interrupts.S +0
-0#define HOST_STACK_LR (HOST_STACK_SIZE + 4) /* In callerstack frame. */
arch/powerpc/kvm/booke_interrupts.S
Quoted 10 lines
arch/powerpc/kvm/booke_interrupts.S +2
-3-.macro KVM_HANDLER ivor_nr -_GLOBAL(kvm_trampoline_handler_\ivor_nr) +_GLOBAL(kvm_trampoline_handler) /* Get pointer to vcpu and record exit number. */ mtspr SPRN_SPRG0, r4 mfspr r4, SPRN_SPRG1 stw r5, VCPU_GPR(r5)(r4) - li r5, \ivor_nr + li r5, 0 /* The SIMM field of this instructionwill be replaced
arch/powerpc/kvm/powerpc.c struct kvm_vcpu
Quoted 45 lines
arch/powerpc/kvm/booke_interrupts.S +4
-23+ * at install time by ivor_nr. + */ /* This branch is fixed up at install time to jump to * kvm_trampoline_resume_host(). */ b . -.endm - -_GLOBAL(kvm_trampoline_start) - -KVM_HANDLER PPC44x_INTERRUPT_CRITICAL -KVM_HANDLER PPC44x_INTERRUPT_MACHINE_CHECK -KVM_HANDLER PPC44x_INTERRUPT_DATA_STORAGE -KVM_HANDLER PPC44x_INTERRUPT_INST_STORAGE -KVM_HANDLER PPC44x_INTERRUPT_EXTERNAL -KVM_HANDLER PPC44x_INTERRUPT_ALIGNMENT -KVM_HANDLER PPC44x_INTERRUPT_PROGRAM -KVM_HANDLER PPC44x_INTERRUPT_FP_UNAVAIL -KVM_HANDLER PPC44x_INTERRUPT_SYSCALL -KVM_HANDLER PPC44x_INTERRUPT_AP_UNAVAIL -KVM_HANDLER PPC44x_INTERRUPT_DECREMENTER -KVM_HANDLER PPC44x_INTERRUPT_FIT -KVM_HANDLER PPC44x_INTERRUPT_WATCHDOG -KVM_HANDLER PPC44x_INTERRUPT_DTLB_MISS -KVM_HANDLER PPC44x_INTERRUPT_ITLB_MISS -KVM_HANDLER PPC44x_INTERRUPT_DEBUG +_GLOBAL(kvm_trampoline_handler_len) + .long . - kvm_trampoline_handler #define NEED_INST_MASK ((1<<PPC44x_INTERRUPT_PROGRAM) | \ (1<<PPC44x_INTERRUPT_DTLB_MISS))@@ -208,9 +191,6 @@ _GLOBAL(kvm_trampoline_resume_guest) _GLOBAL(kvm_trampoline_resume_guest_len) .long . - kvm_trampoline_resume_guest -_GLOBAL(kvm_trampoline_handler_len) - .long kvm_trampoline_handler_1 - kvm_trampoline_handler_0 - /* Registers: * SPRG0: guest r4arch/powerpc/kvm/powerpc.c +0
-0@@ -466,7 +466,7 @@ struct kvm_vcpu*kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id)
arch/powerpc/kvm/powerpc.c struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id)
Quoted 4 lines
arch/powerpc/kvm/powerpc.c +0
-1ivorlist[15 ] =mfspr (SPRN_IVOR15 );for (i =0 ; i <16 ; i++) { memcpy(handlers + ivorlist[i], - kvm_trampoline_start + i *
kvm_trampoline_handler_len,arch/powerpc/kvm/powerpc.c struct kvm_vcpu
Quoted 5 lines
arch/powerpc/kvm/powerpc.c +1
-0+ &kvm_trampoline_handler, kvm_trampoline_handler_len); }@@ -484,9 +484,13 @@ struct kvm_vcpu*kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id)
arch/powerpc/kvm/powerpc.c struct kvm_vcpu · line 484
Quoted 1 line
arch/powerpc/kvm/powerpc.c +0
-0/* Manually fix up the handler branches, since we moved the code away
arch/powerpc/kvm/powerpc.c struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id)
Quoted 5 lines
arch/powerpc/kvm/powerpc.c +2
-0* from its link address. */ for (i =0 ; i <16 ; i++) { +unsigned long *lir5;unsigned long *branch; + lir5 = handlers + ivorlist[i] +
kvm_trampoline_handler_lenarch/powerpc/kvm/powerpc.c struct kvm_vcpu · line 491
Quoted 2 lines
arch/powerpc/kvm/powerpc.c +1
-0+ -8 ; branch = handlers + ivorlist[i] +
kvm_trampoline_handler_lenReview
Quoted 6 lines
arch/powerpc/kvm/powerpc.c +1
-0-4 ; + *lir5 |= i &0xffff ; *branch |= resume_host - (void *)branch; }(quoted diff) +0
-0
b/include/asm-powerpc/kvm_host.hinclude/asm-powerpc/kvm_host.h enum emulation_result { · line 144
Quoted 6 lines
index 088780f..ef57aec 100644
include/asm-powerpc/kvm_host.h +0
-0@@ -143,6 +143,7 @@ enum emulation_result { extern int __kvmppc_vcpu_run(struct kvm_run *kvm_run,struct
kvm_vcpu*vcpu);include/asm-powerpc/kvm_host.h enum emulation_result { · line 149
Quoted 5 lines
include/asm-powerpc/kvm_host.h +1
-0+extern unsigned long *kvm_trampoline_handler;extern char kvm_trampoline_start[];extern void kvm_trampoline_resume_host (void );extern unsigned long kvm_trampoline_resume_host_len;Actually, this patch could still apply with some renaming.
Quoted 8 lines
However, now that we've gotten away from binary patching the branch instruction, I'm not eager to go back to that with the "li" instruction.
Each handler is only 24 bytes, so I'm not that worried about duplicating
them, and the readability and simplicity are better with the duplication.
Another reason is e500 have additional exceptions for SPE exceptions (IVOR32 - IVOR35).
And there are hole from IVOR16 to IVOR 31. If we use fixed macro functions definition,
we will leave blank functions there. How about it?
Cheers!
Wei
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-ppc-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Quoted 10 lines · Zhang Wei
Quoted 9 lines
However, now that we've gotten away from binary patching the branch instruction, I'm not eager to go back to that with the "li" instruction.
Each handler is only 24 bytes, so I'm not that worried about duplicating
them, and the readability and simplicity are better with the duplication.
Quoted 5 lines
Another reason is e500 have additional exceptions for SPE exceptions (IVOR32 - IVOR35).
And there are hole from IVOR16 to IVOR 31. If we use fixed macro functions definition,
we will leave blank functions there. How about it?
True, in that case I think your approach will be best. Could you rebase the patch?
Signature · 12 lines
Hollis Blanchard IBM Linux Technology Center ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ kvm-ppc-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Hi, Hollis,
I'll rebase the patch. And I've put your new patch(01/24) into the tree. :)
Cheers!
Wei.
Quoted 25 lines
-----Original Message-----
From: Hollis Blanchard [mailto:[email protected]]
Sent: Wednesday, January 30, 2008 12:42 AM
To: Zhang Wei
Cc: [email protected]
Subject: RE: [kvm-ppc-devel] [PATCH 1/5] RemoveKVM_HANDLERmacro.Quoted 2 lines · Zhang Wei
Quoted 2 lines
However, now that we've gotten away from binary patching
the branch
Quoted 8 lines
Quoted 7 lines
instruction, I'm not eager to go back to that with the "li" instruction.
Each handler is only 24 bytes, so I'm not that worried about duplicating
them, and the readability and simplicity are better with the duplication.Quoted 5 lines
Another reason is e500 have additional exceptions for SPE exceptions (IVOR32 - IVOR35).
And there are hole from IVOR16 to IVOR 31. If we use fixed macro functions definition,
we will leave blank functions there. How about it?
Quoted 9 lines
True, in that case I think your approach will be best. Could you rebase
the patch?Signature · 2 lines
Hollis Blanchard IBM Linux Technology Center
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-ppc-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel