Skip to content

Commit 65d00e3

Browse files
author
Marc Zyngier
committed
KVM: arm64: Simplify PAGE_S2_MEMATTR
Restore PAGE_S2_MEMATTR() to its former glory, keeping the use of FWB as an implementation detail. 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/20260123191637.715429-6-maz@kernel.org Signed-off-by: Marc Zyngier <maz@kernel.org>
1 parent 4f27fe8 commit 65d00e3

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

arch/arm64/include/asm/pgtable-prot.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ static inline bool __pure lpa2_is_enabled(void)
109109
#define PAGE_KERNEL_EXEC __pgprot(_PAGE_KERNEL_EXEC)
110110
#define PAGE_KERNEL_EXEC_CONT __pgprot(_PAGE_KERNEL_EXEC_CONT)
111111

112-
#define PAGE_S2_MEMATTR(attr, has_fwb) \
112+
#define PAGE_S2_MEMATTR(attr) \
113113
({ \
114114
u64 __val; \
115-
if (has_fwb) \
115+
if (cpus_have_final_cap(ARM64_HAS_STAGE2_FWB)) \
116116
__val = PTE_S2_MEMATTR(MT_S2_FWB_ ## attr); \
117117
else \
118118
__val = PTE_S2_MEMATTR(MT_S2_ ## attr); \

arch/arm64/kvm/hyp/pgtable.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -653,13 +653,12 @@ void kvm_tlb_flush_vmid_range(struct kvm_s2_mmu *mmu,
653653

654654
#define KVM_S2_MEMATTR(pgt, attr) \
655655
({ \
656-
bool __fwb = cpus_have_final_cap(ARM64_HAS_STAGE2_FWB); \
657656
kvm_pte_t __attr; \
658657
\
659658
if ((pgt)->flags & KVM_PGTABLE_S2_AS_S1) \
660-
__attr = PAGE_S2_MEMATTR(AS_S1, __fwb); \
659+
__attr = PAGE_S2_MEMATTR(AS_S1); \
661660
else \
662-
__attr = PAGE_S2_MEMATTR(attr, __fwb); \
661+
__attr = PAGE_S2_MEMATTR(attr); \
663662
\
664663
__attr; \
665664
})

0 commit comments

Comments
 (0)