aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Steiner <steiner@sgi.com>2009-11-19 15:23:41 -0500
committerIngo Molnar <mingo@elte.hu>2009-11-23 13:47:42 -0500
commitfd12a0d69aee6d90fa9b9890db24368a897f8423 (patch)
tree2e77b6badae3966af54beb40f727dea143dbb075
parente38e2af1c57c3eb5211331a5b4fcaae0c4a2a918 (diff)
x86: UV SGI: Don't track GRU space in PAT
GRU space is always mapped as WB in the page table. There is no need to track the mappings in the PAT. This also eliminates the "freeing invalid memtype" messages when the GRU space is unmapped. Signed-off-by: Jack Steiner <steiner@sgi.com> LKML-Reference: <20091119202341.GA4420@sgi.com> [ v2: fix build failure ] Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/x86/include/asm/pat.h2
-rw-r--r--arch/x86/include/asm/x86_init.h2
-rw-r--r--arch/x86/kernel/apic/x2apic_uv_x.c19
-rw-r--r--arch/x86/kernel/x86_init.c2
-rw-r--r--arch/x86/mm/pat.c12
5 files changed, 33 insertions, 4 deletions
diff --git a/arch/x86/include/asm/pat.h b/arch/x86/include/asm/pat.h
index e2c1668dde7a..4c35dd016b54 100644
--- a/arch/x86/include/asm/pat.h
+++ b/arch/x86/include/asm/pat.h
@@ -24,4 +24,6 @@ int io_reserve_memtype(resource_size_t start, resource_size_t end,
24 24
25void io_free_memtype(resource_size_t start, resource_size_t end); 25void io_free_memtype(resource_size_t start, resource_size_t end);
26 26
27int default_is_untracked_pat_range(u64 start, u64 end);
28
27#endif /* _ASM_X86_PAT_H */ 29#endif /* _ASM_X86_PAT_H */
diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h
index 2c756fd4ab0e..8112ed786287 100644
--- a/arch/x86/include/asm/x86_init.h
+++ b/arch/x86/include/asm/x86_init.h
@@ -113,11 +113,13 @@ struct x86_cpuinit_ops {
113 113
114/** 114/**
115 * struct x86_platform_ops - platform specific runtime functions 115 * struct x86_platform_ops - platform specific runtime functions
116 * @is_untracked_pat_range exclude from PAT logic
116 * @calibrate_tsc: calibrate TSC 117 * @calibrate_tsc: calibrate TSC
117 * @get_wallclock: get time from HW clock like RTC etc. 118 * @get_wallclock: get time from HW clock like RTC etc.
118 * @set_wallclock: set time back to HW clock 119 * @set_wallclock: set time back to HW clock
119 */ 120 */
120struct x86_platform_ops { 121struct x86_platform_ops {
122 int (*is_untracked_pat_range)(u64 start, u64 end);
121 unsigned long (*calibrate_tsc)(void); 123 unsigned long (*calibrate_tsc)(void);
122 unsigned long (*get_wallclock)(void); 124 unsigned long (*get_wallclock)(void);
123 int (*set_wallclock)(unsigned long nowtime); 125 int (*set_wallclock)(unsigned long nowtime);
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index f5f5886a6b53..2477c9f88093 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -30,10 +30,22 @@
30#include <asm/apic.h> 30#include <asm/apic.h>
31#include <asm/ipi.h> 31#include <asm/ipi.h>
32#include <asm/smp.h> 32#include <asm/smp.h>
33#include <asm/x86_init.h>
33 34
34DEFINE_PER_CPU(int, x2apic_extra_bits); 35DEFINE_PER_CPU(int, x2apic_extra_bits);
35 36
36static enum uv_system_type uv_system_type; 37static enum uv_system_type uv_system_type;
38static u64 gru_start_paddr, gru_end_paddr;
39
40static int is_GRU_range(u64 start, u64 end)
41{
42 return start >= gru_start_paddr && end < gru_end_paddr;
43}
44
45static int uv_is_untracked_pat_range(u64 start, u64 end)
46{
47 return is_ISA_range(start, end) || is_GRU_range(start, end);
48}
37 49
38static int early_get_nodeid(void) 50static int early_get_nodeid(void)
39{ 51{
@@ -49,6 +61,7 @@ static int early_get_nodeid(void)
49static int __init uv_acpi_madt_oem_check(char *oem_id, char *oem_table_id) 61static int __init uv_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
50{ 62{
51 if (!strcmp(oem_id, "SGI")) { 63 if (!strcmp(oem_id, "SGI")) {
64 x86_platform.is_untracked_pat_range = uv_is_untracked_pat_range;
52 if (!strcmp(oem_table_id, "UVL")) 65 if (!strcmp(oem_table_id, "UVL"))
53 uv_system_type = UV_LEGACY_APIC; 66 uv_system_type = UV_LEGACY_APIC;
54 else if (!strcmp(oem_table_id, "UVX")) 67 else if (!strcmp(oem_table_id, "UVX"))
@@ -385,8 +398,12 @@ static __init void map_gru_high(int max_pnode)
385 int shift = UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR_BASE_SHFT; 398 int shift = UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR_BASE_SHFT;
386 399
387 gru.v = uv_read_local_mmr(UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR); 400 gru.v = uv_read_local_mmr(UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR);
388 if (gru.s.enable) 401 if (gru.s.enable) {
389 map_high("GRU", gru.s.base, shift, max_pnode, map_wb); 402 map_high("GRU", gru.s.base, shift, max_pnode, map_wb);
403 gru_start_paddr = ((u64)gru.s.base << shift);
404 gru_end_paddr = gru_start_paddr + (1UL << shift) * (max_pnode + 1);
405
406 }
390} 407}
391 408
392static __init void map_mmr_high(int max_pnode) 409static __init void map_mmr_high(int max_pnode)
diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c
index 4449a4a2c2ed..bcc749ef62dc 100644
--- a/arch/x86/kernel/x86_init.c
+++ b/arch/x86/kernel/x86_init.c
@@ -13,6 +13,7 @@
13#include <asm/e820.h> 13#include <asm/e820.h>
14#include <asm/time.h> 14#include <asm/time.h>
15#include <asm/irq.h> 15#include <asm/irq.h>
16#include <asm/pat.h>
16#include <asm/tsc.h> 17#include <asm/tsc.h>
17 18
18void __cpuinit x86_init_noop(void) { } 19void __cpuinit x86_init_noop(void) { }
@@ -69,6 +70,7 @@ struct x86_cpuinit_ops x86_cpuinit __cpuinitdata = {
69}; 70};
70 71
71struct x86_platform_ops x86_platform = { 72struct x86_platform_ops x86_platform = {
73 .is_untracked_pat_range = default_is_untracked_pat_range,
72 .calibrate_tsc = native_calibrate_tsc, 74 .calibrate_tsc = native_calibrate_tsc,
73 .get_wallclock = mach_get_cmos_time, 75 .get_wallclock = mach_get_cmos_time,
74 .set_wallclock = mach_set_rtc_mmss, 76 .set_wallclock = mach_set_rtc_mmss,
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index e78cd0ec2bcf..38a66ef9426d 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -20,6 +20,7 @@
20#include <asm/cacheflush.h> 20#include <asm/cacheflush.h>
21#include <asm/processor.h> 21#include <asm/processor.h>
22#include <asm/tlbflush.h> 22#include <asm/tlbflush.h>
23#include <asm/x86_init.h>
23#include <asm/pgtable.h> 24#include <asm/pgtable.h>
24#include <asm/fcntl.h> 25#include <asm/fcntl.h>
25#include <asm/e820.h> 26#include <asm/e820.h>
@@ -348,6 +349,11 @@ static int free_ram_pages_type(u64 start, u64 end)
348 return 0; 349 return 0;
349} 350}
350 351
352int default_is_untracked_pat_range(u64 start, u64 end)
353{
354 return is_ISA_range(start, end);
355}
356
351/* 357/*
352 * req_type typically has one of the: 358 * req_type typically has one of the:
353 * - _PAGE_CACHE_WB 359 * - _PAGE_CACHE_WB
@@ -388,7 +394,7 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
388 } 394 }
389 395
390 /* Low ISA region is always mapped WB in page table. No need to track */ 396 /* Low ISA region is always mapped WB in page table. No need to track */
391 if (is_ISA_range(start, end - 1)) { 397 if (x86_platform.is_untracked_pat_range(start, end - 1)) {
392 if (new_type) 398 if (new_type)
393 *new_type = _PAGE_CACHE_WB; 399 *new_type = _PAGE_CACHE_WB;
394 return 0; 400 return 0;
@@ -499,7 +505,7 @@ int free_memtype(u64 start, u64 end)
499 return 0; 505 return 0;
500 506
501 /* Low ISA region is always mapped WB. No need to track */ 507 /* Low ISA region is always mapped WB. No need to track */
502 if (is_ISA_range(start, end - 1)) 508 if (x86_platform.is_untracked_pat_range(start, end - 1))
503 return 0; 509 return 0;
504 510
505 is_range_ram = pat_pagerange_is_ram(start, end); 511 is_range_ram = pat_pagerange_is_ram(start, end);
@@ -582,7 +588,7 @@ static unsigned long lookup_memtype(u64 paddr)
582 int rettype = _PAGE_CACHE_WB; 588 int rettype = _PAGE_CACHE_WB;
583 struct memtype *entry; 589 struct memtype *entry;
584 590
585 if (is_ISA_range(paddr, paddr + PAGE_SIZE - 1)) 591 if (x86_platform.is_untracked_pat_range(paddr, paddr + PAGE_SIZE - 1))
586 return rettype; 592 return rettype;
587 593
588 if (pat_pagerange_is_ram(paddr, paddr + PAGE_SIZE)) { 594 if (pat_pagerange_is_ram(paddr, paddr + PAGE_SIZE)) {