Skip to content

Commit 352df1d

Browse files
mcaramanagraf
authored andcommitted
KVM: PPC: booke: Get/set guest EPCR register using ONE_REG interface
Implement ONE_REG interface for EPCR register adding KVM_REG_PPC_EPCR to the list of ONE_REG PPC supported registers. Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com> [agraf: remove HV dependency, use get/put_user] Signed-off-by: Alexander Graf <agraf@suse.de>
1 parent 38f9882 commit 352df1d

3 files changed

Lines changed: 17 additions & 0 deletions

File tree

‎Documentation/virtual/kvm/api.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1773,6 +1773,7 @@ registers, find a list below:
17731773
PPC | KVM_REG_PPC_VPA_ADDR | 64
17741774
PPC | KVM_REG_PPC_VPA_SLB | 128
17751775
PPC | KVM_REG_PPC_VPA_DTL | 128
1776+
PPC | KVM_REG_PPC_EPCR | 32
17761777

17771778
4.69 KVM_GET_ONE_REG
17781779

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,4 +411,6 @@ struct kvm_get_htab_header {
411411
#define KVM_REG_PPC_VPA_SLB (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x83)
412412
#define KVM_REG_PPC_VPA_DTL (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x84)
413413

414+
#define KVM_REG_PPC_EPCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x85)
415+
414416
#endif /* __LINUX_KVM_POWERPC_H */

‎arch/powerpc/kvm/booke.c‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,6 +1388,11 @@ int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
13881388
&vcpu->arch.dbg_reg.dac[dac], sizeof(u64));
13891389
break;
13901390
}
1391+
#if defined(CONFIG_64BIT)
1392+
case KVM_REG_PPC_EPCR:
1393+
r = put_user(vcpu->arch.epcr, (u32 __user *)(long)reg->addr);
1394+
break;
1395+
#endif
13911396
default:
13921397
break;
13931398
}
@@ -1415,6 +1420,15 @@ int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
14151420
(u64 __user *)(long)reg->addr, sizeof(u64));
14161421
break;
14171422
}
1423+
#if defined(CONFIG_64BIT)
1424+
case KVM_REG_PPC_EPCR: {
1425+
u32 new_epcr;
1426+
r = get_user(new_epcr, (u32 __user *)(long)reg->addr);
1427+
if (r == 0)
1428+
kvmppc_set_epcr(vcpu, new_epcr);
1429+
break;
1430+
}
1431+
#endif
14181432
default:
14191433
break;
14201434
}

0 commit comments

Comments
 (0)