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

From: Toshi Kani
Date: Mon Jan 26 2015 - 19:17:56 EST


On Mon, 2015-01-26 at 15:58 -0800, Andrew Morton wrote:
> 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.

Right. Will use IS_ALIGNED.

> > + 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.

Will do.

Thanks,
-Toshi

--
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/