Skip to contentSkip to conversation

Pass PVR in sregs

PATCH In review Alexander Graf 2 participants 3 messages Sep 29, 2009 – Oct 10, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/27 Pass PVR in sregs

Right now sregs is unused on PPC, so we can use it for initialization of the CPU.

KVM on BookE always virtualizes the host CPU. On Book3s we go a step further and take the PVR from userspace that tells us what kind of CPU we are supposed to virtualize, because we support Book3s_32 and Book3s_64 guests.

In order to get that information, we use the sregs ioctl, because we don't want to reset the guest CPU on every normal register set.

---
 arch/powerpc/include/asm/kvm.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/powerpc/include/asm/kvm.h +2 -0
index bb2de6a..b82bd68 100644
@@ -46,6 +46,8 @@ struct kvm_regs {
 };
 
 struct kvm_sregs {
+	__u64 pvr;
+	char pad[1016];
 };
 
 struct kvm_fpu {
Signature · 1 line
1.6.0.2
#1 lore raw
Quoted 20 lines · Alexander Graf

Right now sregs is unused on PPC, so we can use it for initialization of the CPU.

KVM on BookE always virtualizes the host CPU. On Book3s we go a step further and take the PVR from userspace that tells us what kind of CPU we are supposed to virtualize, because we support Book3s_32 and Book3s_64 guests.

In order to get that information, we use the sregs ioctl, because we don't want to reset the guest CPU on every normal register set.

---
 arch/powerpc/include/asm/kvm.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/powerpc/include/asm/kvm.h +0 -0
index bb2de6a..b82bd68 100644

arch/powerpc/include/asm/kvm.h struct kvm_regs { · line 53

Quoted 8 lines
arch/powerpc/include/asm/kvm.h +2 -0
@@ -46,6 +46,8 @@ struct kvm_regs {
 };
 
 struct kvm_sregs {
+	__u64 pvr;
+	char pad[1016];
 };
 
 struct kvm_fpu {

Architecturally, PVR is 32 bits, even for PPC64. Is there a reason you want it to be 64 bits here? (I can understand just picking 64 for registers that could be either size, but that's not this case.)

Signature · 2 lines
Hollis Blanchard
IBM Linux Technology Center
#2 lore raw
In reply to Alexander Graf

Am 09.10.2009 um 23:00 schrieb Hollis Blanchard <[email protected]>:

Quoted 32 lines · Alexander Graf
Quoted 31 lines

Right now sregs is unused on PPC, so we can use it for initialization of the CPU.

KVM on BookE always virtualizes the host CPU. On Book3s we go a step further
and take the PVR from userspace that tells us what kind of CPU we are supposed
to virtualize, because we support Book3s_32 and Book3s_64 guests.

In order to get that information, we use the sregs ioctl, because we don't
want to reset the guest CPU on every normal register set.

---
arch/powerpc/include/asm/kvm.h | 2 ++

1 files changed, 2 insertions(+), 0 deletions(-)
arch/powerpc/include/ renamed from arch/powerpc/include/asm/kvm.h +0 -0

asm/kvm.h
index bb2de6a..b82bd68 100644

arch/powerpc/include/asm/kvm.h +2 -0
@@ -46,6 +46,8 @@ struct kvm_regs {
 };
 
 struct kvm_sregs {
+    __u64 pvr;
+    char pad[1016];
 };
 
Quoted 5 lines

arch/powerpc/include/asm/kvm.h struct kvm_regs { · line 53

Quoted 1 line
arch/powerpc/include/asm/kvm.h +0 -0
 struct kvm_fpu {

Architecturally, PVR is 32 bits, even for PPC64. Is there a reason you want it to be 64 bits here? (I can understand just picking 64 for registers that could be either size, but that's not this case.)

No obvious reason. It fills a registerwhich can be up to u64, but if it's limited to u32 we can keep it 32 bits.

Alex

Quoted 5 lines
Signature · 3 lines
-- 
Hollis Blanchard
IBM Linux Technology Center