[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <173348020817.412.3867427890031364695.tip-bot2@tip-bot2>
Date: Fri, 06 Dec 2024 10:16:48 -0000
From: "tip-bot2 for David Woodhouse" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: David Woodhouse <dwmw@...zon.co.uk>, Ingo Molnar <mingo@...nel.org>,
Baoquan He <bhe@...hat.com>, Vivek Goyal <vgoyal@...hat.com>,
Dave Young <dyoung@...hat.com>, Eric Biederman <ebiederm@...ssion.com>,
Ard Biesheuvel <ardb@...nel.org>, "H. Peter Anvin" <hpa@...or.com>,
x86@...nel.org, linux-kernel@...r.kernel.org
Subject: [tip: x86/boot] x86/kexec: Copy control page into place in
machine_kexec_prepare()
The following commit has been merged into the x86/boot branch of tip:
Commit-ID: 6a750b4c009936f352aaac0366f5f10fcf51e81b
Gitweb: https://git.kernel.org/tip/6a750b4c009936f352aaac0366f5f10fcf51e81b
Author: David Woodhouse <dwmw@...zon.co.uk>
AuthorDate: Thu, 05 Dec 2024 15:05:12
Committer: Ingo Molnar <mingo@...nel.org>
CommitterDate: Fri, 06 Dec 2024 10:41:59 +01:00
x86/kexec: Copy control page into place in machine_kexec_prepare()
There's no need for this to wait until the actual machine_kexec() invocation;
future changes will need to make the control page read-only and executable,
so all writes should be completed before machine_kexec_prepare() returns.
Signed-off-by: David Woodhouse <dwmw@...zon.co.uk>
Signed-off-by: Ingo Molnar <mingo@...nel.org>
Cc: Baoquan He <bhe@...hat.com>
Cc: Vivek Goyal <vgoyal@...hat.com>
Cc: Dave Young <dyoung@...hat.com>
Cc: Eric Biederman <ebiederm@...ssion.com>
Cc: Ard Biesheuvel <ardb@...nel.org>
Cc: "H. Peter Anvin" <hpa@...or.com>
Link: https://lore.kernel.org/r/20241205153343.3275139-7-dwmw2@infradead.org
---
arch/x86/kernel/machine_kexec_64.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c
index 7223c38..3a4cbac 100644
--- a/arch/x86/kernel/machine_kexec_64.c
+++ b/arch/x86/kernel/machine_kexec_64.c
@@ -301,17 +301,16 @@ static void load_segments(void)
int machine_kexec_prepare(struct kimage *image)
{
- unsigned long control_page;
+ void *control_page = page_address(image->control_code_page);
int result;
- /* Calculate the offsets */
- control_page = page_to_pfn(image->control_code_page) << PAGE_SHIFT;
-
/* Setup the identity mapped 64bit page table */
- result = init_pgtable(image, control_page);
+ result = init_pgtable(image, __pa(control_page));
if (result)
return result;
+ __memcpy(control_page, relocate_kernel, KEXEC_CONTROL_CODE_MAX_SIZE);
+
return 0;
}
@@ -363,7 +362,6 @@ void machine_kexec(struct kimage *image)
}
control_page = page_address(image->control_code_page);
- __memcpy(control_page, relocate_kernel, KEXEC_CONTROL_CODE_MAX_SIZE);
page_list[PA_CONTROL_PAGE] = virt_to_phys(control_page);
page_list[VA_CONTROL_PAGE] = (unsigned long)control_page;
Powered by blists - more mailing lists