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: Kill KVM_PGTABLE_S2_NOFWB

Nobody is using this flag anymore, so remove it. This allows
some cleanup by removing stage2_has_fwb(), which is can be replaced
by a direct check on the capability.

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-5-maz@kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>

+8 -20
+2 -5
arch/arm64/include/asm/kvm_pgtable.h
··· 229 229 230 230 /** 231 231 * enum kvm_pgtable_stage2_flags - Stage-2 page-table flags. 232 - * @KVM_PGTABLE_S2_NOFWB: Don't enforce Normal-WB even if the CPUs have 233 - * ARM64_HAS_STAGE2_FWB. 234 232 * @KVM_PGTABLE_S2_IDMAP: Only use identity mappings. 235 233 * @KVM_PGTABLE_S2_AS_S1: Final memory attributes are that of Stage-1. 236 234 */ 237 235 enum kvm_pgtable_stage2_flags { 238 - KVM_PGTABLE_S2_NOFWB = BIT(0), 239 - KVM_PGTABLE_S2_IDMAP = BIT(1), 240 - KVM_PGTABLE_S2_AS_S1 = BIT(2), 236 + KVM_PGTABLE_S2_IDMAP = BIT(0), 237 + KVM_PGTABLE_S2_AS_S1 = BIT(1), 241 238 }; 242 239 243 240 /**
+6 -15
arch/arm64/kvm/hyp/pgtable.c
··· 631 631 return vtcr; 632 632 } 633 633 634 - static bool stage2_has_fwb(struct kvm_pgtable *pgt) 635 - { 636 - if (!cpus_have_final_cap(ARM64_HAS_STAGE2_FWB)) 637 - return false; 638 - 639 - return !(pgt->flags & KVM_PGTABLE_S2_NOFWB); 640 - } 641 - 642 634 void kvm_tlb_flush_vmid_range(struct kvm_s2_mmu *mmu, 643 635 phys_addr_t addr, size_t size) 644 636 { ··· 653 661 654 662 #define KVM_S2_MEMATTR(pgt, attr) \ 655 663 ({ \ 664 + bool __fwb = cpus_have_final_cap(ARM64_HAS_STAGE2_FWB); \ 656 665 kvm_pte_t __attr; \ 657 666 \ 658 667 if ((pgt)->flags & KVM_PGTABLE_S2_AS_S1) \ 659 - __attr = PAGE_S2_MEMATTR(AS_S1, \ 660 - stage2_has_fwb(pgt)); \ 668 + __attr = PAGE_S2_MEMATTR(AS_S1, __fwb); \ 661 669 else \ 662 - __attr = PAGE_S2_MEMATTR(attr, \ 663 - stage2_has_fwb(pgt)); \ 670 + __attr = PAGE_S2_MEMATTR(attr, __fwb); \ 664 671 \ 665 672 __attr; \ 666 673 }) ··· 871 880 * system supporting FWB as the optimization is entirely 872 881 * pointless when the unmap walker needs to perform CMOs. 873 882 */ 874 - return system_supports_tlb_range() && stage2_has_fwb(pgt); 883 + return system_supports_tlb_range() && cpus_have_final_cap(ARM64_HAS_STAGE2_FWB); 875 884 } 876 885 877 886 static void stage2_unmap_put_pte(const struct kvm_pgtable_visit_ctx *ctx, ··· 1151 1160 if (mm_ops->page_count(childp) != 1) 1152 1161 return 0; 1153 1162 } else if (stage2_pte_cacheable(pgt, ctx->old)) { 1154 - need_flush = !stage2_has_fwb(pgt); 1163 + need_flush = !cpus_have_final_cap(ARM64_HAS_STAGE2_FWB); 1155 1164 } 1156 1165 1157 1166 /* ··· 1381 1390 .arg = pgt, 1382 1391 }; 1383 1392 1384 - if (stage2_has_fwb(pgt)) 1393 + if (cpus_have_final_cap(ARM64_HAS_STAGE2_FWB)) 1385 1394 return 0; 1386 1395 1387 1396 return kvm_pgtable_walk(pgt, addr, size, &walker);