From b834258fb810a5f2e90082d9443805af0cd5a03af58958a05c522a733ef893c0 Mon Sep 17 00:00:00 2001 From: OBS User unknown Date: Wed, 24 Sep 2008 23:20:56 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/xen?expand=0&rev=54 --- 18406-constify-microcode.patch | 90 ++ 18428-poll-single-port.patch | 235 +++ 18464-cpu-hotplug.patch | 213 +++ 18471-cpu-hotplug.patch | 27 + 18475-amd-microcode-update.patch | 1660 ++++++++++++++++++++ 18481-amd-microcode-update-fix.patch | 37 + 18483-intel-microcode-update.patch | 1766 ++++++++++++++++++++++ 18484-stubdom-ioemu-makefile.patch | 85 ++ 18487-microcode-update-irq-context.patch | 149 ++ 18488-microcode-free-fix.patch | 29 + 18505-amd-powernow-fix.patch | 76 + 18506-enforce-memory-limits.patch | 63 + 18509-continue-hypercall-on-cpu.patch | 136 ++ blktap-pv-cdrom.patch | 99 +- blktapctrl-default-to-ioemu.patch | 20 +- block-flags.diff | 6 +- block-losetup-retry.diff | 6 +- bridge-bonding.diff | 6 +- bridge-opensuse.patch | 6 +- bridge-record-creation.patch | 6 +- bridge-vlan.diff | 6 +- build-tapdisk-ioemu.patch | 2 +- cdrom-removable.patch | 34 +- dump-exec-state.patch | 24 +- hv_xen_extension.patch | 38 +- ioemu-blktap-barriers.patch | 6 +- ioemu-blktap-fix-open.patch | 24 +- ioemu-blktap-image-format.patch | 26 +- ioemu-qcow2-multiblock-aio.patch | 12 +- libxen_permissive.patch | 6 +- msi-enable.patch | 13 + poll-single-port.patch | 163 -- pv-driver-build.patch | 36 +- pvdrv_emulation_control.patch | 6 +- qemu-img-snapshot.patch | 6 +- qemu-security-etch1.diff | 30 +- rpmlint.diff | 6 +- serial-split.patch | 8 +- snapshot-ioemu-delete.patch | 6 +- snapshot-ioemu-restore.patch | 28 +- snapshot-ioemu-save.patch | 24 +- supported_module.diff | 4 +- tools-gdbserver-build.diff | 9 +- tools-kboot.diff | 36 +- tools-xc_kexec.diff | 78 +- x86-extra-trap-info.patch | 12 +- x86-microcode.patch | 141 -- x86-page-gnttab.patch | 32 + x86-show-page-walk-early.patch | 36 +- xen-3.3.1-testing-src.tar.bz2 | 4 +- xen-api-auth.patch | 6 +- xen-changeset.diff | 6 +- xen-config.diff | 6 +- xen-destdir.diff | 42 +- xen-disable-qemu-monitor.diff | 6 +- xen-fixme-doc.diff | 12 +- xen-hvm-default-pae.diff | 6 +- xen-ioapic-ack-default.diff | 6 +- xen-lowmem-emergency-pool.diff | 12 +- xen-no-dummy-nfs-ip.diff | 6 +- xen-paths.diff | 18 +- xen-qemu-iscsi-fix.patch | 6 +- xen-rpmoptflags.diff | 12 +- xen-tightvnc-args.diff | 6 +- xen-warnings.diff | 83 +- xen-xm-top-needs-root.diff | 6 +- xen-xmexample-vti.diff | 6 +- xen-xmexample.diff | 36 +- xen.changes | 23 + xen.spec | 63 +- xend-config.diff | 12 +- xend-domain-lock.patch | 2 +- xend-vif-fix.patch | 6 +- xm-man-update.diff | 460 ++++++ xm-test-cleanup.diff | 6 +- 75 files changed, 5652 insertions(+), 772 deletions(-) create mode 100644 18406-constify-microcode.patch create mode 100644 18428-poll-single-port.patch create mode 100644 18464-cpu-hotplug.patch create mode 100644 18471-cpu-hotplug.patch create mode 100644 18475-amd-microcode-update.patch create mode 100644 18481-amd-microcode-update-fix.patch create mode 100644 18483-intel-microcode-update.patch create mode 100644 18484-stubdom-ioemu-makefile.patch create mode 100644 18487-microcode-update-irq-context.patch create mode 100644 18488-microcode-free-fix.patch create mode 100644 18505-amd-powernow-fix.patch create mode 100644 18506-enforce-memory-limits.patch create mode 100644 18509-continue-hypercall-on-cpu.patch create mode 100644 msi-enable.patch delete mode 100644 poll-single-port.patch delete mode 100644 x86-microcode.patch create mode 100644 x86-page-gnttab.patch create mode 100644 xm-man-update.diff diff --git a/18406-constify-microcode.patch b/18406-constify-microcode.patch new file mode 100644 index 0000000..c7c2f98 --- /dev/null +++ b/18406-constify-microcode.patch @@ -0,0 +1,90 @@ +# HG changeset patch +# User Keir Fraser +# Date 1220022665 -3600 +# Node ID 481f0dc6beb0b19cb02354dbe9b4ce068a5f6a18 +# Parent cd078a3d600e6a1bab65e6392a60a832253cff8b +x86: constify microcode hypercall argument + +Linux 2.6.27 marks the data pointer in its firmware struct 'const', +and hence, to avoid a compiler warning, Xen's microcode update +interface should be properly properly constified too. + +Signed-off-by: Jan Beulich + +Index: xen-3.3.1-testing/xen/arch/x86/microcode.c +=================================================================== +--- xen-3.3.1-testing.orig/xen/arch/x86/microcode.c ++++ xen-3.3.1-testing/xen/arch/x86/microcode.c +@@ -124,7 +124,7 @@ static DEFINE_SPINLOCK(microcode_update_ + /* no concurrent ->write()s are allowed on /dev/cpu/microcode */ + static DEFINE_MUTEX(microcode_mutex); + +-static void __user *user_buffer; /* user area microcode data buffer */ ++static const void __user *user_buffer; /* user area microcode data buffer */ + static unsigned int user_buffer_size; /* it's size */ + + typedef enum mc_error_code { +@@ -455,7 +455,7 @@ out: + return error; + } + +-int microcode_update(XEN_GUEST_HANDLE(void) buf, unsigned long len) ++int microcode_update(XEN_GUEST_HANDLE(const_void) buf, unsigned long len) + { + int ret; + +Index: xen-3.3.1-testing/xen/arch/x86/platform_hypercall.c +=================================================================== +--- xen-3.3.1-testing.orig/xen/arch/x86/platform_hypercall.c ++++ xen-3.3.1-testing/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 ) +Index: xen-3.3.1-testing/xen/include/asm-x86/processor.h +=================================================================== +--- xen-3.3.1-testing.orig/xen/include/asm-x86/processor.h ++++ xen-3.3.1-testing/xen/include/asm-x86/processor.h +@@ -583,6 +583,8 @@ int rdmsr_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 */ +Index: xen-3.3.1-testing/xen/include/public/platform.h +=================================================================== +--- xen-3.3.1-testing.orig/xen/include/public/platform.h ++++ xen-3.3.1-testing/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; +Index: xen-3.3.1-testing/xen/include/xen/compat.h +=================================================================== +--- xen-3.3.1-testing.orig/xen/include/xen/compat.h ++++ xen-3.3.1-testing/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? */ diff --git a/18428-poll-single-port.patch b/18428-poll-single-port.patch new file mode 100644 index 0000000..18f804a --- /dev/null +++ b/18428-poll-single-port.patch @@ -0,0 +1,235 @@ +# HG changeset patch +# User Keir Fraser +# Date 1220535506 -3600 +# Node ID ae9b223a675d9ed37cffbc24d0abe83ef2a30ab3 +# Parent 8d982c7a0d303de1200134fcf3a2573f6f4449fa +More efficient implementation of SCHEDOP_poll when polling a single port. +Signed-off-by: Keir Fraser + +Index: xen-3.3.1-testing/xen/common/domain.c +=================================================================== +--- xen-3.3.1-testing.orig/xen/common/domain.c ++++ xen-3.3.1-testing/xen/common/domain.c +@@ -651,9 +651,11 @@ void vcpu_reset(struct vcpu *v) + + set_bit(_VPF_down, &v->pause_flags); + ++ clear_bit(v->vcpu_id, d->poll_mask); ++ v->poll_evtchn = 0; ++ + v->fpu_initialised = 0; + v->fpu_dirtied = 0; +- v->is_polling = 0; + v->is_initialised = 0; + v->nmi_pending = 0; + v->mce_pending = 0; +Index: xen-3.3.1-testing/xen/common/event_channel.c +=================================================================== +--- xen-3.3.1-testing.orig/xen/common/event_channel.c ++++ xen-3.3.1-testing/xen/common/event_channel.c +@@ -545,6 +545,7 @@ out: + static int evtchn_set_pending(struct vcpu *v, int port) + { + struct domain *d = v->domain; ++ int vcpuid; + + /* + * The following bit operations must happen in strict order. +@@ -564,15 +565,19 @@ static int evtchn_set_pending(struct vcp + } + + /* Check if some VCPU might be polling for this event. */ +- if ( unlikely(d->is_polling) ) +- { +- d->is_polling = 0; +- smp_mb(); /* check vcpu poll-flags /after/ clearing domain poll-flag */ +- for_each_vcpu ( d, v ) ++ if ( likely(bitmap_empty(d->poll_mask, MAX_VIRT_CPUS)) ) ++ return 0; ++ ++ /* Wake any interested (or potentially interested) pollers. */ ++ for ( vcpuid = find_first_bit(d->poll_mask, MAX_VIRT_CPUS); ++ vcpuid < MAX_VIRT_CPUS; ++ vcpuid = find_next_bit(d->poll_mask, MAX_VIRT_CPUS, vcpuid+1) ) ++ { ++ v = d->vcpu[vcpuid]; ++ if ( ((v->poll_evtchn <= 0) || (v->poll_evtchn == port)) && ++ test_and_clear_bit(vcpuid, d->poll_mask) ) + { +- if ( !v->is_polling ) +- continue; +- v->is_polling = 0; ++ v->poll_evtchn = 0; + vcpu_unblock(v); + } + } +Index: xen-3.3.1-testing/xen/common/schedule.c +=================================================================== +--- xen-3.3.1-testing.orig/xen/common/schedule.c ++++ xen-3.3.1-testing/xen/common/schedule.c +@@ -198,6 +198,27 @@ void vcpu_wake(struct vcpu *v) + TRACE_2D(TRC_SCHED_WAKE, v->domain->domain_id, v->vcpu_id); + } + ++void vcpu_unblock(struct vcpu *v) ++{ ++ if ( !test_and_clear_bit(_VPF_blocked, &v->pause_flags) ) ++ return; ++ ++ /* Polling period ends when a VCPU is unblocked. */ ++ if ( unlikely(v->poll_evtchn != 0) ) ++ { ++ v->poll_evtchn = 0; ++ /* ++ * We *must* re-clear _VPF_blocked to avoid racing other wakeups of ++ * this VCPU (and it then going back to sleep on poll_mask). ++ * Test-and-clear is idiomatic and ensures clear_bit not reordered. ++ */ ++ if ( test_and_clear_bit(v->vcpu_id, v->domain->poll_mask) ) ++ clear_bit(_VPF_blocked, &v->pause_flags); ++ } ++ ++ vcpu_wake(v); ++} ++ + static void vcpu_migrate(struct vcpu *v) + { + unsigned long flags; +@@ -337,7 +358,7 @@ static long do_poll(struct sched_poll *s + struct vcpu *v = current; + struct domain *d = v->domain; + evtchn_port_t port; +- long rc = 0; ++ long rc; + unsigned int i; + + /* Fairly arbitrary limit. */ +@@ -348,11 +369,24 @@ static long do_poll(struct sched_poll *s + return -EFAULT; + + set_bit(_VPF_blocked, &v->pause_flags); +- v->is_polling = 1; +- d->is_polling = 1; ++ v->poll_evtchn = -1; ++ set_bit(v->vcpu_id, d->poll_mask); + ++#ifndef CONFIG_X86 /* set_bit() implies mb() on x86 */ + /* Check for events /after/ setting flags: avoids wakeup waiting race. */ +- smp_wmb(); ++ smp_mb(); ++ ++ /* ++ * Someone may have seen we are blocked but not that we are polling, or ++ * vice versa. We are certainly being woken, so clean up and bail. Beyond ++ * this point others can be guaranteed to clean up for us if they wake us. ++ */ ++ rc = 0; ++ if ( (v->poll_evtchn == 0) || ++ !test_bit(_VPF_blocked, &v->pause_flags) || ++ !test_bit(v->vcpu_id, d->poll_mask) ) ++ goto out; ++#endif + + for ( i = 0; i < sched_poll->nr_ports; i++ ) + { +@@ -369,6 +403,9 @@ static long do_poll(struct sched_poll *s + goto out; + } + ++ if ( sched_poll->nr_ports == 1 ) ++ v->poll_evtchn = port; ++ + if ( sched_poll->timeout != 0 ) + set_timer(&v->poll_timer, sched_poll->timeout); + +@@ -378,7 +415,8 @@ static long do_poll(struct sched_poll *s + return 0; + + out: +- v->is_polling = 0; ++ v->poll_evtchn = 0; ++ clear_bit(v->vcpu_id, d->poll_mask); + clear_bit(_VPF_blocked, &v->pause_flags); + return rc; + } +@@ -760,11 +798,8 @@ static void poll_timer_fn(void *data) + { + struct vcpu *v = data; + +- if ( !v->is_polling ) +- return; +- +- v->is_polling = 0; +- vcpu_unblock(v); ++ if ( test_and_clear_bit(v->vcpu_id, v->domain->poll_mask) ) ++ vcpu_unblock(v); + } + + /* Initialise the data structures. */ +Index: xen-3.3.1-testing/xen/include/xen/sched.h +=================================================================== +--- xen-3.3.1-testing.orig/xen/include/xen/sched.h ++++ xen-3.3.1-testing/xen/include/xen/sched.h +@@ -106,8 +106,6 @@ struct vcpu + bool_t fpu_initialised; + /* Has the FPU been used since it was last saved? */ + bool_t fpu_dirtied; +- /* Is this VCPU polling any event channels (SCHEDOP_poll)? */ +- bool_t is_polling; + /* Initialization completed for this VCPU? */ + bool_t is_initialised; + /* Currently running on a CPU? */ +@@ -134,6 +132,13 @@ struct vcpu + /* VCPU affinity is temporarily locked from controller changes? */ + bool_t affinity_locked; + ++ /* ++ * > 0: a single port is being polled; ++ * = 0: nothing is being polled (vcpu should be clear in d->poll_mask); ++ * < 0: multiple ports may be being polled. ++ */ ++ int poll_evtchn; ++ + unsigned long pause_flags; + atomic_t pause_count; + +@@ -209,8 +214,6 @@ struct domain + struct domain *target; + /* Is this guest being debugged by dom0? */ + bool_t debugger_attached; +- /* Are any VCPUs polling event channels (SCHEDOP_poll)? */ +- bool_t is_polling; + /* Is this guest dying (i.e., a zombie)? */ + enum { DOMDYING_alive, DOMDYING_dying, DOMDYING_dead } is_dying; + /* Domain is paused by controller software? */ +@@ -218,6 +221,9 @@ struct domain + /* Domain's VCPUs are pinned 1:1 to physical CPUs? */ + bool_t is_pinned; + ++ /* Are any VCPUs polling event channels (SCHEDOP_poll)? */ ++ DECLARE_BITMAP(poll_mask, MAX_VIRT_CPUS); ++ + /* Guest has shut down (inc. reason code)? */ + spinlock_t shutdown_lock; + bool_t is_shutting_down; /* in process of shutting down? */ +@@ -507,6 +513,7 @@ static inline int vcpu_runnable(struct v + atomic_read(&v->domain->pause_count)); + } + ++void vcpu_unblock(struct vcpu *v); + void vcpu_pause(struct vcpu *v); + void vcpu_pause_nosync(struct vcpu *v); + void domain_pause(struct domain *d); +@@ -523,12 +530,6 @@ void vcpu_unlock_affinity(struct vcpu *v + + void vcpu_runstate_get(struct vcpu *v, struct vcpu_runstate_info *runstate); + +-static inline void vcpu_unblock(struct vcpu *v) +-{ +- if ( test_and_clear_bit(_VPF_blocked, &v->pause_flags) ) +- vcpu_wake(v); +-} +- + #define IS_PRIV(_d) ((_d)->is_privileged) + #define IS_PRIV_FOR(_d, _t) (IS_PRIV(_d) || ((_d)->target && (_d)->target == (_t))) + diff --git a/18464-cpu-hotplug.patch b/18464-cpu-hotplug.patch new file mode 100644 index 0000000..44b262f --- /dev/null +++ b/18464-cpu-hotplug.patch @@ -0,0 +1,213 @@ +# HG changeset patch +# User Keir Fraser +# Date 1221141982 -3600 +# Node ID 4ffc70556000869d3c301452a99e4e524dd54b07 +# Parent fba8dca321c2b99842af6624f24afb77c472184b +x86: Support CPU hotplug offline. + +Signed-off-by: Shan Haitao +Signed-off-by: Keir Fraser + +Index: xen-3.3.1-testing/xen/arch/x86/irq.c +=================================================================== +--- xen-3.3.1-testing.orig/xen/arch/x86/irq.c ++++ xen-3.3.1-testing/xen/arch/x86/irq.c +@@ -737,9 +737,12 @@ __initcall(setup_dump_irqs); + + void fixup_irqs(cpumask_t map) + { +- unsigned int irq; ++ unsigned int irq, sp; + static int warned; ++ irq_guest_action_t *action; ++ struct pending_eoi *peoi; + ++ /* Direct all future interrupts away from this CPU. */ + for ( irq = 0; irq < NR_IRQS; irq++ ) + { + cpumask_t mask; +@@ -758,8 +761,24 @@ void fixup_irqs(cpumask_t map) + printk("Cannot set affinity for irq %i\n", irq); + } + ++ /* Service any interrupts that beat us in the re-direction race. */ + local_irq_enable(); + mdelay(1); + local_irq_disable(); ++ ++ /* Clean up cpu_eoi_map of every interrupt to exclude this CPU. */ ++ for ( irq = 0; irq < NR_IRQS; irq++ ) ++ { ++ if ( !(irq_desc[irq].status & IRQ_GUEST) ) ++ continue; ++ action = (irq_guest_action_t *)irq_desc[irq].action; ++ cpu_clear(smp_processor_id(), action->cpu_eoi_map); ++ } ++ ++ /* Flush the interrupt EOI stack. */ ++ peoi = this_cpu(pending_eoi); ++ for ( sp = 0; sp < pending_eoi_sp(peoi); sp++ ) ++ peoi[sp].ready = 1; ++ flush_ready_eoi(NULL); + } + #endif +Index: xen-3.3.1-testing/xen/arch/x86/smpboot.c +=================================================================== +--- xen-3.3.1-testing.orig/xen/arch/x86/smpboot.c ++++ xen-3.3.1-testing/xen/arch/x86/smpboot.c +@@ -1225,15 +1225,6 @@ int __cpu_disable(void) + if (cpu == 0) + return -EBUSY; + +- /* +- * Only S3 is using this path, and thus idle vcpus are running on all +- * APs when we are called. To support full cpu hotplug, other +- * notification mechanisms should be introduced (e.g., migrate vcpus +- * off this physical cpu before rendezvous point). +- */ +- if (!is_idle_vcpu(current)) +- return -EINVAL; +- + local_irq_disable(); + clear_local_APIC(); + /* Allow any queued timer interrupts to get serviced */ +@@ -1249,6 +1240,9 @@ int __cpu_disable(void) + fixup_irqs(map); + /* It's now safe to remove this processor from the online map */ + cpu_clear(cpu, cpu_online_map); ++ ++ cpu_disable_scheduler(); ++ + return 0; + } + +@@ -1275,28 +1269,6 @@ static int take_cpu_down(void *unused) + return __cpu_disable(); + } + +-/* +- * XXX: One important thing missed here is to migrate vcpus +- * from dead cpu to other online ones and then put whole +- * system into a stop state. It assures a safe environment +- * for a cpu hotplug/remove at normal running state. +- * +- * However for xen PM case, at this point: +- * -> All other domains should be notified with PM event, +- * and then in following states: +- * * Suspend state, or +- * * Paused state, which is a force step to all +- * domains if they do nothing to suspend +- * -> All vcpus of dom0 (except vcpu0) have already beem +- * hot removed +- * with the net effect that all other cpus only have idle vcpu +- * running. In this special case, we can avoid vcpu migration +- * then and system can be considered in a stop state. +- * +- * So current cpu hotplug is a special version for PM specific +- * usage, and need more effort later for full cpu hotplug. +- * (ktian1) +- */ + int cpu_down(unsigned int cpu) + { + int err = 0; +@@ -1307,6 +1279,12 @@ int cpu_down(unsigned int cpu) + goto out; + } + ++ /* Can not offline BSP */ ++ if (cpu == 0) { ++ err = -EINVAL; ++ goto out; ++ } ++ + if (!cpu_online(cpu)) { + err = -EINVAL; + goto out; +Index: xen-3.3.1-testing/xen/common/sched_credit.c +=================================================================== +--- xen-3.3.1-testing.orig/xen/common/sched_credit.c ++++ xen-3.3.1-testing/xen/common/sched_credit.c +@@ -1107,6 +1107,10 @@ csched_load_balance(int cpu, struct csch + + BUG_ON( cpu != snext->vcpu->processor ); + ++ /* If this CPU is going offline we shouldn't steal work. */ ++ if ( unlikely(!cpu_online(cpu)) ) ++ goto out; ++ + if ( snext->pri == CSCHED_PRI_IDLE ) + CSCHED_STAT_CRANK(load_balance_idle); + else if ( snext->pri == CSCHED_PRI_TS_OVER ) +@@ -1149,6 +1153,7 @@ csched_load_balance(int cpu, struct csch + return speer; + } + ++ out: + /* Failed to find more important work elsewhere... */ + __runq_remove(snext); + return snext; +Index: xen-3.3.1-testing/xen/common/schedule.c +=================================================================== +--- xen-3.3.1-testing.orig/xen/common/schedule.c ++++ xen-3.3.1-testing/xen/common/schedule.c +@@ -268,6 +268,48 @@ void vcpu_force_reschedule(struct vcpu * + } + } + ++/* ++ * This function is used by cpu_hotplug code from stop_machine context. ++ * Hence we can avoid needing to take the ++ */ ++void cpu_disable_scheduler(void) ++{ ++ struct domain *d; ++ struct vcpu *v; ++ unsigned int cpu = smp_processor_id(); ++ ++ for_each_domain ( d ) ++ { ++ for_each_vcpu ( d, v ) ++ { ++ if ( is_idle_vcpu(v) ) ++ continue; ++ ++ if ( (cpus_weight(v->cpu_affinity) == 1) && ++ cpu_isset(cpu, v->cpu_affinity) ) ++ { ++ printk("Breaking vcpu affinity for domain %d vcpu %d\n", ++ v->domain->domain_id, v->vcpu_id); ++ cpus_setall(v->cpu_affinity); ++ } ++ ++ /* ++ * Migrate single-shot timers to CPU0. A new cpu will automatically ++ * be chosen when the timer is next re-set. ++ */ ++ if ( v->singleshot_timer.cpu == cpu ) ++ migrate_timer(&v->singleshot_timer, 0); ++ ++ if ( v->processor == cpu ) ++ { ++ set_bit(_VPF_migrating, &v->pause_flags); ++ vcpu_sleep_nosync(v); ++ vcpu_migrate(v); ++ } ++ } ++ } ++} ++ + static int __vcpu_set_affinity( + struct vcpu *v, cpumask_t *affinity, + bool_t old_lock_status, bool_t new_lock_status) +Index: xen-3.3.1-testing/xen/include/xen/sched.h +=================================================================== +--- xen-3.3.1-testing.orig/xen/include/xen/sched.h ++++ xen-3.3.1-testing/xen/include/xen/sched.h +@@ -524,6 +524,7 @@ void domain_unpause_by_systemcontroller( + void cpu_init(void); + + void vcpu_force_reschedule(struct vcpu *v); ++void cpu_disable_scheduler(void); + int vcpu_set_affinity(struct vcpu *v, cpumask_t *affinity); + int vcpu_lock_affinity(struct vcpu *v, cpumask_t *affinity); + void vcpu_unlock_affinity(struct vcpu *v, cpumask_t *affinity); diff --git a/18471-cpu-hotplug.patch b/18471-cpu-hotplug.patch new file mode 100644 index 0000000..6340f55 --- /dev/null +++ b/18471-cpu-hotplug.patch @@ -0,0 +1,27 @@ +# HG changeset patch +# User Keir Fraser +# Date 1221212419 -3600 +# Node ID 34aed15ba9df804ce037c5f691a9b11058fff2b9 +# Parent f125e481d8b65b81dd794d60a99fb0b823eaee2c +x86, cpu hotplug: flush softirq work when going offline + +From: Haitao Shan +Signed-off-by: Keir Fraser + +Index: xen-3.3.1-testing/xen/arch/x86/domain.c +=================================================================== +--- xen-3.3.1-testing.orig/xen/arch/x86/domain.c ++++ xen-3.3.1-testing/xen/arch/x86/domain.c +@@ -86,6 +86,12 @@ static void default_idle(void) + + static void play_dead(void) + { ++ /* ++ * Flush pending softirqs if any. They can be queued up before this CPU ++ * was taken out of cpu_online_map in __cpu_disable(). ++ */ ++ do_softirq(); ++ + /* This must be done before dead CPU ack */ + cpu_exit_clear(); + hvm_cpu_down(); diff --git a/18475-amd-microcode-update.patch b/18475-amd-microcode-update.patch new file mode 100644 index 0000000..ab79122 --- /dev/null +++ b/18475-amd-microcode-update.patch @@ -0,0 +1,1660 @@ +# HG changeset patch +# User Keir Fraser +# Date 1221225493 -3600 +# Node ID 15b1c3d4459afd62fb3de04d69c3c09941ac587c +# Parent e827c54462d3ba44ee3d4ca60bbc970c240551da +x86: microcode update support for AMD CPUs + +Microcode update support for AMD CPUs Family10h and Family11h. +It is based on a patch for Linux which is on its way for 2.6.28. + +Signed-off-by: Christoph Egger + +Index: xen-3.3.1-testing/xen/arch/x86/Makefile +=================================================================== +--- xen-3.3.1-testing.orig/xen/arch/x86/Makefile ++++ xen-3.3.1-testing/xen/arch/x86/Makefile +@@ -28,6 +28,8 @@ obj-y += msi.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 +Index: xen-3.3.1-testing/xen/arch/x86/microcode.c +=================================================================== +--- xen-3.3.1-testing.orig/xen/arch/x86/microcode.c ++++ xen-3.3.1-testing/xen/arch/x86/microcode.c +@@ -1,72 +1,73 @@ + /* +- * Intel CPU Microcode Update Driver for Linux ++ * Intel CPU Microcode Update Driver for Linux + * +- * Copyright (C) 2000-2004 Tigran Aivazian ++ * Copyright (C) 2000-2006 Tigran Aivazian ++ * 2006 Shaohua Li * ++ * This driver allows to upgrade microcode on Intel processors ++ * belonging to IA-32 family - PentiumPro, Pentium II, ++ * Pentium III, Xeon, Pentium 4, etc. + * +- * This driver allows to upgrade microcode on Intel processors +- * belonging to IA-32 family - PentiumPro, Pentium II, +- * Pentium III, Xeon, Pentium 4, etc. ++ * Reference: Section 8.11 of Volume 3a, IA-32 Intel? Architecture ++ * Software Developer's Manual ++ * Order Number 253668 or free download from: + * +- * Reference: Section 8.10 of Volume III, Intel Pentium 4 Manual, +- * Order Number 245472 or free download from: +- * +- * http://developer.intel.com/design/pentium4/manuals/245472.htm ++ * http://developer.intel.com/design/pentium4/manuals/253668.htm + * +- * For more information, go to http://www.urbanmyth.org/microcode ++ * For more information, go to http://www.urbanmyth.org/microcode + * +- * This program is free software; you can redistribute it and/or +- * modify it under the terms of the GNU General Public License +- * as published by the Free Software Foundation; either version +- * 2 of the License, or (at your option) any later version. ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. + * +- * 1.0 16 Feb 2000, Tigran Aivazian +- * Initial release. +- * 1.01 18 Feb 2000, Tigran Aivazian +- * Added read() support + cleanups. +- * 1.02 21 Feb 2000, Tigran Aivazian +- * Added 'device trimming' support. open(O_WRONLY) zeroes +- * and frees the saved copy of applied microcode. +- * 1.03 29 Feb 2000, Tigran Aivazian +- * Made to use devfs (/dev/cpu/microcode) + cleanups. +- * 1.04 06 Jun 2000, Simon Trimmer +- * Added misc device support (now uses both devfs and misc). +- * Added MICROCODE_IOCFREE ioctl to clear memory. +- * 1.05 09 Jun 2000, Simon Trimmer +- * Messages for error cases (non Intel & no suitable microcode). +- * 1.06 03 Aug 2000, Tigran Aivazian +- * Removed ->release(). Removed exclusive open and status bitmap. +- * Added microcode_rwsem to serialize read()/write()/ioctl(). +- * Removed global kernel lock usage. +- * 1.07 07 Sep 2000, Tigran Aivazian +- * Write 0 to 0x8B msr and then cpuid before reading revision, +- * so that it works even if there were no update done by the +- * BIOS. Otherwise, reading from 0x8B gives junk (which happened +- * to be 0 on my machine which is why it worked even when I +- * disabled update by the BIOS) +- * Thanks to Eric W. Biederman for the fix. +- * 1.08 11 Dec 2000, Richard Schaal and +- * Tigran Aivazian +- * Intel Pentium 4 processor support and bugfixes. +- * 1.09 30 Oct 2001, Tigran Aivazian +- * Bugfix for HT (Hyper-Threading) enabled processors +- * whereby processor resources are shared by all logical processors +- * in a single CPU package. +- * 1.10 28 Feb 2002 Asit K Mallick and +- * Tigran Aivazian , +- * Serialize updates as required on HT processors due to speculative +- * nature of implementation. +- * 1.11 22 Mar 2002 Tigran Aivazian +- * Fix the panic when writing zero-length microcode chunk. +- * 1.12 29 Sep 2003 Nitin Kamble , +- * Jun Nakajima +- * Support for the microcode updates in the new format. +- * 1.13 10 Oct 2003 Tigran Aivazian +- * Removed ->read() method and obsoleted MICROCODE_IOCFREE ioctl +- * because we no longer hold a copy of applied microcode +- * in kernel memory. +- * 1.14 25 Jun 2004 Tigran Aivazian +- * Fix sigmatch() macro to handle old CPUs with pf == 0. +- * Thanks to Stuart Swales for pointing out this bug. ++ * 1.0 16 Feb 2000, Tigran Aivazian ++ * Initial release. ++ * 1.01 18 Feb 2000, Tigran Aivazian ++ * Added read() support + cleanups. ++ * 1.02 21 Feb 2000, Tigran Aivazian ++ * Added 'device trimming' support. open(O_WRONLY) zeroes ++ * and frees the saved copy of applied microcode. ++ * 1.03 29 Feb 2000, Tigran Aivazian ++ * Made to use devfs (/dev/cpu/microcode) + cleanups. ++ * 1.04 06 Jun 2000, Simon Trimmer ++ * Added misc device support (now uses both devfs and misc). ++ * Added MICROCODE_IOCFREE ioctl to clear memory. ++ * 1.05 09 Jun 2000, Simon Trimmer ++ * Messages for error cases (non Intel & no suitable microcode). ++ * 1.06 03 Aug 2000, Tigran Aivazian ++ * Removed ->release(). Removed exclusive open and status bitmap. ++ * Added microcode_rwsem to serialize read()/write()/ioctl(). ++ * Removed global kernel lock usage. ++ * 1.07 07 Sep 2000, Tigran Aivazian ++ * Write 0 to 0x8B msr and then cpuid before reading revision, ++ * so that it works even if there were no update done by the ++ * BIOS. Otherwise, reading from 0x8B gives junk (which happened ++ * to be 0 on my machine which is why it worked even when I ++ * disabled update by the BIOS) ++ * Thanks to Eric W. Biederman for the fix. ++ * 1.08 11 Dec 2000, Richard Schaal and ++ * Tigran Aivazian ++ * Intel Pentium 4 processor support and bugfixes. ++ * 1.09 30 Oct 2001, Tigran Aivazian ++ * Bugfix for HT (Hyper-Threading) enabled processors ++ * whereby processor resources are shared by all logical processors ++ * in a single CPU package. ++ * 1.10 28 Feb 2002 Asit K Mallick and ++ * Tigran Aivazian , ++ * Serialize updates as required on HT processors due to ++ * speculative nature of implementation. ++ * 1.11 22 Mar 2002 Tigran Aivazian ++ * Fix the panic when writing zero-length microcode chunk. ++ * 1.12 29 Sep 2003 Nitin Kamble , ++ * Jun Nakajima ++ * Support for the microcode updates in the new format. ++ * 1.13 10 Oct 2003 Tigran Aivazian ++ * Removed ->read() method and obsoleted MICROCODE_IOCFREE ioctl ++ * because we no longer hold a copy of applied microcode ++ * in kernel memory. ++ * 1.14 25 Jun 2004 Tigran Aivazian ++ * Fix sigmatch() macro to handle old CPUs with pf == 0. ++ * Thanks to Stuart Swales for pointing out this bug. + */ + + #include +@@ -76,381 +77,144 @@ + #include + #include + #include ++#include + + #include + #include + #include + #include +- +-#define pr_debug(x...) ((void)0) +-#define DEFINE_MUTEX(_m) DEFINE_SPINLOCK(_m) +-#define mutex_lock(_m) spin_lock(_m) +-#define mutex_unlock(_m) spin_unlock(_m) +-#define vmalloc(_s) xmalloc_bytes(_s) +-#define vfree(_p) xfree(_p) +- +-#if 0 +-MODULE_DESCRIPTION("Intel CPU (IA-32) Microcode Update Driver"); +-MODULE_AUTHOR("Tigran Aivazian "); +-MODULE_LICENSE("GPL"); +-#endif ++#include + + static int verbose; + boolean_param("microcode.verbose", verbose); + +-#define MICROCODE_VERSION "1.14a" ++const struct microcode_ops *microcode_ops; + +-#define DEFAULT_UCODE_DATASIZE (2000) /* 2000 bytes */ +-#define MC_HEADER_SIZE (sizeof (microcode_header_t)) /* 48 bytes */ +-#define DEFAULT_UCODE_TOTALSIZE (DEFAULT_UCODE_DATASIZE + MC_HEADER_SIZE) /* 2048 bytes */ +-#define EXT_HEADER_SIZE (sizeof (struct extended_sigtable)) /* 20 bytes */ +-#define EXT_SIGNATURE_SIZE (sizeof (struct extended_signature)) /* 12 bytes */ +-#define DWSIZE (sizeof (u32)) +-#define get_totalsize(mc) \ +- (((microcode_t *)mc)->hdr.totalsize ? \ +- ((microcode_t *)mc)->hdr.totalsize : DEFAULT_UCODE_TOTALSIZE) +-#define get_datasize(mc) \ +- (((microcode_t *)mc)->hdr.datasize ? \ +- ((microcode_t *)mc)->hdr.datasize : DEFAULT_UCODE_DATASIZE) +- +-#define sigmatch(s1, s2, p1, p2) \ +- (((s1) == (s2)) && (((p1) & (p2)) || (((p1) == 0) && ((p2) == 0)))) +- +-#define exttable_size(et) ((et)->count * EXT_SIGNATURE_SIZE + EXT_HEADER_SIZE) +- +-/* serialize access to the physical write to MSR 0x79 */ +-static DEFINE_SPINLOCK(microcode_update_lock); +- +-/* no concurrent ->write()s are allowed on /dev/cpu/microcode */ +-static DEFINE_MUTEX(microcode_mutex); +- +-static const void __user *user_buffer; /* user area microcode data buffer */ +-static unsigned int user_buffer_size; /* it's size */ +- +-typedef enum mc_error_code { +- MC_SUCCESS = 0, +- MC_IGNORED = 1, +- MC_NOTFOUND = 2, +- MC_MARKED = 3, +- MC_ALLOCATED = 4, +-} mc_error_code_t; +- +-static struct ucode_cpu_info { +- unsigned int sig; +- unsigned int pf, orig_pf; +- unsigned int rev; +- unsigned int cksum; +- mc_error_code_t err; +- microcode_t *mc; +-} ucode_cpu_info[NR_CPUS]; +- +-static void collect_cpu_info (void *unused) +-{ +- int cpu_num = smp_processor_id(); +- struct cpuinfo_x86 *c = cpu_data + cpu_num; +- struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; +- unsigned int val[2]; +- +- uci->sig = uci->pf = uci->rev = uci->cksum = 0; +- uci->err = MC_NOTFOUND; +- uci->mc = NULL; +- +- if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 || +- cpu_has(c, X86_FEATURE_IA64)) { +- printk(KERN_ERR "microcode: CPU%d not a capable Intel processor\n", cpu_num); +- return; +- } else { +- uci->sig = cpuid_eax(0x00000001); ++static DEFINE_SPINLOCK(microcode_mutex); + +- if ((c->x86_model >= 5) || (c->x86 > 6)) { +- /* get processor flags from MSR 0x17 */ +- rdmsr(MSR_IA32_PLATFORM_ID, val[0], val[1]); +- uci->pf = 1 << ((val[1] >> 18) & 7); +- } +- uci->orig_pf = uci->pf; +- } ++struct ucode_cpu_info ucode_cpu_info[NR_CPUS]; ++ ++struct microcode_buffer { ++ void *buf; ++ size_t size; ++}; ++ ++static struct microcode_buffer microcode_buffer; ++static bool_t microcode_error; + +- wrmsr(MSR_IA32_UCODE_REV, 0, 0); +- /* see notes above for revision 1.07. Apparent chip bug */ +- sync_core(); +- /* get the current revision from MSR 0x8B */ +- rdmsr(MSR_IA32_UCODE_REV, val[0], uci->rev); +- pr_debug("microcode: collect_cpu_info : sig=0x%x, pf=0x%x, rev=0x%x\n", +- uci->sig, uci->pf, uci->rev); ++static void microcode_fini_cpu(int cpu) ++{ ++ struct ucode_cpu_info *uci = ucode_cpu_info + cpu; ++ ++ spin_lock(µcode_mutex); ++ microcode_ops->microcode_fini_cpu(cpu); ++ uci->valid = 0; ++ spin_unlock(µcode_mutex); + } + +-static inline void mark_microcode_update (int cpu_num, microcode_header_t *mc_header, int sig, int pf, int cksum) ++static int collect_cpu_info(int cpu) + { +- struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; ++ int err = 0; ++ struct ucode_cpu_info *uci = ucode_cpu_info + cpu; + +- pr_debug("Microcode Found.\n"); +- pr_debug(" Header Revision 0x%x\n", mc_header->hdrver); +- pr_debug(" Loader Revision 0x%x\n", mc_header->ldrver); +- pr_debug(" Revision 0x%x \n", mc_header->rev); +- pr_debug(" Date %x/%x/%x\n", +- ((mc_header->date >> 24 ) & 0xff), +- ((mc_header->date >> 16 ) & 0xff), +- (mc_header->date & 0xFFFF)); +- pr_debug(" Signature 0x%x\n", sig); +- pr_debug(" Type 0x%x Family 0x%x Model 0x%x Stepping 0x%x\n", +- ((sig >> 12) & 0x3), +- ((sig >> 8) & 0xf), +- ((sig >> 4) & 0xf), +- ((sig & 0xf))); +- pr_debug(" Processor Flags 0x%x\n", pf); +- pr_debug(" Checksum 0x%x\n", cksum); +- +- if (mc_header->rev < uci->rev) { +- if (uci->err == MC_NOTFOUND) { +- uci->err = MC_IGNORED; +- uci->cksum = mc_header->rev; +- } else if (uci->err == MC_IGNORED && uci->cksum < mc_header->rev) +- uci->cksum = mc_header->rev; +- } else if (mc_header->rev == uci->rev) { +- if (uci->err < MC_MARKED) { +- /* notify the caller of success on this cpu */ +- uci->err = MC_SUCCESS; +- } +- } else if (uci->err != MC_ALLOCATED || mc_header->rev > uci->mc->hdr.rev) { +- pr_debug("microcode: CPU%d found a matching microcode update with " +- " revision 0x%x (current=0x%x)\n", cpu_num, mc_header->rev, uci->rev); +- uci->cksum = cksum; +- uci->pf = pf; /* keep the original mc pf for cksum calculation */ +- uci->err = MC_MARKED; /* found the match */ +- for_each_online_cpu(cpu_num) { +- if (ucode_cpu_info + cpu_num != uci +- && ucode_cpu_info[cpu_num].mc == uci->mc) { +- uci->mc = NULL; +- break; +- } +- } +- if (uci->mc != NULL) { +- vfree(uci->mc); +- uci->mc = NULL; +- } +- } +- return; ++ memset(uci, 0, sizeof(*uci)); ++ err = microcode_ops->collect_cpu_info(cpu, &uci->cpu_sig); ++ if (!err) ++ uci->valid = 1; ++ ++ return err; + } + +-static int find_matching_ucodes (void) ++static int microcode_resume_cpu(int cpu) + { +- int cursor = 0; +- int error = 0; ++ int err = 0; ++ struct ucode_cpu_info *uci = ucode_cpu_info + cpu; ++ struct cpu_signature nsig; ++ ++ gdprintk(XENLOG_INFO, "microcode: CPU%d resumed\n", cpu); ++ ++ if (!uci->mc.valid_mc) ++ return -EIO; ++ ++ /* ++ * Let's verify that the 'cached' ucode does belong ++ * to this cpu (a bit of paranoia): ++ */ ++ err = microcode_ops->collect_cpu_info(cpu, &nsig); ++ if (err) { ++ microcode_fini_cpu(cpu); ++ return err; ++ } + +- while (cursor + MC_HEADER_SIZE < user_buffer_size) { +- microcode_header_t mc_header; +- void *newmc = NULL; +- int i, sum, cpu_num, allocated_flag, total_size, data_size, ext_table_size; +- +- if (copy_from_user(&mc_header, user_buffer + cursor, MC_HEADER_SIZE)) { +- printk(KERN_ERR "microcode: error! Can not read user data\n"); +- error = -EFAULT; +- goto out; +- } ++ if (memcmp(&nsig, &uci->cpu_sig, sizeof(nsig))) { ++ microcode_fini_cpu(cpu); ++ /* Should we look for a new ucode here? */ ++ return -EIO; ++ } + +- total_size = get_totalsize(&mc_header); +- if (cursor + total_size > user_buffer_size) { +- printk(KERN_ERR "microcode: error! Bad data in microcode data file\n"); +- error = -EINVAL; +- goto out; +- } ++ err = microcode_ops->apply_microcode(cpu); + +- data_size = get_datasize(&mc_header); +- if (data_size + MC_HEADER_SIZE > total_size) { +- printk(KERN_ERR "microcode: error! Bad data in microcode data file\n"); +- error = -EINVAL; +- goto out; +- } ++ return err; ++} + +- if (mc_header.ldrver != 1 || mc_header.hdrver != 1) { +- printk(KERN_ERR "microcode: error! Unknown microcode update format\n"); +- error = -EINVAL; +- goto out; +- } ++static int microcode_update_cpu(int cpu, const void *buf, size_t size) ++{ ++ int err = 0; ++ struct ucode_cpu_info *uci = ucode_cpu_info + cpu; + +- for_each_online_cpu(cpu_num) { +- struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; ++ /* We should bind the task to the CPU */ ++ BUG_ON(raw_smp_processor_id() != cpu); + +- if (sigmatch(mc_header.sig, uci->sig, mc_header.pf, uci->orig_pf)) +- mark_microcode_update(cpu_num, &mc_header, mc_header.sig, mc_header.pf, mc_header.cksum); ++ spin_lock(µcode_mutex); ++ /* ++ * Check if the system resume is in progress (uci->valid != NULL), ++ * otherwise just request a firmware: ++ */ ++ if (uci->valid) { ++ err = microcode_resume_cpu(cpu); ++ } else { ++ err = collect_cpu_info(cpu); ++ if (err) ++ goto out; ++ if (uci->valid) { ++ err = microcode_ops->cpu_request_microcode(cpu, buf, size); + } ++ } + +- ext_table_size = total_size - (MC_HEADER_SIZE + data_size); +- if (ext_table_size) { +- struct extended_sigtable ext_header; +- struct extended_signature ext_sig; +- int ext_sigcount; +- +- if ((ext_table_size < EXT_HEADER_SIZE) +- || ((ext_table_size - EXT_HEADER_SIZE) % EXT_SIGNATURE_SIZE)) { +- printk(KERN_ERR "microcode: error! Bad data in microcode data file\n"); +- error = -EINVAL; +- goto out; +- } +- if (copy_from_user(&ext_header, user_buffer + cursor +- + MC_HEADER_SIZE + data_size, EXT_HEADER_SIZE)) { +- printk(KERN_ERR "microcode: error! Can not read user data\n"); +- error = -EFAULT; +- goto out; +- } +- if (ext_table_size != exttable_size(&ext_header)) { +- printk(KERN_ERR "microcode: error! Bad data in microcode data file\n"); +- error = -EFAULT; +- goto out; +- } +- +- ext_sigcount = ext_header.count; +- +- for (i = 0; i < ext_sigcount; i++) { +- if (copy_from_user(&ext_sig, user_buffer + cursor + MC_HEADER_SIZE + data_size + EXT_HEADER_SIZE +- + EXT_SIGNATURE_SIZE * i, EXT_SIGNATURE_SIZE)) { +- printk(KERN_ERR "microcode: error! Can not read user data\n"); +- error = -EFAULT; +- goto out; +- } +- for_each_online_cpu(cpu_num) { +- struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; +- +- if (sigmatch(ext_sig.sig, uci->sig, ext_sig.pf, uci->orig_pf)) { +- mark_microcode_update(cpu_num, &mc_header, ext_sig.sig, ext_sig.pf, ext_sig.cksum); +- } +- } +- } +- } +- /* now check if any cpu has matched */ +- allocated_flag = 0; +- sum = 0; +- for_each_online_cpu(cpu_num) { +- if (ucode_cpu_info[cpu_num].err == MC_MARKED) { +- struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; +- if (!allocated_flag) { +- allocated_flag = 1; +- newmc = vmalloc(total_size); +- if (!newmc) { +- printk(KERN_ERR "microcode: error! Can not allocate memory\n"); +- error = -ENOMEM; +- goto out; +- } +- if (copy_from_user(newmc + MC_HEADER_SIZE, +- user_buffer + cursor + MC_HEADER_SIZE, +- total_size - MC_HEADER_SIZE)) { +- printk(KERN_ERR "microcode: error! Can not read user data\n"); +- vfree(newmc); +- error = -EFAULT; +- goto out; +- } +- memcpy(newmc, &mc_header, MC_HEADER_SIZE); +- /* check extended table checksum */ +- if (ext_table_size) { +- int ext_table_sum = 0; +- int * ext_tablep = (((void *) newmc) + MC_HEADER_SIZE + data_size); +- i = ext_table_size / DWSIZE; +- while (i--) ext_table_sum += ext_tablep[i]; +- if (ext_table_sum) { +- printk(KERN_WARNING "microcode: aborting, bad extended signature table checksum\n"); +- vfree(newmc); +- error = -EINVAL; +- goto out; +- } +- } +- +- /* calculate the checksum */ +- i = (MC_HEADER_SIZE + data_size) / DWSIZE; +- while (i--) sum += ((int *)newmc)[i]; +- sum -= (mc_header.sig + mc_header.pf + mc_header.cksum); +- } +- ucode_cpu_info[cpu_num].mc = newmc; +- ucode_cpu_info[cpu_num].err = MC_ALLOCATED; /* mc updated */ +- if (sum + uci->sig + uci->pf + uci->cksum != 0) { +- printk(KERN_ERR "microcode: CPU%d aborting, bad checksum\n", cpu_num); +- error = -EINVAL; +- goto out; +- } +- } +- } +- cursor += total_size; /* goto the next update patch */ +- } /* end of while */ + out: +- return error; ++ spin_unlock(µcode_mutex); ++ ++ return err; + } + +-static void do_update_one (void * unused) ++static void do_microcode_update_one(void *info) + { +- unsigned long flags; +- unsigned int val[2]; +- int cpu_num = smp_processor_id(); +- struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; +- +- if (uci->mc == NULL) { +- if (verbose) { +- if (uci->err == MC_SUCCESS) +- printk(KERN_INFO "microcode: CPU%d already at revision 0x%x\n", +- cpu_num, uci->rev); +- else +- printk(KERN_INFO "microcode: No new microcode data for CPU%d\n", cpu_num); +- } +- return; +- } ++ int error = 0; + +- /* serialize access to the physical write to MSR 0x79 */ +- spin_lock_irqsave(µcode_update_lock, flags); ++ error = microcode_update_cpu(smp_processor_id(), ++ microcode_buffer.buf, microcode_buffer.size); + +- /* write microcode via MSR 0x79 */ +- wrmsr(MSR_IA32_UCODE_WRITE, +- (unsigned long) uci->mc->bits, +- (unsigned long) uci->mc->bits >> 16 >> 16); +- wrmsr(MSR_IA32_UCODE_REV, 0, 0); +- +- /* see notes above for revision 1.07. Apparent chip bug */ +- sync_core(); +- +- /* get the current revision from MSR 0x8B */ +- rdmsr(MSR_IA32_UCODE_REV, val[0], val[1]); +- +- /* notify the caller of success on this cpu */ +- uci->err = MC_SUCCESS; +- spin_unlock_irqrestore(µcode_update_lock, flags); +- printk(KERN_INFO "microcode: CPU%d updated from revision " +- "0x%x to 0x%x, date = %08x \n", +- cpu_num, uci->rev, val[1], uci->mc->hdr.date); +- return; ++ if (error) ++ microcode_error = error; + } + +-static int do_microcode_update (void) ++static int do_microcode_update(void) + { +- int i, error; ++ int error = 0; ++ ++ microcode_error = 0; + +- if (on_each_cpu(collect_cpu_info, NULL, 1, 1) != 0) { ++ if (on_each_cpu(do_microcode_update_one, NULL, 1, 1) != 0) { + printk(KERN_ERR "microcode: Error! Could not run on all processors\n"); + error = -EIO; + goto out; + } + +- if ((error = find_matching_ucodes())) { +- printk(KERN_ERR "microcode: Error in the microcode data\n"); +- goto out_free; +- } +- +- if (on_each_cpu(do_update_one, NULL, 1, 1) != 0) { +- printk(KERN_ERR "microcode: Error! Could not run on all processors\n"); +- error = -EIO; ++ if (microcode_error) { ++ error = microcode_error; ++ goto out; + } + +-out_free: +- for_each_online_cpu(i) { +- if (ucode_cpu_info[i].mc) { +- int j; +- void *tmp = ucode_cpu_info[i].mc; +- vfree(tmp); +- for_each_online_cpu(j) { +- if (ucode_cpu_info[j].mc == tmp) +- ucode_cpu_info[j].mc = NULL; +- } +- } +- if (ucode_cpu_info[i].err == MC_IGNORED && verbose) +- printk(KERN_WARNING "microcode: CPU%d not 'upgrading' to earlier revision" +- " 0x%x (current=0x%x)\n", i, ucode_cpu_info[i].cksum, ucode_cpu_info[i].rev); +- } + out: + return error; + } +@@ -458,20 +222,46 @@ out: + int microcode_update(XEN_GUEST_HANDLE(const_void) buf, unsigned long len) + { + int ret; ++ struct cpuinfo_x86 *c = &boot_cpu_data; + +- if (len != (typeof(user_buffer_size))len) { ++ if (len != (typeof(microcode_buffer.size))len) { + printk(KERN_ERR "microcode: too much data\n"); + return -E2BIG; + } + +- mutex_lock(µcode_mutex); ++ switch (c->x86_vendor) { ++ case X86_VENDOR_AMD: ++ ret = microcode_init_amd(c); ++ break; ++ ++ case X86_VENDOR_INTEL: ++ ret = microcode_init_intel(c); ++ break; ++ default: ++ printk(KERN_ERR "microcode: CPU vendor not supported\n"); ++ ret = -EINVAL; ++ break; ++ } ++ ++ if (ret != 0) ++ return ret; ++ ++ microcode_buffer.buf = xmalloc_array(uint8_t, len); ++ if (!microcode_buffer.buf) ++ return -ENOMEM; ++ ++ ret = copy_from_guest(microcode_buffer.buf, buf, len); ++ if (ret != 0) ++ return ret; + +- user_buffer = buf.p; +- user_buffer_size = len; ++ microcode_buffer.size = len; ++ wmb(); + + ret = do_microcode_update(); + +- mutex_unlock(µcode_mutex); ++ xfree(microcode_buffer.buf); ++ microcode_buffer.buf = NULL; ++ microcode_buffer.size = 0; + + return ret; + } +Index: xen-3.3.1-testing/xen/include/asm-x86/msr-index.h +=================================================================== +--- xen-3.3.1-testing.orig/xen/include/asm-x86/msr-index.h ++++ xen-3.3.1-testing/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 +Index: xen-3.3.1-testing/xen/include/asm-x86/processor.h +=================================================================== +--- xen-3.3.1-testing.orig/xen/include/asm-x86/processor.h ++++ xen-3.3.1-testing/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) + { +Index: xen-3.3.1-testing/xen/arch/x86/microcode_amd.c +=================================================================== +--- /dev/null ++++ xen-3.3.1-testing/xen/arch/x86/microcode_amd.c +@@ -0,0 +1,366 @@ ++/* ++ * AMD CPU Microcode Update Driver for Linux ++ * Copyright (C) 2008 Advanced Micro Devices Inc. ++ * ++ * Author: Peter Oruba ++ * ++ * Based on work by: ++ * Tigran Aivazian ++ * ++ * This driver allows to upgrade microcode on AMD ++ * family 0x10 and 0x11 processors. ++ * ++ * Licensed unter the terms of the GNU General Public ++ * License version 2. See file COPYING for details. ++*/ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++ ++ ++#define pr_debug(x...) ((void)0) ++#define DEFINE_MUTEX(_m) DEFINE_SPINLOCK(_m) ++#define mutex_lock(_m) spin_lock(_m) ++#define mutex_unlock(_m) spin_unlock(_m) ++#define vmalloc(_s) xmalloc_bytes(_s) ++#define vfree(_p) xfree(_p) ++ ++ ++#define UCODE_MAGIC 0x00414d44 ++#define UCODE_EQUIV_CPU_TABLE_TYPE 0x00000000 ++#define UCODE_UCODE_TYPE 0x00000001 ++ ++#define UCODE_MAX_SIZE (2048) ++#define DEFAULT_UCODE_DATASIZE (896) ++#define MC_HEADER_SIZE (sizeof(struct microcode_header_amd)) ++#define DEFAULT_UCODE_TOTALSIZE (DEFAULT_UCODE_DATASIZE + MC_HEADER_SIZE) ++#define DWSIZE (sizeof(uint32_t)) ++/* For now we support a fixed ucode total size only */ ++#define get_totalsize(mc) \ ++ ((((struct microcode_amd *)mc)->hdr.mc_patch_data_len * 28) \ ++ + MC_HEADER_SIZE) ++ ++/* serialize access to the physical write */ ++static DEFINE_SPINLOCK(microcode_update_lock); ++ ++struct equiv_cpu_entry *equiv_cpu_table; ++ ++static long install_equiv_cpu_table(const void *, uint32_t, long); ++ ++static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig) ++{ ++ struct cpuinfo_x86 *c = &cpu_data[cpu]; ++ ++ memset(csig, 0, sizeof(*csig)); ++ ++ if (c->x86_vendor != X86_VENDOR_AMD || c->x86 < 0x10) { ++ printk(KERN_ERR "microcode: CPU%d not a capable AMD processor\n", ++ cpu); ++ return -1; ++ } ++ ++ asm volatile("movl %1, %%ecx; rdmsr" ++ : "=a" (csig->rev) ++ : "i" (MSR_AMD_PATCHLEVEL) : "ecx"); ++ ++ printk(KERN_INFO "microcode: collect_cpu_info_amd : patch_id=0x%x\n", ++ csig->rev); ++ ++ return 0; ++} ++ ++static int get_matching_microcode_amd(void *mc, int cpu) ++{ ++ struct ucode_cpu_info *uci = ucode_cpu_info + cpu; ++ struct microcode_header_amd *mc_header = mc; ++ unsigned long total_size = get_totalsize(mc_header); ++ void *new_mc; ++ unsigned int current_cpu_id; ++ unsigned int equiv_cpu_id = 0x00; ++ unsigned int i = 0; ++ ++ /* We should bind the task to the CPU */ ++ BUG_ON(cpu != raw_smp_processor_id()); ++ ++ /* This is a tricky part. We might be called from a write operation ++ * to the device file instead of the usual process of firmware ++ * loading. This routine needs to be able to distinguish both ++ * cases. This is done by checking if there already is a equivalent ++ * CPU table installed. If not, we're written through ++ * /dev/cpu/microcode. ++ * Since we ignore all checks. The error case in which going through ++ * firmware loading and that table is not loaded has already been ++ * checked earlier. ++ */ ++ if (equiv_cpu_table == NULL) { ++ printk(KERN_INFO "microcode: CPU%d microcode update with " ++ "version 0x%x (current=0x%x)\n", ++ cpu, mc_header->patch_id, uci->cpu_sig.rev); ++ goto out; ++ } ++ ++ current_cpu_id = cpuid_eax(0x00000001); ++ ++ while (equiv_cpu_table[i].installed_cpu != 0) { ++ if (current_cpu_id == equiv_cpu_table[i].installed_cpu) { ++ equiv_cpu_id = equiv_cpu_table[i].equiv_cpu; ++ break; ++ } ++ i++; ++ } ++ ++ if (!equiv_cpu_id) { ++ printk(KERN_ERR "microcode: CPU%d cpu_id " ++ "not found in equivalent cpu table \n", cpu); ++ return 0; ++ } ++ ++ if ((mc_header->processor_rev_id[0]) != (equiv_cpu_id & 0xff)) { ++ printk(KERN_INFO ++ "microcode: CPU%d patch does not match " ++ "(patch is %x, cpu extended is %x) \n", ++ cpu, mc_header->processor_rev_id[0], ++ (equiv_cpu_id & 0xff)); ++ return 0; ++ } ++ ++ if ((mc_header->processor_rev_id[1]) != ((equiv_cpu_id >> 16) & 0xff)) { ++ printk(KERN_INFO "microcode: CPU%d patch does not match " ++ "(patch is %x, cpu base id is %x) \n", ++ cpu, mc_header->processor_rev_id[1], ++ ((equiv_cpu_id >> 16) & 0xff)); ++ ++ return 0; ++ } ++ ++ if (mc_header->patch_id <= uci->cpu_sig.rev) ++ return 0; ++ ++ printk(KERN_INFO "microcode: CPU%d found a matching microcode " ++ "update with version 0x%x (current=0x%x)\n", ++ cpu, mc_header->patch_id, uci->cpu_sig.rev); ++ ++out: ++ new_mc = vmalloc(UCODE_MAX_SIZE); ++ if (!new_mc) { ++ printk(KERN_ERR "microcode: error, can't allocate memory\n"); ++ return -ENOMEM; ++ } ++ memset(new_mc, 0, UCODE_MAX_SIZE); ++ ++ /* free previous update file */ ++ vfree(uci->mc.mc_amd); ++ ++ memcpy(new_mc, mc, total_size); ++ ++ uci->mc.mc_amd = new_mc; ++ return 1; ++} ++ ++static int apply_microcode_amd(int cpu) ++{ ++ unsigned long flags; ++ unsigned int eax, edx; ++ unsigned int rev; ++ int cpu_num = raw_smp_processor_id(); ++ struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; ++ unsigned long addr; ++ ++ /* We should bind the task to the CPU */ ++ BUG_ON(cpu_num != cpu); ++ ++ if (uci->mc.mc_amd == NULL) ++ return -EINVAL; ++ ++ spin_lock_irqsave(µcode_update_lock, flags); ++ ++ addr = (unsigned long)&uci->mc.mc_amd->hdr.data_code; ++ edx = (unsigned int)((unsigned long)(addr >> 32)); ++ eax = (unsigned int)((unsigned long)(addr & 0xffffffff)); ++ ++ asm volatile("movl %0, %%ecx; wrmsr" : ++ : "i" (MSR_AMD_PATCHLOADER), "a" (eax), "d" (edx) : "ecx"); ++ ++ /* get patch id after patching */ ++ asm volatile("movl %1, %%ecx; rdmsr" ++ : "=a" (rev) ++ : "i" (MSR_AMD_PATCHLEVEL) : "ecx"); ++ ++ spin_unlock_irqrestore(µcode_update_lock, flags); ++ ++ /* check current patch id and patch's id for match */ ++ if (rev != uci->mc.mc_amd->hdr.patch_id) { ++ printk(KERN_ERR "microcode: CPU%d update from revision " ++ "0x%x to 0x%x failed\n", cpu_num, ++ uci->mc.mc_amd->hdr.patch_id, rev); ++ return -EIO; ++ } ++ ++ printk("microcode: CPU%d updated from revision " ++ "0x%x to 0x%x \n", ++ cpu_num, uci->cpu_sig.rev, uci->mc.mc_amd->hdr.patch_id); ++ ++ uci->cpu_sig.rev = rev; ++ ++ return 0; ++} ++ ++static long get_next_ucode_from_buffer_amd(void **mc, const void *buf, ++ unsigned long size, long offset) ++{ ++ struct microcode_header_amd *mc_header; ++ unsigned long total_size; ++ const uint8_t *buf_pos = buf; ++ ++ /* No more data */ ++ if (offset >= size) ++ return 0; ++ ++ if (buf_pos[offset] != UCODE_UCODE_TYPE) { ++ printk(KERN_ERR "microcode: error! " ++ "Wrong microcode payload type field\n"); ++ return -EINVAL; ++ } ++ ++ mc_header = (struct microcode_header_amd *)(&buf_pos[offset+8]); ++ ++ total_size = (unsigned long) (buf_pos[offset+4] + ++ (buf_pos[offset+5] << 8)); ++ ++ printk(KERN_INFO "microcode: size %lu, total_size %lu, offset %ld\n", ++ size, total_size, offset); ++ ++ if (offset + total_size > size) { ++ printk(KERN_ERR "microcode: error! Bad data in microcode data file\n"); ++ return -EINVAL; ++ } ++ ++ *mc = vmalloc(UCODE_MAX_SIZE); ++ if (!*mc) { ++ printk(KERN_ERR "microcode: error! " ++ "Can not allocate memory for microcode patch\n"); ++ return -ENOMEM; ++ } ++ ++ memset(*mc, 0, UCODE_MAX_SIZE); ++ memcpy(*mc, (const void *)(buf + offset + 8), total_size); ++ ++ return offset + total_size + 8; ++} ++ ++static long install_equiv_cpu_table(const void *buf, ++ uint32_t size, long offset) ++{ ++ const uint32_t *buf_pos = buf; ++ ++ /* No more data */ ++ if (offset >= size) ++ return 0; ++ ++ if (buf_pos[1] != UCODE_EQUIV_CPU_TABLE_TYPE) { ++ printk(KERN_ERR "microcode: error! " ++ "Wrong microcode equivalnet cpu table type field\n"); ++ return 0; ++ } ++ ++ if (size == 0) { ++ printk(KERN_ERR "microcode: error! " ++ "Wrong microcode equivalnet cpu table length\n"); ++ return 0; ++ } ++ ++ equiv_cpu_table = (struct equiv_cpu_entry *) vmalloc(size); ++ if (!equiv_cpu_table) { ++ printk(KERN_ERR "microcode: error, can't allocate memory for equiv CPU table\n"); ++ return 0; ++ } ++ ++ memset(equiv_cpu_table, 0, size); ++ memcpy(equiv_cpu_table, (const void *)&buf_pos[3], size); ++ ++ return size + 12; /* add header length */ ++} ++ ++static int cpu_request_microcode_amd(int cpu, const void *buf, ++ size_t size) ++{ ++ const uint32_t *buf_pos; ++ long offset = 0; ++ int error = 0; ++ void *mc; ++ ++ /* We should bind the task to the CPU */ ++ BUG_ON(cpu != raw_smp_processor_id()); ++ ++ buf_pos = (const uint32_t *)buf; ++ ++ if (buf_pos[0] != UCODE_MAGIC) { ++ printk(KERN_ERR "microcode: error! Wrong microcode patch file magic\n"); ++ return -EINVAL; ++ } ++ ++ offset = install_equiv_cpu_table(buf, (uint32_t)(buf_pos[2]), offset); ++ if (!offset) { ++ printk(KERN_ERR "microcode: installing equivalent cpu table failed\n"); ++ return -EINVAL; ++ } ++ ++ while ((offset = ++ get_next_ucode_from_buffer_amd(&mc, buf, size, offset)) > 0) { ++ error = get_matching_microcode_amd(mc, cpu); ++ if (error < 0) ++ break; ++ /* ++ * It's possible the data file has multiple matching ucode, ++ * lets keep searching till the latest version ++ */ ++ if (error == 1) { ++ apply_microcode_amd(cpu); ++ error = 0; ++ } ++ vfree(mc); ++ } ++ if (offset > 0) { ++ vfree(mc); ++ vfree(equiv_cpu_table); ++ equiv_cpu_table = NULL; ++ } ++ if (offset < 0) ++ error = offset; ++ ++ return error; ++} ++ ++static void microcode_fini_cpu_amd(int cpu) ++{ ++ struct ucode_cpu_info *uci = ucode_cpu_info + cpu; ++ ++ vfree(uci->mc.mc_amd); ++ uci->mc.mc_amd = NULL; ++} ++ ++static struct microcode_ops microcode_amd_ops = { ++ .get_matching_microcode = get_matching_microcode_amd, ++ .microcode_sanity_check = NULL, ++ .cpu_request_microcode = cpu_request_microcode_amd, ++ .collect_cpu_info = collect_cpu_info_amd, ++ .apply_microcode = apply_microcode_amd, ++ .microcode_fini_cpu = microcode_fini_cpu_amd, ++}; ++ ++int microcode_init_amd(struct cpuinfo_x86 *c) ++{ ++ microcode_ops = µcode_amd_ops; ++ return 0; ++} ++ +Index: xen-3.3.1-testing/xen/arch/x86/microcode_intel.c +=================================================================== +--- /dev/null ++++ xen-3.3.1-testing/xen/arch/x86/microcode_intel.c +@@ -0,0 +1,425 @@ ++/* ++ * Intel CPU Microcode Update Driver for Linux ++ * ++ * Copyright (C) 2000-2006 Tigran Aivazian ++ * 2006 Shaohua Li * ++ * This driver allows to upgrade microcode on Intel processors ++ * belonging to IA-32 family - PentiumPro, Pentium II, ++ * Pentium III, Xeon, Pentium 4, etc. ++ * ++ * Reference: Section 8.11 of Volume 3a, IA-32 Intel? Architecture ++ * Software Developer's Manual ++ * Order Number 253668 or free download from: ++ * ++ * http://developer.intel.com/design/pentium4/manuals/253668.htm ++ * ++ * For more information, go to http://www.urbanmyth.org/microcode ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ * ++ * 1.0 16 Feb 2000, Tigran Aivazian ++ * Initial release. ++ * 1.01 18 Feb 2000, Tigran Aivazian ++ * Added read() support + cleanups. ++ * 1.02 21 Feb 2000, Tigran Aivazian ++ * Added 'device trimming' support. open(O_WRONLY) zeroes ++ * and frees the saved copy of applied microcode. ++ * 1.03 29 Feb 2000, Tigran Aivazian ++ * Made to use devfs (/dev/cpu/microcode) + cleanups. ++ * 1.04 06 Jun 2000, Simon Trimmer ++ * Added misc device support (now uses both devfs and misc). ++ * Added MICROCODE_IOCFREE ioctl to clear memory. ++ * 1.05 09 Jun 2000, Simon Trimmer ++ * Messages for error cases (non Intel & no suitable microcode). ++ * 1.06 03 Aug 2000, Tigran Aivazian ++ * Removed ->release(). Removed exclusive open and status bitmap. ++ * Added microcode_rwsem to serialize read()/write()/ioctl(). ++ * Removed global kernel lock usage. ++ * 1.07 07 Sep 2000, Tigran Aivazian ++ * Write 0 to 0x8B msr and then cpuid before reading revision, ++ * so that it works even if there were no update done by the ++ * BIOS. Otherwise, reading from 0x8B gives junk (which happened ++ * to be 0 on my machine which is why it worked even when I ++ * disabled update by the BIOS) ++ * Thanks to Eric W. Biederman for the fix. ++ * 1.08 11 Dec 2000, Richard Schaal and ++ * Tigran Aivazian ++ * Intel Pentium 4 processor support and bugfixes. ++ * 1.09 30 Oct 2001, Tigran Aivazian ++ * Bugfix for HT (Hyper-Threading) enabled processors ++ * whereby processor resources are shared by all logical processors ++ * in a single CPU package. ++ * 1.10 28 Feb 2002 Asit K Mallick and ++ * Tigran Aivazian , ++ * Serialize updates as required on HT processors due to ++ * speculative nature of implementation. ++ * 1.11 22 Mar 2002 Tigran Aivazian ++ * Fix the panic when writing zero-length microcode chunk. ++ * 1.12 29 Sep 2003 Nitin Kamble , ++ * Jun Nakajima ++ * Support for the microcode updates in the new format. ++ * 1.13 10 Oct 2003 Tigran Aivazian ++ * Removed ->read() method and obsoleted MICROCODE_IOCFREE ioctl ++ * because we no longer hold a copy of applied microcode ++ * in kernel memory. ++ * 1.14 25 Jun 2004 Tigran Aivazian ++ * Fix sigmatch() macro to handle old CPUs with pf == 0. ++ * Thanks to Stuart Swales for pointing out this bug. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++ ++#define pr_debug(x...) ((void)0) ++#define DEFINE_MUTEX(_m) DEFINE_SPINLOCK(_m) ++#define mutex_lock(_m) spin_lock(_m) ++#define mutex_unlock(_m) spin_unlock(_m) ++#define vmalloc(_s) xmalloc_bytes(_s) ++#define vfree(_p) xfree(_p) ++ ++#if 0 ++MODULE_DESCRIPTION("Microcode Update Driver"); ++MODULE_AUTHOR("Tigran Aivazian "); ++MODULE_LICENSE("GPL"); ++#endif ++ ++#define DEFAULT_UCODE_DATASIZE (2000) ++#define MC_HEADER_SIZE (sizeof(struct microcode_header_intel)) ++#define DEFAULT_UCODE_TOTALSIZE (DEFAULT_UCODE_DATASIZE + MC_HEADER_SIZE) ++#define EXT_HEADER_SIZE (sizeof(struct extended_sigtable)) ++#define EXT_SIGNATURE_SIZE (sizeof(struct extended_signature)) ++#define DWSIZE (sizeof(u32)) ++#define get_totalsize(mc) \ ++ (((struct microcode_intel *)mc)->hdr.totalsize ? \ ++ ((struct microcode_intel *)mc)->hdr.totalsize : \ ++ DEFAULT_UCODE_TOTALSIZE) ++ ++#define get_datasize(mc) \ ++ (((struct microcode_intel *)mc)->hdr.datasize ? \ ++ ((struct microcode_intel *)mc)->hdr.datasize : DEFAULT_UCODE_DATASIZE) ++ ++#define sigmatch(s1, s2, p1, p2) \ ++ (((s1) == (s2)) && (((p1) & (p2)) || (((p1) == 0) && ((p2) == 0)))) ++ ++#define exttable_size(et) ((et)->count * EXT_SIGNATURE_SIZE + EXT_HEADER_SIZE) ++ ++/* serialize access to the physical write to MSR 0x79 */ ++static DEFINE_SPINLOCK(microcode_update_lock); ++ ++static int collect_cpu_info(int cpu_num, struct cpu_signature *csig) ++{ ++ struct cpuinfo_x86 *c = &cpu_data[cpu_num]; ++ unsigned int val[2]; ++ ++ memset(csig, 0, sizeof(*csig)); ++ ++ if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 || ++ cpu_has(c, X86_FEATURE_IA64)) { ++ printk(KERN_ERR "microcode: CPU%d not a capable Intel " ++ "processor\n", cpu_num); ++ return -1; ++ } ++ ++ csig->sig = cpuid_eax(0x00000001); ++ ++ if ((c->x86_model >= 5) || (c->x86 > 6)) { ++ /* get processor flags from MSR 0x17 */ ++ rdmsr(MSR_IA32_PLATFORM_ID, val[0], val[1]); ++ csig->pf = 1 << ((val[1] >> 18) & 7); ++ } ++ ++ wrmsr(MSR_IA32_UCODE_REV, 0, 0); ++ /* see notes above for revision 1.07. Apparent chip bug */ ++ sync_core(); ++ /* get the current revision from MSR 0x8B */ ++ rdmsr(MSR_IA32_UCODE_REV, val[0], csig->rev); ++ pr_debug("microcode: collect_cpu_info : sig=0x%x, pf=0x%x, rev=0x%x\n", ++ csig->sig, csig->pf, csig->rev); ++ ++ return 0; ++} ++ ++static inline int microcode_update_match(int cpu_num, ++ struct microcode_header_intel *mc_header, int sig, int pf) ++{ ++ struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; ++ ++ if (!sigmatch(sig, uci->cpu_sig.sig, pf, uci->cpu_sig.pf) ++ || mc_header->rev <= uci->cpu_sig.rev) ++ return 0; ++ return 1; ++} ++ ++static int microcode_sanity_check(void *mc) ++{ ++ struct microcode_header_intel *mc_header = mc; ++ struct extended_sigtable *ext_header = NULL; ++ struct extended_signature *ext_sig; ++ unsigned long total_size, data_size, ext_table_size; ++ int sum, orig_sum, ext_sigcount = 0, i; ++ ++ total_size = get_totalsize(mc_header); ++ data_size = get_datasize(mc_header); ++ if (data_size + MC_HEADER_SIZE > total_size) { ++ printk(KERN_ERR "microcode: error! " ++ "Bad data size in microcode data file\n"); ++ return -EINVAL; ++ } ++ ++ if (mc_header->ldrver != 1 || mc_header->hdrver != 1) { ++ printk(KERN_ERR "microcode: error! " ++ "Unknown microcode update format\n"); ++ return -EINVAL; ++ } ++ ext_table_size = total_size - (MC_HEADER_SIZE + data_size); ++ if (ext_table_size) { ++ if ((ext_table_size < EXT_HEADER_SIZE) ++ || ((ext_table_size - EXT_HEADER_SIZE) % EXT_SIGNATURE_SIZE)) { ++ printk(KERN_ERR "microcode: error! " ++ "Small exttable size in microcode data file\n"); ++ return -EINVAL; ++ } ++ ext_header = mc + MC_HEADER_SIZE + data_size; ++ if (ext_table_size != exttable_size(ext_header)) { ++ printk(KERN_ERR "microcode: error! " ++ "Bad exttable size in microcode data file\n"); ++ return -EFAULT; ++ } ++ ext_sigcount = ext_header->count; ++ } ++ ++ /* check extended table checksum */ ++ if (ext_table_size) { ++ int ext_table_sum = 0; ++ int *ext_tablep = (int *)ext_header; ++ ++ i = ext_table_size / DWSIZE; ++ while (i--) ++ ext_table_sum += ext_tablep[i]; ++ if (ext_table_sum) { ++ printk(KERN_WARNING "microcode: aborting, " ++ "bad extended signature table checksum\n"); ++ return -EINVAL; ++ } ++ } ++ ++ /* calculate the checksum */ ++ orig_sum = 0; ++ i = (MC_HEADER_SIZE + data_size) / DWSIZE; ++ while (i--) ++ orig_sum += ((int *)mc)[i]; ++ if (orig_sum) { ++ printk(KERN_ERR "microcode: aborting, bad checksum\n"); ++ return -EINVAL; ++ } ++ if (!ext_table_size) ++ return 0; ++ /* check extended signature checksum */ ++ for (i = 0; i < ext_sigcount; i++) { ++ ext_sig = (void *)ext_header + EXT_HEADER_SIZE + ++ EXT_SIGNATURE_SIZE * i; ++ sum = orig_sum ++ - (mc_header->sig + mc_header->pf + mc_header->cksum) ++ + (ext_sig->sig + ext_sig->pf + ext_sig->cksum); ++ if (sum) { ++ printk(KERN_ERR "microcode: aborting, bad checksum\n"); ++ return -EINVAL; ++ } ++ } ++ return 0; ++} ++ ++/* ++ * return 0 - no update found ++ * return 1 - found update ++ * return < 0 - error ++ */ ++static int get_matching_microcode(void *mc, int cpu) ++{ ++ struct ucode_cpu_info *uci = ucode_cpu_info + cpu; ++ struct microcode_header_intel *mc_header = mc; ++ struct extended_sigtable *ext_header; ++ unsigned long total_size = get_totalsize(mc_header); ++ int ext_sigcount, i; ++ struct extended_signature *ext_sig; ++ void *new_mc; ++ ++ if (microcode_update_match(cpu, mc_header, ++ mc_header->sig, mc_header->pf)) ++ goto find; ++ ++ if (total_size <= get_datasize(mc_header) + MC_HEADER_SIZE) ++ return 0; ++ ++ ext_header = mc + get_datasize(mc_header) + MC_HEADER_SIZE; ++ ext_sigcount = ext_header->count; ++ ext_sig = (void *)ext_header + EXT_HEADER_SIZE; ++ for (i = 0; i < ext_sigcount; i++) { ++ if (microcode_update_match(cpu, mc_header, ++ ext_sig->sig, ext_sig->pf)) ++ goto find; ++ ext_sig++; ++ } ++ return 0; ++find: ++ pr_debug("microcode: CPU%d found a matching microcode update with" ++ " version 0x%x (current=0x%x)\n", ++ cpu, mc_header->rev, uci->cpu_sig.rev); ++ new_mc = vmalloc(total_size); ++ if (!new_mc) { ++ printk(KERN_ERR "microcode: error! Can not allocate memory\n"); ++ return -ENOMEM; ++ } ++ ++ /* free previous update file */ ++ vfree(uci->mc.mc_intel); ++ ++ memcpy(new_mc, mc, total_size); ++ uci->mc.mc_intel = new_mc; ++ return 1; ++} ++ ++static int apply_microcode(int cpu) ++{ ++ unsigned long flags; ++ unsigned int val[2]; ++ int cpu_num = raw_smp_processor_id(); ++ struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; ++ ++ /* We should bind the task to the CPU */ ++ BUG_ON(cpu_num != cpu); ++ ++ if (uci->mc.mc_intel == NULL) ++ return -EINVAL; ++ ++ /* serialize access to the physical write to MSR 0x79 */ ++ spin_lock_irqsave(µcode_update_lock, flags); ++ ++ /* write microcode via MSR 0x79 */ ++ wrmsr(MSR_IA32_UCODE_WRITE, ++ (unsigned long) uci->mc.mc_intel->bits, ++ (unsigned long) uci->mc.mc_intel->bits >> 16 >> 16); ++ wrmsr(MSR_IA32_UCODE_REV, 0, 0); ++ ++ /* see notes above for revision 1.07. Apparent chip bug */ ++ sync_core(); ++ ++ /* get the current revision from MSR 0x8B */ ++ rdmsr(MSR_IA32_UCODE_REV, val[0], val[1]); ++ ++ spin_unlock_irqrestore(µcode_update_lock, flags); ++ if (val[1] != uci->mc.mc_intel->hdr.rev) { ++ printk(KERN_ERR "microcode: CPU%d update from revision " ++ "0x%x to 0x%x failed\n", cpu_num, uci->cpu_sig.rev, val[1]); ++ return -EIO; ++ } ++ printk(KERN_INFO "microcode: CPU%d updated from revision " ++ "0x%x to 0x%x, date = %04x-%02x-%02x \n", ++ cpu_num, uci->cpu_sig.rev, val[1], ++ uci->mc.mc_intel->hdr.date & 0xffff, ++ uci->mc.mc_intel->hdr.date >> 24, ++ (uci->mc.mc_intel->hdr.date >> 16) & 0xff); ++ uci->cpu_sig.rev = val[1]; ++ ++ return 0; ++} ++ ++static long get_next_ucode_from_buffer(void **mc, const u8 *buf, ++ unsigned long size, long offset) ++{ ++ struct microcode_header_intel *mc_header; ++ unsigned long total_size; ++ ++ /* No more data */ ++ if (offset >= size) ++ return 0; ++ mc_header = (struct microcode_header_intel *)(buf + offset); ++ total_size = get_totalsize(mc_header); ++ ++ if (offset + total_size > size) { ++ printk(KERN_ERR "microcode: error! Bad data in microcode data file\n"); ++ return -EINVAL; ++ } ++ ++ *mc = vmalloc(total_size); ++ if (!*mc) { ++ printk(KERN_ERR "microcode: error! Can not allocate memory\n"); ++ return -ENOMEM; ++ } ++ memcpy(*mc, (const void *)(buf + offset), total_size); ++ return offset + total_size; ++} ++ ++/* fake device for request_firmware */ ++extern struct platform_device *microcode_pdev; ++ ++static int cpu_request_microcode(int cpu, const void *buf, size_t size) ++{ ++ long offset = 0; ++ int error = 0; ++ void *mc; ++ ++ /* We should bind the task to the CPU */ ++ BUG_ON(cpu != raw_smp_processor_id()); ++ ++ while ((offset = get_next_ucode_from_buffer(&mc, buf, size, offset)) ++ > 0) { ++ error = microcode_sanity_check(mc); ++ if (error) ++ break; ++ error = get_matching_microcode(mc, cpu); ++ if (error < 0) ++ break; ++ /* ++ * It's possible the data file has multiple matching ucode, ++ * lets keep searching till the latest version ++ */ ++ if (error == 1) { ++ apply_microcode(cpu); ++ error = 0; ++ } ++ vfree(mc); ++ } ++ if (offset > 0) ++ vfree(mc); ++ if (offset < 0) ++ error = offset; ++ ++ return error; ++} ++ ++static void microcode_fini_cpu(int cpu) ++{ ++ struct ucode_cpu_info *uci = ucode_cpu_info + cpu; ++ ++ vfree(uci->mc.mc_intel); ++ uci->mc.mc_intel = NULL; ++} ++ ++static struct microcode_ops microcode_intel_ops = { ++ .get_matching_microcode = get_matching_microcode, ++ .microcode_sanity_check = microcode_sanity_check, ++ .cpu_request_microcode = cpu_request_microcode, ++ .collect_cpu_info = collect_cpu_info, ++ .apply_microcode = apply_microcode, ++ .microcode_fini_cpu = microcode_fini_cpu, ++}; ++ ++int microcode_init_intel(struct cpuinfo_x86 *c) ++{ ++ microcode_ops = µcode_intel_ops; ++ return 0; ++} +Index: xen-3.3.1-testing/xen/include/asm-x86/microcode.h +=================================================================== +--- /dev/null ++++ xen-3.3.1-testing/xen/include/asm-x86/microcode.h +@@ -0,0 +1,100 @@ ++#ifndef ASM_X86__MICROCODE_H ++#define ASM_X86__MICROCODE_H ++ ++struct cpu_signature; ++ ++struct microcode_ops { ++ long (*microcode_get_next_ucode)(void **mc, long offset); ++ int (*get_matching_microcode)(void *mc, int cpu); ++ int (*microcode_sanity_check)(void *mc); ++ int (*cpu_request_microcode)(int cpu, const void *buf, size_t size); ++ int (*collect_cpu_info)(int cpu_num, struct cpu_signature *csig); ++ int (*apply_microcode)(int cpu); ++ void (*microcode_fini_cpu)(int cpu); ++ void (*clear_patch)(void *data); ++}; ++ ++struct microcode_header_intel { ++ 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_intel { ++ struct microcode_header_intel hdr; ++ unsigned int bits[0]; ++}; ++ ++/* 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]; ++}; ++ ++struct equiv_cpu_entry { ++ unsigned int installed_cpu; ++ unsigned int fixed_errata_mask; ++ unsigned int fixed_errata_compare; ++ unsigned int equiv_cpu; ++}; ++ ++struct microcode_header_amd { ++ unsigned int data_code; ++ unsigned int patch_id; ++ unsigned char mc_patch_data_id[2]; ++ unsigned char mc_patch_data_len; ++ unsigned char init_flag; ++ unsigned int mc_patch_data_checksum; ++ unsigned int nb_dev_id; ++ unsigned int sb_dev_id; ++ unsigned char processor_rev_id[2]; ++ unsigned char nb_rev_id; ++ unsigned char sb_rev_id; ++ unsigned char bios_api_rev; ++ unsigned char reserved1[3]; ++ unsigned int match_reg[8]; ++}; ++ ++struct microcode_amd { ++ struct microcode_header_amd hdr; ++ unsigned int mpb[0]; ++}; ++ ++struct cpu_signature { ++ unsigned int sig; ++ unsigned int pf; ++ unsigned int rev; ++}; ++ ++struct ucode_cpu_info { ++ struct cpu_signature cpu_sig; ++ int valid; ++ union { ++ struct microcode_intel *mc_intel; ++ struct microcode_amd *mc_amd; ++ void *valid_mc; ++ } mc; ++}; ++extern struct ucode_cpu_info ucode_cpu_info[]; ++ ++extern const struct microcode_ops *microcode_ops; ++ ++int microcode_init_amd(struct cpuinfo_x86 *c); ++int microcode_init_intel(struct cpuinfo_x86 *c); ++ ++#endif /* ASM_X86__MICROCODE_H */ diff --git a/18481-amd-microcode-update-fix.patch b/18481-amd-microcode-update-fix.patch new file mode 100644 index 0000000..9b9c51c --- /dev/null +++ b/18481-amd-microcode-update-fix.patch @@ -0,0 +1,37 @@ +# HG changeset patch +# User Keir Fraser +# Date 1221489878 -3600 +# Node ID 75c4a603d9cd7f73366986261e1078fce1ead815 +# Parent 59aba2cbbb58111de1aba6b173800d62956cf26f +x86: Fix 32-bit build after AMD microcode update patch. +Signed-off-by: Keir Fraser + +Index: xen-3.3.1-testing/xen/arch/x86/microcode_amd.c +=================================================================== +--- xen-3.3.1-testing.orig/xen/arch/x86/microcode_amd.c ++++ xen-3.3.1-testing/xen/arch/x86/microcode_amd.c +@@ -170,11 +170,10 @@ out: + static int apply_microcode_amd(int cpu) + { + unsigned long flags; +- unsigned int eax, edx; +- unsigned int rev; ++ uint32_t eax, edx, rev; + int cpu_num = raw_smp_processor_id(); + struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; +- unsigned long addr; ++ uint64_t addr; + + /* We should bind the task to the CPU */ + BUG_ON(cpu_num != cpu); +@@ -185,8 +184,8 @@ static int apply_microcode_amd(int cpu) + spin_lock_irqsave(µcode_update_lock, flags); + + addr = (unsigned long)&uci->mc.mc_amd->hdr.data_code; +- edx = (unsigned int)((unsigned long)(addr >> 32)); +- eax = (unsigned int)((unsigned long)(addr & 0xffffffff)); ++ edx = (uint32_t)(addr >> 32); ++ eax = (uint32_t)addr; + + asm volatile("movl %0, %%ecx; wrmsr" : + : "i" (MSR_AMD_PATCHLOADER), "a" (eax), "d" (edx) : "ecx"); diff --git a/18483-intel-microcode-update.patch b/18483-intel-microcode-update.patch new file mode 100644 index 0000000..b798d3f --- /dev/null +++ b/18483-intel-microcode-update.patch @@ -0,0 +1,1766 @@ +# HG changeset patch +# User Keir Fraser +# Date 1221560779 -3600 +# Node ID 087b8b29b6b20165062697305c6651ca2acb7b5b +# Parent 087008dfb00504f8d38ee48e197ea1dc8e5cb203 +x86, microcode: Clean up for Xen coding style, and disable for now +(until allocations in irq context are fixed). + +Signed-off-by: Keir Fraser + +Index: xen-3.3.1-testing/xen/arch/x86/microcode.c +=================================================================== +--- xen-3.3.1-testing.orig/xen/arch/x86/microcode.c ++++ xen-3.3.1-testing/xen/arch/x86/microcode.c +@@ -1,73 +1,24 @@ + /* +- * Intel CPU Microcode Update Driver for Linux ++ * Intel CPU Microcode Update Driver for Linux + * +- * Copyright (C) 2000-2006 Tigran Aivazian +- * 2006 Shaohua Li * +- * This driver allows to upgrade microcode on Intel processors +- * belonging to IA-32 family - PentiumPro, Pentium II, +- * Pentium III, Xeon, Pentium 4, etc. +- * +- * Reference: Section 8.11 of Volume 3a, IA-32 Intel? Architecture +- * Software Developer's Manual +- * Order Number 253668 or free download from: +- * +- * http://developer.intel.com/design/pentium4/manuals/253668.htm +- * +- * For more information, go to http://www.urbanmyth.org/microcode +- * +- * This program is free software; you can redistribute it and/or +- * modify it under the terms of the GNU General Public License +- * as published by the Free Software Foundation; either version +- * 2 of the License, or (at your option) any later version. +- * +- * 1.0 16 Feb 2000, Tigran Aivazian +- * Initial release. +- * 1.01 18 Feb 2000, Tigran Aivazian +- * Added read() support + cleanups. +- * 1.02 21 Feb 2000, Tigran Aivazian +- * Added 'device trimming' support. open(O_WRONLY) zeroes +- * and frees the saved copy of applied microcode. +- * 1.03 29 Feb 2000, Tigran Aivazian +- * Made to use devfs (/dev/cpu/microcode) + cleanups. +- * 1.04 06 Jun 2000, Simon Trimmer +- * Added misc device support (now uses both devfs and misc). +- * Added MICROCODE_IOCFREE ioctl to clear memory. +- * 1.05 09 Jun 2000, Simon Trimmer +- * Messages for error cases (non Intel & no suitable microcode). +- * 1.06 03 Aug 2000, Tigran Aivazian +- * Removed ->release(). Removed exclusive open and status bitmap. +- * Added microcode_rwsem to serialize read()/write()/ioctl(). +- * Removed global kernel lock usage. +- * 1.07 07 Sep 2000, Tigran Aivazian +- * Write 0 to 0x8B msr and then cpuid before reading revision, +- * so that it works even if there were no update done by the +- * BIOS. Otherwise, reading from 0x8B gives junk (which happened +- * to be 0 on my machine which is why it worked even when I +- * disabled update by the BIOS) +- * Thanks to Eric W. Biederman for the fix. +- * 1.08 11 Dec 2000, Richard Schaal and +- * Tigran Aivazian +- * Intel Pentium 4 processor support and bugfixes. +- * 1.09 30 Oct 2001, Tigran Aivazian +- * Bugfix for HT (Hyper-Threading) enabled processors +- * whereby processor resources are shared by all logical processors +- * in a single CPU package. +- * 1.10 28 Feb 2002 Asit K Mallick and +- * Tigran Aivazian , +- * Serialize updates as required on HT processors due to +- * speculative nature of implementation. +- * 1.11 22 Mar 2002 Tigran Aivazian +- * Fix the panic when writing zero-length microcode chunk. +- * 1.12 29 Sep 2003 Nitin Kamble , +- * Jun Nakajima +- * Support for the microcode updates in the new format. +- * 1.13 10 Oct 2003 Tigran Aivazian +- * Removed ->read() method and obsoleted MICROCODE_IOCFREE ioctl +- * because we no longer hold a copy of applied microcode +- * in kernel memory. +- * 1.14 25 Jun 2004 Tigran Aivazian +- * Fix sigmatch() macro to handle old CPUs with pf == 0. +- * Thanks to Stuart Swales for pointing out this bug. ++ * Copyright (C) 2000-2006 Tigran Aivazian ++ * 2006 Shaohua Li * ++ * This driver allows to upgrade microcode on Intel processors ++ * belonging to IA-32 family - PentiumPro, Pentium II, ++ * Pentium III, Xeon, Pentium 4, etc. ++ * ++ * Reference: Section 8.11 of Volume 3a, IA-32 Intel? Architecture ++ * Software Developer's Manual ++ * Order Number 253668 or free download from: ++ * ++ * http://developer.intel.com/design/pentium4/manuals/253668.htm ++ * ++ * For more information, go to http://www.urbanmyth.org/microcode ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. + */ + + #include +@@ -95,8 +46,8 @@ static DEFINE_SPINLOCK(microcode_mutex); + struct ucode_cpu_info ucode_cpu_info[NR_CPUS]; + + struct microcode_buffer { +- void *buf; +- size_t size; ++ void *buf; ++ size_t size; + }; + + static struct microcode_buffer microcode_buffer; +@@ -104,164 +55,157 @@ static bool_t microcode_error; + + static void microcode_fini_cpu(int cpu) + { +- struct ucode_cpu_info *uci = ucode_cpu_info + cpu; ++ struct ucode_cpu_info *uci = ucode_cpu_info + cpu; + +- spin_lock(µcode_mutex); +- microcode_ops->microcode_fini_cpu(cpu); +- uci->valid = 0; +- spin_unlock(µcode_mutex); ++ spin_lock(µcode_mutex); ++ microcode_ops->microcode_fini_cpu(cpu); ++ uci->valid = 0; ++ spin_unlock(µcode_mutex); + } + + static int collect_cpu_info(int cpu) + { +- int err = 0; +- struct ucode_cpu_info *uci = ucode_cpu_info + cpu; ++ int err = 0; ++ struct ucode_cpu_info *uci = ucode_cpu_info + cpu; + +- memset(uci, 0, sizeof(*uci)); +- err = microcode_ops->collect_cpu_info(cpu, &uci->cpu_sig); +- if (!err) +- uci->valid = 1; ++ memset(uci, 0, sizeof(*uci)); ++ err = microcode_ops->collect_cpu_info(cpu, &uci->cpu_sig); ++ if ( !err ) ++ uci->valid = 1; + +- return err; ++ return err; + } + + static int microcode_resume_cpu(int cpu) + { +- int err = 0; +- struct ucode_cpu_info *uci = ucode_cpu_info + cpu; +- struct cpu_signature nsig; +- +- gdprintk(XENLOG_INFO, "microcode: CPU%d resumed\n", cpu); +- +- if (!uci->mc.valid_mc) +- return -EIO; +- +- /* +- * Let's verify that the 'cached' ucode does belong +- * to this cpu (a bit of paranoia): +- */ +- err = microcode_ops->collect_cpu_info(cpu, &nsig); +- if (err) { +- microcode_fini_cpu(cpu); +- return err; +- } +- +- if (memcmp(&nsig, &uci->cpu_sig, sizeof(nsig))) { +- microcode_fini_cpu(cpu); +- /* Should we look for a new ucode here? */ +- return -EIO; +- } ++ int err = 0; ++ struct ucode_cpu_info *uci = ucode_cpu_info + cpu; ++ struct cpu_signature nsig; ++ ++ gdprintk(XENLOG_INFO, "microcode: CPU%d resumed\n", cpu); ++ ++ if ( !uci->mc.valid_mc ) ++ return -EIO; ++ ++ /* ++ * Let's verify that the 'cached' ucode does belong ++ * to this cpu (a bit of paranoia): ++ */ ++ err = microcode_ops->collect_cpu_info(cpu, &nsig); ++ if ( err ) ++ { ++ microcode_fini_cpu(cpu); ++ return err; ++ } ++ ++ if ( memcmp(&nsig, &uci->cpu_sig, sizeof(nsig)) ) ++ { ++ microcode_fini_cpu(cpu); ++ /* Should we look for a new ucode here? */ ++ return -EIO; ++ } + +- err = microcode_ops->apply_microcode(cpu); ++ err = microcode_ops->apply_microcode(cpu); + +- return err; ++ return err; + } + + static int microcode_update_cpu(int cpu, const void *buf, size_t size) + { +- int err = 0; +- struct ucode_cpu_info *uci = ucode_cpu_info + cpu; ++ int err = 0; ++ struct ucode_cpu_info *uci = ucode_cpu_info + cpu; ++ ++ /* We should bind the task to the CPU */ ++ BUG_ON(raw_smp_processor_id() != cpu); + +- /* We should bind the task to the CPU */ +- BUG_ON(raw_smp_processor_id() != cpu); ++ spin_lock(µcode_mutex); + +- spin_lock(µcode_mutex); +- /* +- * Check if the system resume is in progress (uci->valid != NULL), +- * otherwise just request a firmware: +- */ +- if (uci->valid) { +- err = microcode_resume_cpu(cpu); +- } else { +- err = collect_cpu_info(cpu); +- if (err) +- goto out; +- if (uci->valid) { +- err = microcode_ops->cpu_request_microcode(cpu, buf, size); +- } +- } ++ /* ++ * Check if the system resume is in progress (uci->valid != NULL), ++ * otherwise just request a firmware: ++ */ ++ if ( uci->valid ) ++ { ++ err = microcode_resume_cpu(cpu); ++ } ++ else ++ { ++ err = collect_cpu_info(cpu); ++ if ( !err && uci->valid ) ++ err = microcode_ops->cpu_request_microcode(cpu, buf, size); ++ } + +-out: +- spin_unlock(µcode_mutex); ++ spin_unlock(µcode_mutex); + +- return err; ++ return err; + } + + static void do_microcode_update_one(void *info) + { +- int error = 0; ++ int error; + +- error = microcode_update_cpu(smp_processor_id(), +- microcode_buffer.buf, microcode_buffer.size); ++ error = microcode_update_cpu( ++ smp_processor_id(), microcode_buffer.buf, microcode_buffer.size); + +- if (error) +- microcode_error = error; ++ if ( error ) ++ microcode_error = error; + } + + static int do_microcode_update(void) + { +- int error = 0; ++ int error = 0; + +- microcode_error = 0; ++ microcode_error = 0; + +- if (on_each_cpu(do_microcode_update_one, NULL, 1, 1) != 0) { +- printk(KERN_ERR "microcode: Error! Could not run on all processors\n"); +- error = -EIO; +- goto out; +- } +- +- if (microcode_error) { +- error = microcode_error; +- goto out; +- } ++ if ( on_each_cpu(do_microcode_update_one, NULL, 1, 1) != 0 ) ++ { ++ printk(KERN_ERR "microcode: Error! Could not run on all processors\n"); ++ error = -EIO; ++ goto out; ++ } ++ ++ if ( microcode_error ) ++ { ++ error = microcode_error; ++ goto out; ++ } + +-out: +- return error; ++ out: ++ return error; + } + + int microcode_update(XEN_GUEST_HANDLE(const_void) buf, unsigned long len) + { +- int ret; +- struct cpuinfo_x86 *c = &boot_cpu_data; ++ int ret; ++ ++ /* XXX FIXME: No allocations in interrupt context. */ ++ return -EINVAL; ++ ++ if ( len != (typeof(microcode_buffer.size))len ) ++ { ++ printk(KERN_ERR "microcode: too much data\n"); ++ return -E2BIG; ++ } ++ ++ if (microcode_ops == NULL) ++ return -EINVAL; ++ ++ microcode_buffer.buf = xmalloc_array(uint8_t, len); ++ if ( microcode_buffer.buf == NULL ) ++ return -ENOMEM; ++ ++ ret = copy_from_guest(microcode_buffer.buf, buf, len); ++ if ( ret != 0 ) ++ return ret; ++ ++ microcode_buffer.size = len; ++ wmb(); ++ ++ ret = do_microcode_update(); + +- if (len != (typeof(microcode_buffer.size))len) { +- printk(KERN_ERR "microcode: too much data\n"); +- return -E2BIG; +- } +- +- switch (c->x86_vendor) { +- case X86_VENDOR_AMD: +- ret = microcode_init_amd(c); +- break; +- +- case X86_VENDOR_INTEL: +- ret = microcode_init_intel(c); +- break; +- default: +- printk(KERN_ERR "microcode: CPU vendor not supported\n"); +- ret = -EINVAL; +- break; +- } +- +- if (ret != 0) +- return ret; +- +- microcode_buffer.buf = xmalloc_array(uint8_t, len); +- if (!microcode_buffer.buf) +- return -ENOMEM; +- +- ret = copy_from_guest(microcode_buffer.buf, buf, len); +- if (ret != 0) +- return ret; +- +- microcode_buffer.size = len; +- wmb(); +- +- ret = do_microcode_update(); +- +- xfree(microcode_buffer.buf); +- microcode_buffer.buf = NULL; +- microcode_buffer.size = 0; ++ xfree(microcode_buffer.buf); ++ microcode_buffer.buf = NULL; ++ microcode_buffer.size = 0; + +- return ret; ++ return ret; + } +Index: xen-3.3.1-testing/xen/arch/x86/microcode_amd.c +=================================================================== +--- xen-3.3.1-testing.orig/xen/arch/x86/microcode_amd.c ++++ xen-3.3.1-testing/xen/arch/x86/microcode_amd.c +@@ -12,7 +12,7 @@ + * + * Licensed unter the terms of the GNU General Public + * License version 2. See file COPYING for details. +-*/ ++ */ + + #include + #include +@@ -27,28 +27,21 @@ + #include + #include + +- + #define pr_debug(x...) ((void)0) +-#define DEFINE_MUTEX(_m) DEFINE_SPINLOCK(_m) +-#define mutex_lock(_m) spin_lock(_m) +-#define mutex_unlock(_m) spin_unlock(_m) +-#define vmalloc(_s) xmalloc_bytes(_s) +-#define vfree(_p) xfree(_p) +- + + #define UCODE_MAGIC 0x00414d44 + #define UCODE_EQUIV_CPU_TABLE_TYPE 0x00000000 + #define UCODE_UCODE_TYPE 0x00000001 + + #define UCODE_MAX_SIZE (2048) +-#define DEFAULT_UCODE_DATASIZE (896) +-#define MC_HEADER_SIZE (sizeof(struct microcode_header_amd)) ++#define DEFAULT_UCODE_DATASIZE (896) ++#define MC_HEADER_SIZE (sizeof(struct microcode_header_amd)) + #define DEFAULT_UCODE_TOTALSIZE (DEFAULT_UCODE_DATASIZE + MC_HEADER_SIZE) +-#define DWSIZE (sizeof(uint32_t)) ++#define DWSIZE (sizeof(uint32_t)) + /* For now we support a fixed ucode total size only */ + #define get_totalsize(mc) \ +- ((((struct microcode_amd *)mc)->hdr.mc_patch_data_len * 28) \ +- + MC_HEADER_SIZE) ++ ((((struct microcode_amd *)mc)->hdr.mc_patch_data_len * 28) \ ++ + MC_HEADER_SIZE) + + /* serialize access to the physical write */ + static DEFINE_SPINLOCK(microcode_update_lock); +@@ -57,309 +50,330 @@ struct equiv_cpu_entry *equiv_cpu_table; + + static long install_equiv_cpu_table(const void *, uint32_t, long); + +-static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig) ++static int collect_cpu_info(int cpu, struct cpu_signature *csig) + { +- struct cpuinfo_x86 *c = &cpu_data[cpu]; ++ struct cpuinfo_x86 *c = &cpu_data[cpu]; + +- memset(csig, 0, sizeof(*csig)); ++ memset(csig, 0, sizeof(*csig)); + +- if (c->x86_vendor != X86_VENDOR_AMD || c->x86 < 0x10) { +- printk(KERN_ERR "microcode: CPU%d not a capable AMD processor\n", +- cpu); +- return -1; +- } ++ if ( (c->x86_vendor != X86_VENDOR_AMD) || (c->x86 < 0x10) ) ++ { ++ printk(KERN_ERR "microcode: CPU%d not a capable AMD processor\n", ++ cpu); ++ return -1; ++ } + +- asm volatile("movl %1, %%ecx; rdmsr" +- : "=a" (csig->rev) +- : "i" (MSR_AMD_PATCHLEVEL) : "ecx"); ++ asm volatile("movl %1, %%ecx; rdmsr" ++ : "=a" (csig->rev) ++ : "i" (MSR_AMD_PATCHLEVEL) : "ecx"); + +- printk(KERN_INFO "microcode: collect_cpu_info_amd : patch_id=0x%x\n", +- csig->rev); ++ printk(KERN_INFO "microcode: collect_cpu_info: patch_id=0x%x\n", ++ csig->rev); + +- return 0; ++ return 0; + } + +-static int get_matching_microcode_amd(void *mc, int cpu) ++static int get_matching_microcode(void *mc, int cpu) + { +- struct ucode_cpu_info *uci = ucode_cpu_info + cpu; +- struct microcode_header_amd *mc_header = mc; +- unsigned long total_size = get_totalsize(mc_header); +- void *new_mc; +- unsigned int current_cpu_id; +- unsigned int equiv_cpu_id = 0x00; +- unsigned int i = 0; +- +- /* We should bind the task to the CPU */ +- BUG_ON(cpu != raw_smp_processor_id()); +- +- /* This is a tricky part. We might be called from a write operation +- * to the device file instead of the usual process of firmware +- * loading. This routine needs to be able to distinguish both +- * cases. This is done by checking if there already is a equivalent +- * CPU table installed. If not, we're written through +- * /dev/cpu/microcode. +- * Since we ignore all checks. The error case in which going through +- * firmware loading and that table is not loaded has already been +- * checked earlier. +- */ +- if (equiv_cpu_table == NULL) { +- printk(KERN_INFO "microcode: CPU%d microcode update with " +- "version 0x%x (current=0x%x)\n", +- cpu, mc_header->patch_id, uci->cpu_sig.rev); +- goto out; +- } +- +- current_cpu_id = cpuid_eax(0x00000001); +- +- while (equiv_cpu_table[i].installed_cpu != 0) { +- if (current_cpu_id == equiv_cpu_table[i].installed_cpu) { +- equiv_cpu_id = equiv_cpu_table[i].equiv_cpu; +- break; +- } +- i++; +- } +- +- if (!equiv_cpu_id) { +- printk(KERN_ERR "microcode: CPU%d cpu_id " +- "not found in equivalent cpu table \n", cpu); +- return 0; +- } +- +- if ((mc_header->processor_rev_id[0]) != (equiv_cpu_id & 0xff)) { +- printk(KERN_INFO +- "microcode: CPU%d patch does not match " +- "(patch is %x, cpu extended is %x) \n", +- cpu, mc_header->processor_rev_id[0], +- (equiv_cpu_id & 0xff)); +- return 0; +- } +- +- if ((mc_header->processor_rev_id[1]) != ((equiv_cpu_id >> 16) & 0xff)) { +- printk(KERN_INFO "microcode: CPU%d patch does not match " +- "(patch is %x, cpu base id is %x) \n", +- cpu, mc_header->processor_rev_id[1], +- ((equiv_cpu_id >> 16) & 0xff)); +- +- return 0; +- } +- +- if (mc_header->patch_id <= uci->cpu_sig.rev) +- return 0; +- +- printk(KERN_INFO "microcode: CPU%d found a matching microcode " +- "update with version 0x%x (current=0x%x)\n", +- cpu, mc_header->patch_id, uci->cpu_sig.rev); +- +-out: +- new_mc = vmalloc(UCODE_MAX_SIZE); +- if (!new_mc) { +- printk(KERN_ERR "microcode: error, can't allocate memory\n"); +- return -ENOMEM; +- } +- memset(new_mc, 0, UCODE_MAX_SIZE); ++ struct ucode_cpu_info *uci = ucode_cpu_info + cpu; ++ struct microcode_header_amd *mc_header = mc; ++ unsigned long total_size = get_totalsize(mc_header); ++ void *new_mc; ++ unsigned int current_cpu_id; ++ unsigned int equiv_cpu_id = 0x00; ++ unsigned int i = 0; ++ ++ /* We should bind the task to the CPU */ ++ BUG_ON(cpu != raw_smp_processor_id()); ++ ++ /* This is a tricky part. We might be called from a write operation ++ * to the device file instead of the usual process of firmware ++ * loading. This routine needs to be able to distinguish both ++ * cases. This is done by checking if there already is a equivalent ++ * CPU table installed. If not, we're written through ++ * /dev/cpu/microcode. ++ * Since we ignore all checks. The error case in which going through ++ * firmware loading and that table is not loaded has already been ++ * checked earlier. ++ */ ++ if ( equiv_cpu_table == NULL ) ++ { ++ printk(KERN_INFO "microcode: CPU%d microcode update with " ++ "version 0x%x (current=0x%x)\n", ++ cpu, mc_header->patch_id, uci->cpu_sig.rev); ++ goto out; ++ } ++ ++ current_cpu_id = cpuid_eax(0x00000001); ++ ++ while ( equiv_cpu_table[i].installed_cpu != 0 ) ++ { ++ if ( current_cpu_id == equiv_cpu_table[i].installed_cpu ) ++ { ++ equiv_cpu_id = equiv_cpu_table[i].equiv_cpu; ++ break; ++ } ++ i++; ++ } ++ ++ if ( !equiv_cpu_id ) ++ { ++ printk(KERN_ERR "microcode: CPU%d cpu_id " ++ "not found in equivalent cpu table \n", cpu); ++ return 0; ++ } ++ ++ if ( (mc_header->processor_rev_id[0]) != (equiv_cpu_id & 0xff) ) ++ { ++ printk(KERN_INFO ++ "microcode: CPU%d patch does not match " ++ "(patch is %x, cpu extended is %x) \n", ++ cpu, mc_header->processor_rev_id[0], ++ (equiv_cpu_id & 0xff)); ++ return 0; ++ } ++ ++ if ( (mc_header->processor_rev_id[1]) != ((equiv_cpu_id >> 16) & 0xff) ) ++ { ++ printk(KERN_INFO "microcode: CPU%d patch does not match " ++ "(patch is %x, cpu base id is %x) \n", ++ cpu, mc_header->processor_rev_id[1], ++ ((equiv_cpu_id >> 16) & 0xff)); ++ return 0; ++ } ++ ++ if ( mc_header->patch_id <= uci->cpu_sig.rev ) ++ return 0; ++ ++ printk(KERN_INFO "microcode: CPU%d found a matching microcode " ++ "update with version 0x%x (current=0x%x)\n", ++ cpu, mc_header->patch_id, uci->cpu_sig.rev); ++ ++ out: ++ new_mc = xmalloc_bytes(UCODE_MAX_SIZE); ++ if ( new_mc == NULL ) ++ { ++ printk(KERN_ERR "microcode: error, can't allocate memory\n"); ++ return -ENOMEM; ++ } ++ memset(new_mc, 0, UCODE_MAX_SIZE); + +- /* free previous update file */ +- vfree(uci->mc.mc_amd); ++ /* free previous update file */ ++ xfree(uci->mc.mc_amd); + +- memcpy(new_mc, mc, total_size); ++ memcpy(new_mc, mc, total_size); + +- uci->mc.mc_amd = new_mc; +- return 1; ++ uci->mc.mc_amd = new_mc; ++ return 1; + } + +-static int apply_microcode_amd(int cpu) ++static int apply_microcode(int cpu) + { +- unsigned long flags; +- uint32_t eax, edx, rev; +- int cpu_num = raw_smp_processor_id(); +- struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; +- uint64_t addr; +- +- /* We should bind the task to the CPU */ +- BUG_ON(cpu_num != cpu); +- +- if (uci->mc.mc_amd == NULL) +- return -EINVAL; +- +- spin_lock_irqsave(µcode_update_lock, flags); +- +- addr = (unsigned long)&uci->mc.mc_amd->hdr.data_code; +- edx = (uint32_t)(addr >> 32); +- eax = (uint32_t)addr; ++ unsigned long flags; ++ uint32_t eax, edx, rev; ++ int cpu_num = raw_smp_processor_id(); ++ struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; ++ uint64_t addr; ++ ++ /* We should bind the task to the CPU */ ++ BUG_ON(cpu_num != cpu); ++ ++ if ( uci->mc.mc_amd == NULL ) ++ return -EINVAL; ++ ++ spin_lock_irqsave(µcode_update_lock, flags); ++ ++ addr = (unsigned long)&uci->mc.mc_amd->hdr.data_code; ++ edx = (uint32_t)(addr >> 32); ++ eax = (uint32_t)addr; ++ ++ asm volatile("movl %0, %%ecx; wrmsr" : ++ : "i" (MSR_AMD_PATCHLOADER), "a" (eax), "d" (edx) : "ecx"); ++ ++ /* get patch id after patching */ ++ asm volatile("movl %1, %%ecx; rdmsr" ++ : "=a" (rev) ++ : "i" (MSR_AMD_PATCHLEVEL) : "ecx"); ++ ++ spin_unlock_irqrestore(µcode_update_lock, flags); ++ ++ /* check current patch id and patch's id for match */ ++ if ( rev != uci->mc.mc_amd->hdr.patch_id ) ++ { ++ printk(KERN_ERR "microcode: CPU%d update from revision " ++ "0x%x to 0x%x failed\n", cpu_num, ++ uci->mc.mc_amd->hdr.patch_id, rev); ++ return -EIO; ++ } ++ ++ printk("microcode: CPU%d updated from revision " ++ "0x%x to 0x%x \n", ++ cpu_num, uci->cpu_sig.rev, uci->mc.mc_amd->hdr.patch_id); + +- asm volatile("movl %0, %%ecx; wrmsr" : +- : "i" (MSR_AMD_PATCHLOADER), "a" (eax), "d" (edx) : "ecx"); ++ uci->cpu_sig.rev = rev; + +- /* get patch id after patching */ +- asm volatile("movl %1, %%ecx; rdmsr" +- : "=a" (rev) +- : "i" (MSR_AMD_PATCHLEVEL) : "ecx"); +- +- spin_unlock_irqrestore(µcode_update_lock, flags); +- +- /* check current patch id and patch's id for match */ +- if (rev != uci->mc.mc_amd->hdr.patch_id) { +- printk(KERN_ERR "microcode: CPU%d update from revision " +- "0x%x to 0x%x failed\n", cpu_num, +- uci->mc.mc_amd->hdr.patch_id, rev); +- return -EIO; +- } +- +- printk("microcode: CPU%d updated from revision " +- "0x%x to 0x%x \n", +- cpu_num, uci->cpu_sig.rev, uci->mc.mc_amd->hdr.patch_id); +- +- uci->cpu_sig.rev = rev; +- +- return 0; ++ return 0; + } + + static long get_next_ucode_from_buffer_amd(void **mc, const void *buf, +- unsigned long size, long offset) ++ unsigned long size, long offset) + { +- struct microcode_header_amd *mc_header; +- unsigned long total_size; +- const uint8_t *buf_pos = buf; +- +- /* No more data */ +- if (offset >= size) +- return 0; +- +- if (buf_pos[offset] != UCODE_UCODE_TYPE) { +- printk(KERN_ERR "microcode: error! " +- "Wrong microcode payload type field\n"); +- return -EINVAL; +- } +- +- mc_header = (struct microcode_header_amd *)(&buf_pos[offset+8]); +- +- total_size = (unsigned long) (buf_pos[offset+4] + +- (buf_pos[offset+5] << 8)); +- +- printk(KERN_INFO "microcode: size %lu, total_size %lu, offset %ld\n", +- size, total_size, offset); +- +- if (offset + total_size > size) { +- printk(KERN_ERR "microcode: error! Bad data in microcode data file\n"); +- return -EINVAL; +- } +- +- *mc = vmalloc(UCODE_MAX_SIZE); +- if (!*mc) { +- printk(KERN_ERR "microcode: error! " +- "Can not allocate memory for microcode patch\n"); +- return -ENOMEM; +- } ++ struct microcode_header_amd *mc_header; ++ unsigned long total_size; ++ const uint8_t *buf_pos = buf; ++ ++ /* No more data */ ++ if ( offset >= size ) ++ return 0; ++ ++ if ( buf_pos[offset] != UCODE_UCODE_TYPE ) ++ { ++ printk(KERN_ERR "microcode: error! " ++ "Wrong microcode payload type field\n"); ++ return -EINVAL; ++ } ++ ++ mc_header = (struct microcode_header_amd *)(&buf_pos[offset+8]); ++ ++ total_size = (unsigned long) (buf_pos[offset+4] + ++ (buf_pos[offset+5] << 8)); ++ ++ printk(KERN_INFO "microcode: size %lu, total_size %lu, offset %ld\n", ++ size, total_size, offset); ++ ++ if ( (offset + total_size) > size ) ++ { ++ printk(KERN_ERR "microcode: error! Bad data in microcode data file\n"); ++ return -EINVAL; ++ } ++ ++ *mc = xmalloc_bytes(UCODE_MAX_SIZE); ++ if ( *mc == NULL ) ++ { ++ printk(KERN_ERR "microcode: error! " ++ "Can not allocate memory for microcode patch\n"); ++ return -ENOMEM; ++ } + +- memset(*mc, 0, UCODE_MAX_SIZE); +- memcpy(*mc, (const void *)(buf + offset + 8), total_size); ++ memset(*mc, 0, UCODE_MAX_SIZE); ++ memcpy(*mc, (const void *)(buf + offset + 8), total_size); + +- return offset + total_size + 8; ++ return offset + total_size + 8; + } + + static long install_equiv_cpu_table(const void *buf, +- uint32_t size, long offset) ++ uint32_t size, long offset) + { +- const uint32_t *buf_pos = buf; ++ const uint32_t *buf_pos = buf; + +- /* No more data */ +- if (offset >= size) +- return 0; +- +- if (buf_pos[1] != UCODE_EQUIV_CPU_TABLE_TYPE) { +- printk(KERN_ERR "microcode: error! " +- "Wrong microcode equivalnet cpu table type field\n"); +- return 0; +- } +- +- if (size == 0) { +- printk(KERN_ERR "microcode: error! " +- "Wrong microcode equivalnet cpu table length\n"); +- return 0; +- } +- +- equiv_cpu_table = (struct equiv_cpu_entry *) vmalloc(size); +- if (!equiv_cpu_table) { +- printk(KERN_ERR "microcode: error, can't allocate memory for equiv CPU table\n"); +- return 0; +- } ++ /* No more data */ ++ if ( offset >= size ) ++ return 0; ++ ++ if ( buf_pos[1] != UCODE_EQUIV_CPU_TABLE_TYPE ) ++ { ++ printk(KERN_ERR "microcode: error! " ++ "Wrong microcode equivalnet cpu table type field\n"); ++ return 0; ++ } ++ ++ if ( size == 0 ) ++ { ++ printk(KERN_ERR "microcode: error! " ++ "Wrong microcode equivalnet cpu table length\n"); ++ return 0; ++ } ++ ++ equiv_cpu_table = xmalloc_bytes(size); ++ if ( equiv_cpu_table == NULL ) ++ { ++ printk(KERN_ERR "microcode: error, can't allocate " ++ "memory for equiv CPU table\n"); ++ return 0; ++ } + +- memset(equiv_cpu_table, 0, size); +- memcpy(equiv_cpu_table, (const void *)&buf_pos[3], size); ++ memset(equiv_cpu_table, 0, size); ++ memcpy(equiv_cpu_table, (const void *)&buf_pos[3], size); + +- return size + 12; /* add header length */ ++ return size + 12; /* add header length */ + } + +-static int cpu_request_microcode_amd(int cpu, const void *buf, +- size_t size) ++static int cpu_request_microcode(int cpu, const void *buf, size_t size) + { +- const uint32_t *buf_pos; +- long offset = 0; +- int error = 0; +- void *mc; +- +- /* We should bind the task to the CPU */ +- BUG_ON(cpu != raw_smp_processor_id()); +- +- buf_pos = (const uint32_t *)buf; +- +- if (buf_pos[0] != UCODE_MAGIC) { +- printk(KERN_ERR "microcode: error! Wrong microcode patch file magic\n"); +- return -EINVAL; +- } +- +- offset = install_equiv_cpu_table(buf, (uint32_t)(buf_pos[2]), offset); +- if (!offset) { +- printk(KERN_ERR "microcode: installing equivalent cpu table failed\n"); +- return -EINVAL; +- } +- +- while ((offset = +- get_next_ucode_from_buffer_amd(&mc, buf, size, offset)) > 0) { +- error = get_matching_microcode_amd(mc, cpu); +- if (error < 0) +- break; +- /* +- * It's possible the data file has multiple matching ucode, +- * lets keep searching till the latest version +- */ +- if (error == 1) { +- apply_microcode_amd(cpu); +- error = 0; +- } +- vfree(mc); +- } +- if (offset > 0) { +- vfree(mc); +- vfree(equiv_cpu_table); +- equiv_cpu_table = NULL; +- } +- if (offset < 0) +- error = offset; ++ const uint32_t *buf_pos; ++ long offset = 0; ++ int error = 0; ++ void *mc; ++ ++ /* We should bind the task to the CPU */ ++ BUG_ON(cpu != raw_smp_processor_id()); ++ ++ buf_pos = (const uint32_t *)buf; ++ ++ if ( buf_pos[0] != UCODE_MAGIC ) ++ { ++ printk(KERN_ERR "microcode: error! Wrong " ++ "microcode patch file magic\n"); ++ return -EINVAL; ++ } ++ ++ offset = install_equiv_cpu_table(buf, (uint32_t)(buf_pos[2]), offset); ++ if ( !offset ) ++ { ++ printk(KERN_ERR "microcode: installing equivalent cpu table failed\n"); ++ return -EINVAL; ++ } ++ ++ while ( (offset = ++ get_next_ucode_from_buffer_amd(&mc, buf, size, offset)) > 0 ) ++ { ++ error = get_matching_microcode(mc, cpu); ++ if ( error < 0 ) ++ break; ++ /* ++ * It's possible the data file has multiple matching ucode, ++ * lets keep searching till the latest version ++ */ ++ if ( error == 1 ) ++ { ++ apply_microcode(cpu); ++ error = 0; ++ } ++ xfree(mc); ++ } ++ if ( offset > 0 ) ++ { ++ xfree(mc); ++ xfree(equiv_cpu_table); ++ equiv_cpu_table = NULL; ++ } ++ if ( offset < 0 ) ++ error = offset; + +- return error; ++ return error; + } + +-static void microcode_fini_cpu_amd(int cpu) ++static void microcode_fini_cpu(int cpu) + { +- struct ucode_cpu_info *uci = ucode_cpu_info + cpu; ++ struct ucode_cpu_info *uci = ucode_cpu_info + cpu; + +- vfree(uci->mc.mc_amd); +- uci->mc.mc_amd = NULL; ++ xfree(uci->mc.mc_amd); ++ uci->mc.mc_amd = NULL; + } + + static struct microcode_ops microcode_amd_ops = { +- .get_matching_microcode = get_matching_microcode_amd, +- .microcode_sanity_check = NULL, +- .cpu_request_microcode = cpu_request_microcode_amd, +- .collect_cpu_info = collect_cpu_info_amd, +- .apply_microcode = apply_microcode_amd, +- .microcode_fini_cpu = microcode_fini_cpu_amd, ++ .get_matching_microcode = get_matching_microcode, ++ .microcode_sanity_check = NULL, ++ .cpu_request_microcode = cpu_request_microcode, ++ .collect_cpu_info = collect_cpu_info, ++ .apply_microcode = apply_microcode, ++ .microcode_fini_cpu = microcode_fini_cpu, + }; + +-int microcode_init_amd(struct cpuinfo_x86 *c) ++static __init int microcode_init_amd(void) + { +- microcode_ops = µcode_amd_ops; +- return 0; ++ if ( boot_cpu_data.x86_vendor == X86_VENDOR_AMD ) ++ microcode_ops = µcode_amd_ops; ++ return 0; + } +- ++__initcall(microcode_init_amd); +Index: xen-3.3.1-testing/xen/arch/x86/microcode_intel.c +=================================================================== +--- xen-3.3.1-testing.orig/xen/arch/x86/microcode_intel.c ++++ xen-3.3.1-testing/xen/arch/x86/microcode_intel.c +@@ -1,73 +1,24 @@ + /* +- * Intel CPU Microcode Update Driver for Linux ++ * Intel CPU Microcode Update Driver for Linux + * +- * Copyright (C) 2000-2006 Tigran Aivazian +- * 2006 Shaohua Li * +- * This driver allows to upgrade microcode on Intel processors +- * belonging to IA-32 family - PentiumPro, Pentium II, +- * Pentium III, Xeon, Pentium 4, etc. ++ * Copyright (C) 2000-2006 Tigran Aivazian ++ * 2006 Shaohua Li * ++ * This driver allows to upgrade microcode on Intel processors ++ * belonging to IA-32 family - PentiumPro, Pentium II, ++ * Pentium III, Xeon, Pentium 4, etc. + * +- * Reference: Section 8.11 of Volume 3a, IA-32 Intel? Architecture +- * Software Developer's Manual +- * Order Number 253668 or free download from: ++ * Reference: Section 8.11 of Volume 3a, IA-32 Intel? Architecture ++ * Software Developer's Manual ++ * Order Number 253668 or free download from: + * +- * http://developer.intel.com/design/pentium4/manuals/253668.htm ++ * http://developer.intel.com/design/pentium4/manuals/253668.htm + * +- * For more information, go to http://www.urbanmyth.org/microcode ++ * For more information, go to http://www.urbanmyth.org/microcode + * +- * This program is free software; you can redistribute it and/or +- * modify it under the terms of the GNU General Public License +- * as published by the Free Software Foundation; either version +- * 2 of the License, or (at your option) any later version. +- * +- * 1.0 16 Feb 2000, Tigran Aivazian +- * Initial release. +- * 1.01 18 Feb 2000, Tigran Aivazian +- * Added read() support + cleanups. +- * 1.02 21 Feb 2000, Tigran Aivazian +- * Added 'device trimming' support. open(O_WRONLY) zeroes +- * and frees the saved copy of applied microcode. +- * 1.03 29 Feb 2000, Tigran Aivazian +- * Made to use devfs (/dev/cpu/microcode) + cleanups. +- * 1.04 06 Jun 2000, Simon Trimmer +- * Added misc device support (now uses both devfs and misc). +- * Added MICROCODE_IOCFREE ioctl to clear memory. +- * 1.05 09 Jun 2000, Simon Trimmer +- * Messages for error cases (non Intel & no suitable microcode). +- * 1.06 03 Aug 2000, Tigran Aivazian +- * Removed ->release(). Removed exclusive open and status bitmap. +- * Added microcode_rwsem to serialize read()/write()/ioctl(). +- * Removed global kernel lock usage. +- * 1.07 07 Sep 2000, Tigran Aivazian +- * Write 0 to 0x8B msr and then cpuid before reading revision, +- * so that it works even if there were no update done by the +- * BIOS. Otherwise, reading from 0x8B gives junk (which happened +- * to be 0 on my machine which is why it worked even when I +- * disabled update by the BIOS) +- * Thanks to Eric W. Biederman for the fix. +- * 1.08 11 Dec 2000, Richard Schaal and +- * Tigran Aivazian +- * Intel Pentium 4 processor support and bugfixes. +- * 1.09 30 Oct 2001, Tigran Aivazian +- * Bugfix for HT (Hyper-Threading) enabled processors +- * whereby processor resources are shared by all logical processors +- * in a single CPU package. +- * 1.10 28 Feb 2002 Asit K Mallick and +- * Tigran Aivazian , +- * Serialize updates as required on HT processors due to +- * speculative nature of implementation. +- * 1.11 22 Mar 2002 Tigran Aivazian +- * Fix the panic when writing zero-length microcode chunk. +- * 1.12 29 Sep 2003 Nitin Kamble , +- * Jun Nakajima +- * Support for the microcode updates in the new format. +- * 1.13 10 Oct 2003 Tigran Aivazian +- * Removed ->read() method and obsoleted MICROCODE_IOCFREE ioctl +- * because we no longer hold a copy of applied microcode +- * in kernel memory. +- * 1.14 25 Jun 2004 Tigran Aivazian +- * Fix sigmatch() macro to handle old CPUs with pf == 0. +- * Thanks to Stuart Swales for pointing out this bug. ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. + */ + + #include +@@ -84,35 +35,24 @@ + #include + + #define pr_debug(x...) ((void)0) +-#define DEFINE_MUTEX(_m) DEFINE_SPINLOCK(_m) +-#define mutex_lock(_m) spin_lock(_m) +-#define mutex_unlock(_m) spin_unlock(_m) +-#define vmalloc(_s) xmalloc_bytes(_s) +-#define vfree(_p) xfree(_p) +- +-#if 0 +-MODULE_DESCRIPTION("Microcode Update Driver"); +-MODULE_AUTHOR("Tigran Aivazian "); +-MODULE_LICENSE("GPL"); +-#endif + +-#define DEFAULT_UCODE_DATASIZE (2000) +-#define MC_HEADER_SIZE (sizeof(struct microcode_header_intel)) ++#define DEFAULT_UCODE_DATASIZE (2000) ++#define MC_HEADER_SIZE (sizeof(struct microcode_header_intel)) + #define DEFAULT_UCODE_TOTALSIZE (DEFAULT_UCODE_DATASIZE + MC_HEADER_SIZE) +-#define EXT_HEADER_SIZE (sizeof(struct extended_sigtable)) +-#define EXT_SIGNATURE_SIZE (sizeof(struct extended_signature)) +-#define DWSIZE (sizeof(u32)) ++#define EXT_HEADER_SIZE (sizeof(struct extended_sigtable)) ++#define EXT_SIGNATURE_SIZE (sizeof(struct extended_signature)) ++#define DWSIZE (sizeof(u32)) + #define get_totalsize(mc) \ +- (((struct microcode_intel *)mc)->hdr.totalsize ? \ +- ((struct microcode_intel *)mc)->hdr.totalsize : \ +- DEFAULT_UCODE_TOTALSIZE) ++ (((struct microcode_intel *)mc)->hdr.totalsize ? \ ++ ((struct microcode_intel *)mc)->hdr.totalsize : \ ++ DEFAULT_UCODE_TOTALSIZE) + + #define get_datasize(mc) \ +- (((struct microcode_intel *)mc)->hdr.datasize ? \ +- ((struct microcode_intel *)mc)->hdr.datasize : DEFAULT_UCODE_DATASIZE) ++ (((struct microcode_intel *)mc)->hdr.datasize ? \ ++ ((struct microcode_intel *)mc)->hdr.datasize : DEFAULT_UCODE_DATASIZE) + + #define sigmatch(s1, s2, p1, p2) \ +- (((s1) == (s2)) && (((p1) & (p2)) || (((p1) == 0) && ((p2) == 0)))) ++ (((s1) == (s2)) && (((p1) & (p2)) || (((p1) == 0) && ((p2) == 0)))) + + #define exttable_size(et) ((et)->count * EXT_SIGNATURE_SIZE + EXT_HEADER_SIZE) + +@@ -121,125 +61,135 @@ static DEFINE_SPINLOCK(microcode_update_ + + static int collect_cpu_info(int cpu_num, struct cpu_signature *csig) + { +- struct cpuinfo_x86 *c = &cpu_data[cpu_num]; +- unsigned int val[2]; ++ struct cpuinfo_x86 *c = &cpu_data[cpu_num]; ++ unsigned int val[2]; + +- memset(csig, 0, sizeof(*csig)); ++ memset(csig, 0, sizeof(*csig)); + +- if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 || +- cpu_has(c, X86_FEATURE_IA64)) { +- printk(KERN_ERR "microcode: CPU%d not a capable Intel " +- "processor\n", cpu_num); +- return -1; +- } +- +- csig->sig = cpuid_eax(0x00000001); +- +- if ((c->x86_model >= 5) || (c->x86 > 6)) { +- /* get processor flags from MSR 0x17 */ +- rdmsr(MSR_IA32_PLATFORM_ID, val[0], val[1]); +- csig->pf = 1 << ((val[1] >> 18) & 7); +- } +- +- wrmsr(MSR_IA32_UCODE_REV, 0, 0); +- /* see notes above for revision 1.07. Apparent chip bug */ +- sync_core(); +- /* get the current revision from MSR 0x8B */ +- rdmsr(MSR_IA32_UCODE_REV, val[0], csig->rev); +- pr_debug("microcode: collect_cpu_info : sig=0x%x, pf=0x%x, rev=0x%x\n", +- csig->sig, csig->pf, csig->rev); ++ if ( (c->x86_vendor != X86_VENDOR_INTEL) || (c->x86 < 6) || ++ cpu_has(c, X86_FEATURE_IA64) ) ++ { ++ printk(KERN_ERR "microcode: CPU%d not a capable Intel " ++ "processor\n", cpu_num); ++ return -1; ++ } ++ ++ csig->sig = cpuid_eax(0x00000001); ++ ++ if ( (c->x86_model >= 5) || (c->x86 > 6) ) ++ { ++ /* get processor flags from MSR 0x17 */ ++ rdmsr(MSR_IA32_PLATFORM_ID, val[0], val[1]); ++ csig->pf = 1 << ((val[1] >> 18) & 7); ++ } ++ ++ wrmsr(MSR_IA32_UCODE_REV, 0, 0); ++ /* see notes above for revision 1.07. Apparent chip bug */ ++ sync_core(); ++ /* get the current revision from MSR 0x8B */ ++ rdmsr(MSR_IA32_UCODE_REV, val[0], csig->rev); ++ pr_debug("microcode: collect_cpu_info : sig=0x%x, pf=0x%x, rev=0x%x\n", ++ csig->sig, csig->pf, csig->rev); + +- return 0; ++ return 0; + } + +-static inline int microcode_update_match(int cpu_num, +- struct microcode_header_intel *mc_header, int sig, int pf) ++static inline int microcode_update_match( ++ int cpu_num, struct microcode_header_intel *mc_header, int sig, int pf) + { +- struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; ++ struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; + +- if (!sigmatch(sig, uci->cpu_sig.sig, pf, uci->cpu_sig.pf) +- || mc_header->rev <= uci->cpu_sig.rev) +- return 0; +- return 1; ++ return (sigmatch(sig, uci->cpu_sig.sig, pf, uci->cpu_sig.pf) && ++ (mc_header->rev > uci->cpu_sig.rev)); + } + + static int microcode_sanity_check(void *mc) + { +- struct microcode_header_intel *mc_header = mc; +- struct extended_sigtable *ext_header = NULL; +- struct extended_signature *ext_sig; +- unsigned long total_size, data_size, ext_table_size; +- int sum, orig_sum, ext_sigcount = 0, i; +- +- total_size = get_totalsize(mc_header); +- data_size = get_datasize(mc_header); +- if (data_size + MC_HEADER_SIZE > total_size) { +- printk(KERN_ERR "microcode: error! " +- "Bad data size in microcode data file\n"); +- return -EINVAL; +- } +- +- if (mc_header->ldrver != 1 || mc_header->hdrver != 1) { +- printk(KERN_ERR "microcode: error! " +- "Unknown microcode update format\n"); +- return -EINVAL; +- } +- ext_table_size = total_size - (MC_HEADER_SIZE + data_size); +- if (ext_table_size) { +- if ((ext_table_size < EXT_HEADER_SIZE) +- || ((ext_table_size - EXT_HEADER_SIZE) % EXT_SIGNATURE_SIZE)) { +- printk(KERN_ERR "microcode: error! " +- "Small exttable size in microcode data file\n"); +- return -EINVAL; +- } +- ext_header = mc + MC_HEADER_SIZE + data_size; +- if (ext_table_size != exttable_size(ext_header)) { +- printk(KERN_ERR "microcode: error! " +- "Bad exttable size in microcode data file\n"); +- return -EFAULT; +- } +- ext_sigcount = ext_header->count; +- } +- +- /* check extended table checksum */ +- if (ext_table_size) { +- int ext_table_sum = 0; +- int *ext_tablep = (int *)ext_header; +- +- i = ext_table_size / DWSIZE; +- while (i--) +- ext_table_sum += ext_tablep[i]; +- if (ext_table_sum) { +- printk(KERN_WARNING "microcode: aborting, " +- "bad extended signature table checksum\n"); +- return -EINVAL; +- } +- } +- +- /* calculate the checksum */ +- orig_sum = 0; +- i = (MC_HEADER_SIZE + data_size) / DWSIZE; +- while (i--) +- orig_sum += ((int *)mc)[i]; +- if (orig_sum) { +- printk(KERN_ERR "microcode: aborting, bad checksum\n"); +- return -EINVAL; +- } +- if (!ext_table_size) +- return 0; +- /* check extended signature checksum */ +- for (i = 0; i < ext_sigcount; i++) { +- ext_sig = (void *)ext_header + EXT_HEADER_SIZE + +- EXT_SIGNATURE_SIZE * i; +- sum = orig_sum +- - (mc_header->sig + mc_header->pf + mc_header->cksum) +- + (ext_sig->sig + ext_sig->pf + ext_sig->cksum); +- if (sum) { +- printk(KERN_ERR "microcode: aborting, bad checksum\n"); +- return -EINVAL; +- } +- } +- return 0; ++ struct microcode_header_intel *mc_header = mc; ++ struct extended_sigtable *ext_header = NULL; ++ struct extended_signature *ext_sig; ++ unsigned long total_size, data_size, ext_table_size; ++ int sum, orig_sum, ext_sigcount = 0, i; ++ ++ total_size = get_totalsize(mc_header); ++ data_size = get_datasize(mc_header); ++ if ( (data_size + MC_HEADER_SIZE) > total_size ) ++ { ++ printk(KERN_ERR "microcode: error! " ++ "Bad data size in microcode data file\n"); ++ return -EINVAL; ++ } ++ ++ if ( (mc_header->ldrver != 1) || (mc_header->hdrver != 1) ) ++ { ++ printk(KERN_ERR "microcode: error! " ++ "Unknown microcode update format\n"); ++ return -EINVAL; ++ } ++ ext_table_size = total_size - (MC_HEADER_SIZE + data_size); ++ if ( ext_table_size ) ++ { ++ if ( (ext_table_size < EXT_HEADER_SIZE) || ++ ((ext_table_size - EXT_HEADER_SIZE) % EXT_SIGNATURE_SIZE) ) ++ { ++ printk(KERN_ERR "microcode: error! " ++ "Small exttable size in microcode data file\n"); ++ return -EINVAL; ++ } ++ ext_header = mc + MC_HEADER_SIZE + data_size; ++ if ( ext_table_size != exttable_size(ext_header) ) ++ { ++ printk(KERN_ERR "microcode: error! " ++ "Bad exttable size in microcode data file\n"); ++ return -EFAULT; ++ } ++ ext_sigcount = ext_header->count; ++ } ++ ++ /* check extended table checksum */ ++ if ( ext_table_size ) ++ { ++ int ext_table_sum = 0; ++ int *ext_tablep = (int *)ext_header; ++ ++ i = ext_table_size / DWSIZE; ++ while ( i-- ) ++ ext_table_sum += ext_tablep[i]; ++ if ( ext_table_sum ) ++ { ++ printk(KERN_WARNING "microcode: aborting, " ++ "bad extended signature table checksum\n"); ++ return -EINVAL; ++ } ++ } ++ ++ /* calculate the checksum */ ++ orig_sum = 0; ++ i = (MC_HEADER_SIZE + data_size) / DWSIZE; ++ while ( i-- ) ++ orig_sum += ((int *)mc)[i]; ++ if ( orig_sum ) ++ { ++ printk(KERN_ERR "microcode: aborting, bad checksum\n"); ++ return -EINVAL; ++ } ++ if ( !ext_table_size ) ++ return 0; ++ /* check extended signature checksum */ ++ for ( i = 0; i < ext_sigcount; i++ ) ++ { ++ ext_sig = (void *)ext_header + EXT_HEADER_SIZE + ++ EXT_SIGNATURE_SIZE * i; ++ sum = orig_sum ++ - (mc_header->sig + mc_header->pf + mc_header->cksum) ++ + (ext_sig->sig + ext_sig->pf + ext_sig->cksum); ++ if ( sum ) ++ { ++ printk(KERN_ERR "microcode: aborting, bad checksum\n"); ++ return -EINVAL; ++ } ++ } ++ return 0; + } + + /* +@@ -249,118 +199,123 @@ static int microcode_sanity_check(void * + */ + static int get_matching_microcode(void *mc, int cpu) + { +- struct ucode_cpu_info *uci = ucode_cpu_info + cpu; +- struct microcode_header_intel *mc_header = mc; +- struct extended_sigtable *ext_header; +- unsigned long total_size = get_totalsize(mc_header); +- int ext_sigcount, i; +- struct extended_signature *ext_sig; +- void *new_mc; +- +- if (microcode_update_match(cpu, mc_header, +- mc_header->sig, mc_header->pf)) +- goto find; +- +- if (total_size <= get_datasize(mc_header) + MC_HEADER_SIZE) +- return 0; +- +- ext_header = mc + get_datasize(mc_header) + MC_HEADER_SIZE; +- ext_sigcount = ext_header->count; +- ext_sig = (void *)ext_header + EXT_HEADER_SIZE; +- for (i = 0; i < ext_sigcount; i++) { +- if (microcode_update_match(cpu, mc_header, +- ext_sig->sig, ext_sig->pf)) +- goto find; +- ext_sig++; +- } +- return 0; +-find: +- pr_debug("microcode: CPU%d found a matching microcode update with" +- " version 0x%x (current=0x%x)\n", +- cpu, mc_header->rev, uci->cpu_sig.rev); +- new_mc = vmalloc(total_size); +- if (!new_mc) { +- printk(KERN_ERR "microcode: error! Can not allocate memory\n"); +- return -ENOMEM; +- } +- +- /* free previous update file */ +- vfree(uci->mc.mc_intel); +- +- memcpy(new_mc, mc, total_size); +- uci->mc.mc_intel = new_mc; +- return 1; ++ struct ucode_cpu_info *uci = ucode_cpu_info + cpu; ++ struct microcode_header_intel *mc_header = mc; ++ struct extended_sigtable *ext_header; ++ unsigned long total_size = get_totalsize(mc_header); ++ int ext_sigcount, i; ++ struct extended_signature *ext_sig; ++ void *new_mc; ++ ++ if ( microcode_update_match(cpu, mc_header, ++ mc_header->sig, mc_header->pf) ) ++ goto find; ++ ++ if ( total_size <= (get_datasize(mc_header) + MC_HEADER_SIZE) ) ++ return 0; ++ ++ ext_header = mc + get_datasize(mc_header) + MC_HEADER_SIZE; ++ ext_sigcount = ext_header->count; ++ ext_sig = (void *)ext_header + EXT_HEADER_SIZE; ++ for ( i = 0; i < ext_sigcount; i++ ) ++ { ++ if ( microcode_update_match(cpu, mc_header, ++ ext_sig->sig, ext_sig->pf) ) ++ goto find; ++ ext_sig++; ++ } ++ return 0; ++ find: ++ pr_debug("microcode: CPU%d found a matching microcode update with" ++ " version 0x%x (current=0x%x)\n", ++ cpu, mc_header->rev, uci->cpu_sig.rev); ++ new_mc = xmalloc_bytes(total_size); ++ if ( new_mc == NULL ) ++ { ++ printk(KERN_ERR "microcode: error! Can not allocate memory\n"); ++ return -ENOMEM; ++ } ++ ++ /* free previous update file */ ++ xfree(uci->mc.mc_intel); ++ ++ memcpy(new_mc, mc, total_size); ++ uci->mc.mc_intel = new_mc; ++ return 1; + } + + static int apply_microcode(int cpu) + { +- unsigned long flags; +- unsigned int val[2]; +- int cpu_num = raw_smp_processor_id(); +- struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; +- +- /* We should bind the task to the CPU */ +- BUG_ON(cpu_num != cpu); +- +- if (uci->mc.mc_intel == NULL) +- return -EINVAL; +- +- /* serialize access to the physical write to MSR 0x79 */ +- spin_lock_irqsave(µcode_update_lock, flags); +- +- /* write microcode via MSR 0x79 */ +- wrmsr(MSR_IA32_UCODE_WRITE, +- (unsigned long) uci->mc.mc_intel->bits, +- (unsigned long) uci->mc.mc_intel->bits >> 16 >> 16); +- wrmsr(MSR_IA32_UCODE_REV, 0, 0); +- +- /* see notes above for revision 1.07. Apparent chip bug */ +- sync_core(); +- +- /* get the current revision from MSR 0x8B */ +- rdmsr(MSR_IA32_UCODE_REV, val[0], val[1]); +- +- spin_unlock_irqrestore(µcode_update_lock, flags); +- if (val[1] != uci->mc.mc_intel->hdr.rev) { +- printk(KERN_ERR "microcode: CPU%d update from revision " +- "0x%x to 0x%x failed\n", cpu_num, uci->cpu_sig.rev, val[1]); +- return -EIO; +- } +- printk(KERN_INFO "microcode: CPU%d updated from revision " +- "0x%x to 0x%x, date = %04x-%02x-%02x \n", +- cpu_num, uci->cpu_sig.rev, val[1], +- uci->mc.mc_intel->hdr.date & 0xffff, +- uci->mc.mc_intel->hdr.date >> 24, +- (uci->mc.mc_intel->hdr.date >> 16) & 0xff); +- uci->cpu_sig.rev = val[1]; ++ unsigned long flags; ++ unsigned int val[2]; ++ int cpu_num = raw_smp_processor_id(); ++ struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; ++ ++ /* We should bind the task to the CPU */ ++ BUG_ON(cpu_num != cpu); ++ ++ if ( uci->mc.mc_intel == NULL ) ++ return -EINVAL; ++ ++ /* serialize access to the physical write to MSR 0x79 */ ++ spin_lock_irqsave(µcode_update_lock, flags); ++ ++ /* write microcode via MSR 0x79 */ ++ wrmsr(MSR_IA32_UCODE_WRITE, ++ (unsigned long) uci->mc.mc_intel->bits, ++ (unsigned long) uci->mc.mc_intel->bits >> 16 >> 16); ++ wrmsr(MSR_IA32_UCODE_REV, 0, 0); ++ ++ /* see notes above for revision 1.07. Apparent chip bug */ ++ sync_core(); ++ ++ /* get the current revision from MSR 0x8B */ ++ rdmsr(MSR_IA32_UCODE_REV, val[0], val[1]); ++ ++ spin_unlock_irqrestore(µcode_update_lock, flags); ++ if ( val[1] != uci->mc.mc_intel->hdr.rev ) ++ { ++ printk(KERN_ERR "microcode: CPU%d update from revision " ++ "0x%x to 0x%x failed\n", cpu_num, uci->cpu_sig.rev, val[1]); ++ return -EIO; ++ } ++ printk(KERN_INFO "microcode: CPU%d updated from revision " ++ "0x%x to 0x%x, date = %04x-%02x-%02x \n", ++ cpu_num, uci->cpu_sig.rev, val[1], ++ uci->mc.mc_intel->hdr.date & 0xffff, ++ uci->mc.mc_intel->hdr.date >> 24, ++ (uci->mc.mc_intel->hdr.date >> 16) & 0xff); ++ uci->cpu_sig.rev = val[1]; + +- return 0; ++ return 0; + } + + static long get_next_ucode_from_buffer(void **mc, const u8 *buf, +- unsigned long size, long offset) ++ unsigned long size, long offset) + { +- struct microcode_header_intel *mc_header; +- unsigned long total_size; ++ struct microcode_header_intel *mc_header; ++ unsigned long total_size; + +- /* No more data */ +- if (offset >= size) +- return 0; +- mc_header = (struct microcode_header_intel *)(buf + offset); +- total_size = get_totalsize(mc_header); +- +- if (offset + total_size > size) { +- printk(KERN_ERR "microcode: error! Bad data in microcode data file\n"); +- return -EINVAL; +- } +- +- *mc = vmalloc(total_size); +- if (!*mc) { +- printk(KERN_ERR "microcode: error! Can not allocate memory\n"); +- return -ENOMEM; +- } +- memcpy(*mc, (const void *)(buf + offset), total_size); +- return offset + total_size; ++ /* No more data */ ++ if ( offset >= size ) ++ return 0; ++ mc_header = (struct microcode_header_intel *)(buf + offset); ++ total_size = get_totalsize(mc_header); ++ ++ if ( (offset + total_size) > size ) ++ { ++ printk(KERN_ERR "microcode: error! Bad data in microcode data file\n"); ++ return -EINVAL; ++ } ++ ++ *mc = xmalloc_bytes(total_size); ++ if ( *mc == NULL ) ++ { ++ printk(KERN_ERR "microcode: error! Can not allocate memory\n"); ++ return -ENOMEM; ++ } ++ memcpy(*mc, (const void *)(buf + offset), total_size); ++ return offset + total_size; + } + + /* fake device for request_firmware */ +@@ -368,58 +323,61 @@ extern struct platform_device *microcode + + static int cpu_request_microcode(int cpu, const void *buf, size_t size) + { +- long offset = 0; +- int error = 0; +- void *mc; +- +- /* We should bind the task to the CPU */ +- BUG_ON(cpu != raw_smp_processor_id()); +- +- while ((offset = get_next_ucode_from_buffer(&mc, buf, size, offset)) +- > 0) { +- error = microcode_sanity_check(mc); +- if (error) +- break; +- error = get_matching_microcode(mc, cpu); +- if (error < 0) +- break; +- /* +- * It's possible the data file has multiple matching ucode, +- * lets keep searching till the latest version +- */ +- if (error == 1) { +- apply_microcode(cpu); +- error = 0; +- } +- vfree(mc); +- } +- if (offset > 0) +- vfree(mc); +- if (offset < 0) +- error = offset; ++ long offset = 0; ++ int error = 0; ++ void *mc; ++ ++ /* We should bind the task to the CPU */ ++ BUG_ON(cpu != raw_smp_processor_id()); ++ ++ while ( (offset = get_next_ucode_from_buffer(&mc, buf, size, offset)) > 0 ) ++ { ++ error = microcode_sanity_check(mc); ++ if ( error ) ++ break; ++ error = get_matching_microcode(mc, cpu); ++ if ( error < 0 ) ++ break; ++ /* ++ * It's possible the data file has multiple matching ucode, ++ * lets keep searching till the latest version ++ */ ++ if ( error == 1 ) ++ { ++ apply_microcode(cpu); ++ error = 0; ++ } ++ xfree(mc); ++ } ++ if ( offset > 0 ) ++ xfree(mc); ++ if ( offset < 0 ) ++ error = offset; + +- return error; ++ return error; + } + + static void microcode_fini_cpu(int cpu) + { +- struct ucode_cpu_info *uci = ucode_cpu_info + cpu; ++ struct ucode_cpu_info *uci = ucode_cpu_info + cpu; + +- vfree(uci->mc.mc_intel); +- uci->mc.mc_intel = NULL; ++ xfree(uci->mc.mc_intel); ++ uci->mc.mc_intel = NULL; + } + + static struct microcode_ops microcode_intel_ops = { +- .get_matching_microcode = get_matching_microcode, +- .microcode_sanity_check = microcode_sanity_check, +- .cpu_request_microcode = cpu_request_microcode, +- .collect_cpu_info = collect_cpu_info, +- .apply_microcode = apply_microcode, +- .microcode_fini_cpu = microcode_fini_cpu, ++ .get_matching_microcode = get_matching_microcode, ++ .microcode_sanity_check = microcode_sanity_check, ++ .cpu_request_microcode = cpu_request_microcode, ++ .collect_cpu_info = collect_cpu_info, ++ .apply_microcode = apply_microcode, ++ .microcode_fini_cpu = microcode_fini_cpu, + }; + +-int microcode_init_intel(struct cpuinfo_x86 *c) ++static __init int microcode_init_intel(void) + { +- microcode_ops = µcode_intel_ops; +- return 0; ++ if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL ) ++ microcode_ops = µcode_intel_ops; ++ return 0; + } ++__initcall(microcode_init_intel); +Index: xen-3.3.1-testing/xen/include/asm-x86/microcode.h +=================================================================== +--- xen-3.3.1-testing.orig/xen/include/asm-x86/microcode.h ++++ xen-3.3.1-testing/xen/include/asm-x86/microcode.h +@@ -90,11 +90,8 @@ struct ucode_cpu_info { + void *valid_mc; + } mc; + }; +-extern struct ucode_cpu_info ucode_cpu_info[]; + ++extern struct ucode_cpu_info ucode_cpu_info[]; + extern const struct microcode_ops *microcode_ops; + +-int microcode_init_amd(struct cpuinfo_x86 *c); +-int microcode_init_intel(struct cpuinfo_x86 *c); +- + #endif /* ASM_X86__MICROCODE_H */ diff --git a/18484-stubdom-ioemu-makefile.patch b/18484-stubdom-ioemu-makefile.patch new file mode 100644 index 0000000..1c80bd3 --- /dev/null +++ b/18484-stubdom-ioemu-makefile.patch @@ -0,0 +1,85 @@ +# HG changeset patch +# User Keir Fraser +# Date 1221565466 -3600 +# Node ID f03b0cc33576e4fe3ff6adfd0853addf676c105e +# Parent 087b8b29b6b20165062697305c6651ca2acb7b5b +stubdom/ioemu link farm creation fixes + +Replace the stubdom/ioemu link farm creation in stubdom/Makefile, +with code which arranges that: + * No symlinks are made for output files - in particular, any + symlinks for .d files would be written through by the compiler + and cause damage to the original tree and other strange + behaviours + * All subdirectories are made as local subdirectories rather than + links + * Any interrupted or half-completed creation of the link farm + leaves the directory in a state where the link farming will be + restarted + * We use make's inherent ability to test for the existence of files + rather than using [ -f ... ] at the start of the rule's commands + * The list of files to be excluded from the link farm can be + easily updated +etc. + +This should fix some problems particularly with parallel builds, +or by-hand builds where directories are entered in other than the +usual order. + +Signed-off-by: Ian Jackson + +Index: xen-3.3.1-testing/stubdom/Makefile +=================================================================== +--- xen-3.3.1-testing.orig/stubdom/Makefile ++++ xen-3.3.1-testing/stubdom/Makefile +@@ -164,7 +164,26 @@ lwip-$(XEN_TARGET_ARCH): lwip-$(LWIP_VER + .PHONY: $(CROSS_ROOT) + $(CROSS_ROOT): cross-newlib cross-zlib cross-libpci + +-mk-headers-$(XEN_TARGET_ARCH): ++ioemu/linkfarm.stamp: $(XEN_ROOT)/tools/ioemu-dir ++ mkdir -p ioemu ++ifeq ($(CONFIG_QEMU),ioemu) ++ [ -h ioemu/Makefile ] || ( cd ioemu && \ ++ ln -sf ../$(XEN_ROOT)/tools/ioemu/* .) ++else ++ set -e; \ ++ $(absolutify_xen_root); \ ++ cd ioemu; \ ++ src="$$XEN_ROOT/tools/ioemu-dir"; export src; \ ++ (cd $$src && find * -type d -print) | xargs mkdir -p; \ ++ (cd $$src && find * ! -type l -type f $(addprefix ! -name , \ ++ '*.[oda1]' 'config-*' config.mak qemu-dm qemu-img-xen \ ++ '*.html' '*.pod' \ ++ )) | \ ++ while read f; do rm -f "$$f"; ln -s "$$src/$$f" "$$f"; done ++endif ++ touch ioemu/linkfarm.stamp ++ ++mk-headers-$(XEN_TARGET_ARCH): ioemu/linkfarm.stamp + mkdir -p include/xen && \ + ln -sf $(addprefix ../../,$(wildcard $(XEN_ROOT)/xen/include/public/*.h)) include/xen && \ + ln -sf $(addprefix ../../$(XEN_ROOT)/xen/include/public/,arch-ia64 arch-x86 hvm io xsm) include/xen && \ +@@ -183,22 +202,6 @@ mk-headers-$(XEN_TARGET_ARCH): + ln -sf ../$(XEN_ROOT)/tools/libxc/$(XEN_TARGET_ARCH)/*.c . && \ + ln -sf ../$(XEN_ROOT)/tools/libxc/$(XEN_TARGET_ARCH)/*.h . && \ + ln -sf ../$(XEN_ROOT)/tools/libxc/$(XEN_TARGET_ARCH)/Makefile . ) +- mkdir -p ioemu +-ifeq ($(CONFIG_QEMU),ioemu) +- [ -h ioemu/Makefile ] || ( cd ioemu && \ +- ln -sf ../$(XEN_ROOT)/tools/ioemu/* .) +-else +- [ -h ioemu/Makefile ] || ( cd ioemu && \ +- ln -sf $(CONFIG_QEMU)/* . && \ +- rm -fr i386-dm && \ +- rm -fr i386-stubdom && \ +- mkdir i386-dm && \ +- mkdir i386-stubdom && \ +- ln -sf $(CONFIG_QEMU)/i386-dm/* i386-dm/ && \ +- ln -sf $(CONFIG_QEMU)/i386-stubdom/* i386-stubdom/ ) +-endif +- [ ! -h ioemu/config-host.h ] || rm -f ioemu/config-host.h +- [ ! -h ioemu/config-host.mak ] || rm -f ioemu/config-host.mak + $(MAKE) -C $(MINI_OS) links + touch mk-headers-$(XEN_TARGET_ARCH) + diff --git a/18487-microcode-update-irq-context.patch b/18487-microcode-update-irq-context.patch new file mode 100644 index 0000000..675bdd1 --- /dev/null +++ b/18487-microcode-update-irq-context.patch @@ -0,0 +1,149 @@ +# HG changeset patch +# User Keir Fraser +# Date 1221568859 -3600 +# Node ID 879330497672d96ee966c9774d21c437895f6839 +# Parent 88445b184dc666fc196cffab19eac75cd9c10b87 +x86, microcode: Do not run microcode update in IRQ context. + +It's unnecessary, and also invalid since the update process tries to +allocate memory. + +Signed-off-by: Keir Fraser + +Index: xen-3.3.1-testing/xen/arch/x86/microcode.c +=================================================================== +--- xen-3.3.1-testing.orig/xen/arch/x86/microcode.c ++++ xen-3.3.1-testing/xen/arch/x86/microcode.c +@@ -45,14 +45,13 @@ static DEFINE_SPINLOCK(microcode_mutex); + + struct ucode_cpu_info ucode_cpu_info[NR_CPUS]; + +-struct microcode_buffer { +- void *buf; +- size_t size; ++struct microcode_info { ++ unsigned int cpu; ++ uint32_t buffer_size; ++ int error; ++ char buffer[1]; + }; + +-static struct microcode_buffer microcode_buffer; +-static bool_t microcode_error; +- + static void microcode_fini_cpu(int cpu) + { + struct ucode_cpu_info *uci = ucode_cpu_info + cpu; +@@ -110,14 +109,12 @@ static int microcode_resume_cpu(int cpu) + return err; + } + +-static int microcode_update_cpu(int cpu, const void *buf, size_t size) ++static int microcode_update_cpu(const void *buf, size_t size) + { +- int err = 0; ++ int err; ++ unsigned int cpu = smp_processor_id(); + struct ucode_cpu_info *uci = ucode_cpu_info + cpu; + +- /* We should bind the task to the CPU */ +- BUG_ON(raw_smp_processor_id() != cpu); +- + spin_lock(µcode_mutex); + + /* +@@ -140,72 +137,50 @@ static int microcode_update_cpu(int cpu, + return err; + } + +-static void do_microcode_update_one(void *info) ++static long do_microcode_update(void *_info) + { ++ struct microcode_info *info = _info; + int error; + +- error = microcode_update_cpu( +- smp_processor_id(), microcode_buffer.buf, microcode_buffer.size); ++ BUG_ON(info->cpu != smp_processor_id()); + +- if ( error ) +- microcode_error = error; +-} ++ error = microcode_update_cpu(info->buffer, info->buffer_size); + +-static int do_microcode_update(void) +-{ +- int error = 0; +- +- microcode_error = 0; +- +- if ( on_each_cpu(do_microcode_update_one, NULL, 1, 1) != 0 ) +- { +- printk(KERN_ERR "microcode: Error! Could not run on all processors\n"); +- error = -EIO; +- goto out; +- } ++ if ( error ) ++ info->error = error; + +- if ( microcode_error ) +- { +- error = microcode_error; +- goto out; +- } ++ info->cpu = next_cpu(info->cpu, cpu_online_map); ++ if ( info->cpu >= NR_CPUS ) ++ return info->error; + +- out: +- return error; ++ return continue_hypercall_on_cpu(info->cpu, do_microcode_update, info); + } + + int microcode_update(XEN_GUEST_HANDLE(const_void) buf, unsigned long len) + { + int ret; ++ struct microcode_info *info; + +- /* XXX FIXME: No allocations in interrupt context. */ +- return -EINVAL; +- +- if ( len != (typeof(microcode_buffer.size))len ) +- { +- printk(KERN_ERR "microcode: too much data\n"); ++ if ( len != (uint32_t)len ) + return -E2BIG; +- } + + if (microcode_ops == NULL) + return -EINVAL; + +- microcode_buffer.buf = xmalloc_array(uint8_t, len); +- if ( microcode_buffer.buf == NULL ) ++ info = xmalloc_bytes(sizeof(*info) + len); ++ if ( info == NULL ) + return -ENOMEM; + +- ret = copy_from_guest(microcode_buffer.buf, buf, len); ++ ret = copy_from_guest(info->buffer, buf, len); + if ( ret != 0 ) ++ { ++ xfree(info); + return ret; ++ } + +- microcode_buffer.size = len; +- wmb(); +- +- ret = do_microcode_update(); +- +- xfree(microcode_buffer.buf); +- microcode_buffer.buf = NULL; +- microcode_buffer.size = 0; ++ info->buffer_size = len; ++ info->error = 0; ++ info->cpu = first_cpu(cpu_online_map); + +- return ret; ++ return continue_hypercall_on_cpu(info->cpu, do_microcode_update, info); + } diff --git a/18488-microcode-free-fix.patch b/18488-microcode-free-fix.patch new file mode 100644 index 0000000..3d33dae --- /dev/null +++ b/18488-microcode-free-fix.patch @@ -0,0 +1,29 @@ +# HG changeset patch +# User Keir Fraser +# Date 1221569356 -3600 +# Node ID f163138e33402ca565d9886df8ecb21e98f77be6 +# Parent 879330497672d96ee966c9774d21c437895f6839 +x86, microcode: Free microcode_info struct at end of hypercall. +Signed-off-by: Keir Fraser + +Index: xen-3.3.1-testing/xen/arch/x86/microcode.c +=================================================================== +--- xen-3.3.1-testing.orig/xen/arch/x86/microcode.c ++++ xen-3.3.1-testing/xen/arch/x86/microcode.c +@@ -150,10 +150,13 @@ static long do_microcode_update(void *_i + info->error = error; + + info->cpu = next_cpu(info->cpu, cpu_online_map); +- if ( info->cpu >= NR_CPUS ) +- return info->error; ++ if ( info->cpu < NR_CPUS ) ++ return continue_hypercall_on_cpu(info->cpu, do_microcode_update, info); ++ ++ error = info->error; ++ xfree(info); ++ return error; + +- return continue_hypercall_on_cpu(info->cpu, do_microcode_update, info); + } + + int microcode_update(XEN_GUEST_HANDLE(const_void) buf, unsigned long len) diff --git a/18505-amd-powernow-fix.patch b/18505-amd-powernow-fix.patch new file mode 100644 index 0000000..9c9561e --- /dev/null +++ b/18505-amd-powernow-fix.patch @@ -0,0 +1,76 @@ +# HG changeset patch +# User Keir Fraser +# Date 1221576857 -3600 +# Node ID 15efb62ecf09efd07105b10a3b0b84eecfe8ec8f +# Parent d7be37824fe0345b02d0fa8cc9aff01be1a2ba1f +x86: also fix powernow's dom_mask + +Just like for the Intel/ACPI cpufreq code, powernow's dom_mask also +must not be confined to the number of CPUs in the system. + +Signed-off-by: Jan Beulich + +Index: xen-3.3.1-testing/xen/arch/x86/acpi/cpufreq/powernow.c +=================================================================== +--- xen-3.3.1-testing.orig/xen/arch/x86/acpi/cpufreq/powernow.c ++++ xen-3.3.1-testing/xen/arch/x86/acpi/cpufreq/powernow.c +@@ -241,9 +241,8 @@ int powernow_cpufreq_init(void) + { + unsigned int i, ret = 0; + unsigned int dom, max_dom = 0; +- cpumask_t *pt, dom_mask; +- +- cpus_clear(dom_mask); ++ cpumask_t *pt; ++ unsigned long *dom_mask; + + for_each_online_cpu(i) { + struct cpuinfo_x86 *c = &cpu_data[i]; +@@ -258,20 +257,26 @@ int powernow_cpufreq_init(void) + } + if (ret) + return ret; +- cpu_set(processor_pminfo[i].perf.domain_info.domain, dom_mask); + if (max_dom < processor_pminfo[i].perf.domain_info.domain) + max_dom = processor_pminfo[i].perf.domain_info.domain; + } + max_dom++; + ++ dom_mask = xmalloc_array(unsigned long, BITS_TO_LONGS(max_dom)); ++ if (!dom_mask) ++ return -ENOMEM; ++ bitmap_zero(dom_mask, max_dom); ++ + pt = xmalloc_array(cpumask_t, max_dom); + if (!pt) + return -ENOMEM; + memset(pt, 0, max_dom * sizeof(cpumask_t)); + + /* get cpumask of each psd domain */ +- for_each_online_cpu(i) ++ for_each_online_cpu(i) { ++ __set_bit(processor_pminfo[i].perf.domain_info.domain, dom_mask); + cpu_set(i, pt[processor_pminfo[i].perf.domain_info.domain]); ++ } + + for_each_online_cpu(i) + processor_pminfo[i].perf.shared_cpu_map = +@@ -289,8 +294,8 @@ int powernow_cpufreq_init(void) + } + + /* setup ondemand cpufreq */ +- for (dom=0; dom +# Date 1221577042 -3600 +# Node ID 9ab9dadf4876fcab63fcc2e3a8ad13e87b1a8293 +# Parent 15efb62ecf09efd07105b10a3b0b84eecfe8ec8f +x86-64: enforce memory limits imposed by virtual memory layout + +... which currently means: +- The 1:1 map cannot deal with more than 1Tb. +- The m2p table can handle at most 8Tb. +- The page_info array can cover up to e.g. 1.6Gb (<=3D 64 CPUs) or + 1Tb (193-256 CPUs). + +Signed-off-by: Jan Beulich + +Index: xen-3.3.1-testing/xen/arch/x86/e820.c +=================================================================== +--- xen-3.3.1-testing.orig/xen/arch/x86/e820.c ++++ xen-3.3.1-testing/xen/arch/x86/e820.c +@@ -4,6 +4,7 @@ + #include + #include + #include ++#include + #include + + /* opt_mem: Limit of physical RAM. Any RAM beyond this point is ignored. */ +@@ -327,7 +328,7 @@ static void __init clip_to_limit(uint64_ + continue; + if ( warnmsg ) + { +- snprintf(_warnmsg, sizeof(_warnmsg), warnmsg, (int)(limit>>30)); ++ snprintf(_warnmsg, sizeof(_warnmsg), warnmsg, (long)(limit>>30)); + printk("WARNING: %s\n", _warnmsg); + } + printk("Truncating memory map to %lukB\n", +@@ -366,8 +367,25 @@ static void __init machine_specific_memo + + #ifdef __i386__ + clip_to_limit((1ULL << 30) * MACHPHYS_MBYTES, +- "Only the first %u GB of the physical memory map " ++ "Only the first %lu GB of the physical memory map " + "can be accessed by Xen in 32-bit mode."); ++#else ++ { ++ unsigned long limit, mpt_limit, pft_limit; ++ ++ limit = DIRECTMAP_VIRT_END - DIRECTMAP_VIRT_START; ++ mpt_limit = ((RDWR_MPT_VIRT_END - RDWR_MPT_VIRT_START) ++ / sizeof(unsigned long)) << PAGE_SHIFT; ++ pft_limit = ((FRAMETABLE_VIRT_END - FRAMETABLE_VIRT_START) ++ / sizeof(struct page_info)) << PAGE_SHIFT; ++ if ( limit > mpt_limit ) ++ limit = mpt_limit; ++ if ( limit > pft_limit ) ++ limit = pft_limit; ++ clip_to_limit(limit, ++ "Only the first %lu GB of the physical " ++ "memory map can be accessed by Xen."); ++ } + #endif + + reserve_dmi_region(); diff --git a/18509-continue-hypercall-on-cpu.patch b/18509-continue-hypercall-on-cpu.patch new file mode 100644 index 0000000..2be7402 --- /dev/null +++ b/18509-continue-hypercall-on-cpu.patch @@ -0,0 +1,136 @@ +# HG changeset patch +# User Keir Fraser +# Date 1221657190 -3600 +# Node ID 366c78ff361bafb2271c551c4976e4caedea72b2 +# Parent beb28a3975bd39c93c7934dd5e7ec80c69a86c4a +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. + +Signed-off-by: Keir Fraser + +Index: xen-3.3.1-testing/xen/arch/x86/domain.c +=================================================================== +--- xen-3.3.1-testing.orig/xen/arch/x86/domain.c ++++ xen-3.3.1-testing/xen/arch/x86/domain.c +@@ -1356,6 +1356,7 @@ struct migrate_info { + void *data; + void (*saved_schedule_tail)(struct vcpu *); + cpumask_t saved_affinity; ++ unsigned int nest; + }; + + static void continue_hypercall_on_cpu_helper(struct vcpu *v) +@@ -1363,48 +1364,64 @@ static void continue_hypercall_on_cpu_he + struct cpu_user_regs *regs = guest_cpu_user_regs(); + struct migrate_info *info = v->arch.continue_info; + cpumask_t mask = info->saved_affinity; ++ void (*saved_schedule_tail)(struct vcpu *) = info->saved_schedule_tail; + + regs->eax = info->func(info->data); + +- v->arch.schedule_tail = info->saved_schedule_tail; +- v->arch.continue_info = NULL; +- +- xfree(info); ++ if ( info->nest-- == 0 ) ++ { ++ xfree(info); ++ v->arch.schedule_tail = saved_schedule_tail; ++ v->arch.continue_info = NULL; ++ vcpu_unlock_affinity(v, &mask); ++ } + +- vcpu_unlock_affinity(v, &mask); +- schedule_tail(v); ++ (*saved_schedule_tail)(v); + } + + int continue_hypercall_on_cpu(int cpu, long (*func)(void *data), void *data) + { + struct vcpu *v = current; + struct migrate_info *info; ++ cpumask_t mask = cpumask_of_cpu(cpu); + int rc; + + if ( cpu == smp_processor_id() ) + return func(data); + +- info = xmalloc(struct migrate_info); ++ info = v->arch.continue_info; + if ( info == NULL ) +- return -ENOMEM; ++ { ++ info = xmalloc(struct migrate_info); ++ if ( info == NULL ) ++ return -ENOMEM; + +- info->func = func; +- info->data = data; +- info->saved_schedule_tail = v->arch.schedule_tail; +- info->saved_affinity = cpumask_of_cpu(cpu); ++ rc = vcpu_lock_affinity(v, &mask); ++ if ( rc ) ++ { ++ xfree(info); ++ return rc; ++ } + +- v->arch.schedule_tail = continue_hypercall_on_cpu_helper; +- v->arch.continue_info = info; ++ info->saved_schedule_tail = v->arch.schedule_tail; ++ info->saved_affinity = mask; ++ info->nest = 0; + +- rc = vcpu_lock_affinity(v, &info->saved_affinity); +- if ( rc ) ++ v->arch.schedule_tail = continue_hypercall_on_cpu_helper; ++ v->arch.continue_info = info; ++ } ++ else + { +- v->arch.schedule_tail = info->saved_schedule_tail; +- v->arch.continue_info = NULL; +- xfree(info); +- return rc; ++ BUG_ON(info->nest != 0); ++ rc = vcpu_locked_change_affinity(v, &mask); ++ if ( rc ) ++ return rc; ++ info->nest++; + } + ++ info->func = func; ++ info->data = data; ++ + /* Dummy return value will be overwritten by new schedule_tail. */ + BUG_ON(!test_bit(SCHEDULE_SOFTIRQ, &softirq_pending(smp_processor_id()))); + return 0; +Index: xen-3.3.1-testing/xen/common/schedule.c +=================================================================== +--- xen-3.3.1-testing.orig/xen/common/schedule.c ++++ xen-3.3.1-testing/xen/common/schedule.c +@@ -360,6 +360,11 @@ int vcpu_lock_affinity(struct vcpu *v, c + 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) + { + cpumask_t online_affinity; +Index: xen-3.3.1-testing/xen/include/xen/sched.h +=================================================================== +--- xen-3.3.1-testing.orig/xen/include/xen/sched.h ++++ xen-3.3.1-testing/xen/include/xen/sched.h +@@ -527,6 +527,7 @@ void vcpu_force_reschedule(struct vcpu * + void cpu_disable_scheduler(void); + 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); diff --git a/blktap-pv-cdrom.patch b/blktap-pv-cdrom.patch index 80bec88..a595f71 100644 --- a/blktap-pv-cdrom.patch +++ b/blktap-pv-cdrom.patch @@ -1,8 +1,8 @@ Index: xen-3.3.1-testing/tools/blktap/drivers/block-cdrom.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ xen-3.3.1-testing/tools/blktap/drivers/block-cdrom.c 2008-09-10 14:22:17.000000000 -0600 -@@ -0,0 +1,533 @@ ++++ xen-3.3.1-testing/tools/blktap/drivers/block-cdrom.c 2008-09-24 09:45:02.000000000 -0600 +@@ -0,0 +1,539 @@ +/* block-cdrom.c + * + * simple slow synchronous cdrom disk implementation. Based off @@ -285,15 +285,17 @@ Index: xen-3.3.1-testing/tools/blktap/drivers/block-cdrom.c + struct request_sense sense; + + sp = (union xen_block_packet *)buf; -+ sp->err = 0; -+ sp->ret = 0; + switch(sp->type) { + case XEN_TYPE_CDROM_SUPPORT: + xcs = &(sp->xcs); ++ xcs->err = 0; ++ xcs->ret = 0; + xcs->supported = 1; + break; + case XEN_TYPE_CDROM_PACKET: + xcp = &(sp->xcp); ++ xcp->err = 0; ++ xcp->ret = 0; + vgc = (struct vcd_generic_command *)(buf + PACKET_PAYLOAD_OFFSET); + + memset( &cgc, 0, sizeof(struct cdrom_generic_command)); @@ -382,6 +384,8 @@ Index: xen-3.3.1-testing/tools/blktap/drivers/block-cdrom.c + minor = minor (statbuf.st_rdev); + } + xco = &(sp->xco); ++ xco->err = 0; ++ xco->ret = 0; + if (xco->payload_offset) { + char * nodename; + char media_present[2]; @@ -412,6 +416,8 @@ Index: xen-3.3.1-testing/tools/blktap/drivers/block-cdrom.c + break; + case XEN_TYPE_CDROM_MEDIA_CHANGED: + xcmc = &(sp->xcmc); ++ xcmc->err = 0; ++ xcmc->ret = 0; + xcmc->media_changed = prv->media_changed; + prv->media_changed = 0; + break; @@ -539,8 +545,8 @@ Index: xen-3.3.1-testing/tools/blktap/drivers/block-cdrom.c Index: xen-3.3.1-testing/xen/include/public/io/cdromif.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ xen-3.3.1-testing/xen/include/public/io/cdromif.h 2008-09-10 13:19:09.000000000 -0600 -@@ -0,0 +1,122 @@ ++++ xen-3.3.1-testing/xen/include/public/io/cdromif.h 2008-09-24 09:42:05.000000000 -0600 +@@ -0,0 +1,120 @@ +/****************************************************************************** + * cdromif.h + * @@ -648,8 +654,6 @@ Index: xen-3.3.1-testing/xen/include/public/io/cdromif.h +union xen_block_packet +{ + uint32_t type; -+ int8_t ret; -+ int8_t err; + struct xen_cdrom_support xcs; + struct xen_cdrom_open xco; + struct xen_cdrom_media_changed xcmc; @@ -665,8 +669,8 @@ Index: xen-3.3.1-testing/xen/include/public/io/cdromif.h +#endif Index: xen-3.3.1-testing/tools/blktap/drivers/Makefile =================================================================== ---- xen-3.3.1-testing.orig/tools/blktap/drivers/Makefile 2008-09-10 11:28:21.000000000 -0600 -+++ xen-3.3.1-testing/tools/blktap/drivers/Makefile 2008-09-10 13:31:58.000000000 -0600 +--- xen-3.3.1-testing.orig/tools/blktap/drivers/Makefile 2008-09-23 06:52:48.000000000 -0600 ++++ xen-3.3.1-testing/tools/blktap/drivers/Makefile 2008-09-23 06:52:50.000000000 -0600 @@ -24,8 +24,9 @@ $(warning *** libgcrypt not installed: falling back to libcrypto ***) endif @@ -689,8 +693,8 @@ Index: xen-3.3.1-testing/tools/blktap/drivers/Makefile BLK-OBJS-$(CONFIG_Linux) += blk_linux.o Index: xen-3.3.1-testing/tools/blktap/drivers/tapdisk.h =================================================================== ---- xen-3.3.1-testing.orig/tools/blktap/drivers/tapdisk.h 2008-09-10 11:28:24.000000000 -0600 -+++ xen-3.3.1-testing/tools/blktap/drivers/tapdisk.h 2008-09-10 14:09:34.000000000 -0600 +--- xen-3.3.1-testing.orig/tools/blktap/drivers/tapdisk.h 2008-09-23 06:52:50.000000000 -0600 ++++ xen-3.3.1-testing/tools/blktap/drivers/tapdisk.h 2008-09-23 06:52:50.000000000 -0600 @@ -137,6 +137,9 @@ int (*td_get_parent_id) (struct disk_driver *dd, struct disk_id *id); int (*td_validate_parent)(struct disk_driver *dd, @@ -718,7 +722,7 @@ Index: xen-3.3.1-testing/tools/blktap/drivers/tapdisk.h + "raw image (cdrom)", + "cdrom", + 0, -+ 1, ++ 0, +#ifdef TAPDISK + &tapdisk_cdrom, +#endif @@ -727,10 +731,18 @@ Index: xen-3.3.1-testing/tools/blktap/drivers/tapdisk.h /*Main disk info array */ static disk_info_t *dtypes[] = { &aio_disk, +@@ -249,6 +264,7 @@ + &qcow_disk, + &qcow2_disk, + &ioemu_disk, ++ &cdrom_disk, + }; + + typedef struct driver_list_entry { Index: xen-3.3.1-testing/tools/blktap/lib/blktaplib.h =================================================================== ---- xen-3.3.1-testing.orig/tools/blktap/lib/blktaplib.h 2008-09-10 11:28:24.000000000 -0600 -+++ xen-3.3.1-testing/tools/blktap/lib/blktaplib.h 2008-09-10 13:45:24.000000000 -0600 +--- xen-3.3.1-testing.orig/tools/blktap/lib/blktaplib.h 2008-09-23 06:52:50.000000000 -0600 ++++ xen-3.3.1-testing/tools/blktap/lib/blktaplib.h 2008-09-23 06:52:50.000000000 -0600 @@ -221,6 +221,7 @@ #define DISK_TYPE_QCOW 4 #define DISK_TYPE_QCOW2 5 @@ -739,3 +751,60 @@ Index: xen-3.3.1-testing/tools/blktap/lib/blktaplib.h /* xenstore/xenbus: */ #define DOMNAME "Domain-0" +Index: xen-3.3.1-testing/xen/include/public/io/blkif.h +=================================================================== +--- xen-3.3.1-testing.orig/xen/include/public/io/blkif.h 2008-09-16 10:31:07.000000000 -0600 ++++ xen-3.3.1-testing/xen/include/public/io/blkif.h 2008-09-23 06:54:18.000000000 -0600 +@@ -76,6 +76,10 @@ + * "feature-flush-cache" node! + */ + #define BLKIF_OP_FLUSH_DISKCACHE 3 ++/* ++ * Device specific command packet contained within the request ++ */ ++#define BLKIF_OP_PACKET 4 + + /* + * Maximum scatter/gather segments per request. +Index: xen-3.3.1-testing/tools/blktap/drivers/tapdisk.c +=================================================================== +--- xen-3.3.1-testing.orig/tools/blktap/drivers/tapdisk.c 2008-09-16 10:31:02.000000000 -0600 ++++ xen-3.3.1-testing/tools/blktap/drivers/tapdisk.c 2008-09-23 06:56:45.000000000 -0600 +@@ -735,6 +735,22 @@ + goto out; + } + break; ++ case BLKIF_OP_PACKET: ++ ret = 0; ++ if (drv->td_queue_packet) ++ ret = drv->td_queue_packet(dd, sector_nr, ++ nsects, page, ++ send_responses, ++ idx, (void *)(long)i); ++ if (ret > 0) dd->early += ret; ++ else if (ret == -EBUSY) { ++ /* put req back on queue */ ++ --info->fe_ring.req_cons; ++ info->busy.req = req; ++ info->busy.seg_idx = i; ++ goto out; ++ } ++ break; + default: + DPRINTF("Unknown block operation\n"); + break; +Index: xen-3.3.1-testing/tools/python/xen/xend/server/BlktapController.py +=================================================================== +--- xen-3.3.1-testing.orig/tools/python/xen/xend/server/BlktapController.py 2008-09-16 10:31:03.000000000 -0600 ++++ xen-3.3.1-testing/tools/python/xen/xend/server/BlktapController.py 2008-09-23 07:02:27.000000000 -0600 +@@ -14,8 +14,8 @@ + 'ram', + 'qcow', + 'qcow2', +- +- 'ioemu' ++ 'ioemu', ++ 'cdrom', + ] + + class BlktapController(BlkifController): diff --git a/blktapctrl-default-to-ioemu.patch b/blktapctrl-default-to-ioemu.patch index 460b972..2816a0a 100644 --- a/blktapctrl-default-to-ioemu.patch +++ b/blktapctrl-default-to-ioemu.patch @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/tools/blktap/drivers/blktapctrl.c +Index: xen-3.3.1-testing/tools/blktap/drivers/blktapctrl.c =================================================================== ---- xen-3.3.0-testing.orig/tools/blktap/drivers/blktapctrl.c -+++ xen-3.3.0-testing/tools/blktap/drivers/blktapctrl.c +--- xen-3.3.1-testing.orig/tools/blktap/drivers/blktapctrl.c ++++ xen-3.3.1-testing/tools/blktap/drivers/blktapctrl.c @@ -65,6 +65,8 @@ #define MAX_RAND_VAL 0xFFFF #define MAX_ATTEMPTS 10 @@ -23,7 +23,7 @@ Index: xen-3.3.0-testing/tools/blktap/drivers/blktapctrl.c if (dtypes[i]->single_handler == 1) { /* Check whether tapdisk process -@@ -474,6 +479,7 @@ static int launch_tapdisk_provider(char +@@ -474,6 +479,7 @@ static int launch_tapdisk_provider(char return child; } @@ -39,7 +39,7 @@ Index: xen-3.3.0-testing/tools/blktap/drivers/blktapctrl.c static int launch_tapdisk_ioemu(void) { -@@ -554,6 +561,7 @@ static int connect_qemu(blkif_t *blkif, +@@ -554,6 +561,7 @@ static int connect_qemu(blkif_t *blkif, return 0; } @@ -55,7 +55,7 @@ Index: xen-3.3.0-testing/tools/blktap/drivers/blktapctrl.c static int blktapctrl_new_blkif(blkif_t *blkif) { -@@ -621,6 +630,10 @@ static int blktapctrl_new_blkif(blkif_t +@@ -621,6 +630,10 @@ static int blktapctrl_new_blkif(blkif_t blkif->cookie = next_cookie++; if (!exist) { @@ -66,7 +66,7 @@ Index: xen-3.3.0-testing/tools/blktap/drivers/blktapctrl.c if (type == DISK_TYPE_IOEMU) { if (connect_qemu(blkif, blkif->domid)) goto fail; -@@ -628,6 +641,7 @@ static int blktapctrl_new_blkif(blkif_t +@@ -628,6 +641,7 @@ static int blktapctrl_new_blkif(blkif_t if (connect_tapdisk(blkif, minor)) goto fail; } @@ -74,10 +74,10 @@ Index: xen-3.3.0-testing/tools/blktap/drivers/blktapctrl.c } else { DPRINTF("Process exists!\n"); -Index: xen-3.3.0-testing/tools/blktap/drivers/tapdisk.h +Index: xen-3.3.1-testing/tools/blktap/drivers/tapdisk.h =================================================================== ---- xen-3.3.0-testing.orig/tools/blktap/drivers/tapdisk.h -+++ xen-3.3.0-testing/tools/blktap/drivers/tapdisk.h +--- xen-3.3.1-testing.orig/tools/blktap/drivers/tapdisk.h ++++ xen-3.3.1-testing/tools/blktap/drivers/tapdisk.h @@ -145,6 +145,8 @@ typedef struct disk_info { char handle[10]; /* xend handle, e.g. 'ram' */ int single_handler; /* is there a single controller for all */ diff --git a/block-flags.diff b/block-flags.diff index 2802368..c86ccfc 100644 --- a/block-flags.diff +++ b/block-flags.diff @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/tools/examples/block +Index: xen-3.3.1-testing/tools/examples/block =================================================================== ---- xen-3.3.0-testing.orig/tools/examples/block -+++ xen-3.3.0-testing/tools/examples/block +--- xen-3.3.1-testing.orig/tools/examples/block ++++ xen-3.3.1-testing/tools/examples/block @@ -225,11 +225,14 @@ case "$command" in ;; diff --git a/block-losetup-retry.diff b/block-losetup-retry.diff index 9d7d727..4b5520d 100644 --- a/block-losetup-retry.diff +++ b/block-losetup-retry.diff @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/tools/examples/block +Index: xen-3.3.1-testing/tools/examples/block =================================================================== ---- xen-3.3.0-testing.orig/tools/examples/block -+++ xen-3.3.0-testing/tools/examples/block +--- xen-3.3.1-testing.orig/tools/examples/block ++++ xen-3.3.1-testing/tools/examples/block @@ -241,107 +241,111 @@ case "$command" in mount it read-write in a guest domain." fi diff --git a/bridge-bonding.diff b/bridge-bonding.diff index 80f5e8b..17636cc 100644 --- a/bridge-bonding.diff +++ b/bridge-bonding.diff @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/tools/examples/network-bridge +Index: xen-3.3.1-testing/tools/examples/network-bridge =================================================================== ---- xen-3.3.0-testing.orig/tools/examples/network-bridge -+++ xen-3.3.0-testing/tools/examples/network-bridge +--- xen-3.3.1-testing.orig/tools/examples/network-bridge ++++ xen-3.3.1-testing/tools/examples/network-bridge @@ -241,6 +241,9 @@ op_start () { return fi diff --git a/bridge-opensuse.patch b/bridge-opensuse.patch index 62d895d..53005a4 100644 --- a/bridge-opensuse.patch +++ b/bridge-opensuse.patch @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/tools/examples/network-bridge +Index: xen-3.3.1-testing/tools/examples/network-bridge =================================================================== ---- xen-3.3.0-testing.orig/tools/examples/network-bridge -+++ xen-3.3.0-testing/tools/examples/network-bridge +--- xen-3.3.1-testing.orig/tools/examples/network-bridge ++++ xen-3.3.1-testing/tools/examples/network-bridge @@ -253,18 +253,18 @@ op_stop () { transfer_addrs ${bridge} ${pdev} if ! ifdown ${bridge}; then diff --git a/bridge-record-creation.patch b/bridge-record-creation.patch index c36fe6b..8c78c3d 100644 --- a/bridge-record-creation.patch +++ b/bridge-record-creation.patch @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/tools/examples/network-bridge +Index: xen-3.3.1-testing/tools/examples/network-bridge =================================================================== ---- xen-3.3.0-testing.orig/tools/examples/network-bridge -+++ xen-3.3.0-testing/tools/examples/network-bridge +--- xen-3.3.1-testing.orig/tools/examples/network-bridge ++++ xen-3.3.1-testing/tools/examples/network-bridge @@ -249,6 +249,11 @@ op_start () { create_bridge ${tdev} diff --git a/bridge-vlan.diff b/bridge-vlan.diff index 3d834a0..34628ed 100644 --- a/bridge-vlan.diff +++ b/bridge-vlan.diff @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/tools/examples/network-bridge +Index: xen-3.3.1-testing/tools/examples/network-bridge =================================================================== ---- xen-3.3.0-testing.orig/tools/examples/network-bridge -+++ xen-3.3.0-testing/tools/examples/network-bridge +--- xen-3.3.1-testing.orig/tools/examples/network-bridge ++++ xen-3.3.1-testing/tools/examples/network-bridge @@ -191,6 +191,28 @@ antispoofing () { iptables -A FORWARD -m physdev --physdev-in ${pdev} -j ACCEPT } diff --git a/build-tapdisk-ioemu.patch b/build-tapdisk-ioemu.patch index 09df263..38baffd 100644 --- a/build-tapdisk-ioemu.patch +++ b/build-tapdisk-ioemu.patch @@ -42,7 +42,7 @@ Index: xen-3.3.1-testing/tools/ioemu-remote/configure =================================================================== --- xen-3.3.1-testing.orig/tools/ioemu-remote/configure +++ xen-3.3.1-testing/tools/ioemu-remote/configure -@@ -1144,7 +1144,7 @@ fi +@@ -1150,7 +1150,7 @@ fi echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h diff --git a/cdrom-removable.patch b/cdrom-removable.patch index 2fdfcc6..f628434 100644 --- a/cdrom-removable.patch +++ b/cdrom-removable.patch @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/tools/python/xen/xend/server/HalDaemon.py +Index: xen-3.3.1-testing/tools/python/xen/xend/server/HalDaemon.py =================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ xen-3.3.0-testing/tools/python/xen/xend/server/HalDaemon.py 2008-08-29 06:25:55.000000000 -0600 +--- /dev/null ++++ xen-3.3.1-testing/tools/python/xen/xend/server/HalDaemon.py @@ -0,0 +1,243 @@ +#!/usr/bin/env python +# -*- mode: python; -*- @@ -246,10 +246,10 @@ Index: xen-3.3.0-testing/tools/python/xen/xend/server/HalDaemon.py + print 'Falling off end' + + -Index: xen-3.3.0-testing/tools/python/xen/xend/server/Hald.py +Index: xen-3.3.1-testing/tools/python/xen/xend/server/Hald.py =================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ xen-3.3.0-testing/tools/python/xen/xend/server/Hald.py 2008-08-29 06:11:48.000000000 -0600 +--- /dev/null ++++ xen-3.3.1-testing/tools/python/xen/xend/server/Hald.py @@ -0,0 +1,125 @@ +#============================================================================ +# This library is free software; you can redistribute it and/or @@ -376,11 +376,11 @@ Index: xen-3.3.0-testing/tools/python/xen/xend/server/Hald.py + watcher.run() + time.sleep(10) + watcher.shutdown() -Index: xen-3.3.0-testing/tools/python/xen/xend/server/SrvServer.py +Index: xen-3.3.1-testing/tools/python/xen/xend/server/SrvServer.py =================================================================== ---- xen-3.3.0-testing.orig/tools/python/xen/xend/server/SrvServer.py 2008-08-22 08:34:00.000000000 -0600 -+++ xen-3.3.0-testing/tools/python/xen/xend/server/SrvServer.py 2008-08-29 06:11:48.000000000 -0600 -@@ -56,6 +56,7 @@ +--- xen-3.3.1-testing.orig/tools/python/xen/xend/server/SrvServer.py ++++ xen-3.3.1-testing/tools/python/xen/xend/server/SrvServer.py +@@ -56,6 +56,7 @@ from xen.web.SrvDir import SrvDir from SrvRoot import SrvRoot from XMLRPCServer import XMLRPCServer @@ -388,7 +388,7 @@ Index: xen-3.3.0-testing/tools/python/xen/xend/server/SrvServer.py xoptions = XendOptions.instance() -@@ -245,6 +246,8 @@ +@@ -245,6 +246,8 @@ def _loadConfig(servers, root, reload): if xoptions.get_xend_unix_xmlrpc_server(): servers.add(XMLRPCServer(XendAPI.AUTH_PAM, False)) @@ -397,11 +397,11 @@ Index: xen-3.3.0-testing/tools/python/xen/xend/server/SrvServer.py def create(): root = SrvDir() -Index: xen-3.3.0-testing/tools/ioemu-remote/xenstore.c +Index: xen-3.3.1-testing/tools/ioemu-remote/xenstore.c =================================================================== ---- xen-3.3.0-testing.orig/tools/ioemu-remote/xenstore.c 2008-08-22 08:35:31.000000000 -0600 -+++ xen-3.3.0-testing/tools/ioemu-remote/xenstore.c 2008-08-29 06:11:48.000000000 -0600 -@@ -297,6 +297,16 @@ +--- xen-3.3.1-testing.orig/tools/ioemu-remote/xenstore.c ++++ xen-3.3.1-testing/tools/ioemu-remote/xenstore.c +@@ -297,6 +297,16 @@ void xenstore_parse_domain_config(int hv bdrv_set_type_hint(bs, BDRV_TYPE_CDROM); if (pasprintf(&buf, "%s/params", bpath) != -1) xs_watch(xsh, buf, dev); @@ -418,7 +418,7 @@ Index: xen-3.3.0-testing/tools/ioemu-remote/xenstore.c } /* open device now if media present */ -@@ -631,6 +641,50 @@ +@@ -631,6 +641,50 @@ void xenstore_record_dm_state(char *stat xenstore_record_dm("state", state); } @@ -469,7 +469,7 @@ Index: xen-3.3.0-testing/tools/ioemu-remote/xenstore.c void xenstore_process_event(void *opaque) { char **vec, *offset, *bpath = NULL, *buf = NULL, *drv = NULL, *image = NULL; -@@ -650,6 +704,11 @@ +@@ -650,6 +704,11 @@ void xenstore_process_event(void *opaque goto out; } diff --git a/dump-exec-state.patch b/dump-exec-state.patch index 39572a8..f9692a3 100644 --- a/dump-exec-state.patch +++ b/dump-exec-state.patch @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/xen/arch/ia64/linux-xen/smp.c +Index: xen-3.3.1-testing/xen/arch/ia64/linux-xen/smp.c =================================================================== ---- xen-3.3.0-testing.orig/xen/arch/ia64/linux-xen/smp.c -+++ xen-3.3.0-testing/xen/arch/ia64/linux-xen/smp.c +--- xen-3.3.1-testing.orig/xen/arch/ia64/linux-xen/smp.c ++++ xen-3.3.1-testing/xen/arch/ia64/linux-xen/smp.c @@ -175,7 +175,7 @@ handle_IPI (int irq, void *dev_id, struc * At this point the structure may be gone unless * wait is true. @@ -11,10 +11,10 @@ Index: xen-3.3.0-testing/xen/arch/ia64/linux-xen/smp.c /* Notify the sending CPU that the task is done. */ mb(); -Index: xen-3.3.0-testing/xen/arch/x86/smp.c +Index: xen-3.3.1-testing/xen/arch/x86/smp.c =================================================================== ---- xen-3.3.0-testing.orig/xen/arch/x86/smp.c -+++ xen-3.3.0-testing/xen/arch/x86/smp.c +--- xen-3.3.1-testing.orig/xen/arch/x86/smp.c ++++ xen-3.3.1-testing/xen/arch/x86/smp.c @@ -357,7 +357,7 @@ fastcall void smp_call_function_interrup if ( call_data->wait ) @@ -33,10 +33,10 @@ Index: xen-3.3.0-testing/xen/arch/x86/smp.c } irq_exit(); -Index: xen-3.3.0-testing/xen/common/keyhandler.c +Index: xen-3.3.1-testing/xen/common/keyhandler.c =================================================================== ---- xen-3.3.0-testing.orig/xen/common/keyhandler.c -+++ xen-3.3.0-testing/xen/common/keyhandler.c +--- xen-3.3.1-testing.orig/xen/common/keyhandler.c ++++ xen-3.3.1-testing/xen/common/keyhandler.c @@ -91,14 +91,25 @@ static void show_handlers(unsigned char key_table[i].desc); } @@ -83,10 +83,10 @@ Index: xen-3.3.0-testing/xen/common/keyhandler.c on_selected_cpus(cpumask_of_cpu(cpu), __dump_execstate, NULL, 1, 1); } -Index: xen-3.3.0-testing/xen/include/asm-ia64/linux-xen/asm/ptrace.h +Index: xen-3.3.1-testing/xen/include/asm-ia64/linux-xen/asm/ptrace.h =================================================================== ---- xen-3.3.0-testing.orig/xen/include/asm-ia64/linux-xen/asm/ptrace.h -+++ xen-3.3.0-testing/xen/include/asm-ia64/linux-xen/asm/ptrace.h +--- xen-3.3.1-testing.orig/xen/include/asm-ia64/linux-xen/asm/ptrace.h ++++ xen-3.3.1-testing/xen/include/asm-ia64/linux-xen/asm/ptrace.h @@ -278,7 +278,7 @@ struct switch_stack { # define ia64_task_regs(t) (((struct pt_regs *) ((char *) (t) + IA64_STK_OFFSET)) - 1) # define ia64_psr(regs) ((struct ia64_psr *) &(regs)->cr_ipsr) diff --git a/hv_xen_extension.patch b/hv_xen_extension.patch index 19f11f1..13d75e3 100644 --- a/hv_xen_extension.patch +++ b/hv_xen_extension.patch @@ -1,8 +1,8 @@ %patch -Index: xen-unstable.hg/xen/include/asm-x86/hvm/hvm_extensions.h +Index: xen-3.3.1-testing/xen/include/asm-x86/hvm/hvm_extensions.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ xen-unstable.hg/xen/include/asm-x86/hvm/hvm_extensions.h 2008-05-22 18:11:26.000000000 -0400 ++++ xen-3.3.1-testing/xen/include/asm-x86/hvm/hvm_extensions.h 2008-09-17 17:30:15.000000000 -0600 @@ -0,0 +1,165 @@ +/**************************************************************************** + | @@ -169,17 +169,17 @@ Index: xen-unstable.hg/xen/include/asm-x86/hvm/hvm_extensions.h +int hyperx_initialize(struct domain *d); + +#endif -Index: xen-unstable.hg/xen/arch/x86/hvm/hyperv/Makefile +Index: xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/Makefile =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ xen-unstable.hg/xen/arch/x86/hvm/hyperv/Makefile 2008-05-22 18:11:26.000000000 -0400 ++++ xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/Makefile 2008-09-17 17:30:15.000000000 -0600 @@ -0,0 +1,2 @@ +obj-y += hv_intercept.o +obj-y += hv_hypercall.o -Index: xen-unstable.hg/xen/arch/x86/hvm/hyperv/hv_errno.h +Index: xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/hv_errno.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ xen-unstable.hg/xen/arch/x86/hvm/hyperv/hv_errno.h 2008-05-22 18:11:26.000000000 -0400 ++++ xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/hv_errno.h 2008-09-17 17:30:15.000000000 -0600 @@ -0,0 +1,62 @@ +/**************************************************************************** + | @@ -243,10 +243,10 @@ Index: xen-unstable.hg/xen/arch/x86/hvm/hyperv/hv_errno.h +#define HV_STATUS_NO_MEMORY_256PAGES 0x0103 +#define HV_STATUS_NO_MEMORY_1024PAGES 0x0104 +#endif -Index: xen-unstable.hg/xen/arch/x86/hvm/hyperv/hv_hypercall.c +Index: xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/hv_hypercall.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ xen-unstable.hg/xen/arch/x86/hvm/hyperv/hv_hypercall.c 2008-05-22 18:11:26.000000000 -0400 ++++ xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/hv_hypercall.c 2008-09-17 17:30:15.000000000 -0600 @@ -0,0 +1,125 @@ +/**************************************************************************** + | @@ -373,10 +373,10 @@ Index: xen-unstable.hg/xen/arch/x86/hvm/hyperv/hv_hypercall.c + return; + } +} -Index: xen-unstable.hg/xen/arch/x86/hvm/hyperv/hv_hypercall.h +Index: xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/hv_hypercall.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ xen-unstable.hg/xen/arch/x86/hvm/hyperv/hv_hypercall.h 2008-05-22 18:11:26.000000000 -0400 ++++ xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/hv_hypercall.h 2008-09-17 17:30:15.000000000 -0600 @@ -0,0 +1,45 @@ +/**************************************************************************** + | @@ -423,11 +423,11 @@ Index: xen-unstable.hg/xen/arch/x86/hvm/hyperv/hv_hypercall.h +#define HV_FLUSH_VA_LIST 0x0003 + +#endif /* HV_HYPERCALL_H */ -Index: xen-unstable.hg/xen/arch/x86/hvm/hyperv/hv_intercept.c +Index: xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/hv_intercept.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ xen-unstable.hg/xen/arch/x86/hvm/hyperv/hv_intercept.c 2008-05-23 14:37:49.000000000 -0400 -@@ -0,0 +1,983 @@ ++++ xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/hv_intercept.c 2008-09-17 18:22:05.000000000 -0600 +@@ -0,0 +1,977 @@ +/**************************************************************************** + | + | Copyright (c) [2007, 2008] Novell, Inc. @@ -764,7 +764,7 @@ Index: xen-unstable.hg/xen/arch/x86/hvm/hyperv/hv_intercept.c + *(u8 *)(p + 1) = 0x00; + *(u8 *)(p + 2) = 0x00; + *(u8 *)(p + 3) = 0x00; -+ *(u8 *)(p + 4) = 0x08; /* eax |= HYPERV_HCALL */ ++ *(u8 *)(p + 4) = 0x80; /* eax |= HYPERV_HCALL */ + + *(u8 *)(p + 5) = 0x0f; /* vmcall */ + *(u8 *)(p + 6) = 0x01; @@ -1082,7 +1082,6 @@ Index: xen-unstable.hg/xen/arch/x86/hvm/hyperv/hv_intercept.c + if (input == 0x00000001) + { + *ecx |= 0x80000000; -+printk("KYS: hypervisor enabled\n"); + return (1); + } + @@ -1100,7 +1099,6 @@ Index: xen-unstable.hg/xen/arch/x86/hvm/hyperv/hv_intercept.c + *ebx = 0x65766f4e; /* "Nove" */ + *ecx = 0x68536c6c; /* "llSh" */ + *edx = 0x76486d69; /* "imHv" */ -+printk("KYS: hypervisor dentified\n"); + break; + + case 1: @@ -1149,7 +1147,6 @@ Index: xen-unstable.hg/xen/arch/x86/hvm/hyperv/hv_intercept.c + *ebx = (HV_SHIM_PRIVILEGES>>32); + *ecx = 0; /* Reserved */ + *edx = 0; /*No MWAIT (bit 0), No debugging (bit 1)*/ -+printk("KYS: hypervisor Feature identified\n"); + break; + case 4: + /* @@ -1159,7 +1156,6 @@ Index: xen-unstable.hg/xen/arch/x86/hvm/hyperv/hv_intercept.c + *ebx = 0; /* Reserved */ + *ecx = 0; /* Reserved */ + *edx = 0; /* Reserved */ -+printk("KYS: hypervisor recommendation %x\n", *eax); + break; + case 5: + /* @@ -1203,7 +1199,6 @@ Index: xen-unstable.hg/xen/arch/x86/hvm/hyperv/hv_intercept.c + return (0); + switch (idx) + { -+printk("KYS: msr read idx: %d\n", idx); + case HV_MSR_GUEST_OS_ID: + spin_lock(&curp->lock); + regs->eax = (u32)(curp->guest_id_msr & 0xFFFFFFFF); @@ -1318,7 +1313,6 @@ Index: xen-unstable.hg/xen/arch/x86/hvm/hyperv/hv_intercept.c + + switch (idx) + { -+printk("KYS: msr write idx: %d\n", idx); + case HV_MSR_GUEST_OS_ID: + hv_write_guestid_msr(curp, cur_vcpu, msr_content); + break; @@ -1411,10 +1405,10 @@ Index: xen-unstable.hg/xen/arch/x86/hvm/hyperv/hv_intercept.c + hvm_inject_exception(TRAP_gp_fault, 0, 0); + return (1); +} -Index: xen-unstable.hg/xen/arch/x86/hvm/hyperv/hv_shim.h +Index: xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/hv_shim.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ xen-unstable.hg/xen/arch/x86/hvm/hyperv/hv_shim.h 2008-05-22 18:11:26.000000000 -0400 ++++ xen-3.3.1-testing/xen/arch/x86/hvm/hyperv/hv_shim.h 2008-09-17 17:30:15.000000000 -0600 @@ -0,0 +1,281 @@ +/**************************************************************************** + | diff --git a/ioemu-blktap-barriers.patch b/ioemu-blktap-barriers.patch index 781c1b6..465c890 100644 --- a/ioemu-blktap-barriers.patch +++ b/ioemu-blktap-barriers.patch @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/tools/ioemu-remote/hw/xen_blktap.c +Index: xen-3.3.1-testing/tools/ioemu-remote/hw/xen_blktap.c =================================================================== ---- xen-3.3.0-testing.orig/tools/ioemu-remote/hw/xen_blktap.c -+++ xen-3.3.0-testing/tools/ioemu-remote/hw/xen_blktap.c +--- xen-3.3.1-testing.orig/tools/ioemu-remote/hw/xen_blktap.c ++++ xen-3.3.1-testing/tools/ioemu-remote/hw/xen_blktap.c @@ -357,6 +357,15 @@ static void qemu_send_responses(void* op } diff --git a/ioemu-blktap-fix-open.patch b/ioemu-blktap-fix-open.patch index ea40a1a..d151baf 100644 --- a/ioemu-blktap-fix-open.patch +++ b/ioemu-blktap-fix-open.patch @@ -6,10 +6,10 @@ Date: Wed Jul 23 10:51:07 2008 +0200 Signed-off-by: Kevin Wolf -Index: xen-3.3.0-testing/tools/ioemu-remote/hw/xen_blktap.c +Index: xen-3.3.1-testing/tools/ioemu-remote/hw/xen_blktap.c =================================================================== ---- xen-3.3.0-testing.orig/tools/ioemu-remote/hw/xen_blktap.c -+++ xen-3.3.0-testing/tools/ioemu-remote/hw/xen_blktap.c +--- xen-3.3.1-testing.orig/tools/ioemu-remote/hw/xen_blktap.c ++++ xen-3.3.1-testing/tools/ioemu-remote/hw/xen_blktap.c @@ -32,6 +32,11 @@ #include #include @@ -62,10 +62,10 @@ Index: xen-3.3.0-testing/tools/ioemu-remote/hw/xen_blktap.c return 0; } -Index: xen-3.3.0-testing/tools/ioemu-remote/hw/xen_blktap.h +Index: xen-3.3.1-testing/tools/ioemu-remote/hw/xen_blktap.h =================================================================== ---- xen-3.3.0-testing.orig/tools/ioemu-remote/hw/xen_blktap.h -+++ xen-3.3.0-testing/tools/ioemu-remote/hw/xen_blktap.h +--- xen-3.3.1-testing.orig/tools/ioemu-remote/hw/xen_blktap.h ++++ xen-3.3.1-testing/tools/ioemu-remote/hw/xen_blktap.h @@ -30,11 +30,6 @@ typedef uint32_t td_flag_t; #define TD_RDONLY 1 @@ -78,10 +78,10 @@ Index: xen-3.3.0-testing/tools/ioemu-remote/hw/xen_blktap.h /* This structure represents the state of an active virtual disk. */ struct td_state { BlockDriverState* bs; -Index: xen-3.3.0-testing/tools/ioemu-remote/sysemu.h +Index: xen-3.3.1-testing/tools/ioemu-remote/sysemu.h =================================================================== ---- xen-3.3.0-testing.orig/tools/ioemu-remote/sysemu.h -+++ xen-3.3.0-testing/tools/ioemu-remote/sysemu.h +--- xen-3.3.1-testing.orig/tools/ioemu-remote/sysemu.h ++++ xen-3.3.1-testing/tools/ioemu-remote/sysemu.h @@ -116,6 +116,7 @@ extern unsigned int nb_prom_envs; #endif @@ -90,10 +90,10 @@ Index: xen-3.3.0-testing/tools/ioemu-remote/sysemu.h IF_IDE, IF_SCSI, IF_FLOPPY, IF_PFLASH, IF_MTD, IF_SD } BlockInterfaceType; -Index: xen-3.3.0-testing/tools/ioemu-remote/vl.c +Index: xen-3.3.1-testing/tools/ioemu-remote/vl.c =================================================================== ---- xen-3.3.0-testing.orig/tools/ioemu-remote/vl.c -+++ xen-3.3.0-testing/tools/ioemu-remote/vl.c +--- xen-3.3.1-testing.orig/tools/ioemu-remote/vl.c ++++ xen-3.3.1-testing/tools/ioemu-remote/vl.c @@ -5414,6 +5414,9 @@ static int drive_init(struct drive_opt * case IF_PFLASH: case IF_MTD: diff --git a/ioemu-blktap-image-format.patch b/ioemu-blktap-image-format.patch index 8b21cd0..115c476 100644 --- a/ioemu-blktap-image-format.patch +++ b/ioemu-blktap-image-format.patch @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/tools/blktap/drivers/tapdisk.h +Index: xen-3.3.1-testing/tools/blktap/drivers/tapdisk.h =================================================================== ---- xen-3.3.0-testing.orig/tools/blktap/drivers/tapdisk.h -+++ xen-3.3.0-testing/tools/blktap/drivers/tapdisk.h +--- xen-3.3.1-testing.orig/tools/blktap/drivers/tapdisk.h ++++ xen-3.3.1-testing/tools/blktap/drivers/tapdisk.h @@ -159,16 +159,6 @@ extern struct tap_disk tapdisk_ram; extern struct tap_disk tapdisk_qcow; extern struct tap_disk tapdisk_qcow2; @@ -19,10 +19,10 @@ Index: xen-3.3.0-testing/tools/blktap/drivers/tapdisk.h /*Define Individual Disk Parameters here */ static disk_info_t aio_disk = { -Index: xen-3.3.0-testing/tools/blktap/lib/blktaplib.h +Index: xen-3.3.1-testing/tools/blktap/lib/blktaplib.h =================================================================== ---- xen-3.3.0-testing.orig/tools/blktap/lib/blktaplib.h -+++ xen-3.3.0-testing/tools/blktap/lib/blktaplib.h +--- xen-3.3.1-testing.orig/tools/blktap/lib/blktaplib.h ++++ xen-3.3.1-testing/tools/blktap/lib/blktaplib.h @@ -211,6 +211,17 @@ typedef struct msg_pid { #define CTLMSG_PID 9 #define CTLMSG_PID_RSP 10 @@ -41,10 +41,10 @@ Index: xen-3.3.0-testing/tools/blktap/lib/blktaplib.h /* xenstore/xenbus: */ #define DOMNAME "Domain-0" int setup_probe_watch(struct xs_handle *h); -Index: xen-3.3.0-testing/tools/ioemu-remote/hw/xen_blktap.c +Index: xen-3.3.1-testing/tools/ioemu-remote/hw/xen_blktap.c =================================================================== ---- xen-3.3.0-testing.orig/tools/ioemu-remote/hw/xen_blktap.c -+++ xen-3.3.0-testing/tools/ioemu-remote/hw/xen_blktap.c +--- xen-3.3.1-testing.orig/tools/ioemu-remote/hw/xen_blktap.c ++++ xen-3.3.1-testing/tools/ioemu-remote/hw/xen_blktap.c @@ -222,9 +222,10 @@ static int map_new_dev(struct td_state * return -1; } @@ -81,7 +81,7 @@ Index: xen-3.3.0-testing/tools/ioemu-remote/hw/xen_blktap.c fprintf(stderr, "Could not open image file %s\n", path); return -ENOMEM; } -@@ -529,7 +545,7 @@ static void handle_blktap_ctrlmsg(void* +@@ -529,7 +545,7 @@ static void handle_blktap_ctrlmsg(void* s = state_init(); /*Open file*/ @@ -90,10 +90,10 @@ Index: xen-3.3.0-testing/tools/ioemu-remote/hw/xen_blktap.c msglen = sizeof(msg_hdr_t); msg->type = CTLMSG_IMG_FAIL; msg->len = msglen; -Index: xen-3.3.0-testing/tools/ioemu-remote/hw/xen_blktap.h +Index: xen-3.3.1-testing/tools/ioemu-remote/hw/xen_blktap.h =================================================================== ---- xen-3.3.0-testing.orig/tools/ioemu-remote/hw/xen_blktap.h -+++ xen-3.3.0-testing/tools/ioemu-remote/hw/xen_blktap.h +--- xen-3.3.1-testing.orig/tools/ioemu-remote/hw/xen_blktap.h ++++ xen-3.3.1-testing/tools/ioemu-remote/hw/xen_blktap.h @@ -50,4 +50,19 @@ typedef struct fd_list_entry { struct fd_list_entry **pprev, *next; } fd_list_entry_t; diff --git a/ioemu-qcow2-multiblock-aio.patch b/ioemu-qcow2-multiblock-aio.patch index f75b809..a710d53 100644 --- a/ioemu-qcow2-multiblock-aio.patch +++ b/ioemu-qcow2-multiblock-aio.patch @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/tools/ioemu-remote/block-qcow2.c +Index: xen-3.3.1-testing/tools/ioemu-remote/block-qcow2.c =================================================================== ---- xen-3.3.0-testing.orig/tools/ioemu-remote/block-qcow2.c -+++ xen-3.3.0-testing/tools/ioemu-remote/block-qcow2.c +--- xen-3.3.1-testing.orig/tools/ioemu-remote/block-qcow2.c ++++ xen-3.3.1-testing/tools/ioemu-remote/block-qcow2.c @@ -808,6 +808,8 @@ static void qcow_aio_read_cb(void *opaqu BlockDriverState *bs = acb->common.bs; BDRVQcowState *s = bs->opaque; @@ -12,7 +12,7 @@ Index: xen-3.3.0-testing/tools/ioemu-remote/block-qcow2.c acb->hd_aiocb = NULL; if (ret < 0) { @@ -846,11 +848,22 @@ static void qcow_aio_read_cb(void *opaqu - acb->cluster_offset = get_cluster_offset(bs, acb->sector_num << 9, + acb->cluster_offset = get_cluster_offset(bs, acb->sector_num << 9, 0, 0, 0, 0); index_in_cluster = acb->sector_num & (s->cluster_sectors - 1); - acb->n = s->cluster_sectors - index_in_cluster; @@ -36,7 +36,7 @@ Index: xen-3.3.0-testing/tools/ioemu-remote/block-qcow2.c + if (bs->backing_hd) { /* read from the base image */ - n1 = backing_read1(bs->backing_hd, acb->sector_num, + n1 = backing_read1(bs->backing_hd, acb->sector_num, @@ -869,6 +882,9 @@ static void qcow_aio_read_cb(void *opaqu goto redo; } @@ -68,7 +68,7 @@ Index: xen-3.3.0-testing/tools/ioemu-remote/block-qcow2.c + acb->n = n; + acb->hd_aiocb = bdrv_aio_read(s->hd, - (acb->cluster_offset >> 9) + index_in_cluster, + (acb->cluster_offset >> 9) + index_in_cluster, acb->buf, acb->n, qcow_aio_read_cb, acb); @@ -928,6 +960,9 @@ static void qcow_aio_write_cb(void *opaq int index_in_cluster; diff --git a/libxen_permissive.patch b/libxen_permissive.patch index 072c8e5..9013cdc 100644 --- a/libxen_permissive.patch +++ b/libxen_permissive.patch @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/tools/libxen/src/xen_common.c +Index: xen-3.3.1-testing/tools/libxen/src/xen_common.c =================================================================== ---- xen-3.3.0-testing.orig/tools/libxen/src/xen_common.c -+++ xen-3.3.0-testing/tools/libxen/src/xen_common.c +--- xen-3.3.1-testing.orig/tools/libxen/src/xen_common.c ++++ xen-3.3.1-testing/tools/libxen/src/xen_common.c @@ -902,8 +902,15 @@ static void parse_into(xen_session *s, x 0 != strcmp((char *)value_node->children->name, "struct") || value_node->children->children == NULL) diff --git a/msi-enable.patch b/msi-enable.patch new file mode 100644 index 0000000..dccae44 --- /dev/null +++ b/msi-enable.patch @@ -0,0 +1,13 @@ +Index: xen-3.3.1-testing/xen/arch/x86/io_apic.c +=================================================================== +--- xen-3.3.1-testing.orig/xen/arch/x86/io_apic.c ++++ xen-3.3.1-testing/xen/arch/x86/io_apic.c +@@ -45,7 +45,7 @@ + int (*ioapic_renumber_irq)(int ioapic, int irq); + atomic_t irq_mis_count; + +-int msi_enable = 0; ++int msi_enable = 1; + boolean_param("msi", msi_enable); + + int domain_irq_to_vector(struct domain *d, int irq) diff --git a/poll-single-port.patch b/poll-single-port.patch deleted file mode 100644 index aa4fcfd..0000000 --- a/poll-single-port.patch +++ /dev/null @@ -1,163 +0,0 @@ -Index: xen-3.3.1-testing/xen/common/domain.c -=================================================================== ---- xen-3.3.1-testing.orig/xen/common/domain.c -+++ xen-3.3.1-testing/xen/common/domain.c -@@ -209,6 +209,7 @@ struct domain *domain_create( - atomic_set(&d->refcnt, 1); - spin_lock_init(&d->domain_lock); - spin_lock_init(&d->page_alloc_lock); -+ spin_lock_init(&d->poll_lock); - spin_lock_init(&d->shutdown_lock); - spin_lock_init(&d->hypercall_deadlock_mutex); - INIT_LIST_HEAD(&d->page_list); -@@ -653,7 +654,7 @@ void vcpu_reset(struct vcpu *v) - - v->fpu_initialised = 0; - v->fpu_dirtied = 0; -- v->is_polling = 0; -+ v->poll_evtchn = 0; - v->is_initialised = 0; - v->nmi_pending = 0; - v->mce_pending = 0; -Index: xen-3.3.1-testing/xen/common/event_channel.c -=================================================================== ---- xen-3.3.1-testing.orig/xen/common/event_channel.c -+++ xen-3.3.1-testing/xen/common/event_channel.c -@@ -545,6 +545,7 @@ out: - static int evtchn_set_pending(struct vcpu *v, int port) - { - struct domain *d = v->domain; -+ unsigned long flags; - - /* - * The following bit operations must happen in strict order. -@@ -564,19 +565,36 @@ static int evtchn_set_pending(struct vcp - } - - /* Check if some VCPU might be polling for this event. */ -- if ( unlikely(d->is_polling) ) -+ if ( likely(!d->is_polling) ) -+ return 0; -+ -+ spin_lock_irqsave(&d->poll_lock, flags); -+ -+ if ( likely(d->is_polling) ) - { -- d->is_polling = 0; -+ bool_t is_polling = 0; -+ -+ d->is_polling = -1; - smp_mb(); /* check vcpu poll-flags /after/ clearing domain poll-flag */ - for_each_vcpu ( d, v ) - { -- if ( !v->is_polling ) -+ int poll_evtchn = v->poll_evtchn; -+ -+ if ( !poll_evtchn ) -+ continue; -+ if ( poll_evtchn > 0 && poll_evtchn != port ) -+ { -+ is_polling = 1; - continue; -- v->is_polling = 0; -+ } -+ v->poll_evtchn = 0; - vcpu_unblock(v); - } -+ cmpxchg(&d->is_polling, -1, is_polling); - } - -+ spin_unlock_irqrestore(&d->poll_lock, flags); -+ - return 0; - } - -Index: xen-3.3.1-testing/xen/common/schedule.c -=================================================================== ---- xen-3.3.1-testing.orig/xen/common/schedule.c -+++ xen-3.3.1-testing/xen/common/schedule.c -@@ -348,7 +348,7 @@ static long do_poll(struct sched_poll *s - return -EFAULT; - - set_bit(_VPF_blocked, &v->pause_flags); -- v->is_polling = 1; -+ v->poll_evtchn = -1; - d->is_polling = 1; - - /* Check for events /after/ setting flags: avoids wakeup waiting race. */ -@@ -369,6 +369,9 @@ static long do_poll(struct sched_poll *s - goto out; - } - -+ if ( i == 1 ) -+ v->poll_evtchn = port; -+ - if ( sched_poll->timeout != 0 ) - set_timer(&v->poll_timer, sched_poll->timeout); - -@@ -378,7 +381,7 @@ static long do_poll(struct sched_poll *s - return 0; - - out: -- v->is_polling = 0; -+ v->poll_evtchn = 0; - clear_bit(_VPF_blocked, &v->pause_flags); - return rc; - } -@@ -760,10 +763,10 @@ static void poll_timer_fn(void *data) - { - struct vcpu *v = data; - -- if ( !v->is_polling ) -+ if ( !v->poll_evtchn ) - return; - -- v->is_polling = 0; -+ v->poll_evtchn = 0; - vcpu_unblock(v); - } - -Index: xen-3.3.1-testing/xen/include/xen/sched.h -=================================================================== ---- xen-3.3.1-testing.orig/xen/include/xen/sched.h -+++ xen-3.3.1-testing/xen/include/xen/sched.h -@@ -106,8 +106,6 @@ struct vcpu - bool_t fpu_initialised; - /* Has the FPU been used since it was last saved? */ - bool_t fpu_dirtied; -- /* Is this VCPU polling any event channels (SCHEDOP_poll)? */ -- bool_t is_polling; - /* Initialization completed for this VCPU? */ - bool_t is_initialised; - /* Currently running on a CPU? */ -@@ -137,6 +135,11 @@ struct vcpu - unsigned long pause_flags; - atomic_t pause_count; - -+ /* Is this VCPU polling any event channels (SCHEDOP_poll)? -+ * Positive values indicate a single, negative values multiple channels -+ * being polled. */ -+ int poll_evtchn; -+ - /* IRQ-safe virq_lock protects against delivering VIRQ to stale evtchn. */ - u16 virq_to_evtchn[NR_VIRQS]; - spinlock_t virq_lock; -@@ -210,7 +213,7 @@ struct domain - /* Is this guest being debugged by dom0? */ - bool_t debugger_attached; - /* Are any VCPUs polling event channels (SCHEDOP_poll)? */ -- bool_t is_polling; -+ signed char is_polling; - /* Is this guest dying (i.e., a zombie)? */ - enum { DOMDYING_alive, DOMDYING_dying, DOMDYING_dead } is_dying; - /* Domain is paused by controller software? */ -@@ -218,6 +221,9 @@ struct domain - /* Domain's VCPUs are pinned 1:1 to physical CPUs? */ - bool_t is_pinned; - -+ /* Protects is_polling modification in evtchn_set_pending(). */ -+ spinlock_t poll_lock; -+ - /* Guest has shut down (inc. reason code)? */ - spinlock_t shutdown_lock; - bool_t is_shutting_down; /* in process of shutting down? */ diff --git a/pv-driver-build.patch b/pv-driver-build.patch index 6f5f0e5..ba111cd 100644 --- a/pv-driver-build.patch +++ b/pv-driver-build.patch @@ -1,13 +1,29 @@ -Index: xen-3.3.0-testing/unmodified_drivers/linux-2.6/mkbuildtree +Index: xen-3.3.1-testing/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c =================================================================== ---- xen-3.3.0-testing.orig/unmodified_drivers/linux-2.6/mkbuildtree -+++ xen-3.3.0-testing/unmodified_drivers/linux-2.6/mkbuildtree -@@ -40,7 +40,7 @@ ln -sf ${XL}/drivers/xen/core/reboot.c p - mkdir -p include/asm include/xen +--- xen-3.3.1-testing.orig/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c ++++ xen-3.3.1-testing/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c +@@ -14,7 +14,7 @@ EXPORT_SYMBOL(system_state); - lndir -silent ${XL}/include/xen include/xen --ln -nsf ${XEN}/include/public include/xen/interface -+ln -nsf ${XEN}/interface include/xen/interface + void ctrl_alt_del(void) + { +- kill_proc(1, SIGINT, 1); /* interrupt init */ ++ kill_proc_info(SIGINT, SEND_SIG_PRIV, 1); + } + + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8) +Index: xen-3.3.1-testing/unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c +=================================================================== +--- xen-3.3.1-testing.orig/unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c ++++ xen-3.3.1-testing/unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c +@@ -44,7 +44,11 @@ static void ap_suspend(void *_info) + atomic_dec(&info->nr_spinning); + } + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) + #define initiate_ap_suspend(i) smp_call_function(ap_suspend, i, 0, 0) ++#else ++#define initiate_ap_suspend(i) smp_call_function(ap_suspend, i, 0) ++#endif + + #else /* !defined(CONFIG_SMP) */ - # Need to be quite careful here: we don't want the files we link in to - # risk overriding the native Linux ones (in particular, system.h must diff --git a/pvdrv_emulation_control.patch b/pvdrv_emulation_control.patch index 8f3762f..5802d0b 100644 --- a/pvdrv_emulation_control.patch +++ b/pvdrv_emulation_control.patch @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/tools/ioemu-remote/hw/xen_platform.c +Index: xen-3.3.1-testing/tools/ioemu-remote/hw/xen_platform.c =================================================================== ---- xen-3.3.0-testing.orig/tools/ioemu-remote/hw/xen_platform.c -+++ xen-3.3.0-testing/tools/ioemu-remote/hw/xen_platform.c +--- xen-3.3.1-testing.orig/tools/ioemu-remote/hw/xen_platform.c ++++ xen-3.3.1-testing/tools/ioemu-remote/hw/xen_platform.c @@ -101,6 +101,19 @@ static void platform_ioport_write(void * net_tap_shutdown_all(); fprintf(logfile, "Done.\n"); diff --git a/qemu-img-snapshot.patch b/qemu-img-snapshot.patch index 7f49521..a8b2ec2 100644 --- a/qemu-img-snapshot.patch +++ b/qemu-img-snapshot.patch @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/tools/ioemu-remote/qemu-img.c +Index: xen-3.3.1-testing/tools/ioemu-remote/qemu-img.c =================================================================== ---- xen-3.3.0-testing.orig/tools/ioemu-remote/qemu-img.c -+++ xen-3.3.0-testing/tools/ioemu-remote/qemu-img.c +--- xen-3.3.1-testing.orig/tools/ioemu-remote/qemu-img.c ++++ xen-3.3.1-testing/tools/ioemu-remote/qemu-img.c @@ -57,6 +57,7 @@ static void help(void) " commit [-f fmt] filename\n" " convert [-c] [-e] [-6] [-f fmt] [-O output_fmt] filename [filename2 [...]] output_filename\n" diff --git a/qemu-security-etch1.diff b/qemu-security-etch1.diff index 6047f65..1e36c10 100644 --- a/qemu-security-etch1.diff +++ b/qemu-security-etch1.diff @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/tools/ioemu-remote/block.c +Index: xen-3.3.1-testing/tools/ioemu-remote/block.c =================================================================== ---- xen-3.3.0-testing.orig/tools/ioemu-remote/block.c -+++ xen-3.3.0-testing/tools/ioemu-remote/block.c +--- xen-3.3.1-testing.orig/tools/ioemu-remote/block.c ++++ xen-3.3.1-testing/tools/ioemu-remote/block.c @@ -630,6 +630,9 @@ int bdrv_write(BlockDriverState *bs, int return 0; } @@ -12,10 +12,10 @@ Index: xen-3.3.0-testing/tools/ioemu-remote/block.c return drv->bdrv_write(bs, sector_num, buf, nb_sectors); } } -Index: xen-3.3.0-testing/tools/ioemu-remote/hw/ne2000.c +Index: xen-3.3.1-testing/tools/ioemu-remote/hw/ne2000.c =================================================================== ---- xen-3.3.0-testing.orig/tools/ioemu-remote/hw/ne2000.c -+++ xen-3.3.0-testing/tools/ioemu-remote/hw/ne2000.c +--- xen-3.3.1-testing.orig/tools/ioemu-remote/hw/ne2000.c ++++ xen-3.3.1-testing/tools/ioemu-remote/hw/ne2000.c @@ -218,7 +218,7 @@ static int ne2000_can_receive(void *opaq NE2000State *s = opaque; @@ -25,10 +25,10 @@ Index: xen-3.3.0-testing/tools/ioemu-remote/hw/ne2000.c return !ne2000_buffer_full(s); } -Index: xen-3.3.0-testing/tools/ioemu-remote/hw/pc.c +Index: xen-3.3.1-testing/tools/ioemu-remote/hw/pc.c =================================================================== ---- xen-3.3.0-testing.orig/tools/ioemu-remote/hw/pc.c -+++ xen-3.3.0-testing/tools/ioemu-remote/hw/pc.c +--- xen-3.3.1-testing.orig/tools/ioemu-remote/hw/pc.c ++++ xen-3.3.1-testing/tools/ioemu-remote/hw/pc.c @@ -387,7 +387,8 @@ static void bochs_bios_write(void *opaqu case 0x400: case 0x401: @@ -50,10 +50,10 @@ Index: xen-3.3.0-testing/tools/ioemu-remote/hw/pc.c case 0x500: case 0x503: #ifdef DEBUG_BIOS -Index: xen-3.3.0-testing/tools/ioemu-remote/target-i386/translate.c +Index: xen-3.3.1-testing/tools/ioemu-remote/target-i386/translate.c =================================================================== ---- xen-3.3.0-testing.orig/tools/ioemu-remote/target-i386/translate.c -+++ xen-3.3.0-testing/tools/ioemu-remote/target-i386/translate.c +--- xen-3.3.1-testing.orig/tools/ioemu-remote/target-i386/translate.c ++++ xen-3.3.1-testing/tools/ioemu-remote/target-i386/translate.c @@ -5661,6 +5661,7 @@ static target_ulong disas_insn(DisasCont gen_jmp_im(pc_start - s->cs_base); gen_op_into(s->pc - pc_start); @@ -70,10 +70,10 @@ Index: xen-3.3.0-testing/tools/ioemu-remote/target-i386/translate.c case 0xfa: /* cli */ if (!s->vm86) { if (s->cpl <= s->iopl) { -Index: xen-3.3.0-testing/tools/ioemu-remote/vl.c +Index: xen-3.3.1-testing/tools/ioemu-remote/vl.c =================================================================== ---- xen-3.3.0-testing.orig/tools/ioemu-remote/vl.c -+++ xen-3.3.0-testing/tools/ioemu-remote/vl.c +--- xen-3.3.1-testing.orig/tools/ioemu-remote/vl.c ++++ xen-3.3.1-testing/tools/ioemu-remote/vl.c @@ -4380,8 +4380,8 @@ typedef struct NetSocketState { VLANClientState *vc; int fd; diff --git a/rpmlint.diff b/rpmlint.diff index 0507954..3e4b83f 100644 --- a/rpmlint.diff +++ b/rpmlint.diff @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/tools/examples/Makefile +Index: xen-3.3.1-testing/tools/examples/Makefile =================================================================== ---- xen-3.3.0-testing.orig/tools/examples/Makefile -+++ xen-3.3.0-testing/tools/examples/Makefile +--- xen-3.3.1-testing.orig/tools/examples/Makefile ++++ xen-3.3.1-testing/tools/examples/Makefile @@ -70,7 +70,7 @@ install-initd: [ -d $(DESTDIR)/var/adm/fillup-templates ] || $(INSTALL_DIR) $(DESTDIR)/var/adm/fillup-templates/ $(INSTALL_PROG) $(XEND_INITD) $(DESTDIR)/etc/init.d diff --git a/serial-split.patch b/serial-split.patch index 1c0ba61..ae6f5f7 100644 --- a/serial-split.patch +++ b/serial-split.patch @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/tools/misc/serial-split/Makefile +Index: xen-3.3.1-testing/tools/misc/serial-split/Makefile =================================================================== --- /dev/null -+++ xen-3.3.0-testing/tools/misc/serial-split/Makefile ++++ xen-3.3.1-testing/tools/misc/serial-split/Makefile @@ -0,0 +1,20 @@ +CC ?= gcc +CFLAGS ?= -Wall -Os @@ -23,10 +23,10 @@ Index: xen-3.3.0-testing/tools/misc/serial-split/Makefile + +%.o: %.c Makefile + $(CC) $(CFLAGS) -c -o $@ $< -Index: xen-3.3.0-testing/tools/misc/serial-split/serial-split.c +Index: xen-3.3.1-testing/tools/misc/serial-split/serial-split.c =================================================================== --- /dev/null -+++ xen-3.3.0-testing/tools/misc/serial-split/serial-split.c ++++ xen-3.3.1-testing/tools/misc/serial-split/serial-split.c @@ -0,0 +1,422 @@ +/* + * serial-split.c diff --git a/snapshot-ioemu-delete.patch b/snapshot-ioemu-delete.patch index 76cb3ac..cfa229d 100644 --- a/snapshot-ioemu-delete.patch +++ b/snapshot-ioemu-delete.patch @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/tools/ioemu-remote/xenstore.c +Index: xen-3.3.1-testing/tools/ioemu-remote/xenstore.c =================================================================== ---- xen-3.3.0-testing.orig/tools/ioemu-remote/xenstore.c -+++ xen-3.3.0-testing/tools/ioemu-remote/xenstore.c +--- xen-3.3.1-testing.orig/tools/ioemu-remote/xenstore.c ++++ xen-3.3.1-testing/tools/ioemu-remote/xenstore.c @@ -652,6 +652,19 @@ static void xenstore_process_dm_command_ } diff --git a/snapshot-ioemu-restore.patch b/snapshot-ioemu-restore.patch index c892da8..b059fbf 100644 --- a/snapshot-ioemu-restore.patch +++ b/snapshot-ioemu-restore.patch @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/tools/blktap/drivers/blktapctrl.c +Index: xen-3.3.1-testing/tools/blktap/drivers/blktapctrl.c =================================================================== ---- xen-3.3.0-testing.orig/tools/blktap/drivers/blktapctrl.c -+++ xen-3.3.0-testing/tools/blktap/drivers/blktapctrl.c +--- xen-3.3.1-testing.orig/tools/blktap/drivers/blktapctrl.c ++++ xen-3.3.1-testing/tools/blktap/drivers/blktapctrl.c @@ -305,6 +305,7 @@ static int write_msg(int fd, int msgtype msg_dev = (msg_newdev_t *)(buf + sizeof(msg_hdr_t)); msg_dev->devnum = blkif->minor; @@ -10,10 +10,10 @@ Index: xen-3.3.0-testing/tools/blktap/drivers/blktapctrl.c break; -Index: xen-3.3.0-testing/tools/blktap/lib/blktaplib.h +Index: xen-3.3.1-testing/tools/blktap/lib/blktaplib.h =================================================================== ---- xen-3.3.0-testing.orig/tools/blktap/lib/blktaplib.h -+++ xen-3.3.0-testing/tools/blktap/lib/blktaplib.h +--- xen-3.3.1-testing.orig/tools/blktap/lib/blktaplib.h ++++ xen-3.3.1-testing/tools/blktap/lib/blktaplib.h @@ -189,6 +189,7 @@ typedef struct msg_hdr { typedef struct msg_newdev { uint8_t devnum; @@ -22,10 +22,10 @@ Index: xen-3.3.0-testing/tools/blktap/lib/blktaplib.h } msg_newdev_t; typedef struct msg_pid { -Index: xen-3.3.0-testing/tools/ioemu-remote/hw/xen_blktap.c +Index: xen-3.3.1-testing/tools/ioemu-remote/hw/xen_blktap.c =================================================================== ---- xen-3.3.0-testing.orig/tools/ioemu-remote/hw/xen_blktap.c -+++ xen-3.3.0-testing/tools/ioemu-remote/hw/xen_blktap.c +--- xen-3.3.1-testing.orig/tools/ioemu-remote/hw/xen_blktap.c ++++ xen-3.3.1-testing/tools/ioemu-remote/hw/xen_blktap.c @@ -69,6 +69,8 @@ int write_fd; static pid_t process; fd_list_entry_t *fd_start = NULL; @@ -35,7 +35,7 @@ Index: xen-3.3.0-testing/tools/ioemu-remote/hw/xen_blktap.c static void handle_blktap_iomsg(void* private); struct aiocb_info { -@@ -502,6 +504,10 @@ static void handle_blktap_ctrlmsg(void* +@@ -502,6 +504,10 @@ static void handle_blktap_ctrlmsg(void* char buf[MSG_SIZE]; @@ -46,7 +46,7 @@ Index: xen-3.3.0-testing/tools/ioemu-remote/hw/xen_blktap.c length = read(read_fd, buf, MSG_SIZE); if (length > 0 && length >= sizeof(msg_hdr_t)) -@@ -557,7 +563,18 @@ static void handle_blktap_ctrlmsg(void* +@@ -557,7 +563,18 @@ static void handle_blktap_ctrlmsg(void* if (s != NULL) { ret = ((map_new_dev(s, msg_dev->devnum) == msg_dev->devnum ? 0: -1)); @@ -66,10 +66,10 @@ Index: xen-3.3.0-testing/tools/ioemu-remote/hw/xen_blktap.c memset(buf, 0x00, MSG_SIZE); msglen = sizeof(msg_hdr_t); -Index: xen-3.3.0-testing/tools/ioemu-remote/xenstore.c +Index: xen-3.3.1-testing/tools/ioemu-remote/xenstore.c =================================================================== ---- xen-3.3.0-testing.orig/tools/ioemu-remote/xenstore.c -+++ xen-3.3.0-testing/tools/ioemu-remote/xenstore.c +--- xen-3.3.1-testing.orig/tools/ioemu-remote/xenstore.c ++++ xen-3.3.1-testing/tools/ioemu-remote/xenstore.c @@ -37,6 +37,8 @@ static QEMUTimer *insert_timer = NULL; #define UWAIT_MAX (30*1000000) /* thirty seconds */ #define UWAIT (100000) /* 1/10th second */ diff --git a/snapshot-ioemu-save.patch b/snapshot-ioemu-save.patch index 9277570..c79070c 100644 --- a/snapshot-ioemu-save.patch +++ b/snapshot-ioemu-save.patch @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/tools/ioemu-remote/xen-vl-extra.c +Index: xen-3.3.1-testing/tools/ioemu-remote/xen-vl-extra.c =================================================================== ---- xen-3.3.0-testing.orig/tools/ioemu-remote/xen-vl-extra.c -+++ xen-3.3.0-testing/tools/ioemu-remote/xen-vl-extra.c +--- xen-3.3.1-testing.orig/tools/ioemu-remote/xen-vl-extra.c ++++ xen-3.3.1-testing/tools/ioemu-remote/xen-vl-extra.c @@ -8,12 +8,18 @@ * there is only one place where this file is included. */ @@ -103,10 +103,10 @@ Index: xen-3.3.0-testing/tools/ioemu-remote/xen-vl-extra.c struct qemu_alarm_timer; static int unix_start_timer(struct qemu_alarm_timer *t) { return 0; } static void unix_stop_timer(struct qemu_alarm_timer *t) { } -Index: xen-3.3.0-testing/tools/ioemu-remote/i386-dm/helper2.c +Index: xen-3.3.1-testing/tools/ioemu-remote/i386-dm/helper2.c =================================================================== ---- xen-3.3.0-testing.orig/tools/ioemu-remote/i386-dm/helper2.c -+++ xen-3.3.0-testing/tools/ioemu-remote/i386-dm/helper2.c +--- xen-3.3.1-testing.orig/tools/ioemu-remote/i386-dm/helper2.c ++++ xen-3.3.1-testing/tools/ioemu-remote/i386-dm/helper2.c @@ -101,6 +101,9 @@ int send_vcpu = 0; #define NR_CPUS 32 evtchn_port_t ioreq_local_port[NR_CPUS]; @@ -145,10 +145,10 @@ Index: xen-3.3.0-testing/tools/ioemu-remote/i386-dm/helper2.c xenstore_record_dm_state("paused"); -Index: xen-3.3.0-testing/tools/ioemu-remote/qemu-xen.h +Index: xen-3.3.1-testing/tools/ioemu-remote/qemu-xen.h =================================================================== ---- xen-3.3.0-testing.orig/tools/ioemu-remote/qemu-xen.h -+++ xen-3.3.0-testing/tools/ioemu-remote/qemu-xen.h +--- xen-3.3.1-testing.orig/tools/ioemu-remote/qemu-xen.h ++++ xen-3.3.1-testing/tools/ioemu-remote/qemu-xen.h @@ -14,6 +14,15 @@ void qemu_invalidate_map_cache(void) #define mapcache_lock() ((void)0) #define mapcache_unlock() ((void)0) @@ -165,10 +165,10 @@ Index: xen-3.3.0-testing/tools/ioemu-remote/qemu-xen.h /* helper2.c */ extern long time_offset; void timeoffset_get(void); -Index: xen-3.3.0-testing/tools/ioemu-remote/xenstore.c +Index: xen-3.3.1-testing/tools/ioemu-remote/xenstore.c =================================================================== ---- xen-3.3.0-testing.orig/tools/ioemu-remote/xenstore.c -+++ xen-3.3.0-testing/tools/ioemu-remote/xenstore.c +--- xen-3.3.1-testing.orig/tools/ioemu-remote/xenstore.c ++++ xen-3.3.1-testing/tools/ioemu-remote/xenstore.c @@ -24,6 +24,7 @@ #include "exec-all.h" diff --git a/supported_module.diff b/supported_module.diff index cf1a931..2459055 100644 --- a/supported_module.diff +++ b/supported_module.diff @@ -2,10 +2,10 @@ Make our PV drivers "Novell supported modules" Signed-off-by: K. Y. Srinivasan -Index: xen-3.3.0-testing/unmodified_drivers/linux-2.6/Module.supported +Index: xen-3.3.1-testing/unmodified_drivers/linux-2.6/Module.supported =================================================================== --- /dev/null -+++ xen-3.3.0-testing/unmodified_drivers/linux-2.6/Module.supported ++++ xen-3.3.1-testing/unmodified_drivers/linux-2.6/Module.supported @@ -0,0 +1,4 @@ +xen-vbd +xen-platform-pci diff --git a/tools-gdbserver-build.diff b/tools-gdbserver-build.diff index 933e110..747b03a 100644 --- a/tools-gdbserver-build.diff +++ b/tools-gdbserver-build.diff @@ -1,7 +1,8 @@ -diff -r 0eab1869ef66 tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/Makefile.in ---- a/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/Makefile.in Thu Sep 04 11:42:38 2008 +0100 -+++ b/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/Makefile.in Thu Sep 11 15:45:31 2008 -0600 -@@ -90,7 +90,7 @@ GLOBAL_CFLAGS = ${MT_CFLAGS} ${MH_CFLAGS +Index: xen-3.3.1-testing/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/Makefile.in +=================================================================== +--- xen-3.3.1-testing.orig/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/Makefile.in ++++ xen-3.3.1-testing/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/Makefile.in +@@ -90,7 +90,7 @@ INCLUDE_CFLAGS = -I. -I${srcdir} -I$(src GLOBAL_CFLAGS = ${MT_CFLAGS} ${MH_CFLAGS} #PROFILE_CFLAGS = -pg diff --git a/tools-kboot.diff b/tools-kboot.diff index b860817..f4cac24 100644 --- a/tools-kboot.diff +++ b/tools-kboot.diff @@ -13,10 +13,10 @@ Signed-off-by: Gerd Hoffmann tools/kboot/select-kernel | 59 + 9 files changed, 2111 insertions(+) -Index: xen-unstable/buildconfigs/linux-defconfig_xenUboot_x86_32 +Index: xen-3.3.1-testing/buildconfigs/linux-defconfig_xenUboot_x86_32 =================================================================== --- /dev/null -+++ xen-unstable/buildconfigs/linux-defconfig_xenUboot_x86_32 ++++ xen-3.3.1-testing/buildconfigs/linux-defconfig_xenUboot_x86_32 @@ -0,0 +1,874 @@ +# +# Automatically generated make config: don't edit @@ -892,10 +892,10 @@ Index: xen-unstable/buildconfigs/linux-defconfig_xenUboot_x86_32 +CONFIG_X86_NO_TSS=y +CONFIG_X86_NO_IDT=y +CONFIG_KTIME_SCALAR=y -Index: xen-unstable/buildconfigs/linux-defconfig_xenUboot_x86_64 +Index: xen-3.3.1-testing/buildconfigs/linux-defconfig_xenUboot_x86_64 =================================================================== --- /dev/null -+++ xen-unstable/buildconfigs/linux-defconfig_xenUboot_x86_64 ++++ xen-3.3.1-testing/buildconfigs/linux-defconfig_xenUboot_x86_64 @@ -0,0 +1,653 @@ +# +# Automatically generated make config: don't edit @@ -1550,17 +1550,17 @@ Index: xen-unstable/buildconfigs/linux-defconfig_xenUboot_x86_64 +# CONFIG_CRC32 is not set +# CONFIG_LIBCRC32C is not set +CONFIG_ZLIB_INFLATE=y -Index: xen-unstable/buildconfigs/mk.linux-2.6-xenUboot +Index: xen-3.3.1-testing/buildconfigs/mk.linux-2.6-xenUboot =================================================================== --- /dev/null -+++ xen-unstable/buildconfigs/mk.linux-2.6-xenUboot ++++ xen-3.3.1-testing/buildconfigs/mk.linux-2.6-xenUboot @@ -0,0 +1,2 @@ +EXTRAVERSION = xenUboot +include buildconfigs/mk.linux-2.6-xen -Index: xen-unstable/tools/kboot/Makefile +Index: xen-3.3.1-testing/tools/kboot/Makefile =================================================================== --- /dev/null -+++ xen-unstable/tools/kboot/Makefile ++++ xen-3.3.1-testing/tools/kboot/Makefile @@ -0,0 +1,23 @@ +# +# tools/kboot/Makefile @@ -1585,10 +1585,10 @@ Index: xen-unstable/tools/kboot/Makefile +kboot.initramfs: mkinitramfs init select-kernel ../xcutils/xc_kexec + sh ./mkinitramfs | tee $@ + -Index: xen-unstable/tools/kboot/README +Index: xen-3.3.1-testing/tools/kboot/README =================================================================== --- /dev/null -+++ xen-unstable/tools/kboot/README ++++ xen-3.3.1-testing/tools/kboot/README @@ -0,0 +1,43 @@ + +This is a simple kexec-based boot loader @@ -1633,10 +1633,10 @@ Index: xen-unstable/tools/kboot/README + +-- +Gerd Hoffmann -Index: xen-unstable/tools/kboot/init +Index: xen-3.3.1-testing/tools/kboot/init =================================================================== --- /dev/null -+++ xen-unstable/tools/kboot/init ++++ xen-3.3.1-testing/tools/kboot/init @@ -0,0 +1,309 @@ +#!/bin/sh + @@ -1947,10 +1947,10 @@ Index: xen-unstable/tools/kboot/init +msg "bye ..." +banner "boot $guestos" +xc_kexec -e -Index: xen-unstable/tools/kboot/mkinitramfs +Index: xen-3.3.1-testing/tools/kboot/mkinitramfs =================================================================== --- /dev/null -+++ xen-unstable/tools/kboot/mkinitramfs ++++ xen-3.3.1-testing/tools/kboot/mkinitramfs @@ -0,0 +1,111 @@ +#!/bin/sh + @@ -2063,10 +2063,10 @@ Index: xen-unstable/tools/kboot/mkinitramfs + echo "file $LIB/$(basename $lib) $lib 0755 0 0" +done +echo -Index: xen-unstable/tools/kboot/select-kernel +Index: xen-3.3.1-testing/tools/kboot/select-kernel =================================================================== --- /dev/null -+++ xen-unstable/tools/kboot/select-kernel ++++ xen-3.3.1-testing/tools/kboot/select-kernel @@ -0,0 +1,59 @@ +#!/bin/sh + @@ -2127,10 +2127,10 @@ Index: xen-unstable/tools/kboot/select-kernel +msg "using $kernelname" +echo "$kernelname" + -Index: xen-unstable/make-kboot +Index: xen-3.3.1-testing/make-kboot =================================================================== --- /dev/null -+++ xen-unstable/make-kboot ++++ xen-3.3.1-testing/make-kboot @@ -0,0 +1,37 @@ +#!/bin/sh + diff --git a/tools-xc_kexec.diff b/tools-xc_kexec.diff index 8922041..ecc8dba 100644 --- a/tools-xc_kexec.diff +++ b/tools-xc_kexec.diff @@ -23,10 +23,10 @@ Signed-off-by: Gerd Hoffmann tools/xcutils/xc_kexec.c | 503 +++++++++++++++ 19 files changed, 4988 insertions(+), 2 deletions(-) -Index: xen-3.3.0-testing/tools/xcutils/Makefile +Index: xen-3.3.1-testing/tools/xcutils/Makefile =================================================================== ---- xen-3.3.0-testing.orig/tools/xcutils/Makefile -+++ xen-3.3.0-testing/tools/xcutils/Makefile +--- xen-3.3.1-testing.orig/tools/xcutils/Makefile ++++ xen-3.3.1-testing/tools/xcutils/Makefile @@ -18,7 +18,7 @@ CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_ CFLAGS += -Wp,-MD,.$(@F).d PROG_DEP = .*.d @@ -55,10 +55,10 @@ Index: xen-3.3.0-testing/tools/xcutils/Makefile + make -C helper clean -include $(PROG_DEP) -Index: xen-3.3.0-testing/tools/xcutils/helper/Makefile +Index: xen-3.3.1-testing/tools/xcutils/helper/Makefile =================================================================== --- /dev/null -+++ xen-3.3.0-testing/tools/xcutils/helper/Makefile ++++ xen-3.3.1-testing/tools/xcutils/helper/Makefile @@ -0,0 +1,39 @@ + +XEN_ROOT = ../../.. @@ -99,10 +99,10 @@ Index: xen-3.3.0-testing/tools/xcutils/helper/Makefile +# dependencies + +$(XEN_TARGET_ARCH)/entry.o: $(XEN_TARGET_ARCH)/entry.S $(XEN_TARGET_ARCH)/offsets.h -Index: xen-3.3.0-testing/tools/xcutils/helper/console.c +Index: xen-3.3.1-testing/tools/xcutils/helper/console.c =================================================================== --- /dev/null -+++ xen-3.3.0-testing/tools/xcutils/helper/console.c ++++ xen-3.3.1-testing/tools/xcutils/helper/console.c @@ -0,0 +1,69 @@ +#include + @@ -173,10 +173,10 @@ Index: xen-3.3.0-testing/tools/xcutils/helper/console.c + + return printed_len; +} -Index: xen-3.3.0-testing/tools/xcutils/helper/ctype.c +Index: xen-3.3.1-testing/tools/xcutils/helper/ctype.c =================================================================== --- /dev/null -+++ xen-3.3.0-testing/tools/xcutils/helper/ctype.c ++++ xen-3.3.1-testing/tools/xcutils/helper/ctype.c @@ -0,0 +1,35 @@ +/* + * linux/lib/ctype.c @@ -213,10 +213,10 @@ Index: xen-3.3.0-testing/tools/xcutils/helper/ctype.c +_L,_L,_L,_L,_L,_L,_L,_P,_L,_L,_L,_L,_L,_L,_L,_L}; /* 240-255 */ + +EXPORT_SYMBOL(_ctype); -Index: xen-3.3.0-testing/tools/xcutils/helper/ctype.h +Index: xen-3.3.1-testing/tools/xcutils/helper/ctype.h =================================================================== --- /dev/null -+++ xen-3.3.0-testing/tools/xcutils/helper/ctype.h ++++ xen-3.3.1-testing/tools/xcutils/helper/ctype.h @@ -0,0 +1,54 @@ +#ifndef _LINUX_CTYPE_H +#define _LINUX_CTYPE_H @@ -272,10 +272,10 @@ Index: xen-3.3.0-testing/tools/xcutils/helper/ctype.h +#define toupper(c) __toupper(c) + +#endif -Index: xen-3.3.0-testing/tools/xcutils/helper/helper.h +Index: xen-3.3.1-testing/tools/xcutils/helper/helper.h =================================================================== --- /dev/null -+++ xen-3.3.0-testing/tools/xcutils/helper/helper.h ++++ xen-3.3.1-testing/tools/xcutils/helper/helper.h @@ -0,0 +1,107 @@ +#include +#include @@ -384,10 +384,10 @@ Index: xen-3.3.0-testing/tools/xcutils/helper/helper.h +int sprintf(char * buf, const char *fmt, ...); +int vsscanf(const char * buf, const char * fmt, va_list args); +int sscanf(const char * buf, const char * fmt, ...); -Index: xen-3.3.0-testing/tools/xcutils/helper/main.c +Index: xen-3.3.1-testing/tools/xcutils/helper/main.c =================================================================== --- /dev/null -+++ xen-3.3.0-testing/tools/xcutils/helper/main.c ++++ xen-3.3.1-testing/tools/xcutils/helper/main.c @@ -0,0 +1,651 @@ +#include +#include "hypercall.h" @@ -1040,10 +1040,10 @@ Index: xen-3.3.0-testing/tools/xcutils/helper/main.c + printk("\r\n"); + start_kernel(); +} -Index: xen-3.3.0-testing/tools/xcutils/helper/make-offsets.c +Index: xen-3.3.1-testing/tools/xcutils/helper/make-offsets.c =================================================================== --- /dev/null -+++ xen-3.3.0-testing/tools/xcutils/helper/make-offsets.c ++++ xen-3.3.1-testing/tools/xcutils/helper/make-offsets.c @@ -0,0 +1,28 @@ +#include +#include @@ -1073,10 +1073,10 @@ Index: xen-3.3.0-testing/tools/xcutils/helper/make-offsets.c + vcpu_off("cr3", ctrlreg[3]); + return 0; +} -Index: xen-3.3.0-testing/tools/xcutils/helper/printk.c +Index: xen-3.3.1-testing/tools/xcutils/helper/printk.c =================================================================== --- /dev/null -+++ xen-3.3.0-testing/tools/xcutils/helper/printk.c ++++ xen-3.3.1-testing/tools/xcutils/helper/printk.c @@ -0,0 +1,1051 @@ +/* + * linux/kernel/printk.c @@ -2129,10 +2129,10 @@ Index: xen-3.3.0-testing/tools/xcutils/helper/printk.c + printk_ratelimit_burst); +} +EXPORT_SYMBOL(printk_ratelimit); -Index: xen-3.3.0-testing/tools/xcutils/helper/string.c +Index: xen-3.3.1-testing/tools/xcutils/helper/string.c =================================================================== --- /dev/null -+++ xen-3.3.0-testing/tools/xcutils/helper/string.c ++++ xen-3.3.1-testing/tools/xcutils/helper/string.c @@ -0,0 +1,601 @@ +/* + * linux/lib/string.c @@ -2735,10 +2735,10 @@ Index: xen-3.3.0-testing/tools/xcutils/helper/string.c +} +EXPORT_SYMBOL(memchr); +#endif -Index: xen-3.3.0-testing/tools/xcutils/helper/vsprintf.c +Index: xen-3.3.1-testing/tools/xcutils/helper/vsprintf.c =================================================================== --- /dev/null -+++ xen-3.3.0-testing/tools/xcutils/helper/vsprintf.c ++++ xen-3.3.1-testing/tools/xcutils/helper/vsprintf.c @@ -0,0 +1,842 @@ +/* + * linux/lib/vsprintf.c @@ -3582,10 +3582,10 @@ Index: xen-3.3.0-testing/tools/xcutils/helper/vsprintf.c +} + +EXPORT_SYMBOL(sscanf); -Index: xen-3.3.0-testing/tools/xcutils/helper/x86_32/div64.h +Index: xen-3.3.1-testing/tools/xcutils/helper/x86_32/div64.h =================================================================== --- /dev/null -+++ xen-3.3.0-testing/tools/xcutils/helper/x86_32/div64.h ++++ xen-3.3.1-testing/tools/xcutils/helper/x86_32/div64.h @@ -0,0 +1,48 @@ +#ifndef __I386_DIV64 +#define __I386_DIV64 @@ -3635,10 +3635,10 @@ Index: xen-3.3.0-testing/tools/xcutils/helper/x86_32/div64.h + +} +#endif -Index: xen-3.3.0-testing/tools/xcutils/helper/x86_32/entry.S +Index: xen-3.3.1-testing/tools/xcutils/helper/x86_32/entry.S =================================================================== --- /dev/null -+++ xen-3.3.0-testing/tools/xcutils/helper/x86_32/entry.S ++++ xen-3.3.1-testing/tools/xcutils/helper/x86_32/entry.S @@ -0,0 +1,49 @@ +#include "offsets.h" + @@ -3689,10 +3689,10 @@ Index: xen-3.3.0-testing/tools/xcutils/helper/x86_32/entry.S + nop + .align 4096 +hypercall_end: -Index: xen-3.3.0-testing/tools/xcutils/helper/x86_32/hypercall.h +Index: xen-3.3.1-testing/tools/xcutils/helper/x86_32/hypercall.h =================================================================== --- /dev/null -+++ xen-3.3.0-testing/tools/xcutils/helper/x86_32/hypercall.h ++++ xen-3.3.1-testing/tools/xcutils/helper/x86_32/hypercall.h @@ -0,0 +1,359 @@ +/****************************************************************************** + * hypercall.h @@ -4053,10 +4053,10 @@ Index: xen-3.3.0-testing/tools/xcutils/helper/x86_32/hypercall.h + + +#endif /* __HYPERCALL_H__ */ -Index: xen-3.3.0-testing/tools/xcutils/helper/x86_64/div64.h +Index: xen-3.3.1-testing/tools/xcutils/helper/x86_64/div64.h =================================================================== --- /dev/null -+++ xen-3.3.0-testing/tools/xcutils/helper/x86_64/div64.h ++++ xen-3.3.1-testing/tools/xcutils/helper/x86_64/div64.h @@ -0,0 +1,57 @@ +#ifndef _ASM_GENERIC_DIV64_H +#define _ASM_GENERIC_DIV64_H @@ -4115,10 +4115,10 @@ Index: xen-3.3.0-testing/tools/xcutils/helper/x86_64/div64.h +#endif /* BITS_PER_LONG */ + +#endif /* _ASM_GENERIC_DIV64_H */ -Index: xen-3.3.0-testing/tools/xcutils/helper/x86_64/entry.S +Index: xen-3.3.1-testing/tools/xcutils/helper/x86_64/entry.S =================================================================== --- /dev/null -+++ xen-3.3.0-testing/tools/xcutils/helper/x86_64/entry.S ++++ xen-3.3.1-testing/tools/xcutils/helper/x86_64/entry.S @@ -0,0 +1,50 @@ +#include "offsets.h" + @@ -4170,10 +4170,10 @@ Index: xen-3.3.0-testing/tools/xcutils/helper/x86_64/entry.S + nop + .align 4096 +hypercall_end: -Index: xen-3.3.0-testing/tools/xcutils/helper/x86_64/hypercall.h +Index: xen-3.3.1-testing/tools/xcutils/helper/x86_64/hypercall.h =================================================================== --- /dev/null -+++ xen-3.3.0-testing/tools/xcutils/helper/x86_64/hypercall.h ++++ xen-3.3.1-testing/tools/xcutils/helper/x86_64/hypercall.h @@ -0,0 +1,354 @@ +/****************************************************************************** + * hypercall.h @@ -4529,10 +4529,10 @@ Index: xen-3.3.0-testing/tools/xcutils/helper/x86_64/hypercall.h +} + +#endif /* __HYPERCALL_H__ */ -Index: xen-3.3.0-testing/tools/xcutils/kexec-syscall.h +Index: xen-3.3.1-testing/tools/xcutils/kexec-syscall.h =================================================================== --- /dev/null -+++ xen-3.3.0-testing/tools/xcutils/kexec-syscall.h ++++ xen-3.3.1-testing/tools/xcutils/kexec-syscall.h @@ -0,0 +1,80 @@ +#ifndef KEXEC_SYSCALL_H +#define KEXEC_SYSCALL_H @@ -4614,10 +4614,10 @@ Index: xen-3.3.0-testing/tools/xcutils/kexec-syscall.h +#define KEXEC_MAX_SEGMENTS 16 + +#endif /* KEXEC_SYSCALL_H */ -Index: xen-3.3.0-testing/tools/xcutils/xc_kexec.c +Index: xen-3.3.1-testing/tools/xcutils/xc_kexec.c =================================================================== --- /dev/null -+++ xen-3.3.0-testing/tools/xcutils/xc_kexec.c ++++ xen-3.3.1-testing/tools/xcutils/xc_kexec.c @@ -0,0 +1,503 @@ +#include +#include diff --git a/x86-extra-trap-info.patch b/x86-extra-trap-info.patch index ee46a97..0fd6112 100644 --- a/x86-extra-trap-info.patch +++ b/x86-extra-trap-info.patch @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/xen/arch/x86/x86_32/entry.S +Index: xen-3.3.1-testing/xen/arch/x86/x86_32/entry.S =================================================================== ---- xen-3.3.0-testing.orig/xen/arch/x86/x86_32/entry.S -+++ xen-3.3.0-testing/xen/arch/x86/x86_32/entry.S +--- xen-3.3.1-testing.orig/xen/arch/x86/x86_32/entry.S ++++ xen-3.3.1-testing/xen/arch/x86/x86_32/entry.S @@ -401,21 +401,33 @@ ring1: /* obtain ss/esp from oldss/olde movl %eax,UREGS_eip+4(%esp) ret @@ -46,10 +46,10 @@ Index: xen-3.3.0-testing/xen/arch/x86/x86_32/entry.S domain_crash_synchronous: pushl $domain_crash_synchronous_string call printk -Index: xen-3.3.0-testing/xen/arch/x86/x86_64/entry.S +Index: xen-3.3.1-testing/xen/arch/x86/x86_64/entry.S =================================================================== ---- xen-3.3.0-testing.orig/xen/arch/x86/x86_64/entry.S -+++ xen-3.3.0-testing/xen/arch/x86/x86_64/entry.S +--- xen-3.3.1-testing.orig/xen/arch/x86/x86_64/entry.S ++++ xen-3.3.1-testing/xen/arch/x86/x86_64/entry.S @@ -419,17 +419,30 @@ create_bounce_frame: movq %rax,UREGS_rip+8(%rsp) ret diff --git a/x86-microcode.patch b/x86-microcode.patch deleted file mode 100644 index ac2b4ca..0000000 --- a/x86-microcode.patch +++ /dev/null @@ -1,141 +0,0 @@ -Index: xen-3.3.0-testing/xen/arch/x86/microcode.c -=================================================================== ---- xen-3.3.0-testing.orig/xen/arch/x86/microcode.c -+++ xen-3.3.0-testing/xen/arch/x86/microcode.c -@@ -98,7 +98,7 @@ MODULE_LICENSE("GPL"); - static int verbose; - boolean_param("microcode.verbose", verbose); - --#define MICROCODE_VERSION "1.14a" -+#define MICROCODE_VERSION "1.14b" - - #define DEFAULT_UCODE_DATASIZE (2000) /* 2000 bytes */ - #define MC_HEADER_SIZE (sizeof (microcode_header_t)) /* 48 bytes */ -@@ -118,9 +118,6 @@ boolean_param("microcode.verbose", verbo - - #define exttable_size(et) ((et)->count * EXT_SIGNATURE_SIZE + EXT_HEADER_SIZE) - --/* serialize access to the physical write to MSR 0x79 */ --static DEFINE_SPINLOCK(microcode_update_lock); -- - /* no concurrent ->write()s are allowed on /dev/cpu/microcode */ - static DEFINE_MUTEX(microcode_mutex); - -@@ -376,25 +373,10 @@ out: - - static void do_update_one (void * unused) - { -- unsigned long flags; - unsigned int val[2]; - int cpu_num = smp_processor_id(); - struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; - -- if (uci->mc == NULL) { -- if (verbose) { -- if (uci->err == MC_SUCCESS) -- printk(KERN_INFO "microcode: CPU%d already at revision 0x%x\n", -- cpu_num, uci->rev); -- else -- printk(KERN_INFO "microcode: No new microcode data for CPU%d\n", cpu_num); -- } -- return; -- } -- -- /* serialize access to the physical write to MSR 0x79 */ -- spin_lock_irqsave(µcode_update_lock, flags); -- - /* write microcode via MSR 0x79 */ - wrmsr(MSR_IA32_UCODE_WRITE, - (unsigned long) uci->mc->bits, -@@ -409,7 +391,6 @@ static void do_update_one (void * unused - - /* notify the caller of success on this cpu */ - uci->err = MC_SUCCESS; -- spin_unlock_irqrestore(µcode_update_lock, flags); - printk(KERN_INFO "microcode: CPU%d updated from revision " - "0x%x to 0x%x, date = %08x \n", - cpu_num, uci->rev, val[1], uci->mc->hdr.date); -@@ -418,40 +399,65 @@ static void do_update_one (void * unused - - static int do_microcode_update (void) - { -- int i, error; -+ int i, j, error; -+ cpumask_t cpu_mask = cpu_online_map; - -- if (on_each_cpu(collect_cpu_info, NULL, 1, 1) != 0) { -- printk(KERN_ERR "microcode: Error! Could not run on all processors\n"); -- error = -EIO; -- goto out; -+ for_each_cpu_mask(i, cpu_mask) { -+ if (on_selected_cpus(cpumask_of_cpu(i), collect_cpu_info, NULL, 1, 1) != 0) { -+ printk(KERN_ERR "microcode: Error! Could not run on all processors\n"); -+ return -EIO; -+ } - } - - if ((error = find_matching_ucodes())) { - printk(KERN_ERR "microcode: Error in the microcode data\n"); -- goto out_free; -+ cpus_clear(cpu_mask); - } - -- if (on_each_cpu(do_update_one, NULL, 1, 1) != 0) { -- printk(KERN_ERR "microcode: Error! Could not run on all processors\n"); -- error = -EIO; -+ for (; (i = any_online_cpu(cpu_mask)) < NR_CPUS; cpu_clear(i, cpu_mask)) { -+ if (ucode_cpu_info[i].mc == NULL) { -+ if (verbose) { -+ switch (ucode_cpu_info[i].err) { -+ case MC_SUCCESS: -+ printk(KERN_INFO "microcode: CPU%d already at revision 0x%x\n", -+ i, ucode_cpu_info[i].rev); -+ break; -+ case MC_IGNORED: -+ printk(KERN_WARNING "microcode: CPU%d not 'upgrading' to earlier revision" -+ " 0x%x (current=0x%x)\n", i, ucode_cpu_info[i].cksum, ucode_cpu_info[i].rev); -+ break; -+ default: -+ printk(KERN_INFO "microcode: No new microcode data for CPU%d\n", i); -+ break; -+ } -+ } -+ } else if (on_selected_cpus(cpumask_of_cpu(i), do_update_one, NULL, 1, 1) != 0) { -+ printk(KERN_ERR "microcode: Error! Could not run on processor %d\n", i); -+ error = -EIO; -+ } else if (ucode_cpu_info[i].err == MC_SUCCESS) { -+ cpus_andnot(cpu_mask, cpu_mask, cpu_sibling_map[i]); -+ for_each_cpu_mask(j, cpu_sibling_map[i]) { -+ if (j != i) { -+ ucode_cpu_info[j].err = MC_SUCCESS; -+ ASSERT(ucode_cpu_info[j].mc == ucode_cpu_info[i].mc); -+ ucode_cpu_info[j].mc = NULL; -+ } -+ } -+ } - } - --out_free: -- for_each_online_cpu(i) { -+ for (i = 0; i < NR_CPUS; i++) { - if (ucode_cpu_info[i].mc) { -- int j; - void *tmp = ucode_cpu_info[i].mc; -- vfree(tmp); -- for_each_online_cpu(j) { -+ -+ for (j = 0; j < NR_CPUS; j++) { - if (ucode_cpu_info[j].mc == tmp) - ucode_cpu_info[j].mc = NULL; - } -+ vfree(tmp); - } -- if (ucode_cpu_info[i].err == MC_IGNORED && verbose) -- printk(KERN_WARNING "microcode: CPU%d not 'upgrading' to earlier revision" -- " 0x%x (current=0x%x)\n", i, ucode_cpu_info[i].cksum, ucode_cpu_info[i].rev); - } --out: -+ - return error; - } - diff --git a/x86-page-gnttab.patch b/x86-page-gnttab.patch new file mode 100644 index 0000000..2526bc7 --- /dev/null +++ b/x86-page-gnttab.patch @@ -0,0 +1,32 @@ +Index: xen-3.3.1-testing/xen/include/asm-x86/page.h +=================================================================== +--- xen-3.3.1-testing.orig/xen/include/asm-x86/page.h ++++ xen-3.3.1-testing/xen/include/asm-x86/page.h +@@ -301,9 +301,10 @@ void setup_idle_pagetable(void); + * WARNING: This will need to be disabled to run OSes that use the spare PTE + * bits themselves (e.g., *BSD). + */ +-#ifndef NDEBUG +-#define _PAGE_GNTTAB _PAGE_AVAIL2 +-#else ++#ifdef NDEBUG ++#undef _PAGE_GNTTAB ++#endif ++#ifndef _PAGE_GNTTAB + #define _PAGE_GNTTAB 0 + #endif + +Index: xen-3.3.1-testing/xen/include/asm-x86/x86_64/page.h +=================================================================== +--- xen-3.3.1-testing.orig/xen/include/asm-x86/x86_64/page.h ++++ xen-3.3.1-testing/xen/include/asm-x86/x86_64/page.h +@@ -104,6 +104,9 @@ typedef l4_pgentry_t root_pgentry_t; + #define _PAGE_NX_BIT (1U<<23) + #define _PAGE_NX (cpu_has_nx ? _PAGE_NX_BIT : 0U) + ++/* Bit 22 of a 24-bit flag mask. This corresponds to bit 62 of a pte.*/ ++#define _PAGE_GNTTAB (1U<<22) ++ + /* + * Disallow unused flag bits plus PAT/PSE, PCD, PWT and GLOBAL. + * Permit the NX bit if the hardware supports it. diff --git a/x86-show-page-walk-early.patch b/x86-show-page-walk-early.patch index 86842ea..4732bc0 100644 --- a/x86-show-page-walk-early.patch +++ b/x86-show-page-walk-early.patch @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/xen/arch/x86/traps.c +Index: xen-3.3.1-testing/xen/arch/x86/traps.c =================================================================== ---- xen-3.3.0-testing.orig/xen/arch/x86/traps.c -+++ xen-3.3.0-testing/xen/arch/x86/traps.c +--- xen-3.3.1-testing.orig/xen/arch/x86/traps.c ++++ xen-3.3.1-testing/xen/arch/x86/traps.c @@ -1261,6 +1261,7 @@ asmlinkage void do_early_page_fault(stru unsigned long *stk = (unsigned long *)regs; printk("Early fatal page fault at %04x:%p (cr2=%p, ec=%04x)\n", @@ -10,10 +10,10 @@ Index: xen-3.3.0-testing/xen/arch/x86/traps.c printk("Stack dump: "); while ( ((long)stk & ((PAGE_SIZE - 1) & ~(BYTES_PER_LONG - 1))) != 0 ) printk("%p ", _p(*stk++)); -Index: xen-3.3.0-testing/xen/arch/x86/x86_32/mm.c +Index: xen-3.3.1-testing/xen/arch/x86/x86_32/mm.c =================================================================== ---- xen-3.3.0-testing.orig/xen/arch/x86/x86_32/mm.c -+++ xen-3.3.0-testing/xen/arch/x86/x86_32/mm.c +--- xen-3.3.1-testing.orig/xen/arch/x86/x86_32/mm.c ++++ xen-3.3.1-testing/xen/arch/x86/x86_32/mm.c @@ -38,6 +38,7 @@ extern l1_pgentry_t l1_identmap[L1_PAGET unsigned int PAGE_HYPERVISOR = __PAGE_HYPERVISOR; unsigned int PAGE_HYPERVISOR_NOCACHE = __PAGE_HYPERVISOR_NOCACHE; @@ -31,10 +31,10 @@ Index: xen-3.3.0-testing/xen/arch/x86/x86_32/mm.c /* Fill with an obvious debug pattern. */ for ( i = 0; i < (mpt_size / BYTES_PER_LONG); i++) set_gpfn_from_mfn(i, 0x55555555); -Index: xen-3.3.0-testing/xen/arch/x86/x86_32/traps.c +Index: xen-3.3.1-testing/xen/arch/x86/x86_32/traps.c =================================================================== ---- xen-3.3.0-testing.orig/xen/arch/x86/x86_32/traps.c -+++ xen-3.3.0-testing/xen/arch/x86/x86_32/traps.c +--- xen-3.3.1-testing.orig/xen/arch/x86/x86_32/traps.c ++++ xen-3.3.1-testing/xen/arch/x86/x86_32/traps.c @@ -160,7 +160,8 @@ void show_page_walk(unsigned long addr) l3t += (cr3 & 0xFE0UL) >> 3; l3e = l3t[l3_table_offset(addr)]; @@ -65,10 +65,10 @@ Index: xen-3.3.0-testing/xen/arch/x86/x86_32/traps.c printk(" L1[0x%03lx] = %"PRIpte" %08lx\n", l1_table_offset(addr), l1e_get_intpte(l1e), pfn); unmap_domain_page(l1t); -Index: xen-3.3.0-testing/xen/arch/x86/x86_64/mm.c +Index: xen-3.3.1-testing/xen/arch/x86/x86_64/mm.c =================================================================== ---- xen-3.3.0-testing.orig/xen/arch/x86/x86_64/mm.c -+++ xen-3.3.0-testing/xen/arch/x86/x86_64/mm.c +--- xen-3.3.1-testing.orig/xen/arch/x86/x86_64/mm.c ++++ xen-3.3.1-testing/xen/arch/x86/x86_64/mm.c @@ -32,6 +32,7 @@ #include #include @@ -86,10 +86,10 @@ Index: xen-3.3.0-testing/xen/arch/x86/x86_64/mm.c /* Create user-accessible L2 directory to map the MPT for compat guests. */ BUILD_BUG_ON(l4_table_offset(RDWR_MPT_VIRT_START) != l4_table_offset(HIRO_COMPAT_MPT_VIRT_START)); -Index: xen-3.3.0-testing/xen/arch/x86/x86_64/traps.c +Index: xen-3.3.1-testing/xen/arch/x86/x86_64/traps.c =================================================================== ---- xen-3.3.0-testing.orig/xen/arch/x86/x86_64/traps.c -+++ xen-3.3.0-testing/xen/arch/x86/x86_64/traps.c +--- xen-3.3.1-testing.orig/xen/arch/x86/x86_64/traps.c ++++ xen-3.3.1-testing/xen/arch/x86/x86_64/traps.c @@ -174,7 +174,8 @@ void show_page_walk(unsigned long addr) l4t = mfn_to_virt(mfn); l4e = l4t[l4_table_offset(addr)]; @@ -130,10 +130,10 @@ Index: xen-3.3.0-testing/xen/arch/x86/x86_64/traps.c printk(" L1[0x%03lx] = %"PRIpte" %016lx\n", l1_table_offset(addr), l1e_get_intpte(l1e), pfn); } -Index: xen-3.3.0-testing/xen/include/asm-x86/mm.h +Index: xen-3.3.1-testing/xen/include/asm-x86/mm.h =================================================================== ---- xen-3.3.0-testing.orig/xen/include/asm-x86/mm.h -+++ xen-3.3.0-testing/xen/include/asm-x86/mm.h +--- xen-3.3.1-testing.orig/xen/include/asm-x86/mm.h ++++ xen-3.3.1-testing/xen/include/asm-x86/mm.h @@ -307,6 +307,7 @@ TYPE_SAFE(unsigned long,mfn); #define machine_to_phys_mapping ((unsigned long *)RDWR_MPT_VIRT_START) #define INVALID_M2P_ENTRY (~0UL) diff --git a/xen-3.3.1-testing-src.tar.bz2 b/xen-3.3.1-testing-src.tar.bz2 index ca30afe..10ad2df 100644 --- a/xen-3.3.1-testing-src.tar.bz2 +++ b/xen-3.3.1-testing-src.tar.bz2 @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:54669aeece8872bda13bb98fc0afa03d82fd439f4e234935d8174657a2ee0f08 -size 22688672 +oid sha256:a81260006fcf33de732acb4ad2bc84974548f75b6be58f8f8d519a90d8f6b8c3 +size 22688080 diff --git a/xen-api-auth.patch b/xen-api-auth.patch index d5c183d..b308a01 100644 --- a/xen-api-auth.patch +++ b/xen-api-auth.patch @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/tools/python/xen/xend/XendAuthSessions.py +Index: xen-3.3.1-testing/tools/python/xen/xend/XendAuthSessions.py =================================================================== ---- xen-3.3.0-testing.orig/tools/python/xen/xend/XendAuthSessions.py -+++ xen-3.3.0-testing/tools/python/xen/xend/XendAuthSessions.py +--- xen-3.3.1-testing.orig/tools/python/xen/xend/XendAuthSessions.py ++++ xen-3.3.1-testing/tools/python/xen/xend/XendAuthSessions.py @@ -84,7 +84,7 @@ class XendAuthSessions: # if PAM doesn't exist, let's ignore it return False diff --git a/xen-changeset.diff b/xen-changeset.diff index 595024e..6bcb688 100644 --- a/xen-changeset.diff +++ b/xen-changeset.diff @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/xen/Makefile +Index: xen-3.3.1-testing/xen/Makefile =================================================================== ---- xen-3.3.0-testing.orig/xen/Makefile -+++ xen-3.3.0-testing/xen/Makefile +--- xen-3.3.1-testing.orig/xen/Makefile ++++ xen-3.3.1-testing/xen/Makefile @@ -1,3 +1,4 @@ +export XEN_CHANGESET = unavailable # This is the correct place to edit the build version. diff --git a/xen-config.diff b/xen-config.diff index 5641512..6e6abdb 100644 --- a/xen-config.diff +++ b/xen-config.diff @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/Config.mk +Index: xen-3.3.1-testing/Config.mk =================================================================== ---- xen-3.3.0-testing.orig/Config.mk -+++ xen-3.3.0-testing/Config.mk +--- xen-3.3.1-testing.orig/Config.mk ++++ xen-3.3.1-testing/Config.mk @@ -85,20 +85,20 @@ QEMU_REMOTE=http://xenbits.xensource.com # Specify which qemu-dm to use. This may be `ioemu' to use the old diff --git a/xen-destdir.diff b/xen-destdir.diff index 2ecace8..14bbdd8 100644 --- a/xen-destdir.diff +++ b/xen-destdir.diff @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/docs/Makefile +Index: xen-3.3.1-testing/docs/Makefile =================================================================== ---- xen-3.3.0-testing.orig/docs/Makefile -+++ xen-3.3.0-testing/docs/Makefile +--- xen-3.3.1-testing.orig/docs/Makefile ++++ xen-3.3.1-testing/docs/Makefile @@ -90,7 +90,8 @@ install: all $(INSTALL_DIR) $(DESTDIR)$(MANDIR) cp -dR man1 $(DESTDIR)$(MANDIR) @@ -22,10 +22,10 @@ Index: xen-3.3.0-testing/docs/Makefile + ln -sf $*.html html.done/$*/index.html + rm -rf html/ + -Index: xen-3.3.0-testing/tools/examples/Makefile +Index: xen-3.3.1-testing/tools/examples/Makefile =================================================================== ---- xen-3.3.0-testing.orig/tools/examples/Makefile -+++ xen-3.3.0-testing/tools/examples/Makefile +--- xen-3.3.1-testing.orig/tools/examples/Makefile ++++ xen-3.3.1-testing/tools/examples/Makefile @@ -47,18 +47,6 @@ XEN_HOTPLUG_SCRIPTS = xen-backend.agent UDEV_RULES_DIR = /etc/udev UDEV_RULES = xen-backend.rules @@ -77,10 +77,10 @@ Index: xen-3.3.0-testing/tools/examples/Makefile done .PHONY: clean -Index: xen-3.3.0-testing/tools/security/Makefile +Index: xen-3.3.1-testing/tools/security/Makefile =================================================================== ---- xen-3.3.0-testing.orig/tools/security/Makefile -+++ xen-3.3.0-testing/tools/security/Makefile +--- xen-3.3.1-testing.orig/tools/security/Makefile ++++ xen-3.3.1-testing/tools/security/Makefile @@ -64,9 +64,9 @@ install: all $(ACM_CONFIG_FILE) $(INSTALL_DIR) $(DESTDIR)$(ACM_SECGEN_CGIDIR) $(INSTALL_PROG) $(ACM_INST_CGI) $(DESTDIR)$(ACM_SECGEN_CGIDIR) @@ -93,10 +93,10 @@ Index: xen-3.3.0-testing/tools/security/Makefile endif else .PHONY: all -Index: xen-3.3.0-testing/tools/pygrub/Makefile +Index: xen-3.3.1-testing/tools/pygrub/Makefile =================================================================== ---- xen-3.3.0-testing.orig/tools/pygrub/Makefile -+++ xen-3.3.0-testing/tools/pygrub/Makefile +--- xen-3.3.1-testing.orig/tools/pygrub/Makefile ++++ xen-3.3.1-testing/tools/pygrub/Makefile @@ -16,7 +16,7 @@ install: all $(INSTALL_DIR) $(DESTDIR)/var/run/xend/boot else @@ -106,10 +106,10 @@ Index: xen-3.3.0-testing/tools/pygrub/Makefile $(INSTALL_DIR) $(DESTDIR)/var/run/xend/boot endif -Index: xen-3.3.0-testing/tools/python/Makefile +Index: xen-3.3.1-testing/tools/python/Makefile =================================================================== ---- xen-3.3.0-testing.orig/tools/python/Makefile -+++ xen-3.3.0-testing/tools/python/Makefile +--- xen-3.3.1-testing.orig/tools/python/Makefile ++++ xen-3.3.1-testing/tools/python/Makefile @@ -80,7 +80,7 @@ install: install-messages install-dtd CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py install --home="$(DESTDIR)/usr" --prefix="" --force --install-lib="$(DESTDIR)$(LIBPATH)/python" else @@ -119,10 +119,10 @@ Index: xen-3.3.0-testing/tools/python/Makefile endif install-dtd: all -Index: xen-3.3.0-testing/tools/xenstore/Makefile +Index: xen-3.3.1-testing/tools/xenstore/Makefile =================================================================== ---- xen-3.3.0-testing.orig/tools/xenstore/Makefile -+++ xen-3.3.0-testing/tools/xenstore/Makefile +--- xen-3.3.1-testing.orig/tools/xenstore/Makefile ++++ xen-3.3.1-testing/tools/xenstore/Makefile @@ -14,6 +14,7 @@ DEP = .*.d CLIENTS := xenstore-exists xenstore-list xenstore-read xenstore-rm xenstore-chmod @@ -177,10 +177,10 @@ Index: xen-3.3.0-testing/tools/xenstore/Makefile $(INSTALL_DIR) $(DESTDIR)$(LIBDIR) $(INSTALL_PROG) libxenstore.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR) ln -sf libxenstore.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)/libxenstore.so.$(MAJOR) -Index: xen-3.3.0-testing/tools/misc/Makefile +Index: xen-3.3.1-testing/tools/misc/Makefile =================================================================== ---- xen-3.3.0-testing.orig/tools/misc/Makefile -+++ xen-3.3.0-testing/tools/misc/Makefile +--- xen-3.3.1-testing.orig/tools/misc/Makefile ++++ xen-3.3.1-testing/tools/misc/Makefile @@ -19,7 +19,7 @@ SUBDIRS-$(CONFIG_MINITERM) += miniterm SUBDIRS := $(SUBDIRS-y) diff --git a/xen-disable-qemu-monitor.diff b/xen-disable-qemu-monitor.diff index 99859c0..f95f1c3 100644 --- a/xen-disable-qemu-monitor.diff +++ b/xen-disable-qemu-monitor.diff @@ -5,10 +5,10 @@ the "sendkey" command, among other useful things), remove all console commands that can read/write dom0's state. -Index: xen-3.3.0-testing/tools/ioemu-remote/monitor.c +Index: xen-3.3.1-testing/tools/ioemu-remote/monitor.c =================================================================== ---- xen-3.3.0-testing.orig/tools/ioemu-remote/monitor.c -+++ xen-3.3.0-testing/tools/ioemu-remote/monitor.c +--- xen-3.3.1-testing.orig/tools/ioemu-remote/monitor.c ++++ xen-3.3.1-testing/tools/ioemu-remote/monitor.c @@ -1320,6 +1320,7 @@ static term_cmd_t term_cmds[] = { "device|all", "commit changes to the disk images (if -snapshot is used) or backing files" }, { "info", "s?", do_info, diff --git a/xen-fixme-doc.diff b/xen-fixme-doc.diff index 8bb1404..403ceaf 100644 --- a/xen-fixme-doc.diff +++ b/xen-fixme-doc.diff @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/docs/man/xmdomain.cfg.pod.5 +Index: xen-3.3.1-testing/docs/man/xmdomain.cfg.pod.5 =================================================================== ---- xen-3.3.0-testing.orig/docs/man/xmdomain.cfg.pod.5 -+++ xen-3.3.0-testing/docs/man/xmdomain.cfg.pod.5 +--- xen-3.3.1-testing.orig/docs/man/xmdomain.cfg.pod.5 ++++ xen-3.3.1-testing/docs/man/xmdomain.cfg.pod.5 @@ -335,16 +335,10 @@ at hda1, which is the root filesystem. =item I @@ -19,10 +19,10 @@ Index: xen-3.3.0-testing/docs/man/xmdomain.cfg.pod.5 =back =head1 SEE ALSO -Index: xen-3.3.0-testing/docs/man/xm.pod.1 +Index: xen-3.3.1-testing/docs/man/xm.pod.1 =================================================================== ---- xen-3.3.0-testing.orig/docs/man/xm.pod.1 -+++ xen-3.3.0-testing/docs/man/xm.pod.1 +--- xen-3.3.1-testing.orig/docs/man/xm.pod.1 ++++ xen-3.3.1-testing/docs/man/xm.pod.1 @@ -188,7 +188,8 @@ scheduling by the Xen hypervisor. =item B diff --git a/xen-hvm-default-pae.diff b/xen-hvm-default-pae.diff index 1effb5b..60e1b21 100644 --- a/xen-hvm-default-pae.diff +++ b/xen-hvm-default-pae.diff @@ -1,9 +1,9 @@ PAE must be on for 64-on-64 to work at all. -Index: xen-3.3.0-testing/tools/python/xen/xend/image.py +Index: xen-3.3.1-testing/tools/python/xen/xend/image.py =================================================================== ---- xen-3.3.0-testing.orig/tools/python/xen/xend/image.py -+++ xen-3.3.0-testing/tools/python/xen/xend/image.py +--- xen-3.3.1-testing.orig/tools/python/xen/xend/image.py ++++ xen-3.3.1-testing/tools/python/xen/xend/image.py @@ -871,7 +871,7 @@ class X86_HVM_ImageHandler(HVMImageHandl def configure(self, vmConfig): diff --git a/xen-ioapic-ack-default.diff b/xen-ioapic-ack-default.diff index 7e86fcb..18892d0 100644 --- a/xen-ioapic-ack-default.diff +++ b/xen-ioapic-ack-default.diff @@ -1,10 +1,10 @@ Change default IO-APIC ack mode for single IO-APIC systems to old-style. Jan -Index: xen-3.3.0-testing/xen/arch/x86/io_apic.c +Index: xen-3.3.1-testing/xen/arch/x86/io_apic.c =================================================================== ---- xen-3.3.0-testing.orig/xen/arch/x86/io_apic.c -+++ xen-3.3.0-testing/xen/arch/x86/io_apic.c +--- xen-3.3.1-testing.orig/xen/arch/x86/io_apic.c ++++ xen-3.3.1-testing/xen/arch/x86/io_apic.c @@ -1365,7 +1365,7 @@ static unsigned int startup_level_ioapic return 0; /* don't check for pending */ } diff --git a/xen-lowmem-emergency-pool.diff b/xen-lowmem-emergency-pool.diff index 35c2ecf..576c7be 100644 --- a/xen-lowmem-emergency-pool.diff +++ b/xen-lowmem-emergency-pool.diff @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/xen/arch/x86/x86_32/mm.c +Index: xen-3.3.1-testing/xen/arch/x86/x86_32/mm.c =================================================================== ---- xen-3.3.0-testing.orig/xen/arch/x86/x86_32/mm.c -+++ xen-3.3.0-testing/xen/arch/x86/x86_32/mm.c +--- xen-3.3.1-testing.orig/xen/arch/x86/x86_32/mm.c ++++ xen-3.3.1-testing/xen/arch/x86/x86_32/mm.c @@ -63,6 +63,8 @@ l2_pgentry_t *virt_to_xen_l2e(unsigned l return &idle_pg_table_l2[l2_linear_offset(v)]; } @@ -32,10 +32,10 @@ Index: xen-3.3.0-testing/xen/arch/x86/x86_32/mm.c } void __init zap_low_mappings(l2_pgentry_t *dom0_l2) -Index: xen-3.3.0-testing/xen/common/page_alloc.c +Index: xen-3.3.1-testing/xen/common/page_alloc.c =================================================================== ---- xen-3.3.0-testing.orig/xen/common/page_alloc.c -+++ xen-3.3.0-testing/xen/common/page_alloc.c +--- xen-3.3.1-testing.orig/xen/common/page_alloc.c ++++ xen-3.3.1-testing/xen/common/page_alloc.c @@ -53,6 +53,20 @@ static int opt_bootscrub __initdata = 1; boolean_param("bootscrub", opt_bootscrub); diff --git a/xen-no-dummy-nfs-ip.diff b/xen-no-dummy-nfs-ip.diff index 85f9767..26c77f7 100644 --- a/xen-no-dummy-nfs-ip.diff +++ b/xen-no-dummy-nfs-ip.diff @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/tools/python/xen/xm/create.py +Index: xen-3.3.1-testing/tools/python/xen/xm/create.py =================================================================== ---- xen-3.3.0-testing.orig/tools/python/xen/xm/create.py -+++ xen-3.3.0-testing/tools/python/xen/xm/create.py +--- xen-3.3.1-testing.orig/tools/python/xen/xm/create.py ++++ xen-3.3.1-testing/tools/python/xen/xm/create.py @@ -1066,9 +1066,8 @@ def preprocess_access_control(vals): def preprocess_ip(vals): diff --git a/xen-paths.diff b/xen-paths.diff index 40810cf..392f21d 100644 --- a/xen-paths.diff +++ b/xen-paths.diff @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/tools/python/xen/xm/create.py +Index: xen-3.3.1-testing/tools/python/xen/xm/create.py =================================================================== ---- xen-3.3.0-testing.orig/tools/python/xen/xm/create.py -+++ xen-3.3.0-testing/tools/python/xen/xm/create.py +--- xen-3.3.1-testing.orig/tools/python/xen/xm/create.py ++++ xen-3.3.1-testing/tools/python/xen/xm/create.py @@ -70,7 +70,7 @@ gopts.opt('quiet', short='q', use="Quiet.") @@ -11,10 +11,10 @@ Index: xen-3.3.0-testing/tools/python/xen/xm/create.py use="Search path for configuration scripts. " "The value of PATH is a colon-separated directory list.") -Index: xen-3.3.0-testing/docs/man/xm.pod.1 +Index: xen-3.3.1-testing/docs/man/xm.pod.1 =================================================================== ---- xen-3.3.0-testing.orig/docs/man/xm.pod.1 -+++ xen-3.3.0-testing/docs/man/xm.pod.1 +--- xen-3.3.1-testing.orig/docs/man/xm.pod.1 ++++ xen-3.3.1-testing/docs/man/xm.pod.1 @@ -76,7 +76,7 @@ format, and possible options used in eit I=I combinations. @@ -33,10 +33,10 @@ Index: xen-3.3.0-testing/docs/man/xm.pod.1 soon as it is run. =item I -Index: xen-3.3.0-testing/docs/man/xmdomain.cfg.pod.5 +Index: xen-3.3.1-testing/docs/man/xmdomain.cfg.pod.5 =================================================================== ---- xen-3.3.0-testing.orig/docs/man/xmdomain.cfg.pod.5 -+++ xen-3.3.0-testing/docs/man/xmdomain.cfg.pod.5 +--- xen-3.3.1-testing.orig/docs/man/xmdomain.cfg.pod.5 ++++ xen-3.3.1-testing/docs/man/xmdomain.cfg.pod.5 @@ -4,9 +4,9 @@ xmdomain.cfg - xm domain config file for =head1 SYNOPSIS diff --git a/xen-qemu-iscsi-fix.patch b/xen-qemu-iscsi-fix.patch index c6380f6..bb4bef0 100644 --- a/xen-qemu-iscsi-fix.patch +++ b/xen-qemu-iscsi-fix.patch @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/tools/ioemu-remote/xenstore.c +Index: xen-3.3.1-testing/tools/ioemu-remote/xenstore.c =================================================================== ---- xen-3.3.0-testing.orig/tools/ioemu-remote/xenstore.c -+++ xen-3.3.0-testing/tools/ioemu-remote/xenstore.c +--- xen-3.3.1-testing.orig/tools/ioemu-remote/xenstore.c ++++ xen-3.3.1-testing/tools/ioemu-remote/xenstore.c @@ -153,7 +153,7 @@ void xenstore_parse_domain_config(int hv char *buf = NULL, *path; char *fpath = NULL, *bpath = NULL, *btype = NULL, diff --git a/xen-rpmoptflags.diff b/xen-rpmoptflags.diff index 15017fb..908bd39 100644 --- a/xen-rpmoptflags.diff +++ b/xen-rpmoptflags.diff @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/tools/blktap/drivers/Makefile +Index: xen-3.3.1-testing/tools/blktap/drivers/Makefile =================================================================== ---- xen-3.3.0-testing.orig/tools/blktap/drivers/Makefile -+++ xen-3.3.0-testing/tools/blktap/drivers/Makefile +--- xen-3.3.1-testing.orig/tools/blktap/drivers/Makefile ++++ xen-3.3.1-testing/tools/blktap/drivers/Makefile @@ -5,7 +5,6 @@ IBIN = blktapctrl tapdisk QCOW_UTIL = img2qcow qcow2raw qcow-create LIBAIO_DIR = ../../libaio/src @@ -10,10 +10,10 @@ Index: xen-3.3.0-testing/tools/blktap/drivers/Makefile CFLAGS += -Wno-unused CFLAGS += -I../lib CFLAGS += $(CFLAGS_libxenctrl) -Index: xen-3.3.0-testing/Config.mk +Index: xen-3.3.1-testing/Config.mk =================================================================== ---- xen-3.3.0-testing.orig/Config.mk -+++ xen-3.3.0-testing/Config.mk +--- xen-3.3.1-testing.orig/Config.mk ++++ xen-3.3.1-testing/Config.mk @@ -14,7 +14,7 @@ SHELL ?= /bin/sh # Tools to run on system hosting the build diff --git a/xen-tightvnc-args.diff b/xen-tightvnc-args.diff index 0dbe0aa..f4ce56e 100644 --- a/xen-tightvnc-args.diff +++ b/xen-tightvnc-args.diff @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/tools/python/xen/xm/create.py +Index: xen-3.3.1-testing/tools/python/xen/xm/create.py =================================================================== ---- xen-3.3.0-testing.orig/tools/python/xen/xm/create.py -+++ xen-3.3.0-testing/tools/python/xen/xm/create.py +--- xen-3.3.1-testing.orig/tools/python/xen/xm/create.py ++++ xen-3.3.1-testing/tools/python/xen/xm/create.py @@ -1122,8 +1122,7 @@ def spawn_vnc(display): returns the port that the vncviewer is listening on and sets the global vncpid. On failure, returns 0. Note that vncviewer is daemonized. diff --git a/xen-warnings.diff b/xen-warnings.diff index c158a82..eab9d20 100644 --- a/xen-warnings.diff +++ b/xen-warnings.diff @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/tools/misc/miniterm/miniterm.c +Index: xen-3.3.1-testing/tools/misc/miniterm/miniterm.c =================================================================== ---- xen-3.3.0-testing.orig/tools/misc/miniterm/miniterm.c -+++ xen-3.3.0-testing/tools/misc/miniterm/miniterm.c +--- xen-3.3.1-testing.orig/tools/misc/miniterm/miniterm.c ++++ xen-3.3.1-testing/tools/misc/miniterm/miniterm.c @@ -157,7 +157,7 @@ int main(int argc, char **argv) case 0: close(1); /* stdout not needed */ @@ -35,10 +35,10 @@ Index: xen-3.3.0-testing/tools/misc/miniterm/miniterm.c break; } -Index: xen-3.3.0-testing/xen/tools/symbols.c +Index: xen-3.3.1-testing/xen/tools/symbols.c =================================================================== ---- xen-3.3.0-testing.orig/xen/tools/symbols.c -+++ xen-3.3.0-testing/xen/tools/symbols.c +--- xen-3.3.1-testing.orig/xen/tools/symbols.c ++++ xen-3.3.1-testing/xen/tools/symbols.c @@ -81,7 +81,8 @@ static int read_symbol(FILE *in, struct if (rc != 3) { if (rc != EOF) { @@ -49,10 +49,10 @@ Index: xen-3.3.0-testing/xen/tools/symbols.c } return -1; } -Index: xen-3.3.0-testing/tools/libxc/xc_dom_elfloader.c +Index: xen-3.3.1-testing/tools/libxc/xc_dom_elfloader.c =================================================================== ---- xen-3.3.0-testing.orig/tools/libxc/xc_dom_elfloader.c -+++ xen-3.3.0-testing/tools/libxc/xc_dom_elfloader.c +--- xen-3.3.1-testing.orig/tools/libxc/xc_dom_elfloader.c ++++ xen-3.3.1-testing/tools/libxc/xc_dom_elfloader.c @@ -193,8 +193,9 @@ static int xc_dom_load_elf_symtab(struct if ( load ) @@ -64,10 +64,10 @@ Index: xen-3.3.0-testing/tools/libxc/xc_dom_elfloader.c elf_section_start(elf, shdr2), size); } -Index: xen-3.3.0-testing/tools/xenstore/Makefile +Index: xen-3.3.1-testing/tools/xenstore/Makefile =================================================================== ---- xen-3.3.0-testing.orig/tools/xenstore/Makefile -+++ xen-3.3.0-testing/tools/xenstore/Makefile +--- xen-3.3.1-testing.orig/tools/xenstore/Makefile ++++ xen-3.3.1-testing/tools/xenstore/Makefile @@ -4,7 +4,7 @@ include $(XEN_ROOT)/tools/Rules.mk MAJOR = 3.0 MINOR = 0 @@ -77,10 +77,10 @@ Index: xen-3.3.0-testing/tools/xenstore/Makefile CFLAGS += -I. CFLAGS += $(CFLAGS_libxenctrl) -Index: xen-3.3.0-testing/tools/xenstore/xenstored_core.c +Index: xen-3.3.1-testing/tools/xenstore/xenstored_core.c =================================================================== ---- xen-3.3.0-testing.orig/tools/xenstore/xenstored_core.c -+++ xen-3.3.0-testing/tools/xenstore/xenstored_core.c +--- xen-3.3.1-testing.orig/tools/xenstore/xenstored_core.c ++++ xen-3.3.1-testing/tools/xenstore/xenstored_core.c @@ -77,8 +77,8 @@ static void check_store(void); int quota_nb_entry_per_domain = 1000; @@ -105,10 +105,10 @@ Index: xen-3.3.0-testing/tools/xenstore/xenstored_core.c break; case 'T': tracefile = optarg; -Index: xen-3.3.0-testing/tools/xenstore/xenstored_domain.c +Index: xen-3.3.1-testing/tools/xenstore/xenstored_domain.c =================================================================== ---- xen-3.3.0-testing.orig/tools/xenstore/xenstored_domain.c -+++ xen-3.3.0-testing/tools/xenstore/xenstored_domain.c +--- xen-3.3.1-testing.orig/tools/xenstore/xenstored_domain.c ++++ xen-3.3.1-testing/tools/xenstore/xenstored_domain.c @@ -212,7 +212,7 @@ void handle_event(void) { evtchn_port_t port; @@ -127,10 +127,10 @@ Index: xen-3.3.0-testing/tools/xenstore/xenstored_domain.c return -1; dom0 = new_domain(NULL, 0, port); -Index: xen-3.3.0-testing/tools/xenstore/xenstored_transaction.c +Index: xen-3.3.1-testing/tools/xenstore/xenstored_transaction.c =================================================================== ---- xen-3.3.0-testing.orig/tools/xenstore/xenstored_transaction.c -+++ xen-3.3.0-testing/tools/xenstore/xenstored_transaction.c +--- xen-3.3.1-testing.orig/tools/xenstore/xenstored_transaction.c ++++ xen-3.3.1-testing/tools/xenstore/xenstored_transaction.c @@ -82,7 +82,7 @@ struct transaction struct list_head changed_domains; }; @@ -140,10 +140,10 @@ Index: xen-3.3.0-testing/tools/xenstore/xenstored_transaction.c static unsigned int generation; /* Return tdb context to use for this connection. */ -Index: xen-3.3.0-testing/tools/xenstore/xenstore_client.c +Index: xen-3.3.1-testing/tools/xenstore/xenstore_client.c =================================================================== ---- xen-3.3.0-testing.orig/tools/xenstore/xenstore_client.c -+++ xen-3.3.0-testing/tools/xenstore/xenstore_client.c +--- xen-3.3.1-testing.orig/tools/xenstore/xenstore_client.c ++++ xen-3.3.1-testing/tools/xenstore/xenstore_client.c @@ -251,7 +251,7 @@ do_chmod(char *path, struct xs_permissio char **xsval = xs_directory(xsh, xth, path, &xsval_n); @@ -153,10 +153,10 @@ Index: xen-3.3.0-testing/tools/xenstore/xenstore_client.c for (i = 0; i < xsval_n; i++) { snprintf(buf, MAX_PATH_LEN, "%s/%s", path, xsval[i]); -Index: xen-3.3.0-testing/tools/libxen/src/xen_common.c +Index: xen-3.3.1-testing/tools/libxen/src/xen_common.c =================================================================== ---- xen-3.3.0-testing.orig/tools/libxen/src/xen_common.c -+++ xen-3.3.0-testing/tools/libxen/src/xen_common.c +--- xen-3.3.1-testing.orig/tools/libxen/src/xen_common.c ++++ xen-3.3.1-testing/tools/libxen/src/xen_common.c @@ -1055,6 +1055,8 @@ static size_t size_of_member(const abstr default: assert(false); @@ -175,32 +175,3 @@ Index: xen-3.3.0-testing/tools/libxen/src/xen_common.c } -Index: xen-3.3.0-testing/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c -=================================================================== ---- xen-3.3.0-testing.orig/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c -+++ xen-3.3.0-testing/unmodified_drivers/linux-2.6/platform-pci/platform-compat.c -@@ -14,7 +14,10 @@ EXPORT_SYMBOL(system_state); - - void ctrl_alt_del(void) - { -- kill_proc(1, SIGINT, 1); /* interrupt init */ -+ siginfo_t si; -+ pid_t p = 1; -+ -+ kill_proc_info(1, &si, p); - } - - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8) -Index: xen-3.3.0-testing/unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c -=================================================================== ---- xen-3.3.0-testing.orig/unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c -+++ xen-3.3.0-testing/unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c -@@ -44,7 +44,7 @@ static void ap_suspend(void *_info) - atomic_dec(&info->nr_spinning); - } - --#define initiate_ap_suspend(i) smp_call_function(ap_suspend, i, 0, 0) -+#define initiate_ap_suspend(i) smp_call_function(ap_suspend, i, 0) - - #else /* !defined(CONFIG_SMP) */ - diff --git a/xen-xm-top-needs-root.diff b/xen-xm-top-needs-root.diff index ab5d942..1f8ee07 100644 --- a/xen-xm-top-needs-root.diff +++ b/xen-xm-top-needs-root.diff @@ -1,10 +1,10 @@ From: Charles Coffing Upstream: no -Index: xen-3.3.0-testing/tools/python/xen/xm/main.py +Index: xen-3.3.1-testing/tools/python/xen/xm/main.py =================================================================== ---- xen-3.3.0-testing.orig/tools/python/xen/xm/main.py -+++ xen-3.3.0-testing/tools/python/xen/xm/main.py +--- xen-3.3.1-testing.orig/tools/python/xen/xm/main.py ++++ xen-3.3.1-testing/tools/python/xen/xm/main.py @@ -1933,6 +1933,10 @@ def xm_debug_keys(args): def xm_top(args): arg_check(args, "top", 0) diff --git a/xen-xmexample-vti.diff b/xen-xmexample-vti.diff index 4f78f39..e70058d 100644 --- a/xen-xmexample-vti.diff +++ b/xen-xmexample-vti.diff @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/tools/examples/Makefile +Index: xen-3.3.1-testing/tools/examples/Makefile =================================================================== ---- xen-3.3.0-testing.orig/tools/examples/Makefile -+++ xen-3.3.0-testing/tools/examples/Makefile +--- xen-3.3.1-testing.orig/tools/examples/Makefile ++++ xen-3.3.1-testing/tools/examples/Makefile @@ -20,7 +20,6 @@ XEN_CONFIGS += xmexample.hvm-stubdom XEN_CONFIGS += xmexample.hvm-dm XEN_CONFIGS += xmexample.pv-grub diff --git a/xen-xmexample.diff b/xen-xmexample.diff index a1f3361..f12723d 100644 --- a/xen-xmexample.diff +++ b/xen-xmexample.diff @@ -1,9 +1,9 @@ Change various example paths in the config files to match SUSE. -Index: xen-3.3.0-testing/tools/examples/xmexample1 +Index: xen-3.3.1-testing/tools/examples/xmexample1 =================================================================== ---- xen-3.3.0-testing.orig/tools/examples/xmexample1 -+++ xen-3.3.0-testing/tools/examples/xmexample1 +--- xen-3.3.1-testing.orig/tools/examples/xmexample1 ++++ xen-3.3.1-testing/tools/examples/xmexample1 @@ -7,11 +7,13 @@ #============================================================================ @@ -43,10 +43,10 @@ Index: xen-3.3.0-testing/tools/examples/xmexample1 #---------------------------------------------------------------------------- # Configure the behaviour when a domain exits. There are three 'reasons' -Index: xen-3.3.0-testing/tools/examples/xmexample2 +Index: xen-3.3.1-testing/tools/examples/xmexample2 =================================================================== ---- xen-3.3.0-testing.orig/tools/examples/xmexample2 -+++ xen-3.3.0-testing/tools/examples/xmexample2 +--- xen-3.3.1-testing.orig/tools/examples/xmexample2 ++++ xen-3.3.1-testing/tools/examples/xmexample2 @@ -35,11 +35,13 @@ xm_vars.var('vmid', xm_vars.check() @@ -86,10 +86,10 @@ Index: xen-3.3.0-testing/tools/examples/xmexample2 #---------------------------------------------------------------------------- # Configure the behaviour when a domain exits. There are three 'reasons' -Index: xen-3.3.0-testing/tools/examples/xmexample3 +Index: xen-3.3.1-testing/tools/examples/xmexample3 =================================================================== ---- xen-3.3.0-testing.orig/tools/examples/xmexample3 -+++ xen-3.3.0-testing/tools/examples/xmexample3 +--- xen-3.3.1-testing.orig/tools/examples/xmexample3 ++++ xen-3.3.1-testing/tools/examples/xmexample3 @@ -35,11 +35,13 @@ xm_vars.var('vmid', xm_vars.check() @@ -109,10 +109,10 @@ Index: xen-3.3.0-testing/tools/examples/xmexample3 # The domain build function. Default is 'linux'. #builder='linux' -Index: xen-3.3.0-testing/tools/examples/xmexample.hvm +Index: xen-3.3.1-testing/tools/examples/xmexample.hvm =================================================================== ---- xen-3.3.0-testing.orig/tools/examples/xmexample.hvm -+++ xen-3.3.0-testing/tools/examples/xmexample.hvm +--- xen-3.3.1-testing.orig/tools/examples/xmexample.hvm ++++ xen-3.3.1-testing/tools/examples/xmexample.hvm @@ -73,7 +73,7 @@ vif = [ 'type=ioemu, bridge=xenbr0' ] # and MODE is r for read-only, w for read-write. @@ -122,10 +122,10 @@ Index: xen-3.3.0-testing/tools/examples/xmexample.hvm #---------------------------------------------------------------------------- # Configure the behaviour when a domain exits. There are three 'reasons' -Index: xen-3.3.0-testing/docs/man/xmdomain.cfg.pod.5 +Index: xen-3.3.1-testing/docs/man/xmdomain.cfg.pod.5 =================================================================== ---- xen-3.3.0-testing.orig/docs/man/xmdomain.cfg.pod.5 -+++ xen-3.3.0-testing/docs/man/xmdomain.cfg.pod.5 +--- xen-3.3.1-testing.orig/docs/man/xmdomain.cfg.pod.5 ++++ xen-3.3.1-testing/docs/man/xmdomain.cfg.pod.5 @@ -38,13 +38,13 @@ file. The kernel image for the domain. The format of the parameter is the @@ -161,10 +161,10 @@ Index: xen-3.3.0-testing/docs/man/xmdomain.cfg.pod.5 at hda1, which is the root filesystem. =item I -Index: xen-3.3.0-testing/docs/man/xm.pod.1 +Index: xen-3.3.1-testing/docs/man/xm.pod.1 =================================================================== ---- xen-3.3.0-testing.orig/docs/man/xm.pod.1 -+++ xen-3.3.0-testing/docs/man/xm.pod.1 +--- xen-3.3.1-testing.orig/docs/man/xm.pod.1 ++++ xen-3.3.1-testing/docs/man/xm.pod.1 @@ -106,8 +106,8 @@ soon as it is run. =item I diff --git a/xen.changes b/xen.changes index 5456ac3..b706ce3 100644 --- a/xen.changes +++ b/xen.changes @@ -1,3 +1,26 @@ +------------------------------------------------------------------- +Wed Sep 24 15:44:43 MDT 2008 - carnold@novell.com + +- bnc#382401 - xm man page missing information for commands. + +------------------------------------------------------------------- +Wed Sep 17 14:57:29 MDT 2008 - carnold@novell.com + +- Pulled some upstream patches for Intel and AMD microcode fixes. + +------------------------------------------------------------------- +Tue Sep 16 10:51:44 MDT 2008 - carnold@novell.com + +- Update to changeset 18412. Contains several bug fixes including + a crash fix in qemu-dm and also various memory leaks fixes. + +------------------------------------------------------------------- +Mon Sep 15 10:48:35 MDT 2008 - carnold@novell.com + +- Fix parameters in call to kill_proc_info (pv drivers). +- Add conditional for use of smp_call_function so the pv drivers + can be built on older kernel versions. + ------------------------------------------------------------------- Thu Sep 11 12:42:05 MDT 2008 - brogers@novell.com diff --git a/xen.spec b/xen.spec index 3313eb6..f451929 100644 --- a/xen.spec +++ b/xen.spec @@ -1,5 +1,5 @@ # -# spec file for package xen (Version 3.3.1_18390_01) +# spec file for package xen (Version 3.3.1_18412_02) # # Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany. # @@ -21,7 +21,7 @@ Name: xen %define xvers 3.3 %define xvermaj 3 -%define changeset 18390 +%define changeset 18412 %define xen_build_dir xen-3.3.1-testing %if %sles_version %define with_kmp 1 @@ -40,7 +40,7 @@ BuildRequires: glibc-32bit glibc-devel-32bit %if %{?with_kmp}0 BuildRequires: kernel-source kernel-syms module-init-tools xorg-x11 %endif -Version: 3.3.1_18390_01 +Version: 3.3.1_18412_02 Release: 1 License: GPL v2 only Group: System/Kernel @@ -69,8 +69,21 @@ Source24: xenapiusers # sysconfig hook script for Xen Source25: xen-updown.sh # Upstream patches -Patch0: 18412-x86-page-type-preemptible.patch -Patch1: 18420-x86-page-type-preemptible-fix.patch +Patch0: 18406-constify-microcode.patch +Patch1: 18412-x86-page-type-preemptible.patch +Patch2: 18420-x86-page-type-preemptible-fix.patch +Patch3: 18428-poll-single-port.patch +Patch4: 18464-cpu-hotplug.patch +Patch5: 18471-cpu-hotplug.patch +Patch6: 18475-amd-microcode-update.patch +Patch7: 18481-amd-microcode-update-fix.patch +Patch8: 18483-intel-microcode-update.patch +Patch9: 18484-stubdom-ioemu-makefile.patch +Patch10: 18487-microcode-update-irq-context.patch +Patch11: 18488-microcode-free-fix.patch +Patch12: 18505-amd-powernow-fix.patch +Patch13: 18506-enforce-memory-limits.patch +Patch14: 18509-continue-hypercall-on-cpu.patch # Our patches Patch100: xen-config.diff Patch101: xend-config.diff @@ -116,6 +129,7 @@ Patch157: xen-api-auth.patch Patch158: xen-qemu-iscsi-fix.patch Patch159: xend-vif-fix.patch Patch160: tools-gdbserver-build.diff +Patch161: xm-man-update.diff # Patches for snapshot support Patch170: qemu-img-snapshot.patch Patch171: ioemu-blktap-fix-open.patch @@ -131,13 +145,13 @@ Patch184: ioemu-blktap-barriers.patch # Jim's domain lock patch Patch190: xend-domain-lock.patch # Patches from Jan -Patch240: poll-single-port.patch -Patch241: dump-exec-state.patch -Patch242: x86-show-page-walk-early.patch -Patch243: svm-lmsl.patch -Patch244: x86-extra-trap-info.patch -Patch245: x86-microcode.patch +Patch240: dump-exec-state.patch +Patch241: x86-show-page-walk-early.patch +Patch242: svm-lmsl.patch +Patch243: x86-extra-trap-info.patch +Patch244: x86-page-gnttab.patch Patch250: 32on64-extra-mem.patch +Patch251: msi-enable.patch # PV Driver Patches Patch350: pv-driver-build.patch Patch351: xen-ioemu-hvm-pv-support.diff @@ -480,6 +494,19 @@ Authors: %setup -q -n %xen_build_dir %patch0 -p1 %patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 +%patch10 -p1 +%patch11 -p1 +%patch12 -p1 +%patch13 -p1 +%patch14 -p1 %patch100 -p1 %patch101 -p1 %patch102 -p1 @@ -524,6 +551,7 @@ Authors: %patch158 -p1 %patch159 -p1 %patch160 -p1 +%patch161 -p1 %patch170 -p1 %patch171 -p1 %patch172 -p1 @@ -541,8 +569,8 @@ Authors: %patch242 -p1 %patch243 -p1 %patch244 -p1 -%patch245 -p1 %patch250 -p1 +%patch251 -p1 %patch350 -p1 %patch351 -p1 %patch352 -p1 @@ -897,6 +925,17 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/xen/bin/qemu-dm.debug /sbin/ldconfig %changelog +* Wed Sep 24 2008 carnold@novell.com +- bnc#382401 - xm man page missing information for commands. +* Wed Sep 17 2008 carnold@novell.com +- Pulled some upstream patches for Intel and AMD microcode fixes. +* Tue Sep 16 2008 carnold@novell.com +- Update to changeset 18412. Contains several bug fixes including + a crash fix in qemu-dm and also various memory leaks fixes. +* Mon Sep 15 2008 carnold@novell.com +- Fix parameters in call to kill_proc_info (pv drivers). +- Add conditional for use of smp_call_function so the pv drivers + can be built on older kernel versions. * Thu Sep 11 2008 brogers@novell.com - Added gdbserver-xen to the set of tools we build. fate#302942 diff --git a/xend-config.diff b/xend-config.diff index 54ae9c9..5afb622 100644 --- a/xend-config.diff +++ b/xend-config.diff @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/tools/examples/init.d/sysconfig.xendomains +Index: xen-3.3.1-testing/tools/examples/init.d/sysconfig.xendomains =================================================================== ---- xen-3.3.0-testing.orig/tools/examples/init.d/sysconfig.xendomains -+++ xen-3.3.0-testing/tools/examples/init.d/sysconfig.xendomains +--- xen-3.3.1-testing.orig/tools/examples/init.d/sysconfig.xendomains ++++ xen-3.3.1-testing/tools/examples/init.d/sysconfig.xendomains @@ -1,4 +1,4 @@ -## Path: System/xen +## Path: System/Virtualization @@ -27,10 +27,10 @@ Index: xen-3.3.0-testing/tools/examples/init.d/sysconfig.xendomains ## Type: integer ## Default: 300 -Index: xen-3.3.0-testing/tools/examples/xend-config.sxp +Index: xen-3.3.1-testing/tools/examples/xend-config.sxp =================================================================== ---- xen-3.3.0-testing.orig/tools/examples/xend-config.sxp -+++ xen-3.3.0-testing/tools/examples/xend-config.sxp +--- xen-3.3.1-testing.orig/tools/examples/xend-config.sxp ++++ xen-3.3.1-testing/tools/examples/xend-config.sxp @@ -54,11 +54,12 @@ diff --git a/xend-domain-lock.patch b/xend-domain-lock.patch index dd0d114..ca71cf3 100644 --- a/xend-domain-lock.patch +++ b/xend-domain-lock.patch @@ -93,7 +93,7 @@ Index: xen-3.3.1-testing/tools/examples/xend-config.sxp =================================================================== --- xen-3.3.1-testing.orig/tools/examples/xend-config.sxp +++ xen-3.3.1-testing/tools/examples/xend-config.sxp -@@ -250,4 +250,44 @@ +@@ -255,4 +255,44 @@ # Path where persistent domain configuration is stored. # Default is /var/lib/xend/domains/ diff --git a/xend-vif-fix.patch b/xend-vif-fix.patch index b5a588d..f6fcb02 100644 --- a/xend-vif-fix.patch +++ b/xend-vif-fix.patch @@ -1,7 +1,7 @@ -Index: xen-3.3.0-testing/tools/python/xen/xend/server/netif.py +Index: xen-3.3.1-testing/tools/python/xen/xend/server/netif.py =================================================================== ---- xen-3.3.0-testing.orig/tools/python/xen/xend/server/netif.py -+++ xen-3.3.0-testing/tools/python/xen/xend/server/netif.py +--- xen-3.3.1-testing.orig/tools/python/xen/xend/server/netif.py ++++ xen-3.3.1-testing/tools/python/xen/xend/server/netif.py @@ -101,6 +101,13 @@ class NetifController(DevController): def __init__(self, vm): DevController.__init__(self, vm) diff --git a/xm-man-update.diff b/xm-man-update.diff new file mode 100644 index 0000000..67b8358 --- /dev/null +++ b/xm-man-update.diff @@ -0,0 +1,460 @@ +diff -r ae29cd95ba7d docs/man/xm.pod.1 +--- a/docs/man/xm.pod.1 Mon Sep 22 15:33:42 2008 +0100 ++++ b/docs/man/xm.pod.1 Tue Sep 23 09:40:54 2008 -0600 +@@ -67,13 +67,12 @@ so running curses based interfaces over + so running curses based interfaces over the console B. Vi tends to get very odd when using it over this interface. + +-=item B [B<-c>] I [I=I].. ++=item B I [I] [I].. + +-The create sub command requires a config file and can optionally take a +-series of name value pairs that add to or override variables defined ++The create subcommand requires a config file and can optionally take a ++series of I that add to or override variables defined + in the config file. See L for full details of that file +-format, and possible options used in either the configfile or +-I=I combinations. ++format, and possible options used in either the configfile or for I. + + I can either be an absolute path to a file, or a relative + path to a file located in /etc/xen. +@@ -86,9 +85,65 @@ B + + =over 4 + +-=item B<-c> ++=item B<--help_config> + +-Attache console to the domain as soon as it has started. This is ++Print the available configuration variables I. These variables may be ++used on the command line or in the configuration file I. ++ ++=item B<-q>, B<--quiet> ++ ++No console output. ++ ++=item B<--path> ++ ++Search path for configuration scripts. The value of PATH is a ++colon-separated directory list. ++ ++=item B<-f=FILE>, B<--defconfig=FILE> ++ ++Use the given Python configuration script. The configuration ++script is loaded after arguments have been processed. Each ++command-line option sets a configuration variable named after ++its long option name, and these variables are placed in the ++environment of the script before it is loaded. Variables ++for options that may be repeated have list values. Other ++variables can be set using name=value on the command line. ++After the script is loaded, option values that were not set ++on the command line are replaced by the values set in the script. ++ ++=item B<-F=FILE>, B<--config=FILE> ++ ++Use the given SXP formated configuration script. ++SXP is the underlying configuration format used by Xen. ++SXP configuration scripts can be hand-written or generated ++from Python configuration scripts, using the -n ++(dryrun) option to print the configuration. An SXP formatted ++configuration file may also be generated for a given I by ++redirecting the output from the the B> ++to a file. ++ ++=item B<-n>, B<--dryrun> ++ ++Dry run - prints the resulting configuration in SXP ++but does not create the domain. ++ ++=item B<-x>, B<--xmldryrun> ++ ++XML dry run - prints the resulting configuration in ++XML but does not create the domain. ++ ++=item B<-s>, B<--skipdtd> ++ ++Skip DTD checking - skips checks on XML before ++creating. Experimental. Can decrease create time. ++ ++=item B<-p>, B<--paused> ++ ++Leave the domain paused after it is created. ++ ++=item B<-c>, B<--console_autoconnect> ++ ++Attach console to the domain as soon as it has started. This is + useful for determining issues with crashing domains. + + =back +@@ -118,6 +173,11 @@ virtual networking. (This example comes + + =back + ++=item B ++ ++Remove a domain from Xend domain management. The B command ++shows the domain names. ++ + =item B I + + Immediately terminate the domain I. This doesn't give the +@@ -133,6 +193,28 @@ Converts a domain name to a domain id us + + Converts a domain id to a domain name using xend's internal mapping. + ++=item B [I] I [I] ++ ++Dumps the virtual machine's memory for the specified domain to the ++I specified. The dump file will be written to a distribution ++specific directory for dump files. Such as: /var/lib/xen/dump or ++/var/xen/dump Defaults to dumping the core without pausing the domain ++if no I are specified. ++ ++B ++ ++=over 4 ++ ++=item B<-L>, B<--live> ++ ++Dump core without pausing the domain. ++ ++=item B<-C>, B<--crash> ++ ++Crash domain after dumping core. ++ ++=back ++ + =item B [B<--long>] + + Displays the short help message (i.e. common commands). +@@ -140,10 +222,35 @@ The B<--long> option prints out the comp + The B<--long> option prints out the complete set of B subcommands, + grouped by function. + +-=item B [B<--long> | B<--label>] [I ...] ++=item B [I] [I ...] + + Prints information about one or more domains. If no domains are + specified it prints out information about all domains. ++ ++ ++B ++ ++=over 4 ++ ++=item B<-l>, B<--long> ++ ++The output for B is not the table view shown below, but ++instead presents the data in SXP format. ++ ++=item B<--label> ++ ++Security labels are added to the output of xm list and the lines ++are sorted by the labels (ignoring case). ++See the ACCESS CONTROL SUBCOMMAND section of this man page for more ++information about labels. ++ ++=item B<--state=> ++ ++Output information for VMs in the specified state. ++ ++=back ++ ++B + + An example format for the list is as follows: + +@@ -164,10 +271,10 @@ Xen. + + B + +-=over 4 +- + The State field lists 6 states for a Xen domain, and which ones the + current domain is in. ++ ++=over 4 + + =item B + +@@ -204,32 +311,6 @@ FIXME: Is this right? + FIXME: Is this right? + + =back +- +-B +- +-=over 4 +- +-If B<--long> is specified, the output for B is not the table +-view shown above, but instead is an S-Expression representing all +-information known about all domains asked for. This is mostly only +-useful for external programs to parse the data. +- +-B There is no stable guarantees on the format of this data. +-Use at your own risk. +- +-=back +- +-B