From nobody Mon Feb 9 16:12:57 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=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