From: Christoph Hellwig <hch@infradead.org>
To: Yunhui Cui <cuiyunhui@bytedance.com>
Cc: paul.walmsley@sifive.com, palmer@dabbelt.com,
aou@eecs.berkeley.edu, alex@ghiti.fr, anshuman.khandual@arm.com,
akpm@linux-foundation.org, mingo@kernel.org,
catalin.marinas@arm.com, ryan.roberts@arm.com,
kirill.shutemov@linux.intel.com, namcao@linutronix.de,
bjorn@rivosinc.com, arnd@arndb.de, stuart.menefy@codasip.com,
luxu.kernel@bytedance.com, vincenzo.frascino@arm.com,
samuel.holland@sifive.com, christophe.leroy@csgroup.eu,
dawei.li@shingroup.cn, rppt@kernel.org,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] riscv: introduce the ioremap_prot() function
Date: Thu, 20 Mar 2025 08:41:32 -0700 [thread overview]
Message-ID: <Z9w3LL8oZixBKM3t@infradead.org> (raw)
In-Reply-To: <20250320084428.51151-1-cuiyunhui@bytedance.com>
> +{
> + phys_addr_t addr = PFN_PHYS(pfn);
> +
> + /* avoid false positives for bogus PFNs, see comment in pfn_valid() */
> + if (PHYS_PFN(addr) != pfn)
> + return 0;
> +
> + return memblock_is_map_memory(addr);
> +}
> +EXPORT_SYMBOL(pfn_is_map_memory);
This should not be exported or even exposed. Please just open code it
in the only caller.
> +void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
> + pgprot_t pgprot)
> +{
> + /* Don't allow RAM to be mapped. */
> + if (WARN_ON(pfn_is_map_memory(__phys_to_pfn(phys_addr))))
> + return NULL;
Or just use pfn_valid as that's what we usually use for that check.
Or am I missing something specific here?
It would also be nice to just life this to common code.
next prev parent reply other threads:[~2025-03-20 15:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-20 8:44 Yunhui Cui
2025-03-20 9:21 ` Arnd Bergmann
2025-03-24 1:30 ` [External] " yunhui cui
2025-03-24 8:42 ` Arnd Bergmann
2025-03-20 15:41 ` Christoph Hellwig [this message]
2025-03-24 1:34 ` yunhui cui
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=Z9w3LL8oZixBKM3t@infradead.org \
--to=hch@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=alex@ghiti.fr \
--cc=anshuman.khandual@arm.com \
--cc=aou@eecs.berkeley.edu \
--cc=arnd@arndb.de \
--cc=bjorn@rivosinc.com \
--cc=catalin.marinas@arm.com \
--cc=christophe.leroy@csgroup.eu \
--cc=cuiyunhui@bytedance.com \
--cc=dawei.li@shingroup.cn \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=luxu.kernel@bytedance.com \
--cc=mingo@kernel.org \
--cc=namcao@linutronix.de \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=rppt@kernel.org \
--cc=ryan.roberts@arm.com \
--cc=samuel.holland@sifive.com \
--cc=stuart.menefy@codasip.com \
--cc=vincenzo.frascino@arm.com \
/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
all inboxes | Powered by JetHome®