Re: [RFC PATCH 3/7] mm: Change ioremap to set up huge I/O mappings

From: Andrew Morton
Date: Mon Jan 26 2015 - 18:58:17 EST


On Mon, 26 Jan 2015 16:13:25 -0700 Toshi Kani <toshi.kani@xxxxxx> wrote:

> Change ioremap_pud_range() and ioremap_pmd_range() to set up
> huge I/O mappings when their capability is enabled and their
> conditions are met in a given request -- both virtual & physical
> addresses are aligned and its range fufills the mapping size.
>
> These changes are only enabled when both CONFIG_HUGE_IOMAP
> and CONFIG_HAVE_ARCH_HUGE_VMAP are defined.
>
> --- a/lib/ioremap.c
> +++ b/lib/ioremap.c
> @@ -81,6 +81,14 @@ static inline int ioremap_pmd_range(pud_t *pud, unsigned long addr,
> return -ENOMEM;
> do {
> next = pmd_addr_end(addr, end);
> +
> + if (ioremap_pmd_enabled() &&
> + ((next - addr) == PMD_SIZE) &&
> + !((phys_addr + addr) & (PMD_SIZE-1))) {

IS_ALIGNED might be a little neater here.

> + pmd_set_huge(pmd, phys_addr + addr, prot);
> + continue;
> + }
> +
> if (ioremap_pte_range(pmd, addr, next, phys_addr + addr, prot))
> return -ENOMEM;
> } while (pmd++, addr = next, addr != end);
> @@ -99,6 +107,14 @@ static inline int ioremap_pud_range(pgd_t *pgd, unsigned long addr,
> return -ENOMEM;
> do {
> next = pud_addr_end(addr, end);
> +
> + if (ioremap_pud_enabled() &&
> + ((next - addr) == PUD_SIZE) &&
> + !((phys_addr + addr) & (PUD_SIZE-1))) {

And here.

> + pud_set_huge(pud, phys_addr + addr, prot);
> + continue;
> + }
> +
> if (ioremap_pmd_range(pud, addr, next, phys_addr + addr, prot))
> return -ENOMEM;
> } while (pud++, addr = next, addr != end);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/