From: Ross Philipson <ross.philipson@oracle.com>
To: linux-kernel@vger.kernel.org, x86@kernel.org
Cc: ross.philipson@oracle.com, daniel.kiper@oracle.com,
dpsmith@apertussolutions.com, tglx@linutronix.de,
mingo@redhat.com, bp@alien8.de, hpa@zytor.com,
luto@amacapital.net, kanth.ghatraju@oracle.com,
trenchboot-devel@googlegroups.com
Subject: [PATCH 2/2] x86/boot: Add setup_indirect support in early_memremap_is_setup_data
Date: Thu, 27 Jan 2022 12:04:16 -0500 [thread overview]
Message-ID: <1643303056-22272-3-git-send-email-ross.philipson@oracle.com> (raw)
In-Reply-To: <1643303056-22272-1-git-send-email-ross.philipson@oracle.com>
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 <ross.philipson@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
---
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 b45e86e..9129b29 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -670,17 +670,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
next prev parent reply other threads:[~2022-01-27 16:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-27 17:04 [PATCH 0/2] x86/boot: Fix setup_indirect support Ross Philipson
2022-01-27 17:04 ` [PATCH 1/2] x86/boot: Fix memremap of setup_indirect structures Ross Philipson
2022-02-11 17:24 ` Borislav Petkov
2022-02-15 11:34 ` Ross Philipson
2022-02-15 18:37 ` Borislav Petkov
2022-02-22 21:01 ` Ross Philipson
2022-02-24 13:42 ` Borislav Petkov
2022-02-24 15:13 ` Ross Philipson
2022-01-27 17:04 ` Ross Philipson [this message]
2022-02-11 18:41 ` [PATCH 2/2] x86/boot: Add setup_indirect support in early_memremap_is_setup_data Borislav Petkov
2022-02-15 11:36 ` Ross Philipson
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=1643303056-22272-3-git-send-email-ross.philipson@oracle.com \
--to=ross.philipson@oracle.com \
--cc=bp@alien8.de \
--cc=daniel.kiper@oracle.com \
--cc=dpsmith@apertussolutions.com \
--cc=hpa@zytor.com \
--cc=kanth.ghatraju@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=trenchboot-devel@googlegroups.com \
--cc=x86@kernel.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
all inboxes | Powered by JetHome®