- bnc#681302 - xm create -x <guest> returns "ImportError: No module

named ext"
  xm-create-xflag.patch

- Fix xen-utils to cope with xen-unstable c/s 21483

- xz-devel is available since 11.2, make it optional for SLES11SP1

- bnc#665610 - xm console > 1 to same VM messes up both consoles
  Upstream rejected due to portability concern, see
  http://lists.xensource.com/archives/html/xen-devel/2011-02/msg00942.html
  xenconsole-no-multiple-connections.patch
- Enable support for kernel decompression for gzip, bzip2, and LZMA
  so that kernels compressed with any of these methods can be
  launched.

- Update to Xen 4.1.0 c/s 22861

OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=102
This commit is contained in:
Charles Arnold 2011-03-21 16:47:37 +00:00 committed by Git OBS Bridge
parent 213dc42b7c
commit 05bedd5488
168 changed files with 1330 additions and 24685 deletions

View File

@ -1,55 +0,0 @@
# HG changeset patch
# User jfehlig@localhost
# Date 1293498049 25200
# Node ID 7584dc7bc3de64340f193a0cab188e85bd50d594
# Parent f9ce5858f7eae84bec34aa10d3585c7e6f6ca6c9
Revert 20158:f9ce5858f7ea xend: Support "bootloader" mode for "drbd:" devices
block-drbd (provided by drbd project) handles all the details that
c/s 20158 introduces within xend. Subtleties of configuring storage
subsystems should not be handled by xend, but instead delegated to the block
script mechansim provided by the xen toool stack.
Note: Patch submitted upstream but not (yet) accepted since xend is on
the way out.
http://lists.xensource.com/archives/html/xen-devel/2010-12/msg01160.html
Index: xen-4.0.2-testing/tools/python/xen/util/blkif.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/util/blkif.py
+++ xen-4.0.2-testing/tools/python/xen/util/blkif.py
@@ -79,13 +79,6 @@ def parse_uname(uname):
if typ == "phy" and not fn.startswith("/"):
fn = "/dev/%s" %(fn,)
- if typ == "drbd":
- if not fn.startswith("drbd"):
- (drbdadmstdin, drbdadmstdout) = os.popen2("/sbin/drbdadm "+"sh-dev "+fn)
- fn = drbdadmstdout.readline().strip()
- else:
- fn = "/dev/%s" %(fn,)
-
if typ in ("tap", "tap2"):
(taptype, fn) = fn.split(":", 1)
if taptype in ("tapdisk", "ioemu"):
Index: xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -3283,15 +3283,6 @@ class XendDomainInfo:
(fn, types) = parse_uname(disk)
- # If this is a drbd volume, check if we need to activate it
- if disk.find(":") != -1:
- (disktype, diskname) = disk.split(':', 1)
- if disktype == 'drbd':
- (drbdadmstdin, drbdadmstdout) = os.popen2(["/sbin/drbdadm", "state", diskname])
- (state, junk) = drbdadmstdout.readline().split('/', 1)
- if state == 'Secondary':
- os.system('/sbin/drbdadm primary ' + diskname)
-
mounted_vbd_uuid = 0
def _shouldMount(types):
if types[0] in ('file', 'phy'):

View File

@ -1,110 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1270026749 -3600
# Node ID 4f796e29987c0db1579787fe0b7d3d5af00963ea
# Parent 589d075ba2953123c1b39ecdbc190689ac6f443c
x86: start PCI IRQs Xen uses from Dom0-invoked io_apic_set_pci_routing()
When using a serial port from an add-in PCI card, and that IRQ is (as
usual) outside of the legacy range (0...15), Xen would never really
enable the IRQ, as at the time setup_irq() runs the handler for the
IRQ still is &no_irq_type. Consequently, once the trigger mode and
polarity of the interrupt become known to Xen, it should start such
IRQ(s) it uses for itself.
The question is whether the same should also be done in
ioapic_guest_write(): Legacy kernels don't use PHYSDEVOP_setup_gsi
(and hence don't trigger the code path modified).
Note however that even when a kernel is using PHYSDEVOP_setup_gsi in
the way the pv-ops kernel currently does, there's still no guarantee
that the call would ever be issued for IRQs Xen may be using, since
this happens only when devices get enabled. For Xen's purposes, this
function should be called for *all* device IRQs, regardless of
whether those would actually be (attempted to be) used by the kernel,
i.e. in a subsys_initcall() from drivers/acpi/pci_irq.c iterating
over all PCI devices and doing mostly what acpi_pci_irq_enable() does
except for calling this function in place of acpi_register_gsi(). The
downside of this approach is that without extra filtering in Xen
(based on a hint from Dom0), vectors will then get up even for IRQs
that are unused by both hypervisor and kernel.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1271090214 -3600
# Node ID 7eeb131880b20a33e7675cc1726ae312a489be2d
# Parent b65a41dc6c6a2e2341ae778d8386a08d502bbfa4
Fix bug in 21089:4f796e29987c
Signed-off-by: Jan Beulich <jbeulich@novell.com>
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1271169507 -3600
# Node ID 0bebb5fa4f051df9b4fed4d11a723fae91bc7523
# Parent 859a372efa66e6bcba8e1fd968e521cb16da12ea
Make c/s 21089 work again with c/s 21092
Unfortunately the latter c/s' change to mpparse.c yielded the former
patch non-functional - Xen's serial port IRQ is not in IQR_DISABLED
state, yet must be allowed to get its trigger mode and polarity set
up in order for it to be usable.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-4.0.2-testing/xen/arch/x86/io_apic.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/io_apic.c
+++ xen-4.0.2-testing/xen/arch/x86/io_apic.c
@@ -2232,6 +2232,7 @@ int __init io_apic_get_redir_entries (in
int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int active_high_low)
{
+ struct irq_desc *desc = irq_to_desc(irq);
struct IO_APIC_route_entry entry;
unsigned long flags;
int vector;
@@ -2283,7 +2284,12 @@ int io_apic_set_pci_routing (int ioapic,
io_apic_write(ioapic, 0x11+2*pin, *(((int *)&entry)+1));
io_apic_write(ioapic, 0x10+2*pin, *(((int *)&entry)+0));
set_native_irq_info(irq, TARGET_CPUS);
- spin_unlock_irqrestore(&ioapic_lock, flags);
+ spin_unlock(&ioapic_lock);
+
+ spin_lock(&desc->lock);
+ if (!(desc->status & (IRQ_DISABLED | IRQ_GUEST)))
+ desc->handler->startup(irq);
+ spin_unlock_irqrestore(&desc->lock, flags);
return 0;
}
Index: xen-4.0.2-testing/xen/arch/x86/mpparse.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/mpparse.c
+++ xen-4.0.2-testing/xen/arch/x86/mpparse.c
@@ -1102,6 +1102,8 @@ int mp_register_gsi (u32 gsi, int trigge
int ioapic = -1;
int ioapic_pin = 0;
int idx, bit = 0;
+ struct irq_desc * desc;
+ unsigned long flags;
/*
* Mapping between Global System Interrups, which
@@ -1123,8 +1125,13 @@ int mp_register_gsi (u32 gsi, int trigge
ioapic_pin = gsi - mp_ioapic_routing[ioapic].gsi_base;
- if (!(irq_to_desc(gsi)->status & IRQ_DISABLED))
+ desc = irq_to_desc(gsi);
+ spin_lock_irqsave(&desc->lock, flags);
+ if (!(desc->status & IRQ_DISABLED) && desc->handler != &no_irq_type) {
+ spin_unlock_irqrestore(&desc->lock, flags);
return -EEXIST;
+ }
+ spin_unlock_irqrestore(&desc->lock, flags);
/*
* Avoid pin reprogramming. PRTs typically include entries

View File

@ -1,181 +0,0 @@
References: bnc#585371
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1272280332 -3600
# Node ID 3ce824963dc41827bdf1617b37a40e5e5e9dce29
# Parent d01ea51fc929c57c7d5f427e1aafa0de7a436473
Support Linux's advanced crashkernel= syntax
Quoting the original Linux patch's description:
"This patch adds a extended crashkernel syntax that makes the value of
reserved system RAM dependent on the system RAM itself:
crashkernel=<range1>:<size1>[,<range2>:<size2>,...][@offset]
range=start-[end]
For example:
crashkernel=512M-2G:64M,2G-:128M
The motivation comes from distributors that configure their
crashkernel command line automatically with some configuration tool
(YaST, you know ;)). Of course that tool knows the value of System
RAM, but if the user removes RAM, then the system becomes unbootable
or at least unusable and error handling is very difficult."
For x86, other than Linux we pass the actual amount of RAM rather than
the highest page's address (to cope with sparse physical address
maps).
This still needs to be hooked up for ia64.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-4.0.2-testing/xen/arch/x86/setup.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/setup.c
+++ xen-4.0.2-testing/xen/arch/x86/setup.c
@@ -664,6 +664,11 @@ void __init __start_xen(unsigned long mb
memcpy(&boot_e820, &e820, sizeof(e820));
/* Early kexec reservation (explicit static start address). */
+ nr_pages = 0;
+ for ( i = 0; i < e820.nr_map; i++ )
+ if ( e820.map[i].type == E820_RAM )
+ nr_pages += e820.map[i].size >> PAGE_SHIFT;
+ set_kexec_crash_area_size((u64)nr_pages << PAGE_SHIFT);
kexec_reserve_area(&boot_e820);
/*
Index: xen-4.0.2-testing/xen/common/kexec.c
===================================================================
--- xen-4.0.2-testing.orig/xen/common/kexec.c
+++ xen-4.0.2-testing/xen/common/kexec.c
@@ -49,15 +49,109 @@ static unsigned char vmcoreinfo_data[VMC
static size_t vmcoreinfo_size = 0;
xen_kexec_reserve_t kexec_crash_area;
+static struct {
+ u64 start, end;
+ unsigned long size;
+} ranges[16] __initdata;
+/*
+ * Parse command lines in the format
+ *
+ * crashkernel=<ramsize-range>:<size>[,...][@<offset>]
+ *
+ * with <ramsize-range> being of form
+ *
+ * <start>-[<end>]
+ *
+ * as well as the legacy ones in the format
+ *
+ * crashkernel=<size>[@<offset>]
+ */
static void __init parse_crashkernel(const char *str)
{
- kexec_crash_area.size = parse_size_and_unit(str, &str);
- if ( *str == '@' )
- kexec_crash_area.start = parse_size_and_unit(str+1, NULL);
+ const char *cur;
+
+ if ( strchr(str, ':' ) )
+ {
+ unsigned int idx = 0;
+
+ do {
+ if ( idx >= ARRAY_SIZE(ranges) )
+ {
+ printk(XENLOG_WARNING "crashkernel: too many ranges\n");
+ cur = NULL;
+ str = strchr(str, '@');
+ break;
+ }
+
+ ranges[idx].start = parse_size_and_unit(cur = str + !!idx, &str);
+ if ( cur == str )
+ break;
+
+ if ( *str != '-' )
+ {
+ printk(XENLOG_WARNING "crashkernel: '-' expected\n");
+ break;
+ }
+
+ if ( *++str != ':' )
+ {
+ ranges[idx].end = parse_size_and_unit(cur = str, &str);
+ if ( cur == str )
+ break;
+ if ( ranges[idx].end <= ranges[idx].start )
+ {
+ printk(XENLOG_WARNING "crashkernel: end <= start\n");
+ break;
+ }
+ }
+ else
+ ranges[idx].end = -1;
+
+ if ( *str != ':' )
+ {
+ printk(XENLOG_WARNING "crashkernel: ':' expected\n");
+ break;
+ }
+
+ ranges[idx].size = parse_size_and_unit(cur = str + 1, &str);
+ if ( cur == str )
+ break;
+
+ ++idx;
+ } while ( *str == ',' );
+ if ( idx < ARRAY_SIZE(ranges) )
+ ranges[idx].size = 0;
+ }
+ else
+ kexec_crash_area.size = parse_size_and_unit(cur = str, &str);
+ if ( cur != str && *str == '@' )
+ kexec_crash_area.start = parse_size_and_unit(cur = str + 1, &str);
+ if ( cur == str )
+ printk(XENLOG_WARNING "crashkernel: memory value expected\n");
}
custom_param("crashkernel", parse_crashkernel);
+void __init set_kexec_crash_area_size(u64 system_ram)
+{
+ unsigned int idx;
+
+ for ( idx = 0; idx < ARRAY_SIZE(ranges) && !kexec_crash_area.size; ++idx )
+ {
+ if ( !ranges[idx].size )
+ break;
+
+ if ( ranges[idx].size >= system_ram )
+ {
+ printk(XENLOG_WARNING "crashkernel: invalid size\n");
+ continue;
+ }
+
+ if ( ranges[idx].start <= system_ram && ranges[idx].end > system_ram )
+ kexec_crash_area.size = ranges[idx].size;
+ }
+}
+
static void one_cpu_only(void)
{
/* Only allow the first cpu to continue - force other cpus to spin */
Index: xen-4.0.2-testing/xen/include/xen/kexec.h
===================================================================
--- xen-4.0.2-testing.orig/xen/include/xen/kexec.h
+++ xen-4.0.2-testing/xen/include/xen/kexec.h
@@ -12,6 +12,8 @@ typedef struct xen_kexec_reserve {
extern xen_kexec_reserve_t kexec_crash_area;
+void set_kexec_crash_area_size(u64 system_ram);
+
/* We have space for 4 images to support atomic update
* of images. This is important for CRASH images since
* a panic can happen at any time...

View File

@ -1,69 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1272973271 -3600
# Node ID 6c7b905b03ff1cf171187bafe7129e3e213e5787
# Parent bd52f2e040e5a5ca58e956b3d0780a86934a429e
x86: add support for domain-initiated global cache flush
Newer Linux' AGP code wants to flush caches on all CPUs under certain
circumstances. Since doing this on all vCPU-s of the domain in
question doesn't yield the intended effect, this needs to be done in
the hypervisor. Add a new MMUEXT operation for this.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-4.0.2-testing/xen/arch/x86/mm.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/mm.c
+++ xen-4.0.2-testing/xen/arch/x86/mm.c
@@ -2889,6 +2889,27 @@ int do_mmuext_op(
}
break;
+ case MMUEXT_FLUSH_CACHE_GLOBAL:
+ if ( unlikely(foreigndom != DOMID_SELF) )
+ okay = 0;
+ else if ( likely(cache_flush_permitted(d)) )
+ {
+ unsigned int cpu;
+ cpumask_t mask = CPU_MASK_NONE;
+
+ for_each_online_cpu(cpu)
+ if ( !cpus_intersects(mask,
+ per_cpu(cpu_sibling_map, cpu)) )
+ cpu_set(cpu, mask);
+ flush_mask(&mask, FLUSH_CACHE);
+ }
+ else
+ {
+ MEM_LOG("Non-physdev domain tried to FLUSH_CACHE_GLOBAL");
+ okay = 0;
+ }
+ break;
+
case MMUEXT_SET_LDT:
{
unsigned long ptr = op.arg1.linear_addr;
Index: xen-4.0.2-testing/xen/include/public/xen.h
===================================================================
--- xen-4.0.2-testing.orig/xen/include/public/xen.h
+++ xen-4.0.2-testing/xen/include/public/xen.h
@@ -239,6 +239,10 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
*
* cmd: MMUEXT_FLUSH_CACHE
* No additional arguments. Writes back and flushes cache contents.
+ *
+ * cmd: MMUEXT_FLUSH_CACHE_GLOBAL
+ * No additional arguments. Writes back and flushes cache contents
+ * on all CPUs in the system.
*
* cmd: MMUEXT_SET_LDT
* linear_addr: Linear address of LDT base (NB. must be page-aligned).
@@ -268,6 +272,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
#define MMUEXT_NEW_USER_BASEPTR 15
#define MMUEXT_CLEAR_PAGE 16
#define MMUEXT_COPY_PAGE 17
+#define MMUEXT_FLUSH_CACHE_GLOBAL 18
#ifndef __ASSEMBLY__
struct mmuext_op {

View File

@ -1,100 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1273142634 -3600
# Node ID 69c85f5b0a07e7a95945d117ea478a80d21c6b9e
# Parent 26da9bb87405c64c02def8d5f11c66f15847bd02
svm: support EFER.LMSLE for guests
Now that the feature is officially documented (see
http://support.amd.com/us/Processor_TechDocs/24593.pdf), I think it
makes sense to also allow HVM guests to make use of it.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-4.0.2-testing/xen/arch/x86/hvm/hvm.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/hvm/hvm.c
+++ xen-4.0.2-testing/xen/arch/x86/hvm/hvm.c
@@ -603,11 +603,12 @@ static int hvm_load_cpu_ctxt(struct doma
return -EINVAL;
}
- if ( (ctxt.msr_efer & ~(EFER_FFXSE | EFER_LME | EFER_LMA |
+ if ( (ctxt.msr_efer & ~(EFER_FFXSE | EFER_LMSLE | EFER_LME | EFER_LMA |
EFER_NX | EFER_SCE)) ||
((sizeof(long) != 8) && (ctxt.msr_efer & EFER_LME)) ||
(!cpu_has_nx && (ctxt.msr_efer & EFER_NX)) ||
(!cpu_has_syscall && (ctxt.msr_efer & EFER_SCE)) ||
+ (!cpu_has_lmsl && (ctxt.msr_efer & EFER_LMSLE)) ||
(!cpu_has_ffxsr && (ctxt.msr_efer & EFER_FFXSE)) ||
((ctxt.msr_efer & (EFER_LME|EFER_LMA)) == EFER_LMA) )
{
@@ -960,10 +961,11 @@ int hvm_set_efer(uint64_t value)
value &= ~EFER_LMA;
- if ( (value & ~(EFER_FFXSE | EFER_LME | EFER_NX | EFER_SCE)) ||
+ if ( (value & ~(EFER_FFXSE | EFER_LMSLE | EFER_LME | EFER_NX | EFER_SCE)) ||
((sizeof(long) != 8) && (value & EFER_LME)) ||
(!cpu_has_nx && (value & EFER_NX)) ||
(!cpu_has_syscall && (value & EFER_SCE)) ||
+ (!cpu_has_lmsl && (value & EFER_LMSLE)) ||
(!cpu_has_ffxsr && (value & EFER_FFXSE)) )
{
gdprintk(XENLOG_WARNING, "Trying to set reserved bit in "
Index: xen-4.0.2-testing/xen/arch/x86/hvm/svm/svm.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/hvm/svm/svm.c
+++ xen-4.0.2-testing/xen/arch/x86/hvm/svm/svm.c
@@ -57,6 +57,9 @@
u32 svm_feature_flags;
+/* Indicates whether guests may use EFER.LMSLE. */
+bool_t cpu_has_lmsl;
+
#define set_segment_register(name, value) \
asm volatile ( "movw %%ax ,%%" STR(name) "" : : "a" (value) )
@@ -864,6 +867,29 @@ static int svm_cpu_up(struct cpuinfo_x86
/* Initialize core's ASID handling. */
svm_asid_init(c);
+#ifdef __x86_64__
+ /*
+ * Check whether EFER.LMSLE can be written.
+ * Unfortunately there's no feature bit defined for this.
+ */
+ eax = read_efer();
+ edx = read_efer() >> 32;
+ if ( wrmsr_safe(MSR_EFER, eax | EFER_LMSLE, edx) == 0 )
+ rdmsr(MSR_EFER, eax, edx);
+ if ( eax & EFER_LMSLE )
+ {
+ if ( c == &boot_cpu_data )
+ cpu_has_lmsl = 1;
+ wrmsr(MSR_EFER, eax ^ EFER_LMSLE, edx);
+ }
+ else
+ {
+ if ( cpu_has_lmsl )
+ printk(XENLOG_WARNING "Inconsistent LMLSE support across CPUs!\n");
+ cpu_has_lmsl = 0;
+ }
+#endif
+
return 1;
}
Index: xen-4.0.2-testing/xen/include/asm-x86/hvm/hvm.h
===================================================================
--- xen-4.0.2-testing.orig/xen/include/asm-x86/hvm/hvm.h
+++ xen-4.0.2-testing/xen/include/asm-x86/hvm/hvm.h
@@ -143,6 +143,7 @@ struct hvm_function_table {
extern struct hvm_function_table hvm_funcs;
extern int hvm_enabled;
+extern bool_t cpu_has_lmsl;
int hvm_domain_initialise(struct domain *d);
void hvm_domain_relinquish_resources(struct domain *d);

View File

@ -1,99 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1273143595 -3600
# Node ID ccae861f52f7f25aa2ab404a6110831402845dac
# Parent 924f54145fda26df64bf6f57010793893b29866f
Reduce '0' debug key's global impact
On large systems, dumping state may cause time management to get
stalled for so long a period that it wouldn't recover. Therefore add
a tasklet-based alternative mechanism to handle Dom0 state dumps.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-4.0.2-testing/xen/common/keyhandler.c
===================================================================
--- xen-4.0.2-testing.orig/xen/common/keyhandler.c
+++ xen-4.0.2-testing/xen/common/keyhandler.c
@@ -19,6 +19,7 @@
static struct keyhandler *key_table[256];
static unsigned char keypress_key;
+static bool_t alt_key_handling;
char keyhandler_scratch[1024];
@@ -115,6 +116,26 @@ static struct keyhandler dump_registers_
.desc = "dump registers"
};
+static DECLARE_TASKLET(dump_dom0_tasklet, NULL, 0);
+
+static void dump_dom0_action(unsigned long arg)
+{
+ struct vcpu *v = (void *)arg;
+
+ for ( ; ; )
+ {
+ vcpu_show_execution_state(v);
+ if ( (v = v->next_in_list) == NULL )
+ break;
+ if ( softirq_pending(smp_processor_id()) )
+ {
+ dump_dom0_tasklet.data = (unsigned long)v;
+ tasklet_schedule_on_cpu(&dump_dom0_tasklet, v->processor);
+ break;
+ }
+ }
+}
+
static void dump_dom0_registers(unsigned char key)
{
struct vcpu *v;
@@ -125,7 +146,17 @@ static void dump_dom0_registers(unsigned
printk("'%c' pressed -> dumping Dom0's registers\n", key);
for_each_vcpu ( dom0, v )
+ {
+ if ( alt_key_handling && softirq_pending(smp_processor_id()) )
+ {
+ tasklet_kill(&dump_dom0_tasklet);
+ tasklet_init(&dump_dom0_tasklet, dump_dom0_action,
+ (unsigned long)v);
+ tasklet_schedule_on_cpu(&dump_dom0_tasklet, v->processor);
+ return;
+ }
vcpu_show_execution_state(v);
+ }
}
static struct keyhandler dump_dom0_registers_keyhandler = {
@@ -439,8 +470,28 @@ static struct keyhandler do_debug_key_ke
.desc = "trap to xendbg"
};
+static void do_toggle_alt_key(unsigned char key, struct cpu_user_regs *regs)
+{
+ alt_key_handling = !alt_key_handling;
+ printk("'%c' pressed -> using %s key handling\n", key,
+ alt_key_handling ? "alternative" : "normal");
+}
+
+static struct keyhandler toggle_alt_keyhandler = {
+ .irq_callback = 1,
+ .u.irq_fn = do_toggle_alt_key,
+ .desc = "toggle alternative key handling"
+};
+
void __init initialize_keytable(void)
{
+ if ( num_present_cpus() > 16 )
+ {
+ alt_key_handling = 1;
+ printk(XENLOG_INFO "Defaulting to alternative key handling; "
+ "send 'A' to switch to normal mode.\n");
+ }
+ register_keyhandler('A', &toggle_alt_keyhandler);
register_keyhandler('d', &dump_registers_keyhandler);
register_keyhandler('h', &show_handlers_keyhandler);
register_keyhandler('q', &dump_domains_keyhandler);

View File

@ -1,27 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1274118689 -3600
# Node ID 2a16128f17d884b87124eb159d4c4a0c34339d4e
# Parent 89a2f9ad02f23c24a06274a1217991181f19930b
x86: Quieten microcode.c during CPU hotplug
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Index: xen-4.0.2-testing/xen/arch/x86/microcode.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/microcode.c
+++ xen-4.0.2-testing/xen/arch/x86/microcode.c
@@ -66,12 +66,10 @@ static void microcode_fini_cpu(int cpu)
int microcode_resume_cpu(int cpu)
{
- int err = 0;
+ int err;
struct ucode_cpu_info *uci = &per_cpu(ucode_cpu_info, cpu);
struct cpu_signature nsig;
- gdprintk(XENLOG_INFO, "microcode: CPU%d resumed\n", cpu);
-
if ( !uci->mc.mc_valid )
return -EIO;

View File

@ -1,144 +0,0 @@
References: bnc#573413
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1274253726 -3600
# Node ID f67ae6f9d4107f091d062fc1501a96f873671d10
# Parent eb4ecc037b7a53647f0ac89c7067d11ea622ab00
VT-d: Fix ATS enabling for device assignment
Currently, Xen only enables ATS in Xen booting. When an ATS capable
device is assigned to guest, ATS is actually not enabled because FLR
before assignment causes it to be disabled. Thus ATS cannot be used in
guest. This patch enables ATS in domain_context_mapping. This ensures
ATS is enabled in assignment because FLR is earlier than
domain_context_mapping call. Therefore ATS can be used in guest. This
patch also implements disable_ats_device to disable ATS when the
device is deassigned from a domain.
Signed-off-by: Weidong Han <weidong.han@intel.com>
Index: xen-4.0.2-testing/xen/drivers/passthrough/vtd/ia64/ats.c
===================================================================
--- xen-4.0.2-testing.orig/xen/drivers/passthrough/vtd/ia64/ats.c
+++ xen-4.0.2-testing/xen/drivers/passthrough/vtd/ia64/ats.c
@@ -47,6 +47,11 @@ int enable_ats_device(int seg, int bus,
return 0;
}
+int disable_ats_device(int seg, int bus, int devfn)
+{
+ return 0;
+}
+
int dev_invalidate_iotlb(struct iommu *iommu, u16 did,
u64 addr, unsigned int size_order, u64 type)
{
Index: xen-4.0.2-testing/xen/drivers/passthrough/vtd/iommu.c
===================================================================
--- xen-4.0.2-testing.orig/xen/drivers/passthrough/vtd/iommu.c
+++ xen-4.0.2-testing/xen/drivers/passthrough/vtd/iommu.c
@@ -1354,6 +1354,9 @@ static int domain_context_mapping(struct
dprintk(VTDPREFIX, "d%d:PCIe: map bdf = %x:%x.%x\n",
domain->domain_id, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
ret = domain_context_mapping_one(domain, drhd->iommu, bus, devfn);
+ if ( !ret && ats_device(0, bus, devfn) )
+ enable_ats_device(0, bus, devfn);
+
break;
case DEV_TYPE_PCI:
@@ -1476,6 +1479,9 @@ static int domain_context_unmap(struct d
dprintk(VTDPREFIX, "d%d:PCIe: unmap bdf = %x:%x.%x\n",
domain->domain_id, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
ret = domain_context_unmap_one(domain, iommu, bus, devfn);
+ if ( !ret && ats_device(0, bus, devfn) )
+ disable_ats_device(0, bus, devfn);
+
break;
case DEV_TYPE_PCI:
@@ -1805,8 +1811,6 @@ static void setup_dom0_devices(struct do
list_add(&pdev->domain_list, &d->arch.pdev_list);
domain_context_mapping(d, pdev->bus, pdev->devfn);
pci_enable_acs(pdev);
- if ( ats_device(0, pdev->bus, pdev->devfn) )
- enable_ats_device(0, pdev->bus, pdev->devfn);
}
}
spin_unlock(&pcidevs_lock);
Index: xen-4.0.2-testing/xen/drivers/passthrough/vtd/x86/ats.c
===================================================================
--- xen-4.0.2-testing.orig/xen/drivers/passthrough/vtd/x86/ats.c
+++ xen-4.0.2-testing/xen/drivers/passthrough/vtd/x86/ats.c
@@ -92,6 +92,9 @@ int ats_device(int seg, int bus, int dev
pdev = pci_get_pdev(bus, devfn);
drhd = acpi_find_matched_drhd_unit(pdev);
+ if ( !drhd )
+ return 0;
+
if ( !ecap_queued_inval(drhd->iommu->ecap) ||
!ecap_dev_iotlb(drhd->iommu->ecap) )
return 0;
@@ -144,6 +147,9 @@ int enable_ats_device(int seg, int bus,
value = pci_conf_read16(bus, PCI_SLOT(devfn),
PCI_FUNC(devfn), pos + ATS_REG_CTL);
+ if ( value & ATS_ENABLE )
+ return 0;
+
value |= ATS_ENABLE;
pci_conf_write16(bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
pos + ATS_REG_CTL, value);
@@ -153,10 +159,50 @@ int enable_ats_device(int seg, int bus,
pdev->devfn = devfn;
pdev->ats_queue_depth = queue_depth;
list_add(&(pdev->list), &ats_devices);
+ if ( iommu_verbose )
+ dprintk(XENLOG_INFO VTDPREFIX, "%x:%x.%x: ATS is enabled\n",
+ bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
return pos;
}
+int disable_ats_device(int seg, int bus, int devfn)
+{
+ struct list_head *pdev_list, *tmp;
+ struct pci_ats_dev *pdev;
+ u32 value;
+ int pos;
+
+ pos = pci_find_ext_capability(seg, bus, devfn, PCI_EXT_CAP_ID_ATS);
+ if ( !pos )
+ return 0;
+
+ /* BUGBUG: add back seg when multi-seg platform support is enabled */
+ value = pci_conf_read16(bus, PCI_SLOT(devfn),
+ PCI_FUNC(devfn), pos + ATS_REG_CTL);
+ value &= ~ATS_ENABLE;
+ pci_conf_write16(bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
+ pos + ATS_REG_CTL, value);
+
+ list_for_each_safe( pdev_list, tmp, &ats_devices )
+ {
+ pdev = list_entry(pdev_list, struct pci_ats_dev, list);
+ if ( pdev->bus == bus && pdev->devfn == devfn )
+ {
+ list_del(&pdev->list);
+ xfree(pdev);
+ break;
+ }
+ }
+
+ if ( iommu_verbose )
+ dprintk(XENLOG_INFO VTDPREFIX, "%x:%x.%x: ATS is disabled\n",
+ bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+
+ return 0;
+}
+
+
static int device_in_domain(struct iommu *iommu, struct pci_ats_dev *pdev, u16 did)
{
struct root_entry *root_entry = NULL;

View File

@ -1,230 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1275643111 -3600
# Node ID 48e2b07cf01c044bf483bd7fa5408a6f9801416b
# Parent f2b1924f20281bc42fa3532c7d82b3ee0700aff4
Intel: Add CPUID feature mask support for NHM processors.
Signed-off-by: Jun Nakajima <jun.nakajima@intel.com>
Signed-off-by: Liping Ke <liping.ke@intel.com>
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1276604335 -3600
# Node ID 2501732e291b001711a0dc1c474bb89ce77f3110
# Parent a2cc1db1af9c8f9b148c80f8b2c3f64bde7542f9
x86: fix pv cpuid masking
Invert initial values of the variables parsed into from the command
line, so that completely clearing out one or more of the four bit
fields is possible.
Further, consolidate the command line parameter specifications into
a single place.
Finally, as per "Intel Virtualization Technology FlexMigration
Application Note" (http://www.intel.com/Assets/PDF/manual/323850.pdf),
also handle family 6 model 0x1f.
What remains open is the question whether pv_cpuid() shouldn't also
consume these masks.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-4.0.2-testing/xen/arch/x86/cpu/amd.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/cpu/amd.c
+++ xen-4.0.2-testing/xen/arch/x86/cpu/amd.c
@@ -33,14 +33,6 @@ void start_svm(struct cpuinfo_x86 *c);
static char opt_famrev[14];
string_param("cpuid_mask_cpu", opt_famrev);
-/* Finer-grained CPUID feature control. */
-static unsigned int opt_cpuid_mask_ecx, opt_cpuid_mask_edx;
-integer_param("cpuid_mask_ecx", opt_cpuid_mask_ecx);
-integer_param("cpuid_mask_edx", opt_cpuid_mask_edx);
-static unsigned int opt_cpuid_mask_ext_ecx, opt_cpuid_mask_ext_edx;
-integer_param("cpuid_mask_ext_ecx", opt_cpuid_mask_ext_ecx);
-integer_param("cpuid_mask_ext_edx", opt_cpuid_mask_ext_edx);
-
static inline void wrmsr_amd(unsigned int index, unsigned int lo,
unsigned int hi)
{
@@ -102,7 +94,7 @@ static inline int wrmsr_amd_safe(unsigne
*
* The processor revision string parameter has precedene.
*/
-static void __devinit set_cpuidmask(struct cpuinfo_x86 *c)
+static void __devinit set_cpuidmask(const struct cpuinfo_x86 *c)
{
static unsigned int feat_ecx, feat_edx;
static unsigned int extfeat_ecx, extfeat_edx;
@@ -117,12 +109,12 @@ static void __devinit set_cpuidmask(stru
ASSERT((status == not_parsed) && (smp_processor_id() == 0));
status = no_mask;
- if (opt_cpuid_mask_ecx | opt_cpuid_mask_edx |
- opt_cpuid_mask_ext_ecx | opt_cpuid_mask_ext_edx) {
- feat_ecx = opt_cpuid_mask_ecx ? : ~0U;
- feat_edx = opt_cpuid_mask_edx ? : ~0U;
- extfeat_ecx = opt_cpuid_mask_ext_ecx ? : ~0U;
- extfeat_edx = opt_cpuid_mask_ext_edx ? : ~0U;
+ if (~(opt_cpuid_mask_ecx & opt_cpuid_mask_edx &
+ opt_cpuid_mask_ext_ecx & opt_cpuid_mask_ext_edx)) {
+ feat_ecx = opt_cpuid_mask_ecx;
+ feat_edx = opt_cpuid_mask_edx;
+ extfeat_ecx = opt_cpuid_mask_ext_ecx;
+ extfeat_edx = opt_cpuid_mask_ext_edx;
} else if (*opt_famrev == '\0') {
return;
} else if (!strcmp(opt_famrev, "fam_0f_rev_c")) {
Index: xen-4.0.2-testing/xen/arch/x86/cpu/common.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/cpu/common.c
+++ xen-4.0.2-testing/xen/arch/x86/cpu/common.c
@@ -22,6 +22,15 @@ static int cachesize_override __cpuinitd
static int disable_x86_fxsr __cpuinitdata;
static int disable_x86_serial_nr __cpuinitdata;
+unsigned int __devinitdata opt_cpuid_mask_ecx = ~0u;
+integer_param("cpuid_mask_ecx", opt_cpuid_mask_ecx);
+unsigned int __devinitdata opt_cpuid_mask_edx = ~0u;
+integer_param("cpuid_mask_edx", opt_cpuid_mask_edx);
+unsigned int __devinitdata opt_cpuid_mask_ext_ecx = ~0u;
+integer_param("cpuid_mask_ext_ecx", opt_cpuid_mask_ext_ecx);
+unsigned int __devinitdata opt_cpuid_mask_ext_edx = ~0u;
+integer_param("cpuid_mask_ext_edx", opt_cpuid_mask_ext_edx);
+
struct cpu_dev * cpu_devs[X86_VENDOR_NUM] = {};
/*
Index: xen-4.0.2-testing/xen/arch/x86/cpu/cpu.h
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/cpu/cpu.h
+++ xen-4.0.2-testing/xen/arch/x86/cpu/cpu.h
@@ -21,6 +21,9 @@ struct cpu_dev {
extern struct cpu_dev * cpu_devs [X86_VENDOR_NUM];
+extern unsigned int opt_cpuid_mask_ecx, opt_cpuid_mask_edx;
+extern unsigned int opt_cpuid_mask_ext_ecx, opt_cpuid_mask_ext_edx;
+
extern int get_model_name(struct cpuinfo_x86 *c);
extern void display_cacheinfo(struct cpuinfo_x86 *c);
Index: xen-4.0.2-testing/xen/arch/x86/cpu/intel.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/cpu/intel.c
+++ xen-4.0.2-testing/xen/arch/x86/cpu/intel.c
@@ -20,16 +20,6 @@
extern int trap_init_f00f_bug(void);
-/*
- * opt_cpuid_mask_ecx/edx: cpuid.1[ecx, edx] feature mask.
- * For example, E8400[Intel Core 2 Duo Processor series] ecx = 0x0008E3FD,
- * edx = 0xBFEBFBFF when executing CPUID.EAX = 1 normally. If you want to
- * 'rev down' to E8400, you can set these values in these Xen boot parameters.
- */
-static unsigned int opt_cpuid_mask_ecx, opt_cpuid_mask_edx;
-integer_param("cpuid_mask_ecx", opt_cpuid_mask_ecx);
-integer_param("cpuid_mask_edx", opt_cpuid_mask_edx);
-
static int use_xsave;
boolean_param("xsave", use_xsave);
@@ -40,24 +30,57 @@ boolean_param("xsave", use_xsave);
struct movsl_mask movsl_mask __read_mostly;
#endif
-static void __devinit set_cpuidmask(void)
+/*
+ * opt_cpuid_mask_ecx/edx: cpuid.1[ecx, edx] feature mask.
+ * For example, E8400[Intel Core 2 Duo Processor series] ecx = 0x0008E3FD,
+ * edx = 0xBFEBFBFF when executing CPUID.EAX = 1 normally. If you want to
+ * 'rev down' to E8400, you can set these values in these Xen boot parameters.
+ */
+static void __devinit set_cpuidmask(const struct cpuinfo_x86 *c)
{
- unsigned int eax, ebx, ecx, edx, model;
+ const char *extra = "";
- if (!(opt_cpuid_mask_ecx | opt_cpuid_mask_edx))
+ if (!~(opt_cpuid_mask_ecx & opt_cpuid_mask_edx &
+ opt_cpuid_mask_ext_ecx & opt_cpuid_mask_ext_edx))
return;
- cpuid(0x00000001, &eax, &ebx, &ecx, &edx);
- model = ((eax & 0xf0000) >> 12) | ((eax & 0xf0) >> 4);
- if (!((model == 0x1d) || ((model == 0x17) && ((eax & 0xf) >= 4)))) {
- printk(XENLOG_ERR "Cannot set CPU feature mask on CPU#%d\n",
- smp_processor_id());
+ /* Only family 6 supports this feature */
+ switch ((c->x86 == 6) * c->x86_model) {
+ case 0x17:
+ if ((c->x86_mask & 0x0f) < 4)
+ break;
+ /* fall through */
+ case 0x1d:
+ wrmsr(MSR_INTEL_CPUID_FEATURE_MASK,
+ opt_cpuid_mask_ecx,
+ opt_cpuid_mask_edx);
+ if (!~(opt_cpuid_mask_ext_ecx & opt_cpuid_mask_ext_edx))
+ return;
+ extra = "extended ";
+ break;
+/*
+ * CPU supports this feature if the processor signature meets the following:
+ * (CPUID.(EAX=01h):EAX) > 000106A2h, or
+ * (CPUID.(EAX=01h):EAX) == 000106Exh, 0002065xh, 000206Cxh, 000206Exh, or 000206Fxh
+ *
+ */
+ case 0x1a:
+ if ((c->x86_mask & 0x0f) <= 2)
+ break;
+ /* fall through */
+ case 0x1e: case 0x1f:
+ case 0x25: case 0x2c: case 0x2e: case 0x2f:
+ wrmsr(MSR_INTEL_CPUID1_FEATURE_MASK,
+ opt_cpuid_mask_ecx,
+ opt_cpuid_mask_edx);
+ wrmsr(MSR_INTEL_CPUID80000001_FEATURE_MASK,
+ opt_cpuid_mask_ext_ecx,
+ opt_cpuid_mask_ext_edx);
return;
}
- wrmsr(MSR_IA32_CPUID_FEATURE_MASK1,
- opt_cpuid_mask_ecx ? : ~0u,
- opt_cpuid_mask_edx ? : ~0u);
+ printk(XENLOG_ERR "Cannot set CPU feature mask on CPU#%d\n",
+ smp_processor_id());
}
void __devinit early_intel_workaround(struct cpuinfo_x86 *c)
@@ -179,7 +202,7 @@ static void __devinit init_intel(struct
detect_ht(c);
- set_cpuidmask();
+ set_cpuidmask(c);
/* Work around errata */
Intel_errata_workarounds(c);
Index: xen-4.0.2-testing/xen/include/asm-x86/msr-index.h
===================================================================
--- xen-4.0.2-testing.orig/xen/include/asm-x86/msr-index.h
+++ xen-4.0.2-testing/xen/include/asm-x86/msr-index.h
@@ -156,8 +156,10 @@
#define MSR_P6_EVNTSEL0 0x00000186
#define MSR_P6_EVNTSEL1 0x00000187
-/* MSR for cpuid feature mask */
-#define MSR_IA32_CPUID_FEATURE_MASK1 0x00000478
+/* MSRs for Intel cpuid feature mask */
+#define MSR_INTEL_CPUID_FEATURE_MASK 0x00000478
+#define MSR_INTEL_CPUID1_FEATURE_MASK 0x00000130
+#define MSR_INTEL_CPUID80000001_FEATURE_MASK 0x00000131
/* MSRs & bits used for VMX enabling */
#define MSR_IA32_VMX_BASIC 0x480

View File

@ -1,51 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1275892689 -3600
# Node ID 0251bbc0a9a879126bce65e47e4410575cfa73de
# Parent 7ff0e885b5c30cc8573b52144b274509e04759fd
AMD: Workaround for erratum 411
Clear APIC TMICT when we mask APIC LVTT.
Signed-off-by: Wei Wang <wei.wang2@amd.com>
Index: xen-4.0.2-testing/xen/arch/x86/apic.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/apic.c
+++ xen-4.0.2-testing/xen/arch/x86/apic.c
@@ -198,6 +198,9 @@ void clear_local_APIC(void)
maxlvt = get_maxlvt();
+ /* Work around AMD Erratum 411. This is a nice thing to do anyway. */
+ apic_write_around(APIC_TMICT, 0);
+
/*
* Masking an LVT entry on a P6 can trigger a local APIC error
* if the vector is zero. Mask LVTERR first to prevent this.
@@ -1327,7 +1330,10 @@ void disable_APIC_timer(void)
{
if (using_apic_timer) {
unsigned long v;
-
+
+ /* Work around AMD Erratum 411. This is a nice thing to do anyway. */
+ apic_write_around(APIC_TMICT, 0);
+
v = apic_read(APIC_LVTT);
apic_write_around(APIC_LVTT, v | APIC_LVT_MASKED);
}
Index: xen-4.0.2-testing/xen/arch/x86/hpet.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/hpet.c
+++ xen-4.0.2-testing/xen/arch/x86/hpet.c
@@ -659,8 +659,7 @@ void hpet_broadcast_enter(void)
if ( hpet_attach_channel )
hpet_attach_channel(cpu, ch);
- /* Cancel any outstanding LAPIC timer event and disable interrupts. */
- reprogram_timer(0);
+ /* Disable LAPIC timer interrupts. */
disable_APIC_timer();
cpu_set(cpu, ch->cpumask);

View File

@ -1,163 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1276604289 -3600
# Node ID a2cc1db1af9c8f9b148c80f8b2c3f64bde7542f9
# Parent 094b826a2b8e2c17fe7004923352d459e0c23f13
Don't save Xen heap pages during domain save
References: bnc#609153
As discussed in the thread starting at
http://lists.xensource.com/archives/html/xen-devel/2010-05/msg01383.html,
don't save Xen heap pages in order to avoid overallocation when the
domain gets restored, as those pages would get (temporarily) backed
with normal RAM pages by the restore code.
This requires making DOMCTL_getpageframeinfo{2,3} usable for HVM
guests, meaning that the input to these must be treated as GMFNs.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-4.0.2-testing/tools/libxc/xc_domain_save.c
===================================================================
--- xen-4.0.2-testing.orig/tools/libxc/xc_domain_save.c
+++ xen-4.0.2-testing/tools/libxc/xc_domain_save.c
@@ -1282,58 +1282,64 @@ int xc_domain_save(int xc_handle, int io
goto out;
}
- if ( hvm )
+ /* Get page types */
+ if ( xc_get_pfn_type_batch(xc_handle, dom, batch, pfn_type) )
{
- /* Look for and skip completely empty batches. */
- for ( j = 0; j < batch; j++ )
- {
- if ( !pfn_err[j] )
- break;
- pfn_type[j] |= XEN_DOMCTL_PFINFO_XTAB;
- }
- if ( j == batch )
- {
- munmap(region_base, batch*PAGE_SIZE);
- continue; /* bail on this batch: no valid pages */
- }
- for ( ; j < batch; j++ )
- if ( pfn_err[j] )
- pfn_type[j] |= XEN_DOMCTL_PFINFO_XTAB;
+ ERROR("get_pfn_type_batch failed");
+ goto out;
}
- else
+
+ for ( run = j = 0; j < batch; j++ )
{
- /* Get page types */
- if ( xc_get_pfn_type_batch(xc_handle, dom, batch, pfn_type) )
- {
- ERROR("get_pfn_type_batch failed");
- goto out;
- }
+ unsigned long gmfn = pfn_batch[j];
+
+ if ( !hvm )
+ gmfn = pfn_to_mfn(gmfn);
- for ( j = 0; j < batch; j++ )
+ if ( pfn_err[j] )
{
- unsigned long mfn = pfn_to_mfn(pfn_batch[j]);
-
if ( pfn_type[j] == XEN_DOMCTL_PFINFO_XTAB )
- {
- DPRINTF("type fail: page %i mfn %08lx\n",
- j, mfn);
continue;
- }
-
- if ( debug )
+ DPRINTF("map fail: page %i mfn %08lx err %d\n",
+ j, gmfn, pfn_err[j]);
+ pfn_type[j] = XEN_DOMCTL_PFINFO_XTAB;
+ continue;
+ }
+
+ if ( pfn_type[j] == XEN_DOMCTL_PFINFO_XTAB )
+ {
+ DPRINTF("type fail: page %i mfn %08lx\n", j, gmfn);
+ continue;
+ }
+
+ /* canonicalise mfn->pfn */
+ pfn_type[j] |= pfn_batch[j];
+ ++run;
+
+ if ( debug )
+ {
+ if ( hvm )
+ DPRINTF("%d pfn=%08lx sum=%08lx\n",
+ iter,
+ pfn_type[j],
+ csum_page(region_base + (PAGE_SIZE*j)));
+ else
DPRINTF("%d pfn= %08lx mfn= %08lx [mfn]= %08lx"
" sum= %08lx\n",
iter,
- pfn_type[j] | pfn_batch[j],
- mfn,
- mfn_to_pfn(mfn),
+ pfn_type[j],
+ gmfn,
+ mfn_to_pfn(gmfn),
csum_page(region_base + (PAGE_SIZE*j)));
-
- /* canonicalise mfn->pfn */
- pfn_type[j] |= pfn_batch[j];
}
}
+ if ( !run )
+ {
+ munmap(region_base, batch*PAGE_SIZE);
+ continue; /* bail on this batch: no valid pages */
+ }
+
if ( write_exact(io_fd, &batch, sizeof(unsigned int)) )
{
PERROR("Error when writing to state file (2)");
Index: xen-4.0.2-testing/xen/arch/x86/domctl.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/domctl.c
+++ xen-4.0.2-testing/xen/arch/x86/domctl.c
@@ -206,11 +206,12 @@ long arch_do_domctl(
for ( j = 0; j < k; j++ )
{
- unsigned long type = 0, mfn = arr[j];
+ unsigned long type = 0, mfn = gmfn_to_mfn(d, arr[j]);
page = mfn_to_page(mfn);
- if ( unlikely(!mfn_valid(mfn)) )
+ if ( unlikely(!mfn_valid(mfn)) ||
+ unlikely(is_xen_heap_mfn(mfn)) )
type = XEN_DOMCTL_PFINFO_XTAB;
else if ( xsm_getpageframeinfo(page) != 0 )
;
@@ -305,14 +306,15 @@ long arch_do_domctl(
for ( j = 0; j < k; j++ )
{
struct page_info *page;
- unsigned long mfn = arr32[j];
+ unsigned long mfn = gmfn_to_mfn(d, arr32[j]);
page = mfn_to_page(mfn);
if ( domctl->cmd == XEN_DOMCTL_getpageframeinfo3)
arr32[j] = 0;
- if ( unlikely(!mfn_valid(mfn)) )
+ if ( unlikely(!mfn_valid(mfn)) ||
+ unlikely(is_xen_heap_mfn(mfn)) )
arr32[j] |= XEN_DOMCTL_PFINFO_XTAB;
else if ( xsm_getpageframeinfo(page) != 0 )
continue;

View File

@ -1,25 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1276761018 -3600
# Node ID 7a00c0bd4fc131fb4de5df9f3fdc4e48a29dd5f9
# Parent dab8676e97ce7a95c0777e58eee4b1b03bfc5322
cpuidle: fix wrapped ticks calculation for pm timer.
Signed-off-by: Wei Gang <gang.wei@intel.com>
Index: xen-4.0.2-testing/xen/arch/x86/acpi/cpu_idle.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/acpi/cpu_idle.c
+++ xen-4.0.2-testing/xen/arch/x86/acpi/cpu_idle.c
@@ -127,9 +127,9 @@ static inline u32 ticks_elapsed(u32 t1,
if ( t2 >= t1 )
return (t2 - t1);
else if ( !(acpi_gbl_FADT.flags & ACPI_FADT_32BIT_TIMER) )
- return (((0x00FFFFFF - t1) + t2) & 0x00FFFFFF);
+ return (((0x00FFFFFF - t1) + t2 + 1) & 0x00FFFFFF);
else
- return ((0xFFFFFFFF - t1) + t2);
+ return ((0xFFFFFFFF - t1) + t2 +1);
}
static void acpi_safe_halt(void)

View File

@ -1,46 +0,0 @@
# HG changeset patch
# User Ian Jackson <Ian.Jackson@eu.citrix.com>
# Date 1277219220 -3600
# Node ID 9da3abe88c90bd8ec48963a9ec537a8871e266db
# Parent 2ad890d46cb8a11fc6ea329126d398021307e627
Check "mac" address sooner in device_create function, before doing device_add.
In XendDomainInfo.py device_create function, when device type is
"vif", it has a paragraph to check the validity of "mac"
address. Before checking validity, device_add has been done. But after
checking validity, if the mac address is invlid, it raises VmError and
exits directly without doing clean work like removing the device item
from config info. This will cause that the incorrect mac address is
saved into VM Config file and VM fails to restart. If check "mac"
validity before doing device_add, there will be no problem.
Signed-off-by Chunyan Liu <CYLiu@novell.com>
Index: xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -847,11 +847,6 @@ class XendDomainInfo:
@type dev_config: SXP object (parsed config)
"""
log.debug("XendDomainInfo.device_create: %s" % scrub_password(dev_config))
- dev_type = sxp.name(dev_config)
- dev_uuid = self.info.device_add(dev_type, cfg_sxp = dev_config)
- dev_config_dict = self.info['devices'][dev_uuid][1]
- log.debug("XendDomainInfo.device_create: %s" % scrub_password(dev_config_dict))
-
if dev_type == 'vif':
for x in dev_config:
if x != 'vif' and x[0] == 'mac':
@@ -859,6 +854,11 @@ class XendDomainInfo:
log.error("Virtual network interface creation error - invalid MAC Address entered: %s", x[1])
raise VmError("Cannot create a new virtual network interface - MAC address is not valid!");
+ dev_type = sxp.name(dev_config)
+ dev_uuid = self.info.device_add(dev_type, cfg_sxp = dev_config)
+ dev_config_dict = self.info['devices'][dev_uuid][1]
+ log.debug("XendDomainInfo.device_create: %s" % scrub_password(dev_config_dict))
+
if self.domid is not None:
try:
dev_config_dict['devid'] = devid = \

View File

@ -1,39 +0,0 @@
# HG changeset patch
# User Ian Jackson <Ian.Jackson@eu.citrix.com>
# Date 1277475191 -3600
# Node ID e307aa11ed27ea91cf175461b3a715fe3f7253bc
# Parent e7b55cc5533aed48a47cf70e20aa9fb991bf2de4
xend: Fix up check "mac" address sooner change
In changeset 21653,
dev_type = sxp.name(dev_config)
should not have been moved, otherwise, the checking "mac"
paragraph is of no use.
(The original patch as submitted was correct but I had to make the
change manually as it had been mangled.)
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by Chunyan Liu <CYLiu@novell.com>
Index: xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -847,6 +847,8 @@ class XendDomainInfo:
@type dev_config: SXP object (parsed config)
"""
log.debug("XendDomainInfo.device_create: %s" % scrub_password(dev_config))
+ dev_type = sxp.name(dev_config)
+
if dev_type == 'vif':
for x in dev_config:
if x != 'vif' and x[0] == 'mac':
@@ -854,7 +856,6 @@ class XendDomainInfo:
log.error("Virtual network interface creation error - invalid MAC Address entered: %s", x[1])
raise VmError("Cannot create a new virtual network interface - MAC address is not valid!");
- dev_type = sxp.name(dev_config)
dev_uuid = self.info.device_add(dev_type, cfg_sxp = dev_config)
dev_config_dict = self.info['devices'][dev_uuid][1]
log.debug("XendDomainInfo.device_create: %s" % scrub_password(dev_config_dict))

View File

@ -1,49 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1277739919 -3600
# Node ID 059a12afce52a213db56bd8e9442d9eeadfdd34c
# Parent 7e46fdbe8a1187cee2ab609256300d7967f37f06
vtd: Only kill_timer() an init_timer()'ed timer.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Index: xen-4.0.2-testing/xen/drivers/passthrough/io.c
===================================================================
--- xen-4.0.2-testing.orig/xen/drivers/passthrough/io.c
+++ xen-4.0.2-testing/xen/drivers/passthrough/io.c
@@ -27,7 +27,7 @@
static void hvm_dirq_assist(unsigned long _d);
-static int pt_irq_need_timer(uint32_t flags)
+bool_t pt_irq_need_timer(uint32_t flags)
{
return !(flags & (HVM_IRQ_DPCI_GUEST_MSI | HVM_IRQ_DPCI_TRANSLATE));
}
Index: xen-4.0.2-testing/xen/drivers/passthrough/pci.c
===================================================================
--- xen-4.0.2-testing.orig/xen/drivers/passthrough/pci.c
+++ xen-4.0.2-testing/xen/drivers/passthrough/pci.c
@@ -257,7 +257,9 @@ static void pci_clean_dpci_irqs(struct d
i = find_next_bit(hvm_irq_dpci->mapping, d->nr_pirqs, i + 1) )
{
pirq_guest_unbind(d, i);
- kill_timer(&hvm_irq_dpci->hvm_timer[domain_pirq_to_irq(d, i)]);
+
+ if ( pt_irq_need_timer(hvm_irq_dpci->mirq[i].flags) )
+ kill_timer(&hvm_irq_dpci->hvm_timer[domain_pirq_to_irq(d, i)]);
list_for_each_safe ( digl_list, tmp,
&hvm_irq_dpci->mirq[i].digl_list )
Index: xen-4.0.2-testing/xen/include/xen/iommu.h
===================================================================
--- xen-4.0.2-testing.orig/xen/include/xen/iommu.h
+++ xen-4.0.2-testing/xen/include/xen/iommu.h
@@ -106,6 +106,7 @@ void hvm_dpci_isairq_eoi(struct domain *
struct hvm_irq_dpci *domain_get_irq_dpci(struct domain *domain);
int domain_set_irq_dpci(struct domain *domain, struct hvm_irq_dpci *dpci);
void free_hvm_irq_dpci(struct hvm_irq_dpci *dpci);
+bool_t pt_irq_need_timer(uint32_t flags);
#define PT_IRQ_TIME_OUT MILLISECS(8)
#define VTDPREFIX "[VT-D]"

View File

@ -1,188 +0,0 @@
# HG changeset patch
# User Ian Jackson <Ian.Jackson@eu.citrix.com>
# Date 1277819571 -3600
# Node ID a60c604b5829db6285ff89d8163478330ac12ee2
# Parent 7b00193bd0334606b6f6779c3f14a1667a952fe4
tools/xend, xm: add a command to get the state of VMs
add a command "domstate" to get the state of Vms, which may have one state of
{'shutoff', 'idle','shutdown','running','crashed','paused' or 'paused by
admin"}.
For case of pause, I distinguish it into two conditions. One is "paused" the
other is "paused by admin".
"pasued by admin" means that users pause a domain voluntary by "xm paused
VM" or " API"
Signed-off-by James (Song Wei) <jsong@novell.com>
Index: xen-4.0.2-testing/tools/python/xen/xend/XendDomain.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/xend/XendDomain.py
+++ xen-4.0.2-testing/tools/python/xen/xend/XendDomain.py
@@ -250,6 +250,18 @@ class XendDomain:
@return: path to config file.
"""
return os.path.join(self._managed_path(domuuid), CACHED_CONFIG_FILE)
+ def domain_setpauseflag(self, dom, flag=False):
+ try:
+ dominfo = self.domain_lookup_nr(dom)
+ dominfo.paused_by_admin = flag
+ except Exception, err:
+ log.debug("error in in setpauseflag")
+ def domain_getpauseflag(self, dom):
+ try:
+ dominfo = self.domain_lookup_nr(dom)
+ return dominfo.paused_by_admin
+ except Exception, err:
+ log.debug("error in in getpauseflag")
def _managed_check_point_path(self, domuuid):
"""Returns absolute path to check point file for managed domain.
Index: xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -327,6 +327,8 @@ class XendDomainInfo:
@type info: dictionary
@ivar domid: Domain ID (if VM has started)
@type domid: int or None
+ @ivar paused_by_admin: Is this Domain paused by command or API
+ @type paused_by_admin: bool
@ivar guest_bitsize: the bitsize of guest
@type guest_bitsize: int or None
@ivar alloc_mem: the memory domain allocated when booting
@@ -390,6 +392,7 @@ class XendDomainInfo:
self.domid = domid
self.guest_bitsize = None
self.alloc_mem = None
+ self.paused_by_admin = False
maxmem = self.info.get('memory_static_max', 0)
memory = self.info.get('memory_dynamic_max', 0)
Index: xen-4.0.2-testing/tools/python/xen/xend/server/SrvDomain.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/xend/server/SrvDomain.py
+++ xen-4.0.2-testing/tools/python/xen/xend/server/SrvDomain.py
@@ -225,6 +225,20 @@ class SrvDomain(SrvDir):
self.acceptCommand(req)
return self.xd.domain_reset(self.dom.getName())
+ def op_do_get_pauseflag(self, op, req):
+ self.acceptCommand(req)
+ return req.threadRequest(self.do_get_pauseflag, op, req)
+
+ def do_get_pauseflag(self, _, req):
+ return self.xd.domain_getpauseflag(self.dom.getName(), req)
+
+ def op_do_set_pauseflag(self, op, req):
+ self.acceptCommand(req)
+ return req.threadRequest(self.do_set_pauseflag, op, req)
+
+ def do_set_pauseflag(self, _, req):
+ return self.xd.domain_setpauseflag(self.dom.getName(), req)
+
def op_usb_add(self, op, req):
self.acceptCommand(req)
return req.threadRequest(self.do_usb_add, op, req)
Index: xen-4.0.2-testing/tools/python/xen/xm/main.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/xm/main.py
+++ xen-4.0.2-testing/tools/python/xen/xm/main.py
@@ -165,6 +165,8 @@ SUBCOMMAND_HELP = {
#usb
'usb-add' : ('<domain> <[host:bus.addr] [host:vendor_id:product_id]>','Add the usb device to FV VM.'),
'usb-del' : ('<domain> <[host:bus.addr] [host:vendor_id:product_id]>','Delete the usb device to FV VM.'),
+ #domstate
+ 'domstate' : ('<domain> ', 'get the state of a domain'),
# device commands
@@ -370,6 +372,7 @@ common_commands = [
"uptime",
"usb-add",
"usb-del",
+ "domstate",
"vcpu-set",
]
@@ -404,6 +407,7 @@ domain_commands = [
"uptime",
"usb-add",
"usb-del",
+ "domstate",
"vcpu-list",
"vcpu-pin",
"vcpu-set",
@@ -901,7 +905,6 @@ def getDomains(domain_names, state, full
return "-"
state_str = "".join([state_on_off(state)
for state in states])
-
dom_rec.update({'name': dom_rec['name_label'],
'memory_actual': int(dom_metrics_rec['memory_actual'])/1024,
'vcpus': dom_metrics_rec['VCPUs_number'],
@@ -1395,8 +1398,10 @@ def xm_pause(args):
if serverType == SERVER_XEN_API:
server.xenapi.VM.pause(get_single_vm(dom))
+ server.xenapi.VM.set_pauseflag(get_single_vm(dom), True)
else:
server.xend.domain.pause(dom)
+ server.xend.domain.setpauseflag(dom, True)
def xm_unpause(args):
arg_check(args, "unpause", 1)
@@ -1404,8 +1409,10 @@ def xm_unpause(args):
if serverType == SERVER_XEN_API:
server.xenapi.VM.unpause(get_single_vm(dom))
+ server.xenapi.VM.set_pauseflag(get_single_vm(dom), False)
else:
server.xend.domain.unpause(dom)
+ server.xend.domain.setpauseflag(dom, False)
def xm_dump_core(args):
live = False
@@ -1517,6 +1524,32 @@ def xm_usb_add(args):
arg_check(args, "usb-add", 2)
server.xend.domain.usb_add(args[0],args[1])
+def xm_domstate(args):
+ arg_check(args, "domstate", 1)
+ (opitons, params) = getopt.gnu_getopt(args, 's', ['domname='])
+ doms = getDomains(params, 'all')
+ d = parse_doms_info(doms[0])
+ state = d['state']
+ if state:
+ if state.find('s') > 0:
+ print 'shutoff'
+ elif state.find('b') > 0:
+ print 'idle'
+ elif state.find('d') > 0:
+ print 'shutdown'
+ elif state.find('r') > 0:
+ print 'running'
+ elif state.find('c') > 0:
+ print 'crashed'
+ elif state.find('p') > 0:
+ if server.xend.domain.getpauseflag(args[0]):
+ print 'paused by admin'
+ else:
+ print 'paused'
+ else:
+ print 'shutoff'
+ return
+
def xm_usb_del(args):
arg_check(args, "usb-del", 2)
server.xend.domain.usb_del(args[0],args[1])
@@ -3542,6 +3575,8 @@ commands = {
#usb
"usb-add": xm_usb_add,
"usb-del": xm_usb_del,
+ #domstate
+ "domstate": xm_domstate,
}
## The commands supported by a separate argument parser in xend.xm.

View File

@ -1,483 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1279284738 -3600
# Node ID fedab6367c9a0141d49853c77a23d6642ba70ff6
# Parent 1f7c2418e58c7d1d5650ea211016b30114de48f2
ACPI: add support for x2APIC ACPI extensions
References: bnc#656369, bnc#658704
All logical processors with APIC ID values of 255 and greater will
have their APIC reported through Processor X2APIC structure (type-9
entry type) and all logical processors with APIC ID less than 255 will
have their APIC reported through legacy Processor Local APIC (type-0
entry type) only. This is the same case even for NMI structure
reporting.
The Processor X2APIC Affinity structure provides the association
between the X2APIC ID of a logical processor and the proximity domain
to which the logical processor belongs.
This patch adds 2 new subtables to MADT and one new subtable to SRAT.
This patch also changes x86_acpiid_to_apicid from u8 to u32 for x2APIC
ID, and changes mp_register_lapic to accept 32-bit id. But there are
still some 8-bit apic id hardcode and assumptions in Xen code, it
needs to be fixed in future.
Signed-off-by: Weidong Han <weidong.han@intel.com>
Index: xen-4.0.2-testing/xen/arch/x86/acpi/boot.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/acpi/boot.c
+++ xen-4.0.2-testing/xen/arch/x86/acpi/boot.c
@@ -81,7 +81,7 @@ u8 acpi_enable_value, acpi_disable_value
#warning ACPI uses CMPXCHG, i486 and later hardware
#endif
-u8 x86_acpiid_to_apicid[MAX_MADT_ENTRIES] =
+u32 x86_acpiid_to_apicid[MAX_MADT_ENTRIES] =
{[0 ... MAX_MADT_ENTRIES - 1] = 0xff };
EXPORT_SYMBOL(x86_acpiid_to_apicid);
@@ -156,6 +156,35 @@ static int __init acpi_parse_madt(struct
}
static int __init
+acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end)
+{
+ struct acpi_table_x2apic *processor = NULL;
+
+ processor = (struct acpi_table_x2apic *)header;
+
+ if (BAD_MADT_ENTRY(processor, end))
+ return -EINVAL;
+
+ acpi_table_print_madt_entry(header);
+
+ /* Record local apic id only when enabled */
+ if (processor->flags.enabled)
+ x86_acpiid_to_apicid[processor->acpi_uid] = processor->id;
+
+ /*
+ * We need to register disabled CPU as well to permit
+ * counting disabled CPUs. This allows us to size
+ * cpus_possible_map more accurately, to permit
+ * to not preallocating memory for all NR_CPUS
+ * when we use CPU hotplug.
+ */
+ mp_register_lapic(processor->id, /* X2APIC ID */
+ processor->flags.enabled); /* Enabled? */
+
+ return 0;
+}
+
+static int __init
acpi_parse_lapic(struct acpi_subtable_header * header, const unsigned long end)
{
struct acpi_table_lapic *processor = NULL;
@@ -201,6 +230,25 @@ acpi_parse_lapic_addr_ovr(struct acpi_su
}
static int __init
+acpi_parse_x2apic_nmi(struct acpi_subtable_header *header,
+ const unsigned long end)
+{
+ struct acpi_table_x2apic_nmi *x2apic_nmi = NULL;
+
+ x2apic_nmi = (struct acpi_table_x2apic_nmi *)header;
+
+ if (BAD_MADT_ENTRY(x2apic_nmi, end))
+ return -EINVAL;
+
+ acpi_table_print_madt_entry(header);
+
+ if (x2apic_nmi->lint != 1)
+ printk(KERN_WARNING PREFIX "NMI not connected to LINT 1!\n");
+
+ return 0;
+}
+
+static int __init
acpi_parse_lapic_nmi(struct acpi_subtable_header * header, const unsigned long end)
{
struct acpi_table_lapic_nmi *lapic_nmi = NULL;
@@ -465,7 +513,7 @@ static int __init acpi_parse_fadt(struct
*/
static int __init acpi_parse_madt_lapic_entries(void)
{
- int count;
+ int count, x2count;
if (!cpu_has_apic)
return -ENODEV;
@@ -488,11 +536,13 @@ static int __init acpi_parse_madt_lapic_
count = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic,
MAX_APICS);
- if (!count) {
+ x2count = acpi_table_parse_madt(ACPI_MADT_X2APIC, acpi_parse_x2apic,
+ MAX_APICS);
+ if (!count && !x2count) {
printk(KERN_ERR PREFIX "No LAPIC entries present\n");
/* TBD: Cleanup to allow fallback to MPS */
return -ENODEV;
- } else if (count < 0) {
+ } else if (count < 0 || x2count < 0) {
printk(KERN_ERR PREFIX "Error parsing LAPIC entry\n");
/* TBD: Cleanup to allow fallback to MPS */
return count;
@@ -500,7 +550,10 @@ static int __init acpi_parse_madt_lapic_
count =
acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0);
- if (count < 0) {
+ x2count =
+ acpi_table_parse_madt(ACPI_MADT_X2APIC_NMI,
+ acpi_parse_x2apic_nmi, 0);
+ if (count < 0 || x2count < 0) {
printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
/* TBD: Cleanup to allow fallback to MPS */
return count;
Index: xen-4.0.2-testing/xen/arch/x86/mpparse.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/mpparse.c
+++ xen-4.0.2-testing/xen/arch/x86/mpparse.c
@@ -838,7 +838,7 @@ void __init mp_register_lapic_address (
int __devinit mp_register_lapic (
- u8 id,
+ u32 id,
u8 enabled)
{
struct mpc_config_processor processor;
Index: xen-4.0.2-testing/xen/arch/x86/srat.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/srat.c
+++ xen-4.0.2-testing/xen/arch/x86/srat.c
@@ -164,6 +164,36 @@ void __init acpi_numa_slit_init(struct a
}
#endif
+/* Callback for Proximity Domain -> x2APIC mapping */
+void __init
+acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa)
+{
+ int pxm, node;
+ int apic_id;
+
+ if (srat_disabled())
+ return;
+ if (pa->header.length < sizeof(struct acpi_srat_x2apic_cpu_affinity)) {
+ bad_srat();
+ return;
+ }
+ if ((pa->flags & ACPI_SRAT_CPU_ENABLED) == 0)
+ return;
+ pxm = pa->proximity_domain;
+ node = setup_node(pxm);
+ if (node < 0) {
+ printk(KERN_ERR "SRAT: Too many proximity domains %x\n", pxm);
+ bad_srat();
+ return;
+ }
+
+ apic_id = pa->apic_id;
+ apicid_to_node[apic_id] = node;
+ acpi_numa = 1;
+ printk(KERN_INFO "SRAT: PXM %u -> APIC %u -> Node %u\n",
+ pxm, apic_id, node);
+}
+
/* Callback for Proximity Domain -> LAPIC mapping */
void __init
acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa)
Index: xen-4.0.2-testing/xen/drivers/acpi/numa.c
===================================================================
--- xen-4.0.2-testing.orig/xen/drivers/acpi/numa.c
+++ xen-4.0.2-testing/xen/drivers/acpi/numa.c
@@ -90,6 +90,21 @@ void __init acpi_table_print_srat_entry(
#endif /* ACPI_DEBUG_OUTPUT */
break;
+ case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY:
+#ifdef ACPI_DEBUG_OUTPUT
+ {
+ struct acpi_srat_x2apic_cpu_affinity *p =
+ (struct acpi_srat_x2apic_cpu_affinity *)header;
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+ "SRAT Processor (x2apicid[0x%08x]) in"
+ " proximity domain %d %s\n",
+ p->apic_id,
+ p->proximity_domain,
+ (p->flags & ACPI_SRAT_CPU_ENABLED) ?
+ "enabled" : "disabled"));
+ }
+#endif /* ACPI_DEBUG_OUTPUT */
+ break;
default:
printk(KERN_WARNING PREFIX
"Found unsupported SRAT entry (type = 0x%x)\n",
@@ -105,6 +120,33 @@ static int __init acpi_parse_slit(struct
return 0;
}
+void __init __attribute__ ((weak))
+acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa)
+{
+ printk(KERN_WARNING PREFIX
+ "Found unsupported x2apic [0x%08x] SRAT entry\n", pa->apic_id);
+ return;
+}
+
+
+static int __init
+acpi_parse_x2apic_affinity(struct acpi_subtable_header *header,
+ const unsigned long end)
+{
+ struct acpi_srat_x2apic_cpu_affinity *processor_affinity;
+
+ processor_affinity = (struct acpi_srat_x2apic_cpu_affinity *)header;
+ if (!processor_affinity)
+ return -EINVAL;
+
+ acpi_table_print_srat_entry(header);
+
+ /* let architecture-dependent part to do it */
+ acpi_numa_x2apic_affinity_init(processor_affinity);
+
+ return 0;
+}
+
static int __init
acpi_parse_processor_affinity(struct acpi_subtable_header * header,
const unsigned long end)
@@ -164,6 +206,8 @@ int __init acpi_numa_init(void)
{
/* SRAT: Static Resource Affinity Table */
if (!acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat)) {
+ acpi_table_parse_srat(ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY,
+ acpi_parse_x2apic_affinity, NR_CPUS);
acpi_table_parse_srat(ACPI_SRAT_PROCESSOR_AFFINITY,
acpi_parse_processor_affinity,
NR_CPUS);
Index: xen-4.0.2-testing/xen/drivers/acpi/tables.c
===================================================================
--- xen-4.0.2-testing.orig/xen/drivers/acpi/tables.c
+++ xen-4.0.2-testing/xen/drivers/acpi/tables.c
@@ -63,6 +63,18 @@ void __init acpi_table_print_madt_entry(
}
break;
+ case ACPI_MADT_TYPE_LOCAL_X2APIC:
+ {
+ struct acpi_madt_local_x2apic *p =
+ (struct acpi_madt_local_x2apic *)header;
+ printk(KERN_INFO PREFIX
+ "X2APIC (apic_id[0x%02x] uid[0x%02x] %s)\n",
+ p->local_apic_id, p->uid,
+ (p->lapic_flags & ACPI_MADT_ENABLED) ?
+ "enabled" : "disabled");
+ }
+ break;
+
case ACPI_MADT_TYPE_IO_APIC:
{
struct acpi_madt_io_apic *p =
@@ -116,6 +128,24 @@ void __init acpi_table_print_madt_entry(
p->lint);
}
break;
+
+ case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI:
+ {
+ u16 polarity, trigger;
+ struct acpi_madt_local_x2apic_nmi *p =
+ (struct acpi_madt_local_x2apic_nmi *)header;
+
+ polarity = p->inti_flags & ACPI_MADT_POLARITY_MASK;
+ trigger = (p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2;
+
+ printk(KERN_INFO PREFIX
+ "X2APIC_NMI (uid[0x%02x] %s %s lint[0x%x])\n",
+ p->uid,
+ mps_inti_flags_polarity[polarity],
+ mps_inti_flags_trigger[trigger],
+ p->lint);
+ }
+ break;
case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
{
Index: xen-4.0.2-testing/xen/include/acpi/actbl1.h
===================================================================
--- xen-4.0.2-testing.orig/xen/include/acpi/actbl1.h
+++ xen-4.0.2-testing/xen/include/acpi/actbl1.h
@@ -404,7 +404,9 @@ enum acpi_madt_type {
ACPI_MADT_TYPE_IO_SAPIC = 6,
ACPI_MADT_TYPE_LOCAL_SAPIC = 7,
ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8,
- ACPI_MADT_TYPE_RESERVED = 9 /* 9 and greater are reserved */
+ ACPI_MADT_TYPE_LOCAL_X2APIC = 9,
+ ACPI_MADT_TYPE_LOCAL_X2APIC_NMI = 10,
+ ACPI_MADT_TYPE_RESERVED = 11 /* 11 and greater are reserved */
};
/*
@@ -505,6 +507,26 @@ struct acpi_madt_interrupt_source {
#define ACPI_MADT_CPEI_OVERRIDE (1)
+/* 9: Processor Local X2APIC (ACPI 4.0) */
+
+struct acpi_madt_local_x2apic {
+ struct acpi_subtable_header header;
+ u16 reserved; /* Reserved - must be zero */
+ u32 local_apic_id; /* Processor X2_APIC ID */
+ u32 lapic_flags;
+ u32 uid; /* Extended X2_APIC processor ID */
+};
+
+/* 10: Local X2APIC NMI (ACPI 4.0) */
+
+struct acpi_madt_local_x2apic_nmi {
+ struct acpi_subtable_header header;
+ u16 inti_flags;
+ u32 uid; /* Processor X2_APIC ID */
+ u8 lint; /* LINTn to which NMI is connected */
+ u8 reserved[3];
+};
+
/*
* Common flags fields for MADT subtables
*/
@@ -646,11 +668,14 @@ struct acpi_table_srat {
enum acpi_srat_type {
ACPI_SRAT_TYPE_CPU_AFFINITY = 0,
ACPI_SRAT_TYPE_MEMORY_AFFINITY = 1,
- ACPI_SRAT_TYPE_RESERVED = 2
+ ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY = 2,
+ ACPI_SRAT_TYPE_RESERVED = 3 /* 3 and greater are reserved */
};
/* SRAT sub-tables */
+/* 0: Processor Local APIC/SAPIC Affinity */
+
struct acpi_srat_cpu_affinity {
struct acpi_subtable_header header;
u8 proximity_domain_lo;
@@ -661,9 +686,7 @@ struct acpi_srat_cpu_affinity {
u32 reserved; /* Reserved, must be zero */
};
-/* Flags */
-
-#define ACPI_SRAT_CPU_ENABLED (1) /* 00: Use affinity structure */
+/* 1: Memory Affinity */
struct acpi_srat_mem_affinity {
struct acpi_subtable_header header;
@@ -682,6 +705,22 @@ struct acpi_srat_mem_affinity {
#define ACPI_SRAT_MEM_HOT_PLUGGABLE (1<<1) /* 01: Memory region is hot pluggable */
#define ACPI_SRAT_MEM_NON_VOLATILE (1<<2) /* 02: Memory region is non-volatile */
+/* 2: Processor Local X2_APIC Affinity (ACPI 4.0) */
+
+struct acpi_srat_x2apic_cpu_affinity {
+ struct acpi_subtable_header header;
+ u16 reserved; /* Reserved, must be zero */
+ u32 proximity_domain;
+ u32 apic_id;
+ u32 flags;
+ u32 clock_domain;
+ u32 reserved2;
+};
+
+/* Flags for struct acpi_srat_cpu_affinity and struct acpi_srat_x2apic_cpu_affinity */
+
+#define ACPI_SRAT_CPU_ENABLED (1) /* 00: Use affinity structure */
+
/*******************************************************************************
*
* TCPA - Trusted Computing Platform Alliance table
Index: xen-4.0.2-testing/xen/include/asm-x86/acpi.h
===================================================================
--- xen-4.0.2-testing.orig/xen/include/asm-x86/acpi.h
+++ xen-4.0.2-testing/xen/include/asm-x86/acpi.h
@@ -151,7 +151,7 @@ struct acpi_sleep_info {
#endif /* CONFIG_ACPI_SLEEP */
#define MAX_MADT_ENTRIES 256
-extern u8 x86_acpiid_to_apicid[];
+extern u32 x86_acpiid_to_apicid[];
#define MAX_LOCAL_APIC 256
extern u32 pmtmr_ioport;
Index: xen-4.0.2-testing/xen/include/asm-x86/mpspec.h
===================================================================
--- xen-4.0.2-testing.orig/xen/include/asm-x86/mpspec.h
+++ xen-4.0.2-testing/xen/include/asm-x86/mpspec.h
@@ -24,7 +24,7 @@ extern int pic_mode;
extern int using_apic_timer;
#ifdef CONFIG_ACPI
-extern int mp_register_lapic (u8 id, u8 enabled);
+extern int mp_register_lapic (u32 id, u8 enabled);
extern void mp_unregister_lapic(uint32_t apic_id, uint32_t cpu);
extern void mp_register_lapic_address (u64 address);
extern void mp_register_ioapic (u8 id, u32 address, u32 gsi_base);
Index: xen-4.0.2-testing/xen/include/xen/acpi.h
===================================================================
--- xen-4.0.2-testing.orig/xen/include/xen/acpi.h
+++ xen-4.0.2-testing/xen/include/xen/acpi.h
@@ -57,6 +57,8 @@ enum acpi_madt_entry_id {
ACPI_MADT_IOSAPIC,
ACPI_MADT_LSAPIC,
ACPI_MADT_PLAT_INT_SRC,
+ ACPI_MADT_X2APIC,
+ ACPI_MADT_X2APIC_NMI,
ACPI_MADT_ENTRY_COUNT
};
@@ -76,6 +78,17 @@ struct acpi_table_lapic {
} flags;
} __attribute__ ((packed));
+struct acpi_table_x2apic {
+ struct acpi_subtable_header header;
+ u16 reserved;
+ u32 id;
+ struct {
+ u32 enabled:1;
+ u32 reserved:31;
+ } flags;
+ u32 acpi_uid;
+} __attribute__ ((packed));
+
struct acpi_table_ioapic {
struct acpi_subtable_header header;
u8 id;
@@ -105,6 +118,14 @@ struct acpi_table_lapic_nmi {
u8 lint;
} __attribute__ ((packed));
+struct acpi_table_x2apic_nmi {
+ struct acpi_subtable_header header;
+ acpi_interrupt_flags flags;
+ u32 acpi_uid;
+ u8 lint;
+ u8 reserved[3];
+} __attribute__ ((packed));
+
struct acpi_table_lapic_addr_ovr {
struct acpi_subtable_header header;
u8 reserved[2];
@@ -280,6 +301,7 @@ void acpi_table_print_srat_entry (struct
/* the following four functions are architecture-dependent */
void acpi_numa_slit_init (struct acpi_table_slit *slit);
void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa);
+void acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa);
void acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma);
void acpi_numa_arch_fixup(void);

View File

@ -1,130 +0,0 @@
# HG changeset patch
# User "Dube, Lutz" <lutz.dube@ts.fujitsu.com>
# Date 1279902875 -3600
# Node ID 4814e16ea4105502332407e3379c49da92018899
# Parent e23302fcb83c72f93ec01285bd7f4f1641eb67e4
tools/xend: Fix performance of xend with more than 10000 FC device paths
On server startup xend start or a later xend restart needs approx. 30 min to
start/restart. Without attached FC devices xend start/restart needs only some
seconds.
server type: Fujitsu Primergy RX600-S5
The time gets lost in xen/xend/XendNode.py line 329 while calling
vscsi_util.get_all_scsi_device().
329 for pscsi_record in vscsi_util.get_all_scsi_devices():
330 scsi_id = pscsi_record['scsi_id']
331 if scsi_id:
332 saved_HBA_uuid = None
I think, in most cases we don't need all the PSCSI devices registered in
xend, but only a few of it.
So a good solution for this perforamce issue is to scan only the SCSI device
paths we need, controlled by a new option in xend-config.sxp.
I have made a patch to allow specification of scsi devices we need in xend
in the config file xend-config.sxp.
The new options pscsi-device-mask expects a list of device ids oder partial
device ids like the option of lsscsi, e.g.
(pscsi-device-mask ('<partial-dev-id1' 'partial-dev-id2' ...))
Without this option set in xend-config.sxp or if lsscsi is not support, all
device paths are process like today.
Signed-off-by: Lutz Dube Lutz.Dube@ts.fujitsu.com
Comment from Masaki Kanno <kanno.masaki@jp.fujitsu.com>: "Well done"
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Index: xen-4.0.2-testing/tools/examples/xend-config.sxp
===================================================================
--- xen-4.0.2-testing.orig/tools/examples/xend-config.sxp
+++ xen-4.0.2-testing/tools/examples/xend-config.sxp
@@ -277,3 +277,11 @@
# we have to realize this may incur security issue and we can't make sure the
# device assignment could really work properly even after we do this.
#(pci-passthrough-strict-check yes)
+
+# If we have a very big scsi device configuration, start of xend is slow,
+# because xend scans all the device paths to build its internal PSCSI device
+# list. If we need only a few devices for assigning to a guest, we can reduce
+# the scan to this device. Set list list of device paths in same syntax like in
+# command lsscsi, e.g. ('16:0:0:0' '15:0')
+# (pscsi-device-mask ('*'))
+
Index: xen-4.0.2-testing/tools/python/xen/util/vscsi_util.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/util/vscsi_util.py
+++ xen-4.0.2-testing/tools/python/xen/util/vscsi_util.py
@@ -148,11 +148,12 @@ def _vscsi_get_scsidevices_by_sysfs():
return devices
-def vscsi_get_scsidevices():
+def vscsi_get_scsidevices(mask=""):
""" get all scsi devices information """
- devices = _vscsi_get_scsidevices_by_lsscsi("")
- if devices:
+ devices = _vscsi_get_scsidevices_by_lsscsi("[%s]" % mask)
+ if devices or (len(mask) and mask[0] != "*"):
+ # devices found or partial device scan
return devices
return _vscsi_get_scsidevices_by_sysfs()
@@ -274,9 +275,9 @@ def get_scsi_device(pHCTL):
return _make_scsi_record(scsi_info)
return None
-def get_all_scsi_devices():
+def get_all_scsi_devices(mask=""):
scsi_records = []
- for scsi_info in vscsi_get_scsidevices():
+ for scsi_info in vscsi_get_scsidevices(mask):
scsi_record = _make_scsi_record(scsi_info)
scsi_records.append(scsi_record)
return scsi_records
Index: xen-4.0.2-testing/tools/python/xen/xend/XendNode.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/xend/XendNode.py
+++ xen-4.0.2-testing/tools/python/xen/xend/XendNode.py
@@ -323,7 +323,12 @@ class XendNode:
pscsi_table = {}
pscsi_HBA_table = {}
- for pscsi_record in vscsi_util.get_all_scsi_devices():
+ pscsi_records = []
+ for pscsi_mask in xendoptions().get_pscsi_device_mask():
+ pscsi_records += vscsi_util.get_all_scsi_devices(pscsi_mask)
+ log.debug("pscsi record count: %s" % len(pscsi_records))
+
+ for pscsi_record in pscsi_records:
scsi_id = pscsi_record['scsi_id']
if scsi_id:
saved_HBA_uuid = None
Index: xen-4.0.2-testing/tools/python/xen/xend/XendOptions.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/xend/XendOptions.py
+++ xen-4.0.2-testing/tools/python/xen/xend/XendOptions.py
@@ -164,6 +164,9 @@ class XendOptions:
"""
print >>sys.stderr, "xend [ERROR]", fmt % args
+ """Default mask for pscsi device scan."""
+ xend_pscsi_device_mask = ['*']
+
def configure(self):
self.set_config()
@@ -430,6 +433,10 @@ class XendOptions:
return self.get_config_bool("pci-passthrough-strict-check",
self.pci_dev_assign_strict_check_default)
+ def get_pscsi_device_mask(self):
+ return self.get_config_value("pscsi-device-mask",
+ self.xend_pscsi_device_mask)
+
class XendOptionsFile(XendOptions):
"""Default path to the config file."""

View File

@ -1,90 +0,0 @@
# HG changeset patch
# User Lutz Dube <lutz.dube@ts.fujitsu.com>
# Date 1280245980 -3600
# Node ID e017930af272c888f2a562f842af4e142a973d5f
# Parent 5078f2c1e3d6a3a06ecf352a068eb496f09a2a98
xend (XenAPI): Error in Xend-API method VM_set_actions_after_crash
Xend-API defines the method VM_set_actions_after_crash with valid
action names coredump_and_destroy, coredump_and_restart,... . These
values have to be converted into internal representation
"coredump-destroy", "coredump-restart", ... otherwise start of the
domain is rejected. Same error occurs, if I try to create a VM using
the Xend-API with actions_after_crash set to coredump_and_destroy.
Could you please apply my patch to xen-4-0-testing, too.
Signed-off-by: Lutz Dube Lutz.Dube@ts.fujitsu.com
Acked-by: Jim Fehlig <jfehlig@novell.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Index: xen-4.0.2-testing/tools/python/xen/xend/XendAPI.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/xend/XendAPI.py
+++ xen-4.0.2-testing/tools/python/xen/xend/XendAPI.py
@@ -1667,7 +1667,8 @@ class XendAPI(object):
def VM_set_actions_after_crash(self, session, vm_ref, action):
if action not in XEN_API_ON_CRASH_BEHAVIOUR:
return xen_api_error(['VM_ON_CRASH_BEHAVIOUR_INVALID', vm_ref])
- return self.VM_set('actions_after_crash', session, vm_ref, action)
+ return self.VM_set('actions_after_crash', session, vm_ref,
+ XEN_API_ON_CRASH_BEHAVIOUR_LEGACY[action])
def VM_set_HVM_boot_policy(self, session, vm_ref, value):
if value != "" and value != "BIOS order":
Index: xen-4.0.2-testing/tools/python/xen/xend/XendAPIConstants.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/xend/XendAPIConstants.py
+++ xen-4.0.2-testing/tools/python/xen/xend/XendAPIConstants.py
@@ -63,6 +63,18 @@ XEN_API_ON_CRASH_BEHAVIOUR_FILTER = {
'rename_restart' : 'rename_restart',
}
+XEN_API_ON_CRASH_BEHAVIOUR_LEGACY = {
+ 'destroy' : 'destroy',
+ 'coredump-destroy' : 'coredump-destroy',
+ 'coredump_and_destroy' : 'coredump-destroy',
+ 'restart' : 'restart',
+ 'coredump-restart' : 'coredump-restart',
+ 'coredump_and_restart' : 'coredump-restart',
+ 'preserve' : 'preserve',
+ 'rename-restart' : 'rename-restart',
+ 'rename_restart' : 'rename-restart',
+}
+
XEN_API_VBD_MODE = ['RO', 'RW']
XEN_API_VDI_TYPE = ['system', 'user', 'ephemeral']
XEN_API_VBD_TYPE = ['CD', 'Disk']
Index: xen-4.0.2-testing/tools/python/xen/xend/XendConfig.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/xend/XendConfig.py
+++ xen-4.0.2-testing/tools/python/xen/xend/XendConfig.py
@@ -41,6 +41,7 @@ from xen.util.pci import pci_opts_list_f
from xen.xend.XendSXPDev import dev_dict_to_sxp
from xen.util import xsconstants
from xen.util import auxbin
+from xen.xend.XendAPIConstants import *
import xen.util.fileuri
log = logging.getLogger("xend.XendConfig")
@@ -62,6 +63,11 @@ def reverse_dict(adict):
def bool0(v):
return v != '0' and v != 'False' and bool(v)
+def convert_on_crash(v):
+ v = str(v)
+ return XEN_API_ON_CRASH_BEHAVIOUR_LEGACY[v] \
+ if v in XEN_API_ON_CRASH_BEHAVIOUR else v
+
# Recursively copy a data struct, scrubbing out VNC passwords.
# Will scrub any dict entry with a key of 'vncpasswd' or any
# 2-element list whose first member is 'vncpasswd'. It will
@@ -211,7 +217,7 @@ XENAPI_CFG_TYPES = {
'VCPUs_live': int,
'actions_after_shutdown': str,
'actions_after_reboot': str,
- 'actions_after_crash': str,
+ 'actions_after_crash': convert_on_crash,
'PV_bootloader': str,
'PV_kernel': str,
'PV_ramdisk': str,

View File

@ -1,52 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1280486194 -3600
# Node ID c9e7850ec9a18d7085c7468407e175bb64513846
# Parent 754877be695ba3050f140002dbd185a27a437fcc
x86: unmask CPUID levels on Intel CPUs
References: bnc#640773
If the CPUID limit bit in MSR_IA32_MISC_ENABLE is set, clear it to
make all CPUID information available. This is required for some
features to work, such as MWAIT in cpuidle, get cpu topology, XSAVE,
etc.
Signed-off-by: Wei Gang <gang.wei@intel.com>
Index: xen-4.0.2-testing/xen/arch/x86/cpu/intel.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/cpu/intel.c
+++ xen-4.0.2-testing/xen/arch/x86/cpu/intel.c
@@ -90,6 +90,20 @@ void __devinit early_intel_workaround(st
/* Netburst reports 64 bytes clflush size, but does IO in 128 bytes */
if (c->x86 == 15 && c->x86_cache_alignment == 64)
c->x86_cache_alignment = 128;
+
+ /* Unmask CPUID levels if masked: */
+ if (c->x86 > 6 || (c->x86 == 6 && c->x86_model >= 0xd)) {
+ u64 misc_enable;
+
+ rdmsrl(MSR_IA32_MISC_ENABLE, misc_enable);
+
+ if (misc_enable & MSR_IA32_MISC_ENABLE_LIMIT_CPUID) {
+ misc_enable &= ~MSR_IA32_MISC_ENABLE_LIMIT_CPUID;
+ wrmsrl(MSR_IA32_MISC_ENABLE, misc_enable);
+ c->cpuid_level = cpuid_eax(0);
+ printk("revised cpuid_level = %d\n", c->cpuid_level);
+ }
+ }
}
/*
Index: xen-4.0.2-testing/xen/include/asm-x86/msr-index.h
===================================================================
--- xen-4.0.2-testing.orig/xen/include/asm-x86/msr-index.h
+++ xen-4.0.2-testing/xen/include/asm-x86/msr-index.h
@@ -324,6 +324,7 @@
#define MSR_IA32_MISC_ENABLE_BTS_UNAVAIL (1<<11)
#define MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL (1<<12)
#define MSR_IA32_MISC_ENABLE_MONITOR_ENABLE (1<<18)
+#define MSR_IA32_MISC_ENABLE_LIMIT_CPUID (1<<22)
#define MSR_IA32_MISC_ENABLE_XTPR_DISABLE (1<<23)
/* Intel Model 6 */

View File

@ -1,32 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1282069957 -3600
# Node ID 5218db847b58a151d8f320b7141efc984f759b35
# Parent 542e8cd16a6cf036e89b597ba6343245fcaafa25
x86 cpuidle: check whether cpu is online in cpu idle control
We observed a 2.6.18.8 dom0 kernel crash when Xen has maxcpus < num
of physical cores (maxcpus=3D4 for a 12-core system). It appeared that
hypervisor doesn't check whether CPU is online or not. This small
patch fixed the issue.
Signed-off-by: Uwe Dannowski <uwe.dannowski@amd.com>
Acked-by: Wei Huang <wei.huang2@amd.com>
Index: xen-4.0.2-testing/xen/arch/x86/acpi/cpuidle_menu.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/acpi/cpuidle_menu.c
+++ xen-4.0.2-testing/xen/arch/x86/acpi/cpuidle_menu.c
@@ -270,9 +270,10 @@ static void menu_reflect(struct acpi_pro
static int menu_enable_device(struct acpi_processor_power *power)
{
- struct menu_device *data = &per_cpu(menu_devices, power->cpu);
+ if (!cpu_online(power->cpu))
+ return -1;
- memset(data, 0, sizeof(struct menu_device));
+ memset(&per_cpu(menu_devices, power->cpu), 0, sizeof(struct menu_device));
return 0;
}

View File

@ -1,87 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1285340079 -3600
# Node ID 71f836615ea211ac4e6f3b9793f58c6f6934c030
# Parent eb247ea9db8c8b541a7f8c9cdc51c064c4c9e41c
x86: adjust MSR_IA32_MISC_ENABLE handling
In the warning message issued on writes, the Xen-modified value should
be printed (and used to determine whether anything needs to be printed
at all), as the guest kernel will usually do a read-modify-write
cycle.
A question is whether Dom0 shouldn't be allowed control over some
bits, or whether some bits shouldn't be fully virtualized. I'm
particularly thinking of MSR_IA32_MISC_ENABLE_FAST_STRING, which
recent Linux kernels want to disable for CONFIG_KMEMCHECK.
While putting this together I also noticed that rdmsr_safe() failed to
initialize its output registers in the failure path, thus leading to
printing of uninitialized data in the guest WRMSR warning message.
Further, the default case value-changed check can be simplified.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-4.0.2-testing/xen/arch/x86/traps.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/traps.c
+++ xen-4.0.2-testing/xen/arch/x86/traps.c
@@ -1679,6 +1679,16 @@ unsigned long guest_to_host_gpr_switch(u
void (*pv_post_outb_hook)(unsigned int port, u8 value);
+static inline uint32_t guest_misc_enable(uint32_t eax)
+{
+ eax &= ~(MSR_IA32_MISC_ENABLE_PERF_AVAIL |
+ MSR_IA32_MISC_ENABLE_MONITOR_ENABLE);
+ eax |= MSR_IA32_MISC_ENABLE_BTS_UNAVAIL |
+ MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL |
+ MSR_IA32_MISC_ENABLE_XTPR_DISABLE;
+ return eax;
+}
+
/* Instruction fetch with error handling. */
#define insn_fetch(type, base, eip, limit) \
({ unsigned long _rc, _ptr = (base) + (eip); \
@@ -2276,6 +2286,13 @@ static int emulate_privileged_op(struct
if ( wrmsr_safe(MSR_FAM10H_MMIO_CONF_BASE, eax, edx) != 0 )
goto fail;
break;
+ case MSR_IA32_MISC_ENABLE:
+ if ( rdmsr_safe(regs->ecx, l, h) )
+ goto invalid;
+ l = guest_misc_enable(l);
+ if ( eax != l || edx != h )
+ goto invalid;
+ break;
case MSR_IA32_MPERF:
case MSR_IA32_APERF:
if (( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ) &&
@@ -2382,11 +2399,7 @@ static int emulate_privileged_op(struct
case MSR_IA32_MISC_ENABLE:
if ( rdmsr_safe(regs->ecx, regs->eax, regs->edx) )
goto fail;
- regs->eax &= ~(MSR_IA32_MISC_ENABLE_PERF_AVAIL |
- MSR_IA32_MISC_ENABLE_MONITOR_ENABLE);
- regs->eax |= MSR_IA32_MISC_ENABLE_BTS_UNAVAIL |
- MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL |
- MSR_IA32_MISC_ENABLE_XTPR_DISABLE;
+ regs->eax = guest_misc_enable(regs->eax);
break;
case MSR_EFER:
case MSR_AMD_PATCHLEVEL:
Index: xen-4.0.2-testing/xen/include/asm-x86/msr.h
===================================================================
--- xen-4.0.2-testing.orig/xen/include/asm-x86/msr.h
+++ xen-4.0.2-testing/xen/include/asm-x86/msr.h
@@ -39,7 +39,8 @@ static inline void wrmsrl(unsigned int m
__asm__ __volatile__( \
"1: rdmsr\n2:\n" \
".section .fixup,\"ax\"\n" \
- "3: movl %5,%2\n; jmp 2b\n" \
+ "3: xor %0,%0\n; xor %1,%1\n" \
+ " movl %5,%2\n; jmp 2b\n" \
".previous\n" \
".section __ex_table,\"a\"\n" \
" "__FIXUP_ALIGN"\n" \

View File

@ -1,70 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1286784105 -3600
# Node ID a1405385db77c7c81aac27bd88d6c4b2d90b1389
# Parent a33886146b45da46a5161a7ebed4d2f607642aee
x86: emulate MSR_IA32_UCODE_REV Intel access protocol
Intel requires a write of zeros (hence such writes now get silently
ignored) followed by a cpuid(1) followed by the actual read.
Includes some code redundancy elimination possible after the actual
change.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-4.0.2-testing/xen/arch/x86/traps.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/traps.c
+++ xen-4.0.2-testing/xen/arch/x86/traps.c
@@ -2286,6 +2286,14 @@ static int emulate_privileged_op(struct
if ( wrmsr_safe(MSR_FAM10H_MMIO_CONF_BASE, eax, edx) != 0 )
goto fail;
break;
+ case MSR_IA32_UCODE_REV:
+ if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
+ goto fail;
+ if ( rdmsr_safe(regs->ecx, l, h) )
+ goto fail;
+ if ( l | h )
+ goto invalid;
+ break;
case MSR_IA32_MISC_ENABLE:
if ( rdmsr_safe(regs->ecx, l, h) )
goto invalid;
@@ -2393,16 +2401,21 @@ static int emulate_privileged_op(struct
regs->eax = regs->edx = 0;
break;
}
- if ( rdmsr_safe(regs->ecx, regs->eax, regs->edx) != 0 )
- goto fail;
- break;
+ goto rdmsr_normal;
+ case MSR_IA32_UCODE_REV:
+ BUILD_BUG_ON(MSR_IA32_UCODE_REV != MSR_AMD_PATCHLEVEL);
+ if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL )
+ {
+ if ( wrmsr_safe(MSR_IA32_UCODE_REV, 0, 0) )
+ goto fail;
+ sync_core();
+ }
+ goto rdmsr_normal;
case MSR_IA32_MISC_ENABLE:
if ( rdmsr_safe(regs->ecx, regs->eax, regs->edx) )
goto fail;
regs->eax = guest_misc_enable(regs->eax);
break;
- case MSR_EFER:
- case MSR_AMD_PATCHLEVEL:
default:
if ( rdmsr_hypervisor_regs(regs->ecx, &val) )
{
@@ -2418,6 +2431,8 @@ static int emulate_privileged_op(struct
if ( rc )
goto rdmsr_writeback;
+ case MSR_EFER:
+ rdmsr_normal:
/* Everyone can read the MSR space. */
/* gdprintk(XENLOG_WARNING,"Domain attempted RDMSR %p.\n",
_p(regs->ecx));*/

View File

@ -1,186 +0,0 @@
# HG changeset patch
# User Stephan Peijnik <spe@anexia.at>
# Date 1286816093 -3600
# Node ID b8cc53d22545706b28c7a26dffd24f192a76541a
# Parent fbce8e403470db8c9e580a5efd9d717cd2260c1f
Replace pyxml/xmlproc-based XML validator with lxml based one
Pyxml/xmlproc is being used in tools/xen/xm/xenapi_create.py but is
unmaintained for several years now. xmlproc is used only for validating
XML documents against a DTD file.
This patch replaces the pyxml/xmlproc based XML validation with code
based on lxml, which is actively maintained.
Signed-off-by: Stephan Peijnik <spe@anexia.at>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Index: xen-4.0.2-testing/README
===================================================================
--- xen-4.0.2-testing.orig/README
+++ xen-4.0.2-testing/README
@@ -137,12 +137,15 @@ Python Runtime Libraries
Xend (the Xen daemon) has the following runtime dependencies:
* Python 2.3 or later.
- In many distros, the XML-aspects to the standard library
+ In some distros, the XML-aspects to the standard library
(xml.dom.minidom etc) are broken out into a separate python-xml package.
This is also required.
+ In more recent versions of Debian and Ubuntu the XML-aspects are included
+ in the base python package however (python-xml has been removed
+ from Debian in squeeze and from Ubuntu in intrepid).
URL: http://www.python.org/
- Debian: python, python-xml
+ Debian: python
* For optional SSL support, pyOpenSSL:
URL: http://pyopenssl.sourceforge.net/
@@ -153,8 +156,9 @@ Xend (the Xen daemon) has the following
Debian: python-pam
* For optional XenAPI support in XM, PyXML:
- URL: http://pyxml.sourceforge.net
- YUM: PyXML
+ URL: http://codespeak.net/lxml/
+ Debian: python-lxml
+ YUM: python-lxml
Intel(R) Trusted Execution Technology Support
Index: xen-4.0.2-testing/tools/python/xen/xm/xenapi_create.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/xm/xenapi_create.py
+++ xen-4.0.2-testing/tools/python/xen/xm/xenapi_create.py
@@ -14,13 +14,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#============================================================================
# Copyright (C) 2007 Tom Wilkie <tom.wilkie@gmail.com>
+# Copyright (C) 2010 ANEXIA Internetdienstleistungs GmbH
+# Author: Stephan Peijnik <spe@anexia.at>
#============================================================================
"""Domain creation using new XenAPI
"""
from xen.xm.main import server, get_default_SR
from xml.dom.minidom import parse, getDOMImplementation
-from xml.parsers.xmlproc import xmlproc, xmlval, xmldtd
+from lxml import etree
from xen.xend import sxp
from xen.xend.XendAPIConstants import XEN_API_ON_NORMAL_EXIT, \
XEN_API_ON_CRASH_BEHAVIOUR
@@ -35,6 +37,7 @@ import os
from os.path import join
import traceback
import re
+import warnings # Used by lxml-based validator
def log(_, msg):
#print "> " + msg
@@ -118,12 +121,21 @@ class xenapi_create:
Use this if possible as it gives nice
error messages
"""
- dtd = xmldtd.load_dtd(self.dtd)
- parser = xmlproc.XMLProcessor()
- parser.set_application(xmlval.ValidatingApp(dtd, parser))
- parser.dtd = dtd
- parser.ent = dtd
- parser.parse_resource(file)
+ try:
+ dtd = etree.DTD(open(self.dtd, 'r'))
+ except IOError:
+ # The old code did neither raise an exception here, nor
+ # did it report an error. For now we issue a warning.
+ # TODO: How to handle a missing dtd file?
+ # --sp
+ warnings.warn('DTD file %s not found.' % (self.dtd),
+ UserWarning)
+ return
+
+ tree = etree.parse(file)
+ root = tree.getroot()
+ if not dtd.validate(root):
+ self.handle_dtd_errors(dtd)
def check_dom_against_dtd(self, dom):
"""
@@ -131,49 +143,36 @@ class xenapi_create:
Doesn't give as nice error messages.
(no location info)
"""
- dtd = xmldtd.load_dtd(self.dtd)
- app = xmlval.ValidatingApp(dtd, self)
- app.set_locator(self)
- self.dom2sax(dom, app)
-
- # Get errors back from ValidatingApp
- def report_error(self, number, args=None):
- self.errors = xmlproc.errors.english
try:
- msg = self.errors[number]
- if args != None:
- msg = msg % args
- except KeyError:
- msg = self.errors[4002] % number # Unknown err msg :-)
- print msg
+ dtd = etree.DTD(open(self.dtd, 'r'))
+ except IOError:
+ # The old code did neither raise an exception here, nor
+ # did it report an error. For now we issue a warning.
+ # TODO: How to handle a missing dtd file?
+ # --sp
+ warnings.warn('DTD file %s not found.' % (self.dtd),
+ UserWarning)
+ return
+
+ # XXX: This may be a bit slow. Maybe we should use another way
+ # of getting an etree root element from the minidom DOM tree...
+ # -- sp
+ root = etree.XML(dom.toxml())
+ if not dtd.validate(root):
+ self.handle_dtd_errors(dtd)
+
+ # Do the same that was done in report_error before. This is directly
+ # called by check_dtd and check_dom_against_dtd.
+ # We are using sys.stderr instead of print though (python3k clean).
+ def handle_dtd_errors(self, dtd):
+ # XXX: Do we really want to bail out here?
+ # -- sp
+ for err in dtd.error_log:
+ err_str = 'ERROR: %s\n' % (str(err),)
+ sys.stderr.write(err_str)
+ sys.stderr.flush()
sys.exit(-1)
- # Here for compatibility with ValidatingApp
- def get_line(self):
- return -1
-
- def get_column(self):
- return -1
-
- def dom2sax(self, dom, app):
- """
- Take a dom tree and tarverse it,
- issuing SAX calls to app.
- """
- for child in dom.childNodes:
- if child.nodeType == child.TEXT_NODE:
- data = child.nodeValue
- app.handle_data(data, 0, len(data))
- else:
- app.handle_start_tag(
- child.nodeName,
- self.attrs_to_dict(child.attributes))
- self.dom2sax(child, app)
- app.handle_end_tag(child.nodeName)
-
- def attrs_to_dict(self, attrs):
- return dict(attrs.items())
-
#
# Checks which cannot be done with dtd
#

View File

@ -1,43 +0,0 @@
# HG changeset patch
# User Juergen Gross <juergen.gross@ts.fujitsu.com>
# Date 1288264929 -3600
# Node ID dc66c13a29f9af67e0258f688bcd6330cf515383
# Parent 4ac03710fc320e8f76014ca27849da03b85dff9d
avoid numa placement of cpus with active cpupools
When using cpupools don't pin vcpus to numa nodes as this might
conflict with the cpupool definition.
numa placement should be handled by cpupool configuration instead.
Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Index: xen-4.0.2-testing/tools/python/xen/xend/XendCPUPool.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/xend/XendCPUPool.py
+++ xen-4.0.2-testing/tools/python/xen/xend/XendCPUPool.py
@@ -881,6 +881,11 @@ class XendCPUPool(XendBase):
lookup_pool = classmethod(lookup_pool)
+ def number_of_pools(cls):
+ return len(xc.cpupool_getinfo())
+
+ number_of_pools = classmethod(number_of_pools)
+
def _cpu_number_to_ref(cls, number):
node = XendNode.instance()
for cpu_ref in node.get_host_cpu_refs():
Index: xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -2790,7 +2790,7 @@ class XendDomainInfo:
return map(lambda x: x[0], sorted(enumerate(nodeload), key=lambda x:x[1]))
info = xc.physinfo()
- if info['nr_nodes'] > 1:
+ if info['nr_nodes'] > 1 and XendCPUPool.number_of_pools() < 2:
node_memory_list = info['node_to_memory']
needmem = self.image.getRequiredAvailableMemory(self.info['memory_dynamic_max']) / 1024
candidate_node_list = []

View File

@ -1,750 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1288344554 -3600
# Node ID b48d8f27fca251c2df0222d195ffcb772d6a1128
# Parent 2d5e8f4ac43a120bbb5d4c52d08f6980848f0166
vtd: consolidate VT-d quirks into a single file quirks.c
Consolidate VT-d quirks into a single file - quirks.c. This includes
quirks to workaround OEM BIOS issue with VT-d enabling in IGD, Cantiga
VT-d buffer flush issue, Cantiga IGD Vt-d low power related errata,
and a quirk to workaround issues related to wifi direct assignment.
Signed-off-by: Allen Kay <allen.m.kay@intel.com>
Reviewed-by: Jan Beulich <JBeulich@novell.com>
# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1288888517 0
# Node ID fedcd4cbcc1eb3e210628bdf95766ca0c400fc18
# Parent d508b18a68447f91cd879b79a498f06536d89f8e
[VTD] fix a typo and some minor cleanup of quirks.c
Fixed a typo for IGD_DEV define and some minor cleanup to ease future
enhancement.
Signed-off-by: Allen Kay <allen.m.kay@intel.com>
# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1294221021 0
# Node ID e635e6641c07ee2da66b16f46f45442c9a46821d
# Parent 76d897a06b316bf2278220b006d578faf31ce3fb
[VTD] added WLAN device ID on Fujitsu's platform in quirks.c
Added WLAN device ID 0x422C that was found on Fujitsu's Calpella
system to WLAN quirk.
Signed-off-by: Allen Kay <allen.m.kay@intel.com>
--- a/xen/drivers/passthrough/vtd/Makefile
+++ b/xen/drivers/passthrough/vtd/Makefile
@@ -6,3 +6,4 @@ obj-y += dmar.o
obj-y += utils.o
obj-y += qinval.o
obj-y += intremap.o
+obj-y += quirks.o
--- a/xen/drivers/passthrough/vtd/dmar.c
+++ b/xen/drivers/passthrough/vtd/dmar.c
@@ -242,7 +242,7 @@ struct acpi_rhsa_unit * drhd_to_rhsa(str
int is_igd_drhd(struct acpi_drhd_unit *drhd)
{
- return ( drhd->address == igd_drhd_address ? 1 : 0);
+ return drhd && (drhd->address == igd_drhd_address);
}
/*
@@ -278,8 +278,7 @@ static int scope_device_count(void *star
static int __init acpi_parse_dev_scope(void *start, void *end,
- void *acpi_entry, int type,
- int *igd)
+ void *acpi_entry, int type)
{
struct dmar_scope *scope = acpi_entry;
struct acpi_ioapic_unit *acpi_ioapic_unit;
@@ -340,8 +339,15 @@ static int __init acpi_parse_dev_scope(v
if ( iommu_verbose )
dprintk(VTDPREFIX, " endpoint: %x:%x.%x\n",
bus, path->dev, path->fn);
- if ( (bus == 0) && (path->dev == 2) && (path->fn == 0) )
- *igd = 1;
+
+ if ( type == DMAR_TYPE )
+ {
+ struct acpi_drhd_unit *drhd = acpi_entry;
+
+ if ( (bus == 0) && (path->dev == 2) && (path->fn == 0) )
+ igd_drhd_address = drhd->address;
+ }
+
break;
case ACPI_DEV_IOAPIC:
@@ -388,7 +394,7 @@ acpi_parse_one_drhd(struct acpi_dmar_ent
struct acpi_table_drhd * drhd = (struct acpi_table_drhd *)header;
void *dev_scope_start, *dev_scope_end;
struct acpi_drhd_unit *dmaru;
- int ret, igd = 0;
+ int ret;
static int include_all = 0;
if ( (ret = acpi_dmar_check_length(header, sizeof(*drhd))) != 0 )
@@ -413,10 +419,7 @@ acpi_parse_one_drhd(struct acpi_dmar_ent
dev_scope_start = (void *)(drhd + 1);
dev_scope_end = ((void *)drhd) + header->length;
ret = acpi_parse_dev_scope(dev_scope_start, dev_scope_end,
- dmaru, DMAR_TYPE, &igd);
-
- if ( igd )
- igd_drhd_address = dmaru->address;
+ dmaru, DMAR_TYPE);
if ( dmaru->include_all )
{
@@ -504,7 +507,7 @@ acpi_parse_one_rmrr(struct acpi_dmar_ent
struct acpi_rmrr_unit *rmrru;
void *dev_scope_start, *dev_scope_end;
u64 base_addr = rmrr->base_address, end_addr = rmrr->end_address;
- int ret, igd = 0;
+ int ret;
if ( (ret = acpi_dmar_check_length(header, sizeof(*rmrr))) != 0 )
return ret;
@@ -536,7 +539,7 @@ acpi_parse_one_rmrr(struct acpi_dmar_ent
dev_scope_start = (void *)(rmrr + 1);
dev_scope_end = ((void *)rmrr) + header->length;
ret = acpi_parse_dev_scope(dev_scope_start, dev_scope_end,
- rmrru, RMRR_TYPE, &igd);
+ rmrru, RMRR_TYPE);
if ( ret || (rmrru->scope.devices_cnt == 0) )
xfree(rmrru);
@@ -601,7 +604,7 @@ acpi_parse_one_atsr(struct acpi_dmar_ent
{
struct acpi_table_atsr *atsr = (struct acpi_table_atsr *)header;
struct acpi_atsr_unit *atsru;
- int ret, igd = 0;
+ int ret;
static int all_ports;
void *dev_scope_start, *dev_scope_end;
@@ -622,7 +625,7 @@ acpi_parse_one_atsr(struct acpi_dmar_ent
dev_scope_start = (void *)(atsr + 1);
dev_scope_end = ((void *)atsr) + header->length;
ret = acpi_parse_dev_scope(dev_scope_start, dev_scope_end,
- atsru, ATSR_TYPE, &igd);
+ atsru, ATSR_TYPE);
}
else
{
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -26,6 +26,7 @@
extern int qinval_enabled;
extern int ats_enabled;
+extern bool_t rwbf_quirk;
void print_iommu_regs(struct acpi_drhd_unit *drhd);
void print_vtd_entries(struct iommu *iommu, int bus, int devfn, u64 gmfn);
@@ -35,6 +36,12 @@ int enable_qinval(struct iommu *iommu);
void disable_qinval(struct iommu *iommu);
int enable_intremap(struct iommu *iommu, int eim);
void disable_intremap(struct iommu *iommu);
+
+void iommu_flush_cache_entry(void *addr, unsigned int size);
+void iommu_flush_cache_page(void *addr, unsigned long npages);
+int iommu_alloc(struct acpi_drhd_unit *drhd);
+void iommu_free(struct acpi_drhd_unit *drhd);
+
int queue_invalidate_context(struct iommu *iommu,
u16 did, u16 source_id, u8 function_mask, u8 granu);
int queue_invalidate_iotlb(struct iommu *iommu,
@@ -44,19 +51,41 @@ int queue_invalidate_iec(struct iommu *i
int invalidate_sync(struct iommu *iommu);
int iommu_flush_iec_global(struct iommu *iommu);
int iommu_flush_iec_index(struct iommu *iommu, u8 im, u16 iidx);
+void clear_fault_bits(struct iommu *iommu);
+
struct iommu * ioapic_to_iommu(unsigned int apic_id);
struct acpi_drhd_unit * ioapic_to_drhd(unsigned int apic_id);
struct acpi_drhd_unit * iommu_to_drhd(struct iommu *iommu);
struct acpi_rhsa_unit * drhd_to_rhsa(struct acpi_drhd_unit *drhd);
-void clear_fault_bits(struct iommu *iommu);
+struct acpi_drhd_unit * find_ats_dev_drhd(struct iommu *iommu);
+
int ats_device(int seg, int bus, int devfn);
int enable_ats_device(int seg, int bus, int devfn);
int disable_ats_device(int seg, int bus, int devfn);
int invalidate_ats_tcs(struct iommu *iommu);
+
int qinval_device_iotlb(struct iommu *iommu,
u32 max_invs_pend, u16 sid, u16 size, u64 addr);
int dev_invalidate_iotlb(struct iommu *iommu, u16 did,
u64 addr, unsigned int size_order, u64 type);
-struct acpi_drhd_unit * find_ats_dev_drhd(struct iommu *iommu);
+
+unsigned int get_cache_line_size(void);
+void cacheline_flush(char *);
+void flush_all_cache(void);
+
+u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages);
+void free_pgtable_maddr(u64 maddr);
+void *map_vtd_domain_page(u64 maddr);
+void unmap_vtd_domain_page(void *va);
+int domain_context_mapping_one(struct domain *domain, struct iommu *iommu,
+ u8 bus, u8 devfn);
+int domain_context_unmap_one(struct domain *domain, struct iommu *iommu,
+ u8 bus, u8 devfn);
+
+int is_igd_vt_enabled_quirk(void);
+void __init platform_quirks_init(void);
+void vtd_ops_preamble_quirk(struct iommu* iommu);
+void vtd_ops_postamble_quirk(struct iommu* iommu);
+void me_wifi_quirk(struct domain *domain, u8 bus, u8 devfn, int map);
#endif // _VTD_EXTERN_H_
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -43,7 +43,6 @@
#endif
int nr_iommus;
-static bool_t rwbf_quirk;
static void setup_dom0_devices(struct domain *d);
static void setup_dom0_rmrr(struct domain *d);
@@ -481,16 +480,36 @@ static int inline iommu_flush_iotlb_glob
int flush_non_present_entry, int flush_dev_iotlb)
{
struct iommu_flush *flush = iommu_get_flush(iommu);
- return flush->iotlb(iommu, 0, 0, 0, DMA_TLB_GLOBAL_FLUSH,
+ int status;
+
+ /* apply platform specific errata workarounds */
+ vtd_ops_preamble_quirk(iommu);
+
+ status = flush->iotlb(iommu, 0, 0, 0, DMA_TLB_GLOBAL_FLUSH,
flush_non_present_entry, flush_dev_iotlb);
+
+ /* undo platform specific errata workarounds */
+ vtd_ops_postamble_quirk(iommu);
+
+ return status;
}
static int inline iommu_flush_iotlb_dsi(struct iommu *iommu, u16 did,
int flush_non_present_entry, int flush_dev_iotlb)
{
struct iommu_flush *flush = iommu_get_flush(iommu);
- return flush->iotlb(iommu, did, 0, 0, DMA_TLB_DSI_FLUSH,
+ int status;
+
+ /* apply platform specific errata workarounds */
+ vtd_ops_preamble_quirk(iommu);
+
+ status = flush->iotlb(iommu, did, 0, 0, DMA_TLB_DSI_FLUSH,
flush_non_present_entry, flush_dev_iotlb);
+
+ /* undo platform specific errata workarounds */
+ vtd_ops_postamble_quirk(iommu);
+
+ return status;
}
static int inline get_alignment(u64 base, unsigned int size)
@@ -514,6 +533,7 @@ static int inline iommu_flush_iotlb_psi(
{
unsigned int align;
struct iommu_flush *flush = iommu_get_flush(iommu);
+ int status;
ASSERT(!(addr & (~PAGE_MASK_4K)));
ASSERT(pages > 0);
@@ -534,8 +554,16 @@ static int inline iommu_flush_iotlb_psi(
addr >>= PAGE_SHIFT_4K + align;
addr <<= PAGE_SHIFT_4K + align;
- return flush->iotlb(iommu, did, addr, align, DMA_TLB_PSI_FLUSH,
+ /* apply platform specific errata workarounds */
+ vtd_ops_preamble_quirk(iommu);
+
+ status = flush->iotlb(iommu, did, addr, align, DMA_TLB_PSI_FLUSH,
flush_non_present_entry, flush_dev_iotlb);
+
+ /* undo platform specific errata workarounds */
+ vtd_ops_postamble_quirk(iommu);
+
+ return status;
}
static void iommu_flush_all(void)
@@ -688,24 +716,13 @@ static int iommu_set_root_entry(struct i
return 0;
}
-#define GGC 0x52
-#define GGC_MEMORY_VT_ENABLED (0x8 << 8)
-static int is_igd_vt_enabled(void)
-{
- unsigned short ggc;
-
- /* integrated graphics on Intel platforms is located at 0:2.0 */
- ggc = pci_conf_read16(0, 2, 0, GGC);
- return ( ggc & GGC_MEMORY_VT_ENABLED ? 1 : 0 );
-}
-
static void iommu_enable_translation(struct acpi_drhd_unit *drhd)
{
u32 sts;
unsigned long flags;
struct iommu *iommu = drhd->iommu;
- if ( !is_igd_vt_enabled() && is_igd_drhd(drhd) )
+ if ( is_igd_drhd(drhd) && !is_igd_vt_enabled_quirk() )
{
if ( force_iommu )
panic("BIOS did not enable IGD for VT properly, crash Xen for security purpose!\n");
@@ -717,6 +734,9 @@ static void iommu_enable_translation(str
}
}
+ /* apply platform specific errata workarounds */
+ vtd_ops_preamble_quirk(iommu);
+
if ( iommu_verbose )
dprintk(VTDPREFIX,
"iommu_enable_translation: iommu->reg = %p\n", iommu->reg);
@@ -729,6 +749,9 @@ static void iommu_enable_translation(str
(sts & DMA_GSTS_TES), sts);
spin_unlock_irqrestore(&iommu->register_lock, flags);
+ /* undo platform specific errata workarounds */
+ vtd_ops_postamble_quirk(iommu);
+
/* Disable PMRs when VT-d engine takes effect per spec definition */
disable_pmr(iommu);
}
@@ -738,6 +761,9 @@ static void iommu_disable_translation(st
u32 sts;
unsigned long flags;
+ /* apply platform specific errata workarounds */
+ vtd_ops_preamble_quirk(iommu);
+
spin_lock_irqsave(&iommu->register_lock, flags);
sts = dmar_readl(iommu->reg, DMAR_GSTS_REG);
dmar_writel(iommu->reg, DMAR_GCMD_REG, sts & (~DMA_GCMD_TE));
@@ -746,6 +772,9 @@ static void iommu_disable_translation(st
IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG, dmar_readl,
!(sts & DMA_GSTS_TES), sts);
spin_unlock_irqrestore(&iommu->register_lock, flags);
+
+ /* undo platform specific errata workarounds */
+ vtd_ops_postamble_quirk(iommu);
}
enum faulttype {
@@ -1089,6 +1118,7 @@ int __init iommu_alloc(struct acpi_drhd_
xfree(iommu);
return -ENOMEM;
}
+ iommu->intel->drhd = drhd;
iommu->reg = map_to_nocache_virt(nr_iommus, drhd->address);
iommu->index = nr_iommus++;
@@ -1221,7 +1251,7 @@ static void intel_iommu_dom0_init(struct
}
}
-static int domain_context_mapping_one(
+int domain_context_mapping_one(
struct domain *domain,
struct iommu *iommu,
u8 bus, u8 devfn)
@@ -1324,6 +1354,8 @@ static int domain_context_mapping_one(
unmap_vtd_domain_page(context_entries);
+ me_wifi_quirk(domain, bus, devfn, MAP_ME_PHANTOM_FUNC);
+
return 0;
}
@@ -1398,7 +1430,7 @@ static int domain_context_mapping(struct
return ret;
}
-static int domain_context_unmap_one(
+int domain_context_unmap_one(
struct domain *domain,
struct iommu *iommu,
u8 bus, u8 devfn)
@@ -1446,6 +1478,8 @@ static int domain_context_unmap_one(
spin_unlock(&iommu->lock);
unmap_vtd_domain_page(context_entries);
+ me_wifi_quirk(domain, bus, devfn, UNMAP_ME_PHANTOM_FUNC);
+
return 0;
}
@@ -1945,19 +1979,6 @@ static void setup_dom0_rmrr(struct domai
spin_unlock(&pcidevs_lock);
}
-static void platform_quirks(void)
-{
- u32 id;
-
- /* Mobile 4 Series Chipset neglects to set RWBF capability. */
- id = pci_conf_read32(0, 0, 0, 0);
- if ( id == 0x2a408086 )
- {
- dprintk(XENLOG_INFO VTDPREFIX, "DMAR: Forcing write-buffer flush\n");
- rwbf_quirk = 1;
- }
-}
-
int intel_vtd_setup(void)
{
struct acpi_drhd_unit *drhd;
@@ -1966,7 +1987,7 @@ int intel_vtd_setup(void)
if ( list_empty(&acpi_drhd_units) )
return -ENODEV;
- platform_quirks();
+ platform_quirks_init();
irq_to_iommu = xmalloc_array(struct iommu*, nr_irqs);
BUG_ON(!irq_to_iommu);
--- a/xen/drivers/passthrough/vtd/iommu.h
+++ b/xen/drivers/passthrough/vtd/iommu.h
@@ -501,6 +501,7 @@ struct intel_iommu {
struct qi_ctrl qi_ctrl;
struct ir_ctrl ir_ctrl;
struct iommu_flush flush;
+ struct acpi_drhd_unit *drhd;
};
#endif
--- /dev/null
+++ b/xen/drivers/passthrough/vtd/quirks.c
@@ -0,0 +1,263 @@
+/*
+ * Copyright (c) 2010, Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * Author: Allen Kay <allen.m.kay@intel.com>
+ */
+
+#include <xen/irq.h>
+#include <xen/sched.h>
+#include <xen/xmalloc.h>
+#include <xen/domain_page.h>
+#include <xen/iommu.h>
+#include <asm/hvm/iommu.h>
+#include <xen/numa.h>
+#include <xen/softirq.h>
+#include <xen/time.h>
+#include <xen/pci.h>
+#include <xen/pci_regs.h>
+#include <xen/keyhandler.h>
+#include <asm/msi.h>
+#include <asm/irq.h>
+#include <mach_apic.h>
+#include "iommu.h"
+#include "dmar.h"
+#include "extern.h"
+#include "vtd.h"
+
+#define IOH_DEV 0
+#define IGD_DEV 2
+
+#define IGD_BAR_MASK 0xFFFFFFFFFFFF0000
+#define GGC 0x52
+#define GGC_MEMORY_VT_ENABLED (0x8 << 8)
+
+#define IS_CTG(id) (id == 0x2a408086)
+#define IS_ILK(id) (id == 0x00408086 || id == 0x00448086 || id== 0x00628086 || id == 0x006A8086)
+#define IS_CPT(id) (id == 0x01008086 || id == 0x01048086)
+
+u32 ioh_id;
+u32 igd_id;
+bool_t rwbf_quirk;
+static int is_cantiga_b3;
+static u8 *igd_reg_va;
+
+/*
+ * QUIRK to workaround Xen boot issue on Calpella/Ironlake OEM BIOS
+ * not enabling VT-d properly in IGD. The workaround is to not enabling
+ * IGD VT-d translation if VT is not enabled in IGD.
+ */
+int is_igd_vt_enabled_quirk(void)
+{
+ u16 ggc;
+
+ if ( !IS_ILK(ioh_id) )
+ return 1;
+
+ /* integrated graphics on Intel platforms is located at 0:2.0 */
+ ggc = pci_conf_read16(0, IGD_DEV, 0, GGC);
+ return ( ggc & GGC_MEMORY_VT_ENABLED ? 1 : 0 );
+}
+
+/*
+ * QUIRK to workaround cantiga VT-d buffer flush issue.
+ * The workaround is to force write buffer flush even if
+ * VT-d capability indicates it is not required.
+ */
+static void cantiga_b3_errata_init(void)
+{
+ u16 vid;
+ u8 did_hi, rid;
+
+ vid = pci_conf_read16(0, IGD_DEV, 0, 0);
+ if ( vid != 0x8086 )
+ return;
+
+ did_hi = pci_conf_read8(0, IGD_DEV, 0, 3);
+ rid = pci_conf_read8(0, IGD_DEV, 0, 8);
+
+ if ( (did_hi == 0x2A) && (rid == 0x7) )
+ is_cantiga_b3 = 1;
+}
+
+/*
+ * QUIRK to workaround Cantiga IGD VT-d low power errata.
+ * This errata impacts IGD assignment on Cantiga systems
+ * and can potentially cause VT-d operations to hang.
+ * The workaround is to access an IGD PCI config register
+ * to get IGD out of low power state before VT-d translation
+ * enable/disable and IOTLB flushes.
+ */
+
+/*
+ * map IGD MMIO+0x2000 page to allow Xen access to IGD 3D register.
+ */
+static void map_igd_reg(void)
+{
+ u64 igd_mmio, igd_reg;
+
+ if ( !is_cantiga_b3 || igd_reg_va != NULL )
+ return;
+
+ /* get IGD mmio address in PCI BAR */
+ igd_mmio = ((u64)pci_conf_read32(0, IGD_DEV, 0, 0x14) << 32) +
+ pci_conf_read32(0, IGD_DEV, 0, 0x10);
+
+ /* offset of IGD regster we want to access is in 0x2000 range */
+ igd_reg = (igd_mmio & IGD_BAR_MASK) + 0x2000;
+
+ /* ioremap this physical page */
+ set_fixmap_nocache(FIX_IGD_MMIO, igd_reg);
+ igd_reg_va = (u8 *)fix_to_virt(FIX_IGD_MMIO);
+}
+
+/*
+ * force IGD to exit low power mode by accessing a IGD 3D regsiter.
+ */
+static int cantiga_vtd_ops_preamble(struct iommu* iommu)
+{
+ struct intel_iommu *intel = iommu->intel;
+ struct acpi_drhd_unit *drhd = intel ? intel->drhd : NULL;
+
+ if ( !is_igd_drhd(drhd) || !is_cantiga_b3 )
+ return 0;
+
+ /*
+ * read IGD register at IGD MMIO + 0x20A4 to force IGD
+ * to exit low power state. Since map_igd_reg()
+ * already mapped page starting 0x2000, we just need to
+ * add page offset 0x0A4 to virtual address base.
+ */
+ return ( *((volatile int *)(igd_reg_va + 0x0A4)) );
+}
+
+/*
+ * call before VT-d translation enable and IOTLB flush operations.
+ */
+void vtd_ops_preamble_quirk(struct iommu* iommu)
+{
+ cantiga_vtd_ops_preamble(iommu);
+}
+
+/*
+ * call after VT-d translation enable and IOTLB flush operations.
+ */
+void vtd_ops_postamble_quirk(struct iommu* iommu)
+{
+ return;
+}
+
+/* initialize platform identification flags */
+void __init platform_quirks_init(void)
+{
+ ioh_id = pci_conf_read32(0, IOH_DEV, 0, 0);
+ igd_id = pci_conf_read32(0, IGD_DEV, 0, 0);
+
+ /* Mobile 4 Series Chipset neglects to set RWBF capability. */
+ if ( ioh_id == 0x2a408086 )
+ {
+ dprintk(XENLOG_INFO VTDPREFIX, "DMAR: Forcing write-buffer flush\n");
+ rwbf_quirk = 1;
+ }
+
+ /* initialize cantiga B3 identification */
+ cantiga_b3_errata_init();
+
+ /* ioremap IGD MMIO+0x2000 page */
+ map_igd_reg();
+}
+
+/*
+ * QUIRK to workaround wifi direct assignment issue. This issue
+ * impacts only cases where Intel integrated wifi device is directly
+ * is directly assigned to a guest.
+ *
+ * The workaround is to map ME phantom device 0:3.7 or 0:22.7
+ * to the ME vt-d engine if detect the user is trying to directly
+ * assigning Intel integrated wifi device to a guest.
+ */
+
+static void map_me_phantom_function(struct domain *domain, u32 dev, int map)
+{
+ struct acpi_drhd_unit *drhd;
+ struct pci_dev *pdev;
+
+ /* find ME VT-d engine base on a real ME device */
+ pdev = pci_get_pdev(0, PCI_DEVFN(dev, 0));
+ drhd = acpi_find_matched_drhd_unit(pdev);
+
+ /* map or unmap ME phantom function */
+ if ( map )
+ domain_context_mapping_one(domain, drhd->iommu, 0,
+ PCI_DEVFN(dev, 7));
+ else
+ domain_context_unmap_one(domain, drhd->iommu, 0,
+ PCI_DEVFN(dev, 7));
+}
+
+void me_wifi_quirk(struct domain *domain, u8 bus, u8 devfn, int map)
+{
+ u32 id;
+
+ id = pci_conf_read32(0, 0, 0, 0);
+ if ( IS_CTG(id) )
+ {
+ /* quit if ME does not exist */
+ if ( pci_conf_read32(0, 3, 0, 0) == 0xffffffff )
+ return;
+
+ /* if device is WLAN device, map ME phantom device 0:3.7 */
+ id = pci_conf_read32(bus, PCI_SLOT(devfn), PCI_FUNC(devfn), 0);
+ switch (id)
+ {
+ case 0x42328086:
+ case 0x42358086:
+ case 0x42368086:
+ case 0x42378086:
+ case 0x423a8086:
+ case 0x423b8086:
+ case 0x423c8086:
+ case 0x423d8086:
+ map_me_phantom_function(domain, 3, map);
+ break;
+ default:
+ break;
+ }
+ }
+ else if ( IS_ILK(id) || IS_CPT(id) )
+ {
+ /* quit if ME does not exist */
+ if ( pci_conf_read32(0, 22, 0, 0) == 0xffffffff )
+ return;
+
+ /* if device is WLAN device, map ME phantom device 0:22.7 */
+ id = pci_conf_read32(bus, PCI_SLOT(devfn), PCI_FUNC(devfn), 0);
+ switch (id)
+ {
+ case 0x00878086:
+ case 0x00898086:
+ case 0x00828086:
+ case 0x00858086:
+ case 0x42388086:
+ case 0x422b8086:
+ case 0x422c8086:
+ map_me_phantom_function(domain, 22, map);
+ break;
+ default:
+ break;
+ }
+
+ }
+}
--- a/xen/drivers/passthrough/vtd/vtd.h
+++ b/xen/drivers/passthrough/vtd/vtd.h
@@ -23,6 +23,9 @@
#include <xen/iommu.h>
+#define MAP_ME_PHANTOM_FUNC 1
+#define UNMAP_ME_PHANTOM_FUNC 0
+
/* Accomodate both IOAPIC and IOSAPIC. */
struct IO_xAPIC_route_entry {
__u32 vector : 8,
@@ -97,18 +100,4 @@ struct msi_msg_remap_entry {
u32 data; /* msi message data */
};
-unsigned int get_cache_line_size(void);
-void cacheline_flush(char *);
-void flush_all_cache(void);
-u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages);
-void free_pgtable_maddr(u64 maddr);
-void *map_vtd_domain_page(u64 maddr);
-void unmap_vtd_domain_page(void *va);
-
-void iommu_flush_cache_entry(void *addr, unsigned int size);
-void iommu_flush_cache_page(void *addr, unsigned long npages);
-
-int iommu_alloc(struct acpi_drhd_unit *drhd);
-void iommu_free(struct acpi_drhd_unit *drhd);
-
#endif // _VTD_H_
--- a/xen/drivers/passthrough/vtd/x86/vtd.c
+++ b/xen/drivers/passthrough/vtd/x86/vtd.c
@@ -27,6 +27,7 @@
#include "../iommu.h"
#include "../dmar.h"
#include "../vtd.h"
+#include "../extern.h"
/*
* iommu_inclusive_mapping: when set, all memory below 4GB is included in dom0
--- a/xen/include/asm-x86/fixmap.h
+++ b/xen/include/asm-x86/fixmap.h
@@ -52,6 +52,7 @@ enum fixed_addresses {
FIX_MSIX_IO_RESERV_BASE,
FIX_MSIX_IO_RESERV_END = FIX_MSIX_IO_RESERV_BASE + FIX_MSIX_MAX_PAGES -1,
FIX_TBOOT_MAP_ADDRESS,
+ FIX_IGD_MMIO,
__end_of_fixed_addresses
};

View File

@ -1,64 +0,0 @@
# HG changeset patch
# User Jim Fehlig <jfehlig@novell.com>
# Date 1288301229 21600
# Branch xend-pci
# Node ID 461b9d3a643a2c67c961d9fc468a804891f3770d
# Parent 28a16074681582f1209c9077f870ccf44927133e
Fix pci passthru in xend interface used by libvirt
Attempting to define or create a domain whose XML config contains a
passthru PCI device fails with libvirt
xen84: # cat win2k8r2.xml
...
<hostdev mode='subsystem' type='pci' managed='no'>
<source>
<address domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</source>
</hostdev>
...
xen84: # virsh create ./win2k8r2.xml
error: Failed to create domain from ./win2k8r2.xml
error: POST operation failed: xend_post: error from xen daemon:
(xend.err "Error creating domain: 'key'")
The PCI device config maintained by xend includes a 'key' field, which is
initialized by xm client when using that tool and traditional xen config
file. libvirt, which uses xend's sexpr-over-http interface (is that the
proper name for that interface??), does not initialize this field - and
shouldn't be expected to do so IMO. Clients should not be bothered with
xend's internal representation of a PCI device.
This patch populates the 'key' field within xend if it is uninitialized,
similar to current initialization of 'uuid' field. The 'vdevfn' field
suffers a similar problem if not (optionally) specified by user.
AFAICT, the xm client initializes 'vdevfn' to 0x100 if not specified so
I've done the same here.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
Index: xen-4.0.2-testing/tools/python/xen/util/pci.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/util/pci.py
+++ xen-4.0.2-testing/tools/python/xen/util/pci.py
@@ -240,10 +240,16 @@ def pci_convert_sxp_to_dict(dev_sxp):
pci_dev_info = dict(pci_dev[1:])
if 'opts' in pci_dev_info:
pci_dev_info['opts'] = pci_opts_list_from_sxp(pci_dev)
- # append uuid to each pci device that does't already have one.
+ # If necessary, initialize uuid, key, and vdevfn for each pci device
if not pci_dev_info.has_key('uuid'):
- dpci_uuid = pci_dev_info.get('uuid', uuid.createString())
- pci_dev_info['uuid'] = dpci_uuid
+ pci_dev_info['uuid'] = uuid.createString()
+ if not pci_dev_info.has_key('key'):
+ pci_dev_info['key'] = "%02x:%02x.%x" % \
+ (int(pci_dev_info['bus'], 16),
+ int(pci_dev_info['slot'], 16),
+ int(pci_dev_info['func'], 16))
+ if not pci_dev_info.has_key('vdevfn'):
+ pci_dev_info['vdevfn'] = "0x%02x" % AUTO_PHP_SLOT
pci_devs.append(pci_dev_info)
dev_config['devs'] = pci_devs

View File

@ -1,50 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1289813498 0
# Node ID 87f248de52304bc96a80dc093250fed0197f37e0
# Parent 8af10bd7f2d0e9300f1bc68f7e2fb137fa839365
x2apic: Remove a panic condition in enabling x2APIC
Currently Xen triggers a panic if user disables VT-d by command line
while not disable x2APIC. This requires users to specify both
"iommu=0" and "x2apic=0" to disable VT-d if the platform supports
x2APIC. It's not user friendly. This patch removes the panic
condition. That's to say, don't require user to specify "x2apic=0"
when specify "iommu=0". As long as VT-d is not enabled (disabled in
BIOS or in command line), x2APIC won't be enabled naturally (x2APIC
depends on VT-d Interrupt remapping).
Signed-off-by: Weidong Han <weidong.han@intel.com>
Index: xen-4.0.2-testing/xen/arch/x86/apic.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/apic.c
+++ xen-4.0.2-testing/xen/arch/x86/apic.c
@@ -1001,22 +1001,11 @@ static void enable_bsp_x2apic(void)
}
else
{
- if ( !iommu_enabled || !iommu_intremap || !iommu_qinval )
- panic("Cannot enable x2APIC due to iommu or interrupt "
- "remapping or queued invalidation is disabled "
- "by command line!\n");
- else
- {
- if ( x2apic_preenabled )
- panic("x2APIC: already enabled by BIOS, but "
- "iommu_supports_eim fails\n");
- else
- {
- printk("Not enable x2APIC due to "
- "iommu_supports_eim fails!\n");
- return;
- }
- }
+ if ( x2apic_preenabled )
+ panic("x2APIC: already enabled by BIOS, but "
+ "iommu_supports_eim failed!\n");
+ printk("Not enabling x2APIC: depends oniommu_supports_eim\n");
+ return;
}
}

View File

@ -1,21 +0,0 @@
References: bnc#655438
# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1290173202 0
# Node ID b7ed352fa6100104374000cdbd845bbfc6478f08
# Parent 437576a0f2026ded6dcc4b11558714dad1d1d042
VPMU: Add the Intel CPU X7542 to the list of supported prcocessors
Signed-off-by: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
--- a/xen/arch/x86/hvm/vmx/vpmu.c
+++ b/xen/arch/x86/hvm/vmx/vpmu.c
@@ -96,6 +96,7 @@ void vpmu_initialise(struct vcpu *v)
case 23:
case 26:
case 29:
+ case 46:
vpmu->arch_vpmu_ops = &core2_vpmu_ops;
break;
}

View File

@ -1,25 +0,0 @@
# HG changeset patch
# User Tim Deegan <Tim.Deegan@citrix.com>
# Date 1290594003 0
# Node ID 79b71c77907b80772ee8cba0c5bbf8e444e61226
# Parent e5c4e925e1bd15baeadc0817dcceb5fff54b8a74
x86/mm: remove incorrect BUG_ON.
This BUG_ON tests a property of an effectively random PFN in the guest,
and is explicitly _not_ seeing the MFN that's known to be owned.
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Index: xen-4.0.2-testing/xen/arch/x86/mm/p2m.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/mm/p2m.c
+++ xen-4.0.2-testing/xen/arch/x86/mm/p2m.c
@@ -2186,9 +2186,6 @@ guest_physmap_add_entry(struct domain *d
P2M_DEBUG("aliased! mfn=%#lx, old gfn=%#lx, new gfn=%#lx\n",
mfn + i, ogfn, gfn + i);
omfn = gfn_to_mfn_query(d, ogfn, &ot);
- /* If we get here, we know the local domain owns the page,
- so it can't have been grant mapped in. */
- BUG_ON( p2m_is_grant(ot) );
if ( p2m_is_ram(ot) )
{
ASSERT(mfn_valid(omfn));

View File

@ -1,496 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1291922374 0
# Node ID d9fc83a64a82624e24876250dd88b2cd9528d266
# Parent 49d2aa5cee4ecc2411d8d638e4ee32c10e9b2761
x86: x2apic: Large cleanup
References: bnc#656369, bnc#658704
Signed-off-by: Keir Fraser <keir@xen.org>
Index: xen-4.0.2-testing/xen/arch/x86/apic.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/apic.c
+++ xen-4.0.2-testing/xen/arch/x86/apic.c
@@ -67,12 +67,12 @@ static int enable_local_apic __initdata
*/
int apic_verbosity;
+static int opt_x2apic = 1;
+boolean_param("x2apic", opt_x2apic);
+
int x2apic_enabled __read_mostly = 0;
int directed_eoi_enabled __read_mostly = 0;
-/* x2APIC is enabled in BIOS */
-static int x2apic_preenabled;
-
/*
* The following vectors are part of the Linux architecture, there
* is no hardware IRQ pin equivalent for them, they are triggered
@@ -945,30 +945,24 @@ no_apic:
return -1;
}
-void check_x2apic_preenabled(void)
+void x2apic_setup(void)
{
+ struct IO_APIC_route_entry **ioapic_entries = NULL;
u32 lo, hi;
- if ( !x2apic_is_available() )
- return;
-
- rdmsr(MSR_IA32_APICBASE, lo, hi);
- if ( lo & MSR_IA32_APICBASE_EXTD )
+ if ( smp_processor_id() != 0 )
{
- printk("x2APIC mode is already enabled by BIOS.\n");
- x2apic_preenabled = 1;
- x2apic_enabled = 1;
+ if ( x2apic_enabled )
+ __enable_x2apic();
+ return;
}
-}
-static void enable_bsp_x2apic(void)
-{
- struct IO_APIC_route_entry **ioapic_entries = NULL;
- const struct genapic *x2apic_genapic = NULL;
-
- ASSERT(smp_processor_id() == 0);
+ if ( !cpu_has_x2apic )
+ return;
- if ( x2apic_preenabled )
+ /* Check whether x2apic mode was already enabled by the BIOS. */
+ rdmsr(MSR_IA32_APICBASE, lo, hi);
+ if ( lo & MSR_IA32_APICBASE_EXTD )
{
/*
* Interrupt remapping should be also enabled by BIOS when
@@ -978,39 +972,33 @@ static void enable_bsp_x2apic(void)
if ( !intremap_enabled() )
panic("Interrupt remapping is not enabled by BIOS while "
"x2APIC is already enabled by BIOS!\n");
+
+ printk("x2APIC mode is already enabled by BIOS.\n");
+ x2apic_enabled = 1;
}
- x2apic_genapic = apic_x2apic_probe();
- if ( x2apic_genapic )
- genapic = x2apic_genapic;
- else
+ if ( !opt_x2apic )
{
- if ( x2apic_cmdline_disable() )
+ if ( !x2apic_enabled )
{
- if ( x2apic_preenabled )
- {
- /* Ignore x2apic=0, and set default x2apic mode */
- genapic = &apic_x2apic_cluster;
- printk("x2APIC: already enabled by BIOS, ignore x2apic=0.\n");
- }
- else
- {
- printk("Not enable x2APIC due to x2apic=0 is set.\n");
- return;
- }
+ printk("Not enabling x2APIC: disabled by cmdline.\n");
+ return;
}
- else
+ printk("x2APIC: Already enabled by BIOS: Ignoring cmdline disable.\n");
+ }
+
+ if ( !iommu_supports_eim() )
+ {
+ if ( !x2apic_enabled )
{
- if ( x2apic_preenabled )
- panic("x2APIC: already enabled by BIOS, but "
- "iommu_supports_eim failed!\n");
- printk("Not enabling x2APIC: depends oniommu_supports_eim\n");
+ printk("Not enabling x2APIC: depends on iommu_supports_eim.\n");
return;
}
+ panic("x2APIC: already enabled by BIOS, but "
+ "iommu_supports_eim failed!\n");
}
- ioapic_entries = alloc_ioapic_entries();
- if ( !ioapic_entries )
+ if ( (ioapic_entries = alloc_ioapic_entries()) == NULL )
{
printk("Allocate ioapic_entries failed\n");
goto out;
@@ -1032,13 +1020,13 @@ static void enable_bsp_x2apic(void)
goto restore_out;
}
- x2apic_enabled = 1;
+ genapic = apic_x2apic_probe();
printk("Switched to APIC driver %s.\n", genapic->name);
- if ( !x2apic_preenabled )
+ if ( !x2apic_enabled )
{
+ x2apic_enabled = 1;
__enable_x2apic();
- printk("x2APIC mode enabled.\n");
}
restore_out:
@@ -1050,24 +1038,6 @@ out:
free_ioapic_entries(ioapic_entries);
}
-static void enable_ap_x2apic(void)
-{
- ASSERT(smp_processor_id() != 0);
-
- /* APs only enable x2apic when BSP did so. */
- BUG_ON(!x2apic_enabled);
-
- __enable_x2apic();
-}
-
-void enable_x2apic(void)
-{
- if ( smp_processor_id() == 0 )
- enable_bsp_x2apic();
- else
- enable_ap_x2apic();
-}
-
void __init init_apic_mappings(void)
{
unsigned long apic_phys;
Index: xen-4.0.2-testing/xen/arch/x86/cpu/common.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/cpu/common.c
+++ xen-4.0.2-testing/xen/arch/x86/cpu/common.c
@@ -250,8 +250,8 @@ static void __init early_cpu_detect(void
c->x86 = 4;
if (c->cpuid_level >= 0x00000001) {
- u32 junk, tfms, cap0, misc;
- cpuid(0x00000001, &tfms, &misc, &junk, &cap0);
+ u32 cap4, tfms, cap0, misc;
+ cpuid(0x00000001, &tfms, &misc, &cap4, &cap0);
c->x86 = (tfms >> 8) & 15;
c->x86_model = (tfms >> 4) & 15;
if (c->x86 == 0xf)
@@ -260,9 +260,12 @@ static void __init early_cpu_detect(void
c->x86_model += ((tfms >> 16) & 0xF) << 4;
c->x86_mask = tfms & 15;
cap0 &= ~cleared_caps[0];
+ cap4 &= ~cleared_caps[4];
if (cap0 & (1<<19))
c->x86_cache_alignment = ((misc >> 8) & 0xff) * 8;
- c->x86_capability[0] = cap0; /* Added for Xen bootstrap */
+ /* Leaf 0x1 capabilities filled in early for Xen. */
+ c->x86_capability[0] = cap0;
+ c->x86_capability[4] = cap4;
}
}
Index: xen-4.0.2-testing/xen/arch/x86/genapic/x2apic.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/genapic/x2apic.c
+++ xen-4.0.2-testing/xen/arch/x86/genapic/x2apic.c
@@ -23,89 +23,44 @@
#include <xen/smp.h>
#include <asm/mach-default/mach_mpparse.h>
-static int x2apic = 1;
-boolean_param("x2apic", x2apic);
-
-static int x2apic_phys; /* By default we use logical cluster mode. */
+static int x2apic_phys; /* By default we use logical cluster mode. */
boolean_param("x2apic_phys", x2apic_phys);
-int x2apic_cmdline_disable(void)
-{
- return (x2apic == 0);
-}
-
-static int probe_x2apic_phys(void)
+static void init_apic_ldr_x2apic_phys(void)
{
- return x2apic && x2apic_phys && x2apic_is_available() &&
- iommu_supports_eim();
}
-static int probe_x2apic_cluster(void)
-{
- return x2apic && !x2apic_phys && x2apic_is_available() &&
- iommu_supports_eim();
-}
-
-const struct genapic apic_x2apic_phys = {
- APIC_INIT("x2apic_phys", probe_x2apic_phys),
- GENAPIC_X2APIC_PHYS
-};
-
-const struct genapic apic_x2apic_cluster = {
- APIC_INIT("x2apic_cluster", probe_x2apic_cluster),
- GENAPIC_X2APIC_CLUSTER
-};
-
-const struct genapic *apic_x2apic_probe(void)
-{
- if ( !x2apic || !x2apic_is_available() )
- return NULL;
-
- if ( !iommu_supports_eim() )
- return NULL;
-
- if ( x2apic_phys )
- return &apic_x2apic_phys;
- else
- return &apic_x2apic_cluster;
-}
-
-void init_apic_ldr_x2apic_phys(void)
-{
- return;
-}
-
-void init_apic_ldr_x2apic_cluster(void)
+static void init_apic_ldr_x2apic_cluster(void)
{
int cpu = smp_processor_id();
cpu_2_logical_apicid[cpu] = apic_read(APIC_LDR);
}
-void clustered_apic_check_x2apic(void)
+
+static void clustered_apic_check_x2apic(void)
{
- return;
}
-cpumask_t target_cpus_x2apic(void)
+static cpumask_t target_cpus_x2apic(void)
{
return cpu_online_map;
}
-cpumask_t vector_allocation_domain_x2apic(int cpu)
+static cpumask_t vector_allocation_domain_x2apic(int cpu)
{
return cpumask_of_cpu(cpu);
}
-unsigned int cpu_mask_to_apicid_x2apic_phys(cpumask_t cpumask)
+static unsigned int cpu_mask_to_apicid_x2apic_phys(cpumask_t cpumask)
{
return cpu_physical_id(first_cpu(cpumask));
}
-unsigned int cpu_mask_to_apicid_x2apic_cluster(cpumask_t cpumask)
+static unsigned int cpu_mask_to_apicid_x2apic_cluster(cpumask_t cpumask)
{
return cpu_2_logical_apicid[first_cpu(cpumask)];
}
-void send_IPI_mask_x2apic_phys(const cpumask_t *cpumask, int vector)
+static void send_IPI_mask_x2apic_phys(const cpumask_t *cpumask, int vector)
{
unsigned int cpu, cfg;
unsigned long flags;
@@ -132,7 +87,7 @@ void send_IPI_mask_x2apic_phys(const cpu
local_irq_restore(flags);
}
-void send_IPI_mask_x2apic_cluster(const cpumask_t *cpumask, int vector)
+static void send_IPI_mask_x2apic_cluster(const cpumask_t *cpumask, int vector)
{
unsigned int cpu, cfg;
unsigned long flags;
@@ -148,3 +103,34 @@ void send_IPI_mask_x2apic_cluster(const
local_irq_restore(flags);
}
+
+static const struct genapic apic_x2apic_phys = {
+ APIC_INIT("x2apic_phys", NULL),
+ .int_delivery_mode = dest_Fixed,
+ .int_dest_mode = 0 /* physical delivery */,
+ .init_apic_ldr = init_apic_ldr_x2apic_phys,
+ .clustered_apic_check = clustered_apic_check_x2apic,
+ .target_cpus = target_cpus_x2apic,
+ .vector_allocation_domain = vector_allocation_domain_x2apic,
+ .cpu_mask_to_apicid = cpu_mask_to_apicid_x2apic_phys,
+ .send_IPI_mask = send_IPI_mask_x2apic_phys,
+ .send_IPI_self = send_IPI_self_x2apic
+};
+
+static const struct genapic apic_x2apic_cluster = {
+ APIC_INIT("x2apic_cluster", NULL),
+ .int_delivery_mode = dest_LowestPrio,
+ .int_dest_mode = 1 /* logical delivery */,
+ .init_apic_ldr = init_apic_ldr_x2apic_cluster,
+ .clustered_apic_check = clustered_apic_check_x2apic,
+ .target_cpus = target_cpus_x2apic,
+ .vector_allocation_domain = vector_allocation_domain_x2apic,
+ .cpu_mask_to_apicid = cpu_mask_to_apicid_x2apic_cluster,
+ .send_IPI_mask = send_IPI_mask_x2apic_cluster,
+ .send_IPI_self = send_IPI_self_x2apic
+};
+
+const struct genapic *apic_x2apic_probe(void)
+{
+ return x2apic_phys ? &apic_x2apic_phys : &apic_x2apic_cluster;
+}
Index: xen-4.0.2-testing/xen/arch/x86/setup.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/setup.c
+++ xen-4.0.2-testing/xen/arch/x86/setup.c
@@ -1006,9 +1006,6 @@ void __init __start_xen(unsigned long mb
tboot_probe();
- /* Check if x2APIC is already enabled in BIOS */
- check_x2apic_preenabled();
-
/* Unmap the first page of CPU0's stack. */
memguard_guard_stack(cpu0_stack);
@@ -1039,8 +1036,7 @@ void __init __start_xen(unsigned long mb
init_apic_mappings();
- if ( x2apic_is_available() )
- enable_x2apic();
+ x2apic_setup();
percpu_free_unused_areas();
Index: xen-4.0.2-testing/xen/arch/x86/smpboot.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/smpboot.c
+++ xen-4.0.2-testing/xen/arch/x86/smpboot.c
@@ -325,8 +325,7 @@ void __devinit smp_callin(void)
*/
wait_for_init_deassert(&init_deasserted);
- if ( x2apic_enabled )
- enable_x2apic();
+ x2apic_setup();
/*
* (This works even if the APIC is not enabled.)
Index: xen-4.0.2-testing/xen/drivers/passthrough/vtd/intremap.c
===================================================================
--- xen-4.0.2-testing.orig/xen/drivers/passthrough/vtd/intremap.c
+++ xen-4.0.2-testing/xen/drivers/passthrough/vtd/intremap.c
@@ -129,15 +129,10 @@ int iommu_supports_eim(void)
struct acpi_drhd_unit *drhd;
int apic;
- if ( !iommu_enabled || !iommu_qinval || !iommu_intremap )
+ if ( !iommu_enabled || !iommu_qinval || !iommu_intremap ||
+ list_empty(&acpi_drhd_units) )
return 0;
- if ( list_empty(&acpi_drhd_units) )
- {
- dprintk(XENLOG_WARNING VTDPREFIX, "VT-d is not supported\n");
- return 0;
- }
-
/* We MUST have a DRHD unit for each IOAPIC. */
for ( apic = 0; apic < nr_ioapics; apic++ )
if ( !ioapic_to_drhd(IO_APIC_ID(apic)) )
Index: xen-4.0.2-testing/xen/include/asm-x86/apic.h
===================================================================
--- xen-4.0.2-testing.orig/xen/include/asm-x86/apic.h
+++ xen-4.0.2-testing/xen/include/asm-x86/apic.h
@@ -25,21 +25,8 @@ extern int apic_verbosity;
extern int x2apic_enabled;
extern int directed_eoi_enabled;
-extern void check_x2apic_preenabled(void);
-extern int x2apic_cmdline_disable(void);
-extern void enable_x2apic(void);
-
-static __inline int x2apic_is_available(void)
-{
- unsigned int op = 1, eax, ecx;
-
- asm ( "cpuid"
- : "=a" (eax), "=c" (ecx)
- : "0" (op)
- : "bx", "dx" );
-
- return (ecx & (1U << 21));
-}
+void x2apic_setup(void);
+const struct genapic *apic_x2apic_probe(void);
/*
* Define the default level of output to be very little
Index: xen-4.0.2-testing/xen/include/asm-x86/genapic.h
===================================================================
--- xen-4.0.2-testing.orig/xen/include/asm-x86/genapic.h
+++ xen-4.0.2-testing/xen/include/asm-x86/genapic.h
@@ -49,8 +49,6 @@ struct genapic {
APICFUNC(acpi_madt_oem_check)
extern const struct genapic *genapic;
-extern const struct genapic apic_x2apic_phys;
-extern const struct genapic apic_x2apic_cluster;
void init_apic_ldr_flat(void);
void clustered_apic_check_flat(void);
@@ -70,39 +68,6 @@ cpumask_t vector_allocation_domain_flat(
.send_IPI_mask = send_IPI_mask_flat, \
.send_IPI_self = send_IPI_self_flat
-const struct genapic *apic_x2apic_probe(void);
-void init_apic_ldr_x2apic_phys(void);
-void init_apic_ldr_x2apic_cluster(void);
-void clustered_apic_check_x2apic(void);
-cpumask_t target_cpus_x2apic(void);
-unsigned int cpu_mask_to_apicid_x2apic_phys(cpumask_t cpumask);
-unsigned int cpu_mask_to_apicid_x2apic_cluster(cpumask_t cpumask);
-void send_IPI_mask_x2apic_phys(const cpumask_t *mask, int vector);
-void send_IPI_mask_x2apic_cluster(const cpumask_t *mask, int vector);
-void send_IPI_self_x2apic(int vector);
-cpumask_t vector_allocation_domain_x2apic(int cpu);
-#define GENAPIC_X2APIC_PHYS \
- .int_delivery_mode = dest_Fixed, \
- .int_dest_mode = 0 /* physical delivery */, \
- .init_apic_ldr = init_apic_ldr_x2apic_phys, \
- .clustered_apic_check = clustered_apic_check_x2apic, \
- .target_cpus = target_cpus_x2apic, \
- .vector_allocation_domain = vector_allocation_domain_x2apic, \
- .cpu_mask_to_apicid = cpu_mask_to_apicid_x2apic_phys, \
- .send_IPI_mask = send_IPI_mask_x2apic_phys, \
- .send_IPI_self = send_IPI_self_x2apic
-
-#define GENAPIC_X2APIC_CLUSTER \
- .int_delivery_mode = dest_LowestPrio, \
- .int_dest_mode = 1 /* logical delivery */, \
- .init_apic_ldr = init_apic_ldr_x2apic_cluster, \
- .clustered_apic_check = clustered_apic_check_x2apic, \
- .target_cpus = target_cpus_x2apic, \
- .vector_allocation_domain = vector_allocation_domain_x2apic, \
- .cpu_mask_to_apicid = cpu_mask_to_apicid_x2apic_cluster, \
- .send_IPI_mask = send_IPI_mask_x2apic_cluster, \
- .send_IPI_self = send_IPI_self_x2apic
-
void init_apic_ldr_phys(void);
void clustered_apic_check_phys(void);
cpumask_t target_cpus_phys(void);
@@ -121,4 +86,6 @@ cpumask_t vector_allocation_domain_phys(
.send_IPI_mask = send_IPI_mask_phys, \
.send_IPI_self = send_IPI_self_phys
+void send_IPI_self_x2apic(int vector);
+
#endif

View File

@ -1,36 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1291999745 0
# Node ID 3b3fce9050b9b14f3a11123f6943998413ea7e7e
# Parent 901c118b363e978566775f9d118b4f2f15598212
hvm vlapic: Fix tmcct read logic when in periodic mode.
Signed-off-by: Keir Fraser <keir@xen.org>
Index: xen-4.0.2-testing/xen/arch/x86/hvm/vlapic.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/hvm/vlapic.c
+++ xen-4.0.2-testing/xen/arch/x86/hvm/vlapic.c
@@ -428,12 +428,19 @@ int vlapic_ipi(
static uint32_t vlapic_get_tmcct(struct vlapic *vlapic)
{
struct vcpu *v = current;
- uint32_t tmcct, tmict = vlapic_get_reg(vlapic, APIC_TMICT);
+ uint32_t tmcct = 0, tmict = vlapic_get_reg(vlapic, APIC_TMICT);
uint64_t counter_passed;
counter_passed = ((hvm_get_guest_time(v) - vlapic->timer_last_update)
- / APIC_BUS_CYCLE_NS / vlapic->hw.timer_divisor);
- tmcct = tmict - counter_passed;
+ / (APIC_BUS_CYCLE_NS * vlapic->hw.timer_divisor));
+
+ if ( tmict != 0 )
+ {
+ if ( vlapic_lvtt_period(vlapic) )
+ counter_passed %= tmict;
+ if ( counter_passed < tmict )
+ tmcct = tmict - counter_passed;
+ }
HVM_DBG_LOG(DBG_LEVEL_VLAPIC_TIMER,
"timer initial count %d, timer current count %d, "

View File

@ -1,102 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1292320377 0
# Node ID fd4cbfbbd83e6091a343844eae1da1468f54b72b
# Parent ab785e37499c8cdadd1fd5e4ab1bfbbacebf358b
x86/iommu: don't map RAM holes above 4G
References: bnc#658163
Matching the comment in iommu_set_dom0_mapping(), map only actual RAM
from the address range starting at 4G. It's not clear though whether
that comment is actually correct (which is why I'm sending this as
RFC), but it is certain that on systems with sparse physical memory
map we're currently wasting a potentially significant amount of memory
for setting up IOMMU page tables that will never be used.
The main question is what happens for MMIO ranges living above 4G. Of
course, the same issue would currently exist for any such ranges
sitting beyond the end of RAM.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
--- a/xen/arch/x86/domain_build.c
+++ b/xen/arch/x86/domain_build.c
@@ -194,7 +194,7 @@ static unsigned long __init compute_dom0
unsigned int s;
for ( s = 9; s < BITS_PER_LONG; s += 9 )
- avail -= max_page >> s;
+ avail -= max_pdx >> s;
}
/*
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c
@@ -239,8 +239,16 @@ static void amd_iommu_dom0_init(struct d
if ( !iommu_passthrough && !need_iommu(d) )
{
/* Set up 1:1 page table for dom0 */
- for ( i = 0; i < max_page; i++ )
- amd_iommu_map_page(d, i, i, IOMMUF_readable|IOMMUF_writable);
+ for ( i = 0; i < max_pdx; i++ )
+ {
+ unsigned long pfn = pdx_to_pfn(i);
+
+ /*
+ * XXX Should we really map all non-RAM (above 4G)? Minimally
+ * a pfn_valid() check would seem desirable here.
+ */
+ amd_iommu_map_page(d, pfn, pfn, IOMMUF_readable|IOMMUF_writable);
+ }
}
amd_iommu_setup_dom0_devices(d);
--- a/xen/drivers/passthrough/vtd/x86/vtd.c
+++ b/xen/drivers/passthrough/vtd/x86/vtd.c
@@ -128,14 +128,14 @@ void hvm_dpci_isairq_eoi(struct domain *
void iommu_set_dom0_mapping(struct domain *d)
{
- u64 i, j, tmp, max_pfn;
+ unsigned long i, j, tmp, top;
extern int xen_in_range(unsigned long mfn);
BUG_ON(d->domain_id != 0);
- max_pfn = max_t(u64, max_page, 0x100000000ull >> PAGE_SHIFT);
+ top = max(max_pdx, pfn_to_pdx(0xffffffffUL >> PAGE_SHIFT) + 1);
- for ( i = 0; i < max_pfn; i++ )
+ for ( i = 0; i < top; i++ )
{
/*
* Set up 1:1 mapping for dom0. Default to use only conventional RAM
@@ -143,18 +143,23 @@ void iommu_set_dom0_mapping(struct domai
* inclusive mapping maps in everything below 4GB except unusable
* ranges.
*/
- if ( !page_is_ram_type(i, RAM_TYPE_CONVENTIONAL) &&
- (!iommu_inclusive_mapping ||
- page_is_ram_type(i, RAM_TYPE_UNUSABLE)) )
+ unsigned long pfn = pdx_to_pfn(i);
+
+ if ( pfn > (0xffffffffUL >> PAGE_SHIFT) ?
+ (!mfn_valid(pfn) ||
+ !page_is_ram_type(pfn, RAM_TYPE_CONVENTIONAL)) :
+ iommu_inclusive_mapping ?
+ page_is_ram_type(pfn, RAM_TYPE_UNUSABLE) :
+ !page_is_ram_type(pfn, RAM_TYPE_CONVENTIONAL) )
continue;
/* Exclude Xen bits */
- if ( xen_in_range(i) )
+ if ( xen_in_range(pfn) )
continue;
tmp = 1 << (PAGE_SHIFT - PAGE_SHIFT_4K);
for ( j = 0; j < tmp; j++ )
- iommu_map_page(d, (i*tmp+j), (i*tmp+j),
+ iommu_map_page(d, pfn * tmp + j, pfn * tmp + j,
IOMMUF_readable|IOMMUF_writable);
if (!(i & (0xfffff >> (PAGE_SHIFT - PAGE_SHIFT_4K))))

View File

@ -1,177 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1292413934 0
# Node ID 548c808be2a6f166657ce7cfb86df7a296a9526a
# Parent c0662cb08260d831ae8d211ba16fc7038cb889b6
x86: mpparse and cstate need to use 32bit apic id
References: bnc#656369, bnc#658704
Instead of going with mpc_config_processor struct.
that field ony have 8 bits.
We should not change that struct, because it is shared with mptable.
Also need to increase MAX_APICS.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Rather than using a fixed value of 512, make this scale with NR_CPUS
(which obviously still doesn't cover all theoretically possible
systems, but at least allows some build time control).
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-4.0.2-testing/xen/arch/x86/acpi/cpu_idle.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/acpi/cpu_idle.c
+++ xen-4.0.2-testing/xen/arch/x86/acpi/cpu_idle.c
@@ -742,7 +742,7 @@ static void set_cx(
int get_cpu_id(u8 acpi_id)
{
int i;
- u8 apic_id;
+ u32 apic_id;
apic_id = x86_acpiid_to_apicid[acpi_id];
if ( apic_id == 0xff )
Index: xen-4.0.2-testing/xen/arch/x86/mpparse.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/mpparse.c
+++ xen-4.0.2-testing/xen/arch/x86/mpparse.c
@@ -99,7 +99,8 @@ static int mpc_record;
static struct mpc_config_translation *translation_table[MAX_MPC_ENTRY] __initdata;
/* Return xen's logical cpu_id of the new added cpu or <0 if error */
-static int __devinit MP_processor_info (struct mpc_config_processor *m)
+static int __devinit MP_processor_info_x(struct mpc_config_processor *m,
+ u32 apicidx)
{
int ver, apicid, cpu = 0;
physid_mask_t phys_cpu;
@@ -107,7 +108,7 @@ static int __devinit MP_processor_info (
if (!(m->mpc_cpuflag & CPU_ENABLED))
return -EINVAL;
- apicid = mpc_apic_id(m, translation_table[mpc_record]);
+ apicid = mpc_apic_id(m, apicidx, translation_table[mpc_record]);
if (m->mpc_featureflag&(1<<0))
Dprintk(" Floating point unit present.\n");
@@ -159,7 +160,7 @@ static int __devinit MP_processor_info (
if (m->mpc_cpuflag & CPU_BOOTPROCESSOR) {
Dprintk(" Bootup CPU\n");
- boot_cpu_physical_apicid = m->mpc_apicid;
+ boot_cpu_physical_apicid = apicid;
}
ver = m->mpc_apicver;
@@ -170,10 +171,10 @@ static int __devinit MP_processor_info (
if (ver == 0x0) {
printk(KERN_WARNING "BIOS bug, APIC version is 0 for CPU#%d! "
"fixing up to 0x10. (tell your hw vendor)\n",
- m->mpc_apicid);
+ apicid);
ver = 0x10;
}
- apic_version[m->mpc_apicid] = ver;
+ apic_version[apicid] = ver;
phys_cpu = apicid_to_cpu_present(apicid);
physids_or(phys_cpu_present_map, phys_cpu_present_map, phys_cpu);
@@ -216,6 +217,11 @@ static int __devinit MP_processor_info (
return cpu;
}
+static int __devinit MP_processor_info(struct mpc_config_processor *m)
+{
+ return MP_processor_info_x(m, m->mpc_apicid);
+}
+
static void __init MP_bus_info (struct mpc_config_bus *m)
{
char str[7];
@@ -844,7 +850,7 @@ int __devinit mp_register_lapic (
struct mpc_config_processor processor;
int boot_cpu = 0;
- if (MAX_APICS - id <= 0) {
+ if (MAX_APICS <= id) {
printk(KERN_WARNING "Processor #%d invalid (max %d)\n",
id, MAX_APICS);
return -EINVAL;
@@ -864,7 +870,7 @@ int __devinit mp_register_lapic (
processor.mpc_reserved[0] = 0;
processor.mpc_reserved[1] = 0;
- return MP_processor_info(&processor);
+ return MP_processor_info_x(&processor, id);
}
void mp_unregister_lapic(uint32_t apic_id, uint32_t cpu)
Index: xen-4.0.2-testing/xen/common/sched_sedf.c
===================================================================
--- xen-4.0.2-testing.orig/xen/common/sched_sedf.c
+++ xen-4.0.2-testing/xen/common/sched_sedf.c
@@ -124,7 +124,6 @@ struct sedf_cpu_info {
#define PERIOD_BEGIN(inf) ((inf)->deadl_abs - (inf)->period)
-#define MIN(x,y) (((x)<(y))?(x):(y))
#define DIV_UP(x,y) (((x) + (y) - 1) / y)
#define extra_runs(inf) ((inf->status) & 6)
Index: xen-4.0.2-testing/xen/include/asm-x86/mach-generic/mach_apic.h
===================================================================
--- xen-4.0.2-testing.orig/xen/include/asm-x86/mach-generic/mach_apic.h
+++ xen-4.0.2-testing/xen/include/asm-x86/mach-generic/mach_apic.h
@@ -26,15 +26,15 @@ static inline void enable_apic_mode(void
extern u32 bios_cpu_apicid[];
-static inline int mpc_apic_id(struct mpc_config_processor *m,
+static inline int mpc_apic_id(struct mpc_config_processor *m, u32 apicid,
struct mpc_config_translation *translation_record)
{
printk("Processor #%d %d:%d APIC version %d\n",
- m->mpc_apicid,
+ apicid,
(m->mpc_cpufeature & CPU_FAMILY_MASK) >> 8,
(m->mpc_cpufeature & CPU_MODEL_MASK) >> 4,
m->mpc_apicver);
- return (m->mpc_apicid);
+ return apicid;
}
static inline void setup_portio_remap(void)
Index: xen-4.0.2-testing/xen/include/asm-x86/mpspec_def.h
===================================================================
--- xen-4.0.2-testing.orig/xen/include/asm-x86/mpspec_def.h
+++ xen-4.0.2-testing/xen/include/asm-x86/mpspec_def.h
@@ -14,7 +14,7 @@
#define SMP_MAGIC_IDENT (('_'<<24)|('P'<<16)|('M'<<8)|'_')
#define MAX_MPC_ENTRY 1024
-#define MAX_APICS 256
+#define MAX_APICS MAX(256, 4 * NR_CPUS)
struct intel_mp_floating
{
Index: xen-4.0.2-testing/xen/include/xen/kernel.h
===================================================================
--- xen-4.0.2-testing.orig/xen/include/xen/kernel.h
+++ xen-4.0.2-testing/xen/include/xen/kernel.h
@@ -33,6 +33,13 @@
#define max_t(type,x,y) \
({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })
+/*
+ * pre-processor, array size, and bit field width suitable variants;
+ * please don't use in "normal" expressions.
+ */
+#define MIN(x,y) ((x) < (y) ? (x) : (y))
+#define MAX(x,y) ((x) > (y) ? (x) : (y))
+
/**
* container_of - cast a member of a structure out to the containing structure
*

View File

@ -1,165 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1292414148 0
# Node ID d4b373ec948bed71b8683e09e41c6afc99f1edb6
# Parent 548c808be2a6f166657ce7cfb86df7a296a9526a
x86: increase MAX_LOCAL_APIC
References: bnc#656369, bnc#658704
otherwise apicid_to_node[MAX_LOCAL_APIC] will be overrun if apicid >
255. After patch, the mapping get right.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Make this and also MAX_MADT_ENTRIES loosely depend on NR_CPUS. Tie
MAX_APICS to MAX_LOCAL_APIC. Fix initializer of x86_acpiid_to_apicid[]
to match the array member type of u32, as well as all checks in
readers of this array and x86_cpu_to_apicid[].
While the adjustment to xen_vcpu_physid_to_x86_{acpi,apic}id() is not
backward compatible, I think it should still be done this way as the
former reserving of values beyond 0xff should never have been part of
the interface. If considered impossible, a second best solution would
appear to be to make the macros depend on __XEN_INTERFACE_VERSION__.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-4.0.2-testing/xen/arch/x86/acpi/boot.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/acpi/boot.c
+++ xen-4.0.2-testing/xen/arch/x86/acpi/boot.c
@@ -82,7 +82,7 @@ u8 acpi_enable_value, acpi_disable_value
#endif
u32 x86_acpiid_to_apicid[MAX_MADT_ENTRIES] =
- {[0 ... MAX_MADT_ENTRIES - 1] = 0xff };
+ {[0 ... MAX_MADT_ENTRIES - 1] = BAD_APICID };
EXPORT_SYMBOL(x86_acpiid_to_apicid);
/* --------------------------------------------------------------------------
@@ -534,6 +534,7 @@ static int __init acpi_parse_madt_lapic_
mp_register_lapic_address(acpi_lapic_addr);
+ BUILD_BUG_ON(MAX_APICS != MAX_LOCAL_APIC);
count = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic,
MAX_APICS);
x2count = acpi_table_parse_madt(ACPI_MADT_X2APIC, acpi_parse_x2apic,
@@ -998,12 +999,12 @@ unsigned int acpi_get_processor_id(unsig
{
unsigned int acpiid, apicid;
- if ((apicid = x86_cpu_to_apicid[cpu]) == 0xff)
- return 0xff;
+ if ((apicid = x86_cpu_to_apicid[cpu]) == BAD_APICID)
+ return INVALID_ACPIID;
for (acpiid = 0; acpiid < ARRAY_SIZE(x86_acpiid_to_apicid); acpiid++)
if (x86_acpiid_to_apicid[acpiid] == apicid)
return acpiid;
- return 0xff;
+ return INVALID_ACPIID;
}
Index: xen-4.0.2-testing/xen/arch/x86/acpi/cpu_idle.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/acpi/cpu_idle.c
+++ xen-4.0.2-testing/xen/arch/x86/acpi/cpu_idle.c
@@ -745,7 +745,7 @@ int get_cpu_id(u8 acpi_id)
u32 apic_id;
apic_id = x86_acpiid_to_apicid[acpi_id];
- if ( apic_id == 0xff )
+ if ( apic_id == BAD_APICID )
return -1;
for ( i = 0; i < NR_CPUS; i++ )
Index: xen-4.0.2-testing/xen/arch/x86/smpboot.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/smpboot.c
+++ xen-4.0.2-testing/xen/arch/x86/smpboot.c
@@ -96,7 +96,7 @@ struct cpuinfo_x86 cpu_data[NR_CPUS];
EXPORT_SYMBOL(cpu_data);
u32 x86_cpu_to_apicid[NR_CPUS] __read_mostly =
- { [0 ... NR_CPUS-1] = -1U };
+ { [0 ... NR_CPUS-1] = BAD_APICID };
EXPORT_SYMBOL(x86_cpu_to_apicid);
static void map_cpu_to_logical_apicid(void);
@@ -1479,7 +1479,7 @@ int cpu_add(uint32_t apic_id, uint32_t a
return -EINVAL;
/* Detect if the cpu has been added before */
- if ( x86_acpiid_to_apicid[acpi_id] != 0xff)
+ if ( x86_acpiid_to_apicid[acpi_id] != BAD_APICID )
{
if (x86_acpiid_to_apicid[acpi_id] != apic_id)
return -EINVAL;
@@ -1513,7 +1513,7 @@ int cpu_add(uint32_t apic_id, uint32_t a
{
dprintk(XENLOG_WARNING,
"Setup node failed for pxm %x\n", pxm);
- x86_acpiid_to_apicid[acpi_id] = 0xff;
+ x86_acpiid_to_apicid[acpi_id] = BAD_APICID;
mp_unregister_lapic(apic_id, cpu);
spin_unlock(&cpu_add_remove_lock);
return node;
Index: xen-4.0.2-testing/xen/include/asm-x86/acpi.h
===================================================================
--- xen-4.0.2-testing.orig/xen/include/asm-x86/acpi.h
+++ xen-4.0.2-testing/xen/include/asm-x86/acpi.h
@@ -150,9 +150,11 @@ struct acpi_sleep_info {
#endif /* CONFIG_ACPI_SLEEP */
-#define MAX_MADT_ENTRIES 256
+#define MAX_MADT_ENTRIES MAX(256, 2 * NR_CPUS)
extern u32 x86_acpiid_to_apicid[];
-#define MAX_LOCAL_APIC 256
+#define MAX_LOCAL_APIC MAX(256, 4 * NR_CPUS)
+
+#define INVALID_ACPIID (-1U)
extern u32 pmtmr_ioport;
Index: xen-4.0.2-testing/xen/include/asm-x86/numa.h
===================================================================
--- xen-4.0.2-testing.orig/xen/include/asm-x86/numa.h
+++ xen-4.0.2-testing/xen/include/asm-x86/numa.h
@@ -39,7 +39,7 @@ extern int setup_node(int pxm);
extern void srat_detect_node(int cpu);
extern void setup_node_bootmem(int nodeid, u64 start, u64 end);
-extern unsigned char apicid_to_node[256];
+extern unsigned char apicid_to_node[];
#ifdef CONFIG_NUMA
extern void __init init_cpu_to_node(void);
Index: xen-4.0.2-testing/xen/include/public/vcpu.h
===================================================================
--- xen-4.0.2-testing.orig/xen/include/public/vcpu.h
+++ xen-4.0.2-testing/xen/include/public/vcpu.h
@@ -187,8 +187,7 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_register_vc
/*
* Get the physical ID information for a pinned vcpu's underlying physical
* processor. The physical ID informmation is architecture-specific.
- * On x86: id[31:0]=apic_id, id[63:32]=acpi_id, and all values 0xff and
- * greater are reserved.
+ * On x86: id[31:0]=apic_id, id[63:32]=acpi_id.
* This command returns -EINVAL if it is not a valid operation for this VCPU.
*/
#define VCPUOP_get_physid 12 /* arg == vcpu_get_physid_t */
@@ -197,10 +196,8 @@ struct vcpu_get_physid {
};
typedef struct vcpu_get_physid vcpu_get_physid_t;
DEFINE_XEN_GUEST_HANDLE(vcpu_get_physid_t);
-#define xen_vcpu_physid_to_x86_apicid(physid) \
- ((((uint32_t)(physid)) >= 0xff) ? 0xff : ((uint8_t)(physid)))
-#define xen_vcpu_physid_to_x86_acpiid(physid) \
- ((((uint32_t)((physid)>>32)) >= 0xff) ? 0xff : ((uint8_t)((physid)>>32)))
+#define xen_vcpu_physid_to_x86_apicid(physid) ((uint32_t)(physid))
+#define xen_vcpu_physid_to_x86_acpiid(physid) ((uint32_t)((physid) >> 32))
/*
* Register a memory location to get a secondary copy of the vcpu time

View File

@ -1,88 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1292414185 0
# Node ID fcc91cb3efcb83823b7e9c74ee3c97c4a9c0b7d5
# Parent d4b373ec948bed71b8683e09e41c6afc99f1edb6
x86: x2apic pre-enabled but intr-remapping is not enabled
References: bnc#656369, bnc#658704
Make it aligned with Linux kernel.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Removed unnecessary bits from the original patch, and removed
intremap_enabled() with its only caller gone.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-4.0.2-testing/xen/arch/x86/apic.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/apic.c
+++ xen-4.0.2-testing/xen/arch/x86/apic.c
@@ -964,15 +964,6 @@ void x2apic_setup(void)
rdmsr(MSR_IA32_APICBASE, lo, hi);
if ( lo & MSR_IA32_APICBASE_EXTD )
{
- /*
- * Interrupt remapping should be also enabled by BIOS when
- * x2APIC is already enabled by BIOS, otherwise it's a BIOS
- * bug
- */
- if ( !intremap_enabled() )
- panic("Interrupt remapping is not enabled by BIOS while "
- "x2APIC is already enabled by BIOS!\n");
-
printk("x2APIC mode is already enabled by BIOS.\n");
x2apic_enabled = 1;
}
@@ -1015,6 +1006,10 @@ void x2apic_setup(void)
if ( iommu_enable_IR() )
{
+ if ( x2apic_enabled )
+ panic("Interrupt remapping could not be enabled while "
+ "x2APIC is already enabled by BIOS!\n");
+
printk("Would not enable x2APIC due to interrupt remapping "
"cannot be enabled.\n");
goto restore_out;
Index: xen-4.0.2-testing/xen/drivers/passthrough/vtd/intremap.c
===================================================================
--- xen-4.0.2-testing.orig/xen/drivers/passthrough/vtd/intremap.c
+++ xen-4.0.2-testing/xen/drivers/passthrough/vtd/intremap.c
@@ -892,23 +892,3 @@ void iommu_disable_IR(void)
for_each_drhd_unit ( drhd )
disable_qinval(drhd->iommu);
}
-
-/*
- * Check if interrupt remapping is enabled or not
- * return 1: enabled
- * return 0: not enabled
- */
-int intremap_enabled(void)
-{
- struct acpi_drhd_unit *drhd;
- u32 sts;
-
- for_each_drhd_unit ( drhd )
- {
- sts = dmar_readl(drhd->iommu->reg, DMAR_GSTS_REG);
- if ( !(sts & DMA_GSTS_IRES) )
- return 0;
- }
-
- return 1;
-}
Index: xen-4.0.2-testing/xen/include/xen/iommu.h
===================================================================
--- xen-4.0.2-testing.orig/xen/include/xen/iommu.h
+++ xen-4.0.2-testing/xen/include/xen/iommu.h
@@ -62,7 +62,6 @@ int iommu_setup(void);
int iommu_supports_eim(void);
int iommu_enable_IR(void);
void iommu_disable_IR(void);
-int intremap_enabled(void);
int iommu_add_device(struct pci_dev *pdev);
int iommu_remove_device(struct pci_dev *pdev);

View File

@ -1,60 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1294220923 0
# Node ID 76d897a06b316bf2278220b006d578faf31ce3fb
# Parent fece73d4d30985ce40ef87dcd379ce6beb8aadf3
x86 amd: Revert 6382:b74c15e4dd4f (AMD flush filter configuration)
Flush filter is not reliably supported by any processor, we already
have code to unconditionally disable the filter, so we don't need the
command-line config option. Remove it.
Signed-off-by: Keir Fraser <keir@xen.org>
Index: xen-4.0.2-testing/xen/arch/x86/cpu/amd.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/cpu/amd.c
+++ xen-4.0.2-testing/xen/arch/x86/cpu/amd.c
@@ -237,20 +237,6 @@ int cpu_has_amd_erratum(const struct cpu
return 0;
}
-/*
- * amd_flush_filter={on,off}. Forcibly Enable or disable the TLB flush
- * filter on AMD 64-bit processors.
- */
-static int flush_filter_force;
-static void flush_filter(char *s)
-{
- if (!strcmp(s, "off"))
- flush_filter_force = -1;
- if (!strcmp(s, "on"))
- flush_filter_force = 1;
-}
-custom_param("amd_flush_filter", flush_filter);
-
#define num_physpages 0
/*
@@ -545,21 +531,6 @@ static void __devinit init_amd(struct cp
break;
}
- if (c->x86 == 15) {
- rdmsr(MSR_K7_HWCR, l, h);
- printk(KERN_INFO "CPU%d: AMD Flush Filter %sabled",
- smp_processor_id(), (l & (1<<6)) ? "dis" : "en");
- if ((flush_filter_force > 0) && (l & (1<<6))) {
- l &= ~(1<<6);
- printk(" -> Forcibly enabled");
- } else if ((flush_filter_force < 0) && !(l & (1<<6))) {
- l |= 1<<6;
- printk(" -> Forcibly disabled");
- }
- wrmsr(MSR_K7_HWCR, l, h);
- printk("\n");
- }
-
display_cacheinfo(c);
if (cpuid_eax(0x80000000) >= 0x80000008) {

View File

@ -1,77 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1294648952 0
# Node ID 08bb0eefe87107c30a9bdc6d72f26b20c55ae687
# Parent 66e8062894641e5622aa6adc54297d5700b1cea3
x86-64: don't allow wrmsr to MSR_FAM10H_MMIO_CONF_BASE when Xen itself is using it
Signed-off-by: Jan Beulich <jbeulich@novell.com>
# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1294741846 0
# Node ID a2dcebb88bc4571d64b3f30c1fbb33cfe4f6e2c5
# Parent 1ae74f060a39ae1305b3a434d0faa1a19853fdab
x86-64: refine access permission check for wrmsr to MSR_FAM10H_MMIO_CONF_BASE
We really don't want the mmconf window to move/disappear whenever we
use is ourselves, not only when we enabled it.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-4.0.2-testing/xen/arch/x86/traps.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/traps.c
+++ xen-4.0.2-testing/xen/arch/x86/traps.c
@@ -1716,6 +1716,10 @@ static int is_cpufreq_controller(struct
(d->domain_id == 0));
}
+#ifdef CONFIG_X86_64
+#include "x86_64/mmconfig.h"
+#endif
+
static int emulate_privileged_op(struct cpu_user_regs *regs)
{
struct vcpu *v = current;
@@ -2275,7 +2279,13 @@ static int emulate_privileged_op(struct
goto fail;
if ( !IS_PRIV(v->domain) )
break;
- if ( (rdmsr_safe(MSR_FAM10H_MMIO_CONF_BASE, l, h) != 0) ||
+ if ( (rdmsr_safe(MSR_FAM10H_MMIO_CONF_BASE, l, h) != 0) )
+ goto fail;
+ if (
+#ifdef CONFIG_X86_64
+ (pci_probe & PCI_PROBE_MASK) == PCI_PROBE_MMCONF ?
+ eax != l || edx != h :
+#endif
(((((u64)h << 32) | l) ^ val) &
~( FAM10H_MMIO_CONF_ENABLE |
(FAM10H_MMIO_CONF_BUSRANGE_MASK <<
Index: xen-4.0.2-testing/xen/arch/x86/x86_64/mmconfig.h
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/x86_64/mmconfig.h
+++ xen-4.0.2-testing/xen/arch/x86/x86_64/mmconfig.h
@@ -34,6 +34,8 @@
#define PCI_VENDOR_ID_NVIDIA 0x10de
+extern unsigned int pci_probe;
+
/*
* AMD Fam10h CPUs are buggy, and cannot access MMIO config space
* on their northbrige except through the * %eax register. As such, you MUST
Index: xen-4.0.2-testing/xen/arch/x86/x86_64/mmconfig-shared.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/x86_64/mmconfig-shared.c
+++ xen-4.0.2-testing/xen/arch/x86/x86_64/mmconfig-shared.c
@@ -24,7 +24,7 @@
#include "mmconfig.h"
static int __initdata known_bridge;
-static unsigned int pci_probe = PCI_PROBE_CONF1 | PCI_PROBE_MMCONF;
+unsigned int pci_probe = PCI_PROBE_CONF1 | PCI_PROBE_MMCONF;
static void __init parse_mmcfg(char *s)
{

View File

@ -1,46 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1294649119 0
# Node ID 9b5d121c8805b40a4338248c346303e1e18d0c4e
# Parent 08bb0eefe87107c30a9bdc6d72f26b20c55ae687
x86_64: don't use weak symbols on x86-64
References: bnc#656369, bnc#658704
Various gcc versions inline functions that are both weak and hidden,
without even giving a warning.
Certainly the risk exists that we'll see the problem again when
another weak function gets introduced, but I don't see a way to
protect us from that.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Just remove the weak attribute altogether. It's the only one in
non-ia64-specific code. We can get teh same effect with ifdefs which
although a bit unsightly is better than using compiler/linker features
we cannot trust.
Signed-off-by: Keir Fraser <keir@xen.org>
Index: xen-4.0.2-testing/xen/drivers/acpi/numa.c
===================================================================
--- xen-4.0.2-testing.orig/xen/drivers/acpi/numa.c
+++ xen-4.0.2-testing/xen/drivers/acpi/numa.c
@@ -120,14 +120,15 @@ static int __init acpi_parse_slit(struct
return 0;
}
-void __init __attribute__ ((weak))
+#ifndef CONFIG_X86
+void __init
acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa)
{
printk(KERN_WARNING PREFIX
"Found unsupported x2apic [0x%08x] SRAT entry\n", pa->apic_id);
return;
}
-
+#endif
static int __init
acpi_parse_x2apic_affinity(struct acpi_subtable_header *header,

View File

@ -1,109 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1294746050 0
# Node ID 2ff199e2842b7e4f08ea99558afc32536a77280c
# Parent ca10302ac2859b43a41afe425d79ae0df29f2a9c
x86: restore x2apic pre-enabled check logic
References: bnc#656369, bnc#658704
c/s 22475 removed the early checking without replacement, neglecting
the fact that x2apic_enabled must be set early for APIC register
accesses done during second stage ACPI table parsing (rooted at
acpi_boot_init()) to work correctly. Without this, particularly
determination of the boot CPU won't work, resulting in an attempt to
bring up that CPU again as a secondary one (which fails).
Restore the functionality, now calling it from generic_apic_probe().
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-4.0.2-testing/xen/arch/x86/apic.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/apic.c
+++ xen-4.0.2-testing/xen/arch/x86/apic.c
@@ -948,7 +948,6 @@ no_apic:
void x2apic_setup(void)
{
struct IO_APIC_route_entry **ioapic_entries = NULL;
- u32 lo, hi;
if ( smp_processor_id() != 0 )
{
@@ -960,14 +959,6 @@ void x2apic_setup(void)
if ( !cpu_has_x2apic )
return;
- /* Check whether x2apic mode was already enabled by the BIOS. */
- rdmsr(MSR_IA32_APICBASE, lo, hi);
- if ( lo & MSR_IA32_APICBASE_EXTD )
- {
- printk("x2APIC mode is already enabled by BIOS.\n");
- x2apic_enabled = 1;
- }
-
if ( !opt_x2apic )
{
if ( !x2apic_enabled )
Index: xen-4.0.2-testing/xen/arch/x86/genapic/probe.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/genapic/probe.c
+++ xen-4.0.2-testing/xen/arch/x86/genapic/probe.c
@@ -59,8 +59,10 @@ custom_param("apic", genapic_apic_force)
void __init generic_apic_probe(void)
{
- int i;
- int changed = cmdline_apic = (genapic != NULL);
+ int i, changed;
+
+ check_x2apic_preenabled();
+ cmdline_apic = changed = (genapic != NULL);
for (i = 0; !changed && apic_probe[i]; i++) {
if (apic_probe[i]->probe()) {
Index: xen-4.0.2-testing/xen/arch/x86/genapic/x2apic.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/genapic/x2apic.c
+++ xen-4.0.2-testing/xen/arch/x86/genapic/x2apic.c
@@ -20,6 +20,8 @@
#include <xen/cpumask.h>
#include <asm/apicdef.h>
#include <asm/genapic.h>
+#include <asm/msr.h>
+#include <asm/processor.h>
#include <xen/smp.h>
#include <asm/mach-default/mach_mpparse.h>
@@ -134,3 +136,20 @@ const struct genapic *apic_x2apic_probe(
{
return x2apic_phys ? &apic_x2apic_phys : &apic_x2apic_cluster;
}
+
+void __init check_x2apic_preenabled(void)
+{
+ u32 lo, hi;
+
+ if ( !cpu_has_x2apic )
+ return;
+
+ /* Check whether x2apic mode was already enabled by the BIOS. */
+ rdmsr(MSR_IA32_APICBASE, lo, hi);
+ if ( lo & MSR_IA32_APICBASE_EXTD )
+ {
+ printk("x2APIC mode is already enabled by BIOS.\n");
+ x2apic_enabled = 1;
+ genapic = apic_x2apic_probe();
+ }
+}
Index: xen-4.0.2-testing/xen/include/asm-x86/apic.h
===================================================================
--- xen-4.0.2-testing.orig/xen/include/asm-x86/apic.h
+++ xen-4.0.2-testing/xen/include/asm-x86/apic.h
@@ -25,6 +25,7 @@ extern int apic_verbosity;
extern int x2apic_enabled;
extern int directed_eoi_enabled;
+void check_x2apic_preenabled(void);
void x2apic_setup(void);
const struct genapic *apic_x2apic_probe(void);

View File

@ -1,114 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1294746099 0
# Node ID 7926538a633297d65a5d6324bf9bd0eb158a6aff
# Parent 2ff199e2842b7e4f08ea99558afc32536a77280c
xenctx: misc adjustments
- fix off-by-one errors during symbol insertion and lookup
- don't store the symbol type, as it wasn't needed at all so far and
is only needed now at parsing time
- don't insert certain kinds of symbols
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-4.0.2-testing/tools/xentrace/xenctx.c
===================================================================
--- xen-4.0.2-testing.orig/tools/xentrace/xenctx.c
+++ xen-4.0.2-testing/tools/xentrace/xenctx.c
@@ -19,6 +19,7 @@
#include <unistd.h>
#include <errno.h>
#include <signal.h>
+#include <ctype.h>
#include <string.h>
#include <inttypes.h>
#include <getopt.h>
@@ -58,7 +59,6 @@ int disp_tlb;
struct symbol {
guest_word_t address;
- char type;
char *name;
struct symbol *next;
} *symbol_table = NULL;
@@ -112,12 +112,12 @@ static void insert_symbol(struct symbol
/* The System.map is usually already sorted... */
if (prev
- && prev->address < symbol->address
+ && prev->address <= symbol->address
&& (!prev->next || prev->next->address > symbol->address)) {
s = prev;
} else {
/* ... otherwise do crappy/slow search for the correct place */
- while(s && s->next && s->next->address < symbol->address)
+ while (s->next && s->next->address <= symbol->address)
s = s->next;
}
@@ -130,13 +130,13 @@ static struct symbol *lookup_symbol(gues
{
struct symbol *s = symbol_table;
- while(s && s->next && s->next->address < address)
- s = s->next;
+ if (!s)
+ return NULL;
- if (s && s->address < address)
- return s;
+ while (s->next && s->next->address < address)
+ s = s->next;
- return NULL;
+ return s->next && s->next->address <= address ? s->next : s;
}
static void print_symbol(guest_word_t addr)
@@ -159,7 +159,7 @@ static void print_symbol(guest_word_t ad
static void read_symbol_table(const char *symtab)
{
- char line[256];
+ char type, line[256];
char *p;
struct symbol *symbol;
FILE *f;
@@ -178,9 +178,13 @@ static void read_symbol_table(const char
/* need more checks for syntax here... */
symbol->address = strtoull(line, &p, 16);
- p++;
- symbol->type = *p++;
- p++;
+ if (!isspace(*p++))
+ continue;
+ type = *p++;
+ if (!isalpha(type) && type != '?')
+ continue;
+ if (!isspace(*p++))
+ continue;
/* in the future we should handle the module name
* being appended here, this would allow us to use
@@ -190,7 +194,18 @@ static void read_symbol_table(const char
p[strlen(p)-1] = '\0';
symbol->name = strdup(p);
- insert_symbol(symbol);
+ switch (type) {
+ case 'A': /* global absolute */
+ case 'a': /* local absolute */
+ break;
+ case 'U': /* undefined */
+ case 'v': /* undefined weak object */
+ case 'w': /* undefined weak function */
+ continue;
+ default:
+ insert_symbol(symbol);
+ break;
+ }
if (strcmp(symbol->name, "_stext") == 0)
kernel_stext = symbol->address;

View File

@ -1,47 +0,0 @@
# HG changeset patch
# User Tim Deegan <Tim.Deegan@citrix.com>
# Date 1294933573 0
# Node ID b01ef59c8c805df751a8f6ae63cdd5c6a4565255
# Parent 54e91dcae649e23fd267d7afe623fbd52b1b4283
x86/mm: fix EPT PoD locking to match the normal p2m case.
This recursive-locking bug was fixed in the main p2m code in
20269:fd3d5d66c446 (in October 2009) but has lurked unseen in
the EPT side since then. Copy the fix across.
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Index: xen-4.0.2-testing/xen/arch/x86/mm/hap/p2m-ept.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/mm/hap/p2m-ept.c
+++ xen-4.0.2-testing/xen/arch/x86/mm/hap/p2m-ept.c
@@ -37,19 +37,26 @@ static int ept_pod_check_and_populate(st
ept_entry_t *entry, int order,
p2m_query_t q)
{
+ /* Only take the lock if we don't already have it. Otherwise it
+ * wouldn't be safe to do p2m lookups with the p2m lock held */
+ int do_locking = !p2m_locked_by_me(d->arch.p2m);
int r;
- p2m_lock(d->arch.p2m);
+
+ if ( do_locking )
+ p2m_lock(d->arch.p2m);
/* Check to make sure this is still PoD */
if ( entry->avail1 != p2m_populate_on_demand )
{
- p2m_unlock(d->arch.p2m);
+ if ( do_locking )
+ p2m_unlock(d->arch.p2m);
return 0;
}
r = p2m_pod_demand_populate(d, gfn, order, q);
- p2m_unlock(d->arch.p2m);
+ if ( do_locking )
+ p2m_unlock(d->arch.p2m);
return r;
}

View File

@ -1,264 +0,0 @@
References: bnc#633573
# HG changeset patch
# User Allen Kay <allen.m.kay@intel.com>
# Date 1294992706 0
# Node ID 93e7bf0e1845f1a82441fb740522a9b9cb32beda
# Parent 47713825a3f910fc7cf7571947e8b3b4eab23d5f
vt-d: quirks for Sandybridge errata workaround, WLAN, VT-d fault escalation
Adding errata workaround for newly released Sandybridge processor
graphics, additional WLAN device ID's for WLAN quirk, a quirk for
masking VT-d fault escalation to IOH HW that can cause system hangs on
some OEM hardware where the BIOS erroneously escalates VT-d faults to
the platform.
Signed-off-by: Allen Kay <allen.m.kay@intel.com>
# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1295625672 0
# Node ID 1637fdbfc21e2c732eca29136943a568f8f341cd
# Parent 43592043cefc8357e6e6a0ab9ba85ca480968cb1
[VTD][QUIRK] turn off Sandybridge IGD quirk by default
Turn off Sandybridge IGD quirk by default until potential issues such
as MMIO register conflict with OS device driver and proper locking in
preamble and postamble functions are addressed.
Signed-off-by: Allen Kay <allen.m.kay@intel.com>
# HG changeset patch
# User Allen Kay <allen.m.kay@intel.com>
# Date 1296587456 0
# Node ID 3edd21ffe407ac0e853d51aa8302d9bdb4068749
# Parent 0e2c8b75f7d233f15f8bb49d9db0579e7a350964
passthrough/vtd: disable 64-bit MMCFG quirk on 32-bit Xen
Attached patch disables pci_vtd_quirk for 32-bit Xen since 32-bit xen
does not support MMCFG access.
Signed-off-by: Allen Kay <allen.m.kay@intel.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -87,5 +87,6 @@ void __init platform_quirks_init(void);
void vtd_ops_preamble_quirk(struct iommu* iommu);
void vtd_ops_postamble_quirk(struct iommu* iommu);
void me_wifi_quirk(struct domain *domain, u8 bus, u8 devfn, int map);
+void pci_vtd_quirk(struct pci_dev *pdev);
#endif // _VTD_EXTERN_H_
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1845,6 +1845,7 @@ static void setup_dom0_devices(struct do
list_add(&pdev->domain_list, &d->arch.pdev_list);
domain_context_mapping(d, pdev->bus, pdev->devfn);
pci_enable_acs(pdev);
+ pci_vtd_quirk(pdev);
}
}
spin_unlock(&pcidevs_lock);
--- a/xen/drivers/passthrough/vtd/quirks.c
+++ b/xen/drivers/passthrough/vtd/quirks.c
@@ -47,11 +47,13 @@
#define IS_CTG(id) (id == 0x2a408086)
#define IS_ILK(id) (id == 0x00408086 || id == 0x00448086 || id== 0x00628086 || id == 0x006A8086)
#define IS_CPT(id) (id == 0x01008086 || id == 0x01048086)
+#define IS_SNB_GFX(id) (id == 0x01068086 || id == 0x01168086 || id == 0x01268086 || id == 0x01028086 || id == 0x01128086 || id == 0x01228086 || id == 0x010A8086)
u32 ioh_id;
u32 igd_id;
bool_t rwbf_quirk;
static int is_cantiga_b3;
+static int is_snb_gfx;
static u8 *igd_reg_va;
/*
@@ -92,6 +94,12 @@ static void cantiga_b3_errata_init(void)
is_cantiga_b3 = 1;
}
+/* check for Sandybridge IGD device ID's */
+static void snb_errata_init(void)
+{
+ is_snb_gfx = IS_SNB_GFX(igd_id);
+}
+
/*
* QUIRK to workaround Cantiga IGD VT-d low power errata.
* This errata impacts IGD assignment on Cantiga systems
@@ -104,12 +112,15 @@ static void cantiga_b3_errata_init(void)
/*
* map IGD MMIO+0x2000 page to allow Xen access to IGD 3D register.
*/
-static void map_igd_reg(void)
+static void *map_igd_reg(void)
{
u64 igd_mmio, igd_reg;
- if ( !is_cantiga_b3 || igd_reg_va != NULL )
- return;
+ if ( !is_cantiga_b3 && !is_snb_gfx )
+ return NULL;
+
+ if ( igd_reg_va )
+ return igd_reg_va;
/* get IGD mmio address in PCI BAR */
igd_mmio = ((u64)pci_conf_read32(0, IGD_DEV, 0, 0x14) << 32) +
@@ -121,6 +132,7 @@ static void map_igd_reg(void)
/* ioremap this physical page */
set_fixmap_nocache(FIX_IGD_MMIO, igd_reg);
igd_reg_va = (u8 *)fix_to_virt(FIX_IGD_MMIO);
+ return igd_reg_va;
}
/*
@@ -134,6 +146,9 @@ static int cantiga_vtd_ops_preamble(stru
if ( !is_igd_drhd(drhd) || !is_cantiga_b3 )
return 0;
+ if ( !map_igd_reg() )
+ return 0;
+
/*
* read IGD register at IGD MMIO + 0x20A4 to force IGD
* to exit low power state. Since map_igd_reg()
@@ -144,11 +159,69 @@ static int cantiga_vtd_ops_preamble(stru
}
/*
+ * Sandybridge RC6 power management inhibit state erratum.
+ * This can cause power high power consumption.
+ * Workaround is to prevent graphics get into RC6
+ * state when doing VT-d IOTLB operations, do the VT-d
+ * IOTLB operation, and then re-enable RC6 state.
+ */
+static void snb_vtd_ops_preamble(struct iommu* iommu)
+{
+ struct intel_iommu *intel = iommu->intel;
+ struct acpi_drhd_unit *drhd = intel ? intel->drhd : NULL;
+ s_time_t start_time;
+
+ if ( !is_igd_drhd(drhd) || !is_snb_gfx )
+ return;
+
+ if ( !map_igd_reg() )
+ return;
+
+ *((volatile u32 *)(igd_reg_va + 0x54)) = 0x000FFFFF;
+ *((volatile u32 *)(igd_reg_va + 0x700)) = 0;
+
+ start_time = NOW();
+ while ( (*((volatile u32 *)(igd_reg_va + 0x2AC)) & 0xF) != 0 )
+ {
+ if ( NOW() > start_time + DMAR_OPERATION_TIMEOUT )
+ {
+ dprintk(XENLOG_INFO VTDPREFIX,
+ "snb_vtd_ops_preamble: failed to disable idle handshake\n");
+ break;
+ }
+ cpu_relax();
+ }
+
+ *((volatile u32*)(igd_reg_va + 0x50)) = 0x10001;
+}
+
+static void snb_vtd_ops_postamble(struct iommu* iommu)
+{
+ struct intel_iommu *intel = iommu->intel;
+ struct acpi_drhd_unit *drhd = intel ? intel->drhd : NULL;
+
+ if ( !is_igd_drhd(drhd) || !is_snb_gfx )
+ return;
+
+ if ( !map_igd_reg() )
+ return;
+
+ *((volatile u32 *)(igd_reg_va + 0x54)) = 0xA;
+ *((volatile u32 *)(igd_reg_va + 0x50)) = 0x10000;
+}
+
+/*
* call before VT-d translation enable and IOTLB flush operations.
*/
+
+static int snb_igd_quirk;
+boolean_param("snb_igd_quirk", snb_igd_quirk);
+
void vtd_ops_preamble_quirk(struct iommu* iommu)
{
cantiga_vtd_ops_preamble(iommu);
+ if ( snb_igd_quirk )
+ snb_vtd_ops_preamble(iommu);
}
/*
@@ -156,7 +229,8 @@ void vtd_ops_preamble_quirk(struct iommu
*/
void vtd_ops_postamble_quirk(struct iommu* iommu)
{
- return;
+ if ( snb_igd_quirk )
+ snb_vtd_ops_postamble(iommu);
}
/* initialize platform identification flags */
@@ -175,6 +249,8 @@ void __init platform_quirks_init(void)
/* initialize cantiga B3 identification */
cantiga_b3_errata_init();
+ snb_errata_init();
+
/* ioremap IGD MMIO+0x2000 page */
map_igd_reg();
}
@@ -246,11 +322,14 @@ void me_wifi_quirk(struct domain *domain
id = pci_conf_read32(bus, PCI_SLOT(devfn), PCI_FUNC(devfn), 0);
switch (id)
{
- case 0x00878086:
+ case 0x00878086: /* Kilmer Peak */
case 0x00898086:
- case 0x00828086:
+ case 0x00828086: /* Taylor Peak */
case 0x00858086:
- case 0x42388086:
+ case 0x008F8086: /* Rainbow Peak */
+ case 0x00908086:
+ case 0x00918086:
+ case 0x42388086: /* Puma Peak */
case 0x422b8086:
case 0x422c8086:
map_me_phantom_function(domain, 22, map);
@@ -258,6 +337,28 @@ void me_wifi_quirk(struct domain *domain
default:
break;
}
+ }
+}
+/*
+ * Mask reporting Intel VT-d faults to IOH core logic:
+ * - Some platform escalates VT-d faults to platform errors
+ * - This can cause system failure upon non-fatal VT-d faults
+ * - Potential security issue if malicious guest trigger VT-d faults
+ */
+void pci_vtd_quirk(struct pci_dev *pdev)
+{
+#ifdef CONFIG_X86_64
+ int bus = pdev->bus;
+ int dev = PCI_SLOT(pdev->devfn);
+ int func = PCI_FUNC(pdev->devfn);
+ int id, val;
+
+ id = pci_conf_read32(bus, dev, func, 0);
+ if ( id == 0x342e8086 || id == 0x3c288086 )
+ {
+ val = pci_conf_read32(bus, dev, func, 0x1AC);
+ pci_conf_write32(bus, dev, func, 0x1AC, val | (1 << 31));
}
+#endif
}

View File

@ -1,110 +0,0 @@
# HG changeset patch
# User Jan Beulich <jbeulich@novell.com>
# Date 1295353690 0
# Node ID 1e7594758b28706c2b72358598ecf632ddda247b
# Parent 78e2e5a50daa1702e3fd9dbceada700cdaefd511
VT-d/ATS: misc fixes
First of all there were three places potentially de-referencing NULL
(two after an allocation failure, and one after a failed lookup).
Second, if ATS_ENABLE was already set, the device would not have got
added to the ats_devices list, potentially resulting in
dev_invalidate_iotlb() doing an incomplete job.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Index: xen-4.0.2-testing/xen/drivers/passthrough/vtd/x86/ats.c
===================================================================
--- xen-4.0.2-testing.orig/xen/drivers/passthrough/vtd/x86/ats.c
+++ xen-4.0.2-testing/xen/drivers/passthrough/vtd/x86/ats.c
@@ -91,6 +91,9 @@ int ats_device(int seg, int bus, int dev
return 0;
pdev = pci_get_pdev(bus, devfn);
+ if ( !pdev )
+ return 0;
+
drhd = acpi_find_matched_drhd_unit(pdev);
if ( !drhd )
return 0;
@@ -108,6 +111,8 @@ int ats_device(int seg, int bus, int dev
if ( pos && (ats_drhd == NULL) )
{
new_drhd = xmalloc(struct acpi_drhd_unit);
+ if ( !new_drhd )
+ return 0;
memcpy(new_drhd, drhd, sizeof(struct acpi_drhd_unit));
list_add_tail(&new_drhd->list, &ats_dev_drhd_units);
}
@@ -116,9 +121,8 @@ int ats_device(int seg, int bus, int dev
int enable_ats_device(int seg, int bus, int devfn)
{
- struct pci_ats_dev *pdev;
+ struct pci_ats_dev *pdev = NULL;
u32 value;
- u16 queue_depth;
int pos;
if ( !acpi_find_matched_atsr_unit(bus, devfn) )
@@ -142,26 +146,43 @@ int enable_ats_device(int seg, int bus,
/* BUGBUG: add back seg when multi-seg platform support is enabled */
value = pci_conf_read16(bus, PCI_SLOT(devfn),
- PCI_FUNC(devfn), pos + ATS_REG_CAP);
- queue_depth = value & ATS_QUEUE_DEPTH_MASK;
-
- value = pci_conf_read16(bus, PCI_SLOT(devfn),
PCI_FUNC(devfn), pos + ATS_REG_CTL);
if ( value & ATS_ENABLE )
- return 0;
+ {
+ list_for_each_entry ( pdev, &ats_devices, list )
+ {
+ if ( pdev->bus == bus && pdev->devfn == devfn )
+ {
+ pos = 0;
+ break;
+ }
+ }
+ }
+ if ( pos )
+ pdev = xmalloc(struct pci_ats_dev);
+ if ( !pdev )
+ return -ENOMEM;
+
+ if ( !(value & ATS_ENABLE) )
+ {
+ value |= ATS_ENABLE;
+ pci_conf_write16(bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
+ pos + ATS_REG_CTL, value);
+ }
+
+ if ( pos )
+ {
+ pdev->bus = bus;
+ pdev->devfn = devfn;
+ value = pci_conf_read16(bus, PCI_SLOT(devfn),
+ PCI_FUNC(devfn), pos + ATS_REG_CAP);
+ pdev->ats_queue_depth = value & ATS_QUEUE_DEPTH_MASK;
+ list_add(&pdev->list, &ats_devices);
+ }
- value |= ATS_ENABLE;
- pci_conf_write16(bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
- pos + ATS_REG_CTL, value);
-
- pdev = xmalloc(struct pci_ats_dev);
- pdev->bus = bus;
- pdev->devfn = devfn;
- pdev->ats_queue_depth = queue_depth;
- list_add(&(pdev->list), &ats_devices);
if ( iommu_verbose )
- dprintk(XENLOG_INFO VTDPREFIX, "%x:%x.%x: ATS is enabled\n",
- bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+ dprintk(XENLOG_INFO VTDPREFIX, "%x:%x.%x: ATS %s enabled\n",
+ bus, PCI_SLOT(devfn), PCI_FUNC(devfn), pos ? "is" : "was");
return pos;
}

View File

@ -1,64 +0,0 @@
# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1295274541 0
# Node ID 3decd02e0b18ae21fb926c6bad96a4cd02c48272
# Parent 97ab84aca65cdcbce2ddccc51629fb24adb056cf
PoD,hap: Fix logdirty mode when using hardware assisted paging
When writing a writable p2m entry for a pfn, we need to mark the pfn
dirty to avoid corruption when doing live migration.
Marking the page dirty exposes another issue, where there are
excessive sweeps for zero pages if there's a mismatch between PoD
entries and cache entries. Only sweep for zero pages if we actually
need more memory.
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
Index: xen-4.0.2-testing/xen/arch/x86/mm/p2m.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/mm/p2m.c
+++ xen-4.0.2-testing/xen/arch/x86/mm/p2m.c
@@ -1064,14 +1064,22 @@ p2m_pod_demand_populate(struct domain *d
if ( unlikely(d->is_dying) )
goto out_fail;
- /* If we're low, start a sweep */
- if ( order == 9 && page_list_empty(&p2md->pod.super) )
- p2m_pod_emergency_sweep_super(d);
-
- if ( page_list_empty(&p2md->pod.single) &&
- ( ( order == 0 )
- || (order == 9 && page_list_empty(&p2md->pod.super) ) ) )
- p2m_pod_emergency_sweep(d);
+ /* Once we've ballooned down enough that we can fill the remaining
+ * PoD entries from the cache, don't sweep even if the particular
+ * list we want to use is empty: that can lead to thrashing zero pages
+ * through the cache for no good reason. */
+ if ( p2md->pod.entry_count > p2md->pod.count )
+ {
+
+ /* If we're low, start a sweep */
+ if ( order == 9 && page_list_empty(&p2md->pod.super) )
+ p2m_pod_emergency_sweep_super(d);
+
+ if ( page_list_empty(&p2md->pod.single) &&
+ ( ( order == 0 )
+ || (order == 9 && page_list_empty(&p2md->pod.super) ) ) )
+ p2m_pod_emergency_sweep(d);
+ }
/* Keep track of the highest gfn demand-populated by a guest fault */
if ( q == p2m_guest && gfn > p2md->pod.max_guest )
@@ -1098,7 +1106,10 @@ p2m_pod_demand_populate(struct domain *d
set_p2m_entry(d, gfn_aligned, mfn, order, p2m_ram_rw);
for( i = 0 ; i < (1UL << order) ; i++ )
+ {
set_gpfn_from_mfn(mfn_x(mfn) + i, gfn_aligned + i);
+ paging_mark_dirty(d, mfn_x(mfn) + i);
+ }
p2md->pod.entry_count -= (1 << order); /* Lock: p2m */
BUG_ON(p2md->pod.entry_count < 0);

View File

@ -1,82 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1295625507 0
# Node ID 9bd5f65050f8014de7d0fcf9d89ed8c441f261fa
# Parent 5852612cd4c461e5219db73cc52de0c643c414e8
x86:x2apic: Disable x2apic on x86-32 permanently
x2apic initialization on x86_32 uses vcpu pointer before it is
initialized. As x2apic is unlikely to be used on x86_32, this patch
disables x2apic permanently on x86_32. It also asserts the sanity of
vcpu pointer before dereference to prevent further misuse.
Signed-off-by: Fengzhe Zhang <fengzhe.zhang@intel.com>
jb: Moved logic into check_x2apic_preenabled(), disabled dead code on
x86_32.
Index: xen-4.0.2-testing/xen/arch/x86/apic.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/apic.c
+++ xen-4.0.2-testing/xen/arch/x86/apic.c
@@ -959,6 +959,10 @@ void x2apic_setup(void)
if ( !cpu_has_x2apic )
return;
+#ifdef __i386__
+ BUG();
+#else
+
if ( !opt_x2apic )
{
if ( !x2apic_enabled )
@@ -1020,6 +1024,7 @@ restore_out:
unmask_8259A();
out:
+#endif /* !__i386__ */
if ( ioapic_entries )
free_ioapic_entries(ioapic_entries);
}
Index: xen-4.0.2-testing/xen/arch/x86/genapic/x2apic.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/genapic/x2apic.c
+++ xen-4.0.2-testing/xen/arch/x86/genapic/x2apic.c
@@ -25,6 +25,8 @@
#include <xen/smp.h>
#include <asm/mach-default/mach_mpparse.h>
+#ifndef __i386__
+
static int x2apic_phys; /* By default we use logical cluster mode. */
boolean_param("x2apic_phys", x2apic_phys);
@@ -137,6 +139,8 @@ const struct genapic *apic_x2apic_probe(
return x2apic_phys ? &apic_x2apic_phys : &apic_x2apic_cluster;
}
+#endif /* !__i386__ */
+
void __init check_x2apic_preenabled(void)
{
u32 lo, hi;
@@ -149,7 +153,19 @@ void __init check_x2apic_preenabled(void
if ( lo & MSR_IA32_APICBASE_EXTD )
{
printk("x2APIC mode is already enabled by BIOS.\n");
+#ifndef __i386__
x2apic_enabled = 1;
genapic = apic_x2apic_probe();
+#else
+ lo &= ~(MSR_IA32_APICBASE_ENABLE | MSR_IA32_APICBASE_EXTD);
+ wrmsr(MSR_IA32_APICBASE, lo, hi);
+ lo |= MSR_IA32_APICBASE_ENABLE;
+ wrmsr(MSR_IA32_APICBASE, lo, hi);
+ printk("x2APIC disabled permanently on x86_32.\n");
+#endif
}
+
+#ifdef __i386__
+ clear_bit(X86_FEATURE_X2APIC, boot_cpu_data.x86_capability);
+#endif
}

View File

@ -1,24 +0,0 @@
# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1295625605 0
# Node ID 43592043cefc8357e6e6a0ab9ba85ca480968cb1
# Parent 9bd5f65050f8014de7d0fcf9d89ed8c441f261fa
svm: migrate pirq with vcpu
hvm_migrate_pirqs() is missing in svm_do_resume().
Signed-off-by: Wei Wang <wei.wang2@amd.com>
Index: xen-4.0.2-testing/xen/arch/x86/hvm/svm/svm.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/hvm/svm/svm.c
+++ xen-4.0.2-testing/xen/arch/x86/hvm/svm/svm.c
@@ -697,7 +697,7 @@ static void svm_do_resume(struct vcpu *v
{
v->arch.hvm_svm.launch_core = smp_processor_id();
hvm_migrate_timers(v);
-
+ hvm_migrate_pirqs(v);
/* Migrating to another ASID domain. Request a new ASID. */
hvm_asid_flush_vcpu(v);
}

View File

@ -1,8 +1,8 @@
Index: xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py
Index: xen-4.1.0-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -2919,7 +2919,7 @@ class XendDomainInfo:
--- xen-4.1.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-4.1.0-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -2912,7 +2912,7 @@ class XendDomainInfo:
self.guest_bitsize = self.image.getBitSize()
# Make sure there's enough RAM available for the domain

View File

@ -1,118 +0,0 @@
# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1284481903 -3600
# Node ID f71a4c18e34e86e1011662fa42c10ec54bff0688
# Parent 080b5a094d4e0acab6646125f91f988911409016
ioemu: fix VNC altgr-insert behavior
When access to a Xen DomU (Linux) from a VNC client in Windows, alt-gr
key is not working properly with Spanish keyboard. When Alt + another
key pressed, vncserver receives Altgr down, Altgr up and key down
messages in order, that causes incorrect output.
With following patch, when vncerver receives key down message, it
first check if the keysym needs altgr modifer, if it needs altgr
modifier but altgr is not 'down', sending altgr keycode before sending
key keycode.
Signed-off-by: Chunyan Liu <cyliu@novell.com>
committer: Ian Jackson <Ian.Jackson@eu.citrix.com>
git-commit-id: f95d202ed6444dacb15fbea4dee185eb0e048d9a
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/keymaps.c
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/keymaps.c
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/keymaps.c
@@ -51,6 +51,7 @@ typedef struct {
struct key_range *numlock_range;
struct key_range *shift_range;
struct key_range *localstate_range;
+ struct key_range *altgr_range;
} kbd_layout_t;
static void add_to_key_range(struct key_range **krp, int code) {
@@ -133,6 +134,10 @@ static kbd_layout_t *parse_keyboard_layo
add_to_key_range(&k->localstate_range, keycode);
//fprintf(stderr, "localstate keysym %04x keycode %d\n", keysym, keycode);
}
+ if (rest && strstr(rest, "altgr")) {
+ add_to_key_range(&k->altgr_range, keysym);
+ //fprintf(stderr, "altgr keysym %04x keycode %d\n", keysym, keycode);
+ }
/* if(keycode&0x80)
keycode=(keycode<<8)^0x80e0; */
@@ -233,3 +238,16 @@ static inline int keycode_is_shiftable(v
return 0;
return 1;
}
+
+static inline int keysym_is_altgr(void *kbd_layout, int keysym)
+{
+ kbd_layout_t *k = kbd_layout;
+ struct key_range *kr;
+
+ for (kr = k->altgr_range; kr; kr = kr->next)
+ if (keysym >= kr->start && keysym <= kr->end){
+ return 1;
+ }
+ return 0;
+}
+
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/vnc.c
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/vnc.c
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/vnc.c
@@ -1274,12 +1274,27 @@ static void press_key_shift_up(VncState
}
}
+static void press_key_altgr_down(VncState *vs, int down)
+{
+ kbd_put_keycode(0xe0);
+ if (down){
+ kbd_put_keycode(0xb8 & 0x7f);
+ vs->modifiers_state[0xb8] = 1;
+ }
+ else {
+ kbd_put_keycode(0xb8 | 0x80);
+ vs->modifiers_state[0xb8] = 0;
+ }
+}
+
static void do_key_event(VncState *vs, int down, uint32_t sym)
{
int keycode;
int shift_keys = 0;
int shift = 0;
int keypad = 0;
+ int altgr = 0;
+ int altgr_keys = 0;
if (is_graphic_console()) {
if (sym >= 'A' && sym <= 'Z') {
@@ -1289,8 +1304,11 @@ static void do_key_event(VncState *vs, i
else {
shift = keysym_is_shift(vs->kbd_layout, sym & 0xFFFF);
}
+
+ altgr = keysym_is_altgr(vs->kbd_layout, sym & 0xFFFF);
}
shift_keys = vs->modifiers_state[0x2a] | vs->modifiers_state[0x36];
+ altgr_keys = vs->modifiers_state[0xb8];
keycode = keysym2scancode(vs->kbd_layout, sym & 0xFFFF);
if (keycode == 0) {
@@ -1357,6 +1375,11 @@ static void do_key_event(VncState *vs, i
}
if (is_graphic_console()) {
+
+ if (altgr && !altgr_keys) {
+ press_key_altgr_down(vs, down);
+ }
+
/* If the shift state needs to change then simulate an additional
keypress before sending this one. Ignore for non shiftable keys.
*/

View File

@ -1,50 +0,0 @@
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/xenfb.c
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/hw/xenfb.c
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/xenfb.c
@@ -622,6 +622,18 @@ static void xenfb_guest_copy(struct XenF
oops = 1;
}
break;
+ case 16:
+ if (bpp == 16) {
+ for (line = y; line < (y+h); line++) {
+ memcpy (data + (line * linesize) + (x * bpp / 8), xenfb->pixels + xenfb->offset
+ + (line * xenfb->row_stride) + (x * xenfb->depth / 8), w * xenfb->depth / 8);
+ }
+ } else if (bpp == 32) {
+ BLT(uint16_t, uint32_t, 5, 6, 5, 8, 8, 8);
+ } else {
+ oops = 1;
+ }
+ break;
case 24:
if (bpp == 16) {
BLT(uint32_t, uint16_t, 8, 8, 8, 5, 6, 5);
@@ -631,6 +643,18 @@ static void xenfb_guest_copy(struct XenF
oops = 1;
}
break;
+ case 32:
+ if (bpp == 16) {
+ BLT(uint32_t, uint16_t, 8, 8, 8, 5, 6, 5);
+ } else if (bpp == 32) {
+ for (line = y; line < (y+h); line++) {
+ memcpy (data + (line * linesize) + (x * bpp / 8), xenfb->pixels + xenfb->offset
+ + (line * xenfb->row_stride) + (x * xenfb->depth / 8), w * xenfb->depth / 8);
+ }
+ } else {
+ oops = 1;
+ }
+ break;
default:
oops = 1;
}
@@ -784,6 +808,7 @@ static void xenfb_update(void *opaque)
static void xenfb_invalidate(void *opaque)
{
struct XenFB *xenfb = opaque;
+ xenfb->do_resize = 1;
xenfb->up_fullscreen = 1;
}

View File

@ -1,106 +0,0 @@
# HG changeset patch
# User Chun Yan Liu <cyliu@novell.com>
# Date 1294271316 0
# Node ID a283996796c91dd29ecff444b78798e0ce902047
# Parent 39df13908a3ad54e79dd3b53ed307e57f12f6d3d
fix '|' key display problem in en-us with altgr processing
Commit f95d202ed644 handles altgr-insert problem. Unfortunately, with
that patch, there is a problem in En-us keyboard: '|' (bar) cannot be
displayed. After checking keymap files, we found there are two
definitions to "bar" in en-us: bar 0x56 altgr (in "common") bar 0x2b
shift (in "en-us") First line is actually invalid in en-us
lanuage. The 2nd definition will cover the 1st one.
The previous change in didn't consider multi-definition case. It scans
keymap files, if keysym needs altgr, it will records that, after that,
if keysym is pressed but altgr not pressed, it will add an altgr press
opeartion. It is correct if all keysyms are unique and valid. But in
the above multi-definition case, there is problem: when reading bar
0x56 altgr (in "common") it will record altgr needed, but in fact,
that definition won't be used, it always use the 2nd definition and
won't need altgr. Then if the keysym is pressed, the code will still
add an altgr press operation, that will cause problem.
So, if we cannot avoid multi-definition in keymap files, the altgr
flag (whether altgr needed or not) should also be refreshed according
to the 2nd defintion. In the above case, when reading the 1st line, it
records altgr needed; then reading 2nd line, 2nd definition will cover
the 1st, meanwhile the altgr flag should be reset (the 2nd definition
doesn't need altgr, so altgr flag should be removed.)
Following patch supplements f95d202ed644, and solve the
problem.
Signed-off-by: Chun Yan Liu <cyliu@novell.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
committer: Ian Jackson <Ian.Jackson@eu.citrix.com>
git-commit-id: 99d53fbb69d3e03be61ae10506a304a3d08d792f
# HG changeset patch
# User Jan Beulich <jbeulich@novell.com>
# Date 1295287237 0
# Node ID b47bf8f7a5e1959d6f5c62febaef9e81dc3231a0
# Parent b6bbe8be0afa54774a19ef43767a029ebddb2666
keymaps.c: fix use after free in del_key_range
Commit 99d53fbb69d3e03be61ae10506a304a3d08d792f introduced this, and
the compiler indirectly warned about it.
The patch is only compile tested (I don't even know how to reproduce
the original problem), but I suppose worth applying regardless.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Cc: Chun Yan Liu <cyliu@novell.com>
committer: Ian Jackson <Ian.Jackson@eu.citrix.com>
git-commit-id: fdb22f24bc8adb3455b771d804496e11b4570085
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/keymaps.c
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/keymaps.c
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/keymaps.c
@@ -54,6 +54,17 @@ typedef struct {
struct key_range *altgr_range;
} kbd_layout_t;
+static void del_key_range(struct key_range **krp, int code) {
+ struct key_range *kr;
+ while ((kr = *krp) != NULL) {
+ if (code >= kr->start && code <= kr->end) {
+ *krp = kr->next;
+ qemu_free(kr);
+ } else
+ krp = &kr->next;
+ }
+}
+
static void add_to_key_range(struct key_range **krp, int code) {
struct key_range *kr;
for (kr = *krp; kr; kr = kr->next) {
@@ -137,6 +148,8 @@ static kbd_layout_t *parse_keyboard_layo
if (rest && strstr(rest, "altgr")) {
add_to_key_range(&k->altgr_range, keysym);
//fprintf(stderr, "altgr keysym %04x keycode %d\n", keysym, keycode);
+ } else {
+ del_key_range(&k->altgr_range, keysym);
}
/* if(keycode&0x80)
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/vnc.c
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/vnc.c
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/vnc.c
@@ -1279,11 +1279,9 @@ static void press_key_altgr_down(VncStat
kbd_put_keycode(0xe0);
if (down){
kbd_put_keycode(0xb8 & 0x7f);
- vs->modifiers_state[0xb8] = 1;
}
else {
kbd_put_keycode(0xb8 | 0x80);
- vs->modifiers_state[0xb8] = 0;
}
}

View File

@ -1,36 +0,0 @@
# HG changeset patch
# User Jan Beulich <jbeulich@novell.com>
# Date 1294771190 0
# Node ID d224cef9d82c5c1ba9a6d73ca2628f288ce6f434
# Parent a283996796c91dd29ecff444b78798e0ce902047
bump RLIMIT_AS if restricted
References: bnc#641419
Mostly the same as is already being done for several other RLIMIT_*
values.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
committer: Ian Jackson <Ian.Jackson@eu.citrix.com>
git-commit-id: 2aa36d470e97f4baa219f78df82e2d3fe3d9f96d
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/vl.c
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/vl.c
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/vl.c
@@ -4845,6 +4845,13 @@ int main(int argc, char **argv, char **e
rl.rlim_cur = rl.rlim_max;
if (setrlimit(RLIMIT_DATA, &rl) != 0)
perror("setrlimit(RLIMIT_DATA)");
+ if (getrlimit(RLIMIT_AS, &rl) == 0) {
+ rl.rlim_cur = rl.rlim_max;
+ if (setrlimit(RLIMIT_AS, &rl) != 0)
+ perror("setrlimit(RLIMIT_AS)");
+ } else {
+ perror("getrlimit(RLIMIT_AS)");
+ }
rl.rlim_cur = RLIM_INFINITY;
rl.rlim_max = RLIM_INFINITY;
if (setrlimit(RLIMIT_RSS, &rl) != 0)

View File

@ -29,10 +29,10 @@ keycodes up and down events and make sure the intentionally added altgr keycode
Signed-off by Chunyan Liu (cyliu@novell.com)
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/vnc.c
Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/vnc.c
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/vnc.c
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/vnc.c
--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/vnc.c
+++ xen-4.1.0-testing/tools/ioemu-qemu-xen/vnc.c
@@ -1308,6 +1308,9 @@ static void do_key_event(VncState *vs, i
shift_keys = vs->modifiers_state[0x2a] | vs->modifiers_state[0x36];
altgr_keys = vs->modifiers_state[0xb8];

View File

@ -1,11 +1,11 @@
Subject: modify default read/write flag in bdrv_init.
Signed-off by Chunyan Liu <cyliu@novell.com>
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/vl.c
Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/vl.c
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/vl.c
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/vl.c
@@ -2612,6 +2612,8 @@ int drive_init(struct drive_opt *arg, in
--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/vl.c
+++ xen-4.1.0-testing/tools/ioemu-qemu-xen/vl.c
@@ -2617,6 +2617,8 @@ int drive_init(struct drive_opt *arg, in
strncpy(drives_table[nb_drives].serial, serial, sizeof(serial));
nb_drives++;
@ -13,8 +13,8 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/vl.c
+
switch(type) {
case IF_IDE:
case IF_SCSI:
@@ -2624,6 +2626,7 @@ int drive_init(struct drive_opt *arg, in
case IF_XEN:
@@ -2630,6 +2632,7 @@ int drive_init(struct drive_opt *arg, in
break;
case MEDIA_CDROM:
bdrv_set_type_hint(bdrv, BDRV_TYPE_CDROM);
@ -22,7 +22,7 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/vl.c
break;
}
break;
@@ -2644,7 +2647,6 @@ int drive_init(struct drive_opt *arg, in
@@ -2650,7 +2653,6 @@ int drive_init(struct drive_opt *arg, in
}
if (!file[0])
return -2;

View File

@ -1,7 +1,7 @@
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/block.c
Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/block.c
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/block.c
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/block.c
--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/block.c
+++ xen-4.1.0-testing/tools/ioemu-qemu-xen/block.c
@@ -350,7 +350,7 @@ int bdrv_file_open(BlockDriverState **pb
int bdrv_open(BlockDriverState *bs, const char *filename, int flags)
@ -28,10 +28,10 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/block.c
ret = drv->bdrv_open(bs, filename, open_flags);
if ((ret == -EACCES || ret == -EPERM) && !(flags & BDRV_O_FILE)) {
ret = drv->bdrv_open(bs, filename, open_flags & ~BDRV_O_RDWR);
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/usb-msd.c
Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/hw/usb-msd.c
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/hw/usb-msd.c
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/usb-msd.c
--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/hw/usb-msd.c
+++ xen-4.1.0-testing/tools/ioemu-qemu-xen/hw/usb-msd.c
@@ -551,7 +551,7 @@ USBDevice *usb_msd_init(const char *file
s = qemu_mallocz(sizeof(MSDState));
@ -41,10 +41,10 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/usb-msd.c
goto fail;
s->bs = bdrv;
*pbs = bdrv;
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/qemu-img.c
Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/qemu-img.c
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/qemu-img.c
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/qemu-img.c
--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/qemu-img.c
+++ xen-4.1.0-testing/tools/ioemu-qemu-xen/qemu-img.c
@@ -32,7 +32,7 @@
#endif

View File

@ -1,7 +1,7 @@
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c
Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.c
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c
--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.c
+++ xen-4.1.0-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c
@@ -237,6 +237,7 @@ static int open_disk(struct td_state *s,
BlockDriver* drv;
char* devname;
@ -19,10 +19,10 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c
fprintf(stderr, "Could not open image file %s\n", path);
return -ENOMEM;
}
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/xenstore.c
Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/xenstore.c
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/xenstore.c
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/xenstore.c
--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/xenstore.c
+++ xen-4.1.0-testing/tools/ioemu-qemu-xen/xenstore.c
@@ -136,7 +136,8 @@ static void insert_media(void *opaque)
else
format = &bdrv_raw;
@ -33,7 +33,7 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/xenstore.c
#ifdef CONFIG_STUBDOM
{
char *buf, *backend, *params_path, *params;
@@ -469,7 +470,8 @@ void xenstore_parse_domain_config(int hv
@@ -511,7 +512,8 @@ void xenstore_parse_domain_config(int hv
}
for (i = 0; i < num; i++) {
@ -43,7 +43,7 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/xenstore.c
/* read the backend path */
xenstore_get_backend_path(&bpath, "vbd", danger_path, hvm_domid, e_danger[i]);
if (bpath == NULL)
@@ -555,6 +557,17 @@ void xenstore_parse_domain_config(int hv
@@ -597,6 +599,17 @@ void xenstore_parse_domain_config(int hv
format = &bdrv_raw;
}
@ -61,7 +61,7 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/xenstore.c
#if 0
/* Phantom VBDs are disabled because the use of paths
* from guest-controlled areas in xenstore is unsafe.
@@ -622,7 +635,7 @@ void xenstore_parse_domain_config(int hv
@@ -664,7 +677,7 @@ void xenstore_parse_domain_config(int hv
#ifdef CONFIG_STUBDOM
if (pasprintf(&danger_buf, "%s/device/vbd/%s", danger_path, e_danger[i]) == -1)
continue;
@ -70,7 +70,7 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/xenstore.c
pstrcpy(bs->filename, sizeof(bs->filename), params);
}
#else
@@ -668,7 +681,7 @@ void xenstore_parse_domain_config(int hv
@@ -710,7 +723,7 @@ void xenstore_parse_domain_config(int hv
fprintf(stderr, "Using file %s in read-%s mode\n", bs->filename, is_readonly ? "only" : "write");

View File

@ -1,7 +1,7 @@
Index: xen-4.0.2-testing/tools/blktap/drivers/block-cdrom.c
Index: xen-4.1.0-testing/tools/blktap/drivers/block-cdrom.c
===================================================================
--- /dev/null
+++ xen-4.0.2-testing/tools/blktap/drivers/block-cdrom.c
+++ xen-4.1.0-testing/tools/blktap/drivers/block-cdrom.c
@@ -0,0 +1,535 @@
+/* block-cdrom.c
+ *
@ -538,10 +538,10 @@ Index: xen-4.0.2-testing/tools/blktap/drivers/block-cdrom.c
+ .td_get_parent_id = tdcdrom_get_parent_id,
+ .td_validate_parent = tdcdrom_validate_parent
+};
Index: xen-4.0.2-testing/xen/include/public/io/cdromif.h
Index: xen-4.1.0-testing/xen/include/public/io/cdromif.h
===================================================================
--- /dev/null
+++ xen-4.0.2-testing/xen/include/public/io/cdromif.h
+++ xen-4.1.0-testing/xen/include/public/io/cdromif.h
@@ -0,0 +1,122 @@
+/******************************************************************************
+ * cdromif.h
@ -665,19 +665,19 @@ Index: xen-4.0.2-testing/xen/include/public/io/cdromif.h
+ sizeof(struct vcd_generic_command) - sizeof(struct request_sense))
+
+#endif
Index: xen-4.0.2-testing/tools/blktap/drivers/Makefile
Index: xen-4.1.0-testing/tools/blktap/drivers/Makefile
===================================================================
--- xen-4.0.2-testing.orig/tools/blktap/drivers/Makefile
+++ xen-4.0.2-testing/tools/blktap/drivers/Makefile
--- xen-4.1.0-testing.orig/tools/blktap/drivers/Makefile
+++ xen-4.1.0-testing/tools/blktap/drivers/Makefile
@@ -28,8 +28,9 @@ CFLAGS += -DMEMSHR
MEMSHRLIBS += $(MEMSHR_DIR)/libmemshr.a
endif
-LDFLAGS_blktapctrl := $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenstore) $(MEMSHRLIBS) -L../lib -lblktap -lrt -lm -lpthread
-LDFLAGS_img := $(LIBAIO_DIR)/libaio.a $(CRYPT_LIB) -lpthread -lz
+LDFLAGS_xen := $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenstore)
+LDFLAGS_blktapctrl := $(LDFLAGS_xen) $(MEMSHRLIBS) -L../lib -lblktap -lrt -lm -lpthread $(LDFLAGS_xen)
+LDFLAGS_img := $(LIBAIO_DIR)/libaio.a $(CRYPT_LIB) -lpthread -lz $(LDFLAGS_xen)
-LDLIBS_blktapctrl := $(MEMSHRLIBS) $(LDLIBS_libxenctrl) $(LDLIBS_libxenstore) -L../lib -lblktap -lrt -lm -lpthread
-LDLIBS_img := $(LIBAIO_DIR)/libaio.a $(CRYPT_LIB) -lpthread -lz
+LDLIBS_xen := $(LDLIBS_libxenctrl) $(LDLIBS_libxenstore)
+LDLIBS_blktapctrl := $(MEMSHRLIBS) $(LDLIBS_xen) -L../lib -lblktap -lrt -lm -lpthread
+LDLIBS_img := $(LIBAIO_DIR)/libaio.a $(CRYPT_LIB) -lpthread -lz $(LDLIBS_xen)
BLK-OBJS-y := block-aio.o
BLK-OBJS-y += block-sync.o
@ -689,10 +689,10 @@ Index: xen-4.0.2-testing/tools/blktap/drivers/Makefile
BLK-OBJS-y += aes.o
BLK-OBJS-y += tapaio.o
BLK-OBJS-$(CONFIG_Linux) += blk_linux.o
Index: xen-4.0.2-testing/tools/blktap/drivers/tapdisk.h
Index: xen-4.1.0-testing/tools/blktap/drivers/tapdisk.h
===================================================================
--- xen-4.0.2-testing.orig/tools/blktap/drivers/tapdisk.h
+++ xen-4.0.2-testing/tools/blktap/drivers/tapdisk.h
--- xen-4.1.0-testing.orig/tools/blktap/drivers/tapdisk.h
+++ xen-4.1.0-testing/tools/blktap/drivers/tapdisk.h
@@ -137,6 +137,9 @@ struct tap_disk {
int (*td_get_parent_id) (struct disk_driver *dd, struct disk_id *id);
int (*td_validate_parent)(struct disk_driver *dd,
@ -737,10 +737,10 @@ Index: xen-4.0.2-testing/tools/blktap/drivers/tapdisk.h
};
typedef struct driver_list_entry {
Index: xen-4.0.2-testing/tools/blktap/lib/blktaplib.h
Index: xen-4.1.0-testing/tools/blktap/lib/blktaplib.h
===================================================================
--- xen-4.0.2-testing.orig/tools/blktap/lib/blktaplib.h
+++ xen-4.0.2-testing/tools/blktap/lib/blktaplib.h
--- xen-4.1.0-testing.orig/tools/blktap/lib/blktaplib.h
+++ xen-4.1.0-testing/tools/blktap/lib/blktaplib.h
@@ -225,6 +225,7 @@ typedef struct msg_pid {
#define DISK_TYPE_RAM 3
#define DISK_TYPE_QCOW 4
@ -749,25 +749,23 @@ Index: xen-4.0.2-testing/tools/blktap/lib/blktaplib.h
/* xenstore/xenbus: */
#define DOMNAME "Domain-0"
Index: xen-4.0.2-testing/xen/include/public/io/blkif.h
Index: xen-4.1.0-testing/xen/include/public/io/blkif.h
===================================================================
--- xen-4.0.2-testing.orig/xen/include/public/io/blkif.h
+++ xen-4.0.2-testing/xen/include/public/io/blkif.h
@@ -76,6 +76,10 @@
* "feature-flush-cache" node!
--- xen-4.1.0-testing.orig/xen/include/public/io/blkif.h
+++ xen-4.1.0-testing/xen/include/public/io/blkif.h
@@ -80,7 +80,7 @@
* Used in SLES sources for device specific command packet
* contained within the request. Reserved for that purpose.
*/
#define BLKIF_OP_FLUSH_DISKCACHE 3
+/*
+ * Device specific command packet contained within the request
+ */
+#define BLKIF_OP_PACKET 4
-#define BLKIF_OP_RESERVED_1 4
+#define BLKIF_OP_PACKET 4
/*
* Maximum scatter/gather segments per request.
Index: xen-4.0.2-testing/tools/blktap/drivers/tapdisk.c
* Recognised only if "feature-trim" is present in backend xenbus info.
* The "feature-trim" node contains a boolean indicating whether trim
Index: xen-4.1.0-testing/tools/blktap/drivers/tapdisk.c
===================================================================
--- xen-4.0.2-testing.orig/tools/blktap/drivers/tapdisk.c
+++ xen-4.0.2-testing/tools/blktap/drivers/tapdisk.c
--- xen-4.1.0-testing.orig/tools/blktap/drivers/tapdisk.c
+++ xen-4.1.0-testing/tools/blktap/drivers/tapdisk.c
@@ -735,6 +735,22 @@ static void get_io_request(struct td_sta
goto out;
}
@ -791,11 +789,11 @@ Index: xen-4.0.2-testing/tools/blktap/drivers/tapdisk.c
default:
DPRINTF("Unknown block operation\n");
break;
Index: xen-4.0.2-testing/tools/python/xen/xend/server/BlktapController.py
Index: xen-4.1.0-testing/tools/python/xen/xend/server/BlktapController.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/xend/server/BlktapController.py
+++ xen-4.0.2-testing/tools/python/xen/xend/server/BlktapController.py
@@ -21,6 +21,7 @@ blktap1_disk_types = [
--- xen-4.1.0-testing.orig/tools/python/xen/xend/server/BlktapController.py
+++ xen-4.1.0-testing/tools/python/xen/xend/server/BlktapController.py
@@ -15,6 +15,7 @@ blktap1_disk_types = [
'ram',
'qcow',
'qcow2',

View File

@ -1,11 +1,11 @@
bug #239173
bug #242953
Index: xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py
Index: xen-4.1.0-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -3291,7 +3291,7 @@ class XendDomainInfo:
--- xen-4.1.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-4.1.0-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -3295,7 +3295,7 @@ class XendDomainInfo:
(fn, BOOTLOADER_LOOPBACK_DEVICE))
vbd = {
@ -14,11 +14,11 @@ Index: xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py
'device': BOOTLOADER_LOOPBACK_DEVICE,
}
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/xenstore.c
Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/xenstore.c
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/xenstore.c
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/xenstore.c
@@ -397,9 +397,9 @@ void xenstore_parse_domain_config(int hv
--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/xenstore.c
+++ xen-4.1.0-testing/tools/ioemu-qemu-xen/xenstore.c
@@ -447,9 +447,9 @@ void xenstore_parse_domain_config(int hv
{
char **e_danger = NULL;
char *buf = NULL;
@ -30,7 +30,7 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/xenstore.c
unsigned int len, num, hd_index, pci_devid = 0;
BlockDriverState *bs;
BlockDriver *format;
@@ -444,6 +444,14 @@ void xenstore_parse_domain_config(int hv
@@ -486,6 +486,14 @@ void xenstore_parse_domain_config(int hv
e_danger[i]);
if (bpath == NULL)
continue;
@ -45,7 +45,7 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/xenstore.c
/* read the name of the device */
if (pasprintf(&buf, "%s/dev", bpath) == -1)
continue;
@@ -738,6 +746,7 @@ void xenstore_parse_domain_config(int hv
@@ -775,6 +783,7 @@ void xenstore_parse_domain_config(int hv
free(mode);
free(params);
free(dev);

View File

@ -1,26 +0,0 @@
Calling function doesn't handle an "Exception" but only VmError, thus cleanup work won't been done if using Exception.
Change it to VmError.
Signed-off-by ChunyanLiu <cyliu@novell.com>
Index: xen-4.0.2-testing/tools/python/xen/xend/server/BlktapController.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/xend/server/BlktapController.py
+++ xen-4.0.2-testing/tools/python/xen/xend/server/BlktapController.py
@@ -4,6 +4,7 @@ import string, re
from xen.xend.server.blkif import BlkifController
from xen.xend.XendLogging import log
from xen.util.xpopen import xPopen3
+from xen.xend.XendError import VmError
phantomDev = 0;
phantomId = 0;
@@ -209,7 +210,7 @@ class Blktap2Controller(BlktapController
out = stdout.read();
stdout.close();
stderr.close();
- raise Exception, 'Failed to create device.\n stdout: %s\n stderr: %s\nCheck that target \"%s\" exists and that blktap2 driver installed in dom0.' % (out.rstrip(), err.rstrip(), file);
+ raise VmError('Failed to create device.\n stdout: %s\n stderr: %s\nCheck that target \"%s\" exists and that blktap2 driver installed in dom0.' % (out.rstrip(), err.rstrip(), file));
minor, device, control = parseDeviceString(stdout.readline())
stdout.close();

View File

@ -1,7 +1,7 @@
Index: xen-4.0.2-testing/tools/blktap/drivers/tapdisk.h
Index: xen-4.1.0-testing/tools/blktap/drivers/tapdisk.h
===================================================================
--- xen-4.0.2-testing.orig/tools/blktap/drivers/tapdisk.h
+++ xen-4.0.2-testing/tools/blktap/drivers/tapdisk.h
--- xen-4.1.0-testing.orig/tools/blktap/drivers/tapdisk.h
+++ xen-4.1.0-testing/tools/blktap/drivers/tapdisk.h
@@ -168,7 +168,7 @@ static disk_info_t aio_disk = {
"raw image (aio)",
"aio",

View File

@ -1,8 +1,8 @@
Index: xen-4.0.2-testing/tools/hotplug/Linux/network-bridge
Index: xen-4.1.0-testing/tools/hotplug/Linux/network-bridge
===================================================================
--- xen-4.0.2-testing.orig/tools/hotplug/Linux/network-bridge
+++ xen-4.0.2-testing/tools/hotplug/Linux/network-bridge
@@ -245,6 +245,9 @@ op_start () {
--- xen-4.1.0-testing.orig/tools/hotplug/Linux/network-bridge
+++ xen-4.1.0-testing/tools/hotplug/Linux/network-bridge
@@ -249,6 +249,9 @@ op_start () {
claim_lock "network-bridge"
@ -12,14 +12,14 @@ Index: xen-4.0.2-testing/tools/hotplug/Linux/network-bridge
vlans=$(find_active_vlans "${netdev}")
for vlan in $vlans ; do ifdown $vlan ; done
@@ -262,18 +265,32 @@ op_start () {
@@ -266,18 +269,32 @@ op_start () {
ip link set ${netdev} down
ip addr flush ${netdev}
fi
- ip link set ${netdev} name ${pdev}
- ip link set ${tdev} name ${bridge}
-
- setup_bridge_port ${pdev}
- setup_physical_bridge_port ${pdev}
- # Restore slaves
- if [ -n "${slaves}" ]; then

View File

@ -1,8 +1,8 @@
Index: xen-4.0.2-testing/tools/hotplug/Linux/network-bridge
Index: xen-4.1.0-testing/tools/hotplug/Linux/network-bridge
===================================================================
--- xen-4.0.2-testing.orig/tools/hotplug/Linux/network-bridge
+++ xen-4.0.2-testing/tools/hotplug/Linux/network-bridge
@@ -270,19 +270,19 @@ op_stop () {
--- xen-4.1.0-testing.orig/tools/hotplug/Linux/network-bridge
+++ xen-4.1.0-testing/tools/hotplug/Linux/network-bridge
@@ -278,19 +278,19 @@ op_stop () {
transfer_addrs ${bridge} ${pdev}
if ! ifdown ${bridge}; then
get_ip_info ${bridge}

View File

@ -1,8 +1,8 @@
Index: xen-4.0.2-testing/tools/hotplug/Linux/network-bridge
Index: xen-4.1.0-testing/tools/hotplug/Linux/network-bridge
===================================================================
--- xen-4.0.2-testing.orig/tools/hotplug/Linux/network-bridge
+++ xen-4.0.2-testing/tools/hotplug/Linux/network-bridge
@@ -253,6 +253,11 @@ op_start () {
--- xen-4.1.0-testing.orig/tools/hotplug/Linux/network-bridge
+++ xen-4.1.0-testing/tools/hotplug/Linux/network-bridge
@@ -257,6 +257,11 @@ op_start () {
create_bridge ${tdev}
@ -14,7 +14,7 @@ Index: xen-4.0.2-testing/tools/hotplug/Linux/network-bridge
preiftransfer ${netdev}
transfer_addrs ${netdev} ${tdev}
# Remember slaves for bonding interface.
@@ -330,6 +335,13 @@ op_stop () {
@@ -338,6 +343,13 @@ op_stop () {
ip link set ${pdev} name ${netdev}
do_ifup ${netdev}

View File

@ -1,7 +1,7 @@
Index: xen-4.0.2-testing/tools/hotplug/Linux/network-bridge
Index: xen-4.1.0-testing/tools/hotplug/Linux/network-bridge
===================================================================
--- xen-4.0.2-testing.orig/tools/hotplug/Linux/network-bridge
+++ xen-4.0.2-testing/tools/hotplug/Linux/network-bridge
--- xen-4.1.0-testing.orig/tools/hotplug/Linux/network-bridge
+++ xen-4.1.0-testing/tools/hotplug/Linux/network-bridge
@@ -193,6 +193,28 @@ antispoofing () {
iptables -A FORWARD -m physdev --physdev-in ${pdev} -j ACCEPT
}
@ -31,7 +31,7 @@ Index: xen-4.0.2-testing/tools/hotplug/Linux/network-bridge
# Usage: show_status dev bridge
# Print ifconfig and routes.
show_status () {
@@ -223,6 +245,9 @@ op_start () {
@@ -227,6 +249,9 @@ op_start () {
claim_lock "network-bridge"
@ -41,7 +41,7 @@ Index: xen-4.0.2-testing/tools/hotplug/Linux/network-bridge
create_bridge ${tdev}
preiftransfer ${netdev}
@@ -250,6 +275,8 @@ op_start () {
@@ -254,6 +279,8 @@ op_start () {
add_to_bridge2 ${bridge} ${pdev}
do_ifup ${bridge}
@ -50,7 +50,7 @@ Index: xen-4.0.2-testing/tools/hotplug/Linux/network-bridge
if [ ${antispoof} = 'yes' ] ; then
antispoofing
fi
@@ -267,6 +294,9 @@ op_stop () {
@@ -275,6 +302,9 @@ op_stop () {
claim_lock "network-bridge"
@ -60,7 +60,7 @@ Index: xen-4.0.2-testing/tools/hotplug/Linux/network-bridge
transfer_addrs ${bridge} ${pdev}
if ! ifdown ${bridge}; then
get_ip_info ${bridge}
@@ -283,6 +313,8 @@ op_stop () {
@@ -291,6 +321,8 @@ op_stop () {
ip link set ${pdev} name ${netdev}
do_ifup ${netdev}

View File

@ -15,10 +15,10 @@ Signed-off-by: Kevin Wolf <kwolf@suse.de>
tapdisk-ioemu.c | 17 -----------------
4 files changed, 17 insertions(+), 26 deletions(-)
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/Makefile
Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/Makefile
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/Makefile
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/Makefile
--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/Makefile
+++ xen-4.1.0-testing/tools/ioemu-qemu-xen/Makefile
@@ -46,14 +46,6 @@ $(filter %-user,$(SUBDIR_RULES)): libqem
recurse-all: $(SUBDIR_RULES)
@ -56,10 +56,10 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/Makefile
######################################################################
# libqemu_common.a: Target independent part of system emulation. The
# long term path is to suppress *all* target specific code in case of
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/configure
Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/configure
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/configure
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/configure
--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/configure
+++ xen-4.1.0-testing/tools/ioemu-qemu-xen/configure
@@ -1511,7 +1511,7 @@ bsd)
;;
esac
@ -69,10 +69,10 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/configure
if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
tools="qemu-img\$(EXESUF) $tools"
if [ "$linux" = "yes" ] ; then
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/qemu-tool.c
Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/qemu-tool.c
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/qemu-tool.c
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/qemu-tool.c
--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/qemu-tool.c
+++ xen-4.1.0-testing/tools/ioemu-qemu-xen/qemu-tool.c
@@ -68,7 +68,7 @@ void qemu_bh_delete(QEMUBH *bh)
qemu_free(bh);
}
@ -82,10 +82,10 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/qemu-tool.c
IOCanRWHandler *fd_read_poll,
IOHandler *fd_read,
IOHandler *fd_write,
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/tapdisk-ioemu.c
Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/tapdisk-ioemu.c
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/tapdisk-ioemu.c
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/tapdisk-ioemu.c
--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/tapdisk-ioemu.c
+++ xen-4.1.0-testing/tools/ioemu-qemu-xen/tapdisk-ioemu.c
@@ -12,34 +12,12 @@
extern void qemu_aio_init(void);

View File

@ -1,7 +1,7 @@
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/vnc.c
Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/vnc.c
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/vnc.c
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/vnc.c
--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/vnc.c
+++ xen-4.1.0-testing/tools/ioemu-qemu-xen/vnc.c
@@ -1342,6 +1342,11 @@ static void do_key_event(VncState *vs, i
}
break;

View File

@ -1,7 +1,7 @@
Index: xen-4.0.2-testing/tools/python/xen/xend/server/HalDaemon.py
Index: xen-4.1.0-testing/tools/python/xen/xend/server/HalDaemon.py
===================================================================
--- /dev/null
+++ xen-4.0.2-testing/tools/python/xen/xend/server/HalDaemon.py
+++ xen-4.1.0-testing/tools/python/xen/xend/server/HalDaemon.py
@@ -0,0 +1,243 @@
+#!/usr/bin/env python
+# -*- mode: python; -*-
@ -246,10 +246,10 @@ Index: xen-4.0.2-testing/tools/python/xen/xend/server/HalDaemon.py
+ print 'Falling off end'
+
+
Index: xen-4.0.2-testing/tools/python/xen/xend/server/Hald.py
Index: xen-4.1.0-testing/tools/python/xen/xend/server/Hald.py
===================================================================
--- /dev/null
+++ xen-4.0.2-testing/tools/python/xen/xend/server/Hald.py
+++ xen-4.1.0-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-4.0.2-testing/tools/python/xen/xend/server/Hald.py
+ watcher.run()
+ time.sleep(10)
+ watcher.shutdown()
Index: xen-4.0.2-testing/tools/python/xen/xend/server/SrvServer.py
Index: xen-4.1.0-testing/tools/python/xen/xend/server/SrvServer.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/xend/server/SrvServer.py
+++ xen-4.0.2-testing/tools/python/xen/xend/server/SrvServer.py
@@ -56,6 +56,7 @@ from xen.web.SrvDir import SrvDir
--- xen-4.1.0-testing.orig/tools/python/xen/xend/server/SrvServer.py
+++ xen-4.1.0-testing/tools/python/xen/xend/server/SrvServer.py
@@ -57,6 +57,7 @@ from xen.web.SrvDir import SrvDir
from SrvRoot import SrvRoot
from XMLRPCServer import XMLRPCServer
@ -388,7 +388,7 @@ Index: xen-4.0.2-testing/tools/python/xen/xend/server/SrvServer.py
xoptions = XendOptions.instance()
@@ -245,6 +246,8 @@ def _loadConfig(servers, root, reload):
@@ -252,6 +253,8 @@ def _loadConfig(servers, root, reload):
if xoptions.get_xend_unix_xmlrpc_server():
servers.add(XMLRPCServer(XendAPI.AUTH_PAM, False))
@ -397,10 +397,10 @@ Index: xen-4.0.2-testing/tools/python/xen/xend/server/SrvServer.py
def create():
root = SrvDir()
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/xenstore.c
Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/xenstore.c
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/xenstore.c
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/xenstore.c
--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/xenstore.c
+++ xen-4.1.0-testing/tools/ioemu-qemu-xen/xenstore.c
@@ -18,6 +18,7 @@
#include "exec-all.h"
#include "sysemu.h"
@ -409,7 +409,7 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/xenstore.c
#include "hw.h"
#include "pci.h"
#include "qemu-timer.h"
@@ -553,6 +554,21 @@ void xenstore_parse_domain_config(int hv
@@ -595,6 +596,21 @@ void xenstore_parse_domain_config(int hv
#endif
bs = bdrv_new(dev);
@ -431,8 +431,8 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/xenstore.c
/* check if it is a cdrom */
if (danger_type && !strcmp(danger_type, "cdrom")) {
bdrv_set_type_hint(bs, BDRV_TYPE_CDROM);
@@ -961,6 +977,50 @@ void xenstore_record_dm_state(const char
xenstore_record_dm("state", state);
@@ -1028,6 +1044,50 @@ static void xenstore_process_vcpu_set_ev
return;
}
+static void xenstore_process_media_change_event(char **vec)
@ -482,7 +482,7 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/xenstore.c
void xenstore_process_event(void *opaque)
{
char **vec, *offset, *bpath = NULL, *buf = NULL, *drv = NULL, *image = NULL;
@@ -991,6 +1051,11 @@ void xenstore_process_event(void *opaque
@@ -1063,6 +1123,11 @@ void xenstore_process_event(void *opaque
xenstore_watch_callbacks[i].cb(vec[XS_WATCH_TOKEN],
xenstore_watch_callbacks[i].opaque);

View File

@ -1,8 +1,8 @@
Index: xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py
Index: xen-4.1.0-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -3135,6 +3135,11 @@ class XendDomainInfo:
--- xen-4.1.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-4.1.0-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -3130,6 +3130,11 @@ class XendDomainInfo:
self._cleanup_phantom_devs(paths)
self._cleanupVm()

View File

@ -5,10 +5,11 @@ get the signal, it will wait until timeout, thus incorrect device status is
returned. To fix this problem, we do not depend on ev.wait() result, but read
xenstore directly to get correct device status.
diff -r ce65e0e03a57 tools/python/xen/xend/server/DevController.py
--- a/tools/python/xen/xend/server/DevController.py Fri Aug 27 16:53:00 2010 +0800
+++ b/tools/python/xen/xend/server/DevController.py Fri Aug 27 17:13:32 2010 +0800
@@ -149,7 +149,10 @@
Index: xen-4.1.0-testing/tools/python/xen/xend/server/DevController.py
===================================================================
--- xen-4.1.0-testing.orig/tools/python/xen/xend/server/DevController.py
+++ xen-4.1.0-testing/tools/python/xen/xend/server/DevController.py
@@ -149,7 +149,10 @@ class DevController:
(status, err) = self.waitForBackend(devid)
if status == Timeout:
@ -20,7 +21,7 @@ diff -r ce65e0e03a57 tools/python/xen/xend/server/DevController.py
raise VmError("Device %s (%s) could not be connected. "
"Hotplug scripts not working." %
(devid, self.deviceClass))
@@ -554,7 +557,17 @@
@@ -554,7 +557,17 @@ class DevController:
xswatch(statusPath, hotplugStatusCallback, ev, result)
@ -39,7 +40,7 @@ diff -r ce65e0e03a57 tools/python/xen/xend/server/DevController.py
err = xstransact.Read(backpath, HOTPLUG_ERROR_NODE)
@@ -571,7 +584,12 @@
@@ -571,7 +584,12 @@ class DevController:
xswatch(statusPath, deviceDestroyCallback, ev, result)

View File

@ -1,8 +1,8 @@
Index: xen-4.0.2-testing/tools/python/xen/xend/XendCheckpoint.py
Index: xen-4.1.0-testing/tools/python/xen/xend/XendCheckpoint.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/xend/XendCheckpoint.py
+++ xen-4.0.2-testing/tools/python/xen/xend/XendCheckpoint.py
@@ -165,7 +165,7 @@ def save(fd, dominfo, network, live, dst
--- xen-4.1.0-testing.orig/tools/python/xen/xend/XendCheckpoint.py
+++ xen-4.1.0-testing/tools/python/xen/xend/XendCheckpoint.py
@@ -172,7 +172,7 @@ def save(fd, dominfo, network, live, dst
dominfo.destroy()
dominfo.testDeviceComplete()
try:

File diff suppressed because it is too large Load Diff

View File

@ -1,307 +0,0 @@
Index: xen-4.0.2-testing/tools/libxc/Makefile
===================================================================
--- xen-4.0.2-testing.orig/tools/libxc/Makefile
+++ xen-4.0.2-testing/tools/libxc/Makefile
@@ -8,6 +8,7 @@ CTRL_SRCS-y :=
CTRL_SRCS-y += xc_core.c
CTRL_SRCS-$(CONFIG_X86) += xc_core_x86.c
CTRL_SRCS-$(CONFIG_IA64) += xc_core_ia64.c
+CTRL_SRCS-y += xc_cpupool.c
CTRL_SRCS-y += xc_domain.c
CTRL_SRCS-y += xc_evtchn.c
CTRL_SRCS-y += xc_misc.c
Index: xen-4.0.2-testing/tools/libxc/xc_cpupool.c
===================================================================
--- /dev/null
+++ xen-4.0.2-testing/tools/libxc/xc_cpupool.c
@@ -0,0 +1,165 @@
+/******************************************************************************
+ * xc_cpupool.c
+ *
+ * API for manipulating and obtaining information on cpupools.
+ *
+ * Copyright (c) 2009, J Gross.
+ */
+
+#include <stdarg.h>
+#include "xc_private.h"
+
+static int do_sysctl_save(int xc_handle, struct xen_sysctl *sysctl)
+{
+ int ret;
+
+ do {
+ ret = do_sysctl(xc_handle, sysctl);
+ } while ( (ret < 0) && (errno == EAGAIN) );
+
+ return ret;
+}
+
+int xc_cpupool_create(int xc_handle,
+ uint32_t *ppoolid,
+ uint32_t sched_id)
+{
+ int err;
+ DECLARE_SYSCTL;
+
+ sysctl.cmd = XEN_SYSCTL_cpupool_op;
+ sysctl.u.cpupool_op.op = XEN_SYSCTL_CPUPOOL_OP_CREATE;
+ sysctl.u.cpupool_op.cpupool_id = (*ppoolid == 0) ?
+ XEN_SYSCTL_CPUPOOL_PAR_ANY : *ppoolid;
+ sysctl.u.cpupool_op.sched_id = sched_id;
+ if ( (err = do_sysctl_save(xc_handle, &sysctl)) != 0 )
+ return err;
+
+ *ppoolid = sysctl.u.cpupool_op.cpupool_id;
+ return 0;
+}
+
+int xc_cpupool_destroy(int xc_handle,
+ uint32_t poolid)
+{
+ DECLARE_SYSCTL;
+
+ sysctl.cmd = XEN_SYSCTL_cpupool_op;
+ sysctl.u.cpupool_op.op = XEN_SYSCTL_CPUPOOL_OP_DESTROY;
+ sysctl.u.cpupool_op.cpupool_id = poolid;
+ return do_sysctl_save(xc_handle, &sysctl);
+}
+
+int xc_cpupool_getinfo(int xc_handle,
+ uint32_t first_poolid,
+ uint32_t n_max,
+ xc_cpupoolinfo_t *info)
+{
+ int err = 0;
+ int p;
+ uint32_t poolid = first_poolid;
+ uint8_t local[sizeof (info->cpumap)];
+ DECLARE_SYSCTL;
+
+ memset(info, 0, n_max * sizeof(xc_cpupoolinfo_t));
+
+ for (p = 0; p < n_max; p++)
+ {
+ sysctl.cmd = XEN_SYSCTL_cpupool_op;
+ sysctl.u.cpupool_op.op = XEN_SYSCTL_CPUPOOL_OP_INFO;
+ sysctl.u.cpupool_op.cpupool_id = poolid;
+ set_xen_guest_handle(sysctl.u.cpupool_op.cpumap.bitmap, local);
+ sysctl.u.cpupool_op.cpumap.nr_cpus = sizeof(info->cpumap) * 8;
+
+ if ( (err = lock_pages(local, sizeof(local))) != 0 )
+ {
+ PERROR("Could not lock memory for Xen hypercall");
+ break;
+ }
+ err = do_sysctl_save(xc_handle, &sysctl);
+ unlock_pages(local, sizeof (local));
+
+ if ( err < 0 )
+ break;
+
+ info->cpupool_id = sysctl.u.cpupool_op.cpupool_id;
+ info->sched_id = sysctl.u.cpupool_op.sched_id;
+ info->n_dom = sysctl.u.cpupool_op.n_dom;
+ bitmap_byte_to_64(&(info->cpumap), local, sizeof(local) * 8);
+ poolid = sysctl.u.cpupool_op.cpupool_id + 1;
+ info++;
+ }
+
+ if ( p == 0 )
+ return err;
+
+ return p;
+}
+
+int xc_cpupool_addcpu(int xc_handle,
+ uint32_t poolid,
+ int cpu)
+{
+ DECLARE_SYSCTL;
+
+ sysctl.cmd = XEN_SYSCTL_cpupool_op;
+ sysctl.u.cpupool_op.op = XEN_SYSCTL_CPUPOOL_OP_ADDCPU;
+ sysctl.u.cpupool_op.cpupool_id = poolid;
+ sysctl.u.cpupool_op.cpu = (cpu < 0) ? XEN_SYSCTL_CPUPOOL_PAR_ANY : cpu;
+ return do_sysctl_save(xc_handle, &sysctl);
+}
+
+int xc_cpupool_removecpu(int xc_handle,
+ uint32_t poolid,
+ int cpu)
+{
+ DECLARE_SYSCTL;
+
+ sysctl.cmd = XEN_SYSCTL_cpupool_op;
+ sysctl.u.cpupool_op.op = XEN_SYSCTL_CPUPOOL_OP_RMCPU;
+ sysctl.u.cpupool_op.cpupool_id = poolid;
+ sysctl.u.cpupool_op.cpu = (cpu < 0) ? XEN_SYSCTL_CPUPOOL_PAR_ANY : cpu;
+ return do_sysctl_save(xc_handle, &sysctl);
+}
+
+int xc_cpupool_movedomain(int xc_handle,
+ uint32_t poolid,
+ uint32_t domid)
+{
+ DECLARE_SYSCTL;
+
+ sysctl.cmd = XEN_SYSCTL_cpupool_op;
+ sysctl.u.cpupool_op.op = XEN_SYSCTL_CPUPOOL_OP_MOVEDOMAIN;
+ sysctl.u.cpupool_op.cpupool_id = poolid;
+ sysctl.u.cpupool_op.domid = domid;
+ return do_sysctl_save(xc_handle, &sysctl);
+}
+
+int xc_cpupool_freeinfo(int xc_handle,
+ uint64_t *cpumap)
+{
+ int err;
+ uint8_t local[sizeof (*cpumap)];
+ DECLARE_SYSCTL;
+
+ sysctl.cmd = XEN_SYSCTL_cpupool_op;
+ sysctl.u.cpupool_op.op = XEN_SYSCTL_CPUPOOL_OP_FREEINFO;
+ set_xen_guest_handle(sysctl.u.cpupool_op.cpumap.bitmap, local);
+ sysctl.u.cpupool_op.cpumap.nr_cpus = sizeof(*cpumap) * 8;
+
+ if ( (err = lock_pages(local, sizeof(local))) != 0 )
+ {
+ PERROR("Could not lock memory for Xen hypercall");
+ return err;
+ }
+
+ err = do_sysctl_save(xc_handle, &sysctl);
+ unlock_pages(local, sizeof (local));
+
+ if (err < 0)
+ return err;
+
+ bitmap_byte_to_64(cpumap, local, sizeof(local) * 8);
+
+ return 0;
+}
Index: xen-4.0.2-testing/tools/libxc/xc_domain.c
===================================================================
--- xen-4.0.2-testing.orig/tools/libxc/xc_domain.c
+++ xen-4.0.2-testing/tools/libxc/xc_domain.c
@@ -220,6 +220,7 @@ int xc_domain_getinfo(int xc_handle,
info->cpu_time = domctl.u.getdomaininfo.cpu_time;
info->nr_online_vcpus = domctl.u.getdomaininfo.nr_online_vcpus;
info->max_vcpu_id = domctl.u.getdomaininfo.max_vcpu_id;
+ info->cpupool = domctl.u.getdomaininfo.cpupool;
memcpy(info->handle, domctl.u.getdomaininfo.handle,
sizeof(xen_domain_handle_t));
Index: xen-4.0.2-testing/tools/libxc/xenctrl.h
===================================================================
--- xen-4.0.2-testing.orig/tools/libxc/xenctrl.h
+++ xen-4.0.2-testing/tools/libxc/xenctrl.h
@@ -161,6 +161,7 @@ typedef struct xc_dominfo {
unsigned int nr_online_vcpus;
unsigned int max_vcpu_id;
xen_domain_handle_t handle;
+ unsigned int cpupool;
} xc_dominfo_t;
typedef xen_domctl_getdomaininfo_t xc_domaininfo_t;
@@ -492,6 +493,100 @@ int xc_domain_setdebugging(int xc_handle
unsigned int enable);
/*
+ * CPUPOOL MANAGEMENT FUNCTIONS
+ */
+
+typedef struct xc_cpupoolinfo {
+ uint32_t cpupool_id;
+ uint32_t sched_id;
+ uint32_t n_dom;
+ uint64_t cpumap;
+} xc_cpupoolinfo_t;
+
+/**
+ * Create a new cpupool.
+ *
+ * @parm xc_handle a handle to an open hypervisor interface
+ * @parm ppoolid pointer to the new cpupool id (in/out)
+ * @parm sched_id id of scheduler to use for pool
+ * return 0 on success, -1 on failure
+ */
+int xc_cpupool_create(int xc_handle,
+ uint32_t *ppoolid,
+ uint32_t sched_id);
+
+/**
+ * Destroy a cpupool. Pool must be unused and have no cpu assigned.
+ *
+ * @parm xc_handle a handle to an open hypervisor interface
+ * @parm poolid id of the cpupool to destroy
+ * return 0 on success, -1 on failure
+ */
+int xc_cpupool_destroy(int xc_handle,
+ uint32_t poolid);
+
+/**
+ * Get cpupool info. Returns info for up to the specified number of cpupools
+ * starting at the given id.
+ * @parm xc_handle a handle to an open hypervisor interface
+ * @parm first_poolid lowest id for which info is returned
+ * @parm n_max maximum number of cpupools to return info
+ * @parm info pointer to xc_cpupoolinfo_t array
+ * return number of cpupool infos
+ */
+int xc_cpupool_getinfo(int xc_handle,
+ uint32_t first_poolid,
+ uint32_t n_max,
+ xc_cpupoolinfo_t *info);
+
+/**
+ * Add cpu to a cpupool. cpu may be -1 indicating the first unassigned.
+ *
+ * @parm xc_handle a handle to an open hypervisor interface
+ * @parm poolid id of the cpupool
+ * @parm cpu cpu number to add
+ * return 0 on success, -1 on failure
+ */
+int xc_cpupool_addcpu(int xc_handle,
+ uint32_t poolid,
+ int cpu);
+
+/**
+ * Remove cpu from cpupool. cpu may be -1 indicating the last cpu of the pool.
+ *
+ * @parm xc_handle a handle to an open hypervisor interface
+ * @parm poolid id of the cpupool
+ * @parm cpu cpu number to remove
+ * return 0 on success, -1 on failure
+ */
+int xc_cpupool_removecpu(int xc_handle,
+ uint32_t poolid,
+ int cpu);
+
+/**
+ * Move domain to another cpupool.
+ *
+ * @parm xc_handle a handle to an open hypervisor interface
+ * @parm poolid id of the destination cpupool
+ * @parm domid id of the domain to move
+ * return 0 on success, -1 on failure
+ */
+int xc_cpupool_movedomain(int xc_handle,
+ uint32_t poolid,
+ uint32_t domid);
+
+/**
+ * Return map of cpus not in any cpupool.
+ *
+ * @parm xc_handle a handle to an open hypervisor interface
+ * @parm cpumap pointer where to store the cpumap
+ * return 0 on success, -1 on failure
+ */
+int xc_cpupool_freeinfo(int xc_handle,
+ uint64_t *cpumap);
+
+
+/*
* EVENT CHANNEL FUNCTIONS
*/

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,838 +0,0 @@
Index: xen-4.0.2-testing/tools/xm-test/configure.ac
===================================================================
--- xen-4.0.2-testing.orig/tools/xm-test/configure.ac
+++ xen-4.0.2-testing/tools/xm-test/configure.ac
@@ -161,6 +161,7 @@ AC_CONFIG_FILES([
tests/vtpm/Makefile
tests/xapi/Makefile
tests/enforce_dom0_cpus/Makefile
+ tests/cpupool/Makefile
lib/XmTestReport/xmtest.py
lib/XmTestLib/config.py
])
Index: xen-4.0.2-testing/tools/xm-test/grouptest/cpupool
===================================================================
--- /dev/null
+++ xen-4.0.2-testing/tools/xm-test/grouptest/cpupool
@@ -0,0 +1 @@
+cpupool
Index: xen-4.0.2-testing/tools/xm-test/lib/XmTestLib/NetConfig.py
===================================================================
--- xen-4.0.2-testing.orig/tools/xm-test/lib/XmTestLib/NetConfig.py
+++ xen-4.0.2-testing/tools/xm-test/lib/XmTestLib/NetConfig.py
@@ -56,17 +56,21 @@ def getXendNetConfig():
val = pin.get_val()
while val[0] != 'network-script':
val = pin.get_val()
-
- # split network command into script name and its parameters
- sub_val = val[1].split()
- if sub_val[0] == "network-bridge":
+
+ if val[0] != 'network-script' or len(val) < 2:
+ # entry network-script not found or no type specified
netenv = "bridge"
- elif sub_val[0] == "network-route":
- netenv = "route"
- elif sub_val[0] == "network-nat":
- netenv = "nat"
else:
- raise NetworkError("Failed to get network env from xend config")
+ # split network command into script name and its parameters
+ sub_val = val[1].split()
+ if sub_val[0] == "network-bridge":
+ netenv = "bridge"
+ elif sub_val[0] == "network-route":
+ netenv = "route"
+ elif sub_val[0] == "network-nat":
+ netenv = "nat"
+ else:
+ raise NetworkError("Failed to get network env from xend config")
configfile.close()
return netenv
Index: xen-4.0.2-testing/tools/xm-test/lib/XmTestLib/XenDomain.py
===================================================================
--- xen-4.0.2-testing.orig/tools/xm-test/lib/XmTestLib/XenDomain.py
+++ xen-4.0.2-testing/tools/xm-test/lib/XmTestLib/XenDomain.py
@@ -181,6 +181,7 @@ class XenDomain:
if not self.isManaged:
ret, output = traceCommand("xm create %s" % self.config)
+ print self.config
else:
ret, output = traceCommand("xm new %s" % self.config)
if ret != 0:
Index: xen-4.0.2-testing/tools/xm-test/runtest.sh
===================================================================
--- xen-4.0.2-testing.orig/tools/xm-test/runtest.sh
+++ xen-4.0.2-testing/tools/xm-test/runtest.sh
@@ -91,7 +91,7 @@ runnable_tests() {
echo "Error: ramdisk/initrd.img is from an old version, or is not for this "
echo "architecture ($ARCH)."
echo "You need to build a ramdisk from at least ${XM_TEST_MAJ}.${XM_TEST_MIN}"
- exit 1
+ #exit 1
fi
# See if xend is running
Index: xen-4.0.2-testing/tools/xm-test/tests/Makefile.am
===================================================================
--- xen-4.0.2-testing.orig/tools/xm-test/tests/Makefile.am
+++ xen-4.0.2-testing/tools/xm-test/tests/Makefile.am
@@ -28,7 +28,8 @@ SUBDIRS = \
vcpu-pin \
vtpm \
enforce_dom0_cpus \
- save restore migrate
+ save restore migrate \
+ cpupool
EXTRA_DIST = $(SUBDIRS) Makefile.am.template
Index: xen-4.0.2-testing/tools/xm-test/tests/cpupool/01_cpupool_basic_pos.py
===================================================================
--- /dev/null
+++ xen-4.0.2-testing/tools/xm-test/tests/cpupool/01_cpupool_basic_pos.py
@@ -0,0 +1,72 @@
+#!/usr/bin/python
+
+import sys
+import re
+import time
+
+from XmTestLib import *
+
+
+#
+# Check output of xm info. It must include field 'free_cpus'
+# The value must be between 0 - nr_cpus
+#
+free_cpus = getInfo("free_cpus")
+if free_cpus == "":
+ FAIL("Missing 'free_cpus' entry in xm info output")
+if int(free_cpus) not in range(int(getInfo("nr_cpus")) + 1):
+ FAIL("Wrong value of 'free_cpus' (%s)" % int(free_cpus))
+
+
+#
+# Check output of xm list -l. It must contain the key 'pool_name'
+# If XM_USES_API is set, output must also contain 'cpu_pool'.
+#
+status, output = traceCommand("xm list -l Domain-0")
+if status != 0 or "Traceback" in output:
+ raise XmError("xm failed", trace=output, status=status)
+if not re.search("pool_name Pool-0", output):
+ FAIL("Missing or wrong attribute 'pool_name' in output of 'xm list -l'")
+if os.getenv("XM_USES_API"):
+ if not re.search("cpu_pool (.+)", output):
+ FAIL("Missing or wrong attribute 'cpu_pool' in output of 'xm list -l'")
+
+#
+# Test pool selection option of xm list.
+#
+status, output = traceCommand("xm list --pool=Pool-0")
+if status != 0 or "Traceback" in output:
+ raise XmError("xm failed", trace=output, status=status)
+if not re.search("Domain-0 +0 +", output):
+ FAIL("Missing 'Domain-0' in Pool-0")
+
+status, output = traceCommand("xm list --pool=Dummy-Pool")
+if status != 0 or "Traceback" in output:
+ raise XmError("xm failed", trace=output, status=status)
+if len(output.splitlines()) != 1:
+ FAIL("Wrong pool selection; output must be empty")
+
+
+#
+# Create a Domain without pool specification.
+# Default pool is Pool-0
+#
+name = "TestDomPool-1"
+domain = XmTestDomain(name=name)
+try:
+ domain.start(noConsole=True)
+except DomainError, ex:
+ FAIL(str(e))
+
+if not isDomainRunning(name):
+ FAIL("Couldn't start domain without pool specification")
+
+status, output = traceCommand("xm list -l %s" % name)
+if status != 0 or "Traceback" in output:
+ raise XmError("xm failed", trace=output, status=status)
+if not re.search("pool_name Pool-0", output):
+ FAIL("Missing or wrong attribute 'pool_name' in output of 'xm list -l %s'" % name)
+
+destroyAllDomUs()
+
+
Index: xen-4.0.2-testing/tools/xm-test/tests/cpupool/02_cpupool_manage_pos.py
===================================================================
--- /dev/null
+++ xen-4.0.2-testing/tools/xm-test/tests/cpupool/02_cpupool_manage_pos.py
@@ -0,0 +1,152 @@
+#!/usr/bin/python
+
+# Description:
+# Verify commands pool-new and pool-delete.
+#
+import sys
+import re
+import time
+
+from XmTestLib import *
+from pools import *
+
+checkRequirements()
+
+#
+# Check output of xm pool-list (of Pool-0)
+#
+status, output = traceCommand("xm pool-list Pool-0")
+if status != 0:
+ FAIL("xm pool-list failed, rc %s" % status)
+lines = output.splitlines()
+if len(lines) != 2:
+ FAIL("Wrong output of xm pool-list Pool-0 (%s)" % lines)
+if not re.search("Pool-0 +[0-9]+ +credit +y +[0-9]", lines[1]):
+ FAIL("Wrong output of xm pool-list Pool-0 (%s)" % lines)
+
+#
+# Check output of xm pool-list -l (of Pool-0)
+#
+status, output = traceCommand("xm pool-list Pool-0 -l")
+if status != 0:
+ FAIL("xm pool-list failed, rc %s" % status)
+if not re.search("name_label Pool-0", output):
+ FAIL("Wrong output of xm pool-list Pool-0 -l; missing 'name_label'")
+if not re.search("started_VMs 00000000-0000-0000-0000-000000000000", output):
+ FAIL("Wrong output of xm pool-list Pool-0 -l; missing 'started_VMs'")
+if not re.search("started_VM_names Domain-0", output):
+ FAIL("Wrong output of xm pool-list Pool-0 -l; missing 'started_VMi_names'")
+
+
+#
+# Create a pool from pool1.cfg
+#
+cmd = "xm pool-new pool1.cfg name=Pool-1"
+status, output = traceCommand(cmd)
+if status != 0:
+ FAIL("%s failed, rc %s" % (cmd,status))
+
+status, output = traceCommand("xm pool-list")
+if status != 0:
+ FAIL("xm pool-list failed, rc %s" % status)
+if not re.search("Pool-1 +1 +credit", output):
+ FAIL("Missing or wrong pool definition for 'Pool-1'")
+
+
+#
+# check persistence of pool; restart xend
+#
+restartXend()
+
+status, output = traceCommand("xm pool-list")
+if status != 0:
+ FAIL("xm pool-list failed, rc %s" % status)
+if not re.search("Pool-1 +1 +credit", output):
+ FAIL("Missing or wrong pool definition for 'Pool-1'")
+
+
+#
+# Delete pool
+#
+deletePool("Pool-1")
+status, output = traceCommand("xm pool-list")
+if status != 0:
+ FAIL("xm pool-list failed, rc %s" % status)
+if re.search("Pool-1 +1 +credit", output):
+ FAIL("'Pool-1' not deleted")
+
+
+#
+# create / start / check / destroy / delete a managed pool
+#
+cmd = "xm pool-new pool1.cfg"
+status, output = traceCommand(cmd)
+if status != 0:
+ FAIL("%s failed, rc %s" % (cmd,status))
+
+cmd = "xm pool-start Pool-1"
+status, output = traceCommand(cmd)
+if status != 0:
+ FAIL("%s failed, rc %s" % (cmd,status))
+
+cmd = "xm pool-list -l Pool-1"
+status, output = traceCommand(cmd)
+if status != 0:
+ FAIL("%s failed, rc %s" % (cmd,status))
+if not re.search("host_CPU_numbers +[0-9]", output):
+ FAIL("'Pool-1' not activated")
+
+restartXend()
+
+cmd = "xm pool-list -l Pool-1"
+status, output = traceCommand(cmd)
+if status != 0:
+ FAIL("%s failed, rc %s" % (cmd,status))
+if not re.search("host_CPU_numbers +[0-9]", output):
+ FAIL("'Pool-1' not activated")
+
+destroyPool("Pool-1")
+deletePool("Pool-1")
+
+cmd = "xm pool-list Pool-1"
+status, output = traceCommand(cmd)
+if status != 0:
+ FAIL("%s failed, rc %s" % (cmd,status))
+if re.search("Pool-1 +1 +credit", output):
+ FAIL("'Pool-1' not deleted")
+
+
+#
+# create / check / destroy a unmanaged pool
+#
+cmd = "xm pool-create pool1.cfg"
+status, output = traceCommand(cmd)
+if status != 0:
+ FAIL("%s failed, rc %s" % (cmd,status))
+
+cmd = "xm pool-list -l Pool-1"
+status, output = traceCommand(cmd)
+if status != 0:
+ FAIL("%s failed, rc %s" % (cmd,status))
+if not re.search("host_CPU_numbers +[0-9]", output):
+ FAIL("'Pool-1' not activated")
+
+restartXend()
+
+cmd = "xm pool-list -l Pool-1"
+status, output = traceCommand(cmd)
+if status != 0:
+ FAIL("%s failed, rc %s" % (cmd,status))
+if not re.search("host_CPU_numbers +[0-9]", output):
+ FAIL("'Pool-1' not activated")
+
+destroyPool("Pool-1", True)
+
+cmd = "xm pool-list"
+status, output = traceCommand(cmd)
+if status != 0:
+ FAIL("%s failed, rc %s" % (cmd,status))
+if re.search("Pool-1", output):
+ FAIL("'Pool-1' not deleted")
+
+
Index: xen-4.0.2-testing/tools/xm-test/tests/cpupool/03_cpupool_domain.py
===================================================================
--- /dev/null
+++ xen-4.0.2-testing/tools/xm-test/tests/cpupool/03_cpupool_domain.py
@@ -0,0 +1,126 @@
+#!/usr/bin/python
+
+import sys
+import re
+import time
+
+from XmTestLib import *
+from pools import *
+
+
+checkRequirements()
+
+#
+# create Pool-1 with 1 CPU and start a VM
+#
+createStdPool()
+name = "TestDomPool-1"
+domain = XmTestDomain(extraConfig={'pool' : 'Pool-1'}, name=name)
+try:
+ domain.start(noConsole=True)
+except DomainError, ex:
+ FAIL(str(e))
+
+cmd = "xm list --pool=Pool-1"
+status, output = traceCommand(cmd)
+if status != 0:
+ FAIL("%s failed, rc %s" % (cmd,status))
+if not re.search(name, output):
+ FAIL("%s; missing '%s' in Pool-1" % (cmd,name))
+
+domain.stop()
+waitForDomain(name)
+destroyPool("Pool-1", True)
+
+
+
+#
+# create Pool-1 with 1 CPU, add a second CPU
+# start a VM (with vpcu=3) add a third CPU
+# remove 2 CPUs from pool
+# create Pool-1 with 1 CPU and start a VM
+#
+pool_names = ['Pool-1', 'Pool-2']
+createStdPool({'name' : pool_names[0], 'cpus' : '"1"'})
+name = "TestDomPool-1"
+cmd = "xm pool-cpu-add Pool-1 2"
+status, output = traceCommand(cmd)
+if status != 0:
+ FAIL("%s failed, rc %s" % (cmd,status))
+
+domain = XmTestDomain(extraConfig={ 'pool' : 'Pool-1'}, name=name)
+try:
+ domain.start(noConsole=True)
+except DomainError, ex:
+ FAIL(str(e))
+
+cmd = "xm pool-cpu-add Pool-1 3"
+status, output = traceCommand(cmd)
+if status != 0:
+ FAIL("%s failed, rc %s" % (cmd,status))
+
+cmd = "xm pool-cpu-remove Pool-1 2"
+status, output = traceCommand(cmd)
+if status != 0:
+ FAIL("%s failed, rc %s" % (cmd,status))
+cmd = "xm pool-cpu-remove Pool-1 3"
+
+status, output = traceCommand(cmd)
+if status != 0:
+ FAIL("%s failed, rc %s" % (cmd,status))
+
+
+createStdPool({'name' : pool_names[1]})
+name2 = "TestDomPool-2"
+domain2 = XmTestDomain(extraConfig={ 'pool' : 'Pool-2'}, name=name2)
+try:
+ domain2.start(noConsole=True)
+except DomainError, ex:
+ FAIL(str(e))
+
+domain2.stop()
+domain.stop()
+
+waitForDomain(name)
+waitForDomain(name2)
+
+for pool in pool_names:
+ destroyPool(pool, True)
+
+
+
+#
+# Create 2 pools with 1 cpu per pool.
+# Create three domains in each pool, with 1,2,3 VCPUs
+# Switch a thrid cpu between the pools.
+#
+pool_names = ['Pool-1', 'Pool-2']
+domains = {}
+cpu=3
+
+for pool in pool_names:
+ createStdPool({'name' : pool})
+ for dom_nr in range(3):
+ name = "TestDom%s-%s" % (pool, dom_nr)
+ domains[name] = XmTestDomain(extraConfig={'pool' : pool},
+ name=name)
+ try:
+ domains[name].start(noConsole=True)
+ except DomainError, ex:
+ FAIL(str(ex))
+
+cmd_add_1 = "xm pool-cpu-add Pool-1 %s" % cpu
+cmd_rem_1 = "xm pool-cpu-remove Pool-1 %s" % cpu
+cmd_add_2 = "xm pool-cpu-add Pool-2 %s" % cpu
+cmd_rem_2 = "xm pool-cpu-remove Pool-2 %s" % cpu
+
+for i in range(25):
+ traceCommand(cmd_add_1)
+ traceCommand(cmd_rem_1)
+ traceCommand(cmd_add_2)
+ traceCommand(cmd_rem_2)
+
+destroyAllDomUs()
+for pool in pool_names:
+ destroyPool(pool, True)
+
Index: xen-4.0.2-testing/tools/xm-test/tests/cpupool/04_cpupool_migrate.py
===================================================================
--- /dev/null
+++ xen-4.0.2-testing/tools/xm-test/tests/cpupool/04_cpupool_migrate.py
@@ -0,0 +1,84 @@
+#!/usr/bin/python
+
+import sys
+import re
+import time
+
+from XmTestLib import *
+from pools import *
+
+
+
+#
+# Check requirements of test case
+# - min 2 free cpus (not assigned to a pool)
+#
+if int(getInfo("free_cpus")) < 2:
+ SKIP("Need at least 2 free cpus")
+
+
+
+#
+# Create 2 pools with one cpu per pool.
+#
+createStdPool({'name' : 'Pool-1'})
+createStdPool({'name' : 'Pool-2'})
+
+
+
+#
+# Create a domain with vcpus=1 in Pool-0.
+# Migrate it to one of the created pools afterwards to the other pool
+#
+name = "TestDomPool-1"
+domain = XmTestDomain(extraConfig={'pool' : 'Pool-0'}, name=name)
+try:
+ domain.start(noConsole=True)
+except DomainError, ex:
+ FAIL(str(e))
+if not domInPool(name, 'Pool-0'):
+ FAIL("missing '%s' in Pool-0" % name)
+
+if not migrateToPool(name, 'Pool-1'):
+ FAIL("missing '%s' in Pool-1" % name)
+if not migrateToPool(name, 'Pool-2'):
+ FAIL("missing '%s' in Pool-2" % name)
+
+
+
+#
+# Create a domain in Pool-0.
+# Migrate it to one of the created pools afterwards to the other pool
+#
+name = "TestDomPool-2"
+domain = XmTestDomain(extraConfig={'pool' : 'Pool-0'}, name=name)
+try:
+ domain.start(noConsole=True)
+except DomainError, ex:
+ FAIL(str(e))
+if not domInPool(name, 'Pool-0'):
+ FAIL("missing '%s' in Pool-0" % name)
+
+if not migrateToPool(name, 'Pool-1'):
+ FAIL("missing '%s' in Pool-1" % name)
+if not migrateToPool(name, 'Pool-2'):
+ FAIL("missing '%s' in Pool-2" % name)
+
+
+
+#
+# Migrate other domains between pools
+#
+for cnt in range(10):
+ for pool in ['Pool-0', 'Pool-1', 'Pool-2']:
+ for domain in getRunningDomains():
+ if domain != 'Domain-0':
+ if not migrateToPool(domain, pool):
+ FAIL("missing '%s' in %s" % (domain, pool))
+
+
+#
+# Cleanup
+#
+cleanupPoolsDomains()
+
Index: xen-4.0.2-testing/tools/xm-test/tests/cpupool/Makefile.am
===================================================================
--- /dev/null
+++ xen-4.0.2-testing/tools/xm-test/tests/cpupool/Makefile.am
@@ -0,0 +1,22 @@
+SUBDIRS =
+
+TESTS = 01_cpupool_basic_pos.test \
+ 02_cpupool_manage_pos.test \
+ 03_cpupool_domain.test \
+ 04_cpupool_migrate.test
+
+EXTRA_DIST = $(TESTS)
+
+TESTS_ENVIRONMENT=@TENV@
+
+%.test: %.py
+ cp $< $@
+ chmod +x $@
+
+clean-local: am_config_clean-local
+
+am_config_clean-local:
+ rm -f *test
+ rm -f *log
+ rm -f *~
+
Index: xen-4.0.2-testing/tools/xm-test/tests/cpupool/pool1.cfg
===================================================================
--- /dev/null
+++ xen-4.0.2-testing/tools/xm-test/tests/cpupool/pool1.cfg
@@ -0,0 +1 @@
+name="Pool-1"
Index: xen-4.0.2-testing/tools/xm-test/tests/cpupool/pools.py
===================================================================
--- /dev/null
+++ xen-4.0.2-testing/tools/xm-test/tests/cpupool/pools.py
@@ -0,0 +1,78 @@
+#!/usr/bin/python
+
+
+from XmTestLib import *
+
+def checkRequirements():
+ # - min 4 cpus
+ # - only Pool-0 defined
+ nr_cpus = int(getInfo("nr_cpus"))
+ if nr_cpus < 4:
+ SKIP("Need at least 4 cpus for pool tests")
+ if len(getPoolList()) > 1:
+ SKIP("More than one pool already defined")
+
+ # reduce Pool-0 to CPU-0
+ traceCommand("xm pool-cpu-add Pool-0 0")
+ for i in range(1, nr_cpus):
+ traceCommand("xm pool-cpu-remove Pool-0 %s" % i)
+
+def createStdPool(add_param=None):
+ cmd = "xm pool-create pool1.cfg "
+ if add_param:
+ for k,v in add_param.items():
+ cmd += "%s=%s " % (k,v)
+ status, output = traceCommand(cmd)
+ if status != 0 or "Traceback" in output:
+ raise XmError("xm failed", trace=output, status=status)
+
+def deletePool(name):
+ cmd = "xm pool-delete %s" % name
+ status, output = traceCommand(cmd)
+ if status != 0 or "Traceback" in output:
+ raise XmError("xm failed", trace=output, status=status)
+
+def destroyPool(name, delete_on_xenapi=False):
+ cmd = "xm pool-destroy %s" % name
+ status, output = traceCommand(cmd)
+ if status != 0 or "Traceback" in output:
+ raise XmError("xm failed", trace=output, status=status)
+ if os.getenv("XM_USES_API") and delete_on_xenapi:
+ deletePool(name)
+
+def getPoolList():
+ status, output = traceCommand("xm pool-list")
+ if status != 0 or "Traceback" in output:
+ raise XmError("xm failed", trace=output, status=status)
+ lines = output.splitlines()
+ pools = []
+ for l in lines[1:]:
+ elms = l.split(" ", 1)
+ pools.append(elms[0]);
+ return pools
+
+def domInPool(dom, pool):
+ cmd = "xm list --pool=%s" % pool
+ status, output = traceCommand(cmd)
+ if status != 0 or "Traceback" in output:
+ raise XmError("xm failed", trace=output, status=status)
+ return re.search(dom, output) != None
+
+def migrateToPool(dom, pool):
+ status, output = traceCommand("xm pool-migrate %s %s" % (dom, pool))
+ if status != 0 or "Traceback" in output:
+ raise XmError("xm failed", trace=output, status=status)
+ return domInPool(dom, pool)
+
+def cleanupPoolsDomains():
+ destroyAllDomUs()
+ for pool in getPoolList():
+ if pool != 'Pool-0':
+ destroyPool(pool, True)
+
+def waitForDomain(name):
+ for i in range(10):
+ if not isDomainRunning(name):
+ break
+ time.sleep(1)
+
Index: xen-4.0.2-testing/tools/xm-test/tests/xapi/20_xapi-cpu_pool_basic.py
===================================================================
--- /dev/null
+++ xen-4.0.2-testing/tools/xm-test/tests/xapi/20_xapi-cpu_pool_basic.py
@@ -0,0 +1,157 @@
+#!/usr/bin/python
+
+
+# Basic Pool creation tests
+
+from XmTestLib import xapi
+from XmTestLib import *
+
+
+session = xapi.connect()
+host_ref = session.xenapi.host.get_all()[0]
+pools = session.xenapi.host.get_resident_cpu_pools(host_ref)
+if len(pools) != 1:
+ SKIP("Only Pool-0 have to be created for this test")
+
+
+# check extension of host object
+host_recs = session.xenapi.host.get_all_records()
+host_rec = host_recs[host_recs.keys()[0]]
+if len(host_recs.keys()) != 1 or not host_rec.has_key("resident_cpu_pools") or \
+ len(host_rec["resident_cpu_pools"]) != 1:
+ FAIL("Missing or wrong field 'resident_cpu_pools' in host record")
+
+
+# check extension of host_cpu object
+host_cpu_recs = session.xenapi.host_cpu.get_all_records()
+assigned_cpus = [ cpu for cpu in host_cpu_recs.values() if len(cpu["cpu_pool"]) > 0 ]
+unassigned_cpus = session.xenapi.host_cpu.get_unassigned_cpus()
+if len(host_cpu_recs) - len(assigned_cpus) != len(unassigned_cpus):
+ FAIL("Wrong host_cpu count values; CPUS total: %d, CPUS ass: %d, CPUS unass: %d" % (
+ len(host_cpu_recs), len(assigned_cpus), len(unassigned_cpus)))
+
+for cpu_rec in host_cpu_recs.values():
+ cpu_pool = session.xenapi.host_cpu.get_cpu_pool(cpu_rec['uuid'])
+ if cpu_pool != cpu_rec['cpu_pool']:
+ FAIL("Inconsistency of cpu_pool ref between host_cpu record (%s) "
+ "and get_cpu_pool (%s)" % (cpu_rec['cpu_pool'], cpu_pool))
+
+
+# create / modify / remove managed cpu pools
+pool1_cfg = { 'name_label' : 'Pool-1',
+ 'name_description' : 'new pool',
+ 'auto_power_on' : False,
+ 'ncpu' : '3',
+ 'sched_policy' : 'credit',
+ 'proposed_CPUs' : ['1','2'],
+ 'other_config' : { 'xmtest' : True },
+ }
+pool1 = session.xenapi.cpu_pool.create(pool1_cfg)
+pool1_rec = session.xenapi.cpu_pool.get_record(pool1)
+for k in pool1_cfg.keys():
+ if pool1_rec[k] != pool1_cfg[k]:
+ FAIL("Create error Pool-1 (create config %s, current config: %s, key: %s)" % (
+ pool1_cfg, pool1_rec, k))
+
+pool_all = session.xenapi.cpu_pool.get_all()
+if len(pool_all) != 2:
+ FAIL("cpu_pool.get_all() returns '%d', expected '2'" % len(pool_all))
+
+pool_all = session.xenapi.cpu_pool.get_all_records()
+if len(pool_all) != 2:
+ FAIL("cpu_pool.get_all_records() returns '%d', expected '2'" % len(pool_all))
+
+if pool1 != session.xenapi.cpu_pool.get_by_name_label(pool1_cfg['name_label'])[0]:
+ FAIL("cpu_pool.get_by_name_label() returns wrong value")
+
+if pool1 != session.xenapi.cpu_pool.get_by_uuid(pool1):
+ FAIL("cpu_pool.get_by_uuid() returns wrong value")
+
+if session.xenapi.cpu_pool.get_activated(pool1):
+ FAIL("cpu_pool.get_activated() returns 'true' instead of 'false'")
+
+if pool1_cfg['auto_power_on'] != session.xenapi.cpu_pool.get_auto_power_on(pool1):
+ FAIL("cpu_pool.get_auto_power_on() returns wrong value")
+
+if len(session.xenapi.cpu_pool.get_host_CPUs(pool1)) != 0:
+ FAIL("cpu_pool.get_host_CPUs has to return an empty list")
+
+if pool1_cfg['name_label'] != session.xenapi.cpu_pool.get_name_label(pool1):
+ FAIL("cpu_pool.get_name_label() returns wrong value")
+
+if pool1_cfg['name_description'] != session.xenapi.cpu_pool.get_name_description(pool1):
+ FAIL("cpu_pool.get_name_description() returns wrong value")
+
+if pool1_cfg['ncpu'] != session.xenapi.cpu_pool.get_ncpu(pool1):
+ FAIL("cpu_pool.get_ncpu() returns wrong value")
+
+cfg_len = len(pool1_cfg['proposed_CPUs'])
+api_len = len(session.xenapi.cpu_pool.get_proposed_CPUs(pool1))
+if cfg_len != api_len:
+ FAIL("cpu_pool.get_proposed_CPUs() returns wrong value; cfg_cnt: %s, api_cnt:%s" % (cfg_len, api_len))
+
+other_config = session.xenapi.cpu_pool.get_other_config(pool1)
+if pool1_cfg['other_config']['xmtest'] != other_config.get('xmtest'):
+ FAIL("cpu_pool.get_other_config() returns wrong value")
+
+if session.xenapi.cpu_pool.get_resident_on(pool1) != session.xenapi.host.get_all()[0]:
+ FAIL("cpu_pool.get_resident_on() returns wrong value")
+
+if pool1_cfg['sched_policy'] != session.xenapi.cpu_pool.get_sched_policy(pool1):
+ FAIL("cpu_pool.get_sched_policy() returns wrong value")
+
+if len(session.xenapi.cpu_pool.get_started_VMs(pool1)) != 0:
+ FAIL("cpu_pool.get_started_VMs() returns wrong value")
+
+if pool1 != session.xenapi.cpu_pool.get_uuid(pool1):
+ FAIL("cpu_pool.get_uuid() returns wrong value")
+
+session.xenapi.cpu_pool.set_auto_power_on(pool1, True)
+if not session.xenapi.cpu_pool.get_auto_power_on(pool1):
+ FAIL("cpu_pool.get_auto_power_on() returns wrong value")
+
+session.xenapi.cpu_pool.set_proposed_CPUs(pool1, [4])
+if '4' not in session.xenapi.cpu_pool.get_proposed_CPUs(pool1):
+ FAIL("cpu_pool.get_proposed_CPUs() returns wrong value; (set_proposed_CPUs)")
+
+session.xenapi.cpu_pool.add_to_proposed_CPUs(pool1, 5)
+val = session.xenapi.cpu_pool.get_proposed_CPUs(pool1)
+if '5' not in val:
+ FAIL("cpu_pool.get_proposed_CPUs() returns wrong value; %s not in %s" % ('5',val))
+
+session.xenapi.cpu_pool.remove_from_proposed_CPUs(pool1, 5)
+val = session.xenapi.cpu_pool.get_proposed_CPUs(pool1)
+if '5' in val:
+ FAIL("cpu_pool.get_proposed_CPUs() returns wrong value; %s in %s" % ('5',val))
+
+session.xenapi.cpu_pool.set_name_label(pool1, 'New-Pool-1')
+if 'New-Pool-1' != session.xenapi.cpu_pool.get_name_label(pool1):
+ FAIL("cpu_pool.get_name_label() returns wrong value")
+
+session.xenapi.cpu_pool.set_ncpu(pool1, 4)
+if '4' != session.xenapi.cpu_pool.get_ncpu(pool1):
+ FAIL("cpu_pool.get_ncpu() returns wrong value")
+
+session.xenapi.cpu_pool.set_other_config(pool1, {'test' : 'ok'})
+other_config = session.xenapi.cpu_pool.get_other_config(pool1)
+if other_config.get('test') != 'ok':
+ FAIL("cpu_pool.get_other_config() returns wrong value")
+
+session.xenapi.cpu_pool.add_to_other_config(pool1, 'new_entry', 'added')
+other_config = session.xenapi.cpu_pool.get_other_config(pool1)
+if other_config.get('new_entry') != 'added':
+ FAIL("cpu_pool.get_other_config() returns wrong value")
+
+session.xenapi.cpu_pool.remove_from_other_config(pool1, 'new_entry')
+other_config = session.xenapi.cpu_pool.get_other_config(pool1)
+if other_config.get('new_entry') != None:
+ FAIL("cpu_pool.get_other_config() returns wrong value")
+
+session.xenapi.cpu_pool.set_sched_policy(pool1, 'credit')
+if 'credit' != session.xenapi.cpu_pool.get_sched_policy(pool1):
+ FAIL("cpu_pool.get_sched_policy() returns wrong value")
+
+session.xenapi.cpu_pool.destroy(pool1)
+if pool1 in session.xenapi.cpu_pool.get_all():
+ FAIL("cpu_pool.destroy() has not removed pool")
+
Index: xen-4.0.2-testing/tools/xm-test/tests/xapi/Makefile.am
===================================================================
--- xen-4.0.2-testing.orig/tools/xm-test/tests/xapi/Makefile.am
+++ xen-4.0.2-testing/tools/xm-test/tests/xapi/Makefile.am
@@ -3,7 +3,8 @@ SUBDIRS =
TESTS = 01_xapi-vm_basic.test \
02_xapi-vbd_basic.test \
03_xapi-network_pos.test \
- 04_xapi-data_uri_handling.test
+ 04_xapi-data_uri_handling.test \
+ 20_xapi-cpu_pool_basic.test
XFAIL_TESTS =

View File

@ -1,144 +0,0 @@
- fix tasklet_schedule_cpu() when invoked from the tasklet's handler
(and rename to tasklet_schedule_on_cpu() to match upstream)
- properly balance (un-)pausing in continue_hypercall_on_cpu() code
paths
- bump domctl interface version (due to the addition of the "cpupool"
member to struct xen_domctl_getdomaininfo)
- move and rename csched_priv to make sure eventual backported
upstream patches using the variable get correctly adjusted (i.e.
missing adjustments get detected at build time)
- remove boot time per-CPU pool assignment messages (bnc#572146)
Index: xen-4.0.2-testing/xen/arch/x86/domain.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/domain.c
+++ xen-4.0.2-testing/xen/arch/x86/domain.c
@@ -1585,6 +1585,7 @@ int continue_hypercall_on_cpu(int cpu, v
v->arch.schedule_tail = continue_hypercall_on_cpu_helper;
v->arch.continue_info = info;
+ vcpu_pause_nosync(v);
}
else
{
@@ -1595,8 +1596,7 @@ int continue_hypercall_on_cpu(int cpu, v
info->func = func;
info->data = data;
- vcpu_pause_nosync(v);
- tasklet_schedule_cpu(&info->tasklet, cpu);
+ tasklet_schedule_on_cpu(&info->tasklet, cpu);
raise_softirq(SCHEDULE_SOFTIRQ);
/* Dummy return value will be overwritten by new schedule_tail. */
Index: xen-4.0.2-testing/xen/common/sched_credit.c
===================================================================
--- xen-4.0.2-testing.orig/xen/common/sched_credit.c
+++ xen-4.0.2-testing/xen/common/sched_credit.c
@@ -176,7 +176,6 @@ struct csched_private {
/*
* Global variables
*/
-static struct csched_private csched_priv;
static struct csched_private *csched_priv0 = NULL;
static void csched_tick(void *_cpu);
@@ -1527,11 +1526,13 @@ static void csched_tick_resume(struct sc
}
}
+static struct csched_private _csched_priv;
+
struct scheduler sched_credit_def = {
.name = "SMP Credit Scheduler",
.opt_name = "credit",
.sched_id = XEN_SCHEDULER_CREDIT,
- .sched_data = &csched_priv,
+ .sched_data = &_csched_priv,
.init_domain = csched_dom_init,
.destroy_domain = csched_dom_destroy,
Index: xen-4.0.2-testing/xen/common/softirq.c
===================================================================
--- xen-4.0.2-testing.orig/xen/common/softirq.c
+++ xen-4.0.2-testing/xen/common/softirq.c
@@ -114,12 +114,15 @@ static void tasklet_schedule_list(struct
{
BUG_ON(!list_empty(&t->list));
list_add_tail(&t->list, tlist);
+ t->scheduled_on = NR_CPUS;
}
t->is_scheduled = 1;
if ( cpu == smp_processor_id() )
raise_softirq(TASKLET_SOFTIRQ);
- else
+ else if ( !t->is_running )
cpu_raise_softirq(cpu, TASKLET_SOFTIRQ);
+ else
+ t->scheduled_on = cpu;
}
spin_unlock_irqrestore(&tasklet_lock, flags);
@@ -130,7 +133,7 @@ void tasklet_schedule(struct tasklet *t)
tasklet_schedule_list(t, &tasklet_list, smp_processor_id());
}
-void tasklet_schedule_cpu(struct tasklet *t, int cpu)
+void tasklet_schedule_on_cpu(struct tasklet *t, int cpu)
{
tasklet_schedule_list(t, &per_cpu(tasklet_list_pcpu, cpu), cpu);
}
@@ -166,7 +169,15 @@ static void tasklet_action(void)
if ( t->is_scheduled )
{
BUG_ON(t->is_dead || !list_empty(&t->list));
- list_add_tail(&t->list, tlist);
+ if ( t->scheduled_on >= NR_CPUS )
+ list_add_tail(&t->list, tlist);
+ else
+ {
+ unsigned int cpu = t->scheduled_on;
+
+ list_add_tail(&t->list, &per_cpu(tasklet_list_pcpu, cpu));
+ cpu_raise_softirq(cpu, TASKLET_SOFTIRQ);
+ }
}
/*
Index: xen-4.0.2-testing/xen/include/public/domctl.h
===================================================================
--- xen-4.0.2-testing.orig/xen/include/public/domctl.h
+++ xen-4.0.2-testing/xen/include/public/domctl.h
@@ -35,7 +35,7 @@
#include "xen.h"
#include "grant_table.h"
-#define XEN_DOMCTL_INTERFACE_VERSION 0x00000006
+#define XEN_DOMCTL_INTERFACE_VERSION 0x00000007
struct xenctl_cpumap {
XEN_GUEST_HANDLE_64(uint8) bitmap;
Index: xen-4.0.2-testing/xen/include/xen/softirq.h
===================================================================
--- xen-4.0.2-testing.orig/xen/include/xen/softirq.h
+++ xen-4.0.2-testing/xen/include/xen/softirq.h
@@ -52,15 +52,17 @@ struct tasklet
bool_t is_scheduled;
bool_t is_running;
bool_t is_dead;
+ unsigned int scheduled_on;
void (*func)(unsigned long);
unsigned long data;
};
#define DECLARE_TASKLET(name, func, data) \
- struct tasklet name = { LIST_HEAD_INIT(name.list), 0, 0, 0, func, data }
+ struct tasklet name = { LIST_HEAD_INIT(name.list), 0, 0, 0, NR_CPUS, \
+ func, data }
void tasklet_schedule(struct tasklet *t);
-void tasklet_schedule_cpu(struct tasklet *t, int cpu);
+void tasklet_schedule_on_cpu(struct tasklet *t, int cpu);
void tasklet_kill(struct tasklet *t);
void tasklet_init(
struct tasklet *t, void (*func)(unsigned long), unsigned long data);

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
Index: xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py
Index: xen-4.1.0-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -1312,8 +1312,15 @@ class XendDomainInfo:
--- xen-4.1.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-4.1.0-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -1297,8 +1297,15 @@ class XendDomainInfo:
frontpath = self.getDeviceController(deviceClass).frontendPath(dev)
backpath = xstransact.Read(frontpath, "backend")
thread.start_new_thread(self.getDeviceController(deviceClass).finishDeviceCleanup, (backpath, path))

View File

@ -1,7 +1,7 @@
Index: xen-4.0.2-testing/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
Index: xen-4.1.0-testing/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
===================================================================
--- xen-4.0.2-testing.orig/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
+++ xen-4.0.2-testing/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
--- xen-4.1.0-testing.orig/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
+++ xen-4.1.0-testing/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
@@ -396,6 +396,11 @@ static int __devinit platform_pci_init(s
platform_mmio = mmio_addr;
platform_mmiolen = mmio_len;

View File

@ -1,8 +1,8 @@
Index: xen-4.0.2-testing/xen/arch/x86/domain.c
Index: xen-4.1.0-testing/xen/arch/x86/domain.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/domain.c
+++ xen-4.0.2-testing/xen/arch/x86/domain.c
@@ -144,15 +144,30 @@ void dump_pageframe_info(struct domain *
--- xen-4.1.0-testing.orig/xen/arch/x86/domain.c
+++ xen-4.1.0-testing/xen/arch/x86/domain.c
@@ -145,15 +145,30 @@ void dump_pageframe_info(struct domain *
printk("Memory pages belonging to domain %u:\n", d->domain_id);

View File

@ -1,8 +1,8 @@
Index: xen-4.0.2-testing/tools/python/xen/xend/XendConfig.py
Index: xen-4.1.0-testing/tools/python/xen/xend/XendConfig.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/xend/XendConfig.py
+++ xen-4.0.2-testing/tools/python/xen/xend/XendConfig.py
@@ -1861,7 +1861,14 @@ class XendConfig(dict):
--- xen-4.1.0-testing.orig/tools/python/xen/xend/XendConfig.py
+++ xen-4.1.0-testing/tools/python/xen/xend/XendConfig.py
@@ -1874,7 +1874,14 @@ class XendConfig(dict):
ports = sxp.child(dev_sxp, 'port')
for port in ports[1:]:
try:

View File

@ -1,220 +0,0 @@
Index: xen-4.0.2-testing/xen/arch/ia64/linux-xen/smp.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/ia64/linux-xen/smp.c
+++ xen-4.0.2-testing/xen/arch/ia64/linux-xen/smp.c
@@ -94,6 +94,7 @@ static volatile struct call_data_struct
#define IPI_CALL_FUNC 0
#define IPI_CPU_STOP 1
+#define IPI_STATE_DUMP 2
/* This needs to be cacheline aligned because it is written to by *other* CPUs. */
static DEFINE_PER_CPU(u64, ipi_operation) ____cacheline_aligned;
@@ -202,6 +203,10 @@ handle_IPI (int irq, void *dev_id, struc
stop_this_cpu();
break;
+ case IPI_STATE_DUMP:
+ dump_execstate(regs);
+ break;
+
default:
printk(KERN_CRIT "Unknown IPI on CPU %d: %lu\n", this_cpu, which);
break;
@@ -479,6 +484,12 @@ smp_send_stop (void)
send_IPI_allbutself(IPI_CPU_STOP);
}
+void
+smp_send_state_dump (unsigned int cpu)
+{
+ send_IPI_single(cpu, IPI_STATE_DUMP);
+}
+
int __init
setup_profiling_timer (unsigned int multiplier)
{
Index: xen-4.0.2-testing/xen/arch/x86/smp.c
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/smp.c
+++ xen-4.0.2-testing/xen/arch/x86/smp.c
@@ -375,11 +375,24 @@ void smp_send_nmi_allbutself(void)
send_IPI_mask(&cpu_online_map, APIC_DM_NMI);
}
+void smp_send_state_dump(unsigned int cpu)
+{
+ state_dump_pending(cpu) = 1;
+ smp_send_event_check_cpu(cpu);
+}
+
fastcall void smp_event_check_interrupt(struct cpu_user_regs *regs)
{
struct cpu_user_regs *old_regs = set_irq_regs(regs);
ack_APIC_irq();
perfc_incr(ipis);
+ if ( unlikely(state_dump_pending(smp_processor_id())) )
+ {
+ irq_enter();
+ state_dump_pending(smp_processor_id()) = 0;
+ dump_execstate(regs);
+ irq_exit();
+ }
set_irq_regs(old_regs);
}
Index: xen-4.0.2-testing/xen/common/keyhandler.c
===================================================================
--- xen-4.0.2-testing.orig/xen/common/keyhandler.c
+++ xen-4.0.2-testing/xen/common/keyhandler.c
@@ -71,19 +71,52 @@ static struct keyhandler show_handlers_k
.desc = "show this message"
};
-static void __dump_execstate(void *unused)
+#ifdef CONFIG_SMP
+static cpumask_t dump_execstate_mask;
+#endif
+
+void dump_execstate(struct cpu_user_regs *regs)
{
- dump_execution_state();
- printk("*** Dumping CPU%d guest state: ***\n", smp_processor_id());
+ unsigned int cpu = smp_processor_id();
+
+ if ( !guest_mode(regs) )
+ {
+ printk("\n*** Dumping CPU%u host state: ***\n", cpu);
+ show_execution_state(regs);
+ }
if ( is_idle_vcpu(current) )
- printk("No guest context (CPU is idle).\n");
+ printk("No guest context (CPU%u is idle).\n", cpu);
else
+ {
+ printk("*** Dumping CPU%u guest state (d%d:v%d): ***\n",
+ smp_processor_id(), current->domain->domain_id,
+ current->vcpu_id);
show_execution_state(guest_cpu_user_regs());
+ }
+
+#ifdef CONFIG_SMP
+ cpu_clear(cpu, dump_execstate_mask);
+ if ( !alt_key_handling )
+ return;
+
+ cpu = cycle_cpu(cpu, dump_execstate_mask);
+ if ( cpu < NR_CPUS )
+ smp_send_state_dump(cpu);
+ else
+ {
+ printk("\n");
+
+ console_end_sync();
+ watchdog_enable();
+ }
+#endif
}
static void dump_registers(unsigned char key, struct cpu_user_regs *regs)
{
+#ifdef CONFIG_SMP
unsigned int cpu;
+#endif
/* We want to get everything out that we possibly can. */
watchdog_disable();
@@ -91,17 +124,28 @@ static void dump_registers(unsigned char
printk("'%c' pressed -> dumping registers\n", key);
+#ifdef CONFIG_SMP
+ if ( alt_key_handling )
+ dump_execstate_mask = cpu_online_map;
+#endif
+
/* Get local execution state out immediately, in case we get stuck. */
- printk("\n*** Dumping CPU%d host state: ***\n", smp_processor_id());
- __dump_execstate(NULL);
+ dump_execstate(regs);
+
+#ifdef CONFIG_SMP
+ if ( alt_key_handling )
+ return;
for_each_online_cpu ( cpu )
{
if ( cpu == smp_processor_id() )
continue;
- printk("\n*** Dumping CPU%d host state: ***\n", cpu);
- on_selected_cpus(cpumask_of(cpu), __dump_execstate, NULL, 1);
+ cpu_set(cpu, dump_execstate_mask);
+ smp_send_state_dump(cpu);
+ while ( cpu_isset(cpu, dump_execstate_mask) )
+ cpu_relax();
}
+#endif
printk("\n");
Index: xen-4.0.2-testing/xen/include/asm-ia64/linux-xen/asm/ptrace.h
===================================================================
--- xen-4.0.2-testing.orig/xen/include/asm-ia64/linux-xen/asm/ptrace.h
+++ xen-4.0.2-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)
#ifdef XEN
-# define guest_mode(regs) (ia64_psr(regs)->cpl != 0)
+# define guest_mode(regs) (ia64_psr(regs)->cpl && !ia64_psr(regs)->vm)
# define guest_kernel_mode(regs) (ia64_psr(regs)->cpl == CONFIG_CPL0_EMUL)
# define vmx_guest_kernel_mode(regs) (ia64_psr(regs)->cpl == 0)
# define regs_increment_iip(regs) \
Index: xen-4.0.2-testing/xen/include/asm-x86/hardirq.h
===================================================================
--- xen-4.0.2-testing.orig/xen/include/asm-x86/hardirq.h
+++ xen-4.0.2-testing/xen/include/asm-x86/hardirq.h
@@ -8,6 +8,7 @@ typedef struct {
unsigned long __softirq_pending;
unsigned int __local_irq_count;
unsigned int __nmi_count;
+ bool_t __state_dump_pending;
} __cacheline_aligned irq_cpustat_t;
#include <xen/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
Index: xen-4.0.2-testing/xen/include/xen/irq_cpustat.h
===================================================================
--- xen-4.0.2-testing.orig/xen/include/xen/irq_cpustat.h
+++ xen-4.0.2-testing/xen/include/xen/irq_cpustat.h
@@ -26,5 +26,6 @@ extern irq_cpustat_t irq_stat[];
#define softirq_pending(cpu) __IRQ_STAT((cpu), __softirq_pending)
#define local_irq_count(cpu) __IRQ_STAT((cpu), __local_irq_count)
#define nmi_count(cpu) __IRQ_STAT((cpu), __nmi_count)
+#define state_dump_pending(cpu) __IRQ_STAT((cpu), __state_dump_pending)
#endif /* __irq_cpustat_h */
Index: xen-4.0.2-testing/xen/include/xen/lib.h
===================================================================
--- xen-4.0.2-testing.orig/xen/include/xen/lib.h
+++ xen-4.0.2-testing/xen/include/xen/lib.h
@@ -116,4 +116,7 @@ extern int tainted;
extern char *print_tainted(char *str);
extern void add_taint(unsigned);
+struct cpu_user_regs;
+void dump_execstate(struct cpu_user_regs *);
+
#endif /* __LIB_H__ */
Index: xen-4.0.2-testing/xen/include/xen/smp.h
===================================================================
--- xen-4.0.2-testing.orig/xen/include/xen/smp.h
+++ xen-4.0.2-testing/xen/include/xen/smp.h
@@ -13,6 +13,8 @@ extern void smp_send_event_check_mask(co
#define smp_send_event_check_cpu(cpu) \
smp_send_event_check_mask(cpumask_of(cpu))
+extern void smp_send_state_dump(unsigned int cpu);
+
/*
* Prepare machine for booting other CPUs.
*/

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
Index: xen-4.0.2-testing/tools/firmware/hvmloader/acpi/dsdt.asl
Index: xen-4.1.0-testing/tools/firmware/hvmloader/acpi/dsdt.asl
===================================================================
--- xen-4.0.2-testing.orig/tools/firmware/hvmloader/acpi/dsdt.asl
+++ xen-4.0.2-testing/tools/firmware/hvmloader/acpi/dsdt.asl
--- xen-4.1.0-testing.orig/tools/firmware/hvmloader/acpi/dsdt.asl
+++ xen-4.1.0-testing/tools/firmware/hvmloader/acpi/dsdt.asl
@@ -30,21 +30,9 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2,
/*
* S3 (suspend-to-ram), S4 (suspend-to-disc) and S5 (power-off) type codes:
@ -11,18 +11,18 @@ Index: xen-4.0.2-testing/tools/firmware/hvmloader/acpi/dsdt.asl
*/
- Name (\_S3, Package (0x04)
- {
- 0x05, /* PM1a_CNT.SLP_TYP */
- 0x05, /* PM1b_CNT.SLP_TYP */
- 0x01, /* PM1a_CNT.SLP_TYP */
- 0x01, /* PM1b_CNT.SLP_TYP */
- 0x0, /* reserved */
- 0x0 /* reserved */
- })
- Name (\_S4, Package (0x04)
- {
- 0x06, /* PM1a_CNT.SLP_TYP */
- 0x06, /* PM1b_CNT.SLP_TYP */
- 0x00, /* PM1a_CNT.SLP_TYP */
- 0x00, /* PM1b_CNT.SLP_TYP */
- 0x00, /* reserved */
- 0x00 /* reserved */
- })
Name (\_S5, Package (0x04)
{
0x07, /* PM1a_CNT.SLP_TYP */
0x00, /* PM1a_CNT.SLP_TYP */

View File

@ -1,34 +0,0 @@
Subject: hotplug: allow hardlinked files for block device images
tools/hotplug/Linux/block change for this losetup -a output:
inode 12 is listed twice due to hardlinks
/dev/loop0: [0809]:139267 (/abuild/vdisk-sles11_2-disk0)
/dev/loop1: [0809]:139266 (/abuild/vdisk-sles11_1-disk1)
/dev/loop3: [0809]:139267 (/abuild/vdisk-sles11_2-disk0)
/dev/loop5: [0809]:139273 (/abuild/vdisk-sles11_5-disk1)
/dev/loop8: [0809]:12 (/abuild/bootiso-xenpaging-sles11_5.iso)
/dev/loop10: [0809]:12 (/abuild/bootiso-xenpaging-sles11_4.iso)
/dev/loop11: [0809]:139271 (/abuild/vdisk-sles11_4-disk0)
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
tools/hotplug/Linux/block | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: xen-4.0.2-testing/tools/hotplug/Linux/block
===================================================================
--- xen-4.0.2-testing.orig/tools/hotplug/Linux/block
+++ xen-4.0.2-testing/tools/hotplug/Linux/block
@@ -279,8 +279,8 @@ mount it read-write in a guest domain."
fatal "Unable to lookup $file: dev: $dev inode: $inode"
fi
- shared_list=$(losetup -a | grep ' \[0*'${dev}'\]:'${inode} |
- cut -d : -f 1)
+ shared_list=$(losetup -a |
+ sed -n -e "s@^\([^:]\+\)\(:[[:blank:]]\[${dev}\]:${inode}[[:blank:]](${file})\)@\1@p" )
for dev in "$shared_list"
do
if [ -n "$dev" ]

View File

@ -1,8 +1,8 @@
Index: xen-4.0.2-testing/tools/python/xen/xend/XendConfig.py
Index: xen-4.1.0-testing/tools/python/xen/xend/XendConfig.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/xend/XendConfig.py
+++ xen-4.0.2-testing/tools/python/xen/xend/XendConfig.py
@@ -157,6 +157,7 @@ XENAPI_PLATFORM_CFG_TYPES = {
--- xen-4.1.0-testing.orig/tools/python/xen/xend/XendConfig.py
+++ xen-4.1.0-testing/tools/python/xen/xend/XendConfig.py
@@ -159,6 +159,7 @@ XENAPI_PLATFORM_CFG_TYPES = {
'nographic': int,
'nomigrate': int,
'pae' : int,
@ -10,7 +10,7 @@ Index: xen-4.0.2-testing/tools/python/xen/xend/XendConfig.py
'rtc_timeoffset': int,
'parallel': str,
'serial': str,
@@ -509,6 +510,8 @@ class XendConfig(dict):
@@ -515,6 +516,8 @@ class XendConfig(dict):
if self.is_hvm():
if 'timer_mode' not in self['platform']:
self['platform']['timer_mode'] = 1
@ -19,10 +19,10 @@ Index: xen-4.0.2-testing/tools/python/xen/xend/XendConfig.py
if 'viridian' not in self['platform']:
self['platform']['viridian'] = 0
if 'rtc_timeoffset' not in self['platform']:
Index: xen-4.0.2-testing/tools/python/xen/xend/image.py
Index: xen-4.1.0-testing/tools/python/xen/xend/image.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/xend/image.py
+++ xen-4.0.2-testing/tools/python/xen/xend/image.py
--- xen-4.1.0-testing.orig/tools/python/xen/xend/image.py
+++ xen-4.1.0-testing/tools/python/xen/xend/image.py
@@ -839,6 +839,7 @@ class HVMImageHandler(ImageHandler):
self.apic = int(vmConfig['platform'].get('apic', 0))
@ -31,10 +31,10 @@ Index: xen-4.0.2-testing/tools/python/xen/xend/image.py
self.guest_os_type = vmConfig['platform'].get('guest_os_type')
self.memory_sharing = int(vmConfig['memory_sharing'])
try:
Index: xen-4.0.2-testing/tools/python/xen/xm/create.py
Index: xen-4.1.0-testing/tools/python/xen/xm/create.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/xm/create.py
+++ xen-4.0.2-testing/tools/python/xen/xm/create.py
--- xen-4.1.0-testing.orig/tools/python/xen/xm/create.py
+++ xen-4.1.0-testing/tools/python/xen/xm/create.py
@@ -242,6 +242,10 @@ gopts.var('viridian', val='VIRIDIAN',
use="""Expose Viridian interface to x86 HVM guest?
(Default is 0).""")

View File

@ -17,10 +17,10 @@ qcow2 image (the header is gone after three loop iterations):
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/block-qcow2.c
Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/block-qcow2.c
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/block-qcow2.c
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/block-qcow2.c
--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/block-qcow2.c
+++ xen-4.1.0-testing/tools/ioemu-qemu-xen/block-qcow2.c
@@ -916,7 +916,7 @@ static int alloc_cluster_link_l2(BlockDr
goto err;

View File

@ -1,7 +1,7 @@
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c
Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.c
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c
--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.c
+++ xen-4.1.0-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c
@@ -259,8 +259,11 @@ static int open_disk(struct td_state *s,
drv = blktap_drivers[i].drv;
DPRINTF("%s driver specified\n", drv ? drv->format_name : "No");

View File

@ -1,7 +1,7 @@
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c
Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.c
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c
--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.c
+++ xen-4.1.0-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c
@@ -360,6 +360,15 @@ static void qemu_send_responses(void* op
}

View File

@ -1,8 +1,8 @@
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/xen_machine_fv.c
Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/hw/xen_machine_fv.c
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/hw/xen_machine_fv.c
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/xen_machine_fv.c
@@ -268,6 +268,7 @@ void qemu_invalidate_entry(uint8_t *buff
--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/hw/xen_machine_fv.c
+++ xen-4.1.0-testing/tools/ioemu-qemu-xen/hw/xen_machine_fv.c
@@ -269,6 +269,7 @@ void qemu_invalidate_entry(uint8_t *buff
#endif /* defined(MAPCACHE) */
@ -10,7 +10,7 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/xen_machine_fv.c
static void xen_init_fv(ram_addr_t ram_size, int vga_ram_size,
const char *boot_device,
@@ -293,6 +294,11 @@ static void xen_init_fv(ram_addr_t ram_s
@@ -294,6 +295,11 @@ static void xen_init_fv(ram_addr_t ram_s
}
#endif

View File

@ -15,10 +15,10 @@ Signed-off-by: Kevin Wolf <kwolf@suse.de>
hw/xen_blktap.h | 14 ++++++++++++++
2 files changed, 33 insertions(+), 3 deletions(-)
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c
Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.c
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c
--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.c
+++ xen-4.1.0-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c
@@ -230,9 +230,10 @@ static int map_new_dev(struct td_state *
return -1;
}
@ -64,10 +64,10 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c
msglen = sizeof(msg_hdr_t);
msg->type = CTLMSG_IMG_FAIL;
msg->len = msglen;
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.h
Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/hw/xen_blktap.h
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.h
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.h
--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.h
+++ xen-4.1.0-testing/tools/ioemu-qemu-xen/hw/xen_blktap.h
@@ -53,4 +53,18 @@ typedef struct fd_list_entry {
int init_blktap(void);

View File

@ -12,10 +12,10 @@ Signed-off-by: Kevin Wolf <kwolf@suse.de>
hw/xen_blktap.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c
Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.c
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c
--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/hw/xen_blktap.c
+++ xen-4.1.0-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c
@@ -268,6 +268,12 @@ static int open_disk(struct td_state *s,
s->size = bs->total_sectors;
s->sector_size = 512;
@ -29,10 +29,10 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/xen_blktap.c
s->info = ((s->flags & TD_RDONLY) ? VDISK_READONLY : 0);
return 0;
Index: xen-4.0.2-testing/tools/python/xen/xend/server/DevController.py
Index: xen-4.1.0-testing/tools/python/xen/xend/server/DevController.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/xend/server/DevController.py
+++ xen-4.0.2-testing/tools/python/xen/xend/server/DevController.py
--- xen-4.1.0-testing.orig/tools/python/xen/xend/server/DevController.py
+++ xen-4.1.0-testing/tools/python/xen/xend/server/DevController.py
@@ -155,7 +155,7 @@ class DevController:
(devid, self.deviceClass))

View File

@ -1,7 +1,7 @@
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/Makefile
Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/Makefile
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/Makefile
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/Makefile
--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/Makefile
+++ xen-4.1.0-testing/tools/ioemu-qemu-xen/Makefile
@@ -243,7 +243,7 @@ endif
install: all $(if $(BUILD_DOCS),install-doc)
mkdir -p "$(DESTDIR)$(bindir)"
@ -11,11 +11,11 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/Makefile
endif
ifneq ($(BLOBS),)
mkdir -p "$(DESTDIR)$(datadir)"
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/Makefile.target
Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/Makefile.target
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/Makefile.target
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/Makefile.target
@@ -754,7 +754,7 @@ clean:
--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/Makefile.target
+++ xen-4.1.0-testing/tools/ioemu-qemu-xen/Makefile.target
@@ -755,7 +755,7 @@ clean:
install: all install-hook
ifneq ($(PROGS),)

View File

@ -1,7 +1,7 @@
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/qemu-xen.h
Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/qemu-xen.h
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/qemu-xen.h
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/qemu-xen.h
--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/qemu-xen.h
+++ xen-4.1.0-testing/tools/ioemu-qemu-xen/qemu-xen.h
@@ -1,6 +1,8 @@
#ifndef QEMU_XEN_H
#define QEMU_XEN_H
@ -11,46 +11,45 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/qemu-xen.h
/* vl.c */
extern int restore;
extern int vga_ram_size;
@@ -73,7 +75,7 @@ void handle_buffered_pio(void);
#endif
@@ -75,7 +77,7 @@ void handle_buffered_pio(void);
/* xenstore.c */
void xenstore_init(void);
uint32_t xenstore_read_target(void);
-void xenstore_parse_domain_config(int domid);
+void xenstore_parse_domain_config(int domid, QEMUMachine *machine);
int xenstore_parse_disable_pf_config(void);
int xenstore_fd(void);
void xenstore_process_event(void *opaque);
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/vl.c
Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/vl.c
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/vl.c
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/vl.c
@@ -5827,10 +5827,10 @@ int main(int argc, char **argv, char **e
--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/vl.c
+++ xen-4.1.0-testing/tools/ioemu-qemu-xen/vl.c
@@ -5830,9 +5830,9 @@ int main(int argc, char **argv, char **e
if ((msg = xenbus_read(XBT_NIL, "domid", &domid_s)))
fprintf(stderr,"Can not read our own domid: %s\n", msg);
else
- xenstore_parse_domain_config(atoi(domid_s));
+ xenstore_parse_domain_config(atoi(domid_s), machine);
}
#else
- xenstore_parse_domain_config(domid);
+ xenstore_parse_domain_config(domid, machine);
- xenstore_parse_domain_config(domid);
+ xenstore_parse_domain_config(domid, machine);
#endif /* CONFIG_STUBDOM */
}
/* we always create the cdrom drive, even if no disk is there */
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/xenstore.c
Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/xenstore.c
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/xenstore.c
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/xenstore.c
@@ -397,7 +397,7 @@ static const char *xenstore_get_guest_uu
#define PT_PCI_POWER_MANAGEMENT_DEFAULT 0
int direct_pci_msitranslate;
int direct_pci_power_mgmt;
--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/xenstore.c
+++ xen-4.1.0-testing/tools/ioemu-qemu-xen/xenstore.c
@@ -447,7 +447,7 @@ void xenstore_init(void)
}
}
-void xenstore_parse_domain_config(int hvm_domid)
+void xenstore_parse_domain_config(int hvm_domid, QEMUMachine *machine)
{
char **e_danger = NULL;
char *buf = NULL;
@@ -712,15 +712,19 @@ void xenstore_parse_domain_config(int hv
@@ -754,15 +754,19 @@ void xenstore_parse_domain_config(int hv
#endif

View File

@ -1,7 +1,7 @@
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/xen_platform.c
Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/hw/xen_platform.c
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/hw/xen_platform.c
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/xen_platform.c
--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/hw/xen_platform.c
+++ xen-4.1.0-testing/tools/ioemu-qemu-xen/hw/xen_platform.c
@@ -359,6 +359,8 @@ static void platform_ioport_write(void *
case 4:
fprintf(logfile, "Disconnect IDE hard disk...\n");
@ -11,10 +11,10 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/xen_platform.c
fprintf(logfile, "Disconnect netifs...\n");
pci_unplug_netifs();
fprintf(logfile, "Shutdown taps...\n");
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/qemu-xen.h
Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/qemu-xen.h
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/qemu-xen.h
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/qemu-xen.h
--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/qemu-xen.h
+++ xen-4.1.0-testing/tools/ioemu-qemu-xen/qemu-xen.h
@@ -57,6 +57,7 @@ void unset_vram_mapping(void *opaque);
#endif
@ -23,11 +23,11 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/qemu-xen.h
void destroy_hvm_domain(void);
void unregister_iomem(target_phys_addr_t start);
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/pci.c
Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/hw/pci.c
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/hw/pci.c
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/pci.c
@@ -892,6 +892,50 @@ void pci_unplug_netifs(void)
--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/hw/pci.c
+++ xen-4.1.0-testing/tools/ioemu-qemu-xen/hw/pci.c
@@ -871,6 +871,50 @@ void pci_unplug_netifs(void)
}
}
@ -45,7 +45,7 @@ Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/hw/pci.c
+ dev = bus->devices[x];
+ if (dev &&
+ dev->config[0xa] == 0 &&
+ dev->config[0xb] == 1
+ dev->config[0xb] == 1
+#ifdef CONFIG_PASSTHROUGH
+ && test_pci_devfn(x) != 1
+#endif

View File

@ -1,7 +1,7 @@
Index: xen-4.0.2-testing/tools/ioemu-qemu-xen/vnc.c
Index: xen-4.1.0-testing/tools/ioemu-qemu-xen/vnc.c
===================================================================
--- xen-4.0.2-testing.orig/tools/ioemu-qemu-xen/vnc.c
+++ xen-4.0.2-testing/tools/ioemu-qemu-xen/vnc.c
--- xen-4.1.0-testing.orig/tools/ioemu-qemu-xen/vnc.c
+++ xen-4.1.0-testing/tools/ioemu-qemu-xen/vnc.c
@@ -1734,6 +1734,25 @@ static int protocol_client_msg(VncState
}

View File

@ -1,7 +1,7 @@
Index: xen-4.0.2-testing/tools/libxen/src/xen_common.c
Index: xen-4.1.0-testing/tools/libxen/src/xen_common.c
===================================================================
--- xen-4.0.2-testing.orig/tools/libxen/src/xen_common.c
+++ xen-4.0.2-testing/tools/libxen/src/xen_common.c
--- xen-4.1.0-testing.orig/tools/libxen/src/xen_common.c
+++ xen-4.1.0-testing/tools/libxen/src/xen_common.c
@@ -904,8 +904,15 @@ static void parse_into(xen_session *s, x
0 != strcmp((char *)value_node->children->name, "struct") ||
value_node->children->children == NULL)

View File

@ -2,10 +2,10 @@ Make our PV drivers work with older hosts that do not recognize the new PV driv
Signed-off-by: K. Y. Srinivasan <ksrinivasan@novell.com>
Index: xen-4.0.2-testing/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
Index: xen-4.1.0-testing/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
===================================================================
--- xen-4.0.2-testing.orig/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
+++ xen-4.0.2-testing/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
--- xen-4.1.0-testing.orig/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
+++ xen-4.1.0-testing/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
@@ -320,7 +320,10 @@ static int check_platform_magic(struct d
if (magic != XEN_IOPORT_MAGIC_VAL) {

View File

@ -1,23 +1,8 @@
Index: xen-4.0.2-testing/extras/mini-os/netfront.c
Index: xen-4.1.0-testing/extras/mini-os/lib/math.c
===================================================================
--- xen-4.0.2-testing.orig/extras/mini-os/netfront.c
+++ xen-4.0.2-testing/extras/mini-os/netfront.c
@@ -25,8 +25,8 @@ DECLARE_WAIT_QUEUE_HEAD(netfront_queue);
-#define NET_TX_RING_SIZE __RING_SIZE((struct netif_tx_sring *)0, PAGE_SIZE)
-#define NET_RX_RING_SIZE __RING_SIZE((struct netif_rx_sring *)0, PAGE_SIZE)
+#define NET_TX_RING_SIZE __CONST_RING_SIZE(netif_tx, PAGE_SIZE)
+#define NET_RX_RING_SIZE __CONST_RING_SIZE(netif_rx, PAGE_SIZE)
#define GRANT_INVALID_REF 0
Index: xen-4.0.2-testing/extras/mini-os/lib/math.c
===================================================================
--- xen-4.0.2-testing.orig/extras/mini-os/lib/math.c
+++ xen-4.0.2-testing/extras/mini-os/lib/math.c
@@ -191,6 +191,7 @@ __qdivrem(uint64_t uq, uint64_t vq, uint
--- xen-4.1.0-testing.orig/extras/mini-os/lib/math.c
+++ xen-4.1.0-testing/extras/mini-os/lib/math.c
@@ -187,6 +187,7 @@ __qdivrem(uint64_t uq, uint64_t vq, uint
* and thus
* m = 4 - n <= 2
*/
@ -25,16 +10,3 @@ Index: xen-4.0.2-testing/extras/mini-os/lib/math.c
tmp.uq = uq;
u[0] = 0;
u[1] = HHALF(tmp.ul[H]);
Index: xen-4.0.2-testing/extras/mini-os/arch/x86/mm.c
===================================================================
--- xen-4.0.2-testing.orig/extras/mini-os/arch/x86/mm.c
+++ xen-4.0.2-testing/extras/mini-os/arch/x86/mm.c
@@ -281,7 +281,7 @@ static void build_pagetable(unsigned lon
/*
* Mark portion of the address space read only.
*/
-extern void shared_info;
+extern char shared_info[PAGE_SIZE];
static void set_readonly(void *text, void *etext)
{
unsigned long start_address =

View File

@ -5,27 +5,11 @@ bootloader loopback device. This patch creates a list of bootloader
loopback devices so more than one instance of bootloader can be run
concurrently.
Index: xen-4.0.2-testing/tools/python/xen/util/blkif.py
Index: xen-4.1.0-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/util/blkif.py
+++ xen-4.0.2-testing/tools/python/xen/util/blkif.py
@@ -19,11 +19,6 @@ def blkdev_name_to_number(name):
devname = 'virtual-device'
devnum = None
- try:
- return (devname, os.stat(n).st_rdev)
- except Exception, ex:
- pass
-
scsi_major = [ 8, 65, 66, 67, 68, 69, 70, 71, 128, 129, 130, 131, 132, 133, 134, 135 ]
if re.match( '/dev/sd[a-z]([1-9]|1[0-5])?$', n):
major = scsi_major[(ord(n[7:8]) - ord('a')) / 16]
Index: xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -73,7 +73,7 @@ from xen.xend.XendPSCSI import XendPSCSI
--- xen-4.1.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-4.1.0-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -74,7 +74,7 @@ from xen.xend.XendPSCSI import XendPSCSI
from xen.xend.XendDSCSI import XendDSCSI, XendDSCSI_HBA
MIGRATE_TIMEOUT = 30.0
@ -34,7 +18,7 @@ Index: xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py
xc = xen.lowlevel.xc.xc()
xoptions = XendOptions.instance()
@@ -3305,33 +3305,38 @@ class XendDomainInfo:
@@ -3299,33 +3299,38 @@ class XendDomainInfo:
# This is a file, not a device. pygrub can cope with a
# file if it's raw, but if it's QCOW or other such formats
# used through blktap, then we need to mount it first.

Some files were not shown because too many files have changed in this diff Show More