Skip to content

Commit f15dcf1

Browse files
author
Marc Zyngier
committed
KVM: arm64: selftests: get-reg-list: Add pauth configuration
The get-reg-list test ignores the Pointer Authentication features, which is a shame now that we have relatively common HW with this feature. Define two new configurations (with and without PMU) that exercise the KVM capabilities. Signed-off-by: Marc Zyngier <[email protected]> Reviewed-by: Andrew Jones <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent dda0190 commit f15dcf1

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

tools/testing/selftests/kvm/aarch64/get-reg-list.c

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,22 @@ static __u64 sve_rejects_set[] = {
10141014
KVM_REG_ARM64_SVE_VLS,
10151015
};
10161016

1017+
static __u64 pauth_addr_regs[] = {
1018+
ARM64_SYS_REG(3, 0, 2, 1, 0), /* APIAKEYLO_EL1 */
1019+
ARM64_SYS_REG(3, 0, 2, 1, 1), /* APIAKEYHI_EL1 */
1020+
ARM64_SYS_REG(3, 0, 2, 1, 2), /* APIBKEYLO_EL1 */
1021+
ARM64_SYS_REG(3, 0, 2, 1, 3), /* APIBKEYHI_EL1 */
1022+
ARM64_SYS_REG(3, 0, 2, 2, 0), /* APDAKEYLO_EL1 */
1023+
ARM64_SYS_REG(3, 0, 2, 2, 1), /* APDAKEYHI_EL1 */
1024+
ARM64_SYS_REG(3, 0, 2, 2, 2), /* APDBKEYLO_EL1 */
1025+
ARM64_SYS_REG(3, 0, 2, 2, 3) /* APDBKEYHI_EL1 */
1026+
};
1027+
1028+
static __u64 pauth_generic_regs[] = {
1029+
ARM64_SYS_REG(3, 0, 2, 3, 0), /* APGAKEYLO_EL1 */
1030+
ARM64_SYS_REG(3, 0, 2, 3, 1), /* APGAKEYHI_EL1 */
1031+
};
1032+
10171033
#define BASE_SUBLIST \
10181034
{ "base", .regs = base_regs, .regs_n = ARRAY_SIZE(base_regs), }
10191035
#define VREGS_SUBLIST \
@@ -1025,6 +1041,21 @@ static __u64 sve_rejects_set[] = {
10251041
{ "sve", .capability = KVM_CAP_ARM_SVE, .feature = KVM_ARM_VCPU_SVE, .finalize = true, \
10261042
.regs = sve_regs, .regs_n = ARRAY_SIZE(sve_regs), \
10271043
.rejects_set = sve_rejects_set, .rejects_set_n = ARRAY_SIZE(sve_rejects_set), }
1044+
#define PAUTH_SUBLIST \
1045+
{ \
1046+
.name = "pauth_address", \
1047+
.capability = KVM_CAP_ARM_PTRAUTH_ADDRESS, \
1048+
.feature = KVM_ARM_VCPU_PTRAUTH_ADDRESS, \
1049+
.regs = pauth_addr_regs, \
1050+
.regs_n = ARRAY_SIZE(pauth_addr_regs), \
1051+
}, \
1052+
{ \
1053+
.name = "pauth_generic", \
1054+
.capability = KVM_CAP_ARM_PTRAUTH_GENERIC, \
1055+
.feature = KVM_ARM_VCPU_PTRAUTH_GENERIC, \
1056+
.regs = pauth_generic_regs, \
1057+
.regs_n = ARRAY_SIZE(pauth_generic_regs), \
1058+
}
10281059

10291060
static struct vcpu_config vregs_config = {
10301061
.sublists = {
@@ -1056,11 +1087,30 @@ static struct vcpu_config sve_pmu_config = {
10561087
{0},
10571088
},
10581089
};
1090+
static struct vcpu_config pauth_config = {
1091+
.sublists = {
1092+
BASE_SUBLIST,
1093+
VREGS_SUBLIST,
1094+
PAUTH_SUBLIST,
1095+
{0},
1096+
},
1097+
};
1098+
static struct vcpu_config pauth_pmu_config = {
1099+
.sublists = {
1100+
BASE_SUBLIST,
1101+
VREGS_SUBLIST,
1102+
PAUTH_SUBLIST,
1103+
PMU_SUBLIST,
1104+
{0},
1105+
},
1106+
};
10591107

10601108
static struct vcpu_config *vcpu_configs[] = {
10611109
&vregs_config,
10621110
&vregs_pmu_config,
10631111
&sve_config,
10641112
&sve_pmu_config,
1113+
&pauth_config,
1114+
&pauth_pmu_config,
10651115
};
10661116
static int vcpu_configs_n = ARRAY_SIZE(vcpu_configs);

0 commit comments

Comments
 (0)