Thread (53 messages) 53 messages, 3 authors, 2026-02-02

Re: [PATCH 09/20] KVM: arm64: Convert HCR_EL2.RW to AS_RES1

From: Fuad Tabba <tabba@google.com>
Date: 2026-01-27 18:10:04
Also in: kvm, kvmarm

On Mon, 26 Jan 2026 at 12:17, Marc Zyngier [off-list ref] wrote:
Now that we have the AS_RES1 constraint, it becomes trivial to express
the HCR_EL2.RW behaviour.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Fuad Tabba <tabba@google.com>

Cheers,
/fuad
quoted hunk ↗ jump to hunk
---
 arch/arm64/kvm/config.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)
diff --git a/arch/arm64/kvm/config.c b/arch/arm64/kvm/config.c
index 68ed5af2b4d53..39487182057a3 100644
--- a/arch/arm64/kvm/config.c
+++ b/arch/arm64/kvm/config.c
@@ -389,19 +389,6 @@ static bool feat_vmid16(struct kvm *kvm)
        return kvm_has_feat_enum(kvm, ID_AA64MMFR1_EL1, VMIDBits, 16);
 }

-static bool compute_hcr_rw(struct kvm *kvm, u64 *bits)
-{
-       /* This is purely academic: AArch32 and NV are mutually exclusive */
-       if (bits) {
-               if (kvm_has_feat(kvm, FEAT_AA32EL1))
-                       *bits &= ~HCR_EL2_RW;
-               else
-                       *bits |= HCR_EL2_RW;
-       }
-
-       return true;
-}
-
 static bool compute_hcr_e2h(struct kvm *kvm, u64 *bits)
 {
        if (bits) {
@@ -967,7 +954,7 @@ static const DECLARE_FEAT_MAP(hcrx_desc, __HCRX_EL2,

 static const struct reg_bits_to_feat_map hcr_feat_map[] = {
        NEEDS_FEAT(HCR_EL2_TID0, FEAT_AA32EL0),
-       NEEDS_FEAT_FIXED(HCR_EL2_RW, compute_hcr_rw),
+       NEEDS_FEAT_FLAG(HCR_EL2_RW, AS_RES1, FEAT_AA32EL1),
        NEEDS_FEAT(HCR_EL2_HCD, not_feat_aa64el3),
        NEEDS_FEAT(HCR_EL2_AMO          |
                   HCR_EL2_BSU          |
--
2.47.3
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help