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

Re: [PATCH 13/20] KVM: arm64: Move RESx into individual register descriptors

From: Marc Zyngier <maz@kernel.org>
Date: 2026-01-30 09:06:13
Also in: kvm, kvmarm

On Thu, 29 Jan 2026 18:13:18 +0000,
Fuad Tabba [off-list ref] wrote:
quoted
Actually, this interacts badly with check_feat_map(), which tries to
find whether we have fully populated the registers, excluding the RESx
bits. But since we consider E2H to be a reserved but, we end-up with:

[    0.141317] kvm [1]: Undefined HCR_EL2 behaviour, bits 0000000400000000

With my approach, it was possible to distinguish the architecturally
RESx bits (defined as RES0 or RES1), as they were the only ones with
the FORCE_RESx attribute.

I can work around it with
diff --git a/arch/arm64/kvm/config.c b/arch/arm64/kvm/config.c
index 364bdd1e5be51..398458f4a6b7b 100644
--- a/arch/arm64/kvm/config.c
+++ b/arch/arm64/kvm/config.c
@@ -1283,7 +1283,7 @@ static void __init check_feat_map(const struct reg_bits_to_feat_map *map,
        u64 mask = 0;

        for (int i = 0; i < map_size; i++)
-               if (!(map[i].flags & FORCE_RESx))
+               if (!(map[i].flags & FORCE_RESx) || !(map[i].bits & resx))
                        mask |= map[i].bits;

        if (mask != ~resx)
but it becomes a bit awkward...
If it becomes more complicated than the original, then what's the
point. Up to you whether you want to try to pursue this or not.
Not more complicated, just moving the complexity somewhere else. I'll
add a comment explaining the logic at this point. Overall, this is a
net cleanup, I think.
From my part:

Reviewed-by: Fuad Tabba <tabba@google.com>
Thank you!

	M.

-- 
Without deviation from the norm, progress is not possible.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help