Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4126236ybc; Thu, 14 Nov 2019 22:26:59 -0800 (PST) X-Google-Smtp-Source: APXvYqweObygxYhdkv7ftiuEkdafuL5Y0U8TbxmcTyl+ed4qX2J4n6KgkIXzj9zX32E0lVxCzNC9 X-Received: by 2002:a17:906:c2d6:: with SMTP id ch22mr11637176ejb.262.1573799219736; Thu, 14 Nov 2019 22:26:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573799219; cv=none; d=google.com; s=arc-20160816; b=jyiiusKSc/aY5mNKDPuTCV08PxfSHZBvbAwdlQe0CUwznLiAShLkDO8SYfuOtO3hjn txFrPK5bJrvGGKKomHHysppHIe+/NVtstyTdtYSWNU/yQV794cbSG4v6OkOcXhL9MbFf ljYsPLVkhyK7ckd8heFxuBD3KkVlKCTYKKAvwcwdV29Xy29Yp2PurVpeKxD+SVs8Gaky UDTu9alrfV000c9RUWzxjUiNBgragrwEk60d4veXZZyn5Jhcg/cXlGGmkQnkJptwvWy2 gd19+m5Sn6EKRL31lwRXnPVYeBaBH+d9XlFfkSb7XxL2nv7tbbr+iNSJ1L09ijIfC/GM bwww== 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=cM8Ydh9BD/PK1AFTf4/Y44qDVgyIONE5iveGJHjNDWQ=; b=bKJo3Y7a4hyLybkpv2Iij1XAj3zpUIkDuCqznAtk/Jx1H0Gy24tq2GuDAZg81Ezl50 Ck2XqktiYxIpA6m6ftKKTtkHpX0fGY5DqtY9A75ZtTCVT0W2vhV/EKg4BrBRJq5yRui4 hyNT4EtcnXWcfDnWl5g3yVBBTy4dvFpDIJDo1LxgoGnHh9+gmGI35KKMv5vo7ygVrVUV XDeK52Pfd/f3NrO/N1dP/GrN25dae1+zL0jV3uMMoir94AaGNA70T/zBoabD0IfYBuGM iGO6uJbkP4k2v7eF2LPeXkm3IMDdvR5fkcev7xktKP+xZGvgdbqyOUwo7cJLbZY1gJPq nvPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HnxlwjdY; 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 q3si4913311eju.242.2019.11.14.22.26.33; Thu, 14 Nov 2019 22:26:59 -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=HnxlwjdY; 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 S1727349AbfKOGYK (ORCPT + 99 others); Fri, 15 Nov 2019 01:24:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:50782 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727442AbfKOGVs (ORCPT ); Fri, 15 Nov 2019 01:21:48 -0500 Received: from localhost (unknown [104.132.150.99]) (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 BD1882073A; Fri, 15 Nov 2019 06:21:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573798908; bh=TIK9pVtbBBILAUJCSvHvEmIwJ+1++E+kftAnB/VxuJ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HnxlwjdYhB1mj7j1I24RUSKnKHBuDREdpCFmCbXR1/bKzYXWZ2V4op9S0FvEoLeh4 lXOhcMbCbAJdJLbgEezHuZPI0CwpigKdNHbvRaRaHFYS2SkS1unKdRMBY98IiLPotf CZ0QIavmO1uPjVRRooq6x/eXs+SykdOPk54NZBoA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jim Mattson , Konrad Rzeszutek Wilk , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Ben Hutchings Subject: [PATCH 4.4 08/20] kvm: x86: IA32_ARCH_CAPABILITIES is always supported Date: Fri, 15 Nov 2019 14:20:37 +0800 Message-Id: <20191115062010.880089365@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191115062006.854443935@linuxfoundation.org> References: <20191115062006.854443935@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 1eaafe91a0df4157521b6417b3dd8430bf5f52f0 upstream. If there is a possibility that a VM may migrate to a Skylake host, then the hypervisor should report IA32_ARCH_CAPABILITIES.RSBA[bit 2] as being set (future work, of course). This implies that CPUID.(EAX=7,ECX=0):EDX.ARCH_CAPABILITIES[bit 29] should be set. Therefore, kvm should report this CPUID bit as being supported whether or not the host supports it. Userspace is still free to clear the bit if it chooses. For more information on RSBA, see Intel's white paper, "Retpoline: A Branch Target Injection Mitigation" (Document Number 337131-001), currently available at https://bugzilla.kernel.org/show_bug.cgi?id=199511. Since the IA32_ARCH_CAPABILITIES MSR is emulated in kvm, there is no dependency on hardware support for this feature. Signed-off-by: Jim Mattson Reviewed-by: Konrad Rzeszutek Wilk Fixes: 28c1c9fabf48 ("KVM/VMX: Emulate MSR_IA32_ARCH_CAPABILITIES") Signed-off-by: Radim Krčmář Signed-off-by: Greg Kroah-Hartman Signed-off-by: Ben Hutchings Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/cpuid.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -447,6 +447,11 @@ static inline int __do_cpuid_ent(struct entry->ebx |= F(TSC_ADJUST); entry->edx &= kvm_cpuid_7_0_edx_x86_features; cpuid_mask(&entry->edx, CPUID_7_EDX); + /* + * We emulate ARCH_CAPABILITIES in software even + * if the host doesn't support it. + */ + entry->edx |= F(ARCH_CAPABILITIES); } else { entry->ebx = 0; entry->edx = 0;