[Xen-devel] [PATCH 2/n] x86/microcode: Move interface from processor.h to microcode.h

Andrew Cooper posted 1 patch 3 weeks ago
Failed in applying to current master (apply log)
xen/arch/x86/acpi/power.c         | 1 +
xen/arch/x86/efi/efi-boot.h       | 2 +-
xen/arch/x86/microcode/core.c     | 2 +-
xen/arch/x86/microcode/private.h  | 3 +++
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   | 9 ---------
10 files changed, 17 insertions(+), 12 deletions(-)

[Xen-devel] [PATCH 2/n] x86/microcode: Move interface from processor.h to microcode.h

Posted by Andrew Cooper 3 weeks ago
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 7 function declarations are actually called externally.
early_microcode_update_cpu() has no callers so make it static, and move the
vendor init declarations to private.h

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Wei Liu <wl@xen.org>
CC: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/acpi/power.c         | 1 +
 xen/arch/x86/efi/efi-boot.h       | 2 +-
 xen/arch/x86/microcode/core.c     | 2 +-
 xen/arch/x86/microcode/private.h  | 3 +++
 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   | 9 ---------
 10 files changed, 17 insertions(+), 12 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 <asm/tboot.h>
 #include <asm/apic.h>
 #include <asm/io_apic.h>
+#include <asm/microcode.h>
 #include <asm/spec_ctrl.h>
 #include <acpi/cpufreq/cpufreq.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 <xen/vga.h>
 #include <asm/e820.h>
 #include <asm/edd.h>
+#include <asm/microcode.h>
 #include <asm/msr.h>
-#include <asm/processor.h>
 
 static struct file __initdata ucode;
 static multiboot_info_t __initdata mbi = {
diff --git a/xen/arch/x86/microcode/core.c b/xen/arch/x86/microcode/core.c
index e99f4ab06c..e54a5fec51 100644
--- a/xen/arch/x86/microcode/core.c
+++ b/xen/arch/x86/microcode/core.c
@@ -756,7 +756,7 @@ int microcode_update_one(bool start_update)
 }
 
 /* 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 = 0;
     const void *data = NULL;
diff --git a/xen/arch/x86/microcode/private.h b/xen/arch/x86/microcode/private.h
index 97c7405dad..cdfe637b6d 100644
--- a/xen/arch/x86/microcode/private.h
+++ b/xen/arch/x86/microcode/private.h
@@ -36,4 +36,7 @@ extern const struct microcode_ops *microcode_ops;
 
 void microcode_free_patch(struct microcode_patch *patch);
 
+int microcode_init_intel(void);
+int microcode_init_amd(void);
+
 #endif /* ASM_X86_MICROCODE_PRIVATE_H */
diff --git a/xen/arch/x86/platform_hypercall.c b/xen/arch/x86/platform_hypercall.c
index 80efb84328..ee2efdd875 100644
--- a/xen/arch/x86/platform_hypercall.c
+++ b/xen/arch/x86/platform_hypercall.c
@@ -27,6 +27,7 @@
 #include <public/platform.h>
 #include <acpi/cpufreq/processor_perf.h>
 #include <asm/edd.h>
+#include <asm/microcode.h>
 #include <asm/mtrr.h>
 #include <asm/io_apic.h>
 #include <asm/setup.h>
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 <asm/cpuid.h>
 #include <asm/spec_ctrl.h>
 #include <asm/guest.h>
+#include <asm/microcode.h>
 
 /* 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 <asm/div64.h>
 #include <asm/flushtlb.h>
 #include <asm/guest.h>
+#include <asm/microcode.h>
 #include <asm/msr.h>
 #include <asm/mtrr.h>
 #include <asm/spec_ctrl.h>
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 @@
 
 #include <asm/microcode.h>
 #include <asm/msr.h>
-#include <asm/processor.h>
 #include <asm/pv/domain.h>
 #include <asm/pv/shim.h>
 #include <asm/setup.h>
diff --git a/xen/include/asm-x86/microcode.h b/xen/include/asm-x86/microcode.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
 
+#include <xen/types.h>
 #include <xen/percpu.h>
 
+#include <public/xen.h>
+
 struct cpu_signature {
     unsigned int sig;
     unsigned int pf;
@@ -11,4 +14,9 @@ struct cpu_signature {
 
 DECLARE_PER_CPU(struct cpu_signature, cpu_sig);
 
+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/processor.h
index b2b19a02cd..fe231c5072 100644
--- a/xen/include/asm-x86/processor.h
+++ b/xen/include/asm-x86/processor.h
@@ -9,7 +9,6 @@
 #include <xen/types.h>
 #include <xen/smp.h>
 #include <xen/percpu.h>
-#include <public/xen.h>
 #include <asm/types.h>
 #include <asm/cpufeature.h>
 #include <asm/desc.h>
@@ -579,14 +578,6 @@ void cpuid_hypervisor_leaves(const struct vcpu *v, uint32_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);
 
-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);
-int microcode_init_amd(void);
-
 static inline uint8_t get_cpu_family(uint32_t raw, uint8_t *model,
                                      uint8_t *stepping)
 {
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH 2/n] x86/microcode: Move interface from processor.h to microcode.h

Posted by Jan Beulich 3 weeks ago
On 18.03.2020 22:30, Andrew Cooper wrote:
> 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 7 function declarations are actually called externally.
> early_microcode_update_cpu() has no callers so make it static, and move the
> vendor init declarations to private.h
> 
> No functional change.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Acked-by: Jan Beulich <jbeulich@suse.com>


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel