* Re: [kvm-ppc-devel] [PATCH] [1/4] Add per guest pvr
2008-01-30 12:31 [kvm-ppc-devel] [PATCH] [1/4] Add per guest pvr ehrhardt
@ 2008-01-30 21:18 ` Hollis Blanchard
2008-01-30 21:40 ` Hollis Blanchard
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Hollis Blanchard @ 2008-01-30 21:18 UTC (permalink / raw)
To: kvm-ppc
On Wed, 2008-01-30 at 13:31 +0100, ehrhardt@linux.vnet.ibm.com wrote:
> This adds get/set pvr to differ wanted guest cpu on runtiome.
> The intention to bring it up so early at the vm ioctl is that our kernel code
> can not know if which guest type we want to create on vcpu_create. Vcpu_create
> itself do not transport any structure and and is called before our hooks in
> the machine initialization.
The analogue for x86 is cpuid, and that's handled as a vcpu ioctl. Of
course, they don't go all the way with it, because their guests are
somewhat tied to the host hardware (hardware manages e.g. guest register
state).
> We want to have our implementation ready to run different guest types at the
> same time, therefore we can't set this globally at the /dev/kvm ioctl.
> Currently this sets the pvr per machine while in the architecture itself it
> is a per processor attribute (this binds us to one processor type per virtual
> machine). If needed we might change this so that vcpu_create uses the last set
> vm pvr as pvr for a new cpu e.g create generic followed by coprocesser
> sequentially - comments?
Yes, I really don't like it. :) I think this should be a per-vcpu ioctl,
and then we must make sure we've allocated enough vcpu memory for any
guest architecture type (see vcpu_size as passed to kvm_init()).
> Additionally this may later be extended to select the real pvr that e.g.
> will be presented to what a guest sees on a read to that spr. here the patch
> as it is atm folowed by the tlb patch that uses the function to select the
> right tlb layout.
Why aren't you using real PVR numbers already?
Anyways, this probably isn't worth spending too much time on now. The
immediate need is for the TLB accessors, and I think we can base those
on the PVR without a full multi-arch guest solution.
--
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
kvm-ppc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [kvm-ppc-devel] [PATCH] [1/4] Add per guest pvr
2008-01-30 12:31 [kvm-ppc-devel] [PATCH] [1/4] Add per guest pvr ehrhardt
2008-01-30 21:18 ` Hollis Blanchard
@ 2008-01-30 21:40 ` Hollis Blanchard
2008-01-31 8:37 ` Christian Ehrhardt
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Hollis Blanchard @ 2008-01-30 21:40 UTC (permalink / raw)
To: kvm-ppc
On Wed, 2008-01-30 at 15:18 -0600, Hollis Blanchard wrote:
>
> Anyways, this probably isn't worth spending too much time on now. The
> immediate need is for the TLB accessors, and I think we can base those
> on the PVR without a full multi-arch guest solution.
Forgot to explain...
It looks like arch->vcpu.pvr is totally uninitialized right now. (I'm
surprised the guest hasn't complained.) Instead of setting it from
userspace, could you send a patch that initializes it to the hardware's
PVR value? It's a simple patch, and you can use that to disambiguate the
TLB stuff in later patches.
We can discuss the best way to handle this long term, but right now I
think virtual IO is more important.
--
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
kvm-ppc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [kvm-ppc-devel] [PATCH] [1/4] Add per guest pvr
2008-01-30 12:31 [kvm-ppc-devel] [PATCH] [1/4] Add per guest pvr ehrhardt
2008-01-30 21:18 ` Hollis Blanchard
2008-01-30 21:40 ` Hollis Blanchard
@ 2008-01-31 8:37 ` Christian Ehrhardt
2008-01-31 14:56 ` ehrhardt
2008-02-01 13:31 ` Zhang Wei
4 siblings, 0 replies; 6+ messages in thread
From: Christian Ehrhardt @ 2008-01-31 8:37 UTC (permalink / raw)
To: kvm-ppc
Hollis Blanchard wrote:
> On Wed, 2008-01-30 at 13:31 +0100, ehrhardt@linux.vnet.ibm.com wrote:
>> This adds get/set pvr to differ wanted guest cpu on runtiome.
>> The intention to bring it up so early at the vm ioctl is that our kernel code
>> can not know if which guest type we want to create on vcpu_create. Vcpu_create
>> itself do not transport any structure and and is called before our hooks in
>> the machine initialization.
>
> The analogue for x86 is cpuid, and that's handled as a vcpu ioctl. Of
> course, they don't go all the way with it, because their guests are
> somewhat tied to the host hardware (hardware manages e.g. guest register
> state).
>
>> We want to have our implementation ready to run different guest types at the
>> same time, therefore we can't set this globally at the /dev/kvm ioctl.
>> Currently this sets the pvr per machine while in the architecture itself it
>> is a per processor attribute (this binds us to one processor type per virtual
>> machine). If needed we might change this so that vcpu_create uses the last set
>> vm pvr as pvr for a new cpu e.g create generic followed by coprocesser
>> sequentially - comments?
>
> Yes, I really don't like it. :) I think this should be a per-vcpu ioctl,
> and then we must make sure we've allocated enough vcpu memory for any
> guest architecture type (see vcpu_size as passed to kvm_init()).
ok, fine for me. It was you who suggested that we need it on create, but allocating
enough for all possible cases is ok for me. I'll change the pvr stuff.
>> Additionally this may later be extended to select the real pvr that e.g.
>> will be presented to what a guest sees on a read to that spr. here the patch
>> as it is atm folowed by the tlb patch that uses the function to select the
>> right tlb layout.
>
> Why aren't you using real PVR numbers already?
To be honest I did not want to decide which of the numerous 440 types I should set
and I didn't need to use that pvr&mask match atm.
> Anyways, this probably isn't worth spending too much time on now. The
> immediate need is for the TLB accessors, and I think we can base those
> on the PVR without a full multi-arch guest solution.
I'll let it be virtual pvr's - we can change them later without issues anyway.
--
Grüsse / regards,
Christian Ehrhardt
IBM Linux Technology Center, Open Virtualization
-------------------------------------------------------------------------
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
kvm-ppc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* [kvm-ppc-devel] [PATCH] [1/4] Add per guest pvr
2008-01-30 12:31 [kvm-ppc-devel] [PATCH] [1/4] Add per guest pvr ehrhardt
` (2 preceding siblings ...)
2008-01-31 8:37 ` Christian Ehrhardt
@ 2008-01-31 14:56 ` ehrhardt
2008-02-01 13:31 ` Zhang Wei
4 siblings, 0 replies; 6+ messages in thread
From: ehrhardt @ 2008-01-31 14:56 UTC (permalink / raw)
To: kvm-ppc
Changed according to the comments of the first submission.
Subject: [PATCH] [1/4] Add per guest pvr
From: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
This adds a per vcpu call to get/set the the pvr in vcpu->arch.
Signed-off-by: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
---
arch/powerpc/kvm/powerpc.c | 13 +++++++++++++
include/asm-powerpc/kvm.h | 9 +++++++++
include/linux/kvm.h | 3 +++
3 files changed, 25 insertions(+)
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -779,6 +779,19 @@ long kvm_arch_vcpu_ioctl(struct file *fi
r = kvm_vcpu_ioctl_interrupt(vcpu, &irq);
break;
}
+ case KVM_SET_GUEST_PVR: {
+ struct kvm_pvr __user *upvr = (struct kvm_pvr __user *)arg;
+ r = copy_from_user(&(vcpu->arch.pvr), &(upvr->pvr),
+ sizeof(__u32));
+ break;
+ }
+ case KVM_GET_GUEST_PVR: {
+ struct kvm_pvr __user *upvr = (struct kvm_pvr __user *)arg;
+ struct kvm_pvr kpvr;
+ kpvr.pvr = vcpu->arch.pvr;
+ r = copy_to_user(upvr, &kpvr, sizeof(struct kvm_pvr));
+ break;
+ }
default:
r = -EINVAL;
}
diff --git a/include/asm-powerpc/kvm.h b/include/asm-powerpc/kvm.h
--- a/include/asm-powerpc/kvm.h
+++ b/include/asm-powerpc/kvm.h
@@ -53,4 +53,13 @@ struct kvm_fpu {
struct kvm_fpu {
};
+/*
+ * guest ident based on virtual pvr's to differ between cpu types
+ * this may later on be extended to appear and behave as real pvr's
+*/
+#define KVM_PPC_PVR_PPC440EP 0x422218D3
+
+struct kvm_pvr {
+ __u32 pvr;
+};
#endif /* __POWERPC_KVM_H__ */
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -249,6 +249,7 @@ struct kvm_vapic_addr {
#define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46,\
struct kvm_userspace_memory_region)
#define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47)
+
/*
* KVM_CREATE_VCPU receives as a parameter the vcpu slot, and returns
* a vcpu fd.
@@ -288,5 +289,7 @@ struct kvm_vapic_addr {
#define KVM_TPR_ACCESS_REPORTING _IOWR(KVMIO, 0x92, struct kvm_tpr_access_ctl)
/* Available with KVM_CAP_VAPIC */
#define KVM_SET_VAPIC_ADDR _IOW(KVMIO, 0x93, struct kvm_vapic_addr)
+#define KVM_SET_GUEST_PVR _IOW(KVMIO, 0x94, struct kvm_pvr)
+#define KVM_GET_GUEST_PVR _IOR(KVMIO, 0x95, struct kvm_pvr)
#endif
-------------------------------------------------------------------------
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
kvm-ppc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [kvm-ppc-devel] [PATCH] [1/4] Add per guest pvr
2008-01-30 12:31 [kvm-ppc-devel] [PATCH] [1/4] Add per guest pvr ehrhardt
` (3 preceding siblings ...)
2008-01-31 14:56 ` ehrhardt
@ 2008-02-01 13:31 ` Zhang Wei
4 siblings, 0 replies; 6+ messages in thread
From: Zhang Wei @ 2008-02-01 13:31 UTC (permalink / raw)
To: kvm-ppc
Hi, Christian,
Thanks! Very clear!
But, could you please rebase your patch to Hollis' most recent codes?
Cheers!
Wei.
> -----Original Message-----
> From: ehrhardt@linux.vnet.ibm.com
> [mailto:ehrhardt@linux.vnet.ibm.com]
> Sent: Thursday, January 31, 2008 10:57 PM
> To: kvm-ppc-devel
> Cc: Zhang Wei; Hollis Blanchard; jyoung5@us.ibm.com;
> ehrhardt@linux.vnet.ibm.com
> Subject: [PATCH] [1/4] Add per guest pvr
>
> Changed according to the comments of the first submission.
>
> Subject: [PATCH] [1/4] Add per guest pvr
> From: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
>
> This adds a per vcpu call to get/set the the pvr in vcpu->arch.
>
> Signed-off-by: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
> ---
>
> arch/powerpc/kvm/powerpc.c | 13 +++++++++++++
> include/asm-powerpc/kvm.h | 9 +++++++++
> include/linux/kvm.h | 3 +++
> 3 files changed, 25 insertions(+)
>
> diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
> --- a/arch/powerpc/kvm/powerpc.c
> +++ b/arch/powerpc/kvm/powerpc.c
> @@ -779,6 +779,19 @@ long kvm_arch_vcpu_ioctl(struct file *fi
> r = kvm_vcpu_ioctl_interrupt(vcpu, &irq);
> break;
> }
> + case KVM_SET_GUEST_PVR: {
> + struct kvm_pvr __user *upvr = (struct kvm_pvr
> __user *)arg;
> + r = copy_from_user(&(vcpu->arch.pvr), &(upvr->pvr),
> + sizeof(__u32));
> + break;
> + }
> + case KVM_GET_GUEST_PVR: {
> + struct kvm_pvr __user *upvr = (struct kvm_pvr
> __user *)arg;
> + struct kvm_pvr kpvr;
> + kpvr.pvr = vcpu->arch.pvr;
> + r = copy_to_user(upvr, &kpvr, sizeof(struct kvm_pvr));
> + break;
> + }
> default:
> r = -EINVAL;
> }
> diff --git a/include/asm-powerpc/kvm.h b/include/asm-powerpc/kvm.h
> --- a/include/asm-powerpc/kvm.h
> +++ b/include/asm-powerpc/kvm.h
> @@ -53,4 +53,13 @@ struct kvm_fpu {
> struct kvm_fpu {
> };
>
> +/*
> + * guest ident based on virtual pvr's to differ between cpu types
> + * this may later on be extended to appear and behave as real pvr's
> +*/
> +#define KVM_PPC_PVR_PPC440EP 0x422218D3
> +
> +struct kvm_pvr {
> + __u32 pvr;
> +};
> #endif /* __POWERPC_KVM_H__ */
> diff --git a/include/linux/kvm.h b/include/linux/kvm.h
> --- a/include/linux/kvm.h
> +++ b/include/linux/kvm.h
> @@ -249,6 +249,7 @@ struct kvm_vapic_addr {
> #define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46,\
> struct
> kvm_userspace_memory_region)
> #define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47)
> +
> /*
> * KVM_CREATE_VCPU receives as a parameter the vcpu slot, and returns
> * a vcpu fd.
> @@ -288,5 +289,7 @@ struct kvm_vapic_addr {
> #define KVM_TPR_ACCESS_REPORTING _IOWR(KVMIO, 0x92, struct
> kvm_tpr_access_ctl)
> /* Available with KVM_CAP_VAPIC */
> #define KVM_SET_VAPIC_ADDR _IOW(KVMIO, 0x93, struct
> kvm_vapic_addr)
> +#define KVM_SET_GUEST_PVR _IOW(KVMIO, 0x94, struct kvm_pvr)
> +#define KVM_GET_GUEST_PVR _IOR(KVMIO, 0x95, struct kvm_pvr)
>
> #endif
>
-------------------------------------------------------------------------
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
kvm-ppc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
^ permalink raw reply [flat|nested] 6+ messages in thread