Messages in this thread | | | Date | Wed, 11 May 2022 17:37:50 +0300 | From | Mike Rapoport <> | Subject | Re: linux-next: Tree for May 3 |
| |
On Wed, May 11, 2022 at 04:10:34PM +0200, Christoph Hellwig wrote: > On Wed, May 11, 2022 at 05:08:52PM +0300, Mike Rapoport wrote: > > I guess the default to use memblock_alloc_low() backfires on system with > > physical memory living at 0x1000200000: > > > > [ 0.000000] Early memory node ranges > > [ 0.000000] node 0: [mem 0x0000001000200000-0x000000103fffffff] > > > > The default limit for "low" memory is 0xffffffff and there is simply no > > memory there. > > Is there any way to ask memblock for a specific address limit? > swiotlb just wants <= 32-bit by default. With the little caveat > that it should be 32-bit addressable for all devices, and we don't > know the physical to dma address mapping at time of allocation.
There is
void *memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align, phys_addr_t min_addr, phys_addr_t max_addr, int nid);
that lets caller to specify min and max limits
Presuming that devices see [0x1000200000-0x103fffffff] as [0x200000-0x3fffffff] we may try something like
min = memblock_start_of_DRAM(); max = min + 0xffffffff;
if (flags & SWIOTLB_ANY) max = MEMBLOCK_ALLOC_ACCESSIBLE;
tlb = memblock_alloc_try_nid(bytes, PAGE_SIZE, min, max, NUMA_NO_NODE);
-- Sincerely yours, Mike.
| |