linux-kernel.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: Peter Zijlstra <peterz@infradead.org>,
	Borislav Petkov <bp@suse.de>, Sasha Levin <sashal@kernel.org>,
	seanjc@google.com, pbonzini@redhat.com, tglx@linutronix.de,
	mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
	x86@kernel.org, kvm@vger.kernel.org
Subject: [PATCH AUTOSEL 5.10 03/25] x86/kvm/vmx: Make noinstr clean
Date: Tue, 19 Jul 2022 21:15:54 -0400	[thread overview]
Message-ID: <20220720011616.1024753-3-sashal@kernel.org> (raw)
In-Reply-To: <20220720011616.1024753-1-sashal@kernel.org>

From: Peter Zijlstra <peterz@infradead.org>

[ Upstream commit 742ab6df974ae8384a2dd213db1a3a06cf6d8936 ]

The recent mmio_stale_data fixes broke the noinstr constraints:

  vmlinux.o: warning: objtool: vmx_vcpu_enter_exit+0x15b: call to wrmsrl.constprop.0() leaves .noinstr.text section
  vmlinux.o: warning: objtool: vmx_vcpu_enter_exit+0x1bf: call to kvm_arch_has_assigned_device() leaves .noinstr.text section

make it all happy again.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/x86/kvm/vmx/vmx.c   | 6 +++---
 arch/x86/kvm/x86.c       | 4 ++--
 include/linux/kvm_host.h | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index cc647dcc228b..497d50c7fc00 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -380,9 +380,9 @@ static __always_inline void vmx_disable_fb_clear(struct vcpu_vmx *vmx)
 	if (!vmx->disable_fb_clear)
 		return;
 
-	rdmsrl(MSR_IA32_MCU_OPT_CTRL, msr);
+	msr = __rdmsr(MSR_IA32_MCU_OPT_CTRL);
 	msr |= FB_CLEAR_DIS;
-	wrmsrl(MSR_IA32_MCU_OPT_CTRL, msr);
+	native_wrmsrl(MSR_IA32_MCU_OPT_CTRL, msr);
 	/* Cache the MSR value to avoid reading it later */
 	vmx->msr_ia32_mcu_opt_ctrl = msr;
 }
@@ -393,7 +393,7 @@ static __always_inline void vmx_enable_fb_clear(struct vcpu_vmx *vmx)
 		return;
 
 	vmx->msr_ia32_mcu_opt_ctrl &= ~FB_CLEAR_DIS;
-	wrmsrl(MSR_IA32_MCU_OPT_CTRL, vmx->msr_ia32_mcu_opt_ctrl);
+	native_wrmsrl(MSR_IA32_MCU_OPT_CTRL, vmx->msr_ia32_mcu_opt_ctrl);
 }
 
 static void vmx_update_fb_clear_dis(struct kvm_vcpu *vcpu, struct vcpu_vmx *vmx)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index da547752580a..1003a46e4ddf 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -11171,9 +11171,9 @@ void kvm_arch_end_assignment(struct kvm *kvm)
 }
 EXPORT_SYMBOL_GPL(kvm_arch_end_assignment);
 
-bool kvm_arch_has_assigned_device(struct kvm *kvm)
+bool noinstr kvm_arch_has_assigned_device(struct kvm *kvm)
 {
-	return atomic_read(&kvm->arch.assigned_device_count);
+	return arch_atomic_read(&kvm->arch.assigned_device_count);
 }
 EXPORT_SYMBOL_GPL(kvm_arch_has_assigned_device);
 
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index c66c702a4f07..439fbe0ee0c7 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -988,7 +988,7 @@ static inline void kvm_arch_end_assignment(struct kvm *kvm)
 {
 }
 
-static inline bool kvm_arch_has_assigned_device(struct kvm *kvm)
+static __always_inline bool kvm_arch_has_assigned_device(struct kvm *kvm)
 {
 	return false;
 }
-- 
2.35.1


  parent reply	other threads:[~2022-07-20  1:22 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-20  1:15 [PATCH AUTOSEL 5.10 01/25] Revert "evm: Fix memleak in init_desc" Sasha Levin
2022-07-20  1:15 ` [PATCH AUTOSEL 5.10 02/25] ARM: rockchip: Add missing of_node_put() in rockchip_suspend_init() Sasha Levin
2022-07-20  1:15 ` Sasha Levin [this message]
2022-07-20  1:15 ` [PATCH AUTOSEL 5.10 04/25] objtool: Treat .text.__x86.* as noinstr Sasha Levin
2022-07-20  1:15 ` [PATCH AUTOSEL 5.10 05/25] x86/bugs: Report AMD retbleed vulnerability Sasha Levin
2022-07-20  7:48   ` Greg KH
2022-07-20 16:37     ` Sasha Levin
2022-07-20  1:15 ` [PATCH AUTOSEL 5.10 06/25] x86/bugs: Keep a per-CPU IA32_SPEC_CTRL value Sasha Levin
2022-07-20  1:15 ` [PATCH AUTOSEL 5.10 07/25] x86/bugs: Optimize SPEC_CTRL MSR writes Sasha Levin
2022-07-20  1:15 ` [PATCH AUTOSEL 5.10 08/25] x86/cpu/amd: Add Spectral Chicken Sasha Levin
2022-07-20  1:16 ` [PATCH AUTOSEL 5.10 09/25] x86/speculation: Fix RSB filling with CONFIG_RETPOLINE=n Sasha Levin
2022-07-20  1:16 ` [PATCH AUTOSEL 5.10 10/25] wifi: mac80211: check skb_shared in ieee80211_8023_xmit() Sasha Levin
2022-07-20  1:16 ` [PATCH AUTOSEL 5.10 11/25] wifi: mac80211: do not wake queues on a vif that is being stopped Sasha Levin
2022-07-20  1:16 ` [PATCH AUTOSEL 5.10 12/25] wifi: cfg80211: Allow P2P client interface to indicate port authorization Sasha Levin
2022-07-20  1:16 ` [PATCH AUTOSEL 5.10 13/25] drm: panel-orientation-quirks: Add quirk for the Lenovo Yoga Tablet 2 830 Sasha Levin
2022-07-20  1:16 ` [PATCH AUTOSEL 5.10 14/25] nilfs2: fix incorrect masking of permission flags for symlinks Sasha Levin
2022-07-20  1:16 ` [PATCH AUTOSEL 5.10 15/25] ASoC: ti: omap-mcbsp: duplicate sysfs error Sasha Levin
2022-07-20  1:16 ` [PATCH AUTOSEL 5.10 16/25] ASoC: tlv320adcx140: Fix tx_mask check Sasha Levin
2022-07-20  1:16 ` [PATCH AUTOSEL 5.10 17/25] ASoC: wm8998: Fix event generation for input mux Sasha Levin
2022-07-20  1:16 ` [PATCH AUTOSEL 5.10 18/25] ASoC: cs47l92: Fix event generation for OUT1 demux Sasha Levin
2022-07-20  1:16 ` [PATCH AUTOSEL 5.10 19/25] ASoC: arizona: Update arizona_aif_cfg_changed to use RX_BCLK_RATE Sasha Levin
2022-07-20  1:16 ` [PATCH AUTOSEL 5.10 20/25] scsi: target: Fix WRITE_SAME No Data Buffer crash Sasha Levin
2022-07-20  1:16 ` [PATCH AUTOSEL 5.10 21/25] platform/x86: asus-wmi: Add key mappings Sasha Levin
2022-07-20  1:16 ` [PATCH AUTOSEL 5.10 22/25] platform/x86: intel_atomisp2_led: Also turn off the always-on camera LED on the Asus T100TAF Sasha Levin
2022-07-20  1:16 ` [PATCH AUTOSEL 5.10 23/25] scsi: ufs: core: Fix missing clk change notification on host reset Sasha Levin
2022-07-20  1:16 ` [PATCH AUTOSEL 5.10 24/25] scsi: pm80xx: Fix 'Unknown' max/min linkrate Sasha Levin
2022-07-20  1:16 ` [PATCH AUTOSEL 5.10 25/25] scsi: pm80xx: Set stopped phy's linkrate to Disabled 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=20220720011616.1024753-3-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=bp@alien8.de \
    --cc=bp@suse.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=seanjc@google.com \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --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;
as well as URLs for NNTP newsgroup(s).