From nobody Fri Mar 29 14:24:17 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=1584565635; cv=none; d=zohomail.com; s=zohoarc; b=BkvlhB5qrMfMpPRTVGe0arKsaMpCNypILEnuUQxc6W6ylqT0u4sN5pT7AgKiUR7W/JCOEYnKV3B1ITptadl0loS4oFdWIETKOjI2ul0kuQM7azbTdIEYAeyrKRIZtqetFO7adG1Fv8YdUuxqguR7gGXb9bAtUYUT/BmtZ65Q09U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584565635; 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=ydtNZZP0Zm3O98c1WClmQftdud036rxJ0kM193tok2M=; b=Rp1GKrAKBKGMm2pzzmtQHAEAqkl3FYU7geMZxq+KRnkJPTvZJ1mo92XQp9CHVjXKuzihcpexNj1IDfx0j1SxlNSihKC0n5p2wHKpDLEJvQeEaFxI2lsd1cgyQCZn2LaK1USf43MM6LafcI7kkgnzmSsr2DmoIqPNKqkqtJy0l00= 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 158456563526952.94026766153797; Wed, 18 Mar 2020 14:07: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 1jEfsq-0007Y5-8D; Wed, 18 Mar 2020 21:05:48 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jEfsp-0007Y0-Fk for xen-devel@lists.xenproject.org; Wed, 18 Mar 2020 21:05:47 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 3c3bf270-695c-11ea-b34e-bc764e2007e4; Wed, 18 Mar 2020 21:05:46 +0000 (UTC) X-Inumbo-ID: 3c3bf270-695c-11ea-b34e-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1584565546; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=NK67VgtZBL9Iw9OOeVuXZ8sHCZAlIIKa0NVNNjny/bU=; b=Pd71npqPg/XhX/klhAecWIGCk6IAf08KFPr8/JRBrTIXO5fFgiLkbIoB blC4bW5GXUZkENm3ZFQG8AkVMb09pJlqo4++P6Sg9PR/Ri5l9bpODlWPG Qf5cab1AbwmM3gTzsXK5ltY/C17QEg00Q1LwIRT+RU4iziH0uIATRjnCg g=; 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: jtQtRzbqNLKuYtYUcnCZISLhW1vh54c7jvTpbahOLqv9/36yOfF5kHI3zjD6mXFX1dZr3DUi1G qUJC7XTlufMIz6pWs+K1XrCTv12XKvKKRm05ZoH+/7ZGyAKdRL1VciYhCPP9McVVhJ4t5qZUcV wldz8PM3Fjs4nU8G8b0GRrk1DOXYeGC7BO8+4dc512EUH2K3Vo5+5Gh69UCbSx1+YlS/N3CU1W BBy9m+72aY0jkv9pHrjczrUjhgxcHO0FHVv4JBj8DXJBNn3XYkjiqgQBkiBQxJNtW2jPfZ0FtD wuE= X-SBRS: 2.7 X-MesageID: 14651278 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,569,1574139600"; d="scan'208";a="14651278" From: Andrew Cooper To: Xen-devel Date: Wed, 18 Mar 2020 21:05:40 +0000 Message-ID: <20200318210540.5602-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] xen/x86: 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 | 4 +-- xen/arch/x86/microcode/Makefile | 3 ++ xen/arch/x86/{microcode_amd.c =3D> microcode/amd.c} | 12 ++++---- xen/arch/x86/{microcode.c =3D> microcode/core.c} | 15 +++------- .../x86/{microcode_intel.c =3D> microcode/intel.c} | 9 ++---- .../microcode.h =3D> arch/x86/microcode/private.h} | 19 ++++--------- xen/include/asm-x86/microcode.h | 32 ------------------= ---- 7 files changed, 22 insertions(+), 72 deletions(-) create mode 100644 xen/arch/x86/microcode/Makefile rename xen/arch/x86/{microcode_amd.c =3D> microcode/amd.c} (99%) rename xen/arch/x86/{microcode.c =3D> microcode/core.c} (99%) rename xen/arch/x86/{microcode_intel.c =3D> microcode/intel.c} (98%) copy xen/{include/asm-x86/microcode.h =3D> arch/x86/microcode/private.h} (= 79%) diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index ed709e2373..fa87520c66 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -43,9 +43,7 @@ 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 microcode/ 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/microcode/Makefile b/xen/arch/x86/microcode/Makef= ile new file mode 100644 index 0000000000..aae235245b --- /dev/null +++ b/xen/arch/x86/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/microcode/amd.c similarity index 99% rename from xen/arch/x86/microcode_amd.c rename to xen/arch/x86/microcode/amd.c index bc7459416c..9028889813 100644 --- a/xen/arch/x86/microcode_amd.c +++ b/xen/arch/x86/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/microcode/core.c similarity index 99% rename from xen/arch/x86/microcode.c rename to xen/arch/x86/microcode/core.c index 6907b312cf..e99f4ab06c 100644 --- a/xen/arch/x86/microcode.c +++ b/xen/arch/x86/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/microcode/intel.c similarity index 98% rename from xen/arch/x86/microcode_intel.c rename to xen/arch/x86/microcode/intel.c index 91b7d473f7..90fb006c94 100644 --- a/xen/arch/x86/microcode_intel.c +++ b/xen/arch/x86/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/microcode/priva= te.h similarity index 79% copy from xen/include/asm-x86/microcode.h copy to xen/arch/x86/microcode/private.h index 7d5a1f8e8a..97c7405dad 100644 --- a/xen/include/asm-x86/microcode.h +++ b/xen/arch/x86/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,15 +32,8 @@ 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 void microcode_free_patch(struct microcode_patch *patch); =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 7d5a1f8e8a..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,8 +10,5 @@ struct cpu_signature { }; =20 DECLARE_PER_CPU(struct cpu_signature, cpu_sig); -extern const struct microcode_ops *microcode_ops; - -void microcode_free_patch(struct microcode_patch *patch); =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