Skip to content

Commit 997eeec

Browse files
broonieoupton
authored andcommitted
KVM: arm64: Define helper for EL2 registers with custom visibility
In preparation for adding more visibility filtering for EL2 registers add a helper macro like EL2_REG() which allows specification of a custom visibility operation. Signed-off-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Oliver Upton <[email protected]>
1 parent ee3a9a0 commit 997eeec

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

arch/arm64/kvm/sys_regs.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2171,6 +2171,15 @@ static bool bad_redir_trap(struct kvm_vcpu *vcpu,
21712171
.val = v, \
21722172
}
21732173

2174+
#define EL2_REG_FILTERED(name, acc, rst, v, filter) { \
2175+
SYS_DESC(SYS_##name), \
2176+
.access = acc, \
2177+
.reset = rst, \
2178+
.reg = name, \
2179+
.visibility = filter, \
2180+
.val = v, \
2181+
}
2182+
21742183
#define EL2_REG_VNCR(name, rst, v) EL2_REG(name, bad_vncr_trap, rst, v)
21752184
#define EL2_REG_REDIR(name, rst, v) EL2_REG(name, bad_redir_trap, rst, v)
21762185

@@ -2887,8 +2896,8 @@ static const struct sys_reg_desc sys_reg_descs[] = {
28872896
EL2_REG_VNCR(HFGITR_EL2, reset_val, 0),
28882897
EL2_REG_VNCR(HACR_EL2, reset_val, 0),
28892898

2890-
{ SYS_DESC(SYS_ZCR_EL2), .access = access_zcr_el2, .reset = reset_val,
2891-
.visibility = sve_el2_visibility, .reg = ZCR_EL2 },
2899+
EL2_REG_FILTERED(ZCR_EL2, access_zcr_el2, reset_val, 0,
2900+
sve_el2_visibility),
28922901

28932902
EL2_REG_VNCR(HCRX_EL2, reset_val, 0),
28942903

0 commit comments

Comments
 (0)