mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 01:53:29 +02:00
Merge branch 'dat-enhancement-1'
Heiko Carstens says: ==================== Add the Dat-Enhancement facility 1 to the list of facilities which are required to start the kernel. The facility provides the CSPG and IDTE instructions. In particular the CSPG instruction can be used to replace a valid page table entry with a different page table entry, which also differs in the page frame real address. Without the CSPG instruction it is possible to use the CSP instruction to change valid page table entries, however it only allows to change the lower or higher 32 bits of such entries, which means it cannot be used to change the page frame real address of valid page table entries. Given that there is code around (e.g. HugeTLB vmemmap optimization) which requires to change valid page table entries of the kernel mapping, without the detour over an invalid page table entry, make the CSPG instruction unconditionally available. The Dat-Enhancement facility 1 is available since z990, which is older than the currently supported minimum architecture (z10). Therefore adding this the architecture level set shouldn't cause any problems. ==================== Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
This commit is contained in:
commit
547e9feb0e
|
|
@ -27,7 +27,6 @@ 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)
|
||||
|
|
|
|||
|
|
@ -648,18 +648,6 @@ static inline int mm_uses_skeys(struct mm_struct *mm)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline void csp(unsigned int *ptr, unsigned int old, unsigned int new)
|
||||
{
|
||||
union register_pair r1 = { .even = old, .odd = new, };
|
||||
unsigned long address = (unsigned long)ptr | 1;
|
||||
|
||||
asm volatile(
|
||||
" csp %[r1],%[address]"
|
||||
: [r1] "+&d" (r1.pair), "+m" (*ptr)
|
||||
: [address] "d" (address)
|
||||
: "cc");
|
||||
}
|
||||
|
||||
/**
|
||||
* cspg() - Compare and Swap and Purge (CSPG)
|
||||
* @ptr: Pointer to the value to be exchanged
|
||||
|
|
@ -1402,7 +1390,6 @@ int set_pgste_bits(struct mm_struct *mm, unsigned long addr,
|
|||
int get_pgste(struct mm_struct *mm, unsigned long hva, unsigned long *pgstep);
|
||||
int pgste_perform_essa(struct mm_struct *mm, unsigned long hva, int orc,
|
||||
unsigned long *oldpte, unsigned long *oldpgste);
|
||||
void gmap_pmdp_csp(struct mm_struct *mm, unsigned long vmaddr);
|
||||
void gmap_pmdp_invalidate(struct mm_struct *mm, unsigned long vmaddr);
|
||||
void gmap_pmdp_idte_local(struct mm_struct *mm, unsigned long vmaddr);
|
||||
void gmap_pmdp_idte_global(struct mm_struct *mm, unsigned long vmaddr);
|
||||
|
|
@ -1692,10 +1679,10 @@ static inline pmd_t mk_pmd_phys(unsigned long physpage, pgprot_t pgprot)
|
|||
|
||||
#endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLB_PAGE */
|
||||
|
||||
static inline void __pmdp_csp(pmd_t *pmdp)
|
||||
static inline void __pmdp_cspg(pmd_t *pmdp)
|
||||
{
|
||||
csp((unsigned int *)pmdp + 1, pmd_val(*pmdp),
|
||||
pmd_val(*pmdp) | _SEGMENT_ENTRY_INVALID);
|
||||
cspg((unsigned long *)pmdp, pmd_val(*pmdp),
|
||||
pmd_val(*pmdp) | _SEGMENT_ENTRY_INVALID);
|
||||
}
|
||||
|
||||
#define IDTE_GLOBAL 0
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@ static inline void __tlb_flush_idte(unsigned long asce)
|
|||
*/
|
||||
static inline void __tlb_flush_global(void)
|
||||
{
|
||||
unsigned int dummy = 0;
|
||||
unsigned long dummy = 0;
|
||||
|
||||
csp(&dummy, 0, 0);
|
||||
cspg(&dummy, 0, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -54,7 +54,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 (cpu_has_idte() && gmap_asce != -1UL) {
|
||||
if (gmap_asce != -1UL) {
|
||||
if (gmap_asce)
|
||||
__tlb_flush_idte(gmap_asce);
|
||||
__tlb_flush_idte(mm->context.asce);
|
||||
|
|
@ -68,10 +68,7 @@ static inline void __tlb_flush_mm(struct mm_struct *mm)
|
|||
|
||||
static inline void __tlb_flush_kernel(void)
|
||||
{
|
||||
if (cpu_has_idte())
|
||||
__tlb_flush_idte(init_mm.context.asce);
|
||||
else
|
||||
__tlb_flush_global();
|
||||
__tlb_flush_idte(init_mm.context.asce);
|
||||
}
|
||||
|
||||
static inline void __tlb_flush_mm_lazy(struct mm_struct * mm)
|
||||
|
|
|
|||
|
|
@ -138,10 +138,7 @@ EXPORT_SYMBOL_GPL(gmap_create);
|
|||
|
||||
static void gmap_flush_tlb(struct gmap *gmap)
|
||||
{
|
||||
if (cpu_has_idte())
|
||||
__tlb_flush_idte(gmap->asce);
|
||||
else
|
||||
__tlb_flush_global();
|
||||
__tlb_flush_idte(gmap->asce);
|
||||
}
|
||||
|
||||
static void gmap_radix_tree_free(struct radix_tree_root *root)
|
||||
|
|
@ -1988,10 +1985,8 @@ 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 (cpu_has_idte())
|
||||
__pmdp_idte(gaddr, (pmd_t *)pmdp, 0, 0, IDTE_GLOBAL);
|
||||
else
|
||||
__pmdp_csp(pmdp);
|
||||
__pmdp_idte(gaddr, (pmd_t *)pmdp, 0, 0, IDTE_GLOBAL);
|
||||
set_pmd(pmdp, new);
|
||||
}
|
||||
|
||||
|
|
@ -2012,7 +2007,7 @@ static void gmap_pmdp_clear(struct mm_struct *mm, unsigned long vmaddr,
|
|||
_SEGMENT_ENTRY_GMAP_UC |
|
||||
_SEGMENT_ENTRY));
|
||||
if (purge)
|
||||
__pmdp_csp(pmdp);
|
||||
__pmdp_cspg(pmdp);
|
||||
set_pmd(pmdp, __pmd(_SEGMENT_ENTRY_EMPTY));
|
||||
}
|
||||
spin_unlock(&gmap->guest_table_lock);
|
||||
|
|
@ -2032,17 +2027,6 @@ void gmap_pmdp_invalidate(struct mm_struct *mm, unsigned long vmaddr)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(gmap_pmdp_invalidate);
|
||||
|
||||
/**
|
||||
* gmap_pmdp_csp - csp all affected guest pmd entries
|
||||
* @mm: pointer to the process mm_struct
|
||||
* @vmaddr: virtual address in the process address space
|
||||
*/
|
||||
void gmap_pmdp_csp(struct mm_struct *mm, unsigned long vmaddr)
|
||||
{
|
||||
gmap_pmdp_clear(mm, vmaddr, 1);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(gmap_pmdp_csp);
|
||||
|
||||
/**
|
||||
* gmap_pmdp_idte_local - invalidate and clear a guest pmd entry
|
||||
* @mm: pointer to the process mm_struct
|
||||
|
|
@ -2066,7 +2050,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 (cpu_has_idte())
|
||||
else
|
||||
__pmdp_idte(gaddr, pmdp, 0, 0, IDTE_LOCAL);
|
||||
*pmdp = __pmd(_SEGMENT_ENTRY_EMPTY);
|
||||
}
|
||||
|
|
@ -2099,10 +2083,8 @@ 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 (cpu_has_idte())
|
||||
__pmdp_idte(gaddr, pmdp, 0, 0, IDTE_GLOBAL);
|
||||
else
|
||||
__pmdp_csp(pmdp);
|
||||
__pmdp_idte(gaddr, pmdp, 0, 0, IDTE_GLOBAL);
|
||||
*pmdp = __pmd(_SEGMENT_ENTRY_EMPTY);
|
||||
}
|
||||
spin_unlock(&gmap->guest_table_lock);
|
||||
|
|
|
|||
|
|
@ -78,10 +78,8 @@ 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 (cpu_has_idte()) {
|
||||
cspg(old, *old, new);
|
||||
} else {
|
||||
csp((unsigned int *)old + 1, *old, new);
|
||||
cspg(old, *old, new);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -360,14 +360,10 @@ 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 (cpu_has_idte()) {
|
||||
} else {
|
||||
__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);
|
||||
} else {
|
||||
__pmdp_csp(pmdp);
|
||||
if (mm_has_pgste(mm) && mm->context.allow_gmap_hpage_1m)
|
||||
gmap_pmdp_csp(mm, addr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -487,14 +483,8 @@ 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 (cpu_has_idte())
|
||||
__pudp_idte(addr, pudp, 0, 0, IDTE_GLOBAL);
|
||||
else
|
||||
/*
|
||||
* Invalid bit position is the same for pmd and pud, so we can
|
||||
* reuse _pmd_csp() here
|
||||
*/
|
||||
__pmdp_csp((pmd_t *) pudp);
|
||||
__pudp_idte(addr, pudp, 0, 0, IDTE_GLOBAL);
|
||||
}
|
||||
|
||||
static inline pud_t pudp_flush_direct(struct mm_struct *mm,
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ static struct facility_def facility_defs[] = {
|
|||
.bits = (int[]){
|
||||
0, /* N3 instructions */
|
||||
1, /* z/Arch mode installed */
|
||||
3, /* dat-enhancement 1 */
|
||||
18, /* long displacement facility */
|
||||
21, /* extended-immediate facility */
|
||||
25, /* store clock fast */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user