KVM: arm64: Don't use FIELD_PREP() in initialisers
Marc Zyngier
maintainerPATCH 1/1 KVM: arm64: Don't use FIELD_PREP() in initialisers
Nathan reports that compiling with CONFIG_PTDUMP_STAGE2_DEBUGFS results in a compilation failure, with the compiler moaning about "braced-group within expression allowed only inside a function"...
Replace FIELD_PREP() with its shifting primitive, which does the trick here.
Reported-by Nathan Chancellor <[email protected]>
Fixes 81e9fe5c6f25d ("KVM: arm64: Teach ptdump about FEAT_XNX permissions")
Signed-off-by Marc Zyngier <[email protected]>
--- arch/arm64/kvm/ptdump.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/kvm/ptdump.c +4 -4
@@ -46,22 +46,22 @@ static const struct ptdump_prot_bits stage2_pte_bits[] = { }, { .mask = KVM_PTE_LEAF_ATTR_HI_S2_XN, - .val = FIELD_PREP(KVM_PTE_LEAF_ATTR_HI_S2_XN, 0b00), + .val = 0b00UL << __bf_shf(KVM_PTE_LEAF_ATTR_HI_S2_XN), .set = "px ux ", }, { .mask = KVM_PTE_LEAF_ATTR_HI_S2_XN, - .val = FIELD_PREP(KVM_PTE_LEAF_ATTR_HI_S2_XN, 0b01), + .val = 0b01UL << __bf_shf(KVM_PTE_LEAF_ATTR_HI_S2_XN), .set = "PXNux ", }, { .mask = KVM_PTE_LEAF_ATTR_HI_S2_XN, - .val = FIELD_PREP(KVM_PTE_LEAF_ATTR_HI_S2_XN, 0b10), + .val = 0b10UL << __bf_shf(KVM_PTE_LEAF_ATTR_HI_S2_XN), .set = "PXNUXN", }, { .mask = KVM_PTE_LEAF_ATTR_HI_S2_XN, - .val = FIELD_PREP(KVM_PTE_LEAF_ATTR_HI_S2_XN, 0b11), + .val = 0b11UL << __bf_shf(KVM_PTE_LEAF_ATTR_HI_S2_XN), .set = "px UXN", }, {
Signature · 1 line
2.47.3
Quoted 8 lines · Marc Zyngier
Nathan reports that compiling with
CONFIG_PTDUMP_STAGE2_DEBUGFSresults in a compilation failure, with the compiler moaning about "braced-group within expression allowed only inside a function"...Replace
FIELD_PREP()with its shifting primitive, which does the trick here.[...]
Applied to next, thanks!
[1/1] KVM: arm64: Don't use FIELD_PREP() in initialisers
https://git.kernel.org/kvmarm/kvmarm/c/5742f3650013
--
Best,
Oliver