linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Nicolin Chen <nicoleotsuka@gmail.com>
To: "Jérôme Glisse" <jglisse@redhat.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: mm/hmm: a simple question regarding devm_request_mem_region()
Date: Wed, 21 Mar 2018 15:23:57 -0700	[thread overview]
Message-ID: <20180321222357.GA31089@Asurada-Nvidia> (raw)

Hello Jerome,

I started to looking at the mm/hmm code and having a question at the
devm_request_mem_region() call in the hmm_devmem_add() implementation:

>	addr = min((unsigned long)iomem_resource.end,
>		   (1UL << MAX_PHYSMEM_BITS) - 1);

The main question is here as I am a bit confused by this addr. The code
is trying to get an addr from the end of memory space. However, I have
tried on an ARM64 platform where ioport_resource.end is -1, so it takes
"(1UL << MAX_PHYSMEM_BITS) - 1" as the addr base, while this addr is way
beyond the actual main memory size that's available on my board. Is HMM
supposed to get an memory region like this? Would it be possible for you
to give some hint to help me understand it?

>	addr = addr - size + 1UL;
>
>	/*
>	 * FIXME add a new helper to quickly walk resource tree and find free
>	 * range
>	 *
>	 * FIXME what about ioport_resource resource ?
>	 */
>	for (; addr > size && addr >= iomem_resource.start; addr -= size) {
>		ret = region_intersects(addr, size, 0, IORES_DESC_NONE);
>		if (ret != REGION_DISJOINT)
>			continue;
>
>		devmem->resource = devm_request_mem_region(device, addr, size,

Thanks
Nicolin

             reply	other threads:[~2018-03-21 22:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-21 22:23 Nicolin Chen [this message]
2018-03-21 22:56 ` mm/hmm: a simple question regarding devm_request_mem_region() Jerome Glisse
2018-03-22  0:23   ` Nicolin Chen
2018-03-22  0:32     ` Jerome Glisse
2018-03-22  2:00       ` Nicolin Chen

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=20180321222357.GA31089@Asurada-Nvidia \
    --to=nicoleotsuka@gmail.com \
    --cc=jglisse@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).