[PATCH] ppc64: Remove PTRRELOC() from msChunks code

The msChunks code was written to work on pSeries, but now it's only used on
iSeries. This means there's no need to do PTRRELOC anymore, so remove it all.

A few places were getting "extern reloc_offset()" from abs_addr.h, move it
into system.h instead.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>

authored by

Michael Ellerman and committed by
Paul Mackerras
38e85dc1 aed31351

+13 -35
+1 -9
arch/ppc64/kernel/LparData.c
··· 229 struct msChunks msChunks; 230 EXPORT_SYMBOL(msChunks); 231 232 - /* Depending on whether this is called from iSeries or pSeries setup 233 - * code, the location of the msChunks struct may or may not have 234 - * to be reloc'd, so we force the caller to do that for us by passing 235 - * in a pointer to the structure. 236 - */ 237 unsigned long 238 msChunks_alloc(unsigned long mem, unsigned long num_chunks, unsigned long chunk_size) 239 { 240 - unsigned long offset = reloc_offset(); 241 - struct msChunks *_msChunks = PTRRELOC(&msChunks); 242 - 243 _msChunks->num_chunks = num_chunks; 244 _msChunks->chunk_size = chunk_size; 245 _msChunks->chunk_shift = __ilog2(chunk_size); 246 _msChunks->chunk_mask = (1UL<<_msChunks->chunk_shift)-1; 247 248 mem = _ALIGN(mem, sizeof(msChunks_entry)); 249 - _msChunks->abs = (msChunks_entry *)(mem + offset); 250 mem += num_chunks * sizeof(msChunks_entry); 251 252 return mem;
··· 229 struct msChunks msChunks; 230 EXPORT_SYMBOL(msChunks); 231 232 unsigned long 233 msChunks_alloc(unsigned long mem, unsigned long num_chunks, unsigned long chunk_size) 234 { 235 _msChunks->num_chunks = num_chunks; 236 _msChunks->chunk_size = chunk_size; 237 _msChunks->chunk_shift = __ilog2(chunk_size); 238 _msChunks->chunk_mask = (1UL<<_msChunks->chunk_shift)-1; 239 240 mem = _ALIGN(mem, sizeof(msChunks_entry)); 241 + _msChunks->abs = (msChunks_entry *)mem; 242 mem += num_chunks * sizeof(msChunks_entry); 243 244 return mem;
+10 -26
include/asm-ppc64/abs_addr.h
··· 29 extern struct msChunks msChunks; 30 31 extern unsigned long msChunks_alloc(unsigned long, unsigned long, unsigned long); 32 - extern unsigned long reloc_offset(void); 33 34 #ifdef CONFIG_MSCHUNKS 35 36 - static inline unsigned long 37 - chunk_to_addr(unsigned long chunk) 38 { 39 - unsigned long offset = reloc_offset(); 40 - struct msChunks *_msChunks = PTRRELOC(&msChunks); 41 - 42 - return chunk << _msChunks->chunk_shift; 43 } 44 45 - static inline unsigned long 46 - addr_to_chunk(unsigned long addr) 47 { 48 - unsigned long offset = reloc_offset(); 49 - struct msChunks *_msChunks = PTRRELOC(&msChunks); 50 - 51 - return addr >> _msChunks->chunk_shift; 52 } 53 54 - static inline unsigned long 55 - chunk_offset(unsigned long addr) 56 { 57 - unsigned long offset = reloc_offset(); 58 - struct msChunks *_msChunks = PTRRELOC(&msChunks); 59 - 60 - return addr & _msChunks->chunk_mask; 61 } 62 63 - static inline unsigned long 64 - abs_chunk(unsigned long pchunk) 65 { 66 - unsigned long offset = reloc_offset(); 67 - struct msChunks *_msChunks = PTRRELOC(&msChunks); 68 - if ( pchunk >= _msChunks->num_chunks ) { 69 return pchunk; 70 - } 71 - return PTRRELOC(_msChunks->abs)[pchunk]; 72 } 73 74 /* A macro so it can take pointers or unsigned long. */
··· 29 extern struct msChunks msChunks; 30 31 extern unsigned long msChunks_alloc(unsigned long, unsigned long, unsigned long); 32 33 #ifdef CONFIG_MSCHUNKS 34 35 + static inline unsigned long chunk_to_addr(unsigned long chunk) 36 { 37 + return chunk << msChunks.chunk_shift; 38 } 39 40 + static inline unsigned long addr_to_chunk(unsigned long addr) 41 { 42 + return addr >> msChunks.chunk_shift; 43 } 44 45 + static inline unsigned long chunk_offset(unsigned long addr) 46 { 47 + return addr & msChunks.chunk_mask; 48 } 49 50 + static inline unsigned long abs_chunk(unsigned long pchunk) 51 { 52 + if (pchunk >= msChunks.num_chunks) 53 return pchunk; 54 + 55 + return msChunks.abs[pchunk]; 56 } 57 58 /* A macro so it can take pointers or unsigned long. */
+2
include/asm-ppc64/system.h
··· 302 303 #define arch_align_stack(x) (x) 304 305 #endif /* __KERNEL__ */ 306 #endif
··· 302 303 #define arch_align_stack(x) (x) 304 305 + extern unsigned long reloc_offset(void); 306 + 307 #endif /* __KERNEL__ */ 308 #endif