public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] x86/ioremap: clean up the mess in xxx_is_setup_data
@ 2024-11-15  1:21 Baoquan He
  2024-11-15  1:21 ` [PATCH 1/3] x86/ioremap: introduce helper to check if physical address is in setup_data Baoquan He
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Baoquan He @ 2024-11-15  1:21 UTC (permalink / raw)
  To: linux-kernel, bp; +Cc: x86, thomas.lendacky, Baoquan He

Functions memremap_is_setup_data() and early_memremap_is_setup_data()
share completely the same process and handling, except of the
different memremap/unmap invocations. The code can be extracted and put
into a helper function __memremap_is_setup_data().

And parameter 'size' is unused in implementation of memremap_is_efi_data(),
memremap_is_setup_data and early_memremap_is_setup_data().

This patchset is made to clean them up. It sits on top of tip/x86/urgent
commit 8d9ffb2fe65a ("x86/mm: Fix a kdump kernel failure on SME system
when CONFIG_IMA_KEXEC=y")

Baoquan He (3):
  x86/ioremap: introduce helper to check if physical address is in
    setup_data
  x86/ioremap: use helper to implement xxx_is_setup_data()
  x86/mm: clean up unused parameters of functions

 arch/x86/mm/ioremap.c | 117 +++++++++++++++---------------------------
 1 file changed, 41 insertions(+), 76 deletions(-)

-- 
2.41.0


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/3] x86/ioremap: introduce helper to check if physical address is in setup_data
  2024-11-15  1:21 [PATCH 0/3] x86/ioremap: clean up the mess in xxx_is_setup_data Baoquan He
@ 2024-11-15  1:21 ` Baoquan He
  2024-11-15 11:28   ` [tip: x86/mm] x86/ioremap: Introduce " tip-bot2 for Baoquan He
  2024-11-15 14:22   ` [PATCH 1/3] x86/ioremap: introduce " Tom Lendacky
  2024-11-15  1:21 ` [PATCH 2/3] x86/ioremap: use helper to implement xxx_is_setup_data() Baoquan He
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 14+ messages in thread
From: Baoquan He @ 2024-11-15  1:21 UTC (permalink / raw)
  To: linux-kernel, bp; +Cc: x86, thomas.lendacky, Baoquan He

Functions memremap_is_setup_data() and early_memremap_is_setup_data()
share completely the same process and handling, except of the
different memremap/unmap invocations.

Add helper __memremap_is_setup_data() to extract the common part,
parameter 'early' is used to decide what kind of memremap/unmap
APIs are called.

Signed-off-by: Baoquan He <bhe@redhat.com>
---
 arch/x86/mm/ioremap.c | 81 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)

diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 8d29163568a7..5ef6182db630 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -628,6 +628,87 @@ static bool memremap_is_efi_data(resource_size_t phys_addr,
 	return false;
 }
 
+#define SD_SIZE sizeof(struct setup_data)
+/*
+ * Examine the physical address to determine if it is boot data by checking
+ * it against the boot params setup_data chain.
+ */
+static bool __init __memremap_is_setup_data(resource_size_t phys_addr,
+						bool early)
+{
+	struct setup_indirect *indirect;
+	struct setup_data *data;
+	u64 paddr, paddr_next;
+
+	paddr = boot_params.hdr.setup_data;
+	while (paddr) {
+		unsigned int len, size;
+
+		if (phys_addr == paddr)
+			return true;
+
+		if (early)
+			data = early_memremap_decrypted(paddr, SD_SIZE);
+		else
+			data = memremap(paddr, SD_SIZE,
+					MEMREMAP_WB | MEMREMAP_DEC);
+		if (!data) {
+			pr_warn("failed to memremap setup_data entry\n");
+			return false;
+		}
+
+		size = SD_SIZE;
+
+		paddr_next = data->next;
+		len = data->len;
+
+		if ((phys_addr > paddr) &&
+		    (phys_addr < (paddr + SD_SIZE + len))) {
+			if (early)
+				early_memunmap(data, SD_SIZE);
+			else
+				memunmap(data);
+			return true;
+		}
+
+		if (data->type == SETUP_INDIRECT) {
+			size += len;
+			if (early) {
+				early_memunmap(data, SD_SIZE);
+				data = early_memremap_decrypted(paddr, size);
+			} else {
+				memunmap(data);
+				data = memremap(paddr, size,
+						MEMREMAP_WB | MEMREMAP_DEC);
+			}
+			if (!data) {
+				pr_warn("failed to memremap indirect setup_data\n");
+				return false;
+			}
+
+			indirect = (struct setup_indirect *)data->data;
+
+			if (indirect->type != SETUP_INDIRECT) {
+				paddr = indirect->addr;
+				len = indirect->len;
+			}
+		}
+
+		if (early)
+			early_memunmap(data, size);
+		else
+			memunmap(data);
+
+		if ((phys_addr > paddr) && (phys_addr < (paddr + len)))
+			return true;
+
+		paddr = paddr_next;
+	}
+
+	return false;
+}
+#undef SD_SIZE
+
 /*
  * Examine the physical address to determine if it is boot data by checking
  * it against the boot params setup_data chain.
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/3] x86/ioremap: use helper to implement xxx_is_setup_data()
  2024-11-15  1:21 [PATCH 0/3] x86/ioremap: clean up the mess in xxx_is_setup_data Baoquan He
  2024-11-15  1:21 ` [PATCH 1/3] x86/ioremap: introduce helper to check if physical address is in setup_data Baoquan He
@ 2024-11-15  1:21 ` Baoquan He
  2024-11-15 11:28   ` [tip: x86/mm] x86/ioremap: Use " tip-bot2 for Baoquan He
  2024-11-15 14:24   ` [PATCH 2/3] x86/ioremap: use " Tom Lendacky
  2024-11-15  1:21 ` [PATCH 3/3] x86/mm: clean up unused parameters of functions Baoquan He
  2024-11-15  1:23 ` [PATCH 0/3] x86/ioremap: clean up the mess in xxx_is_setup_data Baoquan He
  3 siblings, 2 replies; 14+ messages in thread
From: Baoquan He @ 2024-11-15  1:21 UTC (permalink / raw)
  To: linux-kernel, bp; +Cc: x86, thomas.lendacky, Baoquan He

This simplifies codes a lot by removing the duplicated code handling.

And also remove the similar code comment above of them.

While at it, add __ref to memremap_is_setup_data() to avoid
the section mismatch warning:

WARNING: modpost: vmlinux: section mismatch in reference: arch_memremap_can_ram_remap.cold+0x6 (section: .text.unlikely) -> __memremap_is_setup_data (section: .init.text)
Signed-off-by: Baoquan He <bhe@redhat.com>
---
 arch/x86/mm/ioremap.c | 119 ++----------------------------------------
 1 file changed, 3 insertions(+), 116 deletions(-)

diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 5ef6182db630..5d1b5e4a8756 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -709,129 +709,16 @@ static bool __init __memremap_is_setup_data(resource_size_t phys_addr,
 }
 #undef SD_SIZE
 
-/*
- * Examine the physical address to determine if it is boot data by checking
- * it against the boot params setup_data chain.
- */
-static bool memremap_is_setup_data(resource_size_t phys_addr,
+static bool __ref memremap_is_setup_data(resource_size_t phys_addr,
 				   unsigned long size)
 {
-	struct setup_indirect *indirect;
-	struct setup_data *data;
-	u64 paddr, paddr_next;
-
-	paddr = boot_params.hdr.setup_data;
-	while (paddr) {
-		unsigned int len;
-
-		if (phys_addr == paddr)
-			return true;
-
-		data = memremap(paddr, sizeof(*data),
-				MEMREMAP_WB | MEMREMAP_DEC);
-		if (!data) {
-			pr_warn("failed to memremap setup_data entry\n");
-			return false;
-		}
-
-		paddr_next = data->next;
-		len = data->len;
-
-		if ((phys_addr > paddr) &&
-		    (phys_addr < (paddr + sizeof(struct setup_data) + len))) {
-			memunmap(data);
-			return true;
-		}
-
-		if (data->type == SETUP_INDIRECT) {
-			memunmap(data);
-			data = memremap(paddr, sizeof(*data) + len,
-					MEMREMAP_WB | MEMREMAP_DEC);
-			if (!data) {
-				pr_warn("failed to memremap indirect setup_data\n");
-				return false;
-			}
-
-			indirect = (struct setup_indirect *)data->data;
-
-			if (indirect->type != SETUP_INDIRECT) {
-				paddr = indirect->addr;
-				len = indirect->len;
-			}
-		}
-
-		memunmap(data);
-
-		if ((phys_addr > paddr) && (phys_addr < (paddr + len)))
-			return true;
-
-		paddr = paddr_next;
-	}
-
-	return false;
+	return __memremap_is_setup_data(phys_addr, false);
 }
 
-/*
- * Examine the physical address to determine if it is boot data by checking
- * it against the boot params setup_data chain (early boot version).
- */
 static bool __init early_memremap_is_setup_data(resource_size_t phys_addr,
 						unsigned long size)
 {
-	struct setup_indirect *indirect;
-	struct setup_data *data;
-	u64 paddr, paddr_next;
-
-	paddr = boot_params.hdr.setup_data;
-	while (paddr) {
-		unsigned int len, size;
-
-		if (phys_addr == paddr)
-			return true;
-
-		data = early_memremap_decrypted(paddr, sizeof(*data));
-		if (!data) {
-			pr_warn("failed to early memremap setup_data entry\n");
-			return false;
-		}
-
-		size = sizeof(*data);
-
-		paddr_next = data->next;
-		len = data->len;
-
-		if ((phys_addr > paddr) &&
-		    (phys_addr < (paddr + sizeof(struct setup_data) + len))) {
-			early_memunmap(data, sizeof(*data));
-			return true;
-		}
-
-		if (data->type == SETUP_INDIRECT) {
-			size += len;
-			early_memunmap(data, sizeof(*data));
-			data = early_memremap_decrypted(paddr, size);
-			if (!data) {
-				pr_warn("failed to early memremap indirect setup_data\n");
-				return false;
-			}
-
-			indirect = (struct setup_indirect *)data->data;
-
-			if (indirect->type != SETUP_INDIRECT) {
-				paddr = indirect->addr;
-				len = indirect->len;
-			}
-		}
-
-		early_memunmap(data, size);
-
-		if ((phys_addr > paddr) && (phys_addr < (paddr + len)))
-			return true;
-
-		paddr = paddr_next;
-	}
-
-	return false;
+	return __memremap_is_setup_data(phys_addr, true);
 }
 
 /*
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/3] x86/mm: clean up unused parameters of functions
  2024-11-15  1:21 [PATCH 0/3] x86/ioremap: clean up the mess in xxx_is_setup_data Baoquan He
  2024-11-15  1:21 ` [PATCH 1/3] x86/ioremap: introduce helper to check if physical address is in setup_data Baoquan He
  2024-11-15  1:21 ` [PATCH 2/3] x86/ioremap: use helper to implement xxx_is_setup_data() Baoquan He
@ 2024-11-15  1:21 ` Baoquan He
  2024-11-15 11:28   ` [tip: x86/mm] x86/mm: Clean " tip-bot2 for Baoquan He
  2024-11-15 14:27   ` [PATCH 3/3] x86/mm: clean " Tom Lendacky
  2024-11-15  1:23 ` [PATCH 0/3] x86/ioremap: clean up the mess in xxx_is_setup_data Baoquan He
  3 siblings, 2 replies; 14+ messages in thread
From: Baoquan He @ 2024-11-15  1:21 UTC (permalink / raw)
  To: linux-kernel, bp; +Cc: x86, thomas.lendacky, Baoquan He

For functions memremap_is_efi_data(), memremap_is_setup_data and
early_memremap_is_setup_data(), their parameter 'size' is not used
and sometime cause confusion. Remove it now.

Signed-off-by: Baoquan He <bhe@redhat.com>
---
 arch/x86/mm/ioremap.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 5d1b5e4a8756..71b282e5a4a0 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -593,8 +593,7 @@ static bool memremap_should_map_decrypted(resource_size_t phys_addr,
  * Examine the physical address to determine if it is EFI data. Check
  * it against the boot params structure and EFI tables and memory types.
  */
-static bool memremap_is_efi_data(resource_size_t phys_addr,
-				 unsigned long size)
+static bool memremap_is_efi_data(resource_size_t phys_addr)
 {
 	u64 paddr;
 
@@ -709,14 +708,12 @@ static bool __init __memremap_is_setup_data(resource_size_t phys_addr,
 }
 #undef SD_SIZE
 
-static bool __ref memremap_is_setup_data(resource_size_t phys_addr,
-				   unsigned long size)
+static bool __ref memremap_is_setup_data(resource_size_t phys_addr)
 {
 	return __memremap_is_setup_data(phys_addr, false);
 }
 
-static bool __init early_memremap_is_setup_data(resource_size_t phys_addr,
-						unsigned long size)
+static bool __init early_memremap_is_setup_data(resource_size_t phys_addr)
 {
 	return __memremap_is_setup_data(phys_addr, true);
 }
@@ -739,8 +736,8 @@ bool arch_memremap_can_ram_remap(resource_size_t phys_addr, unsigned long size,
 		return false;
 
 	if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT)) {
-		if (memremap_is_setup_data(phys_addr, size) ||
-		    memremap_is_efi_data(phys_addr, size))
+		if (memremap_is_setup_data(phys_addr) ||
+		    memremap_is_efi_data(phys_addr))
 			return false;
 	}
 
@@ -765,8 +762,8 @@ pgprot_t __init early_memremap_pgprot_adjust(resource_size_t phys_addr,
 	encrypted_prot = true;
 
 	if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT)) {
-		if (early_memremap_is_setup_data(phys_addr, size) ||
-		    memremap_is_efi_data(phys_addr, size))
+		if (early_memremap_is_setup_data(phys_addr) ||
+		    memremap_is_efi_data(phys_addr))
 			encrypted_prot = false;
 	}
 
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/3] x86/ioremap: clean up the mess in xxx_is_setup_data
  2024-11-15  1:21 [PATCH 0/3] x86/ioremap: clean up the mess in xxx_is_setup_data Baoquan He
                   ` (2 preceding siblings ...)
  2024-11-15  1:21 ` [PATCH 3/3] x86/mm: clean up unused parameters of functions Baoquan He
@ 2024-11-15  1:23 ` Baoquan He
  3 siblings, 0 replies; 14+ messages in thread
From: Baoquan He @ 2024-11-15  1:23 UTC (permalink / raw)
  To: kexec; +Cc: x86, thomas.lendacky, linux-kernel, bp

Also CC kexec list.

On 11/15/24 at 09:21am, Baoquan He wrote:
> Functions memremap_is_setup_data() and early_memremap_is_setup_data()
> share completely the same process and handling, except of the
> different memremap/unmap invocations. The code can be extracted and put
> into a helper function __memremap_is_setup_data().
> 
> And parameter 'size' is unused in implementation of memremap_is_efi_data(),
> memremap_is_setup_data and early_memremap_is_setup_data().
> 
> This patchset is made to clean them up. It sits on top of tip/x86/urgent
> commit 8d9ffb2fe65a ("x86/mm: Fix a kdump kernel failure on SME system
> when CONFIG_IMA_KEXEC=y")
> 
> Baoquan He (3):
>   x86/ioremap: introduce helper to check if physical address is in
>     setup_data
>   x86/ioremap: use helper to implement xxx_is_setup_data()
>   x86/mm: clean up unused parameters of functions
> 
>  arch/x86/mm/ioremap.c | 117 +++++++++++++++---------------------------
>  1 file changed, 41 insertions(+), 76 deletions(-)
> 
> -- 
> 2.41.0
> 


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [tip: x86/mm] x86/mm: Clean up unused parameters of functions
  2024-11-15  1:21 ` [PATCH 3/3] x86/mm: clean up unused parameters of functions Baoquan He
@ 2024-11-15 11:28   ` tip-bot2 for Baoquan He
  2024-11-15 14:27   ` [PATCH 3/3] x86/mm: clean " Tom Lendacky
  1 sibling, 0 replies; 14+ messages in thread
From: tip-bot2 for Baoquan He @ 2024-11-15 11:28 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Baoquan He, Ingo Molnar, x86, linux-kernel

The following commit has been merged into the x86/mm branch of tip:

Commit-ID:     390c9c9e48b821fc53b67dd93ae0f7a1f82a0469
Gitweb:        https://git.kernel.org/tip/390c9c9e48b821fc53b67dd93ae0f7a1f82a0469
Author:        Baoquan He <bhe@redhat.com>
AuthorDate:    Fri, 15 Nov 2024 09:21:31 +08:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Fri, 15 Nov 2024 12:03:36 +01:00

x86/mm: Clean up unused parameters of functions

For functions memremap_is_efi_data(), memremap_is_setup_data and
early_memremap_is_setup_data(), their parameter 'size' is not used
and sometime cause confusion. Remove it now.

Signed-off-by: Baoquan He <bhe@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20241115012131.509226-4-bhe@redhat.com
---
 arch/x86/mm/ioremap.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 5d1b5e4..71b282e 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -593,8 +593,7 @@ static bool memremap_should_map_decrypted(resource_size_t phys_addr,
  * Examine the physical address to determine if it is EFI data. Check
  * it against the boot params structure and EFI tables and memory types.
  */
-static bool memremap_is_efi_data(resource_size_t phys_addr,
-				 unsigned long size)
+static bool memremap_is_efi_data(resource_size_t phys_addr)
 {
 	u64 paddr;
 
@@ -709,14 +708,12 @@ static bool __init __memremap_is_setup_data(resource_size_t phys_addr,
 }
 #undef SD_SIZE
 
-static bool __ref memremap_is_setup_data(resource_size_t phys_addr,
-				   unsigned long size)
+static bool __ref memremap_is_setup_data(resource_size_t phys_addr)
 {
 	return __memremap_is_setup_data(phys_addr, false);
 }
 
-static bool __init early_memremap_is_setup_data(resource_size_t phys_addr,
-						unsigned long size)
+static bool __init early_memremap_is_setup_data(resource_size_t phys_addr)
 {
 	return __memremap_is_setup_data(phys_addr, true);
 }
@@ -739,8 +736,8 @@ bool arch_memremap_can_ram_remap(resource_size_t phys_addr, unsigned long size,
 		return false;
 
 	if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT)) {
-		if (memremap_is_setup_data(phys_addr, size) ||
-		    memremap_is_efi_data(phys_addr, size))
+		if (memremap_is_setup_data(phys_addr) ||
+		    memremap_is_efi_data(phys_addr))
 			return false;
 	}
 
@@ -765,8 +762,8 @@ pgprot_t __init early_memremap_pgprot_adjust(resource_size_t phys_addr,
 	encrypted_prot = true;
 
 	if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT)) {
-		if (early_memremap_is_setup_data(phys_addr, size) ||
-		    memremap_is_efi_data(phys_addr, size))
+		if (early_memremap_is_setup_data(phys_addr) ||
+		    memremap_is_efi_data(phys_addr))
 			encrypted_prot = false;
 	}
 

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [tip: x86/mm] x86/ioremap: Use helper to implement xxx_is_setup_data()
  2024-11-15  1:21 ` [PATCH 2/3] x86/ioremap: use helper to implement xxx_is_setup_data() Baoquan He
@ 2024-11-15 11:28   ` tip-bot2 for Baoquan He
  2024-11-15 14:24   ` [PATCH 2/3] x86/ioremap: use " Tom Lendacky
  1 sibling, 0 replies; 14+ messages in thread
From: tip-bot2 for Baoquan He @ 2024-11-15 11:28 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Baoquan He, Ingo Molnar, x86, linux-kernel

The following commit has been merged into the x86/mm branch of tip:

Commit-ID:     ca9114c1fbb478f69e2e4508b3c126058c5d5521
Gitweb:        https://git.kernel.org/tip/ca9114c1fbb478f69e2e4508b3c126058c5d5521
Author:        Baoquan He <bhe@redhat.com>
AuthorDate:    Fri, 15 Nov 2024 09:21:30 +08:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Fri, 15 Nov 2024 12:03:36 +01:00

x86/ioremap: Use helper to implement xxx_is_setup_data()

This simplifies codes a lot by removing the duplicated code handling.

And also remove the similar code comment above of them.

While at it, add __ref to memremap_is_setup_data() to avoid
the section mismatch warning:

  WARNING: modpost: vmlinux: section mismatch in reference: arch_memremap_can_ram_remap.cold+0x6 (section: .text.unlikely) -> __memremap_is_setup_data (section: .init.text)

Signed-off-by: Baoquan He <bhe@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20241115012131.509226-3-bhe@redhat.com
---
 arch/x86/mm/ioremap.c | 119 +----------------------------------------
 1 file changed, 3 insertions(+), 116 deletions(-)

diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 5ef6182..5d1b5e4 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -709,129 +709,16 @@ static bool __init __memremap_is_setup_data(resource_size_t phys_addr,
 }
 #undef SD_SIZE
 
-/*
- * Examine the physical address to determine if it is boot data by checking
- * it against the boot params setup_data chain.
- */
-static bool memremap_is_setup_data(resource_size_t phys_addr,
+static bool __ref memremap_is_setup_data(resource_size_t phys_addr,
 				   unsigned long size)
 {
-	struct setup_indirect *indirect;
-	struct setup_data *data;
-	u64 paddr, paddr_next;
-
-	paddr = boot_params.hdr.setup_data;
-	while (paddr) {
-		unsigned int len;
-
-		if (phys_addr == paddr)
-			return true;
-
-		data = memremap(paddr, sizeof(*data),
-				MEMREMAP_WB | MEMREMAP_DEC);
-		if (!data) {
-			pr_warn("failed to memremap setup_data entry\n");
-			return false;
-		}
-
-		paddr_next = data->next;
-		len = data->len;
-
-		if ((phys_addr > paddr) &&
-		    (phys_addr < (paddr + sizeof(struct setup_data) + len))) {
-			memunmap(data);
-			return true;
-		}
-
-		if (data->type == SETUP_INDIRECT) {
-			memunmap(data);
-			data = memremap(paddr, sizeof(*data) + len,
-					MEMREMAP_WB | MEMREMAP_DEC);
-			if (!data) {
-				pr_warn("failed to memremap indirect setup_data\n");
-				return false;
-			}
-
-			indirect = (struct setup_indirect *)data->data;
-
-			if (indirect->type != SETUP_INDIRECT) {
-				paddr = indirect->addr;
-				len = indirect->len;
-			}
-		}
-
-		memunmap(data);
-
-		if ((phys_addr > paddr) && (phys_addr < (paddr + len)))
-			return true;
-
-		paddr = paddr_next;
-	}
-
-	return false;
+	return __memremap_is_setup_data(phys_addr, false);
 }
 
-/*
- * Examine the physical address to determine if it is boot data by checking
- * it against the boot params setup_data chain (early boot version).
- */
 static bool __init early_memremap_is_setup_data(resource_size_t phys_addr,
 						unsigned long size)
 {
-	struct setup_indirect *indirect;
-	struct setup_data *data;
-	u64 paddr, paddr_next;
-
-	paddr = boot_params.hdr.setup_data;
-	while (paddr) {
-		unsigned int len, size;
-
-		if (phys_addr == paddr)
-			return true;
-
-		data = early_memremap_decrypted(paddr, sizeof(*data));
-		if (!data) {
-			pr_warn("failed to early memremap setup_data entry\n");
-			return false;
-		}
-
-		size = sizeof(*data);
-
-		paddr_next = data->next;
-		len = data->len;
-
-		if ((phys_addr > paddr) &&
-		    (phys_addr < (paddr + sizeof(struct setup_data) + len))) {
-			early_memunmap(data, sizeof(*data));
-			return true;
-		}
-
-		if (data->type == SETUP_INDIRECT) {
-			size += len;
-			early_memunmap(data, sizeof(*data));
-			data = early_memremap_decrypted(paddr, size);
-			if (!data) {
-				pr_warn("failed to early memremap indirect setup_data\n");
-				return false;
-			}
-
-			indirect = (struct setup_indirect *)data->data;
-
-			if (indirect->type != SETUP_INDIRECT) {
-				paddr = indirect->addr;
-				len = indirect->len;
-			}
-		}
-
-		early_memunmap(data, size);
-
-		if ((phys_addr > paddr) && (phys_addr < (paddr + len)))
-			return true;
-
-		paddr = paddr_next;
-	}
-
-	return false;
+	return __memremap_is_setup_data(phys_addr, true);
 }
 
 /*

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [tip: x86/mm] x86/ioremap: Introduce helper to check if physical address is in setup_data
  2024-11-15  1:21 ` [PATCH 1/3] x86/ioremap: introduce helper to check if physical address is in setup_data Baoquan He
@ 2024-11-15 11:28   ` tip-bot2 for Baoquan He
  2024-11-15 14:22   ` [PATCH 1/3] x86/ioremap: introduce " Tom Lendacky
  1 sibling, 0 replies; 14+ messages in thread
From: tip-bot2 for Baoquan He @ 2024-11-15 11:28 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Baoquan He, Ingo Molnar, x86, linux-kernel

The following commit has been merged into the x86/mm branch of tip:

Commit-ID:     e1d30a1f6c2196de359ac7c2726ba07fcd389cc4
Gitweb:        https://git.kernel.org/tip/e1d30a1f6c2196de359ac7c2726ba07fcd389cc4
Author:        Baoquan He <bhe@redhat.com>
AuthorDate:    Fri, 15 Nov 2024 09:21:29 +08:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Fri, 15 Nov 2024 12:03:36 +01:00

x86/ioremap: Introduce helper to check if physical address is in setup_data

Functions memremap_is_setup_data() and early_memremap_is_setup_data()
share completely the same process and handling, except of the
different memremap/unmap invocations.

Add helper __memremap_is_setup_data() to extract the common part,
parameter 'early' is used to decide what kind of memremap/unmap
APIs are called.

Signed-off-by: Baoquan He <bhe@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20241115012131.509226-2-bhe@redhat.com
---
 arch/x86/mm/ioremap.c | 81 ++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 81 insertions(+)

diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 8d29163..5ef6182 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -628,6 +628,87 @@ static bool memremap_is_efi_data(resource_size_t phys_addr,
 	return false;
 }
 
+#define SD_SIZE sizeof(struct setup_data)
+/*
+ * Examine the physical address to determine if it is boot data by checking
+ * it against the boot params setup_data chain.
+ */
+static bool __init __memremap_is_setup_data(resource_size_t phys_addr,
+						bool early)
+{
+	struct setup_indirect *indirect;
+	struct setup_data *data;
+	u64 paddr, paddr_next;
+
+	paddr = boot_params.hdr.setup_data;
+	while (paddr) {
+		unsigned int len, size;
+
+		if (phys_addr == paddr)
+			return true;
+
+		if (early)
+			data = early_memremap_decrypted(paddr, SD_SIZE);
+		else
+			data = memremap(paddr, SD_SIZE,
+					MEMREMAP_WB | MEMREMAP_DEC);
+		if (!data) {
+			pr_warn("failed to memremap setup_data entry\n");
+			return false;
+		}
+
+		size = SD_SIZE;
+
+		paddr_next = data->next;
+		len = data->len;
+
+		if ((phys_addr > paddr) &&
+		    (phys_addr < (paddr + SD_SIZE + len))) {
+			if (early)
+				early_memunmap(data, SD_SIZE);
+			else
+				memunmap(data);
+			return true;
+		}
+
+		if (data->type == SETUP_INDIRECT) {
+			size += len;
+			if (early) {
+				early_memunmap(data, SD_SIZE);
+				data = early_memremap_decrypted(paddr, size);
+			} else {
+				memunmap(data);
+				data = memremap(paddr, size,
+						MEMREMAP_WB | MEMREMAP_DEC);
+			}
+			if (!data) {
+				pr_warn("failed to memremap indirect setup_data\n");
+				return false;
+			}
+
+			indirect = (struct setup_indirect *)data->data;
+
+			if (indirect->type != SETUP_INDIRECT) {
+				paddr = indirect->addr;
+				len = indirect->len;
+			}
+		}
+
+		if (early)
+			early_memunmap(data, size);
+		else
+			memunmap(data);
+
+		if ((phys_addr > paddr) && (phys_addr < (paddr + len)))
+			return true;
+
+		paddr = paddr_next;
+	}
+
+	return false;
+}
+#undef SD_SIZE
+
 /*
  * Examine the physical address to determine if it is boot data by checking
  * it against the boot params setup_data chain.

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/3] x86/ioremap: introduce helper to check if physical address is in setup_data
  2024-11-15  1:21 ` [PATCH 1/3] x86/ioremap: introduce helper to check if physical address is in setup_data Baoquan He
  2024-11-15 11:28   ` [tip: x86/mm] x86/ioremap: Introduce " tip-bot2 for Baoquan He
@ 2024-11-15 14:22   ` Tom Lendacky
  2024-11-15 23:25     ` Baoquan He
  1 sibling, 1 reply; 14+ messages in thread
From: Tom Lendacky @ 2024-11-15 14:22 UTC (permalink / raw)
  To: Baoquan He, linux-kernel, bp; +Cc: x86

On 11/14/24 19:21, Baoquan He wrote:
> Functions memremap_is_setup_data() and early_memremap_is_setup_data()
> share completely the same process and handling, except of the
> different memremap/unmap invocations.
> 
> Add helper __memremap_is_setup_data() to extract the common part,
> parameter 'early' is used to decide what kind of memremap/unmap
> APIs are called.
> 
> Signed-off-by: Baoquan He <bhe@redhat.com>
> ---
>  arch/x86/mm/ioremap.c | 81 +++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 81 insertions(+)
> 
> diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
> index 8d29163568a7..5ef6182db630 100644
> --- a/arch/x86/mm/ioremap.c
> +++ b/arch/x86/mm/ioremap.c
> @@ -628,6 +628,87 @@ static bool memremap_is_efi_data(resource_size_t phys_addr,
>  	return false;
>  }
>  
> +#define SD_SIZE sizeof(struct setup_data)
> +/*
> + * Examine the physical address to determine if it is boot data by checking
> + * it against the boot params setup_data chain.
> + */
> +static bool __init __memremap_is_setup_data(resource_size_t phys_addr,

You should remove the __init for this helper since it is called by a
function that is outside of __init.

> +						bool early)
> +{
> +	struct setup_indirect *indirect;
> +	struct setup_data *data;
> +	u64 paddr, paddr_next;
> +
> +	paddr = boot_params.hdr.setup_data;
> +	while (paddr) {
> +		unsigned int len, size;
> +
> +		if (phys_addr == paddr)
> +			return true;
> +
> +		if (early)
> +			data = early_memremap_decrypted(paddr, SD_SIZE);
> +		else
> +			data = memremap(paddr, SD_SIZE,
> +					MEMREMAP_WB | MEMREMAP_DEC);
> +		if (!data) {
> +			pr_warn("failed to memremap setup_data entry\n");
> +			return false;
> +		}
> +
> +		size = SD_SIZE;

Just me, but I would use sizeof(*data) here instead of using a #define
that is later undefined below.

Thanks,
Tom

> +
> +		paddr_next = data->next;
> +		len = data->len;
> +
> +		if ((phys_addr > paddr) &&
> +		    (phys_addr < (paddr + SD_SIZE + len))) {
> +			if (early)
> +				early_memunmap(data, SD_SIZE);
> +			else
> +				memunmap(data);
> +			return true;
> +		}
> +
> +		if (data->type == SETUP_INDIRECT) {
> +			size += len;
> +			if (early) {
> +				early_memunmap(data, SD_SIZE);
> +				data = early_memremap_decrypted(paddr, size);
> +			} else {
> +				memunmap(data);
> +				data = memremap(paddr, size,
> +						MEMREMAP_WB | MEMREMAP_DEC);
> +			}
> +			if (!data) {
> +				pr_warn("failed to memremap indirect setup_data\n");
> +				return false;
> +			}
> +
> +			indirect = (struct setup_indirect *)data->data;
> +
> +			if (indirect->type != SETUP_INDIRECT) {
> +				paddr = indirect->addr;
> +				len = indirect->len;
> +			}
> +		}
> +
> +		if (early)
> +			early_memunmap(data, size);
> +		else
> +			memunmap(data);
> +
> +		if ((phys_addr > paddr) && (phys_addr < (paddr + len)))
> +			return true;
> +
> +		paddr = paddr_next;
> +	}
> +
> +	return false;
> +}
> +#undef SD_SIZE
> +
>  /*
>   * Examine the physical address to determine if it is boot data by checking
>   * it against the boot params setup_data chain.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/3] x86/ioremap: use helper to implement xxx_is_setup_data()
  2024-11-15  1:21 ` [PATCH 2/3] x86/ioremap: use helper to implement xxx_is_setup_data() Baoquan He
  2024-11-15 11:28   ` [tip: x86/mm] x86/ioremap: Use " tip-bot2 for Baoquan He
@ 2024-11-15 14:24   ` Tom Lendacky
  2024-11-16  8:36     ` Ingo Molnar
  1 sibling, 1 reply; 14+ messages in thread
From: Tom Lendacky @ 2024-11-15 14:24 UTC (permalink / raw)
  To: Baoquan He, linux-kernel, bp; +Cc: x86

On 11/14/24 19:21, Baoquan He wrote:
> This simplifies codes a lot by removing the duplicated code handling.

You should probably squash this with the first patch.

> 
> And also remove the similar code comment above of them.
> 
> While at it, add __ref to memremap_is_setup_data() to avoid

The __ref shouldn't be needed if you remove the __init from the helper
function.

Thanks,
Tom

> the section mismatch warning:
> 
> WARNING: modpost: vmlinux: section mismatch in reference: arch_memremap_can_ram_remap.cold+0x6 (section: .text.unlikely) -> __memremap_is_setup_data (section: .init.text)
> Signed-off-by: Baoquan He <bhe@redhat.com>
> ---
>  arch/x86/mm/ioremap.c | 119 ++----------------------------------------
>  1 file changed, 3 insertions(+), 116 deletions(-)
> 
> diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
> index 5ef6182db630..5d1b5e4a8756 100644
> --- a/arch/x86/mm/ioremap.c
> +++ b/arch/x86/mm/ioremap.c
> @@ -709,129 +709,16 @@ static bool __init __memremap_is_setup_data(resource_size_t phys_addr,
>  }
>  #undef SD_SIZE
>  
> -/*
> - * Examine the physical address to determine if it is boot data by checking
> - * it against the boot params setup_data chain.
> - */
> -static bool memremap_is_setup_data(resource_size_t phys_addr,
> +static bool __ref memremap_is_setup_data(resource_size_t phys_addr,
>  				   unsigned long size)
>  {
> -	struct setup_indirect *indirect;
> -	struct setup_data *data;
> -	u64 paddr, paddr_next;
> -
> -	paddr = boot_params.hdr.setup_data;
> -	while (paddr) {
> -		unsigned int len;
> -
> -		if (phys_addr == paddr)
> -			return true;
> -
> -		data = memremap(paddr, sizeof(*data),
> -				MEMREMAP_WB | MEMREMAP_DEC);
> -		if (!data) {
> -			pr_warn("failed to memremap setup_data entry\n");
> -			return false;
> -		}
> -
> -		paddr_next = data->next;
> -		len = data->len;
> -
> -		if ((phys_addr > paddr) &&
> -		    (phys_addr < (paddr + sizeof(struct setup_data) + len))) {
> -			memunmap(data);
> -			return true;
> -		}
> -
> -		if (data->type == SETUP_INDIRECT) {
> -			memunmap(data);
> -			data = memremap(paddr, sizeof(*data) + len,
> -					MEMREMAP_WB | MEMREMAP_DEC);
> -			if (!data) {
> -				pr_warn("failed to memremap indirect setup_data\n");
> -				return false;
> -			}
> -
> -			indirect = (struct setup_indirect *)data->data;
> -
> -			if (indirect->type != SETUP_INDIRECT) {
> -				paddr = indirect->addr;
> -				len = indirect->len;
> -			}
> -		}
> -
> -		memunmap(data);
> -
> -		if ((phys_addr > paddr) && (phys_addr < (paddr + len)))
> -			return true;
> -
> -		paddr = paddr_next;
> -	}
> -
> -	return false;
> +	return __memremap_is_setup_data(phys_addr, false);
>  }
>  
> -/*
> - * Examine the physical address to determine if it is boot data by checking
> - * it against the boot params setup_data chain (early boot version).
> - */
>  static bool __init early_memremap_is_setup_data(resource_size_t phys_addr,
>  						unsigned long size)
>  {
> -	struct setup_indirect *indirect;
> -	struct setup_data *data;
> -	u64 paddr, paddr_next;
> -
> -	paddr = boot_params.hdr.setup_data;
> -	while (paddr) {
> -		unsigned int len, size;
> -
> -		if (phys_addr == paddr)
> -			return true;
> -
> -		data = early_memremap_decrypted(paddr, sizeof(*data));
> -		if (!data) {
> -			pr_warn("failed to early memremap setup_data entry\n");
> -			return false;
> -		}
> -
> -		size = sizeof(*data);
> -
> -		paddr_next = data->next;
> -		len = data->len;
> -
> -		if ((phys_addr > paddr) &&
> -		    (phys_addr < (paddr + sizeof(struct setup_data) + len))) {
> -			early_memunmap(data, sizeof(*data));
> -			return true;
> -		}
> -
> -		if (data->type == SETUP_INDIRECT) {
> -			size += len;
> -			early_memunmap(data, sizeof(*data));
> -			data = early_memremap_decrypted(paddr, size);
> -			if (!data) {
> -				pr_warn("failed to early memremap indirect setup_data\n");
> -				return false;
> -			}
> -
> -			indirect = (struct setup_indirect *)data->data;
> -
> -			if (indirect->type != SETUP_INDIRECT) {
> -				paddr = indirect->addr;
> -				len = indirect->len;
> -			}
> -		}
> -
> -		early_memunmap(data, size);
> -
> -		if ((phys_addr > paddr) && (phys_addr < (paddr + len)))
> -			return true;
> -
> -		paddr = paddr_next;
> -	}
> -
> -	return false;
> +	return __memremap_is_setup_data(phys_addr, true);
>  }
>  
>  /*

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/3] x86/mm: clean up unused parameters of functions
  2024-11-15  1:21 ` [PATCH 3/3] x86/mm: clean up unused parameters of functions Baoquan He
  2024-11-15 11:28   ` [tip: x86/mm] x86/mm: Clean " tip-bot2 for Baoquan He
@ 2024-11-15 14:27   ` Tom Lendacky
  1 sibling, 0 replies; 14+ messages in thread
From: Tom Lendacky @ 2024-11-15 14:27 UTC (permalink / raw)
  To: Baoquan He, linux-kernel, bp; +Cc: x86

On 11/14/24 19:21, Baoquan He wrote:
> For functions memremap_is_efi_data(), memremap_is_setup_data and
> early_memremap_is_setup_data(), their parameter 'size' is not used
> and sometime cause confusion. Remove it now.
> 
> Signed-off-by: Baoquan He <bhe@redhat.com>

Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>

> ---
>  arch/x86/mm/ioremap.c | 17 +++++++----------
>  1 file changed, 7 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
> index 5d1b5e4a8756..71b282e5a4a0 100644
> --- a/arch/x86/mm/ioremap.c
> +++ b/arch/x86/mm/ioremap.c
> @@ -593,8 +593,7 @@ static bool memremap_should_map_decrypted(resource_size_t phys_addr,
>   * Examine the physical address to determine if it is EFI data. Check
>   * it against the boot params structure and EFI tables and memory types.
>   */
> -static bool memremap_is_efi_data(resource_size_t phys_addr,
> -				 unsigned long size)
> +static bool memremap_is_efi_data(resource_size_t phys_addr)
>  {
>  	u64 paddr;
>  
> @@ -709,14 +708,12 @@ static bool __init __memremap_is_setup_data(resource_size_t phys_addr,
>  }
>  #undef SD_SIZE
>  
> -static bool __ref memremap_is_setup_data(resource_size_t phys_addr,
> -				   unsigned long size)
> +static bool __ref memremap_is_setup_data(resource_size_t phys_addr)
>  {
>  	return __memremap_is_setup_data(phys_addr, false);
>  }
>  
> -static bool __init early_memremap_is_setup_data(resource_size_t phys_addr,
> -						unsigned long size)
> +static bool __init early_memremap_is_setup_data(resource_size_t phys_addr)
>  {
>  	return __memremap_is_setup_data(phys_addr, true);
>  }
> @@ -739,8 +736,8 @@ bool arch_memremap_can_ram_remap(resource_size_t phys_addr, unsigned long size,
>  		return false;
>  
>  	if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT)) {
> -		if (memremap_is_setup_data(phys_addr, size) ||
> -		    memremap_is_efi_data(phys_addr, size))
> +		if (memremap_is_setup_data(phys_addr) ||
> +		    memremap_is_efi_data(phys_addr))
>  			return false;
>  	}
>  
> @@ -765,8 +762,8 @@ pgprot_t __init early_memremap_pgprot_adjust(resource_size_t phys_addr,
>  	encrypted_prot = true;
>  
>  	if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT)) {
> -		if (early_memremap_is_setup_data(phys_addr, size) ||
> -		    memremap_is_efi_data(phys_addr, size))
> +		if (early_memremap_is_setup_data(phys_addr) ||
> +		    memremap_is_efi_data(phys_addr))
>  			encrypted_prot = false;
>  	}
>  

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/3] x86/ioremap: introduce helper to check if physical address is in setup_data
  2024-11-15 14:22   ` [PATCH 1/3] x86/ioremap: introduce " Tom Lendacky
@ 2024-11-15 23:25     ` Baoquan He
  0 siblings, 0 replies; 14+ messages in thread
From: Baoquan He @ 2024-11-15 23:25 UTC (permalink / raw)
  To: Tom Lendacky; +Cc: linux-kernel, bp, x86

On 11/15/24 at 08:22am, Tom Lendacky wrote:
> On 11/14/24 19:21, Baoquan He wrote:
> > Functions memremap_is_setup_data() and early_memremap_is_setup_data()
> > share completely the same process and handling, except of the
> > different memremap/unmap invocations.
> > 
> > Add helper __memremap_is_setup_data() to extract the common part,
> > parameter 'early' is used to decide what kind of memremap/unmap
> > APIs are called.
> > 
> > Signed-off-by: Baoquan He <bhe@redhat.com>
> > ---
> >  arch/x86/mm/ioremap.c | 81 +++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 81 insertions(+)
> > 
> > diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
> > index 8d29163568a7..5ef6182db630 100644
> > --- a/arch/x86/mm/ioremap.c
> > +++ b/arch/x86/mm/ioremap.c
> > @@ -628,6 +628,87 @@ static bool memremap_is_efi_data(resource_size_t phys_addr,
> >  	return false;
> >  }
> >  
> > +#define SD_SIZE sizeof(struct setup_data)
> > +/*
> > + * Examine the physical address to determine if it is boot data by checking
> > + * it against the boot params setup_data chain.
> > + */
> > +static bool __init __memremap_is_setup_data(resource_size_t phys_addr,
> 
> You should remove the __init for this helper since it is called by a
> function that is outside of __init.

Removing __init for helper will trigger below warning. Then __ref need
be added to helper __memremap_is_setup_data() to suppress it. Maybe the
latter way should be taken since the helper need be called by a normal
function?

WARNING: modpost: vmlinux: section mismatch in reference: __memremap_is_setup_data+0x5f (section: .text) -> early_memunmap (section: .init.text)
WARNING: modpost: vmlinux: section mismatch in reference: __memremap_is_setup_data+0x167 (section: .text) -> early_memremap_decrypted (section: .init.text)
WARNING: modpost: vmlinux: section mismatch in reference: __memremap_is_setup_data+0x180 (section: .text) -> early_memunmap (section: .init.text)
WARNING: modpost: vmlinux: section mismatch in reference: __memremap_is_setup_data+0x1a9 (section: .text) -> early_memunmap (section: .init.text)
WARNING: modpost: vmlinux: section mismatch in reference: __memremap_is_setup_data+0x1b4 (section: .text) -> early_memremap_decrypted (section: .init.text)

Thanks
Baoquan


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/3] x86/ioremap: use helper to implement xxx_is_setup_data()
  2024-11-15 14:24   ` [PATCH 2/3] x86/ioremap: use " Tom Lendacky
@ 2024-11-16  8:36     ` Ingo Molnar
  2024-11-16 13:28       ` Baoquan He
  0 siblings, 1 reply; 14+ messages in thread
From: Ingo Molnar @ 2024-11-16  8:36 UTC (permalink / raw)
  To: Tom Lendacky; +Cc: Baoquan He, linux-kernel, bp, x86


* Tom Lendacky <thomas.lendacky@amd.com> wrote:

> On 11/14/24 19:21, Baoquan He wrote:
> > This simplifies codes a lot by removing the duplicated code handling.
> 
> You should probably squash this with the first patch.
> 
> > 
> > And also remove the similar code comment above of them.
> > 
> > While at it, add __ref to memremap_is_setup_data() to avoid
> 
> The __ref shouldn't be needed if you remove the __init from the helper
> function.

Yeah.

Baoquan, I've zapped these 3 commits from tip:x86/mm for now, mind resending them the init 
annotations fixed?

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/3] x86/ioremap: use helper to implement xxx_is_setup_data()
  2024-11-16  8:36     ` Ingo Molnar
@ 2024-11-16 13:28       ` Baoquan He
  0 siblings, 0 replies; 14+ messages in thread
From: Baoquan He @ 2024-11-16 13:28 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Tom Lendacky, linux-kernel, bp, x86

On 11/16/24 at 09:36am, Ingo Molnar wrote:
> 
> * Tom Lendacky <thomas.lendacky@amd.com> wrote:
> 
> > On 11/14/24 19:21, Baoquan He wrote:
> > > This simplifies codes a lot by removing the duplicated code handling.
> > 
> > You should probably squash this with the first patch.
> > 
> > > 
> > > And also remove the similar code comment above of them.
> > > 
> > > While at it, add __ref to memremap_is_setup_data() to avoid
> > 
> > The __ref shouldn't be needed if you remove the __init from the helper
> > function.
> 
> Yeah.
> 
> Baoquan, I've zapped these 3 commits from tip:x86/mm for now, mind resending them the init 
> annotations fixed?

Sure, will resend. Thanks.


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2024-11-16 13:28 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-15  1:21 [PATCH 0/3] x86/ioremap: clean up the mess in xxx_is_setup_data Baoquan He
2024-11-15  1:21 ` [PATCH 1/3] x86/ioremap: introduce helper to check if physical address is in setup_data Baoquan He
2024-11-15 11:28   ` [tip: x86/mm] x86/ioremap: Introduce " tip-bot2 for Baoquan He
2024-11-15 14:22   ` [PATCH 1/3] x86/ioremap: introduce " Tom Lendacky
2024-11-15 23:25     ` Baoquan He
2024-11-15  1:21 ` [PATCH 2/3] x86/ioremap: use helper to implement xxx_is_setup_data() Baoquan He
2024-11-15 11:28   ` [tip: x86/mm] x86/ioremap: Use " tip-bot2 for Baoquan He
2024-11-15 14:24   ` [PATCH 2/3] x86/ioremap: use " Tom Lendacky
2024-11-16  8:36     ` Ingo Molnar
2024-11-16 13:28       ` Baoquan He
2024-11-15  1:21 ` [PATCH 3/3] x86/mm: clean up unused parameters of functions Baoquan He
2024-11-15 11:28   ` [tip: x86/mm] x86/mm: Clean " tip-bot2 for Baoquan He
2024-11-15 14:27   ` [PATCH 3/3] x86/mm: clean " Tom Lendacky
2024-11-15  1:23 ` [PATCH 0/3] x86/ioremap: clean up the mess in xxx_is_setup_data Baoquan He

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox