Commit 8e561e7eda02819c711a75b64a000bf34948cdbb

Authored by David Gibson
Committed by Paul Mackerras
1 parent 9c709f3b62

[POWERPC] Kill typedef-ed structs for hash PTEs and BATs

Using typedefs to rename structure types if frowned on by CodingStyle.
However, we do so for the hash PTE structure on both ppc32 (where it's
called "PTE") and ppc64 (where it's called "hpte_t").  On ppc32 we
also have such a typedef for the BATs ("BAT").

This removes this unhelpful use of typedefs, in the process
bringing ppc32 and ppc64 closer together, by using the name "struct
hash_pte" in both cases.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>

Showing 9 changed files with 40 additions and 39 deletions Side-by-side Diff

arch/powerpc/mm/hash_native_64.c
... ... @@ -104,7 +104,7 @@
104 104 spin_unlock(&native_tlbie_lock);
105 105 }
106 106  
107   -static inline void native_lock_hpte(hpte_t *hptep)
  107 +static inline void native_lock_hpte(struct hash_pte *hptep)
108 108 {
109 109 unsigned long *word = &hptep->v;
110 110  
... ... @@ -116,7 +116,7 @@
116 116 }
117 117 }
118 118  
119   -static inline void native_unlock_hpte(hpte_t *hptep)
  119 +static inline void native_unlock_hpte(struct hash_pte *hptep)
120 120 {
121 121 unsigned long *word = &hptep->v;
122 122  
... ... @@ -128,7 +128,7 @@
128 128 unsigned long pa, unsigned long rflags,
129 129 unsigned long vflags, int psize)
130 130 {
131   - hpte_t *hptep = htab_address + hpte_group;
  131 + struct hash_pte *hptep = htab_address + hpte_group;
132 132 unsigned long hpte_v, hpte_r;
133 133 int i;
134 134  
... ... @@ -177,7 +177,7 @@
177 177  
178 178 static long native_hpte_remove(unsigned long hpte_group)
179 179 {
180   - hpte_t *hptep;
  180 + struct hash_pte *hptep;
181 181 int i;
182 182 int slot_offset;
183 183 unsigned long hpte_v;
... ... @@ -217,7 +217,7 @@
217 217 static long native_hpte_updatepp(unsigned long slot, unsigned long newpp,
218 218 unsigned long va, int psize, int local)
219 219 {
220   - hpte_t *hptep = htab_address + slot;
  220 + struct hash_pte *hptep = htab_address + slot;
221 221 unsigned long hpte_v, want_v;
222 222 int ret = 0;
223 223  
... ... @@ -250,7 +250,7 @@
250 250  
251 251 static long native_hpte_find(unsigned long va, int psize)
252 252 {
253   - hpte_t *hptep;
  253 + struct hash_pte *hptep;
254 254 unsigned long hash;
255 255 unsigned long i, j;
256 256 long slot;
... ... @@ -293,7 +293,7 @@
293 293 {
294 294 unsigned long vsid, va;
295 295 long slot;
296   - hpte_t *hptep;
  296 + struct hash_pte *hptep;
297 297  
298 298 vsid = get_kernel_vsid(ea);
299 299 va = (vsid << 28) | (ea & 0x0fffffff);
... ... @@ -314,7 +314,7 @@
314 314 static void native_hpte_invalidate(unsigned long slot, unsigned long va,
315 315 int psize, int local)
316 316 {
317   - hpte_t *hptep = htab_address + slot;
  317 + struct hash_pte *hptep = htab_address + slot;
318 318 unsigned long hpte_v;
319 319 unsigned long want_v;
320 320 unsigned long flags;
... ... @@ -344,7 +344,7 @@
344 344 #define LP_BITS 8
345 345 #define LP_MASK(i) ((0xFF >> (i)) << LP_SHIFT)
346 346  
347   -static void hpte_decode(hpte_t *hpte, unsigned long slot,
  347 +static void hpte_decode(struct hash_pte *hpte, unsigned long slot,
348 348 int *psize, unsigned long *va)
349 349 {
350 350 unsigned long hpte_r = hpte->r;
... ... @@ -414,7 +414,7 @@
414 414 static void native_hpte_clear(void)
415 415 {
416 416 unsigned long slot, slots, flags;
417   - hpte_t *hptep = htab_address;
  417 + struct hash_pte *hptep = htab_address;
418 418 unsigned long hpte_v, va;
419 419 unsigned long pteg_count;
420 420 int psize;
... ... @@ -461,7 +461,7 @@
461 461 static void native_flush_hash_range(unsigned long number, int local)
462 462 {
463 463 unsigned long va, hash, index, hidx, shift, slot;
464   - hpte_t *hptep;
  464 + struct hash_pte *hptep;
465 465 unsigned long hpte_v;
466 466 unsigned long want_v;
467 467 unsigned long flags;
arch/powerpc/mm/hash_utils_64.c
... ... @@ -87,7 +87,7 @@
87 87 static unsigned long _SDR1;
88 88 struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
89 89  
90   -hpte_t *htab_address;
  90 +struct hash_pte *htab_address;
91 91 unsigned long htab_size_bytes;
92 92 unsigned long htab_hash_mask;
93 93 int mmu_linear_psize = MMU_PAGE_4K;
arch/powerpc/mm/mmu_decl.h
... ... @@ -39,8 +39,8 @@
39 39 extern unsigned long ioremap_base;
40 40 extern unsigned int rtas_data, rtas_size;
41 41  
42   -struct _PTE;
43   -extern struct _PTE *Hash, *Hash_end;
  42 +struct hash_pte;
  43 +extern struct hash_pte *Hash, *Hash_end;
44 44 extern unsigned long Hash_size, Hash_mask;
45 45  
46 46 extern unsigned int num_tlbcam_entries;
arch/powerpc/mm/ppc_mmu_32.c
... ... @@ -34,12 +34,12 @@
34 34  
35 35 #include "mmu_decl.h"
36 36  
37   -PTE *Hash, *Hash_end;
  37 +struct hash_pte *Hash, *Hash_end;
38 38 unsigned long Hash_size, Hash_mask;
39 39 unsigned long _SDR1;
40 40  
41 41 union ubat { /* BAT register values to be loaded */
42   - BAT bat;
  42 + struct ppc_bat bat;
43 43 u32 word[2];
44 44 } BATS[8][2]; /* 8 pairs of IBAT, DBAT */
45 45  
... ... @@ -244,7 +244,7 @@
244 244 cacheable_memzero(Hash, Hash_size);
245 245 _SDR1 = __pa(Hash) | SDR1_LOW_BITS;
246 246  
247   - Hash_end = (PTE *) ((unsigned long)Hash + Hash_size);
  247 + Hash_end = (struct hash_pte *) ((unsigned long)Hash + Hash_size);
248 248  
249 249 printk("Total memory = %ldMB; using %ldkB for hash table (at %p)\n",
250 250 total_memory >> 20, Hash_size >> 10, Hash);
arch/powerpc/platforms/iseries/call_hpt.h
... ... @@ -76,24 +76,25 @@
76 76 return compressedStatus;
77 77 }
78 78  
79   -static inline u64 HvCallHpt_findValid(hpte_t *hpte, u64 vpn)
  79 +static inline u64 HvCallHpt_findValid(struct hash_pte *hpte, u64 vpn)
80 80 {
81 81 return HvCall3Ret16(HvCallHptFindValid, hpte, vpn, 0, 0);
82 82 }
83 83  
84   -static inline u64 HvCallHpt_findNextValid(hpte_t *hpte, u32 hpteIndex,
  84 +static inline u64 HvCallHpt_findNextValid(struct hash_pte *hpte, u32 hpteIndex,
85 85 u8 bitson, u8 bitsoff)
86 86 {
87 87 return HvCall3Ret16(HvCallHptFindNextValid, hpte, hpteIndex,
88 88 bitson, bitsoff);
89 89 }
90 90  
91   -static inline void HvCallHpt_get(hpte_t *hpte, u32 hpteIndex)
  91 +static inline void HvCallHpt_get(struct hash_pte *hpte, u32 hpteIndex)
92 92 {
93 93 HvCall2Ret16(HvCallHptGet, hpte, hpteIndex, 0);
94 94 }
95 95  
96   -static inline void HvCallHpt_addValidate(u32 hpteIndex, u32 hBit, hpte_t *hpte)
  96 +static inline void HvCallHpt_addValidate(u32 hpteIndex, u32 hBit,
  97 + struct hash_pte *hpte)
97 98 {
98 99 HvCall4(HvCallHptAddValidate, hpteIndex, hBit, hpte->v, hpte->r);
99 100 }
arch/powerpc/platforms/iseries/htab.c
... ... @@ -44,7 +44,7 @@
44 44 unsigned long vflags, int psize)
45 45 {
46 46 long slot;
47   - hpte_t lhpte;
  47 + struct hash_pte lhpte;
48 48 int secondary = 0;
49 49  
50 50 BUG_ON(psize != MMU_PAGE_4K);
... ... @@ -99,7 +99,7 @@
99 99  
100 100 static unsigned long iSeries_hpte_getword0(unsigned long slot)
101 101 {
102   - hpte_t hpte;
  102 + struct hash_pte hpte;
103 103  
104 104 HvCallHpt_get(&hpte, slot);
105 105 return hpte.v;
... ... @@ -144,7 +144,7 @@
144 144 static long iSeries_hpte_updatepp(unsigned long slot, unsigned long newpp,
145 145 unsigned long va, int psize, int local)
146 146 {
147   - hpte_t hpte;
  147 + struct hash_pte hpte;
148 148 unsigned long want_v;
149 149  
150 150 iSeries_hlock(slot);
... ... @@ -176,7 +176,7 @@
176 176 */
177 177 static long iSeries_hpte_find(unsigned long vpn)
178 178 {
179   - hpte_t hpte;
  179 + struct hash_pte hpte;
180 180 long slot;
181 181  
182 182 /*
arch/powerpc/platforms/ps3/htab.c
... ... @@ -34,7 +34,7 @@
34 34 #define DBG(fmt...) do{if(0)printk(fmt);}while(0)
35 35 #endif
36 36  
37   -static hpte_t *htab;
  37 +static struct hash_pte *htab;
38 38 static unsigned long htab_addr;
39 39 static unsigned char *bolttab;
40 40 static unsigned char *inusetab;
... ... @@ -44,8 +44,8 @@
44 44 #define debug_dump_hpte(_a, _b, _c, _d, _e, _f, _g) \
45 45 _debug_dump_hpte(_a, _b, _c, _d, _e, _f, _g, __func__, __LINE__)
46 46 static void _debug_dump_hpte(unsigned long pa, unsigned long va,
47   - unsigned long group, unsigned long bitmap, hpte_t lhpte, int psize,
48   - unsigned long slot, const char* func, int line)
  47 + unsigned long group, unsigned long bitmap, struct hash_pte lhpte,
  48 + int psize, unsigned long slot, const char* func, int line)
49 49 {
50 50 DBG("%s:%d: pa = %lxh\n", func, line, pa);
51 51 DBG("%s:%d: lpar = %lxh\n", func, line,
... ... @@ -63,7 +63,7 @@
63 63 unsigned long pa, unsigned long rflags, unsigned long vflags, int psize)
64 64 {
65 65 unsigned long slot;
66   - hpte_t lhpte;
  66 + struct hash_pte lhpte;
67 67 int secondary = 0;
68 68 unsigned long result;
69 69 unsigned long bitmap;
... ... @@ -255,7 +255,7 @@
255 255  
256 256 ppc64_pft_size = __ilog2(htab_size);
257 257  
258   - bitmap_size = htab_size / sizeof(hpte_t) / 8;
  258 + bitmap_size = htab_size / sizeof(struct hash_pte) / 8;
259 259  
260 260 bolttab = __va(lmb_alloc(bitmap_size, 1));
261 261 inusetab = __va(lmb_alloc(bitmap_size, 1));
... ... @@ -273,8 +273,8 @@
273 273  
274 274 result = lv1_map_htab(0, &htab_addr);
275 275  
276   - htab = (hpte_t *)__ioremap(htab_addr, htab_size,
277   - pgprot_val(PAGE_READONLY_X));
  276 + htab = (struct hash_pte *)__ioremap(htab_addr, htab_size,
  277 + pgprot_val(PAGE_READONLY_X));
278 278  
279 279 DBG("%s:%d: lpar %016lxh, virt %016lxh\n", __func__, __LINE__,
280 280 htab_addr, (unsigned long)htab);
include/asm-powerpc/mmu-hash32.h
... ... @@ -28,7 +28,7 @@
28 28 #define BPP_RW 0x02 /* Read/write */
29 29  
30 30 #ifndef __ASSEMBLY__
31   -typedef struct _BAT {
  31 +struct ppc_bat {
32 32 struct {
33 33 unsigned long bepi:15; /* Effective page index (virtual address) */
34 34 unsigned long :4; /* Unused */
... ... @@ -46,7 +46,7 @@
46 46 unsigned long :1; /* Unused */
47 47 unsigned long pp:2; /* Page access protections */
48 48 } batl; /* Lower register */
49   -} BAT;
  49 +};
50 50 #endif /* !__ASSEMBLY__ */
51 51  
52 52 /*
... ... @@ -62,7 +62,7 @@
62 62 #ifndef __ASSEMBLY__
63 63  
64 64 /* Hardware Page Table Entry */
65   -typedef struct _PTE {
  65 +struct hash_pte {
66 66 unsigned long v:1; /* Entry is valid */
67 67 unsigned long vsid:24; /* Virtual segment identifier */
68 68 unsigned long h:1; /* Hash algorithm indicator */
... ... @@ -77,7 +77,7 @@
77 77 unsigned long g:1; /* Guarded */
78 78 unsigned long :1; /* Unused */
79 79 unsigned long pp:2; /* Page protection */
80   -} PTE;
  80 +};
81 81  
82 82 typedef struct {
83 83 unsigned long id;
include/asm-powerpc/mmu-hash64.h
... ... @@ -103,12 +103,12 @@
103 103  
104 104 #ifndef __ASSEMBLY__
105 105  
106   -typedef struct {
  106 +struct hash_pte {
107 107 unsigned long v;
108 108 unsigned long r;
109   -} hpte_t;
  109 +};
110 110  
111   -extern hpte_t *htab_address;
  111 +extern struct hash_pte *htab_address;
112 112 extern unsigned long htab_size_bytes;
113 113 extern unsigned long htab_hash_mask;
114 114