Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

KVM: arm64: Simplify handling of full register invalid constraint

Now that we embed the RESx bits in the register description, it becomes
easier to deal with registers that are simply not valid, as their
existence is not satisfied by the configuration (SCTLR2_ELx without
FEAT_SCTLR2, for example). Such registers essentially become RES0 for
any bit that wasn't already advertised as RESx.

Reviewed-by: Fuad Tabba <tabba@google.com>
Tested-by: Fuad Tabba <tabba@google.com>
Link: https://patch.msgid.link/20260202184329.2724080-17-maz@kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>

+9 -6
+9 -6
arch/arm64/kvm/config.c
··· 1321 1321 unsigned long require, 1322 1322 unsigned long exclude) 1323 1323 { 1324 - struct resx resx, tmp; 1324 + struct resx resx; 1325 1325 1326 1326 resx = compute_resx_bits(kvm, r->bit_feat_map, r->bit_feat_map_sz, 1327 1327 require, exclude); ··· 1331 1331 resx.res1 |= r->feat_map.masks->res1; 1332 1332 } 1333 1333 1334 - tmp = compute_resx_bits(kvm, &r->feat_map, 1, require, exclude); 1335 - 1336 - resx.res0 |= tmp.res0; 1337 - resx.res0 |= ~reg_feat_map_bits(&r->feat_map); 1338 - resx.res1 |= tmp.res1; 1334 + /* 1335 + * If the register itself was not valid, all the non-RESx bits are 1336 + * now considered RES0 (this matches the behaviour of registers such 1337 + * as SCTLR2 and TCR2). Weed out any potential (though unlikely) 1338 + * overlap with RES1 bits coming from the previous computation. 1339 + */ 1340 + resx.res0 |= compute_resx_bits(kvm, &r->feat_map, 1, require, exclude).res0; 1341 + resx.res1 &= ~resx.res0; 1339 1342 1340 1343 return resx; 1341 1344 }