Skip to content

Commit fb86207

Browse files
author
Marc Zyngier
committed
KVM: arm64: Convert HCR_EL2.RW to AS_RES1
Now that we have the AS_RES1 constraint, it becomes trivial to express the HCR_EL2.RW behaviour. Reviewed-by: Fuad Tabba <tabba@google.com> Tested-by: Fuad Tabba <tabba@google.com> Link: https://patch.msgid.link/20260202184329.2724080-10-maz@kernel.org Signed-off-by: Marc Zyngier <maz@kernel.org>
1 parent c27b8b7 commit fb86207

1 file changed

Lines changed: 1 addition & 14 deletions

File tree

arch/arm64/kvm/config.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -389,19 +389,6 @@ static bool feat_vmid16(struct kvm *kvm)
389389
return kvm_has_feat_enum(kvm, ID_AA64MMFR1_EL1, VMIDBits, 16);
390390
}
391391

392-
static bool compute_hcr_rw(struct kvm *kvm, u64 *bits)
393-
{
394-
/* This is purely academic: AArch32 and NV are mutually exclusive */
395-
if (bits) {
396-
if (kvm_has_feat(kvm, FEAT_AA32EL1))
397-
*bits &= ~HCR_EL2_RW;
398-
else
399-
*bits |= HCR_EL2_RW;
400-
}
401-
402-
return true;
403-
}
404-
405392
static bool compute_hcr_e2h(struct kvm *kvm, u64 *bits)
406393
{
407394
if (bits) {
@@ -967,7 +954,7 @@ static const DECLARE_FEAT_MAP(hcrx_desc, __HCRX_EL2,
967954

968955
static const struct reg_bits_to_feat_map hcr_feat_map[] = {
969956
NEEDS_FEAT(HCR_EL2_TID0, FEAT_AA32EL0),
970-
NEEDS_FEAT_FIXED(HCR_EL2_RW, compute_hcr_rw),
957+
NEEDS_FEAT_FLAG(HCR_EL2_RW, AS_RES1, FEAT_AA32EL1),
971958
NEEDS_FEAT(HCR_EL2_HCD, not_feat_aa64el3),
972959
NEEDS_FEAT(HCR_EL2_AMO |
973960
HCR_EL2_BSU |

0 commit comments

Comments
 (0)