From: Benjamin Herrenschmidt The "systemcfg" data structure in the ppc64 kernel is something that used to be defined to be at a hard-coded page number in the kernel image. This is not necessary (at least not any more) and is a possible problem with future developements. This patch removes that constraint, which also simplifies various bits of assembly in head.S that were dealing with it. This is the first step of a deeper cleanup of systemcfg definition of usage (and ultimately removal in it's current incarnation). Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Andrew Morton --- 25-akpm/arch/ppc64/kernel/LparData.c | 2 +- 25-akpm/arch/ppc64/kernel/head.S | 32 +++++--------------------------- 25-akpm/arch/ppc64/kernel/pacaData.c | 7 ++++++- 25-akpm/arch/ppc64/kernel/proc_ppc64.c | 2 +- 25-akpm/include/asm-ppc64/systemcfg.h | 5 ----- 5 files changed, 13 insertions(+), 35 deletions(-) diff -puN arch/ppc64/kernel/head.S~ppc64-move-systemcfg-out-of-heads arch/ppc64/kernel/head.S --- 25/arch/ppc64/kernel/head.S~ppc64-move-systemcfg-out-of-heads 2005-01-30 22:10:57.814989344 -0800 +++ 25-akpm/arch/ppc64/kernel/head.S 2005-01-30 22:10:57.824987824 -0800 @@ -517,16 +517,7 @@ __end_interrupts: .globl naca naca: .llong itVpdAreas -#endif - - . = SYSTEMCFG_PHYS_ADDR - .globl __start_systemcfg -__start_systemcfg: - . = (SYSTEMCFG_PHYS_ADDR + PAGE_SIZE) - .globl __end_systemcfg -__end_systemcfg: -#ifdef CONFIG_PPC_ISERIES /* * The iSeries LPAR map is at this fixed address * so that the HvReleaseData structure can address @@ -536,6 +527,8 @@ __end_systemcfg: * VSID generation algorithm. See include/asm/mmu_context.h. */ + . = 0x4800 + .llong 2 /* # ESIDs to be mapped by hypervisor */ .llong 1 /* # memory ranges to be mapped by hypervisor */ .llong STAB0_PAGE /* Page # of segment table within load area */ @@ -1264,10 +1257,6 @@ _STATIC(__start_initialization_iSeries) addi r2,r2,0x4000 addi r2,r2,0x4000 - LOADADDR(r9,systemcfg) - SET_REG_TO_CONST(r4, SYSTEMCFG_VIRT_ADDR) - std r4,0(r9) /* set the systemcfg pointer */ - bl .iSeries_early_setup /* relocation is on at this point */ @@ -1772,7 +1761,7 @@ _GLOBAL(__secondary_start) sc /* HvCall_setASR */ #else /* set the ASR */ - li r3,SYSTEMCFG_PHYS_ADDR /* r3 = ptr to systemcfg */ + ld r3,systemcfg@got(r2) /* r3 = ptr to systemcfg */ lwz r3,PLATFORM(r3) /* r3 = platform flags */ cmpldi r3,PLATFORM_PSERIES_LPAR bne 98f @@ -1861,12 +1850,6 @@ _STATIC(start_here_multiplatform) ori r6,r6,MSR_RI mtmsrd r6 /* RI on */ - /* setup the systemcfg pointer which is needed by *tab_initialize */ - LOADADDR(r6,systemcfg) - sub r6,r6,r26 /* addr of the variable systemcfg */ - li r27,SYSTEMCFG_PHYS_ADDR - std r27,0(r6) /* set the value of systemcfg */ - #ifdef CONFIG_HMT /* Start up the second thread on cpu 0 */ mfspr r3,PVR @@ -1941,7 +1924,7 @@ _STATIC(start_here_multiplatform) /* set the ASR */ ld r3,PACASTABREAL(r13) ori r4,r3,1 /* turn on valid bit */ - li r3,SYSTEMCFG_PHYS_ADDR /* r3 = ptr to systemcfg */ + ld r3,systemcfg@got(r2) /* r3 = ptr to systemcfg */ lwz r3,PLATFORM(r3) /* r3 = platform flags */ cmpldi r3,PLATFORM_PSERIES_LPAR bne 98f @@ -1960,7 +1943,7 @@ _STATIC(start_here_multiplatform) mtasr r4 /* set the stab location */ 99: /* Set SDR1 (hash table pointer) */ - li r3,SYSTEMCFG_PHYS_ADDR /* r3 = ptr to systemcfg */ + ld r3,systemcfg@got(r2) /* r3 = ptr to systemcfg */ lwz r3,PLATFORM(r3) /* r3 = platform flags */ /* Test if bit 0 is set (LPAR bit) */ andi. r3,r3,0x1 @@ -1998,11 +1981,6 @@ _STATIC(start_here_common) li r3,0 bl .do_cpu_ftr_fixups - /* setup the systemcfg pointer */ - LOADADDR(r9,systemcfg) - SET_REG_TO_CONST(r8, SYSTEMCFG_VIRT_ADDR) - std r8,0(r9) - LOADADDR(r26, boot_cpuid) lwz r26,0(r26) diff -puN arch/ppc64/kernel/LparData.c~ppc64-move-systemcfg-out-of-heads arch/ppc64/kernel/LparData.c --- 25/arch/ppc64/kernel/LparData.c~ppc64-move-systemcfg-out-of-heads 2005-01-30 22:10:57.816989040 -0800 +++ 25-akpm/arch/ppc64/kernel/LparData.c 2005-01-30 22:10:57.826987520 -0800 @@ -45,7 +45,7 @@ struct HvReleaseData hvReleaseData = { .xSize = sizeof(struct HvReleaseData), .xVpdAreasPtrOffset = offsetof(struct naca_struct, xItVpdAreas), .xSlicNacaAddr = &naca, /* 64-bit Naca address */ - .xMsNucDataOffset = 0x6000, /* offset of LparMap within loadarea (see head.S) */ + .xMsNucDataOffset = 0x4800, /* offset of LparMap within loadarea (see head.S) */ .xTagsMode = 1, /* tags inactive */ .xAddressSize = 0, /* 64 bit */ .xNoSharedProcs = 0, /* shared processors */ diff -puN arch/ppc64/kernel/pacaData.c~ppc64-move-systemcfg-out-of-heads arch/ppc64/kernel/pacaData.c --- 25/arch/ppc64/kernel/pacaData.c~ppc64-move-systemcfg-out-of-heads 2005-01-30 22:10:57.817988888 -0800 +++ 25-akpm/arch/ppc64/kernel/pacaData.c 2005-01-30 22:10:57.825987672 -0800 @@ -20,9 +20,14 @@ #include #include -struct systemcfg *systemcfg; +static union { + struct systemcfg data; + u8 page[PAGE_SIZE]; +} systemcfg_store __page_aligned; +struct systemcfg *systemcfg = &systemcfg_store.data; EXPORT_SYMBOL(systemcfg); + /* This symbol is provided by the linker - let it fill in the paca * field correctly */ extern unsigned long __toc_start; diff -puN arch/ppc64/kernel/proc_ppc64.c~ppc64-move-systemcfg-out-of-heads arch/ppc64/kernel/proc_ppc64.c --- 25/arch/ppc64/kernel/proc_ppc64.c~ppc64-move-systemcfg-out-of-heads 2005-01-30 22:10:57.818988736 -0800 +++ 25-akpm/arch/ppc64/kernel/proc_ppc64.c 2005-01-30 22:10:57.825987672 -0800 @@ -89,7 +89,7 @@ static int __init proc_ppc64_init(void) return 1; pde->nlink = 1; pde->data = systemcfg; - pde->size = 4096; + pde->size = PAGE_SIZE; pde->proc_fops = &page_map_fops; #ifdef CONFIG_PPC_PSERIES diff -puN include/asm-ppc64/systemcfg.h~ppc64-move-systemcfg-out-of-heads include/asm-ppc64/systemcfg.h --- 25/include/asm-ppc64/systemcfg.h~ppc64-move-systemcfg-out-of-heads 2005-01-30 22:10:57.820988432 -0800 +++ 25-akpm/include/asm-ppc64/systemcfg.h 2005-01-30 22:10:57.826987520 -0800 @@ -47,7 +47,6 @@ struct systemcfg { __u32 dcache_line_size; /* L1 d-cache line size 0x64 */ __u32 icache_size; /* L1 i-cache size 0x68 */ __u32 icache_line_size; /* L1 i-cache line size 0x6C */ - __u8 reserved0[3984]; /* Reserve rest of page 0x70 */ }; #ifdef __KERNEL__ @@ -56,8 +55,4 @@ extern struct systemcfg *systemcfg; #endif /* __ASSEMBLY__ */ -#define SYSTEMCFG_PAGE 0x5 -#define SYSTEMCFG_PHYS_ADDR (SYSTEMCFG_PAGE<