[PATCH] powerpc: Take 5, merge page.h

Milton Miller miltonm at bga.com
Sat Nov 12 04:17:46 EST 2005


On Fri Nov 11 14:25:24 EST 2005, Michael Ellerman wrote:
> +#ifndef __ASSEMBLY__
> +
> +#undef STRICT_MM_TYPECHECKS
> +
> +#ifdef STRICT_MM_TYPECHECKS

Should this be a debugging config?

> +/*
> + * We always define HW_PAGE_SHIFT to 12 as use of 64K pages remains 
> Linux
> + * specific, every notion of page number shared with the firmware, 
> TCEs,
> + * iommu, etc... still uses a page size of 4K.
> + */
> +#define HW_PAGE_SHIFT          12
> +#define HW_PAGE_SIZE           (ASM_CONST(1) << HW_PAGE_SHIFT)
> +#define HW_PAGE_MASK           (~(HW_PAGE_SIZE-1))
> +
> +/*
> + * PAGE_FACTOR is the number of bits factor between PAGE_SHIFT and
> + * HW_PAGE_SHIFT, that is 4K pages.
> + */
> +#define PAGE_FACTOR            (PAGE_SHIFT - HW_PAGE_SHIFT)
...

> +#ifdef CONFIG_PPC_64K_PAGES
> +static inline void copy_page(void *to, void *from)
> +{
> +       unsigned int i;
> +       for (i=0; i < (1 << (PAGE_SHIFT - 12)); i++) {
> +               copy_4K_page(to, from);
> +               to += 4096;
> +               from += 4096;
> +       }
> +}
> +#else /* CONFIG_PPC_64K_PAGES */
> +static inline void copy_page(void *to, void *from)
> +{
> +       copy_4K_page(to, from);
> +}
> +#endif /* CONFIG_PPC_64K_PAGES */
> +

Can the compiler optimize the first one to the second?  Can
we always use the first version?

milton




More information about the Linuxppc64-dev mailing list