From nobody Thu Mar 28 21:21:19 2024 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=1584631661; cv=none; d=zohomail.com; s=zohoarc; b=FfKun5KRko2Y+3hIeZ0NUzdKHsUCErwC/ep2urWsMJNuIyK1TonKnkY5mheqhlM1lrEs3yKmbn9kDAyk8D0gFeUHgwwJjtpDt0IPxaZWTU/ZqQpNWwQ2Upp2r58g7EGnNynwKM2puqueTml3DJa4gLMKDaSTxjLVoYu7+1l9w4E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584631661; 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=zxAgB53cZNqyXV571mLsAKUSg+5a3I4kpsvLtJ0ffkM=; b=RgcwtoMPg6mspENj4IiWxxSioQhVXnPZwAhi2PNoOIKfO6yvuUaqr0lIOQ4LsAOPaLCeVz7M7gqpwuUFi9BiNR28XxN2GS4botHbRIRXtfaXZtRbUtGNbj+Sh2QMEATQnobkL0kq0tL1jyRkPH4JsTNfcl7KfWIFrSwwo1RO0BE= 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 1584631661060439.62870456916755; Thu, 19 Mar 2020 08:27:41 -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 1jEx4A-0003NY-9f; Thu, 19 Mar 2020 15:26:38 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jEx49-0003NK-1T for xen-devel@lists.xenproject.org; Thu, 19 Mar 2020 15:26:37 +0000 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 03106b1c-69f6-11ea-bec1-bc764e2007e4; Thu, 19 Mar 2020 15:26:32 +0000 (UTC) X-Inumbo-ID: 03106b1c-69f6-11ea-bec1-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1584631592; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5tS2vBkJkuSxuO4vTRChjIHi4mAWIH1qpcU8kqQhNBc=; b=V63/hn15kc1AQbITAtNWudX87OsF4p1FtrTOVQKuI6sJ7TLQvJAL5uJ5 8vWvJiZYYINbwB/6UTvW1VGujsKl02i2HyQWGBqK6EVdqNAz4YszjL6RS Jr4yMGzk9JcEABQUMS5S4ZO5V5Xs5iOlpfrvhBXghivk6qebyYwoUn9+u s=; Authentication-Results: esa5.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 (esa5.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=esa5.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa5.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=esa5.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 (esa5.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=esa5.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: XQeZWB2RRICaDFyFcxUfUPBLGj64th5TB8ARXqbUWRhnZbxQputlZOOwFkRF/obw3ti/GkhF3E r1q6SrS2moQRlb97wH17i+KcrsOrNuIyPHhQyiBO8xVClzIbUtzOg3f+qI0FHlNx34wJjVDvJl 7PhrU+1EP70wxYn6IKyDzm+3zvDPfwOOeYqDkOb2IgB6T89p4R/OpWzzqGvLfl2vsYVaGeTyaw JZdk0Eqe4EShwzqH/gxMBTjk+YZDocpvi00mlfx22BsTX4S/131gRIPFkpcPNATeXdESNYMxjZ wRo= X-SBRS: 2.7 X-MesageID: 14622629 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.70,572,1574139600"; d="scan'208";a="14622629" From: Andrew Cooper To: Xen-devel Date: Thu, 19 Mar 2020 15:26:17 +0000 Message-ID: <20200319152622.31758-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200319152622.31758-1-andrew.cooper3@citrix.com> References: <20200319152622.31758-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 1/6] x86/ucode: Remove declarations for non-external functions 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?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Neither microcode_free_patch() nor early_microcode_update_cpu() have extern= al callers. Make them static. early_microcode_update_cpu()'s sole caller is following a use of microcode_ops, making the error path dead. Drop it as well. 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/microcode.c | 7 ++----- xen/include/asm-x86/microcode.h | 2 -- xen/include/asm-x86/processor.h | 1 - 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/microcode.c b/xen/arch/x86/microcode.c index 6907b312cf..27a88c6826 100644 --- a/xen/arch/x86/microcode.c +++ b/xen/arch/x86/microcode.c @@ -250,7 +250,7 @@ static struct microcode_patch *parse_blob(const char *b= uf, size_t len) return NULL; } =20 -void microcode_free_patch(struct microcode_patch *microcode_patch) +static void microcode_free_patch(struct microcode_patch *microcode_patch) { microcode_ops->free_patch(microcode_patch->mc); xfree(microcode_patch); @@ -763,16 +763,13 @@ int microcode_update_one(bool start_update) } =20 /* BSP calls this function to parse ucode blob and then apply an update. */ -int __init early_microcode_update_cpu(void) +static int __init early_microcode_update_cpu(void) { int rc =3D 0; const void *data =3D NULL; size_t len; struct microcode_patch *patch; =20 - if ( !microcode_ops ) - return -ENOSYS; - if ( ucode_blob.size ) { len =3D ucode_blob.size; diff --git a/xen/include/asm-x86/microcode.h b/xen/include/asm-x86/microcod= e.h index 7d5a1f8e8a..1a2bbacc6c 100644 --- a/xen/include/asm-x86/microcode.h +++ b/xen/include/asm-x86/microcode.h @@ -41,6 +41,4 @@ struct cpu_signature { DECLARE_PER_CPU(struct cpu_signature, cpu_sig); extern const struct microcode_ops *microcode_ops; =20 -void microcode_free_patch(struct microcode_patch *patch); - #endif /* ASM_X86__MICROCODE_H */ diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processo= r.h index b2b19a02cd..895c7032b9 100644 --- a/xen/include/asm-x86/processor.h +++ b/xen/include/asm-x86/processor.h @@ -581,7 +581,6 @@ int guest_wrmsr_xen(struct vcpu *v, uint32_t idx, uint6= 4_t val); =20 void microcode_set_module(unsigned int); int microcode_update(XEN_GUEST_HANDLE_PARAM(const_void), unsigned long len= ); -int early_microcode_update_cpu(void); int early_microcode_init(void); int microcode_update_one(bool start_update); int microcode_init_intel(void); --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Thu Mar 28 21:21:19 2024 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=1584631665; cv=none; d=zohomail.com; s=zohoarc; b=mW+MU5BX9C/SPD4fZ37oKPVAL+ifoto/5cQGpB0VbIPzeY2cuaohHqHo4KGGVl/ZwiNF6+QAYzQWe1LWdpJuIL7kxLsGR/YoV2Z4JW30CnoXLf+ZOdbtihKVEx2nCarfBPXsZyN5Rrgrewgx3bWOLMUFhRVcZhV0dYzRWqWA/3k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584631665; 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=fT+RsDnq3Rc60XR6tOVD0S9yKSgG366jG5Nfw+8JMIA=; b=RBJwknHdN5tknS847+hoHz20DHA2Ipg91co/9XuJv0hvXRFA68UZUqFlHkqotC/hA+7iimTAg60PHG/TyKoc+VJ/gNEeU3kI8BBkSuheZ2rSyj63NMX9IDAUWpy0SV1B6uwrXGabpIwZLbu7Xyn+UINewcglTai0tB0bC5LF0Sg= 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 1584631665550941.8162327136249; Thu, 19 Mar 2020 08:27:45 -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 1jEx4F-0003Pp-14; Thu, 19 Mar 2020 15:26:43 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jEx4E-0003P9-2M for xen-devel@lists.xenproject.org; Thu, 19 Mar 2020 15:26:42 +0000 Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 03e0166e-69f6-11ea-a6c1-bc764e2007e4; Thu, 19 Mar 2020 15:26:34 +0000 (UTC) X-Inumbo-ID: 03e0166e-69f6-11ea-a6c1-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1584631594; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ctJq4EsyS1HBueXLlBon3PzmXHNdh76NoHH8OguyHdE=; b=f7Y0gs6sXE7rpRc3bB5tuEFgGMFe9SUcxku5/ZP+fdQdHYtQFv+04s2R euA5CZx7MXUZS3oUUmUYOiVAC/ftKWqt+AT/fvAN8ErOm/gNCWzXeCpeb uRPvSvF6hyVQhdqpSTwBi2/07e0rQjTBdZzrVI4/wuD8AMmV4aRHbZPmx A=; Authentication-Results: esa2.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 (esa2.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=esa2.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa2.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=esa2.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 (esa2.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=esa2.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: 9ragIFqXMmJ5stAkaXDqilrcJGghhqPdT1HlFS/Wc4UBbPLAl8axnatrBLD1binqVv4avDFgTu jMrrUa9pgPFCAzHTwvDFyxmjUauxFHShmoGXJrAwHLmTIzmTacGC9gUy8BqCg3aDFMbdWbCL3S 4PbsrCGvd/G1adhy6nEEt0lY+/ehsddZI5A5exBRedTNO4sTskBBRdOFpQt+okAYBwrqvlK4tf 7Wcl6OKrOIxhkB+JBmjNEs3X3l5FFnyXm9fVARnByGoiJsEkeAwPMZJ+bA6vPVQtbtlSvBaSyk P1w= X-SBRS: 2.7 X-MesageID: 14285533 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.70,572,1574139600"; d="scan'208";a="14285533" From: Andrew Cooper To: Xen-devel Date: Thu, 19 Mar 2020 15:26:18 +0000 Message-ID: <20200319152622.31758-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200319152622.31758-1-andrew.cooper3@citrix.com> References: <20200319152622.31758-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 2/6] x86/ucode: Move microcode into its own directory 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?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Split the existing asm/microcode.h in half, keeping the per-cpu cpu_sig available to external users, and moving everything else into private.h Take the opportunity to trim and clean up the include lists for all 3 source files, all of which include rather more than necessary. No functional change. Signed-off-by: Andrew Cooper Acked-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 Inclusion of asm/flushtlb.h in isolation was broken by c/s 80943aa40e, and = the commit message even states this breakage. I'm surprised it got accepted. Either this needs fixing, or the 23(!) other files including asm/flushtlb.h should be adjusted. Personally I don't think it is reasonable to require including xen/mm.h just to get at tlb flushing functionality, but I also ca= n't spot an obvious way to untangle the dependencies (hence the TODO). --- xen/arch/x86/Makefile | 3 --- xen/arch/x86/cpu/Makefile | 1 + xen/arch/x86/cpu/microcode/Makefile | 3 +++ .../x86/{microcode_amd.c =3D> cpu/microcode/amd.c} | 12 ++++----- xen/arch/x86/{microcode.c =3D> cpu/microcode/core.c} | 15 +++-------- .../{microcode_intel.c =3D> cpu/microcode/intel.c} | 9 +++---- .../x86/cpu/microcode/private.h} | 19 +++++--------- xen/include/asm-x86/microcode.h | 30 ------------------= ---- 8 files changed, 22 insertions(+), 70 deletions(-) create mode 100644 xen/arch/x86/cpu/microcode/Makefile rename xen/arch/x86/{microcode_amd.c =3D> cpu/microcode/amd.c} (99%) rename xen/arch/x86/{microcode.c =3D> cpu/microcode/core.c} (99%) rename xen/arch/x86/{microcode_intel.c =3D> cpu/microcode/intel.c} (98%) copy xen/{include/asm-x86/microcode.h =3D> arch/x86/cpu/microcode/private.= h} (78%) diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index ed709e2373..e954edbc2e 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -43,9 +43,6 @@ obj-$(CONFIG_INDIRECT_THUNK) +=3D indirect-thunk.o obj-y +=3D ioport_emulate.o obj-y +=3D irq.o obj-$(CONFIG_KEXEC) +=3D machine_kexec.o -obj-y +=3D microcode_amd.o -obj-y +=3D microcode_intel.o -obj-y +=3D microcode.o obj-y +=3D mm.o x86_64/mm.o obj-$(CONFIG_HVM) +=3D monitor.o obj-y +=3D mpparse.o diff --git a/xen/arch/x86/cpu/Makefile b/xen/arch/x86/cpu/Makefile index de983006a1..35561fe51d 100644 --- a/xen/arch/x86/cpu/Makefile +++ b/xen/arch/x86/cpu/Makefile @@ -1,4 +1,5 @@ obj-y +=3D mcheck/ +obj-y +=3D microcode/ obj-y +=3D mtrr/ =20 obj-y +=3D amd.o diff --git a/xen/arch/x86/cpu/microcode/Makefile b/xen/arch/x86/cpu/microco= de/Makefile new file mode 100644 index 0000000000..aae235245b --- /dev/null +++ b/xen/arch/x86/cpu/microcode/Makefile @@ -0,0 +1,3 @@ +obj-y +=3D amd.o +obj-y +=3D core.o +obj-y +=3D intel.o diff --git a/xen/arch/x86/microcode_amd.c b/xen/arch/x86/cpu/microcode/amd.c similarity index 99% rename from xen/arch/x86/microcode_amd.c rename to xen/arch/x86/cpu/microcode/amd.c index bc7459416c..9028889813 100644 --- a/xen/arch/x86/microcode_amd.c +++ b/xen/arch/x86/cpu/microcode/amd.c @@ -16,16 +16,14 @@ =20 #include #include -#include -#include -#include -#include -#include +#include /* TODO: Fix asm/tlbflush.h breakage */ =20 +#include #include #include -#include -#include +#include + +#include "private.h" =20 #define pr_debug(x...) ((void)0) =20 diff --git a/xen/arch/x86/microcode.c b/xen/arch/x86/cpu/microcode/core.c similarity index 99% rename from xen/arch/x86/microcode.c rename to xen/arch/x86/cpu/microcode/core.c index 27a88c6826..ac5da6b2fe 100644 --- a/xen/arch/x86/microcode.c +++ b/xen/arch/x86/cpu/microcode/core.c @@ -22,29 +22,22 @@ */ =20 #include +#include #include +#include #include -#include -#include -#include #include -#include -#include -#include #include #include -#include -#include -#include #include =20 #include #include -#include #include #include #include -#include + +#include "private.h" =20 /* * Before performing a late microcode update on any thread, we diff --git a/xen/arch/x86/microcode_intel.c b/xen/arch/x86/cpu/microcode/in= tel.c similarity index 98% rename from xen/arch/x86/microcode_intel.c rename to xen/arch/x86/cpu/microcode/intel.c index 91b7d473f7..90fb006c94 100644 --- a/xen/arch/x86/microcode_intel.c +++ b/xen/arch/x86/cpu/microcode/intel.c @@ -23,15 +23,12 @@ =20 #include #include -#include -#include -#include -#include -#include =20 #include #include -#include +#include + +#include "private.h" =20 #define pr_debug(x...) ((void)0) =20 diff --git a/xen/include/asm-x86/microcode.h b/xen/arch/x86/cpu/microcode/p= rivate.h similarity index 78% copy from xen/include/asm-x86/microcode.h copy to xen/arch/x86/cpu/microcode/private.h index 1a2bbacc6c..2e3be79eaf 100644 --- a/xen/include/asm-x86/microcode.h +++ b/xen/arch/x86/cpu/microcode/private.h @@ -1,7 +1,9 @@ -#ifndef ASM_X86__MICROCODE_H -#define ASM_X86__MICROCODE_H +#ifndef ASM_X86_MICROCODE_PRIVATE_H +#define ASM_X86_MICROCODE_PRIVATE_H =20 -#include +#include + +#include =20 enum microcode_match_result { OLD_UCODE, /* signature matched, but revision id is older or equal */ @@ -9,8 +11,6 @@ enum microcode_match_result { MIS_UCODE, /* signature mismatched */ }; =20 -struct cpu_signature; - struct microcode_patch { union { struct microcode_intel *mc_intel; @@ -32,13 +32,6 @@ struct microcode_ops { const struct microcode_patch *new, const struct microcode_patch *o= ld); }; =20 -struct cpu_signature { - unsigned int sig; - unsigned int pf; - unsigned int rev; -}; - -DECLARE_PER_CPU(struct cpu_signature, cpu_sig); extern const struct microcode_ops *microcode_ops; =20 -#endif /* ASM_X86__MICROCODE_H */ +#endif /* ASM_X86_MICROCODE_PRIVATE_H */ diff --git a/xen/include/asm-x86/microcode.h b/xen/include/asm-x86/microcod= e.h index 1a2bbacc6c..9b6ff7db08 100644 --- a/xen/include/asm-x86/microcode.h +++ b/xen/include/asm-x86/microcode.h @@ -3,35 +3,6 @@ =20 #include =20 -enum microcode_match_result { - OLD_UCODE, /* signature matched, but revision id is older or equal */ - NEW_UCODE, /* signature matched, but revision id is newer */ - MIS_UCODE, /* signature mismatched */ -}; - -struct cpu_signature; - -struct microcode_patch { - union { - struct microcode_intel *mc_intel; - struct microcode_amd *mc_amd; - void *mc; - }; -}; - -struct microcode_ops { - struct microcode_patch *(*cpu_request_microcode)(const void *buf, - size_t size); - int (*collect_cpu_info)(struct cpu_signature *csig); - int (*apply_microcode)(const struct microcode_patch *patch); - int (*start_update)(void); - void (*end_update_percpu)(void); - void (*free_patch)(void *mc); - bool (*match_cpu)(const struct microcode_patch *patch); - enum microcode_match_result (*compare_patch)( - const struct microcode_patch *new, const struct microcode_patch *o= ld); -}; - struct cpu_signature { unsigned int sig; unsigned int pf; @@ -39,6 +10,5 @@ struct cpu_signature { }; =20 DECLARE_PER_CPU(struct cpu_signature, cpu_sig); -extern const struct microcode_ops *microcode_ops; =20 #endif /* ASM_X86__MICROCODE_H */ --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Thu Mar 28 21:21:19 2024 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=1584631667; cv=none; d=zohomail.com; s=zohoarc; b=MYQhSUGrlGGTC31oU2py0Ph8w7H8eUDhPiwr8Q4mYJuSQlE70i8r5FqfaaX1nHBWbGSBVgqe6KUY6erwgrGUJTtVzVeZX91EAVBuh91CmWmtuTy4FGBecNBJmDKUAUUr6eB3BrJCl+RH26SnBtBlF7kEIXkXtXl6b2P77YSUh2s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584631667; 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=vcbiyj6w/AK8J6YK5EglTgv54xS/EoCfZdTEGCzLe5g=; b=L46BGHSYvz5mGjVbU1WYlu+rAmEIz0gArf/m2mbTBqwT0sLVBvTWk6KUNm7EcreT0zJBwyw9JKVJfbo3jjAuZkZWB4vKx/IF4J7RsF5vJGqbAOtqF8G4qR1INnrfcaLfhGfN5wWHToTehTdA4SGv/q883KL/hn6od3OMjvrUHoY= 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 1584631667861349.22476122680825; Thu, 19 Mar 2020 08:27:47 -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 1jEx4A-0003NP-0j; Thu, 19 Mar 2020 15:26:38 +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 1jEx48-0003NC-MW for xen-devel@lists.xenproject.org; Thu, 19 Mar 2020 15:26:36 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 047937b8-69f6-11ea-bc31-12813bfff9fa; Thu, 19 Mar 2020 15:26:35 +0000 (UTC) X-Inumbo-ID: 047937b8-69f6-11ea-bc31-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1584631595; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=IFqmDK+pyXIICW/cF9wL4yB/wqgNWJh5iNiQY3eawJ8=; b=aXnJFMVM6pKd6mDUi4bWMnDwD/Ou6VChUA3UrZB4e8AmSxTisVna3n2M ToVtHmwWbObZC/3v8sHF2cgFEI7Lg7mfMbDZeh+vR4kKTlStRBqKHd6L+ mApuBoLUME9qVOc+R4DdVNgiG3bl15r0RaBw4Ohp0z2xSPEsQAcUurtwf 0=; Authentication-Results: esa4.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 (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.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=esa4.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 (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: ctM7E/On9qb2FZo0C1gAA7ZhQ9ScNjOKTT4EYGkXnXHJFQSNqzz8jBj6dsQAYyrtT0hgDMI0KN 67EiV5QT2yoy70OPSx5fElAF6PrfpnZL0LP8SprkIB04ITJgiDTqZXK39y5ElXAP0ouVxyRosR jO66oXkWFPAghvgJ+5ivrO91uq+xu/HjZQ+2hMOjSVlBBZa6+jds2soseZcPUMnzsoxn9cbDZc kiS03oeDKUk4elvr/fPTmejkZZ7yAIjYiHM1lizhcnNmgU7n98M6/vtrwMhltavtrfXi6yP7xb OEc= X-SBRS: 2.7 X-MesageID: 14927763 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.70,572,1574139600"; d="scan'208";a="14927763" From: Andrew Cooper To: Xen-devel Date: Thu, 19 Mar 2020 15:26:19 +0000 Message-ID: <20200319152622.31758-4-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200319152622.31758-1-andrew.cooper3@citrix.com> References: <20200319152622.31758-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 3/6] x86/ucode: Move interface from processor.h to microcode.h 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?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) This reduces the complexity of processor.h, particularly the need to include public/xen.h. Substitute processor.h includes for microcode.h in some sources, and add microcode.h includes in others. Only 4 of the function declarations are actually called externally. Move t= he avendor init declarations to private.h 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/acpi/power.c | 1 + xen/arch/x86/cpu/microcode/private.h | 3 +++ xen/arch/x86/efi/efi-boot.h | 2 +- xen/arch/x86/platform_hypercall.c | 1 + xen/arch/x86/setup.c | 1 + xen/arch/x86/smpboot.c | 1 + xen/arch/x86/spec_ctrl.c | 1 - xen/include/asm-x86/microcode.h | 8 ++++++++ xen/include/asm-x86/processor.h | 8 -------- 9 files changed, 16 insertions(+), 10 deletions(-) diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c index b5df00b22c..e3d6eefe65 100644 --- a/xen/arch/x86/acpi/power.c +++ b/xen/arch/x86/acpi/power.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include =20 diff --git a/xen/arch/x86/cpu/microcode/private.h b/xen/arch/x86/cpu/microc= ode/private.h index 2e3be79eaf..459b6a4c54 100644 --- a/xen/arch/x86/cpu/microcode/private.h +++ b/xen/arch/x86/cpu/microcode/private.h @@ -34,4 +34,7 @@ struct microcode_ops { =20 extern const struct microcode_ops *microcode_ops; =20 +int microcode_init_intel(void); +int microcode_init_amd(void); + #endif /* ASM_X86_MICROCODE_PRIVATE_H */ diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h index bf7b0a61dc..7bfb96875c 100644 --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h @@ -6,8 +6,8 @@ #include #include #include +#include #include -#include =20 static struct file __initdata ucode; static multiboot_info_t __initdata mbi =3D { diff --git a/xen/arch/x86/platform_hypercall.c b/xen/arch/x86/platform_hype= rcall.c index 80efb84328..ee2efdd875 100644 --- a/xen/arch/x86/platform_hypercall.c +++ b/xen/arch/x86/platform_hypercall.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index c87040c890..885919d5c3 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -52,6 +52,7 @@ #include #include #include +#include =20 /* opt_nosmp: If true, secondary processors are ignored. */ static bool __initdata opt_nosmp; diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index 0e54bd14f3..09264b02d1 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c index aed2c6613a..c5d8e587a8 100644 --- a/xen/arch/x86/spec_ctrl.c +++ b/xen/arch/x86/spec_ctrl.c @@ -24,7 +24,6 @@ =20 #include #include -#include #include #include #include diff --git a/xen/include/asm-x86/microcode.h b/xen/include/asm-x86/microcod= e.h index 9b6ff7db08..89b9aaa02d 100644 --- a/xen/include/asm-x86/microcode.h +++ b/xen/include/asm-x86/microcode.h @@ -1,8 +1,11 @@ #ifndef ASM_X86__MICROCODE_H #define ASM_X86__MICROCODE_H =20 +#include #include =20 +#include + struct cpu_signature { unsigned int sig; unsigned int pf; @@ -11,4 +14,9 @@ struct cpu_signature { =20 DECLARE_PER_CPU(struct cpu_signature, cpu_sig); =20 +void microcode_set_module(unsigned int idx); +int microcode_update(XEN_GUEST_HANDLE_PARAM(const_void), unsigned long len= ); +int early_microcode_init(void); +int microcode_update_one(bool start_update); + #endif /* ASM_X86__MICROCODE_H */ diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processo= r.h index 895c7032b9..fe231c5072 100644 --- a/xen/include/asm-x86/processor.h +++ b/xen/include/asm-x86/processor.h @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include @@ -579,13 +578,6 @@ void cpuid_hypervisor_leaves(const struct vcpu *v, uin= t32_t leaf, int guest_rdmsr_xen(const struct vcpu *v, uint32_t idx, uint64_t *val); int guest_wrmsr_xen(struct vcpu *v, uint32_t idx, uint64_t val); =20 -void microcode_set_module(unsigned int); -int microcode_update(XEN_GUEST_HANDLE_PARAM(const_void), unsigned long len= ); -int early_microcode_init(void); -int microcode_update_one(bool start_update); -int microcode_init_intel(void); -int microcode_init_amd(void); - static inline uint8_t get_cpu_family(uint32_t raw, uint8_t *model, uint8_t *stepping) { --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Thu Mar 28 21:21:19 2024 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=1584631695; cv=none; d=zohomail.com; s=zohoarc; b=VG9zYEh35BryfXS0qqI6lgjiQe8j69N6PyV7qwiyCGw87sDpB2IJrXDWtcT3s42rAq8lA+u07SJxpfyuJSg//X+jLzbPNFu8zA5wiaKUOnDzJI6OG6HD+SOybhQDv9VMUGW0htSR1v95IaMqXkUwlzGwpnbpfGYlPFRfqGYJmCk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584631695; 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=uP3XRKFjLe6kix47ofmthmsa6njqUsu/myrpBnNCRG4=; b=GaEgl2b/BgzNLwzBMRbk8abRsTsULCcBaDzXtbdS9RNKkqGz6mSe2XqtvaYyHVgj0Zlaluv1m/11rhkw4vILbOHLaXKYC8CZCjKKWbJ9v2gg0/kL5gt5nly007+jVQAhghna0irSaT1XpBV8G2BRvhkvwrsHNPv9nk/8zqccxPU= 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 1584631695311938.191896654978; Thu, 19 Mar 2020 08:28:15 -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 1jEx4Y-0003Xl-CO; Thu, 19 Mar 2020 15:27:02 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jEx4X-0003XG-2H for xen-devel@lists.xenproject.org; Thu, 19 Mar 2020 15:27:01 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 13628a9a-69f6-11ea-a6c1-bc764e2007e4; Thu, 19 Mar 2020 15:27:00 +0000 (UTC) X-Inumbo-ID: 13628a9a-69f6-11ea-a6c1-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1584631620; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=t+0wL690QLRI2X2xlJ9FWS9trSb3uXbLf7OPjapmSoI=; b=TwLs7+qy9PZwzy73foId84CP39XcvGQ0Eiz228me5ZVlT88mvUGX7dS9 xMEbYOkGDQNz1QqMc+pVNiWwZ50tVn/GXYf0nOFsoWHYDn/LjdllzDg9L kzqXBUNMaEQGj8YEP9WRi1sG+nXaPfIaJyufYJfDtGz0/Rd6bCCIwQdM6 8=; 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: ZoQGFsLuSCPaNyAAiPkRhKvoCCMw54cHtgUr6hRBr6bj4lX36NjoFiE+i5Fb9FbuzGtXZndonk z3kShYFu1IXYo1lNM1IKBvH3rHQRf0I75+X/7RxghZBEgFLvwrvU9z4+xKmdiCVbPxd9h7X5i+ 3yTPjDHAuNogy3b5RwQhMOaGKOeuRwKQR0Hm/g4NqQpGcGhvqTCUVbE6XQ2TaqQ+PvvXRsGbDY RT+Iymb2o1xgBgh+dNZdJhM+kii/TCPcVbaAz7lmf4DyE+zkKxdtBZYtFDBb1GnK2Ew9z7i3E0 /Io= X-SBRS: 2.7 X-MesageID: 14703418 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.70,572,1574139600"; d="scan'208";a="14703418" From: Andrew Cooper To: Xen-devel Date: Thu, 19 Mar 2020 15:26:20 +0000 Message-ID: <20200319152622.31758-5-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200319152622.31758-1-andrew.cooper3@citrix.com> References: <20200319152622.31758-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 4/6] x86/ucode: Rationalise startup and family/model checks 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?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Drop microcode_init_{intel,amd}(), export {intel,amd}_ucode_ops, and use a switch statement in early_microcode_init() rather than probing each vendor = in turn. This allows the microcode_ops pointer to become local to core.c. As there are no external users of microcode_ops, there is no need for collect_cpu_info() to implement sanity checks. Move applicable checks to early_microcode_init() so they are performed once, rather than repeatedly. Items to note: * The AMD ucode driver does have an upper familiy limit of 0x17, as a side effect of the logic in verify_patch_size() which does need updating for each new model. * The Intel logic guarding the read of MSR_PLATFORM_ID is contrary to the SDM, which states that the MSR has been architectural since the Pentium Pro (06-01-xx), and lists no family/model restrictions in the pseudocode for microcode loading. Either way, Xen's 64bit-only nature already makes this check redundant. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 The MSR_PLATFORM_ID guard was inherited from Linux, and has existed there since the code's introduction. My best guess is that the MSR list in the S= DM got altered at some point between then and now. --- xen/arch/x86/cpu/microcode/amd.c | 21 ++------------------ xen/arch/x86/cpu/microcode/core.c | 37 ++++++++++++++++++++++----------= ---- xen/arch/x86/cpu/microcode/intel.c | 26 +++---------------------- xen/arch/x86/cpu/microcode/private.h | 5 +---- 4 files changed, 29 insertions(+), 60 deletions(-) diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/= amd.c index 9028889813..768fbcf322 100644 --- a/xen/arch/x86/cpu/microcode/amd.c +++ b/xen/arch/x86/cpu/microcode/amd.c @@ -76,22 +76,12 @@ struct mpbhdr { /* See comment in start_update() for cases when this routine fails */ static int collect_cpu_info(struct cpu_signature *csig) { - unsigned int cpu =3D smp_processor_id(); - struct cpuinfo_x86 *c =3D &cpu_data[cpu]; - memset(csig, 0, sizeof(*csig)); =20 - if ( (c->x86_vendor !=3D X86_VENDOR_AMD) || (c->x86 < 0x10) ) - { - printk(KERN_ERR "microcode: CPU%d not a capable AMD processor\n", - cpu); - return -EINVAL; - } - rdmsrl(MSR_AMD_PATCHLEVEL, csig->rev); =20 pr_debug("microcode: CPU%d collect_cpu_info: patch_id=3D%#x\n", - cpu, csig->rev); + smp_processor_id(), csig->rev); =20 return 0; } @@ -601,7 +591,7 @@ static int start_update(void) } #endif =20 -static const struct microcode_ops microcode_amd_ops =3D { +const struct microcode_ops amd_ucode_ops =3D { .cpu_request_microcode =3D cpu_request_microcode, .collect_cpu_info =3D collect_cpu_info, .apply_microcode =3D apply_microcode, @@ -613,10 +603,3 @@ static const struct microcode_ops microcode_amd_ops = =3D { .compare_patch =3D compare_patch, .match_cpu =3D match_cpu, }; - -int __init microcode_init_amd(void) -{ - if ( boot_cpu_data.x86_vendor =3D=3D X86_VENDOR_AMD ) - microcode_ops =3D µcode_amd_ops; - return 0; -} diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode= /core.c index ac5da6b2fe..61e4b9b7ab 100644 --- a/xen/arch/x86/cpu/microcode/core.c +++ b/xen/arch/x86/cpu/microcode/core.c @@ -210,7 +210,7 @@ void __init microcode_grab_module( microcode_scan_module(module_map, mbi); } =20 -const struct microcode_ops *microcode_ops; +static const struct microcode_ops __read_mostly *microcode_ops; =20 static DEFINE_SPINLOCK(microcode_mutex); =20 @@ -798,23 +798,32 @@ static int __init early_microcode_update_cpu(void) =20 int __init early_microcode_init(void) { - int rc; - - rc =3D microcode_init_intel(); - if ( rc ) - return rc; - - rc =3D microcode_init_amd(); - if ( rc ) - return rc; + const struct cpuinfo_x86 *c =3D &boot_cpu_data; + int rc =3D 0; =20 - if ( microcode_ops ) + switch ( c->x86_vendor ) { - microcode_ops->collect_cpu_info(&this_cpu(cpu_sig)); + case X86_VENDOR_AMD: + if ( c->x86 >=3D 0x10 && c->x86 <=3D 0x17 ) + microcode_ops =3D &amd_ucode_ops; + break; + + case X86_VENDOR_INTEL: + if ( c->x86 >=3D 6 ) + microcode_ops =3D &intel_ucode_ops; + break; + } =20 - if ( ucode_mod.mod_end || ucode_blob.size ) - rc =3D early_microcode_update_cpu(); + if ( !microcode_ops ) + { + printk(XENLOG_WARNING "Microcode loading not available\n"); + return -ENODEV; } =20 + microcode_ops->collect_cpu_info(&this_cpu(cpu_sig)); + + if ( ucode_mod.mod_end || ucode_blob.size ) + rc =3D early_microcode_update_cpu(); + return rc; } diff --git a/xen/arch/x86/cpu/microcode/intel.c b/xen/arch/x86/cpu/microcod= e/intel.c index 90fb006c94..48544e8d6d 100644 --- a/xen/arch/x86/cpu/microcode/intel.c +++ b/xen/arch/x86/cpu/microcode/intel.c @@ -93,27 +93,14 @@ struct extended_sigtable { =20 static int collect_cpu_info(struct cpu_signature *csig) { - unsigned int cpu_num =3D smp_processor_id(); - struct cpuinfo_x86 *c =3D &cpu_data[cpu_num]; uint64_t msr_content; =20 memset(csig, 0, sizeof(*csig)); =20 - if ( (c->x86_vendor !=3D X86_VENDOR_INTEL) || (c->x86 < 6) ) - { - printk(KERN_ERR "microcode: CPU%d not a capable Intel " - "processor\n", cpu_num); - return -1; - } - csig->sig =3D cpuid_eax(0x00000001); =20 - if ( (c->x86_model >=3D 5) || (c->x86 > 6) ) - { - /* get processor flags from MSR 0x17 */ - rdmsrl(MSR_IA32_PLATFORM_ID, msr_content); - csig->pf =3D 1 << ((msr_content >> 50) & 7); - } + rdmsrl(MSR_IA32_PLATFORM_ID, msr_content); + csig->pf =3D 1 << ((msr_content >> 50) & 7); =20 wrmsrl(MSR_IA32_UCODE_REV, 0x0ULL); /* As documented in the SDM: Do a CPUID 1 here */ @@ -405,7 +392,7 @@ static struct microcode_patch *cpu_request_microcode(co= nst void *buf, return patch; } =20 -static const struct microcode_ops microcode_intel_ops =3D { +const struct microcode_ops intel_ucode_ops =3D { .cpu_request_microcode =3D cpu_request_microcode, .collect_cpu_info =3D collect_cpu_info, .apply_microcode =3D apply_microcode, @@ -413,10 +400,3 @@ static const struct microcode_ops microcode_intel_ops = =3D { .compare_patch =3D compare_patch, .match_cpu =3D match_cpu, }; - -int __init microcode_init_intel(void) -{ - if ( boot_cpu_data.x86_vendor =3D=3D X86_VENDOR_INTEL ) - microcode_ops =3D µcode_intel_ops; - return 0; -} diff --git a/xen/arch/x86/cpu/microcode/private.h b/xen/arch/x86/cpu/microc= ode/private.h index 459b6a4c54..c32ddc8d19 100644 --- a/xen/arch/x86/cpu/microcode/private.h +++ b/xen/arch/x86/cpu/microcode/private.h @@ -32,9 +32,6 @@ struct microcode_ops { const struct microcode_patch *new, const struct microcode_patch *o= ld); }; =20 -extern const struct microcode_ops *microcode_ops; - -int microcode_init_intel(void); -int microcode_init_amd(void); +extern const struct microcode_ops amd_ucode_ops, intel_ucode_ops; =20 #endif /* ASM_X86_MICROCODE_PRIVATE_H */ --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Thu Mar 28 21:21:19 2024 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=1584631661; cv=none; d=zohomail.com; s=zohoarc; b=Xd4saWWlEVqkngBzDL6BFT/Y/mwaRjBWzjQ9Rl2U+cggNRyO6eMhNVosfV/DKvfiihHxq5kxDzOGEGwvoiHN5h/sW/4CSKjkz37zZKzaoVqpf3y9TwpEicNsagnSHTPqDYGoqBwwvM0a1J07Bz038psyPXhXItDVR7f0p+wV1qY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584631661; 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=HRx+S2aSexDWHGq1/+N9vgLxd12Gz9ta3H6KM+xytbg=; b=AetnFJn+ffccd6r+48KLVWgAVTojGs2t9PBRzyn3iVF7k5FJ4oOZjFfnKDOx0aZPc/QzaV/O/fmOYL2bGBddj+P98z/cAVlgoZGYw9jrWtqGjaIimg7I7iVRzQfkYpQ4BUfRNl1UrA95dDMJ6NRYFqXwrzucg/1jiNChKJHpPis= 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 1584631661280754.5411333380655; Thu, 19 Mar 2020 08:27:41 -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 1jEx4E-0003PP-Lc; Thu, 19 Mar 2020 15:26:42 +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 1jEx4D-0003Or-H7 for xen-devel@lists.xenproject.org; Thu, 19 Mar 2020 15:26:41 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 0590e394-69f6-11ea-bc31-12813bfff9fa; Thu, 19 Mar 2020 15:26:36 +0000 (UTC) X-Inumbo-ID: 0590e394-69f6-11ea-bc31-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1584631596; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Gx3n03GdIkTIW+JLb46tieM2d3B+HVI3//jmwt8huEU=; b=g9GAj5sgOSyxA3FaXc9OQX8sdESvUycd8UxnldHOmg1nIFKH5fW2I8qz IZpNcsmoNiFciKfZBzomm+aEjAIqjXljAEzP7sZUpYKUItfBlw39MuStI xVxgPOzMnT2WXRNUOyVMtYb71cB6bq/bk8ebbzVRPhv6rFfTG480EmTN+ g=; Authentication-Results: esa4.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 (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.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=esa4.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 (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: U2+/gQ1FI8o0WpXteChVjPVyMPNkMDC+w5luN/t7292xVlIzM9iD+/HK4EpxAxK2vD02J9GH0V w0td7tuEJgYW6NK9HZBztQfUN9O0qVDxFXqZdQQThoAq3UadDfAlg5AYrijdQ0SORui0ZMvAYo CpMhVYz/hfQGSlBSfCC20hvXwQjcHDSMfwYDprDPgZb3cI9K26cgkx+DdDapu3k4ZbvhYyMbJb fXSXBbhmjZjKHuQNH1eZPtIUY3A6ZegnvU31EywEBubFlOf9Dtt1nalMGhLCQ6WBGCww50Dw0B Pbs= X-SBRS: 2.7 X-MesageID: 14927764 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.70,572,1574139600"; d="scan'208";a="14927764" From: Andrew Cooper To: Xen-devel Date: Thu, 19 Mar 2020 15:26:21 +0000 Message-ID: <20200319152622.31758-6-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200319152622.31758-1-andrew.cooper3@citrix.com> References: <20200319152622.31758-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 5/6] x86/ucode: Alter ops->free_patch() to free the entire patch 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?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The data layout for struct microcode_patch is extremely poor, and unnecessarily complicated. Almost all of it is opaque to core.c, with the exception of free_patch(). Move the responsibility for freeing the patch into the free_patch() hook, which will allow each driver to do a better job. Take the opportunity to m= ake the hooks idempotent. No practical change in behaviour. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 --- xen/arch/x86/cpu/microcode/amd.c | 17 ++++++++++++----- xen/arch/x86/cpu/microcode/core.c | 3 +-- xen/arch/x86/cpu/microcode/intel.c | 8 ++++++-- xen/arch/x86/cpu/microcode/private.h | 2 +- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/= amd.c index 768fbcf322..77e582c8e1 100644 --- a/xen/arch/x86/cpu/microcode/amd.c +++ b/xen/arch/x86/cpu/microcode/amd.c @@ -180,10 +180,8 @@ static bool match_cpu(const struct microcode_patch *pa= tch) return patch && (microcode_fits(patch->mc_amd) =3D=3D NEW_UCODE); } =20 -static void free_patch(void *mc) +static void free_mc_amd(struct microcode_amd *mc_amd) { - struct microcode_amd *mc_amd =3D mc; - if ( mc_amd ) { xfree(mc_amd->equiv_cpu_table); @@ -192,6 +190,15 @@ static void free_patch(void *mc) } } =20 +static void free_patch(struct microcode_patch *patch) +{ + if ( patch ) + { + free_mc_amd(patch->mc_amd); + xfree(patch); + } +} + static enum microcode_match_result compare_header( const struct microcode_header_amd *new_header, const struct microcode_header_amd *old_header) @@ -564,12 +571,12 @@ static struct microcode_patch *cpu_request_microcode(= const void *buf, patch->mc_amd =3D mc_amd; else { - free_patch(mc_amd); + free_mc_amd(mc_amd); error =3D -ENOMEM; } } else - free_patch(mc_amd); + free_mc_amd(mc_amd); =20 out: if ( error && !patch ) diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode= /core.c index 61e4b9b7ab..30017e3e0f 100644 --- a/xen/arch/x86/cpu/microcode/core.c +++ b/xen/arch/x86/cpu/microcode/core.c @@ -245,8 +245,7 @@ static struct microcode_patch *parse_blob(const char *b= uf, size_t len) =20 static void microcode_free_patch(struct microcode_patch *microcode_patch) { - microcode_ops->free_patch(microcode_patch->mc); - xfree(microcode_patch); + microcode_ops->free_patch(microcode_patch); } =20 /* Return true if cache gets updated. Otherwise, return false */ diff --git a/xen/arch/x86/cpu/microcode/intel.c b/xen/arch/x86/cpu/microcod= e/intel.c index 48544e8d6d..0e6ba50048 100644 --- a/xen/arch/x86/cpu/microcode/intel.c +++ b/xen/arch/x86/cpu/microcode/intel.c @@ -248,9 +248,13 @@ static bool match_cpu(const struct microcode_patch *pa= tch) return microcode_update_match(&patch->mc_intel->hdr) =3D=3D NEW_UCODE; } =20 -static void free_patch(void *mc) +static void free_patch(struct microcode_patch *patch) { - xfree(mc); + if ( patch ) + { + xfree(patch->mc_intel); + xfree(patch); + } } =20 static enum microcode_match_result compare_patch( diff --git a/xen/arch/x86/cpu/microcode/private.h b/xen/arch/x86/cpu/microc= ode/private.h index c32ddc8d19..897d32a8e9 100644 --- a/xen/arch/x86/cpu/microcode/private.h +++ b/xen/arch/x86/cpu/microcode/private.h @@ -26,7 +26,7 @@ struct microcode_ops { int (*apply_microcode)(const struct microcode_patch *patch); int (*start_update)(void); void (*end_update_percpu)(void); - void (*free_patch)(void *mc); + void (*free_patch)(struct microcode_patch *patch); bool (*match_cpu)(const struct microcode_patch *patch); enum microcode_match_result (*compare_patch)( const struct microcode_patch *new, const struct microcode_patch *o= ld); --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Thu Mar 28 21:21:19 2024 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=1584631688; cv=none; d=zohomail.com; s=zohoarc; b=TqfTnkib1A1gWloxWQ9f+V/UoHeRVN4J2SChJ6W5b0X2iY7NnAryVztUPqOMveGTgwvdsJgkJC5D5ru9ORksFILXmnm0MDrjoQX9FXlLOOSTeN6ouuz1H8CkURmKh0xt6NYNuvLB/wCzazXkQf5DeD9N4yeYxHnkRklrB5zoZB0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584631688; 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=Fe6yvB7OOj6QpxGqG/rVDWeylpNfKua69XxgzJSHRCA=; b=RMJYFsS3JsjXiA/6J7ufJKbA9TjTFMeulnfHYnM4mlpAVJ9iQfrPop3ML6cZe6sW3BwsvZCJ+H8UfwxPq9igyQ1YNDM4u4IJCsmarpmfqweobok0HZqzGxHRYJyNdf8Po9X3BYjzKxlcS7V0oNdrdMREqaMM3OxddKMvOPqupOo= 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 1584631688711188.34077175586788; Thu, 19 Mar 2020 08:28:08 -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 1jEx4d-0003ai-QJ; Thu, 19 Mar 2020 15:27:07 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jEx4c-0003Zx-1w for xen-devel@lists.xenproject.org; Thu, 19 Mar 2020 15:27:06 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 1432ba08-69f6-11ea-a6c1-bc764e2007e4; Thu, 19 Mar 2020 15:27:01 +0000 (UTC) X-Inumbo-ID: 1432ba08-69f6-11ea-a6c1-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1584631621; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UTwDfuoEAGglX9Z3bbi6oCiNVKIROQ9af6EpmvNbZDI=; b=EKwa5UOB5KFR30xlnHmRKTRvEuLIL9WcxMiztEK+vpsPSotTM0OZ7AyT QSdNc0IZ+NLql2vvF9yaKsyqy3FueCRssM8d37UJHebqMEhJY7KtjRYp1 jSf3RQdx0VQjbrfS3CGy/J+6n9o60NAIe5eOnLgk/Bi3NJo/W0U+vfMx1 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: JwXHt9kz0O/F1rJ4WaQmAmRF5/3GDjsvs8nFEURLyCQafLiXAi+LE9MmkKjmM6otd/d1jEICL6 b5gXgPt++JMKrSZmYupX685KcHpy9ZLPYJczxALHTYYanBG5PIWIFDj6RtuTfY7qPmzn/7OYDO 905/5xvOZKJIZLWvkgucbyUvxL4Ds0DGB/2vJctPnwWyk34Xv8K0QiMlIaPFF6xsJiof0WVmaX K9Og3qgJ0SuhtrfT0pQn1XzNV1S5qHwb/fKqSkafNr4jRXmG2vdlfcN/HCLHyIpdl/p57KYnx5 pik= X-SBRS: 2.7 X-MesageID: 14703419 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.70,572,1574139600"; d="scan'208";a="14703419" From: Andrew Cooper To: Xen-devel Date: Thu, 19 Mar 2020 15:26:22 +0000 Message-ID: <20200319152622.31758-7-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200319152622.31758-1-andrew.cooper3@citrix.com> References: <20200319152622.31758-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 6/6] x86/ucode: Make struct microcode_patch opaque 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?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) This will enforce proper interface discipline in core.c, and allow each dri= ver to choose its own (better) data layout. No functional change. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 --- xen/arch/x86/cpu/microcode/amd.c | 4 ++++ xen/arch/x86/cpu/microcode/intel.c | 4 ++++ xen/arch/x86/cpu/microcode/private.h | 8 +------- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/= amd.c index 77e582c8e1..99e2449eee 100644 --- a/xen/arch/x86/cpu/microcode/amd.c +++ b/xen/arch/x86/cpu/microcode/amd.c @@ -73,6 +73,10 @@ struct mpbhdr { uint8_t data[]; }; =20 +struct microcode_patch { + struct microcode_amd *mc_amd; +}; + /* See comment in start_update() for cases when this routine fails */ static int collect_cpu_info(struct cpu_signature *csig) { diff --git a/xen/arch/x86/cpu/microcode/intel.c b/xen/arch/x86/cpu/microcod= e/intel.c index 0e6ba50048..5e9c2a9c7f 100644 --- a/xen/arch/x86/cpu/microcode/intel.c +++ b/xen/arch/x86/cpu/microcode/intel.c @@ -71,6 +71,10 @@ struct extended_sigtable { struct extended_signature sigs[0]; }; =20 +struct microcode_patch { + struct microcode_intel *mc_intel; +}; + #define DEFAULT_UCODE_DATASIZE (2000) #define MC_HEADER_SIZE (sizeof(struct microcode_header_intel)) #define DEFAULT_UCODE_TOTALSIZE (DEFAULT_UCODE_DATASIZE + MC_HEADER_SIZE) diff --git a/xen/arch/x86/cpu/microcode/private.h b/xen/arch/x86/cpu/microc= ode/private.h index 897d32a8e9..e64168a502 100644 --- a/xen/arch/x86/cpu/microcode/private.h +++ b/xen/arch/x86/cpu/microcode/private.h @@ -11,13 +11,7 @@ enum microcode_match_result { MIS_UCODE, /* signature mismatched */ }; =20 -struct microcode_patch { - union { - struct microcode_intel *mc_intel; - struct microcode_amd *mc_amd; - void *mc; - }; -}; +struct microcode_patch; /* Opaque */ =20 struct microcode_ops { struct microcode_patch *(*cpu_request_microcode)(const void *buf, --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel