mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for Ross Philipson" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Ross Philipson <ross.philipson@oracle.com>,
	Borislav Petkov <bp@suse.de>,
	Daniel Kiper <daniel.kiper@oracle.com>, <stable@vger.kernel.org>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: x86/urgent] x86/boot: Add setup_indirect support in early_memremap_is_setup_data()
Date: Wed, 09 Mar 2022 16:06:09 -0000	[thread overview]
Message-ID: <164684196918.16921.3379747739770954386.tip-bot2@tip-bot2> (raw)
In-Reply-To: <1645668456-22036-3-git-send-email-ross.philipson@oracle.com>

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

Commit-ID:     445c1470b6ef96440e7cfc42dfc160f5004fd149
Gitweb:        https://git.kernel.org/tip/445c1470b6ef96440e7cfc42dfc160f5004fd149
Author:        Ross Philipson <ross.philipson@oracle.com>
AuthorDate:    Wed, 23 Feb 2022 21:07:36 -05:00
Committer:     Borislav Petkov <bp@suse.de>
CommitterDate: Wed, 09 Mar 2022 12:49:46 +01:00

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. 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>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/1645668456-22036-3-git-send-email-ross.philipson@oracle.com
---
 arch/x86/mm/ioremap.c | 33 +++++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index ab666c4..17a492c 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -676,22 +676,51 @@ static bool memremap_is_setup_data(resource_size_t phys_addr,
 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;
+		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;
 
-		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 (!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;

  reply	other threads:[~2022-03-09 16:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-24  2:07 [PATCH v2 0/2] x86/boot: Fix setup_indirect support Ross Philipson
2022-02-24  2:07 ` [PATCH v2 1/2] x86/boot: Fix memremap of setup_indirect structures Ross Philipson
2022-03-09 16:06   ` [tip: x86/urgent] " tip-bot2 for Ross Philipson
2022-02-24  2:07 ` [PATCH v2 2/2] x86/boot: Add setup_indirect support in early_memremap_is_setup_data Ross Philipson
2022-03-09 16:06   ` tip-bot2 for Ross Philipson [this message]
2022-02-25 21:17 ` [PATCH v2 0/2] x86/boot: Fix setup_indirect support Daniel Kiper
2022-03-08 20:34   ` 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=164684196918.16921.3379747739770954386.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=bp@suse.de \
    --cc=daniel.kiper@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=ross.philipson@oracle.com \
    --cc=stable@vger.kernel.org \
    --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®