[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 03/11] xen/platform_op: Wrap around XENPF_microcode_update(2)


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jiqian Chen <Jiqian.Chen@xxxxxxx>
  • Date: Fri, 25 Jul 2025 14:15:22 +0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0RpOgsPA26B5Jaym4nHduKhV3x1BUCK6xdLduwp69R0=; b=j25/OyDi4epkf1J0ZxHNvYTKsHpNqW6PdXpxOYaU9Hq05W5DZ3cTEX6gi8bqYJ89QGszNMlqcRrOJIQ+SvKX57mhilG5ZpI4dGGbsDa+dAhC1EkRPGtjAzg06PLr5FJ+Onc7wSBq4cPWx1R5zUPZGncqdWDpfwEr9sPbe/dwSBEr4hAcx79heb49CPhHX7gTZRh5DnqslStEpAWJ/21mJiRIjSmW0DD5CUaz22sZ+7vk+5MD5m2N3S1Vr744dh8RzybWEMOVow8f1BwKAAB7lki+DjiEJZMIziZ4qwnhF8mnWVF0KbtefEsN+cuVmmndEqGxHvSxPKIH9kkxKq0Www==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KaA9i/Bn3dKoBb+m6aZdR1hl8zwKQHc7R8UZq0+VW4KPSU+JFHTebAkeWxdM6tsjLfXCR9uWaS9rVPQr8uLC+oLlan+isSTJc3LnHHQZogSCIsF3EpFGGH1xBzs31XbRj0WJd67+iZHjiEnKLppYoDpeLLSTQpFWw7nWoU8Y8n9lZ92glcqEIFrZRjnckH0uiWEgi0AKafYjQesjXHQjg3QWylJ6IALl4A/sZ5tfAPxRABwFkoiLzDqNQ1cDRSNorcaf+AyLTi6C3JK+bpeg9elx4jNidQkNS2nJiUjQO+c6iyFkUdO6hJx1M25UzHytzcsQOQ+ByvMh8xP6B9q5HQ==
  • Cc: Huang Rui <ray.huang@xxxxxxx>, Jiqian Chen <Jiqian.Chen@xxxxxxx>, "Jan Beulich" <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Fri, 25 Jul 2025 06:16:04 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

ucode_update_hcall() is only used for XENPF_microcode_update and
XENPF_microcode_update2, so wrap it and its call stack functions:
ucode_update_hcall
        ucode_update_hcall_cont
                do_microcode_update
                        control_thread_fn
                                microcode_nmi_callback
                                        is_cpu_primary
                                        primary_thread_work
                                        secondary_nmi_work
                                                wait_for_state
                                set_state
                                wait_for_condition
                                wait_cpu_callin
                                wait_cpu_callout
                        primary_thread_fn
                        secondary_thread_fn

Signed-off-by: Jiqian Chen <Jiqian.Chen@xxxxxxx>
---
cc: Jan Beulich <jbeulich@xxxxxxxx>
cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
cc: "Roger Pau Monné" <roger.pau@xxxxxxxxxx>
---
 xen/arch/x86/cpu/microcode/core.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/xen/arch/x86/cpu/microcode/core.c 
b/xen/arch/x86/cpu/microcode/core.c
index 816e9bfe40ba..ec306cea895e 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -59,6 +59,7 @@
 #define MICROCODE_UPDATE_TIMEOUT_US 1000000
 
 static bool __initdata ucode_mod_forced;
+#ifdef CONFIG_PLATFORM_OP
 static unsigned int nr_cores;
 
 /*
@@ -76,6 +77,7 @@ static enum {
     LOADING_ENTER,
     LOADING_EXIT,
 } loading_state;
+#endif /* CONFIG_PLATFORM_OP */
 
 struct patch_with_flags {
     unsigned int flags;
@@ -167,6 +169,7 @@ static struct microcode_ops __ro_after_init ucode_ops;
 static DEFINE_SPINLOCK(microcode_mutex);
 
 DEFINE_PER_CPU(struct cpu_signature, cpu_sig);
+#ifdef CONFIG_PLATFORM_OP
 /* Store error code of the work done in NMI handler */
 static DEFINE_PER_CPU(int, loading_err);
 
@@ -183,6 +186,7 @@ static struct patch_with_flags nmi_patch =
 {
     .patch  = ZERO_BLOCK_PTR,
 };
+#endif /* CONFIG_PLATFORM_OP */
 
 /*
  * Return a patch that covers current CPU. If there are multiple patches,
@@ -195,6 +199,7 @@ static struct microcode_patch *parse_blob(const char *buf, 
size_t len)
     return alternative_call(ucode_ops.cpu_request_microcode, buf, len, true);
 }
 
+#ifdef CONFIG_PLATFORM_OP
 /* Returns true if ucode should be loaded on a given cpu */
 static bool is_cpu_primary(unsigned int cpu)
 {
@@ -646,6 +651,7 @@ int ucode_update_hcall(XEN_GUEST_HANDLE(const_void) buf,
      */
     return continue_hypercall_on_cpu(0, ucode_update_hcall_cont, buffer);
 }
+#endif /* CONFIG_PLATFORM_OP */
 
 /* Load a cached update to current cpu */
 int microcode_update_one(void)
-- 
2.34.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.