All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Rapoport <rppt@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Conor.Dooley@microchip.com, sfr@canb.auug.org.au,
	linux-next@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-riscv@lists.infradead.org
Subject: Re: linux-next: Tree for May 3
Date: Wed, 11 May 2022 17:37:50 +0300	[thread overview]
Message-ID: <YnvKPu5uQ8rqEcvV@kernel.org> (raw)
In-Reply-To: <20220511141034.GA31732@lst.de>

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.

WARNING: multiple messages have this Message-ID (diff)
From: Mike Rapoport <rppt@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Conor.Dooley@microchip.com, sfr@canb.auug.org.au,
	linux-next@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-riscv@lists.infradead.org
Subject: Re: linux-next: Tree for May 3
Date: Wed, 11 May 2022 17:37:50 +0300	[thread overview]
Message-ID: <YnvKPu5uQ8rqEcvV@kernel.org> (raw)
In-Reply-To: <20220511141034.GA31732@lst.de>

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.

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2022-05-11 14:38 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-03  7:29 linux-next: Tree for May 3 Stephen Rothwell
2022-05-04  8:32 ` Conor.Dooley
2022-05-04  8:32   ` Conor.Dooley
2022-05-09 13:33   ` Conor.Dooley
2022-05-09 13:33     ` Conor.Dooley
2022-05-09 14:11     ` Christoph Hellwig
2022-05-09 14:11       ` Christoph Hellwig
2022-05-09 14:39       ` Conor.Dooley
2022-05-09 14:39         ` Conor.Dooley
2022-05-10 11:20         ` Conor.Dooley
2022-05-10 11:20           ` Conor.Dooley
2022-05-11  6:22           ` Christoph Hellwig
2022-05-11  6:22             ` Christoph Hellwig
2022-05-11  6:44             ` Conor.Dooley
2022-05-11  6:44               ` Conor.Dooley
2022-05-11  6:48               ` Christoph Hellwig
2022-05-11  6:48                 ` Christoph Hellwig
2022-05-11 10:10                 ` Conor.Dooley
2022-05-11 10:10                   ` Conor.Dooley
2022-05-11 12:37                   ` Christoph Hellwig
2022-05-11 12:37                     ` Christoph Hellwig
2022-05-11 14:08                     ` Mike Rapoport
2022-05-11 14:08                       ` Mike Rapoport
2022-05-11 14:10                       ` Christoph Hellwig
2022-05-11 14:10                         ` Christoph Hellwig
2022-05-11 14:37                         ` Mike Rapoport [this message]
2022-05-11 14:37                           ` Mike Rapoport
2022-05-11 14:40                           ` Christoph Hellwig
2022-05-11 14:40                             ` Christoph Hellwig
2022-05-13  7:55                     ` Conor.Dooley
2022-05-13  7:55                       ` Conor.Dooley
2022-05-14 12:18                   ` Geert Uytterhoeven
2022-05-14 12:18                     ` Geert Uytterhoeven
2022-05-16  9:47                     ` Conor.Dooley
2022-05-16  9:47                       ` Conor.Dooley
  -- strict thread matches above, loose matches on Subject: below --
2024-05-03  7:17 Stephen Rothwell
2021-05-03  2:59 Stephen Rothwell
2019-05-03 10:00 Stephen Rothwell
2018-05-03  5:13 Stephen Rothwell
2017-05-03  5:54 Stephen Rothwell
2016-05-03  9:37 Stephen Rothwell
2013-05-03  4:10 Stephen Rothwell
2013-05-03  4:10 ` Stephen Rothwell
2012-05-03  6:38 Stephen Rothwell
2011-05-03  5:47 Stephen Rothwell
2010-05-03  5:16 Stephen Rothwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YnvKPu5uQ8rqEcvV@kernel.org \
    --to=rppt@kernel.org \
    --cc=Conor.Dooley@microchip.com \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=sfr@canb.auug.org.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.