Skip to contentSkip to conversation

xen: backport of microcode updates to xen-3.3-testing

PATCH New Christoph Egger 1 participant 1 message Feb 4, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen: backport of microcode updates to xen-3.3-testing

Hi,

Attached patch backports microcode support updates to xen-3.3-testing per request from SUN Microsystems.

The patch collects the following changesets from xen-unstable in one diff:

18406 x86: constify microcode hypercall argument
18475 x86: microcode update support for AMD CPUs
18481 x86: Fix 32-bit build after AMD microcode update patch. 18483 x86, microcode: Clean up for Xen coding style, and disable for now 18485 x86, microcode: More code cleanups.
18487 x86, microcode: Do not run microcode update in IRQ context. 18488 x86, microcode: Free microcode_info struct at end of hypercall. 18509 x86: Allow continue_hypercall_on_cpu() to be called from within an
existing continuation handler. This fix is needed for the new method of microcode re-programming.
18519 x86,amd,microcode: fix hypercall return code
19059 x86: update microcode support

From: Hans Rosenfeld <[email protected]>

Signature · 6 lines
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Karl-Hammerschmidt-Str. 34, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Jochen Polster, Thomas M. McCoy, Giuliano Meroni
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
xen/arch/x86/Makefile +2 -0
diff -r 3155a367b476 xen/arch/x86/Makefile
@@ -28,6 +28,8 @@ obj-y += ioport_emulate.o
 obj-y += ioport_emulate.o
 obj-y += irq.o
 obj-y += microcode.o
+obj-y += microcode_amd.o
+obj-y += microcode_intel.o
 obj-y += mm.o
 obj-y += mpparse.o
 obj-y += nmi.o
xen/arch/x86/domain.c +39 -22

92 lines not on this page · raw message

xen/arch/x86/microcode.c +108 -416

582 lines not on this page · raw message

xen/arch/x86/platform_hypercall.c +1 -2
diff -r 3155a367b476 xen/arch/x86/platform_hypercall.c
@@ -147,8 +147,7 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
 
     case XENPF_microcode_update:
     {
-        extern int microcode_update(XEN_GUEST_HANDLE(void), unsigned long len);
-        XEN_GUEST_HANDLE(void) data;
+        XEN_GUEST_HANDLE(const_void) data;
 
         ret = xsm_microcode();
         if ( ret )
xen/common/schedule.c +5 -0
diff -r 3155a367b476 xen/common/schedule.c
@@ -295,6 +295,11 @@ int vcpu_lock_affinity(struct vcpu *v, c
 int vcpu_lock_affinity(struct vcpu *v, cpumask_t *affinity)
 {
     return __vcpu_set_affinity(v, affinity, 0, 1);
+}
+
+int vcpu_locked_change_affinity(struct vcpu *v, cpumask_t *affinity)
+{
+    return __vcpu_set_affinity(v, affinity, 1, 1);
 }
 
 void vcpu_unlock_affinity(struct vcpu *v, cpumask_t *affinity)
xen/include/asm-x86/msr-index.h +4 -0
diff -r 3155a367b476 xen/include/asm-x86/msr-index.h
@@ -211,6 +211,10 @@
 #define FAM10H_MMIO_CONF_BASE_MASK	0xfffffff
 #define FAM10H_MMIO_CONF_BASE_SHIFT	20
 
+/* AMD Microcode MSRs */
+#define MSR_AMD_PATCHLEVEL		0x0000008b
+#define MSR_AMD_PATCHLOADER		0xc0010020
+
 /* K6 MSRs */
 #define MSR_K6_EFER			0xc0000080
 #define MSR_K6_STAR			0xc0000081
xen/include/asm-x86/processor.h +2 -35
diff -r 3155a367b476 xen/include/asm-x86/processor.h
@@ -486,41 +486,6 @@ long set_gdt(struct vcpu *d,
 })
 long set_debugreg(struct vcpu *p, int reg, unsigned long value);
 
-struct microcode_header {
-    unsigned int hdrver;
-    unsigned int rev;
-    unsigned int date;
-    unsigned int sig;
-    unsigned int cksum;
-    unsigned int ldrver;
-    unsigned int pf;
-    unsigned int datasize;
-    unsigned int totalsize;
-    unsigned int reserved[3];
-};
-
-struct microcode {
-    struct microcode_header hdr;
-    unsigned int bits[0];
-};
-
-typedef struct microcode microcode_t;
-typedef struct microcode_header microcode_header_t;
-
-/* microcode format is extended from prescott processors */
-struct extended_signature {
-    unsigned int sig;
-    unsigned int pf;
-    unsigned int cksum;
-};
-
-struct extended_sigtable {
-    unsigned int count;
-    unsigned int cksum;
-    unsigned int reserved[3];
-    struct extended_signature sigs[0];
-};
-
 /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
 static always_inline void rep_nop(void)
 {
@@ -583,6 +548,8 @@ int wrmsr_hypervisor_regs(
 int wrmsr_hypervisor_regs(
     uint32_t idx, uint32_t eax, uint32_t edx);
 
+int microcode_update(XEN_GUEST_HANDLE(const_void), unsigned long len);
+
 #endif /* !__ASSEMBLY__ */
 
 #endif /* __ASM_X86_PROCESSOR_H */
xen/include/public/platform.h +1 -1
diff -r 3155a367b476 xen/include/public/platform.h
@@ -97,7 +97,7 @@ DEFINE_XEN_GUEST_HANDLE(xenpf_read_memty
 #define XENPF_microcode_update    35
 struct xenpf_microcode_update {
     /* IN variables. */
-    XEN_GUEST_HANDLE(void) data;      /* Pointer to microcode data */
+    XEN_GUEST_HANDLE(const_void) data;/* Pointer to microcode data */
     uint32_t length;                  /* Length of microcode data. */
 };
 typedef struct xenpf_microcode_update xenpf_microcode_update_t;
xen/include/xen/compat.h +3 -1
diff -r 3155a367b476 xen/include/xen/compat.h
@@ -19,7 +19,9 @@
         type *_[0] __attribute__((__packed__)); \
     } __compat_handle_ ## name
 
-#define DEFINE_COMPAT_HANDLE(name)   __DEFINE_COMPAT_HANDLE(name, name)
+#define DEFINE_COMPAT_HANDLE(name) \
+    __DEFINE_COMPAT_HANDLE(name, name); \
+    __DEFINE_COMPAT_HANDLE(const_ ## name, const name)
 #define COMPAT_HANDLE(name)          __compat_handle_ ## name
 
 /* Is the compat handle a NULL reference? */
xen/include/xen/sched.h +1 -0
diff -r 3155a367b476 xen/include/xen/sched.h
@@ -526,6 +526,7 @@ void vcpu_force_reschedule(struct vcpu *
 void vcpu_force_reschedule(struct vcpu *v);
 int vcpu_set_affinity(struct vcpu *v, cpumask_t *affinity);
 int vcpu_lock_affinity(struct vcpu *v, cpumask_t *affinity);
+int vcpu_locked_change_affinity(struct vcpu *v, cpumask_t *affinity);
 void vcpu_unlock_affinity(struct vcpu *v, cpumask_t *affinity);
 
 void vcpu_runstate_get(struct vcpu *v, struct vcpu_runstate_info *runstate);

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel