From nobody Fri Nov 29 23:47:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1623069722; cv=none; d=zohomail.com; s=zohoarc; b=PzawQOe6mWwPFVyEFhJJLB3vlBsBMpWV+eC5FpTqSVj6fRdNftWRvQ+oDle61Lr98YQJa+nM8kFNQx2H969SPEAfvuceKBQDKMbMtkpYp18KVkl9uCvwG8p1TwFuEKRGzfFVcBir755ZzyUSSD4Xk62jEw7ltGdHId+VnCyWRGI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623069722; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=HyMVGQ15nnZ2voBKYszMbKyQ1DGSN3o8aq3McPqDQ6I=; b=aInXH5SUPVq6/QKQv0TFMRi6+z5g0QD1D6hmRCfIvjfvof49/qMfWBGzOZFP7aCGFfg42hUirllOwQvUTJsHija1nvEuOYaYiAPo34MRwwK1p4aujNzVsirF5VdN7lxYilMQ8pDZrqiMjk0Mnc1Gg4uvMcwBRKcn7H0t3vLd1ao= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1623069722782238.91162523454466; Mon, 7 Jun 2021 05:42:02 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.137911.255417 (Exim 4.92) (envelope-from ) id 1lqEZM-00082w-K6; Mon, 07 Jun 2021 12:41:28 +0000 Received: by outflank-mailman (output) from mailman id 137911.255417; Mon, 07 Jun 2021 12:41:28 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lqEZM-00082p-Fr; Mon, 07 Jun 2021 12:41:28 +0000 Received: by outflank-mailman (input) for mailman id 137911; Mon, 07 Jun 2021 12:41:27 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lqEZL-00082j-Bv for xen-devel@lists.xenproject.org; Mon, 07 Jun 2021 12:41:27 +0000 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id fb71e5c2-4264-4af1-a06d-f5e1b5f5b3ba; Mon, 07 Jun 2021 12:41:25 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: fb71e5c2-4264-4af1-a06d-f5e1b5f5b3ba DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1623069684; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=e21/IGcWymo5MIqD1rnrm7qEJJUELfd/4foTt5tkdmY=; b=eXYPe5ZLS29F1kqJwUL41WIGflAx3bIY2WsUkECCGOX5xI24ukiKDgfY tRlHCLlA7IhxFiPI3ud4LdMk18XN8lkJdbLyQkccWtTkONQ1dTr+bcWk/ qcs3EJ9yy6OAejwna+ya5HJwPpjPMdqK7X6hJWN6iaLTjiKg1Wu7E96yU Q=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: fiVjXspTC+it6lcBUkjP2Oto3/hNkUH99pmvJs7QBmN9c3U0HLGyIMxwSVGXnQKf39T6r2RRCE uK/WCtExn2HTB9t8rfyS7m/Ni86TSMH1FuNjbj7tOoEtbTGA+31YIJ03CknguXtMN5PL5NK4JU TgvAxOQudR3x103kWk4oaDiTygLToZ+aWzxBIduxlGYiqzqRdHhZNr7ToNnPVPrtxNb92BbRYk mlZvbtRSwZN00ZwhTg4Z5zY1eYfRfXYwbP9svncVLjSuWo+Fh4CHv+l2BXCSGqfkIA42T35Mjn UdU= X-SBRS: 5.1 X-MesageID: 45278750 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED IronPort-HdrOrdr: A9a23:pjRvOqA++2VDlGnlHemL55DYdb4zR+YMi2TDtnoBKiC9Hfb0qy nDppsmPHzP6Ar5OktLpTnoAsDpfZq7z/BICOEqVotKNzOLhILHFuBfxLqn7gSlPhbT2YdmpM VdWpk7JdHrD2FAq4LQ/Am8Hr8bsb262ZHtqOvFzU5Xa0VPZ7t75wl0MQqVe3cGITV7OQ== X-IronPort-AV: E=Sophos;i="5.83,255,1616472000"; d="scan'208";a="45278750" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu Subject: [PATCH] x86/cpuid: Fix HLE and RTM handling (again) Date: Mon, 7 Jun 2021 13:41:16 +0100 Message-ID: <20210607124116.24250-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) For reasons which are my fault, but I don't recall why, the FDP_EXCP_ONLY/NO_FPU_SEL adjustment uses the whole special_features[] array, not the two relevant bits. HLE and RTM were recently added to the list of special features, causing th= em to be always set in guest view, irrespective of the toolstacks choice on the matter. Rewrite the logic to refer to the features specifically, rather than relying on the contents of the special_features[] array. Fixes: 8fe24090d9 ("x86/cpuid: Rework HLE and RTM handling") Signed-off-by: Andrew Cooper Reported-by: Edwin T=C3=B6r=C3=B6k Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Wei Liu --- xen/arch/x86/cpuid.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c index f3c8950aa3..958caf35da 100644 --- a/xen/arch/x86/cpuid.c +++ b/xen/arch/x86/cpuid.c @@ -672,9 +672,11 @@ void recalculate_cpuid_policy(struct domain *d) sanitise_featureset(fs); =20 /* Fold host's FDP_EXCP_ONLY and NO_FPU_SEL into guest's view. */ - fs[FEATURESET_7b0] &=3D ~special_features[FEATURESET_7b0]; + fs[FEATURESET_7b0] &=3D ~(cpufeat_mask(X86_FEATURE_FDP_EXCP_ONLY) | + cpufeat_mask(X86_FEATURE_NO_FPU_SEL)); fs[FEATURESET_7b0] |=3D (host_cpuid_policy.feat._7b0 & - special_features[FEATURESET_7b0]); + (cpufeat_mask(X86_FEATURE_FDP_EXCP_ONLY) | + cpufeat_mask(X86_FEATURE_NO_FPU_SEL))); =20 cpuid_featureset_to_policy(fs, p); =20 --=20 2.11.0