Skip to content

Commit 459fc4e

Browse files
author
Marc Zyngier
committed
KVM: arm64: Allow RES1 bits to be inferred from configuration
So far, when a bit field is tied to an unsupported feature, we set it as RES0. This is almost correct, but there are a few exceptions where the bits become RES1. Add a AS_RES1 qualifier that instruct the RESx computing code to simply do that. Reviewed-by: Joey Gouly <joey.gouly@arm.com> Reviewed-by: Fuad Tabba <tabba@google.com> Tested-by: Fuad Tabba <tabba@google.com> Link: https://patch.msgid.link/20260202184329.2724080-8-maz@kernel.org Signed-off-by: Marc Zyngier <maz@kernel.org>
1 parent bbea276 commit 459fc4e

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

arch/arm64/kvm/config.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ struct reg_bits_to_feat_map {
2424
#define CALL_FUNC BIT(1) /* Needs to evaluate tons of crap */
2525
#define FIXED_VALUE BIT(2) /* RAZ/WI or RAO/WI in KVM */
2626
#define MASKS_POINTER BIT(3) /* Pointer to fgt_masks struct instead of bits */
27+
#define AS_RES1 BIT(4) /* RES1 when not supported */
2728

2829
unsigned long flags;
2930

@@ -1315,8 +1316,12 @@ static struct resx __compute_fixed_bits(struct kvm *kvm,
13151316
else
13161317
match = idreg_feat_match(kvm, &map[i]);
13171318

1318-
if (!match || (map[i].flags & FIXED_VALUE))
1319-
resx.res0 |= reg_feat_map_bits(&map[i]);
1319+
if (!match || (map[i].flags & FIXED_VALUE)) {
1320+
if (map[i].flags & AS_RES1)
1321+
resx.res1 |= reg_feat_map_bits(&map[i]);
1322+
else
1323+
resx.res0 |= reg_feat_map_bits(&map[i]);
1324+
}
13201325
}
13211326

13221327
return resx;

0 commit comments

Comments
 (0)