KVM: PPC: Book3S HV: Add one-reg interface to virtual PTCR register
Subsystems (3)
RFC PATCH 29/32 KVM: PPC: Book3S HV: Add one-reg interface to virtual PTCR register
This adds a one-reg register identifier which can be used to read and set the virtual PTCR for the guest. This register identifies the address and size of the virtual partition table for the guest, which contains information about the nested guests under this guest.
Migrating this value is the only extra requirement for migrating a guest which has nested guests (assuming of course that the destination host supports nested virtualization in the kvm-hv module).
--- Documentation/virtual/kvm/api.txt | 1 + arch/powerpc/include/uapi/asm/kvm.h | 1 + arch/powerpc/kvm/book3s_hv.c | 6 ++++++ 3 files changed, 8 insertions(+)
Documentation/virtual/kvm/api.txt +1 -0
@@ -1922,6 +1922,7 @@ registers, find a list below: PPC | KVM_REG_PPC_TIDR | 64 PPC | KVM_REG_PPC_PSSCR | 64 PPC | KVM_REG_PPC_DEC_EXPIRY | 64 + PPC | KVM_REG_PPC_PTCR | 64 PPC | KVM_REG_PPC_TM_GPR0 | 64 ... PPC | KVM_REG_PPC_TM_GPR31 | 64
arch/powerpc/include/uapi/asm/kvm.h +1 -0
@@ -634,6 +634,7 @@ struct kvm_ppc_cpu_char {#define KVM_REG_PPC_DEC_EXPIRY (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xbe)#define KVM_REG_PPC_ONLINE (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xbf) +#define KVM_REG_PPC_PTCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc0)/* Transactional Memory checkpointed state: * This is all GPRs, all VSX regs and a subset of SPRs
arch/powerpc/kvm/book3s_hv.c +6 -0
@@ -1727,6 +1727,9 @@ static int kvmppc_get_one_reg_hv(struct kvm_vcpu *vcpu, u64 id,case KVM_REG_PPC_ONLINE : *val =get_reg_val (id, vcpu->arch.online);break ; +case KVM_REG_PPC_PTCR : + *val =get_reg_val (id, vcpu->kvm->arch.l1_ptcr); +break ;default : r = -EINVAL ;break ;
@@ -1958,6 +1961,9 @@ static int kvmppc_set_one_reg_hv(struct kvm_vcpu *vcpu, u64 id,atomic_dec (&vcpu->arch.vcore->online_count); vcpu->arch.online = i;break ; +case KVM_REG_PPC_PTCR : + vcpu->kvm->arch.l1_ptcr =set_reg_val (id, *val); +break ;default : r = -EINVAL ;break ;
Signature · 1 line
2.7.4
Quoted 10 lines · Paul Mackerras
This adds a one-reg register identifier which can be used to read and set the virtual PTCR for the guest. This register identifies the address and size of the virtual partition table for the guest, which contains information about the nested guests under this guest.
Migrating this value is the only extra requirement for migrating a guest which has nested guests (assuming of course that the destination host supports nested virtualization in the kvm-hv module).
Signed-off-by Paul Mackerras <[email protected]>
Quoted 54 lines
--- Documentation/virtual/kvm/api.txt | 1 + arch/powerpc/include/uapi/asm/kvm.h | 1 + arch/powerpc/kvm/book3s_hv.c | 6 ++++++ 3 files changed, 8 insertions(+)Documentation/virtual/kvm/api.txt +1
-0@@ -1922,6 +1922,7 @@ registers, find a list below: PPC | KVM_REG_PPC_TIDR | 64 PPC | KVM_REG_PPC_PSSCR | 64 PPC | KVM_REG_PPC_DEC_EXPIRY | 64 + PPC | KVM_REG_PPC_PTCR | 64 PPC | KVM_REG_PPC_TM_GPR0 | 64 PPC | KVM_REG_PPC_TM_GPR31 | 64arch/powerpc/include/uapi/asm/kvm.h +1
-0@@ -634,6 +634,7 @@ struct kvm_ppc_cpu_char {#define KVM_REG_PPC_DEC_EXPIRY (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xbe)#define KVM_REG_PPC_ONLINE (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xbf) +#define KVM_REG_PPC_PTCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc0)/* Transactional Memory checkpointed state: * This is all GPRs, all VSX regs and a subset of SPRs arch/powerpc/kvm/book3s_hv.c +6
-0@@ -1727,6 +1727,9 @@ static int kvmppc_get_one_reg_hv(struct kvm_vcpu *vcpu, u64 id,case KVM_REG_PPC_ONLINE : *val =get_reg_val (id, vcpu->arch.online);break ; +case KVM_REG_PPC_PTCR : + *val =get_reg_val (id, vcpu->kvm->arch.l1_ptcr); +break ;default : r = -EINVAL ;break ;@@ -1958,6 +1961,9 @@ static int kvmppc_set_one_reg_hv(struct kvm_vcpu *vcpu, u64 id,atomic_dec (&vcpu->arch.vcore->online_count); vcpu->arch.online = i;break ; +case KVM_REG_PPC_PTCR : + vcpu->kvm->arch.l1_ptcr =set_reg_val (id, *val); +break ;default : r = -EINVAL ;break ;
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson