mirror of
https://github.com/torvalds/linux.git
synced 2026-05-29 17:43:52 +02:00
s390/cpufeature: Convert MACHINE_HAS_EDAT2 to cpu_has_edat2()
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
2e2ff71feb
commit
3f5eede6df
|
|
@ -11,10 +11,6 @@
|
|||
#include <linux/printk.h>
|
||||
#include <asm/physmem_info.h>
|
||||
|
||||
struct machine_info {
|
||||
unsigned char has_edat2 : 1;
|
||||
};
|
||||
|
||||
struct vmlinux_info {
|
||||
unsigned long entry;
|
||||
unsigned long image_size; /* does not include .bss */
|
||||
|
|
|
|||
|
|
@ -39,8 +39,6 @@ int __bootdata_preserved(relocate_lowcore);
|
|||
u64 __bootdata_preserved(stfle_fac_list[16]);
|
||||
struct oldmem_data __bootdata_preserved(oldmem_data);
|
||||
|
||||
struct machine_info machine;
|
||||
|
||||
void error(char *x)
|
||||
{
|
||||
boot_emerg("%s\n", x);
|
||||
|
|
@ -52,8 +50,6 @@ static void detect_facilities(void)
|
|||
{
|
||||
if (cpu_has_edat1())
|
||||
local_ctl_set_bit(0, CR0_EDAT_BIT);
|
||||
if (test_facility(78))
|
||||
machine.has_edat2 = 1;
|
||||
page_noexec_mask = -1UL;
|
||||
segment_noexec_mask = -1UL;
|
||||
region_noexec_mask = -1UL;
|
||||
|
|
|
|||
|
|
@ -315,7 +315,7 @@ static unsigned long try_get_large_pud_pa(pud_t *pu_dir, unsigned long addr, uns
|
|||
{
|
||||
unsigned long pa, size = end - addr;
|
||||
|
||||
if (!machine.has_edat2 || !large_page_mapping_allowed(mode) ||
|
||||
if (!cpu_has_edat2() || !large_page_mapping_allowed(mode) ||
|
||||
!IS_ALIGNED(addr, PUD_SIZE) || (size < PUD_SIZE))
|
||||
return INVALID_PHYS_ADDR;
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ enum {
|
|||
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_nx() test_facility(130)
|
||||
#define cpu_has_rdp() test_facility(194)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
#define MACHINE_FLAG_DIAG9C BIT(3)
|
||||
#define MACHINE_FLAG_ESOP BIT(4)
|
||||
#define MACHINE_FLAG_IDTE BIT(5)
|
||||
#define MACHINE_FLAG_EDAT2 BIT(8)
|
||||
#define MACHINE_FLAG_TE BIT(11)
|
||||
#define MACHINE_FLAG_TLB_GUEST BIT(14)
|
||||
#define MACHINE_FLAG_SCC BIT(17)
|
||||
|
|
@ -78,7 +77,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_EDAT2 (get_lowcore()->machine_flags & MACHINE_FLAG_EDAT2)
|
||||
#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)
|
||||
|
|
|
|||
|
|
@ -237,8 +237,6 @@ static __init void detect_diag9c(void)
|
|||
|
||||
static __init void detect_machine_facilities(void)
|
||||
{
|
||||
if (test_facility(78))
|
||||
get_lowcore()->machine_flags |= MACHINE_FLAG_EDAT2;
|
||||
if (test_facility(3))
|
||||
get_lowcore()->machine_flags |= MACHINE_FLAG_IDTE;
|
||||
if (test_facility(50) && test_facility(73)) {
|
||||
|
|
|
|||
|
|
@ -961,7 +961,7 @@ void __init setup_arch(char **cmdline_p)
|
|||
setup_uv();
|
||||
dma_contiguous_reserve(ident_map_size);
|
||||
vmcp_cma_reserve();
|
||||
if (MACHINE_HAS_EDAT2)
|
||||
if (cpu_has_edat2())
|
||||
hugetlb_cma_reserve(PUD_SHIFT - PAGE_SHIFT);
|
||||
|
||||
reserve_crashkernel();
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ bool __init arch_hugetlb_valid_size(unsigned long size)
|
|||
{
|
||||
if (cpu_has_edat1() && size == PMD_SIZE)
|
||||
return true;
|
||||
else if (MACHINE_HAS_EDAT2 && size == PUD_SIZE)
|
||||
else if (cpu_has_edat2() && size == PUD_SIZE)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ static void pgt_set(unsigned long *old, unsigned long new, unsigned long addr,
|
|||
unsigned long *table, mask;
|
||||
|
||||
mask = 0;
|
||||
if (MACHINE_HAS_EDAT2) {
|
||||
if (cpu_has_edat2()) {
|
||||
switch (dtt) {
|
||||
case CRDTE_DTT_REGION3:
|
||||
mask = ~(PTRS_PER_PUD * sizeof(pud_t) - 1);
|
||||
|
|
|
|||
|
|
@ -336,7 +336,7 @@ static int modify_pud_table(p4d_t *p4d, unsigned long addr, unsigned long end,
|
|||
} else if (pud_none(*pud)) {
|
||||
if (IS_ALIGNED(addr, PUD_SIZE) &&
|
||||
IS_ALIGNED(next, PUD_SIZE) &&
|
||||
MACHINE_HAS_EDAT2 && direct &&
|
||||
cpu_has_edat2() && direct &&
|
||||
!debug_pagealloc_enabled()) {
|
||||
set_pud(pud, __pud(__pa(addr) | prot));
|
||||
pages++;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user