lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YnvKPu5uQ8rqEcvV@kernel.org>
Date:   Wed, 11 May 2022 17:37:50 +0300
From:   Mike Rapoport <rppt@...nel.org>
To:     Christoph Hellwig <hch@....de>
Cc:     Conor.Dooley@...rochip.com, sfr@...b.auug.org.au,
        linux-next@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-riscv@...ts.infradead.org
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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ