mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ross Stutterheim <ross.stutterheim@garmin.com>
To: <linux-arm-kernel@lists.infradead.org>, <linux-kernel@vger.kernel.org>
Cc: Russell King <linux@armlinux.org.uk>,
	Mike Rapoport <rppt@linux.ibm.com>, <ross.stutterheim@garmin.com>,
	<ross.sweng@gmail.com>
Subject: [PATCH v2] arm/memremap: fix arch_memremap_can_ram_remap()
Date: Mon, 14 Apr 2025 09:21:40 -0500	[thread overview]
Message-ID: <20250414142140.131756-1-ross.stutterheim@garmin.com> (raw)
In-Reply-To: <20250414133219.107455-1-ross.stutterheim@garmin.com>

commit 260364d112bc ("arm[64]/memremap: don't abuse pfn_valid() to ensure
presence of linear map") added the definition of
arch_memremap_can_ram_remap() for arm[64] specific filtering of what pages
can be used from the linear mapping. memblock_is_map_memory() was called
with the pfn of the address given to arch_memremap_can_ram_remap();
however, memblock_is_map_memory() expects to be given an address for arm,
not a pfn.

This results in calls to memremap() returning a newly mapped area when
it should return an address in the existing linear mapping.

Fix this by removing the address to pfn translation and pass the
address directly.

Fixes: 260364d112bc ("arm[64]/memremap: don't abuse pfn_valid() to ensure presence of linear map")
Signed-off-by: Ross Stutterheim <ross.stutterheim@garmin.com>
---
 arch/arm/mm/ioremap.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index 748698e91a4b..27e64f782cb3 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -515,7 +515,5 @@ void __init early_ioremap_init(void)
 bool arch_memremap_can_ram_remap(resource_size_t offset, size_t size,
 				 unsigned long flags)
 {
-	unsigned long pfn = PHYS_PFN(offset);
-
-	return memblock_is_map_memory(pfn);
+	return memblock_is_map_memory(offset);
 }
-- 
2.49.0


  parent reply	other threads:[~2025-04-14 14:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-14 13:32 [PATCH] arm[64]/memremap: " Ross Stutterheim
2025-04-14 13:49 ` Catalin Marinas
2025-04-14 14:18   ` Ross Stutterheim
2025-04-14 14:21 ` Ross Stutterheim [this message]
2025-04-16 10:09   ` [PATCH v2] arm/memremap: " Catalin Marinas
2025-04-16 13:57     ` Ross Stutterheim
2025-04-16 15:48       ` Russell King (Oracle)
2025-04-16 22:54         ` Catalin Marinas
2025-04-19  7:04         ` Mike Rapoport
2025-04-16 11:13   ` Linus Walleij
2025-04-16 13:52 ` [PATCH v3] " Ross Stutterheim

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=20250414142140.131756-1-ross.stutterheim@garmin.com \
    --to=ross.stutterheim@garmin.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=ross.sweng@gmail.com \
    --cc=rppt@linux.ibm.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®