Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp229894lqg; Thu, 11 Apr 2024 00:25:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVInGHMT3ErI2o4323NnbBMtQxjSsOIvGJD2adQMdb2dKG+vDvDmT19Pdz4ICa2/buzLdna7LYTFfFVyWSgHXk7JvzRXnMLcLWQuzqi9w== X-Google-Smtp-Source: AGHT+IE1Covx5fpAbbwJhHQGGDqsk2KeeqT2odTPby0ZI22a0l5uhTDexUbpcUwIexUdEAqcVXeT X-Received: by 2002:a05:6359:498c:b0:17f:72d6:ce2a with SMTP id mv12-20020a056359498c00b0017f72d6ce2amr6903419rwb.1.1712820348431; Thu, 11 Apr 2024 00:25:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712820348; cv=pass; d=google.com; s=arc-20160816; b=FwVO3Azk2YwMfWw/YOM4oVD7/TIvFpxdtkRnfdTETFFUKTh/Lxi2KwuCZw0zchRAp1 kt5op+Q1cs5dtrsaTTAByQATXWf8O0b1xK3ce9x1mj/wQ7pQlb6LnRxvMKI9eYYsTPRd 2889pM43cTDdvUhsERI5/+n+qfZbLaY2uowADrvBJth1jw6pQDfpFM1mi8FA8xVa5SWc sBBS50DhDF2pT+hZ2/B1reHpHB5qVSlgwsqg565W8DSSkcWH3UaHvZ2sytgQv2k1M193 OBumZawmiCFudROkWn8+DDcMSu9ng5vlcvs3ZjtUtB1vfMmRzPD2PDhtbYhk0+MF9Uvv AilQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=lnwdpFPDwDwPRlXtxxrN+weoWOb9YtGRdlGy/ntNYTo=; fh=B+pj/7Zlt6omm0ZsgnD4tfyfvcaJjCyGKUn2xGstYtI=; b=kVanh9Rei4o83mDWsT+/olQGEKr0XbJvv3ICHw8M9NYWDwff0Ei/4a/HEW0uqIlqM6 f0X3VfZT3oPJmZugFzSHL9+aGB9pomR3UGVJWDPZ6luOBO6BPHuzU6dThfUGza5KSKdY NM3CqeMvEtNDxGAl/lov8YBnx7OOmDGVkT3B+d6D83/kuzVH4xTkzOJ1vrpwn5dww+h5 G3g7twAH9o8PEv0RATkXy0KYLd3IVDHQYW+fUN1zU74Nujcp3v6PKMdNfyCMLSLY107e xNJSxhocpL5xGXDOqEPBOo0DxI+WVvVDr/FfT9rN3ar2GtNV0GMff6bPI0LIYW6M+REB i6Uw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b=e5eFim6E; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel+bounces-139963-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139963-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=oracle.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id s9-20020a63e809000000b005f3ffb190fdsi763734pgh.557.2024.04.11.00.25.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 00:25:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-139963-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b=e5eFim6E; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel+bounces-139963-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139963-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=oracle.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 12149282AD0 for ; Thu, 11 Apr 2024 07:25:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7AB2513E408; Thu, 11 Apr 2024 07:25:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="e5eFim6E" Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F059613DBB1; Thu, 11 Apr 2024 07:25:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712820323; cv=none; b=ihIMwqyPVVONff3bpDijYLumGtpDrevA7iAEtfKppKvc518awPgLlS9puOwtZZEVpn3qiZpMw5TXmvl37yA6v9l2Sy+WUBOpsgTYUZ6CLVZCDYWVsZJSrmT5AYk0Za2dKibfamzvusvEfYekfy49uzTceRXKHbg9edg1MnZuCOM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712820323; c=relaxed/simple; bh=6mwx4ZptoWeBdE7Uw4CKuzXPvoq1OIBVM0SrKdhpFVo=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=Rdvyeaq5943U6IBgKVrsrtPoUO6ziZD94F/23ngT6ixYl4s3uTYqVlcCAp2B68xqGt3AKGWCrhTV1HvoAagsbgEQL1IV8jWy/SiTF8QGIK/DUmgu77gEUvRvnef58j1eLxrkoauozRVlaH5MbhJz6ORBY3b813GbfCZSMEnjBFc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=e5eFim6E; arc=none smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 43B6E0AM007560; Thu, 11 Apr 2024 07:24:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=corp-2023-11-20; bh=lnwdpFPDwDwPRlXtxxrN+weoWOb9YtGRdlGy/ntNYTo=; b=e5eFim6EB82WRsdIBzsU+wCgnSefXFq1fDckwuLls5TLExv8beDHwHtN0cLwemew8wJV wh9l/stTjfY3Gr9gqU5TwTnf7E9okaERsSwIEYii4qc1SCFzU1/AvGey+lwqC8r7j3O8 +HLMv6wRoIgl2S/RYyPQ2kdxQcCmi8BflNw/YXUfkYn9G73MWB7B/qjzCRxJhK2JyLKk fUZAJKWq6Lc5jkunILhxLd3uOL9Jpt9hndUAD8Vqmt/rrGPOrn2O1ePOEjcGVfojpQas 43z9trZxLO55KvCoPdzYmwKYrd2nHmVDTq5rtPoBwaTdWyZzXi9Cydyw1fV1xb+ewj5S nQ== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3xaxeds347-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Apr 2024 07:24:49 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 43B6sLxj039988; Thu, 11 Apr 2024 07:24:49 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3xavuffdpd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 11 Apr 2024 07:24:49 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 43B7Omtd030222; Thu, 11 Apr 2024 07:24:48 GMT Received: from laptop-dell-latitude7430.nl.oracle.com (dhcp-10-175-60-243.vpn.oracle.com [10.175.60.243]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3xavuffdnp-1; Thu, 11 Apr 2024 07:24:48 +0000 From: Alexandre Chartre To: x86@kernel.org, kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, daniel.sneddon@linux.intel.com, pawan.kumar.gupta@linux.intel.com, tglx@linutronix.de, konrad.wilk@oracle.com, peterz@infradead.org, gregkh@linuxfoundation.org, seanjc@google.com, andrew.cooper3@citrix.com, dave.hansen@linux.intel.com, nik.borisov@suse.com, kpsingh@kernel.org, longman@redhat.com, bp@alien8.de, pbonzini@redhat.com, alexandre.chartre@oracle.com Subject: [PATCH] KVM: x86: Set BHI_NO in guest when host is not affected by BHI Date: Thu, 11 Apr 2024 09:24:45 +0200 Message-Id: <20240411072445.522731-1-alexandre.chartre@oracle.com> X-Mailer: git-send-email 2.39.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-11_02,2024-04-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2404110052 X-Proofpoint-GUID: J38Ol2hH7iRACtHNqOkjjXgSFLZcRMdR X-Proofpoint-ORIG-GUID: J38Ol2hH7iRACtHNqOkjjXgSFLZcRMdR When a system is not affected by the BHI bug then KVM should configure guests with BHI_NO to ensure they won't enable any BHI mitigation. Signed-off-by: Alexandre Chartre --- arch/x86/kvm/x86.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 984ea2089efc..f43d3c15a6b7 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1678,6 +1678,9 @@ static u64 kvm_get_arch_capabilities(void) if (!boot_cpu_has_bug(X86_BUG_GDS) || gds_ucode_mitigated()) data |= ARCH_CAP_GDS_NO; + if (!boot_cpu_has_bug(X86_BUG_BHI)) + data |= ARCH_CAP_BHI_NO; + return data; } -- 2.39.3