From nobody Thu Nov 21 11:36:02 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=1732053530; cv=none; d=zohomail.com; s=zohoarc; b=KVw0szzCS+iani/EuMiKiU3wHOINkgCeNlSNMVOgpHHKyO87+biBAM69XadpKpEyBul/JnF7XOogFpJ+MV1hblQRpQJlfCzwZzmLkLLGTp79po9jn17ezhJP8PeeB4UbJX3LBlgGRqYpBZJteA1+mOfoSnsNZth1D/BfvAF8NMg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732053530; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=T4Tx40p/pcQzp9i9bKe4qDKeOuzdAJlJfoFrtC7E+UY=; b=E4aepklK2V6G91aBsnfoG62acZP/CdaKap1AdD3MdUUVJIUlKd8xAtkPzs8pk08jPRJW+K+SfeAc/ljMNVx6wpZV5wUzKHrTZQMq+yHlmjHxT9Cb9H8BRTdfTRC+5ixXIsxY7Wnr+PlEmsRMjYKSzzz+NMl0RrQ+tbedOBl0DVc= 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) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1732053530361298.4246864644955; Tue, 19 Nov 2024 13:58:50 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.840830.1256355 (Exim 4.92) (envelope-from ) id 1tDWF2-0001ke-Pb; Tue, 19 Nov 2024 21:58:36 +0000 Received: by outflank-mailman (output) from mailman id 840830.1256355; Tue, 19 Nov 2024 21:58:36 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tDWF2-0001kX-MV; Tue, 19 Nov 2024 21:58:36 +0000 Received: by outflank-mailman (input) for mailman id 840830; Tue, 19 Nov 2024 21:58:35 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tDWF1-0001j1-6J for xen-devel@lists.xenproject.org; Tue, 19 Nov 2024 21:58:35 +0000 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [2a00:1450:4864:20::536]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 6a2adf61-a6c1-11ef-a0ca-8be0dac302b0; Tue, 19 Nov 2024 22:58:31 +0100 (CET) Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-5cf9ef18ae9so438815a12.1 for ; Tue, 19 Nov 2024 13:58:31 -0800 (PST) Received: from andrewcoop.eng.citrite.net ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa4b9357088sm257347366b.23.2024.11.19.13.58.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Nov 2024 13:58:29 -0800 (PST) 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: 6a2adf61-a6c1-11ef-a0ca-8be0dac302b0 X-Custom-Connection: eyJyZW1vdGVpcCI6IjJhMDA6MTQ1MDo0ODY0OjIwOjo1MzYiLCJoZWxvIjoibWFpbC1lZDEteDUzNi5nb29nbGUuY29tIn0= X-Custom-Transaction: eyJpZCI6IjZhMmFkZjYxLWE2YzEtMTFlZi1hMGNhLThiZTBkYWMzMDJiMCIsInRzIjoxNzMyMDUzNTExLjQzMzM3Mywic2VuZGVyIjoiYW5kcmV3LmNvb3BlckBjbG91ZC5jb20iLCJyZWNpcGllbnQiOiJ4ZW4tZGV2ZWxAbGlzdHMueGVucHJvamVjdC5vcmcifQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1732053510; x=1732658310; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=T4Tx40p/pcQzp9i9bKe4qDKeOuzdAJlJfoFrtC7E+UY=; b=pxmtX3FNwVR07DuuA/Mg9qTQST3WDa+GN5Pvdp4JF0LAp2VqJSHutg/6cb5VL+Gb30 kwImlM8Pl2j7Z5KhLcmMucuoTOi56eOXjRITg/kHF6zXkldl6wlGVlEpJT9nTuhq4BlA VU/EddOPltrPOr++v8jC1NRFB/R/Rd0RV+Qro= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732053510; x=1732658310; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=T4Tx40p/pcQzp9i9bKe4qDKeOuzdAJlJfoFrtC7E+UY=; b=IH8SCyRdP+cZMsJNAre0pJoXhENwTwfpgVfdtkyqhzb14uqKS3cgnLCDmzRXY3jtqc KF4/d+QfVXtpg3Byhp69AKfPgel/UOdno/DM9qnFOQ+8RedpkaNptSSFQbHEiyvPzvYC Ad6w4xq7r+7kF17dDvn1GOC6rizHBlbWd7nTV6ATTKloUFqaWrQm1mjDXhqx6qKBNbYQ Bh8lnC2DdgCrO196LcNNSV1qDQDbjHTBYi60nAn8WYLtG8dpjq5ONsRmrc+GZNT1DBQk 6pJ3OcoOKK/jg7MxRUrf1Oz+D4esZK6yi6ywuk8WvfwYM1usil75yWnBXaiWI3ruSKZn T39Q== X-Gm-Message-State: AOJu0YxftQfxchlZDhE29JC9WsvCSQJwGcQKYA/0F6NS8PWbJg6qGO4n 0otC6bvWzLa676GypLS8ftNm63ryQKBlBxZFD62f0WKehlD07ED6InGbWcA41/FE+tyjHZ366qa N X-Google-Smtp-Source: AGHT+IG4Lp1bXImRAxW8kuCUc3FPutR9gAMOMnEhrrNflgK5ZvBxgTWjJtLjSTLIIGIWZhZKruAkeg== X-Received: by 2002:a17:907:3f10:b0:a99:4045:c88a with SMTP id a640c23a62f3a-aa4dc4f9cfcmr66146866b.0.1732053509841; Tue, 19 Nov 2024 13:58:29 -0800 (PST) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH] x86/ucode: Only rescan features on successful microcode load Date: Tue, 19 Nov 2024 21:58:27 +0000 Message-Id: <20241119215827.2891332-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1732053532198116600 There's no point rescanning if we didn't load something new. Take the opportunity to make the comment a bit more concise. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 --- xen/arch/x86/cpu/microcode/core.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode= /core.c index 4811b5ffb11c..2bf462bf0c2e 100644 --- a/xen/arch/x86/cpu/microcode/core.c +++ b/xen/arch/x86/cpu/microcode/core.c @@ -860,6 +860,10 @@ static int __init early_microcode_load(struct boot_inf= o *bi) =20 rc =3D ucode_ops.apply_microcode(patch, 0); =20 + if ( rc =3D=3D 0 ) + /* Rescan CPUID/MSR features, which may have changed after a load.= */ + early_cpu_init(false); + unmap: bootstrap_unmap(); =20 @@ -911,14 +915,5 @@ int __init early_microcode_init(struct boot_info *bi) =20 rc =3D early_microcode_load(bi); =20 - /* - * Some CPUID leaves and MSRs are only present after microcode updates - * on some processors. We take the chance here to make sure what little - * state we have already probed is re-probed in order to ensure we do - * not use stale values. tsx_init() in particular needs to have up to - * date MSR_ARCH_CAPS. - */ - early_cpu_init(false); - return rc; } --=20 2.39.5