From: Pawan Gupta <pawan.kumar.gupta@linux.intel.com> To: speck@linutronix.de Subject: [MODERATED] [PATCH 6/9] TAA v2 6 Date: Wed, 23 Oct 2019 12:23:33 +0200 [thread overview] Message-ID: <ac11e65cbdc741b2f32cd2a8f07b50a2879c15af.1572168937.git.bp@suse.de> (raw) In-Reply-To: <cover.1572168937.git.bp@suse.de> From: Pawan Gupta <pawan.kumar.gupta@linux.intel.com> Subject: [PATCH 6/9] kvm/x86: Export MDS_NO=0 to guests when TSX is enabled Export the IA32_ARCH_CAPABILITIES MSR bit MDS_NO=0 to guests on TSX Async Abort(TAA) affected hosts that have TSX enabled and updated microcode. This is required so that the guests don't complain, "Vulnerable: Clear CPU buffers attempted, no microcode" when the host has the updated microcode to clear CPU buffers. Microcode update also adds support for MSR_IA32_TSX_CTRL which is enumerated by the ARCH_CAP_TSX_CTRL bit in IA32_ARCH_CAPABILITIES MSR. Guests can't do this check themselves when the ARCH_CAP_TSX_CTRL bit is not exported to the guests. In this case export MDS_NO=0 to the guests. When guests have CPUID.MD_CLEAR=1, they deploy MDS mitigation which also mitigates TAA. Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com> Signed-off-by: Borislav Petkov <bp@suse.de> Reviewed-by: Tony Luck <tony.luck@intel.com> Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com> Tested-by: Neelima Krishnan <neelima.krishnan@intel.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Joerg Roedel <joro@8bytes.org> Cc: kvm ML <kvm@vger.kernel.org> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: "Radim Krcmar" <rkrcmar@redhat.com> Cc: Sean Christopherson <sean.j.christopherson@intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: x86-ml <x86@kernel.org> --- arch/x86/kvm/x86.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 661e2bf38526..fb8d80caf642 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1299,6 +1299,25 @@ static u64 kvm_get_arch_capabilities(void) if (!boot_cpu_has_bug(X86_BUG_MDS)) data |= ARCH_CAP_MDS_NO; + /* + * On TAA affected systems, export MDS_NO=0 when: + * - TSX is enabled on the host, i.e. X86_FEATURE_RTM=1. + * - Updated microcode is present. This is detected by + * the presence of ARCH_CAP_TSX_CTRL_MSR and ensures + * that VERW clears CPU buffers. + * + * When MDS_NO=0 is exported, guests deploy clear CPU buffer + * mitigation and don't complain: + * + * "Vulnerable: Clear CPU buffers attempted, no microcode" + * + * If TSX is disabled on the system, guests are also mitigated against + * TAA and clear CPU buffer mitigation is not required for guests. + */ + if (boot_cpu_has_bug(X86_BUG_TAA) && boot_cpu_has(X86_FEATURE_RTM) && + (data & ARCH_CAP_TSX_CTRL_MSR)) + data &= ~ARCH_CAP_MDS_NO; + return data; } -- 2.21.0
next prev parent reply other threads:[~2019-10-27 9:42 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-10-27 9:35 [MODERATED] [PATCH 0/9] TAA v2 0 Borislav Petkov 2019-10-23 8:45 ` [MODERATED] [PATCH 1/9] TAA v2 1 Pawan Gupta 2019-10-23 8:52 ` [MODERATED] [PATCH 2/9] TAA v2 2 Pawan Gupta 2019-10-28 7:36 ` Thomas Gleixner 2019-10-23 9:01 ` [MODERATED] [PATCH 3/9] TAA v2 3 Pawan Gupta 2019-10-23 9:30 ` [MODERATED] [PATCH 4/9] TAA v2 4 Pawan Gupta 2019-10-23 10:19 ` [MODERATED] [PATCH 5/9] TAA v2 5 Pawan Gupta 2019-10-23 10:23 ` Pawan Gupta [this message] 2019-10-23 10:28 ` [MODERATED] [PATCH 7/9] TAA v2 7 Pawan Gupta 2019-10-23 10:32 ` [MODERATED] [PATCH 8/9] TAA v2 8 Pawan Gupta 2019-10-23 10:35 ` [MODERATED] [PATCH 9/9] TAA v2 9 Michal Hocko
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=ac11e65cbdc741b2f32cd2a8f07b50a2879c15af.1572168937.git.bp@suse.de \ --to=pawan.kumar.gupta@linux.intel.com \ --cc=speck@linutronix.de \ --subject='Re: [MODERATED] [PATCH 6/9] TAA v2 6' \ /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
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).