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

s390/cpufeature: Convert MACHINE_HAS_RDP to cpu_has_rdp()

Convert MACHINE_HAS_... to cpu_has_...() which uses test_facility() instead
of testing the machine_flags lowcore member if the feature is present.

test_facility() generates better code since it results in a static branch
without accessing memory. The branch is patched via alternatives by the
decompressor depending on the availability of the required facility.

Reviewed-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>

authored by

Heiko Carstens and committed by
Vasily Gorbik
15a36036 679b110b

+4 -6
+1
arch/s390/include/asm/cpufeature.h
··· 22 22 23 23 int cpu_have_feature(unsigned int nr); 24 24 25 + #define cpu_has_rdp() test_facility(194) 25 26 #define cpu_has_seq_insn() test_facility(85) 26 27 27 28 #endif /* __ASM_S390_CPUFEATURE_H */
+3 -2
arch/s390/include/asm/pgtable.h
··· 14 14 15 15 #include <linux/sched.h> 16 16 #include <linux/mm_types.h> 17 + #include <linux/cpufeature.h> 17 18 #include <linux/page-flags.h> 18 19 #include <linux/radix-tree.h> 19 20 #include <linux/atomic.h> ··· 1340 1339 * PTE does not have _PAGE_PROTECT set, to avoid unnecessary overhead. 1341 1340 * A local RDP can be used to do the flush. 1342 1341 */ 1343 - if (MACHINE_HAS_RDP && !(pte_val(*ptep) & _PAGE_PROTECT)) 1342 + if (cpu_has_rdp() && !(pte_val(*ptep) & _PAGE_PROTECT)) 1344 1343 __ptep_rdp(address, ptep, 0, 0, 1); 1345 1344 } 1346 1345 #define flush_tlb_fix_spurious_fault flush_tlb_fix_spurious_fault ··· 1355 1354 { 1356 1355 if (pte_same(*ptep, entry)) 1357 1356 return 0; 1358 - if (MACHINE_HAS_RDP && !mm_has_pgste(vma->vm_mm) && pte_allow_rdp(*ptep, entry)) 1357 + if (cpu_has_rdp() && !mm_has_pgste(vma->vm_mm) && pte_allow_rdp(*ptep, entry)) 1359 1358 ptep_reset_dat_prot(vma->vm_mm, addr, ptep, entry); 1360 1359 else 1361 1360 ptep_xchg_direct(vma->vm_mm, addr, ptep, entry);
-2
arch/s390/include/asm/setup.h
··· 33 33 #define MACHINE_FLAG_GS BIT(16) 34 34 #define MACHINE_FLAG_SCC BIT(17) 35 35 #define MACHINE_FLAG_PCI_MIO BIT(18) 36 - #define MACHINE_FLAG_RDP BIT(19) 37 36 38 37 #define LPP_MAGIC BIT(31) 39 38 #define LPP_PID_MASK _AC(0xffffffff, UL) ··· 93 94 #define MACHINE_HAS_GS (get_lowcore()->machine_flags & MACHINE_FLAG_GS) 94 95 #define MACHINE_HAS_SCC (get_lowcore()->machine_flags & MACHINE_FLAG_SCC) 95 96 #define MACHINE_HAS_PCI_MIO (get_lowcore()->machine_flags & MACHINE_FLAG_PCI_MIO) 96 - #define MACHINE_HAS_RDP (get_lowcore()->machine_flags & MACHINE_FLAG_RDP) 97 97 98 98 /* 99 99 * Console mode. Override with conmode=
-2
arch/s390/kernel/early.c
··· 267 267 get_lowcore()->machine_flags |= MACHINE_FLAG_PCI_MIO; 268 268 /* the control bit is set during PCI initialization */ 269 269 } 270 - if (test_facility(194)) 271 - get_lowcore()->machine_flags |= MACHINE_FLAG_RDP; 272 270 } 273 271 274 272 static inline void save_vector_registers(void)