From nobody Mon Feb 9 08:57:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1585649198; cv=none; d=zohomail.com; s=zohoarc; b=K/OHmwu2RDon6CGjk2/riJhEvEHHn1MiCxturZ2b1fGD64b6zigkhmqyN49yx/Mq/XK+RXEkGK6Txi2w6OjNZ8hpst5SowKcUXOhuOsl2dJJGQ652BaiT49WoueXfdvKOCxF617v0nUnVVOheS7mBDyRAmNdQgXibCztClTkJ+s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585649198; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kaDhVfdvcDYG9fCqKRxWClTruTdBJ324TBTk+Wfqt7U=; b=GHTkfjSHmQSHqhgQTLjnRDVWTXMJ7/lVYkVQxvrVonrf3zk3B7KlEZbFgB+IACNkv/LhMyEpq50bqqj07lgnPAuAdeqD9+95vrt8HJYe1AyKJGmtJyBK0CUUs5md63fqfu6RpWsWoBKWLL+czLqX0wwTXZST5AJbEyjj266tiwI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none 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 1585649198506709.4718455092012; Tue, 31 Mar 2020 03:06:38 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jJDmS-0005wl-85; Tue, 31 Mar 2020 10:06:00 +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.89) (envelope-from ) id 1jJDmR-0005vz-8z for xen-devel@lists.xenproject.org; Tue, 31 Mar 2020 10:05:59 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 2f649311-7337-11ea-ba0b-12813bfff9fa; Tue, 31 Mar 2020 10:05:46 +0000 (UTC) X-Inumbo-ID: 2f649311-7337-11ea-ba0b-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1585649145; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Si5z3xeHwmyHLpHOIC9s/BWYm39Q13l64/PRkSlBm6w=; b=cdXGASegCVucSYjuDJm5B0j98ptJBbAJ3zNE/TLh0a8VTGZcrIKBSP4z bGueHDinyvfyv+GRoTeprjpiVeZqa+849+rNi9TiXOJdq8yDTkyLdectS J0zXuQViLtEM6TcAeUIGOb6XTosHkJ6uv8dTETiykoaWYf4pLrBEiyyCJ M=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com 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; Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa6.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: XngBh1581dh7CTw+F+sgioVCiUhxNKM2+kaS9KN8JnNSqtxxjKjbDzVq7rVnR9HumtnbuKXHeQ UzlcYOVvpQgHaWTV8EAxW877G/NyR/XOB3cBvQZL4dRtmapIXFXi4fIqZaKif4gko4dONUdssA xBIbY7U2OnQ5nO5CvxEfChUHlw/6UFxsCjr/C8Y3D+rw3RH3TrHtJLV1ThkA8GTED1nwN5+HvA vtJKcuCRQ99yHnm1J/XL0wXM4cUxJtC+kQriDHXvyriFJc74aI2L6VWhLDexH1nESQn33RvTcn j9A= X-SBRS: 2.7 X-MesageID: 15327881 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.72,327,1580792400"; d="scan'208";a="15327881" From: Andrew Cooper To: Xen-devel Subject: [PATCH 07/11] x86/ucode/amd: Alter API for microcode_fits() Date: Tue, 31 Mar 2020 11:05:27 +0100 Message-ID: <20200331100531.4294-8-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200331100531.4294-1-andrew.cooper3@citrix.com> References: <20200331100531.4294-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Although it is logically a step in the wrong direction overall, it simplifi= es the rearranging of cpu_request_microcode() substantially for microcode_fits= () to take struct microcode_header_amd directly, and not require an intermedia= te struct microcode_amd pointing at it. Make this change (taking time to rename 'mc_amd' to its eventual 'patch' to reduce the churn in the series), and a later cleanup will make it uniformly take a struct microcode_patch. No functional change. Signed-off-by: Andrew Cooper Acked-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 --- xen/arch/x86/cpu/microcode/amd.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/= amd.c index 8318664f85..254f3dd4d7 100644 --- a/xen/arch/x86/cpu/microcode/amd.c +++ b/xen/arch/x86/cpu/microcode/amd.c @@ -173,31 +173,30 @@ static bool check_final_patch_levels(const struct cpu= _signature *sig) } =20 static enum microcode_match_result microcode_fits( - const struct microcode_amd *mc_amd) + const struct microcode_header_amd *patch) { unsigned int cpu =3D smp_processor_id(); const struct cpu_signature *sig =3D &per_cpu(cpu_sig, cpu); - const struct microcode_header_amd *mc_header =3D mc_amd->mpb; =20 if ( equiv.sig !=3D sig->sig || - equiv.id !=3D mc_header->processor_rev_id ) + equiv.id !=3D patch->processor_rev_id ) return MIS_UCODE; =20 - if ( mc_header->patch_id <=3D sig->rev ) + if ( patch->patch_id <=3D sig->rev ) { pr_debug("microcode: patch is already at required level or greater= .\n"); return OLD_UCODE; } =20 pr_debug("microcode: CPU%d found a matching microcode update with vers= ion %#x (current=3D%#x)\n", - cpu, mc_header->patch_id, sig->rev); + cpu, patch->patch_id, sig->rev); =20 return NEW_UCODE; } =20 static bool match_cpu(const struct microcode_patch *patch) { - return patch && (microcode_fits(patch) =3D=3D NEW_UCODE); + return patch && (microcode_fits(patch->mpb) =3D=3D NEW_UCODE); } =20 static void free_patch(struct microcode_patch *mc_amd) @@ -223,14 +222,11 @@ static enum microcode_match_result compare_header( static enum microcode_match_result compare_patch( const struct microcode_patch *new, const struct microcode_patch *old) { - const struct microcode_header_amd *new_header =3D new->mpb; - const struct microcode_header_amd *old_header =3D old->mpb; - /* Both patches to compare are supposed to be applicable to local CPU.= */ - ASSERT(microcode_fits(new) !=3D MIS_UCODE); - ASSERT(microcode_fits(old) !=3D MIS_UCODE); + ASSERT(microcode_fits(new->mpb) !=3D MIS_UCODE); + ASSERT(microcode_fits(old->mpb) !=3D MIS_UCODE); =20 - return compare_header(new_header, old_header); + return compare_header(new->mpb, old->mpb); } =20 static int apply_microcode(const struct microcode_patch *patch) @@ -509,7 +505,7 @@ static struct microcode_patch *cpu_request_microcode(co= nst void *buf, * If the new ucode covers current CPU, compare ucodes and store t= he * one with higher revision. */ - if ( (microcode_fits(mc_amd) !=3D MIS_UCODE) && + if ( (microcode_fits(mc_amd->mpb) !=3D MIS_UCODE) && (!saved || (compare_header(mc_amd->mpb, saved) =3D=3D NEW_UCO= DE)) ) { xfree(saved); --=20 2.11.0