Skip to content

Commit e9eb790

Browse files
ShivaprasadGBhatmpe
authored andcommitted
KVM: PPC: Book3S HV: Add one-reg interface for HASHKEYR register
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 <[email protected]> Reviewed-by: Nicholas Piggin <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://msgid.link/[email protected]
1 parent 2d6be3c commit e9eb790

File tree

5 files changed

+10
-0
lines changed

5 files changed

+10
-0
lines changed

Documentation/virt/kvm/api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2439,6 +2439,7 @@ registers, find a list below:
24392439
PPC KVM_REG_PPC_PSSCR 64
24402440
PPC KVM_REG_PPC_DEC_EXPIRY 64
24412441
PPC KVM_REG_PPC_PTCR 64
2442+
PPC KVM_REG_PPC_HASHKEYR 64
24422443
PPC KVM_REG_PPC_DAWR1 64
24432444
PPC KVM_REG_PPC_DAWRX1 64
24442445
PPC KVM_REG_PPC_DEXCR 64

arch/powerpc/include/asm/kvm_host.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,7 @@ struct kvm_vcpu_arch {
600600
ulong dawr1;
601601
ulong dawrx1;
602602
ulong dexcr;
603+
ulong hashkeyr;
603604
ulong ciabr;
604605
ulong cfar;
605606
ulong ppr;

arch/powerpc/include/uapi/asm/kvm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,7 @@ struct kvm_ppc_cpu_char {
646646
#define KVM_REG_PPC_DAWR1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc4)
647647
#define KVM_REG_PPC_DAWRX1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc5)
648648
#define KVM_REG_PPC_DEXCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc6)
649+
#define KVM_REG_PPC_HASHKEYR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc7)
649650

650651
/* Transactional Memory checkpointed state:
651652
* This is all GPRs, all VSX regs and a subset of SPRs

arch/powerpc/kvm/book3s_hv.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2352,6 +2352,9 @@ static int kvmppc_get_one_reg_hv(struct kvm_vcpu *vcpu, u64 id,
23522352
case KVM_REG_PPC_DEXCR:
23532353
*val = get_reg_val(id, kvmppc_get_dexcr_hv(vcpu));
23542354
break;
2355+
case KVM_REG_PPC_HASHKEYR:
2356+
*val = get_reg_val(id, kvmppc_get_hashkeyr_hv(vcpu));
2357+
break;
23552358
case KVM_REG_PPC_CIABR:
23562359
*val = get_reg_val(id, kvmppc_get_ciabr_hv(vcpu));
23572360
break;
@@ -2598,6 +2601,9 @@ static int kvmppc_set_one_reg_hv(struct kvm_vcpu *vcpu, u64 id,
25982601
case KVM_REG_PPC_DEXCR:
25992602
kvmppc_set_dexcr_hv(vcpu, set_reg_val(id, *val));
26002603
break;
2604+
case KVM_REG_PPC_HASHKEYR:
2605+
kvmppc_set_hashkeyr_hv(vcpu, set_reg_val(id, *val));
2606+
break;
26012607
case KVM_REG_PPC_CIABR:
26022608
kvmppc_set_ciabr_hv(vcpu, set_reg_val(id, *val));
26032609
/* Don't allow setting breakpoints in hypervisor code */

arch/powerpc/kvm/book3s_hv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ KVMPPC_BOOK3S_HV_VCPU_ACCESSOR(dawr1, 64, KVMPPC_GSID_DAWR1)
117117
KVMPPC_BOOK3S_HV_VCPU_ACCESSOR(dawrx0, 64, KVMPPC_GSID_DAWRX0)
118118
KVMPPC_BOOK3S_HV_VCPU_ACCESSOR(dawrx1, 64, KVMPPC_GSID_DAWRX1)
119119
KVMPPC_BOOK3S_HV_VCPU_ACCESSOR(dexcr, 64, KVMPPC_GSID_DEXCR)
120+
KVMPPC_BOOK3S_HV_VCPU_ACCESSOR(hashkeyr, 64, KVMPPC_GSID_HASHKEYR)
120121
KVMPPC_BOOK3S_HV_VCPU_ACCESSOR(ciabr, 64, KVMPPC_GSID_CIABR)
121122
KVMPPC_BOOK3S_HV_VCPU_ACCESSOR(wort, 64, KVMPPC_GSID_WORT)
122123
KVMPPC_BOOK3S_HV_VCPU_ACCESSOR(ppr, 64, KVMPPC_GSID_PPR)

0 commit comments

Comments
 (0)