Re: [PATCH 2/4] kvmppc: add hypercall infrastructure - guest part
On Friday 22 August 2008 05:38:54 Kumar Gala wrote: > > On Aug 19, 2008, at 5:36 AM, [EMAIL PROTECTED] wrote: > > > From: Christian Ehrhardt <[EMAIL PROTECTED]> > > > > This adds the guest portion of the hypercall infrastructure, > > basically an > > illegal instruction with a defined layout. > > See http://kvm.qumranet.com/kvmwiki/PowerPC_Hypercall_ABI for more > > detail > > on the hypercall ABI for powerpc. > > > > Signed-off-by: Christian Ehrhardt <[EMAIL PROTECTED]> > > --- > > > > [diffstat] > > kvm_para.h | 33 + > > 1 file changed, 33 insertions(+) > > > > [diff] > > Can we make this more generic (naming) and location. I believe there > is some interesting in using the same ABI on the Freescale HV so it > seems like have the wrappers be a bit more generic saves us. Agreed. Maybe something like epapr_hcalls.h . -- Hollis Blanchard IBM Linux Technology Center ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH 2/4] kvmppc: add hypercall infrastructure - guest part
On Aug 19, 2008, at 5:36 AM, [EMAIL PROTECTED] wrote: From: Christian Ehrhardt <[EMAIL PROTECTED]> This adds the guest portion of the hypercall infrastructure, basically an illegal instruction with a defined layout. See http://kvm.qumranet.com/kvmwiki/PowerPC_Hypercall_ABI for more detail on the hypercall ABI for powerpc. Signed-off-by: Christian Ehrhardt <[EMAIL PROTECTED]> --- [diffstat] kvm_para.h | 33 + 1 file changed, 33 insertions(+) [diff] Can we make this more generic (naming) and location. I believe there is some interesting in using the same ABI on the Freescale HV so it seems like have the wrappers be a bit more generic saves us. - k ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH 2/4] kvmppc: add hypercall infrastructure - guest part
On Tue, 2008-08-19 at 13:28 +0200, Arnd Bergmann wrote: > On Tuesday 19 August 2008, [EMAIL PROTECTED] wrote: > > +static inline long kvm_hypercall1(unsigned int nr, unsigned long p1) > > +{ > > + register unsigned long hcall asm ("r0") = nr; > > + register unsigned long arg1 asm ("r3") = p1; > > + register long ret asm ("r11"); > > + > > + asm volatile(".long %1" > > + : "=r"(ret) > > + : "i"(KVM_HYPERCALL_BIN), "r"(hcall), "r"(arg1) > > + : "r4", "r5", "r6", "r7", "r8", > > + "r9", "r10", "r12", "cc"); > > + return ret; > > +} > > What is the reasoning for making the calling convention different from > all the existing hcall interfaces here? > > pseries uses r3 for the hcall number, lv1 and beat use r11, so using > r0 just for the sake of being different seems counterintuitive. There was a really good reason at the time, but I can't seem to remember it now. ;) We're thinking about it. -- Hollis Blanchard IBM Linux Technology Center ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH 2/4] kvmppc: add hypercall infrastructure - guest part
Arnd Bergmann wrote: On Tuesday 19 August 2008, [EMAIL PROTECTED] wrote: +static inline long kvm_hypercall1(unsigned int nr, unsigned long p1) +{ + register unsigned long hcall asm ("r0") = nr; + register unsigned long arg1 asm ("r3") = p1; + register long ret asm ("r11"); + + asm volatile(".long %1" + : "=r"(ret) + : "i"(KVM_HYPERCALL_BIN), "r"(hcall), "r"(arg1) + : "r4", "r5", "r6", "r7", "r8", + "r9", "r10", "r12", "cc"); + return ret; +} What is the reasoning for making the calling convention different from all the existing hcall interfaces here? pseries uses r3 for the hcall number, lv1 and beat use r11, so using r0 just for the sake of being different seems counterintuitive. Arnd <>< Some documentation is here http://kvm.qumranet.com/kvmwiki/PowerPC_Hypercall_ABI As far as I remember it was oriented on system calls, from my point we can still change it atm. When we discussed about that I was too new to the power architecture to really get all the details, but I assume Hollis and Jimi can answer you that. -- Grüsse / regards, Christian Ehrhardt IBM Linux Technology Center, Open Virtualization ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH 2/4] kvmppc: add hypercall infrastructure - guest part
On Tuesday 19 August 2008, [EMAIL PROTECTED] wrote: > +static inline long kvm_hypercall1(unsigned int nr, unsigned long p1) > +{ > + register unsigned long hcall asm ("r0") = nr; > + register unsigned long arg1 asm ("r3") = p1; > + register long ret asm ("r11"); > + > + asm volatile(".long %1" > + : "=r"(ret) > + : "i"(KVM_HYPERCALL_BIN), "r"(hcall), "r"(arg1) > + : "r4", "r5", "r6", "r7", "r8", > + "r9", "r10", "r12", "cc"); > + return ret; > +} What is the reasoning for making the calling convention different from all the existing hcall interfaces here? pseries uses r3 for the hcall number, lv1 and beat use r11, so using r0 just for the sake of being different seems counterintuitive. Arnd <>< ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH 2/4] kvmppc: add hypercall infrastructure - guest part
From: Christian Ehrhardt <[EMAIL PROTECTED]> This adds the guest portion of the hypercall infrastructure, basically an illegal instruction with a defined layout. See http://kvm.qumranet.com/kvmwiki/PowerPC_Hypercall_ABI for more detail on the hypercall ABI for powerpc. Signed-off-by: Christian Ehrhardt <[EMAIL PROTECTED]> --- [diffstat] kvm_para.h | 33 + 1 file changed, 33 insertions(+) [diff] diff --git a/include/asm-powerpc/kvm_para.h b/include/asm-powerpc/kvm_para.h --- a/include/asm-powerpc/kvm_para.h +++ b/include/asm-powerpc/kvm_para.h @@ -25,6 +25,8 @@ #ifdef __KERNEL__ #include + +#define KVM_HYPERCALL_BIN 0x03ff static struct kvmppc_para_features { char *dtcell; @@ -69,6 +71,37 @@ void kvm_guest_init(void); +static inline long kvm_hypercall1(unsigned int nr, unsigned long p1) +{ + register unsigned long hcall asm ("r0") = nr; + register unsigned long arg1 asm ("r3") = p1; + register long ret asm ("r11"); + + asm volatile(".long %1" + : "=r"(ret) + : "i"(KVM_HYPERCALL_BIN), "r"(hcall), "r"(arg1) + : "r4", "r5", "r6", "r7", "r8", + "r9", "r10", "r12", "cc"); + return ret; +} + +static inline long kvm_hypercall2(unsigned int nr, + unsigned long p1, unsigned long p2) +{ + register unsigned long hcall asm ("r0") = nr; + register unsigned long arg1 asm ("r3") = p1; + register unsigned long arg2 asm ("r4") = p2; + register long ret asm ("r11"); + + asm volatile(".long %1" + : "=r"(ret) + : "i"(KVM_HYPERCALL_BIN), "r"(hcall), + "r"(arg1), "r"(arg2) + : "r5", "r6", "r7", "r8", + "r9", "r10", "r12", "cc"); + return ret; +} + #endif /* __KERNEL__ */ #endif /* __POWERPC_KVM_PARA_H__ */ ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev