Commit cc07552d authored by Stephen Rothwell's avatar Stephen Rothwell Committed by Linus Torvalds

[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: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 7ed2df0c
...@@ -472,18 +472,16 @@ static void __init build_iSeries_Memory_Map(void) ...@@ -472,18 +472,16 @@ static void __init build_iSeries_Memory_Map(void)
printk("HPT absolute addr = %016lx, size = %dK\n", printk("HPT absolute addr = %016lx, size = %dK\n",
chunk_to_addr(hptFirstChunk), hptSizeChunks * 256); chunk_to_addr(hptFirstChunk), hptSizeChunks * 256);
/* Fill in the htab_data structure */ /* Fill in the hashed page table hash mask */
/* Fill in size of hashed page table */
num_ptegs = hptSizePages * num_ptegs = hptSizePages *
(PAGE_SIZE / (sizeof(HPTE) * HPTES_PER_GROUP)); (PAGE_SIZE / (sizeof(HPTE) * HPTES_PER_GROUP));
htab_data.htab_num_ptegs = num_ptegs; htab_hash_mask = num_ptegs - 1;
htab_data.htab_hash_mask = num_ptegs - 1;
/* /*
* The actual hashed page table is in the hypervisor, * The actual hashed page table is in the hypervisor,
* we have no direct access * we have no direct access
*/ */
htab_data.htab = NULL; htab_address = NULL;
/* /*
* Determine if absolute memory has any * Determine if absolute memory has any
......
...@@ -436,7 +436,7 @@ static long pSeries_lpar_hpte_find(unsigned long vpn) ...@@ -436,7 +436,7 @@ static long pSeries_lpar_hpte_find(unsigned long vpn)
hash = hpt_hash(vpn, 0); hash = hpt_hash(vpn, 0);
for (j = 0; j < 2; j++) { 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++) { for (i = 0; i < HPTES_PER_GROUP; i++) {
hpte_dw0.dword0 = pSeries_lpar_hpte_getword0(slot); hpte_dw0.dword0 = pSeries_lpar_hpte_getword0(slot);
dw0 = hpte_dw0.dw0; dw0 = hpte_dw0.dw0;
......
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
#include <asm/serial.h> #include <asm/serial.h>
#include <asm/cache.h> #include <asm/cache.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/mmu.h>
#ifdef DEBUG #ifdef DEBUG
#define DBG(fmt...) udbg_printf(fmt) #define DBG(fmt...) udbg_printf(fmt)
...@@ -90,7 +91,6 @@ extern void udbg_init_maple_realmode(void); ...@@ -90,7 +91,6 @@ extern void udbg_init_maple_realmode(void);
#endif #endif
/* extern void *stab; */ /* extern void *stab; */
extern HTAB htab_data;
extern unsigned long klimit; extern unsigned long klimit;
extern void mm_init_ppc64(void); extern void mm_init_ppc64(void);
...@@ -672,8 +672,8 @@ void __init setup_system(void) ...@@ -672,8 +672,8 @@ void __init setup_system(void)
ppc64_caches.dline_size); ppc64_caches.dline_size);
printk("ppc64_caches.icache_line_size = 0x%x\n", printk("ppc64_caches.icache_line_size = 0x%x\n",
ppc64_caches.iline_size); ppc64_caches.iline_size);
printk("htab_data.htab = 0x%p\n", htab_data.htab); printk("htab_address = 0x%p\n", htab_address);
printk("htab_data.num_ptegs = 0x%lx\n", htab_data.htab_num_ptegs); printk("htab_hash_mask = 0x%lx\n", htab_hash_mask);
printk("-----------------------------------------------------\n"); printk("-----------------------------------------------------\n");
mm_init_ppc64(); mm_init_ppc64();
......
...@@ -139,8 +139,8 @@ END_FTR_SECTION_IFCLR(CPU_FTR_COHERENT_ICACHE) ...@@ -139,8 +139,8 @@ END_FTR_SECTION_IFCLR(CPU_FTR_COHERENT_ICACHE)
std r3,STK_PARM(r4)(r1) std r3,STK_PARM(r4)(r1)
/* Get htab_hash_mask */ /* Get htab_hash_mask */
ld r4,htab_data@got(2) ld r4,htab_hash_mask@got(2)
ld r27,16(r4) /* htab_data.htab_hash_mask -> r27 */ ld r27,0(r4) /* htab_hash_mask -> r27 */
/* Check if we may already be in the hashtable, in this case, we /* 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 * go to out-of-line code to try to modify the HPTE
......
...@@ -52,7 +52,7 @@ long native_hpte_insert(unsigned long hpte_group, unsigned long va, ...@@ -52,7 +52,7 @@ long native_hpte_insert(unsigned long hpte_group, unsigned long va,
unsigned long hpteflags, int bolted, int large) unsigned long hpteflags, int bolted, int large)
{ {
unsigned long arpn = physRpn_to_absRpn(prpn); unsigned long arpn = physRpn_to_absRpn(prpn);
HPTE *hptep = htab_data.htab + hpte_group; HPTE *hptep = htab_address + hpte_group;
Hpte_dword0 dw0; Hpte_dword0 dw0;
HPTE lhpte; HPTE lhpte;
int i; int i;
...@@ -117,7 +117,7 @@ static long native_hpte_remove(unsigned long hpte_group) ...@@ -117,7 +117,7 @@ static long native_hpte_remove(unsigned long hpte_group)
slot_offset = mftb() & 0x7; slot_offset = mftb() & 0x7;
for (i = 0; i < HPTES_PER_GROUP; i++) { 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; dw0 = hptep->dw0.dw0;
if (dw0.v && !dw0.bolted) { if (dw0.v && !dw0.bolted) {
...@@ -172,9 +172,9 @@ static long native_hpte_find(unsigned long vpn) ...@@ -172,9 +172,9 @@ static long native_hpte_find(unsigned long vpn)
hash = hpt_hash(vpn, 0); hash = hpt_hash(vpn, 0);
for (j = 0; j < 2; j++) { 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++) { for (i = 0; i < HPTES_PER_GROUP; i++) {
hptep = htab_data.htab + slot; hptep = htab_address + slot;
dw0 = hptep->dw0.dw0; dw0 = hptep->dw0.dw0;
if ((dw0.avpn == (vpn >> 11)) && dw0.v && if ((dw0.avpn == (vpn >> 11)) && dw0.v &&
...@@ -195,7 +195,7 @@ static long native_hpte_find(unsigned long vpn) ...@@ -195,7 +195,7 @@ static long native_hpte_find(unsigned long vpn)
static long native_hpte_updatepp(unsigned long slot, unsigned long newpp, static long native_hpte_updatepp(unsigned long slot, unsigned long newpp,
unsigned long va, int large, int local) unsigned long va, int large, int local)
{ {
HPTE *hptep = htab_data.htab + slot; HPTE *hptep = htab_address + slot;
Hpte_dword0 dw0; Hpte_dword0 dw0;
unsigned long avpn = va >> 23; unsigned long avpn = va >> 23;
int ret = 0; int ret = 0;
...@@ -254,7 +254,7 @@ static void native_hpte_updateboltedpp(unsigned long newpp, unsigned long ea) ...@@ -254,7 +254,7 @@ static void native_hpte_updateboltedpp(unsigned long newpp, unsigned long ea)
slot = native_hpte_find(vpn); slot = native_hpte_find(vpn);
if (slot == -1) if (slot == -1)
panic("could not find page to bolt\n"); panic("could not find page to bolt\n");
hptep = htab_data.htab + slot; hptep = htab_address + slot;
set_pp_bit(newpp, hptep); set_pp_bit(newpp, hptep);
...@@ -269,7 +269,7 @@ static void native_hpte_updateboltedpp(unsigned long newpp, unsigned long ea) ...@@ -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, static void native_hpte_invalidate(unsigned long slot, unsigned long va,
int large, int local) int large, int local)
{ {
HPTE *hptep = htab_data.htab + slot; HPTE *hptep = htab_address + slot;
Hpte_dword0 dw0; Hpte_dword0 dw0;
unsigned long avpn = va >> 23; unsigned long avpn = va >> 23;
unsigned long flags; unsigned long flags;
...@@ -336,10 +336,10 @@ static void native_flush_hash_range(unsigned long context, ...@@ -336,10 +336,10 @@ static void native_flush_hash_range(unsigned long context,
secondary = (pte_val(batch->pte[i]) & _PAGE_SECONDARY) >> 15; secondary = (pte_val(batch->pte[i]) & _PAGE_SECONDARY) >> 15;
if (secondary) if (secondary)
hash = ~hash; 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; slot += (pte_val(batch->pte[i]) & _PAGE_GROUP_IX) >> 12;
hptep = htab_data.htab + slot; hptep = htab_address + slot;
avpn = va >> 23; avpn = va >> 23;
if (large) if (large)
......
...@@ -74,7 +74,8 @@ ...@@ -74,7 +74,8 @@
extern unsigned long dart_tablebase; extern unsigned long dart_tablebase;
#endif /* CONFIG_U3_DART */ #endif /* CONFIG_U3_DART */
HTAB htab_data = {NULL, 0, 0, 0, 0}; HPTE *htab_address;
unsigned long htab_hash_mask;
extern unsigned long _SDR1; extern unsigned long _SDR1;
...@@ -113,7 +114,7 @@ static inline void create_pte_mapping(unsigned long start, unsigned long end, ...@@ -113,7 +114,7 @@ static inline void create_pte_mapping(unsigned long start, unsigned long end,
hash = hpt_hash(vpn, large); 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 #ifdef CONFIG_PPC_PSERIES
if (systemcfg->platform & PLATFORM_LPAR) if (systemcfg->platform & PLATFORM_LPAR)
...@@ -155,12 +156,11 @@ void __init htab_initialize(void) ...@@ -155,12 +156,11 @@ void __init htab_initialize(void)
htab_size_bytes = pteg_count << 7; htab_size_bytes = pteg_count << 7;
} }
htab_data.htab_num_ptegs = pteg_count; htab_hash_mask = pteg_count - 1;
htab_data.htab_hash_mask = pteg_count - 1;
if (systemcfg->platform & PLATFORM_LPAR) { if (systemcfg->platform & PLATFORM_LPAR) {
/* Using a hypervisor which owns the htab */ /* Using a hypervisor which owns the htab */
htab_data.htab = NULL; htab_address = NULL;
_SDR1 = 0; _SDR1 = 0;
} else { } else {
/* Find storage for the HPT. Must be contiguous in /* Find storage for the HPT. Must be contiguous in
...@@ -175,7 +175,7 @@ void __init htab_initialize(void) ...@@ -175,7 +175,7 @@ void __init htab_initialize(void)
ppc64_terminate_msg(0x20, "hpt space"); ppc64_terminate_msg(0x20, "hpt space");
loop_forever(); loop_forever();
} }
htab_data.htab = abs_to_virt(table); htab_address = abs_to_virt(table);
/* htab absolute addr + encoded htabsize */ /* htab absolute addr + encoded htabsize */
_SDR1 = table + __ilog2(pteg_count) - 11; _SDR1 = table + __ilog2(pteg_count) - 11;
...@@ -356,7 +356,7 @@ void flush_hash_page(unsigned long context, unsigned long ea, pte_t pte, ...@@ -356,7 +356,7 @@ void flush_hash_page(unsigned long context, unsigned long ea, pte_t pte,
secondary = (pte_val(pte) & _PAGE_SECONDARY) >> 15; secondary = (pte_val(pte) & _PAGE_SECONDARY) >> 15;
if (secondary) if (secondary)
hash = ~hash; 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; slot += (pte_val(pte) & _PAGE_GROUP_IX) >> 12;
ppc_md.hpte_invalidate(slot, va, huge, local); ppc_md.hpte_invalidate(slot, va, huge, local);
......
...@@ -832,7 +832,7 @@ int hash_huge_page(struct mm_struct *mm, unsigned long access, ...@@ -832,7 +832,7 @@ int hash_huge_page(struct mm_struct *mm, unsigned long access,
hash = hpt_hash(vpn, 1); hash = hpt_hash(vpn, 1);
if (pte_val(old_pte) & _PAGE_SECONDARY) if (pte_val(old_pte) & _PAGE_SECONDARY)
hash = ~hash; 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; slot += (pte_val(old_pte) & _PAGE_GROUP_IX) >> 12;
if (ppc_md.hpte_updatepp(slot, hpteflags, va, 1, local) == -1) 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, ...@@ -846,7 +846,7 @@ int hash_huge_page(struct mm_struct *mm, unsigned long access,
prpn = pte_pfn(old_pte); prpn = pte_pfn(old_pte);
repeat: repeat:
hpte_group = ((hash & htab_data.htab_hash_mask) * hpte_group = ((hash & htab_hash_mask) *
HPTES_PER_GROUP) & ~0x7UL; HPTES_PER_GROUP) & ~0x7UL;
/* Update the linux pte with the HPTE slot */ /* Update the linux pte with the HPTE slot */
...@@ -863,13 +863,13 @@ int hash_huge_page(struct mm_struct *mm, unsigned long access, ...@@ -863,13 +863,13 @@ int hash_huge_page(struct mm_struct *mm, unsigned long access,
/* Primary is full, try the secondary */ /* Primary is full, try the secondary */
if (unlikely(slot == -1)) { if (unlikely(slot == -1)) {
pte_val(new_pte) |= _PAGE_SECONDARY; pte_val(new_pte) |= _PAGE_SECONDARY;
hpte_group = ((~hash & htab_data.htab_hash_mask) * hpte_group = ((~hash & htab_hash_mask) *
HPTES_PER_GROUP) & ~0x7UL; HPTES_PER_GROUP) & ~0x7UL;
slot = ppc_md.hpte_insert(hpte_group, va, prpn, slot = ppc_md.hpte_insert(hpte_group, va, prpn,
1, hpteflags, 0, 1); 1, hpteflags, 0, 1);
if (slot == -1) { if (slot == -1) {
if (mftb() & 0x1) 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); ppc_md.hpte_remove(hpte_group);
goto repeat; goto repeat;
......
...@@ -168,7 +168,7 @@ static void map_io_page(unsigned long ea, unsigned long pa, int flags) ...@@ -168,7 +168,7 @@ static void map_io_page(unsigned long ea, unsigned long pa, int flags)
hash = hpt_hash(vpn, 0); 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 */ /* Panic if a pte grpup is full */
if (ppc_md.hpte_insert(hpteg, va, pa >> PAGE_SHIFT, 0, if (ppc_md.hpte_insert(hpteg, va, pa >> PAGE_SHIFT, 0,
......
...@@ -98,15 +98,8 @@ typedef struct { ...@@ -98,15 +98,8 @@ typedef struct {
#define PP_RXRX 3 /* Supervisor read, User read */ #define PP_RXRX 3 /* Supervisor read, User read */
typedef struct { extern HPTE * htab_address;
HPTE * htab; extern unsigned long htab_hash_mask;
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;
static inline unsigned long hpt_hash(unsigned long vpn, int large) static inline unsigned long hpt_hash(unsigned long vpn, int large)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment