mirror of
https://github.com/torvalds/linux.git
synced 2026-05-24 23:22:31 +02:00
s390/cpufeature: Convert MACHINE_HAS_IDTE to cpu_has_idte()
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>
This commit is contained in:
parent
3f5eede6df
commit
949b73c990
|
|
@ -25,6 +25,7 @@ int cpu_have_feature(unsigned int nr);
|
|||
#define cpu_has_edat1() test_facility(8)
|
||||
#define cpu_has_edat2() test_facility(78)
|
||||
#define cpu_has_gs() test_facility(133)
|
||||
#define cpu_has_idte() test_facility(3)
|
||||
#define cpu_has_nx() test_facility(130)
|
||||
#define cpu_has_rdp() test_facility(194)
|
||||
#define cpu_has_seq_insn() test_facility(85)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@
|
|||
#define MACHINE_FLAG_LPAR BIT(2)
|
||||
#define MACHINE_FLAG_DIAG9C BIT(3)
|
||||
#define MACHINE_FLAG_ESOP BIT(4)
|
||||
#define MACHINE_FLAG_IDTE BIT(5)
|
||||
#define MACHINE_FLAG_TE BIT(11)
|
||||
#define MACHINE_FLAG_TLB_GUEST BIT(14)
|
||||
#define MACHINE_FLAG_SCC BIT(17)
|
||||
|
|
@ -76,7 +75,6 @@ extern unsigned long mio_wb_bit_mask;
|
|||
|
||||
#define MACHINE_HAS_DIAG9C (get_lowcore()->machine_flags & MACHINE_FLAG_DIAG9C)
|
||||
#define MACHINE_HAS_ESOP (get_lowcore()->machine_flags & MACHINE_FLAG_ESOP)
|
||||
#define MACHINE_HAS_IDTE (get_lowcore()->machine_flags & MACHINE_FLAG_IDTE)
|
||||
#define MACHINE_HAS_TE (get_lowcore()->machine_flags & MACHINE_FLAG_TE)
|
||||
#define MACHINE_HAS_TLB_GUEST (get_lowcore()->machine_flags & MACHINE_FLAG_TLB_GUEST)
|
||||
#define MACHINE_HAS_SCC (get_lowcore()->machine_flags & MACHINE_FLAG_SCC)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#ifndef _S390_TLBFLUSH_H
|
||||
#define _S390_TLBFLUSH_H
|
||||
|
||||
#include <linux/cpufeature.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/sched.h>
|
||||
#include <asm/processor.h>
|
||||
|
|
@ -52,7 +53,7 @@ static inline void __tlb_flush_mm(struct mm_struct *mm)
|
|||
cpumask_copy(mm_cpumask(mm), &mm->context.cpu_attach_mask);
|
||||
barrier();
|
||||
gmap_asce = READ_ONCE(mm->context.gmap_asce);
|
||||
if (MACHINE_HAS_IDTE && gmap_asce != -1UL) {
|
||||
if (cpu_has_idte() && gmap_asce != -1UL) {
|
||||
if (gmap_asce)
|
||||
__tlb_flush_idte(gmap_asce);
|
||||
__tlb_flush_idte(mm->context.asce);
|
||||
|
|
@ -66,7 +67,7 @@ static inline void __tlb_flush_mm(struct mm_struct *mm)
|
|||
|
||||
static inline void __tlb_flush_kernel(void)
|
||||
{
|
||||
if (MACHINE_HAS_IDTE)
|
||||
if (cpu_has_idte())
|
||||
__tlb_flush_idte(init_mm.context.asce);
|
||||
else
|
||||
__tlb_flush_global();
|
||||
|
|
|
|||
|
|
@ -237,8 +237,6 @@ static __init void detect_diag9c(void)
|
|||
|
||||
static __init void detect_machine_facilities(void)
|
||||
{
|
||||
if (test_facility(3))
|
||||
get_lowcore()->machine_flags |= MACHINE_FLAG_IDTE;
|
||||
if (test_facility(50) && test_facility(73)) {
|
||||
get_lowcore()->machine_flags |= MACHINE_FLAG_TE;
|
||||
system_ctl_set_bit(0, CR0_TRANSACTIONAL_EXECUTION_BIT);
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
* Janosch Frank <frankja@linux.vnet.ibm.com>
|
||||
*/
|
||||
|
||||
#include <linux/cpufeature.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/pagewalk.h>
|
||||
#include <linux/swap.h>
|
||||
|
|
@ -135,7 +136,7 @@ EXPORT_SYMBOL_GPL(gmap_create);
|
|||
|
||||
static void gmap_flush_tlb(struct gmap *gmap)
|
||||
{
|
||||
if (MACHINE_HAS_IDTE)
|
||||
if (cpu_has_idte())
|
||||
__tlb_flush_idte(gmap->asce);
|
||||
else
|
||||
__tlb_flush_global();
|
||||
|
|
@ -2028,7 +2029,7 @@ static void gmap_pmdp_xchg(struct gmap *gmap, pmd_t *pmdp, pmd_t new,
|
|||
if (MACHINE_HAS_TLB_GUEST)
|
||||
__pmdp_idte(gaddr, (pmd_t *)pmdp, IDTE_GUEST_ASCE, gmap->asce,
|
||||
IDTE_GLOBAL);
|
||||
else if (MACHINE_HAS_IDTE)
|
||||
else if (cpu_has_idte())
|
||||
__pmdp_idte(gaddr, (pmd_t *)pmdp, 0, 0, IDTE_GLOBAL);
|
||||
else
|
||||
__pmdp_csp(pmdp);
|
||||
|
|
@ -2106,7 +2107,7 @@ void gmap_pmdp_idte_local(struct mm_struct *mm, unsigned long vmaddr)
|
|||
if (MACHINE_HAS_TLB_GUEST)
|
||||
__pmdp_idte(gaddr, pmdp, IDTE_GUEST_ASCE,
|
||||
gmap->asce, IDTE_LOCAL);
|
||||
else if (MACHINE_HAS_IDTE)
|
||||
else if (cpu_has_idte())
|
||||
__pmdp_idte(gaddr, pmdp, 0, 0, IDTE_LOCAL);
|
||||
*pmdp = __pmd(_SEGMENT_ENTRY_EMPTY);
|
||||
}
|
||||
|
|
@ -2139,7 +2140,7 @@ void gmap_pmdp_idte_global(struct mm_struct *mm, unsigned long vmaddr)
|
|||
if (MACHINE_HAS_TLB_GUEST)
|
||||
__pmdp_idte(gaddr, pmdp, IDTE_GUEST_ASCE,
|
||||
gmap->asce, IDTE_GLOBAL);
|
||||
else if (MACHINE_HAS_IDTE)
|
||||
else if (cpu_has_idte())
|
||||
__pmdp_idte(gaddr, pmdp, 0, 0, IDTE_GLOBAL);
|
||||
else
|
||||
__pmdp_csp(pmdp);
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ static void pgt_set(unsigned long *old, unsigned long new, unsigned long addr,
|
|||
}
|
||||
table = (unsigned long *)((unsigned long)old & mask);
|
||||
crdte(*old, new, table, dtt, addr, get_lowcore()->kernel_asce.val);
|
||||
} else if (MACHINE_HAS_IDTE) {
|
||||
} else if (cpu_has_idte()) {
|
||||
cspg(old, *old, new);
|
||||
} else {
|
||||
csp((unsigned int *)old + 1, *old, new);
|
||||
|
|
|
|||
|
|
@ -392,7 +392,7 @@ static inline void pmdp_idte_global(struct mm_struct *mm,
|
|||
mm->context.asce, IDTE_GLOBAL);
|
||||
if (mm_has_pgste(mm) && mm->context.allow_gmap_hpage_1m)
|
||||
gmap_pmdp_idte_global(mm, addr);
|
||||
} else if (MACHINE_HAS_IDTE) {
|
||||
} else if (cpu_has_idte()) {
|
||||
__pmdp_idte(addr, pmdp, 0, 0, IDTE_GLOBAL);
|
||||
if (mm_has_pgste(mm) && mm->context.allow_gmap_hpage_1m)
|
||||
gmap_pmdp_idte_global(mm, addr);
|
||||
|
|
@ -519,7 +519,7 @@ static inline void pudp_idte_global(struct mm_struct *mm,
|
|||
if (MACHINE_HAS_TLB_GUEST)
|
||||
__pudp_idte(addr, pudp, IDTE_NODAT | IDTE_GUEST_ASCE,
|
||||
mm->context.asce, IDTE_GLOBAL);
|
||||
else if (MACHINE_HAS_IDTE)
|
||||
else if (cpu_has_idte())
|
||||
__pudp_idte(addr, pudp, 0, 0, IDTE_GLOBAL);
|
||||
else
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user