From 863680a2a9117da95139ad37b90b282238935ccf Mon Sep 17 00:00:00 2001 From: Dave Hansen Date: Tue, 22 Sep 2026 20:36:58 -0700 Subject: [PATCH 06/75] x86/platform/uv: Remove GRU mapping leftovers UV boot still goes out of its way to accommodate the GRU (Global Reference Unit), the hub's memory-access engine: - map_gru_high() reads the GRU overlay config MMR and creates a write-back identity mapping of the GRU's per-pnode MMIO window, - it records the window in gru_start_paddr/gru_end_paddr so that uv_is_untracked_pat_range(), installed as x86_platform's ->is_untracked_pat_range, can tell PAT to ignore the range, - and uv_setup_hub_info() stashes the GRU base/shift from the GAM parameters table in uv_hub_info for the driver to find. The driver that used all of this is gone: commit 85de4712bccf ("misc: sgi-gru: Remove SGI GRU driver") Nothing maps or touches GRU space anymore, so the mapping and the PAT exclusion have no effect on anything the kernel does; they just cost a chunk of the identity map and an indirect call in the PAT paths. Remove them, which also drops the hub_info fields and UV_GLOBAL_GRU_MMR_BASE. With the GRU gone map_high() only ever maps uncached, so fold the map_type argument away. x86_platform.is_untracked_pat_range falls back to the default is_ISA_range, which is what the UV version did for everything but the GRU window. The GAM parameters table still reports the GRU base and shift and decode_gam_params() still prints them; only the kernel's copy goes away. No functional change intended beyond no longer creating a mapping that had no users. --- arch/x86/include/asm/uv/uv_hub.h | 4 -- arch/x86/kernel/apic/x2apic_uv_x.c | 70 +++--------------------------- 2 files changed, 6 insertions(+), 68 deletions(-) diff --git a/arch/x86/include/asm/uv/uv_hub.h b/arch/x86/include/asm/uv/uv_hub.h index be1b1dacb7449..77c19382e25dc 100644 --- a/arch/x86/include/asm/uv/uv_hub.h +++ b/arch/x86/include/asm/uv/uv_hub.h @@ -168,8 +168,6 @@ struct uv_hub_info_s { unsigned long gnode_upper; unsigned long lowmem_remap_top; unsigned long lowmem_remap_base; - unsigned long global_gru_base; - unsigned long global_gru_shift; unsigned short pnode; unsigned short pnode_mask; unsigned short coherency_domain_number; @@ -331,8 +329,6 @@ union uvh_apicid { #define UV_GLOBAL_MMR64_BASE (uv_hub_info->global_mmr_base) -#define UV_GLOBAL_GRU_MMR_BASE 0x4000000 - #define _UV_GLOBAL_MMR64_PNODE_SHIFT 26 #define UV_GLOBAL_MMR64_PNODE_SHIFT (uv_hub_info->global_mmr_shift) diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c index 42568ceec4816..22dc31b29dc6b 100644 --- a/arch/x86/kernel/apic/x2apic_uv_x.c +++ b/arch/x86/kernel/apic/x2apic_uv_x.c @@ -30,7 +30,6 @@ static enum uv_system_type uv_system_type; static int uv_hubbed_system; static int uv_hubless_system; -static u64 gru_start_paddr, gru_end_paddr; static union uvh_apicid uvh_apicid; static int uv_node_id; @@ -83,19 +82,6 @@ static unsigned long __init uv_early_read_mmr(unsigned long addr) return val; } -static inline bool is_GRU_range(u64 start, u64 end) -{ - if (!gru_start_paddr) - return false; - - return start >= gru_start_paddr && end <= gru_end_paddr; -} - -static bool uv_is_untracked_pat_range(u64 start, u64 end) -{ - return is_ISA_range(start, end) || is_GRU_range(start, end); -} - static void __init early_get_pnodeid(void) { int pnode; @@ -439,7 +425,6 @@ static int __init uv_set_system_type(char *_oem_id, char *_oem_table_id) early_set_apic_mode(); early_get_pnodeid(); early_get_apic_socketid_shift(); - x86_platform.is_untracked_pat_range = uv_is_untracked_pat_range; x86_platform.nmi_init = uv_nmi_init; uv_tsc_check_sync(); @@ -820,10 +805,7 @@ static __init void get_lowmem_redirect(unsigned long *base, unsigned long *size) *base = *size = 0; } -enum map_type {map_wb, map_uc}; -static const char * const mt[] = { "WB", "UC" }; - -static __init void map_high(char *id, unsigned long base, int pshift, int bshift, int max_pnode, enum map_type map_type) +static __init void map_high(char *id, unsigned long base, int pshift, int bshift, int max_pnode) { unsigned long bytes, paddr; @@ -833,43 +815,10 @@ static __init void map_high(char *id, unsigned long base, int pshift, int bshift pr_info("UV: Map %s_HI base address NULL\n", id); return; } - if (map_type == map_uc) - init_extra_mapping_uc(paddr, bytes); - else - init_extra_mapping_wb(paddr, bytes); - - pr_info("UV: Map %s_HI 0x%lx - 0x%lx %s (%d segments)\n", - id, paddr, paddr + bytes, mt[map_type], max_pnode + 1); -} - -static __init void map_gru_high(int max_pnode) -{ - union uvh_rh_gam_gru_overlay_config_u gru; - unsigned long mask, base; - int shift; - - if (UVH_RH_GAM_GRU_OVERLAY_CONFIG) { - gru.v = uv_read_local_mmr(UVH_RH_GAM_GRU_OVERLAY_CONFIG); - shift = UVH_RH_GAM_GRU_OVERLAY_CONFIG_BASE_SHFT; - mask = UVH_RH_GAM_GRU_OVERLAY_CONFIG_BASE_MASK; - } else if (UVH_RH10_GAM_GRU_OVERLAY_CONFIG) { - gru.v = uv_read_local_mmr(UVH_RH10_GAM_GRU_OVERLAY_CONFIG); - shift = UVH_RH10_GAM_GRU_OVERLAY_CONFIG_BASE_SHFT; - mask = UVH_RH10_GAM_GRU_OVERLAY_CONFIG_BASE_MASK; - } else { - pr_err("UV: GRU unavailable (no MMR)\n"); - return; - } + init_extra_mapping_uc(paddr, bytes); - if (!gru.s.enable) { - pr_info("UV: GRU disabled (by BIOS)\n"); - return; - } - - base = (gru.v & mask) >> shift; - map_high("GRU", base, shift, shift, max_pnode, map_wb); - gru_start_paddr = ((u64)base << shift); - gru_end_paddr = gru_start_paddr + (1UL << shift) * (max_pnode + 1); + pr_info("UV: Map %s_HI 0x%lx - 0x%lx UC (%d segments)\n", + id, paddr, paddr + bytes, max_pnode + 1); } static __init void map_mmr_high(int max_pnode) @@ -899,7 +848,7 @@ static __init void map_mmr_high(int max_pnode) } if (enable) - map_high("MMR", base, shift, shift, max_pnode, map_uc); + map_high("MMR", base, shift, shift, max_pnode); else pr_info("UV: MMR disabled\n"); } @@ -1024,7 +973,7 @@ static void __init calc_mmioh_map(enum mmioh_arch index, id, base, shift, m_io, max_io, max_pnode); if (max_io >= 0 && !mapped) - map_high(id, base, shift, m_io, max_io, map_uc); + map_high(id, base, shift, m_io, max_io); } static __init void map_mmioh_high(int min_pnode, int max_pnode) @@ -1219,8 +1168,6 @@ static void __init uv_init_hub_info(struct uv_hub_info_s *hi) if (uv_gp_table) { hi->global_mmr_base = uv_gp_table->mmr_base; hi->global_mmr_shift = uv_gp_table->mmr_shift; - hi->global_gru_base = uv_gp_table->gru_base; - hi->global_gru_shift = uv_gp_table->gru_shift; hi->gpa_shift = uv_gp_table->gpa_shift; hi->gpa_mask = (1UL << hi->gpa_shift) - 1; } else { @@ -1238,10 +1185,6 @@ static void __init uv_init_hub_info(struct uv_hub_info_s *hi) pr_info("UV: N:%d M:%d m_shift:%d n_lshift:%d\n", hi->n_val, hi->m_val, hi->m_shift, hi->n_lshift); pr_info("UV: gpa_mask/shift:0x%lx/%d pnode_mask:0x%x apic_pns:%d\n", hi->gpa_mask, hi->gpa_shift, hi->pnode_mask, hi->apic_pnode_shift); pr_info("UV: mmr_base/shift:0x%lx/%ld\n", hi->global_mmr_base, hi->global_mmr_shift); - if (hi->global_gru_base) - pr_info("UV: gru_base/shift:0x%lx/%ld\n", - hi->global_gru_base, hi->global_gru_shift); - pr_info("UV: gnode_upper:0x%lx gnode_extra:0x%x\n", hi->gnode_upper, hi->gnode_extra); } @@ -1799,7 +1742,6 @@ static void __init uv_system_init_hub(void) } pr_info("UV: min_pnode:%02x max_pnode:%02x\n", min_pnode, max_pnode); - map_gru_high(max_pnode); map_mmr_high(max_pnode); map_mmioh_high(min_pnode, max_pnode); -- 2.43.0