Mailing List Archive

[xen staging] x86/Kconfig: Introduce CONFIG_{AMD,INTEL} and conditionalise ucode
commit 0e7ea8ca5fc9bce9248414f6aaf2dc861abd45d9
Author: Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Oct 25 14:18:15 2023 +0100
Commit: Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Apr 10 18:41:28 2024 +0100

x86/Kconfig: Introduce CONFIG_{AMD,INTEL} and conditionalise ucode

We eventually want to be able to build a stripped down Xen for a single
platform. Make a start with CONFIG_{AMD,INTEL} (hidden behind EXPERT, but
available to randconfig), and adjust the microcode logic.

No practical change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
xen/arch/x86/Kconfig | 2 ++
xen/arch/x86/Kconfig.cpu | 22 ++++++++++++++++++++++
xen/arch/x86/cpu/microcode/Makefile | 4 ++--
xen/arch/x86/cpu/microcode/private.h | 9 +++++++++
4 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index d6f3128588..2b6248774d 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -51,6 +51,8 @@ config HAS_CC_CET_IBT

menu "Architecture Features"

+source "arch/x86/Kconfig.cpu"
+
source "arch/Kconfig"

config PV
diff --git a/xen/arch/x86/Kconfig.cpu b/xen/arch/x86/Kconfig.cpu
new file mode 100644
index 0000000000..5fb18db1aa
--- /dev/null
+++ b/xen/arch/x86/Kconfig.cpu
@@ -0,0 +1,22 @@
+menu "Supported CPU vendors"
+ visible if EXPERT
+
+config AMD
+ bool "Support AMD CPUs"
+ default y
+ help
+ Detection, tunings and quirks for AMD platforms.
+
+ May be turned off in builds targetting other vendors. Otherwise,
+ must be enabled for Xen to work suitably on AMD platforms.
+
+config INTEL
+ bool "Support Intel CPUs"
+ default y
+ help
+ Detection, tunings and quirks for Intel platforms.
+
+ May be turned off in builds targetting other vendors. Otherwise,
+ must be enabled for Xen to work suitably on Intel platforms.
+
+endmenu
diff --git a/xen/arch/x86/cpu/microcode/Makefile b/xen/arch/x86/cpu/microcode/Makefile
index aae235245b..30d600544f 100644
--- a/xen/arch/x86/cpu/microcode/Makefile
+++ b/xen/arch/x86/cpu/microcode/Makefile
@@ -1,3 +1,3 @@
-obj-y += amd.o
+obj-$(CONFIG_AMD) += amd.o
obj-y += core.o
-obj-y += intel.o
+obj-$(CONFIG_INTEL) += intel.o
diff --git a/xen/arch/x86/cpu/microcode/private.h b/xen/arch/x86/cpu/microcode/private.h
index b58611e908..da556fe506 100644
--- a/xen/arch/x86/cpu/microcode/private.h
+++ b/xen/arch/x86/cpu/microcode/private.h
@@ -70,7 +70,16 @@ struct microcode_ops {
* support available) and (not) ops->apply_microcode (i.e. read only).
* Otherwise, all hooks must be filled in.
*/
+#ifdef CONFIG_AMD
void ucode_probe_amd(struct microcode_ops *ops);
+#else
+static inline void ucode_probe_amd(struct microcode_ops *ops) {}
+#endif
+
+#ifdef CONFIG_INTEL
void ucode_probe_intel(struct microcode_ops *ops);
+#else
+static inline void ucode_probe_intel(struct microcode_ops *ops) {}
+#endif

#endif /* ASM_X86_MICROCODE_PRIVATE_H */
--
generated by git-patchbot for /home/xen/git/xen.git#staging