2021-08-27 13:23:41

by Ross Philipson

[permalink] [raw]
Subject: [PATCH v4 02/14] x86/boot: Add setup_indirect support in early_memremap_is_setup_data

The x86 boot documentation describes the setup_indirect structures and
how they are used. Only one of the two functions in ioremap.c that needed
to be modified to be aware of the introduction of setup_indirect
functionality was updated. This adds comparable support to the other
function where it was missing.

Fixes: b3c72fc9a78e ("x86/boot: Introduce setup_indirect")

Signed-off-by: Ross Philipson <[email protected]>
---
arch/x86/mm/ioremap.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index ab74e4f..f2b34c5 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -669,17 +669,34 @@ static bool __init early_memremap_is_setup_data(resource_size_t phys_addr,

paddr = boot_params.hdr.setup_data;
while (paddr) {
- unsigned int len;
+ unsigned int len, size;

if (phys_addr == paddr)
return true;

data = early_memremap_decrypted(paddr, sizeof(*data));
+ size = sizeof(*data);

paddr_next = data->next;
len = data->len;

- early_memunmap(data, sizeof(*data));
+ if ((phys_addr > paddr) && (phys_addr < (paddr + 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 (((struct setup_indirect *)data->data)->type != SETUP_INDIRECT) {
+ paddr = ((struct setup_indirect *)data->data)->addr;
+ len = ((struct setup_indirect *)data->data)->len;
+ }
+ }
+
+ early_memunmap(data, size);

if ((phys_addr > paddr) && (phys_addr < (paddr + len)))
return true;
--
1.8.3.1


2021-09-22 12:09:24

by Daniel Kiper

[permalink] [raw]
Subject: Re: [PATCH v4 02/14] x86/boot: Add setup_indirect support in early_memremap_is_setup_data

On Fri, Aug 27, 2021 at 09:28:25AM -0400, Ross Philipson wrote:
> The x86 boot documentation describes the setup_indirect structures and
> how they are used. Only one of the two functions in ioremap.c that needed
> to be modified to be aware of the introduction of setup_indirect
> functionality was updated. This adds comparable support to the other
> function where it was missing.
>
> Fixes: b3c72fc9a78e ("x86/boot: Introduce setup_indirect")
>
> Signed-off-by: Ross Philipson <[email protected]>

Reviewed-by: Daniel Kiper <[email protected]>

This is the fix. So, I think it should be taken now, regardless of the
fate of the other patches in the series.

Daniel