[PATCH 10/14] cell: add iommu support for larger memory

Milton Miller miltonm at bga.com
Thu Dec 8 04:24:45 EST 2005


On Tue Dec 6 14:52:30 EST 2005, Arnd Bergmann wrote:
> Index: linux-2.6.15-rc/arch/powerpc/platforms/cell/iommu.c
> ===================================================================
> --- linux-2.6.15-rc.orig/arch/powerpc/platforms/cell/iommu.c
> +++ linux-2.6.15-rc/arch/powerpc/platforms/cell/iommu.c
...
> @@ -40,6 +42,7 @@
>  #include <asm/abs_addr.h>
>  #include <asm/system.h>
>  #include <asm/ppc-pci.h>
> +#include <asm/udbg.h>
>
>  #include "iommu.h"
>
> @@ -221,7 +224,7 @@ set_iopt_cache(void __iomem *base, unsig
>         unsigned long __iomem *tags = base + IOC_PT_CACHE_DIR;
>         unsigned long __iomem *p = base + IOC_PT_CACHE_REG;
>         pr_debug("iopt %02lx was v%016lx/t%016lx, store 
> v%016lx/t%016lx\n",
> -               index, get_iopt_cache(base, index, &oldtag), oldtag, 
> val, tag);
> +               index, get_iopt_cache(base, index, &tag), tag, val, 
> tag);

Assuming get_iopt_cache takes &tag to fill it in, this code is wrong.
The order of function argument evaluation is undefined in C, and the
compiler can choose to change its order at any time.

> -       for (address = 0; address < 0x100000000ul; address += 
> io_page_size) {
> -               ioste = get_iost_entry(0x10000000000ul, address, 
> io_page_size);
> -               if ((address & 0xfffffff) == 0) /* segment start */
> -                       set_iost_cache(base, address >> 28, ioste);
> -               index = get_ioc_hash_1way(ioste, address);
> +       for (real_address = 0, io_address = 0;
> +            io_address <= map_start + map_size;
> +            real_address += io_page_size, io_address += io_page_size) 
> {
> +               ioste = get_iost_entry(fake_iopt, io_address, 
> io_page_size);
> +               if ((real_address & 0xfffffff) == 0) /* segment start 
> */
> +                       set_iost_cache(ioc_mmio_base,
> +                                      io_address >> 28, ioste);
> +               index = get_ioc_hash_1way(ioste, io_address);

[comment] more magic numbers remain...

milton




More information about the Linuxppc64-dev mailing list