bus dma: a flag/quirk for page zero
avg at FreeBSD.org
Wed Jan 11 17:18:49 UTC 2012
on 11/01/2012 17:01 John Baldwin said the following:
> I think this is fine, but you should just always exclude page zero when allocating
> bounce pages. Bounce pages are assigned to zones that can be shared by multiple
> tags, so other tags that map to the same zone can alloc bounce pages that ohci
> will use (add_bounce_page() should probably take the bounce zone as an arg instead
> of a tag). I think it's not worth creating a separate zone just for ohci, but
> to forbid page zero from all zones instead.
Thank you for the explanation.
Actually, I think that on x86 we don't have to do anything special for any memory
allocations that we do, including the bounce pages, as the page zero is excluded
from phys_avail and is not available for normal use.
The only thing we have to do on x86 is to bounce the page zero if it gets passed
to us. (And that can happen only in very special situations, obviously. I am not
sure if anything besides the system dump would do that.)
And I would prefer to defer any changes to !x86 bus dma to the respective platform
maintainers, obviously ;-)
> Also, please change this:
> - if (newtag->lowaddr < ptoa((vm_paddr_t)Maxmem)
> - || newtag->alignment > 1)
> + if (newtag->lowaddr < ptoa((vm_paddr_t)Maxmem) ||
> + newtag->alignment > 1)
> + newtag->flags |= BUS_DMA_COULD_BOUNCE;
> + if ((newtag->flags & BUS_DMA_NO_PAGEZERO) != 0)
> newtag->flags |= BUS_DMA_COULD_BOUNCE;
> To just be one if.
More information about the freebsd-current