Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13476389ybl; Sun, 29 Dec 2019 12:49:56 -0800 (PST) X-Google-Smtp-Source: APXvYqyAZJ/g0JLMVs8ruV3oxll745Xe2v7v3liZG01rU5vRv97l0WhRYnS4gyCsS26xUr5t9yEG X-Received: by 2002:a9d:6e98:: with SMTP id a24mr54402003otr.109.1577652595923; Sun, 29 Dec 2019 12:49:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577652595; cv=none; d=google.com; s=arc-20160816; b=LjaaEKji7G7zy/gJGgmAo7EcwSCgmQkUwHe8Zqj23tCiD83FUWql3TWFlJGgbGahYO ZUHd4Ljs/dSh8U+U2yz/r2PDH4THI2KrTBAFXVPCHAaN+vfPpWL8ZK3Z+SDkLGgWNVrH NODYlMukoORuSVCqdPJljW4zlyWMSR5rUrWOifR+ilUxVln7nQ/RMlbYUFABgkfRANQQ uWhZshfnl3KPgtm1KvIU9/4pSAxVe1It3RX26h1EZ7/bjCzRyhkBsUSNrgPR07cN3FXC J1VcIGBk/XUt0MAKHTn9lVTeJt2zwv35KJYqS5NGP7hG6xEUC3J/SI0FhCBXRLayHems XJ1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5P3/bskiFtAtcaC/kegvE+GmtKoTaxXi6tIIN/naKnU=; b=a5S9owBfv4kAwRAq/CVdXdvHuhEXA+9RROkU3PK29hym5UfP0fLCoCv9JsCWrtqB4m TnGnx5cH/GD358Fj699CX3rge04zJtbfrmjdM95qSWObdVmJpWy4VaoOmXFd4umL3agf 6nvbZvo5x8F9gAtpHs78ezb38YlaY6ilSSiMEthbuEVyXuQLeH8aT6CrA6+kLEMtfyUY apxKbxpBuq/o1lzm8NEL3bER9LFkjjRABy2z392+qQZfgBXmYfsvwA1zNyJtjGu9se7P hGUTh81emXsChFBazM1eNUDZ5uHDY8ml/nmVxrM4wKTJhmf0itFYt50tAQ5yen/axNaD SyUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ztsiq1lg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k131si15677955oia.64.2019.12.29.12.49.44; Sun, 29 Dec 2019 12:49:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ztsiq1lg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387515AbfL2R6X (ORCPT + 99 others); Sun, 29 Dec 2019 12:58:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:49310 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387469AbfL2R6R (ORCPT ); Sun, 29 Dec 2019 12:58:17 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C0B89206DB; Sun, 29 Dec 2019 17:58:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577642297; bh=iTZR3SpRq2wY9Ep4gpB+c/ynW1BnyIfbSusvbnoKGPs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ztsiq1lgPa7ZFHVp+HbSAzu7X0ZMTW/839Wv0Djd+HC6rHihkNvjlwjmaWdZqR5uV O28UnbAMeXeqvNXhT3ChcLyvFfj3nxaKXUL+jcy06EFqcq39QOYwoSwFEW8Ylv9ZxM Buu3IPLUdBx1m90cZnrLicwDcdRSGw+2Oed8TIOM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jim Mattson , Jacob Xu , Peter Shier , Paolo Bonzini , Eric Biggers Subject: [PATCH 5.4 417/434] kvm: x86: Host feature SSBD doesnt imply guest feature AMD_SSBD Date: Sun, 29 Dec 2019 18:27:50 +0100 Message-Id: <20191229172730.635509330@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229172702.393141737@linuxfoundation.org> References: <20191229172702.393141737@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jim Mattson commit 8715f05269bfbc6453e25e80825d781a82902f8e upstream. The host reports support for the synthetic feature X86_FEATURE_SSBD when any of the three following hardware features are set: CPUID.(EAX=7,ECX=0):EDX.SSBD[bit 31] CPUID.80000008H:EBX.AMD_SSBD[bit 24] CPUID.80000008H:EBX.VIRT_SSBD[bit 25] Either of the first two hardware features implies the existence of the IA32_SPEC_CTRL MSR, but CPUID.80000008H:EBX.VIRT_SSBD[bit 25] does not. Therefore, CPUID.80000008H:EBX.AMD_SSBD[bit 24] should only be set in the guest if CPUID.(EAX=7,ECX=0):EDX.SSBD[bit 31] or CPUID.80000008H:EBX.AMD_SSBD[bit 24] is set on the host. Fixes: 4c6903a0f9d76 ("KVM: x86: fix reporting of AMD speculation bug CPUID leaf") Signed-off-by: Jim Mattson Reviewed-by: Jacob Xu Reviewed-by: Peter Shier Cc: Paolo Bonzini Cc: stable@vger.kernel.org Reported-by: Eric Biggers Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/cpuid.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -760,7 +760,8 @@ static inline int __do_cpuid_func(struct entry->ebx |= F(AMD_IBRS); if (boot_cpu_has(X86_FEATURE_STIBP)) entry->ebx |= F(AMD_STIBP); - if (boot_cpu_has(X86_FEATURE_SSBD)) + if (boot_cpu_has(X86_FEATURE_SPEC_CTRL_SSBD) || + boot_cpu_has(X86_FEATURE_AMD_SSBD)) entry->ebx |= F(AMD_SSBD); if (!boot_cpu_has_bug(X86_BUG_SPEC_STORE_BYPASS)) entry->ebx |= F(AMD_SSB_NO);