mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-11-01 09:13:37 +00:00
s390/tlb: Convert MACHINE_HAS_TLB_GUEST to machine_has_tlb_guest()
Use static branch(es) to implement and use machine_has_tlb_guest() instead of a runtime check via MACHINE_HAS_TLB_GUEST. Also add sclp_early_detect_machine_features() in order to allow for feature detection from the decompressor. 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
f931f67cfc
commit
17d3804808
10 changed files with 30 additions and 15 deletions
|
|
@ -482,6 +482,7 @@ void startup_kernel(void)
|
|||
|
||||
read_ipl_report();
|
||||
sclp_early_read_info();
|
||||
sclp_early_detect_machine_features();
|
||||
detect_facilities();
|
||||
cmma_init();
|
||||
sanitize_prot_virt_host();
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#define MFEATURE_LOWCORE 0
|
||||
#define MFEATURE_PCI_MIO 1
|
||||
#define MFEATURE_SCC 2
|
||||
#define MFEATURE_TLB_GUEST 3
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
|
|
@ -80,6 +81,7 @@ static __always_inline bool machine_has_##name(void) \
|
|||
|
||||
DEFINE_MACHINE_HAS_FEATURE(relocated_lowcore, MFEATURE_LOWCORE)
|
||||
DEFINE_MACHINE_HAS_FEATURE(scc, MFEATURE_SCC)
|
||||
DEFINE_MACHINE_HAS_FEATURE(tlb_guest, MFEATURE_TLB_GUEST)
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ASM_S390_MACHINE_H */
|
||||
|
|
|
|||
|
|
@ -168,6 +168,7 @@ int sclp_early_read_storage_info(void);
|
|||
int sclp_early_get_core_info(struct sclp_core_info *info);
|
||||
void sclp_early_get_ipl_info(struct sclp_ipl_info *info);
|
||||
void sclp_early_detect(void);
|
||||
void sclp_early_detect_machine_features(void);
|
||||
void sclp_early_printk(const char *s);
|
||||
void __sclp_early_printk(const char *s, unsigned int len);
|
||||
void sclp_emergency_printk(const char *s);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
#define MACHINE_FLAG_DIAG9C BIT(3)
|
||||
#define MACHINE_FLAG_ESOP BIT(4)
|
||||
#define MACHINE_FLAG_TE BIT(11)
|
||||
#define MACHINE_FLAG_TLB_GUEST BIT(14)
|
||||
|
||||
#define LPP_MAGIC BIT(31)
|
||||
#define LPP_PID_MASK _AC(0xffffffff, UL)
|
||||
|
|
@ -74,7 +73,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_TE (get_lowcore()->machine_flags & MACHINE_FLAG_TE)
|
||||
#define MACHINE_HAS_TLB_GUEST (get_lowcore()->machine_flags & MACHINE_FLAG_TLB_GUEST)
|
||||
|
||||
/*
|
||||
* Console mode. Override with conmode=
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#include <linux/mm.h>
|
||||
#include <linux/sched.h>
|
||||
#include <asm/processor.h>
|
||||
#include <asm/machine.h>
|
||||
|
||||
/*
|
||||
* Flush all TLB entries on the local CPU.
|
||||
|
|
@ -23,7 +24,7 @@ static inline void __tlb_flush_idte(unsigned long asce)
|
|||
unsigned long opt;
|
||||
|
||||
opt = IDTE_PTOA;
|
||||
if (MACHINE_HAS_TLB_GUEST)
|
||||
if (machine_has_tlb_guest())
|
||||
opt |= IDTE_GUEST_ASCE;
|
||||
/* Global TLB flush for the mm */
|
||||
asm volatile("idte 0,%1,%0" : : "a" (opt), "a" (asce) : "cc");
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
#include <asm/access-regs.h>
|
||||
#include <asm/asm-offsets.h>
|
||||
#include <asm/lowcore.h>
|
||||
#include <asm/machine.h>
|
||||
#include <asm/stp.h>
|
||||
#include <asm/gmap.h>
|
||||
#include <asm/nmi.h>
|
||||
|
|
@ -3397,7 +3398,7 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
|
|||
/* we emulate STHYI in kvm */
|
||||
set_kvm_facility(kvm->arch.model.fac_mask, 74);
|
||||
set_kvm_facility(kvm->arch.model.fac_list, 74);
|
||||
if (MACHINE_HAS_TLB_GUEST) {
|
||||
if (machine_has_tlb_guest()) {
|
||||
set_kvm_facility(kvm->arch.model.fac_mask, 147);
|
||||
set_kvm_facility(kvm->arch.model.fac_list, 147);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include <linux/pgtable.h>
|
||||
#include <asm/page-states.h>
|
||||
#include <asm/pgalloc.h>
|
||||
#include <asm/machine.h>
|
||||
#include <asm/gmap.h>
|
||||
#include <asm/page.h>
|
||||
#include <asm/tlb.h>
|
||||
|
|
@ -2026,7 +2027,7 @@ static void gmap_pmdp_xchg(struct gmap *gmap, pmd_t *pmdp, pmd_t new,
|
|||
gaddr &= HPAGE_MASK;
|
||||
pmdp_notify_gmap(gmap, pmdp, gaddr);
|
||||
new = clear_pmd_bit(new, __pgprot(_SEGMENT_ENTRY_GMAP_IN));
|
||||
if (MACHINE_HAS_TLB_GUEST)
|
||||
if (machine_has_tlb_guest())
|
||||
__pmdp_idte(gaddr, (pmd_t *)pmdp, IDTE_GUEST_ASCE, gmap->asce,
|
||||
IDTE_GLOBAL);
|
||||
else if (cpu_has_idte())
|
||||
|
|
@ -2104,7 +2105,7 @@ void gmap_pmdp_idte_local(struct mm_struct *mm, unsigned long vmaddr)
|
|||
WARN_ON(pmd_val(*pmdp) & ~(_SEGMENT_ENTRY_HARDWARE_BITS_LARGE |
|
||||
_SEGMENT_ENTRY_GMAP_UC |
|
||||
_SEGMENT_ENTRY));
|
||||
if (MACHINE_HAS_TLB_GUEST)
|
||||
if (machine_has_tlb_guest())
|
||||
__pmdp_idte(gaddr, pmdp, IDTE_GUEST_ASCE,
|
||||
gmap->asce, IDTE_LOCAL);
|
||||
else if (cpu_has_idte())
|
||||
|
|
@ -2137,7 +2138,7 @@ void gmap_pmdp_idte_global(struct mm_struct *mm, unsigned long vmaddr)
|
|||
WARN_ON(pmd_val(*pmdp) & ~(_SEGMENT_ENTRY_HARDWARE_BITS_LARGE |
|
||||
_SEGMENT_ENTRY_GMAP_UC |
|
||||
_SEGMENT_ENTRY));
|
||||
if (MACHINE_HAS_TLB_GUEST)
|
||||
if (machine_has_tlb_guest())
|
||||
__pmdp_idte(gaddr, pmdp, IDTE_GUEST_ASCE,
|
||||
gmap->asce, IDTE_GLOBAL);
|
||||
else if (cpu_has_idte())
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include <asm/tlbflush.h>
|
||||
#include <asm/mmu_context.h>
|
||||
#include <asm/page-states.h>
|
||||
#include <asm/machine.h>
|
||||
|
||||
pgprot_t pgprot_writecombine(pgprot_t prot)
|
||||
{
|
||||
|
|
@ -50,7 +51,7 @@ static inline void ptep_ipte_local(struct mm_struct *mm, unsigned long addr,
|
|||
{
|
||||
unsigned long opt, asce;
|
||||
|
||||
if (MACHINE_HAS_TLB_GUEST) {
|
||||
if (machine_has_tlb_guest()) {
|
||||
opt = 0;
|
||||
asce = READ_ONCE(mm->context.gmap_asce);
|
||||
if (asce == 0UL || nodat)
|
||||
|
|
@ -70,7 +71,7 @@ static inline void ptep_ipte_global(struct mm_struct *mm, unsigned long addr,
|
|||
{
|
||||
unsigned long opt, asce;
|
||||
|
||||
if (MACHINE_HAS_TLB_GUEST) {
|
||||
if (machine_has_tlb_guest()) {
|
||||
opt = 0;
|
||||
asce = READ_ONCE(mm->context.gmap_asce);
|
||||
if (asce == 0UL || nodat)
|
||||
|
|
@ -375,7 +376,7 @@ void ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr,
|
|||
static inline void pmdp_idte_local(struct mm_struct *mm,
|
||||
unsigned long addr, pmd_t *pmdp)
|
||||
{
|
||||
if (MACHINE_HAS_TLB_GUEST)
|
||||
if (machine_has_tlb_guest())
|
||||
__pmdp_idte(addr, pmdp, IDTE_NODAT | IDTE_GUEST_ASCE,
|
||||
mm->context.asce, IDTE_LOCAL);
|
||||
else
|
||||
|
|
@ -387,7 +388,7 @@ static inline void pmdp_idte_local(struct mm_struct *mm,
|
|||
static inline void pmdp_idte_global(struct mm_struct *mm,
|
||||
unsigned long addr, pmd_t *pmdp)
|
||||
{
|
||||
if (MACHINE_HAS_TLB_GUEST) {
|
||||
if (machine_has_tlb_guest()) {
|
||||
__pmdp_idte(addr, pmdp, IDTE_NODAT | IDTE_GUEST_ASCE,
|
||||
mm->context.asce, IDTE_GLOBAL);
|
||||
if (mm_has_pgste(mm) && mm->context.allow_gmap_hpage_1m)
|
||||
|
|
@ -506,7 +507,7 @@ EXPORT_SYMBOL(pmdp_xchg_lazy);
|
|||
static inline void pudp_idte_local(struct mm_struct *mm,
|
||||
unsigned long addr, pud_t *pudp)
|
||||
{
|
||||
if (MACHINE_HAS_TLB_GUEST)
|
||||
if (machine_has_tlb_guest())
|
||||
__pudp_idte(addr, pudp, IDTE_NODAT | IDTE_GUEST_ASCE,
|
||||
mm->context.asce, IDTE_LOCAL);
|
||||
else
|
||||
|
|
@ -516,7 +517,7 @@ static inline void pudp_idte_local(struct mm_struct *mm,
|
|||
static inline void pudp_idte_global(struct mm_struct *mm,
|
||||
unsigned long addr, pud_t *pudp)
|
||||
{
|
||||
if (MACHINE_HAS_TLB_GUEST)
|
||||
if (machine_has_tlb_guest())
|
||||
__pudp_idte(addr, pudp, IDTE_NODAT | IDTE_GUEST_ASCE,
|
||||
mm->context.asce, IDTE_GLOBAL);
|
||||
else if (cpu_has_idte())
|
||||
|
|
|
|||
|
|
@ -52,8 +52,6 @@ static void __init sclp_early_facilities_detect(void)
|
|||
sclp.has_zpci_lsi = !!(sccb->fac118 & 0x01);
|
||||
if (sccb->fac85 & 0x02)
|
||||
get_lowcore()->machine_flags |= MACHINE_FLAG_ESOP;
|
||||
if (sccb->fac91 & 0x40)
|
||||
get_lowcore()->machine_flags |= MACHINE_FLAG_TLB_GUEST;
|
||||
sclp.has_diag204_bif = !!(sccb->fac98 & 0x80);
|
||||
sclp.has_diag310 = !!(sccb->fac91 & 0x80);
|
||||
if (sccb->cpuoff > 134) {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#include <asm/sections.h>
|
||||
#include <asm/physmem_info.h>
|
||||
#include <asm/facility.h>
|
||||
#include <asm/machine.h>
|
||||
#include "sclp.h"
|
||||
#include "sclp_rw.h"
|
||||
|
||||
|
|
@ -335,6 +336,16 @@ int __init sclp_early_get_hsa_size(unsigned long *hsa_size)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void __init sclp_early_detect_machine_features(void)
|
||||
{
|
||||
struct read_info_sccb *sccb = &sclp_info_sccb;
|
||||
|
||||
if (!sclp_info_sccb_valid)
|
||||
return;
|
||||
if (sccb->fac91 & 0x40)
|
||||
set_machine_feature(MFEATURE_TLB_GUEST);
|
||||
}
|
||||
|
||||
#define SCLP_STORAGE_INFO_FACILITY 0x0000400000000000UL
|
||||
|
||||
void __weak __init add_physmem_online_range(u64 start, u64 end) {}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue