summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2005-01-04 05:14:32 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-01-04 05:14:32 -0800
commitcc07552d93c5faa2fcaae251e61532fdebfff13d (patch)
tree78deaedece7a5fcc568e0a15ed17c02425199cbc
parent7ed2df0c5a46478fa063d2300692f059a657b553 (diff)
[PATCH] ppc64: tidy up the htab_data structure
More tidying up. The htab_data structure contained 5 fields or which two were completely unused and one other was just kept for printing at boot time. I have mode the remaining two into global variables. Built and booted on iSeries (which is always lpar) and on pSeries without partitioning. Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/ppc64/kernel/iSeries_setup.c8
-rw-r--r--arch/ppc64/kernel/pSeries_lpar.c2
-rw-r--r--arch/ppc64/kernel/setup.c6
-rw-r--r--arch/ppc64/mm/hash_low.S4
-rw-r--r--arch/ppc64/mm/hash_native.c18
-rw-r--r--arch/ppc64/mm/hash_utils.c14
-rw-r--r--arch/ppc64/mm/hugetlbpage.c8
-rw-r--r--arch/ppc64/mm/init.c2
-rw-r--r--include/asm-ppc64/mmu.h11
9 files changed, 32 insertions, 41 deletions
diff --git a/arch/ppc64/kernel/iSeries_setup.c b/arch/ppc64/kernel/iSeries_setup.c
index 50fb14a3fdb4..b48af5ef347b 100644
--- a/arch/ppc64/kernel/iSeries_setup.c
+++ b/arch/ppc64/kernel/iSeries_setup.c
@@ -472,18 +472,16 @@ static void __init build_iSeries_Memory_Map(void)
printk("HPT absolute addr = %016lx, size = %dK\n",
chunk_to_addr(hptFirstChunk), hptSizeChunks * 256);
- /* Fill in the htab_data structure */
- /* Fill in size of hashed page table */
+ /* Fill in the hashed page table hash mask */
num_ptegs = hptSizePages *
(PAGE_SIZE / (sizeof(HPTE) * HPTES_PER_GROUP));
- htab_data.htab_num_ptegs = num_ptegs;
- htab_data.htab_hash_mask = num_ptegs - 1;
+ htab_hash_mask = num_ptegs - 1;
/*
* The actual hashed page table is in the hypervisor,
* we have no direct access
*/
- htab_data.htab = NULL;
+ htab_address = NULL;
/*
* Determine if absolute memory has any
diff --git a/arch/ppc64/kernel/pSeries_lpar.c b/arch/ppc64/kernel/pSeries_lpar.c
index c1f984a24ad7..b0623213c244 100644
--- a/arch/ppc64/kernel/pSeries_lpar.c
+++ b/arch/ppc64/kernel/pSeries_lpar.c
@@ -436,7 +436,7 @@ static long pSeries_lpar_hpte_find(unsigned long vpn)
hash = hpt_hash(vpn, 0);
for (j = 0; j < 2; j++) {
- slot = (hash & htab_data.htab_hash_mask) * HPTES_PER_GROUP;
+ slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
for (i = 0; i < HPTES_PER_GROUP; i++) {
hpte_dw0.dword0 = pSeries_lpar_hpte_getword0(slot);
dw0 = hpte_dw0.dw0;
diff --git a/arch/ppc64/kernel/setup.c b/arch/ppc64/kernel/setup.c
index 5c70176d5907..01063536c86c 100644
--- a/arch/ppc64/kernel/setup.c
+++ b/arch/ppc64/kernel/setup.c
@@ -55,6 +55,7 @@
#include <asm/serial.h>
#include <asm/cache.h>
#include <asm/page.h>
+#include <asm/mmu.h>
#ifdef DEBUG
#define DBG(fmt...) udbg_printf(fmt)
@@ -90,7 +91,6 @@ extern void udbg_init_maple_realmode(void);
#endif
/* extern void *stab; */
-extern HTAB htab_data;
extern unsigned long klimit;
extern void mm_init_ppc64(void);
@@ -672,8 +672,8 @@ void __init setup_system(void)
ppc64_caches.dline_size);
printk("ppc64_caches.icache_line_size = 0x%x\n",
ppc64_caches.iline_size);
- printk("htab_data.htab = 0x%p\n", htab_data.htab);
- printk("htab_data.num_ptegs = 0x%lx\n", htab_data.htab_num_ptegs);
+ printk("htab_address = 0x%p\n", htab_address);
+ printk("htab_hash_mask = 0x%lx\n", htab_hash_mask);
printk("-----------------------------------------------------\n");
mm_init_ppc64();
diff --git a/arch/ppc64/mm/hash_low.S b/arch/ppc64/mm/hash_low.S
index 68dd4b9adf96..9a7652bc4004 100644
--- a/arch/ppc64/mm/hash_low.S
+++ b/arch/ppc64/mm/hash_low.S
@@ -139,8 +139,8 @@ END_FTR_SECTION_IFCLR(CPU_FTR_COHERENT_ICACHE)
std r3,STK_PARM(r4)(r1)
/* Get htab_hash_mask */
- ld r4,htab_data@got(2)
- ld r27,16(r4) /* htab_data.htab_hash_mask -> r27 */
+ ld r4,htab_hash_mask@got(2)
+ ld r27,0(r4) /* htab_hash_mask -> r27 */
/* Check if we may already be in the hashtable, in this case, we
* go to out-of-line code to try to modify the HPTE
diff --git a/arch/ppc64/mm/hash_native.c b/arch/ppc64/mm/hash_native.c
index bf0edd83a49c..6506f3d0fd1a 100644
--- a/arch/ppc64/mm/hash_native.c
+++ b/arch/ppc64/mm/hash_native.c
@@ -52,7 +52,7 @@ long native_hpte_insert(unsigned long hpte_group, unsigned long va,
unsigned long hpteflags, int bolted, int large)
{
unsigned long arpn = physRpn_to_absRpn(prpn);
- HPTE *hptep = htab_data.htab + hpte_group;
+ HPTE *hptep = htab_address + hpte_group;
Hpte_dword0 dw0;
HPTE lhpte;
int i;
@@ -117,7 +117,7 @@ static long native_hpte_remove(unsigned long hpte_group)
slot_offset = mftb() & 0x7;
for (i = 0; i < HPTES_PER_GROUP; i++) {
- hptep = htab_data.htab + hpte_group + slot_offset;
+ hptep = htab_address + hpte_group + slot_offset;
dw0 = hptep->dw0.dw0;
if (dw0.v && !dw0.bolted) {
@@ -172,9 +172,9 @@ static long native_hpte_find(unsigned long vpn)
hash = hpt_hash(vpn, 0);
for (j = 0; j < 2; j++) {
- slot = (hash & htab_data.htab_hash_mask) * HPTES_PER_GROUP;
+ slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
for (i = 0; i < HPTES_PER_GROUP; i++) {
- hptep = htab_data.htab + slot;
+ hptep = htab_address + slot;
dw0 = hptep->dw0.dw0;
if ((dw0.avpn == (vpn >> 11)) && dw0.v &&
@@ -195,7 +195,7 @@ static long native_hpte_find(unsigned long vpn)
static long native_hpte_updatepp(unsigned long slot, unsigned long newpp,
unsigned long va, int large, int local)
{
- HPTE *hptep = htab_data.htab + slot;
+ HPTE *hptep = htab_address + slot;
Hpte_dword0 dw0;
unsigned long avpn = va >> 23;
int ret = 0;
@@ -254,7 +254,7 @@ static void native_hpte_updateboltedpp(unsigned long newpp, unsigned long ea)
slot = native_hpte_find(vpn);
if (slot == -1)
panic("could not find page to bolt\n");
- hptep = htab_data.htab + slot;
+ hptep = htab_address + slot;
set_pp_bit(newpp, hptep);
@@ -269,7 +269,7 @@ static void native_hpte_updateboltedpp(unsigned long newpp, unsigned long ea)
static void native_hpte_invalidate(unsigned long slot, unsigned long va,
int large, int local)
{
- HPTE *hptep = htab_data.htab + slot;
+ HPTE *hptep = htab_address + slot;
Hpte_dword0 dw0;
unsigned long avpn = va >> 23;
unsigned long flags;
@@ -336,10 +336,10 @@ static void native_flush_hash_range(unsigned long context,
secondary = (pte_val(batch->pte[i]) & _PAGE_SECONDARY) >> 15;
if (secondary)
hash = ~hash;
- slot = (hash & htab_data.htab_hash_mask) * HPTES_PER_GROUP;
+ slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
slot += (pte_val(batch->pte[i]) & _PAGE_GROUP_IX) >> 12;
- hptep = htab_data.htab + slot;
+ hptep = htab_address + slot;
avpn = va >> 23;
if (large)
diff --git a/arch/ppc64/mm/hash_utils.c b/arch/ppc64/mm/hash_utils.c
index e369e11518ee..dbed7011d017 100644
--- a/arch/ppc64/mm/hash_utils.c
+++ b/arch/ppc64/mm/hash_utils.c
@@ -74,7 +74,8 @@
extern unsigned long dart_tablebase;
#endif /* CONFIG_U3_DART */
-HTAB htab_data = {NULL, 0, 0, 0, 0};
+HPTE *htab_address;
+unsigned long htab_hash_mask;
extern unsigned long _SDR1;
@@ -113,7 +114,7 @@ static inline void create_pte_mapping(unsigned long start, unsigned long end,
hash = hpt_hash(vpn, large);
- hpteg = ((hash & htab_data.htab_hash_mask)*HPTES_PER_GROUP);
+ hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP);
#ifdef CONFIG_PPC_PSERIES
if (systemcfg->platform & PLATFORM_LPAR)
@@ -155,12 +156,11 @@ void __init htab_initialize(void)
htab_size_bytes = pteg_count << 7;
}
- htab_data.htab_num_ptegs = pteg_count;
- htab_data.htab_hash_mask = pteg_count - 1;
+ htab_hash_mask = pteg_count - 1;
if (systemcfg->platform & PLATFORM_LPAR) {
/* Using a hypervisor which owns the htab */
- htab_data.htab = NULL;
+ htab_address = NULL;
_SDR1 = 0;
} else {
/* Find storage for the HPT. Must be contiguous in
@@ -175,7 +175,7 @@ void __init htab_initialize(void)
ppc64_terminate_msg(0x20, "hpt space");
loop_forever();
}
- htab_data.htab = abs_to_virt(table);
+ htab_address = abs_to_virt(table);
/* htab absolute addr + encoded htabsize */
_SDR1 = table + __ilog2(pteg_count) - 11;
@@ -356,7 +356,7 @@ void flush_hash_page(unsigned long context, unsigned long ea, pte_t pte,
secondary = (pte_val(pte) & _PAGE_SECONDARY) >> 15;
if (secondary)
hash = ~hash;
- slot = (hash & htab_data.htab_hash_mask) * HPTES_PER_GROUP;
+ slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
slot += (pte_val(pte) & _PAGE_GROUP_IX) >> 12;
ppc_md.hpte_invalidate(slot, va, huge, local);
diff --git a/arch/ppc64/mm/hugetlbpage.c b/arch/ppc64/mm/hugetlbpage.c
index 7fbc4d06379e..7b6b074a461d 100644
--- a/arch/ppc64/mm/hugetlbpage.c
+++ b/arch/ppc64/mm/hugetlbpage.c
@@ -832,7 +832,7 @@ int hash_huge_page(struct mm_struct *mm, unsigned long access,
hash = hpt_hash(vpn, 1);
if (pte_val(old_pte) & _PAGE_SECONDARY)
hash = ~hash;
- slot = (hash & htab_data.htab_hash_mask) * HPTES_PER_GROUP;
+ slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
slot += (pte_val(old_pte) & _PAGE_GROUP_IX) >> 12;
if (ppc_md.hpte_updatepp(slot, hpteflags, va, 1, local) == -1)
@@ -846,7 +846,7 @@ int hash_huge_page(struct mm_struct *mm, unsigned long access,
prpn = pte_pfn(old_pte);
repeat:
- hpte_group = ((hash & htab_data.htab_hash_mask) *
+ hpte_group = ((hash & htab_hash_mask) *
HPTES_PER_GROUP) & ~0x7UL;
/* Update the linux pte with the HPTE slot */
@@ -863,13 +863,13 @@ repeat:
/* Primary is full, try the secondary */
if (unlikely(slot == -1)) {
pte_val(new_pte) |= _PAGE_SECONDARY;
- hpte_group = ((~hash & htab_data.htab_hash_mask) *
+ hpte_group = ((~hash & htab_hash_mask) *
HPTES_PER_GROUP) & ~0x7UL;
slot = ppc_md.hpte_insert(hpte_group, va, prpn,
1, hpteflags, 0, 1);
if (slot == -1) {
if (mftb() & 0x1)
- hpte_group = ((hash & htab_data.htab_hash_mask) * HPTES_PER_GROUP) & ~0x7UL;
+ hpte_group = ((hash & htab_hash_mask) * HPTES_PER_GROUP) & ~0x7UL;
ppc_md.hpte_remove(hpte_group);
goto repeat;
diff --git a/arch/ppc64/mm/init.c b/arch/ppc64/mm/init.c
index c735188d72b9..c6f79ebb185a 100644
--- a/arch/ppc64/mm/init.c
+++ b/arch/ppc64/mm/init.c
@@ -168,7 +168,7 @@ static void map_io_page(unsigned long ea, unsigned long pa, int flags)
hash = hpt_hash(vpn, 0);
- hpteg = ((hash & htab_data.htab_hash_mask)*HPTES_PER_GROUP);
+ hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP);
/* Panic if a pte grpup is full */
if (ppc_md.hpte_insert(hpteg, va, pa >> PAGE_SHIFT, 0,
diff --git a/include/asm-ppc64/mmu.h b/include/asm-ppc64/mmu.h
index dbd7ac630507..daebba6b7a17 100644
--- a/include/asm-ppc64/mmu.h
+++ b/include/asm-ppc64/mmu.h
@@ -98,15 +98,8 @@ typedef struct {
#define PP_RXRX 3 /* Supervisor read, User read */
-typedef struct {
- HPTE * htab;
- unsigned long htab_num_ptegs;
- unsigned long htab_hash_mask;
- unsigned long next_round_robin;
- unsigned long last_kernel_address;
-} HTAB;
-
-extern HTAB htab_data;
+extern HPTE * htab_address;
+extern unsigned long htab_hash_mask;
static inline unsigned long hpt_hash(unsigned long vpn, int large)
{