stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Juergen Gross <jgross@suse.com>, Borislav Petkov <bp@suse.de>,
	Jan Beulich <jbeulich@suse.com>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Sasha Levin <sashal@kernel.org>,
	tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
	dave.hansen@linux.intel.com, x86@kernel.org, jpoimboe@kernel.org,
	peterz@infradead.org, michael.roth@amd.com,
	brijesh.singh@amd.com, kirill.shutemov@linux.intel.com,
	ak@linux.intel.com, thomas.lendacky@amd.com,
	xen-devel@lists.xenproject.org
Subject: [PATCH AUTOSEL 5.18 28/41] x86/xen: Use clear_bss() for Xen PV guests
Date: Thu, 14 Jul 2022 00:22:08 -0400	[thread overview]
Message-ID: <20220714042221.281187-28-sashal@kernel.org> (raw)
In-Reply-To: <20220714042221.281187-1-sashal@kernel.org>

From: Juergen Gross <jgross@suse.com>

[ Upstream commit 96e8fc5818686d4a1591bb6907e7fdb64ef29884 ]

Instead of clearing the bss area in assembly code, use the clear_bss()
function.

This requires to pass the start_info address as parameter to
xen_start_kernel() in order to avoid the xen_start_info being zeroed
again.

Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Link: https://lore.kernel.org/r/20220630071441.28576-2-jgross@suse.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/x86/include/asm/setup.h |  3 +++
 arch/x86/kernel/head64.c     |  2 +-
 arch/x86/xen/enlighten_pv.c  |  8 ++++++--
 arch/x86/xen/xen-head.S      | 10 +---------
 4 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h
index 896e48d45828..bccc84de7ff2 100644
--- a/arch/x86/include/asm/setup.h
+++ b/arch/x86/include/asm/setup.h
@@ -132,6 +132,9 @@ void *extend_brk(size_t size, size_t align);
 	}
 
 extern void probe_roms(void);
+
+void clear_bss(void);
+
 #ifdef __i386__
 
 asmlinkage void __init i386_start_kernel(void);
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index 4f5ecbbaae77..2e10a33778cf 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -421,7 +421,7 @@ void __init do_early_exception(struct pt_regs *regs, int trapnr)
 
 /* Don't add a printk in there. printk relies on the PDA which is not initialized 
    yet. */
-static void __init clear_bss(void)
+void __init clear_bss(void)
 {
 	memset(__bss_start, 0,
 	       (unsigned long) __bss_stop - (unsigned long) __bss_start);
diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c
index 5038edb79ad5..b55de4ad685c 100644
--- a/arch/x86/xen/enlighten_pv.c
+++ b/arch/x86/xen/enlighten_pv.c
@@ -1183,15 +1183,19 @@ static void __init xen_domu_set_legacy_features(void)
 extern void early_xen_iret_patch(void);
 
 /* First C function to be called on Xen boot */
-asmlinkage __visible void __init xen_start_kernel(void)
+asmlinkage __visible void __init xen_start_kernel(struct start_info *si)
 {
 	struct physdev_set_iopl set_iopl;
 	unsigned long initrd_start = 0;
 	int rc;
 
-	if (!xen_start_info)
+	if (!si)
 		return;
 
+	clear_bss();
+
+	xen_start_info = si;
+
 	__text_gen_insn(&early_xen_iret_patch,
 			JMP32_INSN_OPCODE, &early_xen_iret_patch, &xen_iret,
 			JMP32_INSN_SIZE);
diff --git a/arch/x86/xen/xen-head.S b/arch/x86/xen/xen-head.S
index 3a2cd93bf059..13af6fe453e3 100644
--- a/arch/x86/xen/xen-head.S
+++ b/arch/x86/xen/xen-head.S
@@ -48,15 +48,6 @@ SYM_CODE_START(startup_xen)
 	ANNOTATE_NOENDBR
 	cld
 
-	/* Clear .bss */
-	xor %eax,%eax
-	mov $__bss_start, %rdi
-	mov $__bss_stop, %rcx
-	sub %rdi, %rcx
-	shr $3, %rcx
-	rep stosq
-
-	mov %rsi, xen_start_info
 	mov initial_stack(%rip), %rsp
 
 	/* Set up %gs.
@@ -71,6 +62,7 @@ SYM_CODE_START(startup_xen)
 	cdq
 	wrmsr
 
+	mov	%rsi, %rdi
 	call xen_start_kernel
 SYM_CODE_END(startup_xen)
 	__FINIT
-- 
2.35.1


  parent reply	other threads:[~2022-07-14  4:26 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-14  4:21 [PATCH AUTOSEL 5.18 01/41] ASoC: ops: Fix off by one in range control validation Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 02/41] pinctrl: aspeed: Fix potential NULL dereference in aspeed_pinmux_set_mux() Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 03/41] ASoC: Realtek/Maxim SoundWire codecs: disable pm_runtime on remove Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 04/41] ASoC: rt711-sdca-sdw: fix calibrate mutex initialization Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 05/41] ASoC: Intel: sof_sdw: handle errors on card registration Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 06/41] ASoC: rt711: fix calibrate mutex initialization Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 07/41] ASoC: rt7*-sdw: harden jack_detect_handler Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 08/41] ASoC: codecs: rt700/rt711/rt711-sdca: initialize workqueues in probe Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 09/41] ASoC: SOF: Intel: hda-dsp: Expose hda_dsp_core_power_up() Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 10/41] ASoC: SOF: Intel: hda-loader: Make sure that the fw load sequence is followed Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 11/41] ASoC: SOF: Intel: hda-loader: Clarify the cl_dsp_init() flow Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 12/41] ASoC: wcd9335: Remove RX channel from old list before adding it to a new one Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 13/41] ASoC: wcd9335: Fix spurious event generation Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 14/41] ASoC: wcd938x: Fix event generation for some controls Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 15/41] ASoC: Intel: bytcr_wm5102: Fix GPIO related probe-ordering problem Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 16/41] ASoC: rockchip: i2s: switch BCLK to GPIO Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 17/41] ASoC: wm_adsp: Fix event for preloader Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 18/41] ASoC: wm5110: Fix DRE control Sasha Levin
2022-07-14  4:21 ` [PATCH AUTOSEL 5.18 19/41] ASoC: cs35l41: Correct some control names Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 20/41] ASoC: rt711-sdca: fix kernel NULL pointer dereference when IO error Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 21/41] ASoC: dapm: Initialise kcontrol data for mux/demux controls Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 22/41] ASoC: cs35l41: Add ASP TX3/4 source to register patch Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 23/41] ASoC: cs47l15: Fix event generation for low power mux control Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 24/41] ASoC: madera: Fix event generation for OUT1 demux Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 25/41] ASoC: madera: Fix event generation for rate controls Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 26/41] irqchip: or1k-pic: Undefine mask_ack for level triggered hardware Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 27/41] pinctrl: imx: Add the zero base flag for imx93 Sasha Levin
2022-07-14  4:22 ` Sasha Levin [this message]
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 29/41] x86: Clear .brk area at early boot Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 30/41] soc: ixp4xx/npe: Fix unused match warning Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 31/41] ARM: dts: stm32: use the correct clock source for CEC on stm32mp151 Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 32/41] Revert "can: xilinx_can: Limit CANFD brp to 2" Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 33/41] ALSA: usb-audio: Add quirks for MacroSilicon MS2100/MS2106 devices Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 34/41] ALSA: usb-audio: Add quirk for Fiero SC-01 Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 35/41] ALSA: usb-audio: Add quirk for Fiero SC-01 (fw v1.0.0) Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 36/41] nvme-pci: phison e16 has bogus namespace ids Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 37/41] nvme: use struct group for generic command dwords Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 38/41] wireguard: selftests: set fake real time in init Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 39/41] wireguard: selftests: use virt machine on m68k Sasha Levin
2022-07-14  7:08   ` Geert Uytterhoeven
2022-07-17 23:01     ` Sasha Levin
2022-07-18  1:34       ` Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 40/41] wireguard: selftests: always call kernel makefile Sasha Levin
2022-07-14  4:22 ` [PATCH AUTOSEL 5.18 41/41] signal handling: don't use BUG_ON() for debugging Sasha Levin

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=20220714042221.281187-28-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=bp@alien8.de \
    --cc=bp@suse.de \
    --cc=brijesh.singh@amd.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=jbeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=jpoimboe@kernel.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.roth@amd.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.com \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xenproject.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;
as well as URLs for NNTP newsgroup(s).