]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[PATCH] ppc64: Remove redundant abs_to_phys() macro
authorMichael Ellerman <michael@ellerman.id.au>
Wed, 3 Aug 2005 10:21:25 +0000 (20:21 +1000)
committerPaul Mackerras <paulus@samba.org>
Mon, 29 Aug 2005 00:53:37 +0000 (10:53 +1000)
abs_to_phys() is a macro that turns out to do nothing, and also has the
unfortunate property that it's not the inverse of phys_to_abs() on iSeries.

The following is for my benefit as much as everyone else.

With CONFIG_MSCHUNKS enabled, the lmb code is changed such that it keeps
a physbase variable for each lmb region. This is used to take the possibly
discontiguous lmb regions and present them as a contiguous address space
beginning from zero.

In this context each lmb region's base address is its "absolute" base
address, and its physbase is it's "physical" address (from Linux's point of
view). The abs_to_phys() macro does the mapping from "absolute" to "physical".

Note: This is not related to the iSeries mapping of physical to absolute
(ie. Hypervisor) addresses which is maintained with the msChunks structure.
And the msChunks structure is not controlled via CONFIG_MSCHUNKS.

Once upon a time you could compile for non-iSeries with CONFIG_MSCHUNKS
enabled. But these days CONFIG_MSCHUNKS depends on CONFIG_PPC_ISERIES, so
for non-iSeries code abs_to_phys() is a no-op.

On iSeries we always have one lmb region which spans from 0 to
systemcfg->physicalMemorySize (arch/ppc64/kernel/iSeries_setup.c line 383).
This region has a base (ie. absolute) address of 0, and a physbase address
of 0 (as calculated in lmb_analyze() (arch/ppc64/kernel/lmb.c line 144)).

On iSeries, abs_to_phys(aa) is defined as lmb_abs_to_phys(aa), which finds
the lmb region containing aa (and there's only one, ie. 0), and then does:

 return lmb.memory.region[0].physbase + (aa - lmb.memory.region[0].base)

physbase == base == 0, so you're left with "return aa".

So remove abs_to_phys(), and lmb_abs_to_phys() which is the implementation
of abs_to_phys() for iSeries.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/ppc64/kernel/lmb.c
arch/ppc64/mm/init.c
include/asm-ppc64/abs_addr.h

index 6cb275615fc4984d872025562ef5efffb614cbaa..111da736652bc72c167f9567ec41b82666bd318d 100644 (file)
@@ -313,25 +313,6 @@ lmb_end_of_DRAM(void)
        return 0;
 }
 
-unsigned long __init
-lmb_abs_to_phys(unsigned long aa)
-{
-       unsigned long i, pa = aa;
-       struct lmb *_lmb = &lmb;
-       struct lmb_region *_mem = &(_lmb->memory);
-
-       for (i=0; i < _mem->cnt; i++) {
-               unsigned long lmbbase = _mem->region[i].base;
-               unsigned long lmbsize = _mem->region[i].size;
-               if ( lmb_addrs_overlap(aa,1,lmbbase,lmbsize) ) {
-                       pa = _mem->region[i].physbase + (aa - lmbbase);
-                       break;
-               }
-       }
-
-       return pa;
-}
-
 /*
  * Truncate the lmb list to memory_limit if it's set
  * You must call lmb_analyze() after this.
index 9edfe267123e8d40669b6becb81ece1574da6d55..a16cf12c586b1a245522b4891cd4ada86a7e904b 100644 (file)
@@ -42,7 +42,6 @@
 
 #include <asm/pgalloc.h>
 #include <asm/page.h>
-#include <asm/abs_addr.h>
 #include <asm/prom.h>
 #include <asm/lmb.h>
 #include <asm/rtas.h>
@@ -167,7 +166,6 @@ static int map_io_page(unsigned long ea, unsigned long pa, int flags)
                ptep = pte_alloc_kernel(&init_mm, pmdp, ea);
                if (!ptep)
                        return -ENOMEM;
-               pa = abs_to_phys(pa);
                set_pte_at(&init_mm, ea, ptep, pfn_pte(pa >> PAGE_SHIFT,
                                                          __pgprot(flags)));
                spin_unlock(&init_mm.page_table_lock);
@@ -547,7 +545,7 @@ void __init do_init_bootmem(void)
         */
        bootmap_pages = bootmem_bootmap_pages(total_pages);
 
-       start = abs_to_phys(lmb_alloc(bootmap_pages<<PAGE_SHIFT, PAGE_SIZE));
+       start = lmb_alloc(bootmap_pages<<PAGE_SHIFT, PAGE_SIZE);
        BUG_ON(!start);
 
        boot_mapsize = init_bootmem(start >> PAGE_SHIFT, total_pages);
index ab4320c1cf5b71da9ace3f6ad6c6f2b1c8d4a388..200db1c45f292a0b325793bee16126504f19bad3 100644 (file)
@@ -56,9 +56,6 @@ static inline unsigned long phys_to_abs(unsigned long pa)
        return chunk_to_addr(chunk) + (pa & MSCHUNKS_OFFSET_MASK);
 }
 
-/* A macro so it can take pointers or unsigned long. */
-#define abs_to_phys(aa) lmb_abs_to_phys((unsigned long)(aa))
-
 #else  /* !CONFIG_MSCHUNKS */
 
 #define chunk_to_addr(chunk) ((unsigned long)(chunk))
@@ -68,12 +65,11 @@ static inline unsigned long phys_to_abs(unsigned long pa)
 
 #define phys_to_abs(pa) (pa)
 #define physRpn_to_absRpn(rpn) (rpn)
-#define abs_to_phys(aa) (aa)
 
 #endif /* !CONFIG_MSCHUNKS */
 
 /* Convenience macros */
 #define virt_to_abs(va) phys_to_abs(__pa(va))
-#define abs_to_virt(aa) __va(abs_to_phys(aa))
+#define abs_to_virt(aa) __va(aa)
 
 #endif /* _ABS_ADDR_H */