linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: arm64: Don't use FIELD_PREP() in initialisers
@ 2025-11-25 20:17 Marc Zyngier
  2025-11-25 21:25 ` Oliver Upton
  0 siblings, 1 reply; 2+ messages in thread
From: Marc Zyngier @ 2025-11-25 20:17 UTC (permalink / raw)
  To: kvmarm, linux-arm-kernel, kvm
  Cc: Joey Gouly, Suzuki K Poulose, Oliver Upton, Zenghui Yu,
	Nathan Chancellor

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 <nathan@kernel.org>
Fixes: 81e9fe5c6f25d ("KVM: arm64: Teach ptdump about FEAT_XNX permissions")
Closes: https://lore.kernel.org/r/20251125173929.GA3256322@ax162
Signed-off-by: Marc Zyngier <maz@kernel.org>
---
 arch/arm64/kvm/ptdump.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/kvm/ptdump.c b/arch/arm64/kvm/ptdump.c
index bd722383d0e3f..6cbe018fd6fda 100644
--- a/arch/arm64/kvm/ptdump.c
+++ b/arch/arm64/kvm/ptdump.c
@@ -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",
 	},
 	{
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] KVM: arm64: Don't use FIELD_PREP() in initialisers
  2025-11-25 20:17 [PATCH] KVM: arm64: Don't use FIELD_PREP() in initialisers Marc Zyngier
@ 2025-11-25 21:25 ` Oliver Upton
  0 siblings, 0 replies; 2+ messages in thread
From: Oliver Upton @ 2025-11-25 21:25 UTC (permalink / raw)
  To: kvmarm, linux-arm-kernel, kvm, Marc Zyngier
  Cc: Oliver Upton, Joey Gouly, Suzuki K Poulose, Zenghui Yu,
	Nathan Chancellor

On Tue, 25 Nov 2025 20:17:15 +0000, Marc Zyngier wrote:
> 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.
> 
> [...]

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-11-25 21:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-25 20:17 [PATCH] KVM: arm64: Don't use FIELD_PREP() in initialisers Marc Zyngier
2025-11-25 21:25 ` Oliver Upton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).