diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2007-08-20 00:58:36 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-08-22 01:21:46 -0400 |
commit | 16a15a30f8a09af6ce2dc4fd6eec9b454c1fe488 (patch) | |
tree | b9a2be9818f41d92df001950374ed6bc49e44751 | |
parent | 556ecf9be66f4d493e19bc71a7ce84366d512b71 (diff) |
[POWERPC] iSeries: Clean up lparmap mess
We need to have xLparMap in head_64.S so that it is at a fixed address
(because the linker will not resolve (address & 0xffffffff) for us).
But the assembler miscalculates the KERNEL_VSID() expressions. So put
the confusing expressions into asm-offsets.c.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r-- | arch/powerpc/kernel/Makefile | 7 | ||||
-rw-r--r-- | arch/powerpc/kernel/asm-offsets.c | 8 | ||||
-rw-r--r-- | arch/powerpc/kernel/head_64.S | 27 | ||||
-rw-r--r-- | arch/powerpc/kernel/lparmap.c | 32 | ||||
-rw-r--r-- | include/asm-powerpc/iseries/lpar_map.h | 3 | ||||
-rw-r--r-- | include/asm-powerpc/page_64.h | 2 |
6 files changed, 31 insertions, 48 deletions
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index a4850dd8764f..967afc517d8f 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile | |||
@@ -80,13 +80,6 @@ ifneq ($(CONFIG_PPC_INDIRECT_IO),y) | |||
80 | obj-y += iomap.o | 80 | obj-y += iomap.o |
81 | endif | 81 | endif |
82 | 82 | ||
83 | ifeq ($(CONFIG_PPC_ISERIES),y) | ||
84 | CFLAGS_lparmap.s += -g0 | ||
85 | extra-y += lparmap.s | ||
86 | $(obj)/head_64.o: $(obj)/lparmap.s | ||
87 | AFLAGS_head_64.o += -I$(obj) | ||
88 | endif | ||
89 | |||
90 | else | 83 | else |
91 | # stuff used from here for ARCH=ppc | 84 | # stuff used from here for ARCH=ppc |
92 | smpobj-$(CONFIG_SMP) += smp.o | 85 | smpobj-$(CONFIG_SMP) += smp.o |
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index 2cb1d9487796..a40805328f9b 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c | |||
@@ -312,5 +312,13 @@ int main(void) | |||
312 | #ifdef CONFIG_BUG | 312 | #ifdef CONFIG_BUG |
313 | DEFINE(BUG_ENTRY_SIZE, sizeof(struct bug_entry)); | 313 | DEFINE(BUG_ENTRY_SIZE, sizeof(struct bug_entry)); |
314 | #endif | 314 | #endif |
315 | |||
316 | #ifdef CONFIG_PPC_ISERIES | ||
317 | /* the assembler miscalculates the VSID values */ | ||
318 | DEFINE(PAGE_OFFSET_ESID, GET_ESID(PAGE_OFFSET)); | ||
319 | DEFINE(PAGE_OFFSET_VSID, KERNEL_VSID(PAGE_OFFSET)); | ||
320 | DEFINE(VMALLOC_START_ESID, GET_ESID(VMALLOC_START)); | ||
321 | DEFINE(VMALLOC_START_VSID, KERNEL_VSID(VMALLOC_START)); | ||
322 | #endif | ||
315 | return 0; | 323 | return 0; |
316 | } | 324 | } |
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S index 171800002ede..1e6d9cc06ca0 100644 --- a/arch/powerpc/kernel/head_64.S +++ b/arch/powerpc/kernel/head_64.S | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <asm/iseries/lpar_map.h> | 34 | #include <asm/iseries/lpar_map.h> |
35 | #include <asm/thread_info.h> | 35 | #include <asm/thread_info.h> |
36 | #include <asm/firmware.h> | 36 | #include <asm/firmware.h> |
37 | #include <asm/page_64.h> | ||
37 | 38 | ||
38 | #define DO_SOFT_DISABLE | 39 | #define DO_SOFT_DISABLE |
39 | 40 | ||
@@ -1519,8 +1520,8 @@ _GLOBAL(do_stab_bolted) | |||
1519 | * Space for CPU0's segment table. | 1520 | * Space for CPU0's segment table. |
1520 | * | 1521 | * |
1521 | * On iSeries, the hypervisor must fill in at least one entry before | 1522 | * On iSeries, the hypervisor must fill in at least one entry before |
1522 | * we get control (with relocate on). The address is give to the hv | 1523 | * we get control (with relocate on). The address is given to the hv |
1523 | * as a page number (see xLparMap in lpardata.c), so this must be at a | 1524 | * as a page number (see xLparMap below), so this must be at a |
1524 | * fixed address (the linker can't compute (u64)&initial_stab >> | 1525 | * fixed address (the linker can't compute (u64)&initial_stab >> |
1525 | * PAGE_SHIFT). | 1526 | * PAGE_SHIFT). |
1526 | */ | 1527 | */ |
@@ -1542,12 +1543,22 @@ fwnmi_data_area: | |||
1542 | * both pSeries and iSeries */ | 1543 | * both pSeries and iSeries */ |
1543 | #ifdef CONFIG_PPC_ISERIES | 1544 | #ifdef CONFIG_PPC_ISERIES |
1544 | . = LPARMAP_PHYS | 1545 | . = LPARMAP_PHYS |
1545 | #include "lparmap.s" | 1546 | .globl xLparMap |
1546 | /* | 1547 | xLparMap: |
1547 | * This ".text" is here for old compilers that generate a trailing | 1548 | .quad HvEsidsToMap /* xNumberEsids */ |
1548 | * .note section when compiling .c files to .s | 1549 | .quad HvRangesToMap /* xNumberRanges */ |
1549 | */ | 1550 | .quad STAB0_PAGE /* xSegmentTableOffs */ |
1550 | .text | 1551 | .zero 40 /* xRsvd */ |
1552 | /* xEsids (HvEsidsToMap entries of 2 quads) */ | ||
1553 | .quad PAGE_OFFSET_ESID /* xKernelEsid */ | ||
1554 | .quad PAGE_OFFSET_VSID /* xKernelVsid */ | ||
1555 | .quad VMALLOC_START_ESID /* xKernelEsid */ | ||
1556 | .quad VMALLOC_START_VSID /* xKernelVsid */ | ||
1557 | /* xRanges (HvRangesToMap entries of 3 quads) */ | ||
1558 | .quad HvPagesToMap /* xPages */ | ||
1559 | .quad 0 /* xOffset */ | ||
1560 | .quad PAGE_OFFSET_VSID << (SID_SHIFT - HW_PAGE_SHIFT) /* xVPN */ | ||
1561 | |||
1551 | #endif /* CONFIG_PPC_ISERIES */ | 1562 | #endif /* CONFIG_PPC_ISERIES */ |
1552 | 1563 | ||
1553 | . = 0x8000 | 1564 | . = 0x8000 |
diff --git a/arch/powerpc/kernel/lparmap.c b/arch/powerpc/kernel/lparmap.c deleted file mode 100644 index af11285ffbd1..000000000000 --- a/arch/powerpc/kernel/lparmap.c +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2005 Stephen Rothwell IBM Corp. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation; either version | ||
7 | * 2 of the License, or (at your option) any later version. | ||
8 | */ | ||
9 | #include <asm/mmu.h> | ||
10 | #include <asm/pgtable.h> | ||
11 | #include <asm/iseries/lpar_map.h> | ||
12 | |||
13 | /* The # is to stop gcc trying to make .text nonexecutable */ | ||
14 | const struct LparMap __attribute__((__section__(".text #"))) xLparMap = { | ||
15 | .xNumberEsids = HvEsidsToMap, | ||
16 | .xNumberRanges = HvRangesToMap, | ||
17 | .xSegmentTableOffs = STAB0_PAGE, | ||
18 | |||
19 | .xEsids = { | ||
20 | { .xKernelEsid = GET_ESID(PAGE_OFFSET), | ||
21 | .xKernelVsid = KERNEL_VSID(PAGE_OFFSET), }, | ||
22 | { .xKernelEsid = GET_ESID(VMALLOC_START), | ||
23 | .xKernelVsid = KERNEL_VSID(VMALLOC_START), }, | ||
24 | }, | ||
25 | |||
26 | .xRanges = { | ||
27 | { .xPages = HvPagesToMap, | ||
28 | .xOffset = 0, | ||
29 | .xVPN = KERNEL_VSID(PAGE_OFFSET) << (SID_SHIFT - HW_PAGE_SHIFT), | ||
30 | }, | ||
31 | }, | ||
32 | }; | ||
diff --git a/include/asm-powerpc/iseries/lpar_map.h b/include/asm-powerpc/iseries/lpar_map.h index 2ec384d66abb..5e9f3e128ee2 100644 --- a/include/asm-powerpc/iseries/lpar_map.h +++ b/include/asm-powerpc/iseries/lpar_map.h | |||
@@ -22,6 +22,8 @@ | |||
22 | 22 | ||
23 | #include <asm/types.h> | 23 | #include <asm/types.h> |
24 | 24 | ||
25 | #endif | ||
26 | |||
25 | /* | 27 | /* |
26 | * The iSeries hypervisor will set up mapping for one or more | 28 | * The iSeries hypervisor will set up mapping for one or more |
27 | * ESID/VSID pairs (in SLB/segment registers) and will set up | 29 | * ESID/VSID pairs (in SLB/segment registers) and will set up |
@@ -56,6 +58,7 @@ | |||
56 | /* Hypervisor initially maps 32MB of the load area */ | 58 | /* Hypervisor initially maps 32MB of the load area */ |
57 | #define HvPagesToMap 8192 | 59 | #define HvPagesToMap 8192 |
58 | 60 | ||
61 | #ifndef __ASSEMBLY__ | ||
59 | struct LparMap { | 62 | struct LparMap { |
60 | u64 xNumberEsids; // Number of ESID/VSID pairs | 63 | u64 xNumberEsids; // Number of ESID/VSID pairs |
61 | u64 xNumberRanges; // Number of VA ranges to map | 64 | u64 xNumberRanges; // Number of VA ranges to map |
diff --git a/include/asm-powerpc/page_64.h b/include/asm-powerpc/page_64.h index 4ceb1132c480..56a2df0f6836 100644 --- a/include/asm-powerpc/page_64.h +++ b/include/asm-powerpc/page_64.h | |||
@@ -28,7 +28,7 @@ | |||
28 | 28 | ||
29 | /* Segment size */ | 29 | /* Segment size */ |
30 | #define SID_SHIFT 28 | 30 | #define SID_SHIFT 28 |
31 | #define SID_MASK 0xfffffffffUL | 31 | #define SID_MASK ASM_CONST(0xfffffffff) |
32 | #define ESID_MASK 0xfffffffff0000000UL | 32 | #define ESID_MASK 0xfffffffff0000000UL |
33 | #define GET_ESID(x) (((x) >> SID_SHIFT) & SID_MASK) | 33 | #define GET_ESID(x) (((x) >> SID_SHIFT) & SID_MASK) |
34 | 34 | ||