]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
KVM: PPC: Book3S HV: Add one-reg interface for HASHKEYR register
authorShivaprasad G Bhat <sbhat@linux.ibm.com>
Wed, 5 Jun 2024 13:07:15 +0000 (13:07 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 6 Jun 2024 12:39:04 +0000 (22:39 +1000)
The patch adds a one-reg register identifier which can be used to
read and set the virtual HASHKEYR for the guest during enter/exit
with KVM_REG_PPC_HASHKEYR. The specific SPR KVM API documentation
too updated.

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/171759283170.1480.12904332463112769129.stgit@linux.ibm.com
Documentation/virt/kvm/api.rst
arch/powerpc/include/asm/kvm_host.h
arch/powerpc/include/uapi/asm/kvm.h
arch/powerpc/kvm/book3s_hv.c
arch/powerpc/kvm/book3s_hv.h

index 81077c6542810feb8f501186c114905c605f3d4b..0c22cb4196d8129a4e58bde018a53d37fd88de65 100644 (file)
@@ -2439,6 +2439,7 @@ registers, find a list below:
   PPC     KVM_REG_PPC_PSSCR               64
   PPC     KVM_REG_PPC_DEC_EXPIRY          64
   PPC     KVM_REG_PPC_PTCR                64
+  PPC     KVM_REG_PPC_HASHKEYR            64
   PPC     KVM_REG_PPC_DAWR1               64
   PPC     KVM_REG_PPC_DAWRX1              64
   PPC     KVM_REG_PPC_DEXCR               64
index 1e2fdcbecffd6898dd2e6d393aa6c4d34b908648..a0cd9dbf534fec7640c056fbf052a5898fa67029 100644 (file)
@@ -600,6 +600,7 @@ struct kvm_vcpu_arch {
        ulong dawr1;
        ulong dawrx1;
        ulong dexcr;
+       ulong hashkeyr;
        ulong ciabr;
        ulong cfar;
        ulong ppr;
index fcb947f65667c9870beca3447cc4debdda067cdc..23a0af739c78bce2fd2160ba2ef87e040ddb197c 100644 (file)
@@ -646,6 +646,7 @@ struct kvm_ppc_cpu_char {
 #define KVM_REG_PPC_DAWR1      (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc4)
 #define KVM_REG_PPC_DAWRX1     (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc5)
 #define KVM_REG_PPC_DEXCR      (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc6)
+#define KVM_REG_PPC_HASHKEYR   (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc7)
 
 /* Transactional Memory checkpointed state:
  * This is all GPRs, all VSX regs and a subset of SPRs
index b4d9c562ebc47a669b10c1164739d1262f04b1f1..993c52facd5d8b23f623ae1143441e1e9736b016 100644 (file)
@@ -2352,6 +2352,9 @@ static int kvmppc_get_one_reg_hv(struct kvm_vcpu *vcpu, u64 id,
        case KVM_REG_PPC_DEXCR:
                *val = get_reg_val(id, kvmppc_get_dexcr_hv(vcpu));
                break;
+       case KVM_REG_PPC_HASHKEYR:
+               *val = get_reg_val(id, kvmppc_get_hashkeyr_hv(vcpu));
+               break;
        case KVM_REG_PPC_CIABR:
                *val = get_reg_val(id, kvmppc_get_ciabr_hv(vcpu));
                break;
@@ -2598,6 +2601,9 @@ static int kvmppc_set_one_reg_hv(struct kvm_vcpu *vcpu, u64 id,
        case KVM_REG_PPC_DEXCR:
                kvmppc_set_dexcr_hv(vcpu, set_reg_val(id, *val));
                break;
+       case KVM_REG_PPC_HASHKEYR:
+               kvmppc_set_hashkeyr_hv(vcpu, set_reg_val(id, *val));
+               break;
        case KVM_REG_PPC_CIABR:
                kvmppc_set_ciabr_hv(vcpu, set_reg_val(id, *val));
                /* Don't allow setting breakpoints in hypervisor code */
index 7b0fd282fe9510579833a8d6455039af094839dd..c073fdfa7dc49053a36b04874673c31685073a99 100644 (file)
@@ -117,6 +117,7 @@ KVMPPC_BOOK3S_HV_VCPU_ACCESSOR(dawr1, 64, KVMPPC_GSID_DAWR1)
 KVMPPC_BOOK3S_HV_VCPU_ACCESSOR(dawrx0, 64, KVMPPC_GSID_DAWRX0)
 KVMPPC_BOOK3S_HV_VCPU_ACCESSOR(dawrx1, 64, KVMPPC_GSID_DAWRX1)
 KVMPPC_BOOK3S_HV_VCPU_ACCESSOR(dexcr, 64, KVMPPC_GSID_DEXCR)
+KVMPPC_BOOK3S_HV_VCPU_ACCESSOR(hashkeyr, 64, KVMPPC_GSID_HASHKEYR)
 KVMPPC_BOOK3S_HV_VCPU_ACCESSOR(ciabr, 64, KVMPPC_GSID_CIABR)
 KVMPPC_BOOK3S_HV_VCPU_ACCESSOR(wort, 64, KVMPPC_GSID_WORT)
 KVMPPC_BOOK3S_HV_VCPU_ACCESSOR(ppr, 64, KVMPPC_GSID_PPR)