]> xenbits.xensource.com Git - xen.git/log
xen.git
11 years agoupdate Xen version to 4.3.1-rc1 4.3.1-rc1
Jan Beulich [Tue, 1 Oct 2013 10:21:04 +0000 (12:21 +0200)]
update Xen version to 4.3.1-rc1

11 years agox86: properly set up fbld emulation operand address
Jan Beulich [Mon, 30 Sep 2013 12:24:25 +0000 (14:24 +0200)]
x86: properly set up fbld emulation operand address

This is CVE-2013-4361 / XSA-66.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
master commit: 28b706efb6abb637fabfd74cde70a50935a5640b
master date: 2013-09-30 14:18:58 +0200

11 years agox86/mm/shadow: Fix initialization of PV shadow L4 tables.
Tim Deegan [Mon, 30 Sep 2013 12:23:33 +0000 (14:23 +0200)]
x86/mm/shadow: Fix initialization of PV shadow L4 tables.

Shadowed PV L4 tables must have the same Xen mappings as their
unshadowed equivalent.  This is done by copying the Xen entries
verbatim from the idle pagetable, and then using guest_l4_slot()
in the SHADOW_FOREACH_L4E() iterator to avoid touching those entries.

adc5afbf1c70ef55c260fb93e4b8ce5ccb918706 (x86: support up to 16Tb)
changed the definition of ROOT_PAGETABLE_XEN_SLOTS to extend right to
the top of the address space, which causes the shadow code to
copy Xen mappings into guest-kernel-address slots too.

In the common case, all those slots are zero in the idle pagetable,
and no harm is done.  But if any slot above #271 is non-zero, Xen will
crash when that slot is later cleared (it attempts to drop
shadow-pagetable refcounts on its own L4 pagetables).

Fix by using the new ROOT_PAGETABLE_PV_XEN_SLOTS when appropriate.
Monitor pagetables need the full Xen mappings, so they keep using the
old name (with its new semantics).

This is CVE-2013-4356 / XSA-64.

Signed-off-by: Tim Deegan <tim@xen.org>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
master commit: f46befdd825c8a459c5eb21adb7d5b0dc6e30ad5
master date: 2013-09-30 14:18:25 +0200

11 years agox86: properly handle hvm_copy_from_guest_{phys,virt}() errors
Jan Beulich [Mon, 30 Sep 2013 12:22:37 +0000 (14:22 +0200)]
x86: properly handle hvm_copy_from_guest_{phys,virt}() errors

Ignoring them generally implies using uninitialized data and, in all
but two of the cases dealt with here, potentially leaking hypervisor
stack contents to guests.

This is CVE-2013-4355 / XSA-63.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Tim Deegan <tim@xen.org>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
master commit: 6bb838e7375f5b031e9ac346b353775c90de45dc
master date: 2013-09-30 14:17:46 +0200

11 years agox86/HVM: refuse doing string operations in certain situations
Jan Beulich [Fri, 27 Sep 2013 09:59:54 +0000 (11:59 +0200)]
x86/HVM: refuse doing string operations in certain situations

We shouldn't do any acceleration for
- "rep movs" when either side is passed through MMIO or when both sides
  are handled by qemu
- "rep ins" and "rep outs" when the memory operand is any kind of MMIO

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
master commit: 14fcce2fa883405bab26b60821a6cc5f2c770833
master date: 2013-09-23 09:55:14 +0200

11 years agox86/HVM: linear address must be canonical for the whole accessed range
Jan Beulich [Fri, 27 Sep 2013 09:59:14 +0000 (11:59 +0200)]
x86/HVM: linear address must be canonical for the whole accessed range

... rather than just for the first byte.

While at it, also
- make the real mode case at least dpo a wrap around check
- drop the mis-named "gpf" label (we're not generating faults here)
  and use in-place returns instead

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
master commit: 7f12732670b31b2fea899a4160d455574658474f
master date: 2013-09-23 09:53:55 +0200

11 years agosched_credit: filter node-affinity mask against online cpus
Dario Faggioli [Fri, 27 Sep 2013 09:57:59 +0000 (11:57 +0200)]
sched_credit: filter node-affinity mask against online cpus

in _csched_cpu_pick(), as not doing so may result in the domain's
node-affinity mask (as retrieved by csched_balance_cpumask() )
and online mask (as retrieved by cpupool_scheduler_cpumask() )
having an empty intersection.

Therefore, when attempting a node-affinity load balancing step
and running this:

    ...
    /* Pick an online CPU from the proper affinity mask */
    csched_balance_cpumask(vc, balance_step, &cpus);
    cpumask_and(&cpus, &cpus, online);
    ...

we end up with an empty cpumask (in cpus). At this point, in
the following code:

    ....
    /* If present, prefer vc's current processor */
    cpu = cpumask_test_cpu(vc->processor, &cpus)
            ? vc->processor
            : cpumask_cycle(vc->processor, &cpus);
    ....

an ASSERT (from inside cpumask_cycle() ) triggers like this:

(XEN) Xen call trace:
(XEN)    [<ffff82d08011b124>] _csched_cpu_pick+0x1d2/0x652
(XEN)    [<ffff82d08011b5b2>] csched_cpu_pick+0xe/0x10
(XEN)    [<ffff82d0801232de>] vcpu_migrate+0x167/0x31e
(XEN)    [<ffff82d0801238cc>] cpu_disable_scheduler+0x1c8/0x287
(XEN)    [<ffff82d080101b3f>] cpupool_unassign_cpu_helper+0x20/0xb4
(XEN)    [<ffff82d08010544f>] continue_hypercall_tasklet_handler+0x4a/0xb1
(XEN)    [<ffff82d080127793>] do_tasklet_work+0x78/0xab
(XEN)    [<ffff82d080127a70>] do_tasklet+0x5f/0x8b
(XEN)    [<ffff82d080158985>] idle_loop+0x57/0x5e
(XEN)
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 1:
(XEN) Assertion 'cpu < nr_cpu_ids' failed at /home/dario/Sources/xen/xen/xen.git/xen/include/xe:16481

It is for example sufficient to have a domain with node-affinity
to NUMA node 1 running, and issueing a `xl cpupool-numa-split'
would make the above happen. That is because, by default, all
the existing domains remain assigned to the first cpupool, and
it now (after the cpupool-numa-split) only includes NUMA node 0.

This change prevents that by generalizing the function used
for figuring out whether a node-affinity load balancing step
is legit or not. This way we can, in _csched_cpu_pick(),
figure out early enough that the mask would end up empty,
skip the step all together and avoid the splat.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: George Dunlap <george.dunlap@eu.citrix.com>
master commit: 5e5a44b6c942d6ea47f15d6f1ed02b03e0d69445
master date: 2013-09-20 11:37:28 +0200

11 years agowatchdog/crash: Always disable watchdog in console_force_unlock()
Andrew Cooper [Fri, 27 Sep 2013 09:54:42 +0000 (11:54 +0200)]
watchdog/crash: Always disable watchdog in console_force_unlock()

Depending on the state of the conring and serial_tx_buffer,
console_force_unlock() can be a long running operation, usually because of
serial_start_sync()

XenServer testing has found a reliable case where console_force_unlock() on
one PCPU takes long enough for another PCPU to timeout due to the watchdog
(such as waiting for a tlb flush callin).

The watchdog timeout causes the second PCPU to repeat the
console_force_unlock(), at which point the first PCPU typically fails an
assertion in spin_unlock_irqrestore(&port->tx_lock) (because the tx_lock has
been unlocked behind itself).

console_force_unlock() is only on emergency paths, so one way or another the
host is going down.  Disable the watchdog before forcing the console lock to
help prevent having pcpus completing with each other to bring the host down.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
master commit: 7b9fa702ca323164d6b49e8b639a57f880454a8c
master date: 2013-08-13 14:31:01 +0200

11 years agoxen/conring: Write to console ring even if console lock is busted
Andrew Cooper [Fri, 27 Sep 2013 09:53:26 +0000 (11:53 +0200)]
xen/conring: Write to console ring even if console lock is busted

console_lock_busted gets set when an NMI/MCE/Double Fault handler decides to
bring Xen down in an emergency.  conring_puts() cannot block and does
not have problematic interactions with the console_lock.

Therefore, choosing to not put the string into the console ring simply means
that the kexec environment cant find any panic() message caused by an IST
interrupt, which is unhelpful for debugging purposes.

In the case that two pcpus fight with console_force_unlock(), having slightly
garbled strings in the console ring is far more useful than having nothing at
all.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Matt Wilson <msw@amazon.com>
Acked-by: Keir Fraser <keir@xen.org>
master commit: 66450c1d1ab3c4480bbba949113b95d1ab6a943a
master date: 2013-08-06 17:45:00 +0200

11 years agox86/xsave: initialize extended register state when guests enable it
Jan Beulich [Wed, 25 Sep 2013 08:54:30 +0000 (10:54 +0200)]
x86/xsave: initialize extended register state when guests enable it

Till now, when setting previously unset bits in XCR0 we wouldn't touch
the active register state, thus leaving in the newly enabled registers
whatever a prior user of it left there, i.e. potentially leaking
information between guests.

This is CVE-2013-1442 / XSA-62.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
master commit: 63a75ba0de817d6f384f96d25427a05c313e2179
master date: 2013-09-25 10:41:25 +0200

11 years agounmodified_drivers: enable unplug per default
Olaf Hering [Mon, 23 Sep 2013 14:28:52 +0000 (16:28 +0200)]
unmodified_drivers: enable unplug per default

Since xen-3.3 an official unplug protocol for emulated hardware is
available in the toolstack. The pvops kernel does the unplug per
default, so it is safe to do it also in the drivers for forward ported
xenlinux.
Currently its required to load xen-platform-pci with the module
parameter dev_unplug=all, which is cumbersome.
Also recognize the dev_unplug=never parameter, which provides the
default before this patch.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
master commit: df17e9c889c48c9c10aa3f9dd0bb11077f54efc4
master date: 2013-09-20 11:41:08 +0200

11 years agox86/HVM: properly handle MMIO reads and writes wider than a machine word
Jan Beulich [Mon, 23 Sep 2013 14:28:21 +0000 (16:28 +0200)]
x86/HVM: properly handle MMIO reads and writes wider than a machine word

Just like real hardware we ought to split such accesses transparently
to the caller. With little extra effort we can at once even handle page
crossing accesses correctly.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
master commit: 3b89f08a498ddac09d4002d9849e329018ceb107
master date: 2013-09-20 11:01:08 +0200

11 years agoVMX: fix failure path in construct_vmcs
George Dunlap [Mon, 23 Sep 2013 14:27:39 +0000 (16:27 +0200)]
VMX: fix failure path in construct_vmcs

If the allocation fails, make sure to call vmx_vmcs_exit().

This is a candidate for backport.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Signed-off-by: Mukesh Rathor <mukesh.rathor@oracle.com>
master commit: dad7e45bf44c0569546a3ed7d0fa4182a4a73f0a
master date: 2013-09-18 14:45:42 +0200

11 years agox86/HVM: fix failure path in hvm_vcpu_initialise
George Dunlap [Mon, 23 Sep 2013 14:27:08 +0000 (16:27 +0200)]
x86/HVM: fix failure path in hvm_vcpu_initialise

It looks like one of the failure cases in hvm_vcpu_initialise jumps to
the wrong label; this could lead to slow leaks if something isn't
cleaned up properly.

I will probably change these labels in a future patch, but I figured
it was better to have this fix separately.

This is also a candidate for backport.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Signed-off-by: Mukesh Rathor <mukesh.rathor@oracle.com>
master commit: 925fbcb7fdd6238f26b1576dc1f3e297f1f24f1e
master date: 2013-09-18 14:45:24 +0200

11 years agopassthrough/amd: Missing 'break'
Tim Deegan [Mon, 23 Sep 2013 14:25:33 +0000 (16:25 +0200)]
passthrough/amd: Missing 'break'

Coverity CID 1055502

Signed-off-by: Tim Deegan <tim@xen.org>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
master commit: 72fa4fdf647ba99ecaf39589a93cde8dd36eed3c
master date: 2013-09-17 16:36:25 +0100

11 years agohvm/vpmu: Prevent dump handlers from incorrectly mutating state
Andrew Cooper [Mon, 23 Sep 2013 14:24:48 +0000 (16:24 +0200)]
hvm/vpmu: Prevent dump handlers from incorrectly mutating state

Discovered by Coverity, CID 1055181

core2_vpmu_dump() was incorrectly setting VPMU_CONTEXT_LOADED when it
was intending to check for it.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
This would have been avoided if the dump function declared all its
pointers "const" - doing this now (also in SVM).

Also fixing some indentation issues at once.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
master commit: 42c5b1214071d363a52c6356dfe2ed820f500849
master date: 2013-09-16 12:22:20 +0200

11 years agox86: machine_restart() must not call acpi_dmar_reinstate() twice
Jan Beulich [Mon, 23 Sep 2013 14:23:52 +0000 (16:23 +0200)]
x86: machine_restart() must not call acpi_dmar_reinstate() twice

.. as that function is not idempotent (it always alters the table
checksum). The (generally) duplicate call was a result from it being
made before machine_restart() re-invoking itself on the boot CPU.

Considering that no problem arose so far from the table corruption I
doubt that we need to restore the correct table signature on the
reboot path in general. The only case I can see this as potentially
necessary is the tboot one, hence do the call just in that case.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
master commit: a54dc5f4fe1eae6b1beb21326ef0338cd3969cd1
master date: 2013-09-13 14:27:34 +0200

11 years agocpufreq: missing check of copy_from_guest()
Tim Deegan [Mon, 23 Sep 2013 14:23:14 +0000 (16:23 +0200)]
cpufreq: missing check of copy_from_guest()

Coverity CID 1055131
Coverity CID 1055132

Signed-off-by: Tim Deegan <tim@xen.org>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
master commit: 803f9a6cdfeda64beee908576de0ad02d6b0c480
master date: 2013-09-12 17:47:08 +0100

11 years agolibxc/x86: fix page table creation for huge guests
Jan Beulich [Mon, 23 Sep 2013 14:22:47 +0000 (16:22 +0200)]
libxc/x86: fix page table creation for huge guests

The switch-over logic from one page directory to the next was wrong;
it needs to be deferred until we actually reach the last page within
a given region, instead of being done when the last entry of a page
directory gets started with.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
master commit: 06d086832155fc7f5344e9d108b979de34674d11
master date: 2013-09-12 17:41:04 +0200

11 years agox86: fix memory cut-off when using PFN compression
Jan Beulich [Mon, 23 Sep 2013 14:21:52 +0000 (16:21 +0200)]
x86: fix memory cut-off when using PFN compression

For one setup_max_pdx(), when invoked a second time (after SRAT got
parsed), needs to start from the original max_page value again (using
the already adjusted one from the first invocation would not allow the
cut-off boundary to be moved up).

Second, _if_ we need to cut off some part of memory, we must not allow
this to also propagate into the NUMA accounting. Otherwise
cutoff_node() results in nodes_cover_memory() to find some parts of
memory apparently not having a PXM association, causing all SRAT info
to be ignored.

The only possibly problematic consumer of node_spanned_pages (the
meaning of which gets altered here in that it now also includes memory
Xen can't actively make use of) is XEN_SYSCTL_numainfo: At a first
glance the potentially larger reported memory size shouldn't confuse
tool stacks.

And finally we must not put our boot time modules at addresses which
(at that time) can't be guaranteed to be accessible later. This applies
to both the EFI boot loader and the module relocation code.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Acked-by: Dario Faggioli <dario.faggioli@citrix.com>
master commit: 8efce9d69998a3d3c720ac7dbdb9b7e240369957
master date: 2013-09-12 09:52:53 +0200

11 years agosched/arinc653: check for guest data transfer failures
Matthew Daley [Mon, 23 Sep 2013 14:20:59 +0000 (16:20 +0200)]
sched/arinc653: check for guest data transfer failures

Coverity-ID: 1055121
Coverity-ID: 1055122
Coverity-ID: 1055123
Coverity-ID: 1055124
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
master commit: 546ba2f17008387cf9821df46e6dac04f0883a9b
master date: 2013-09-10 17:16:02 +0200

11 years agotools: xen-mceinj: Add missing return value checks
Bastian Blank [Sun, 11 Aug 2013 20:10:20 +0000 (22:10 +0200)]
tools: xen-mceinj: Add missing return value checks

The return value of vasprintf must be checked. This check is enforced
with the compiler options used in Debian by request and in Ubuntu by
default.

Check the return value and abort on error.

Signed-off-by: Bastian Blank <waldi@debian.org>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
(cherry picked from commit 1efe90faa31be104a24fe75323429d227eae1d9f)

11 years agolibxl: Allow network driver domains when run_hotplug_scritps is set
George Dunlap [Fri, 5 Jul 2013 11:13:54 +0000 (12:13 +0100)]
libxl: Allow network driver domains when run_hotplug_scritps is set

As of commit 05bfd984dfe7014f1f5ea1133608b9bab589c120, hotplug scripts
are not run if backend_domid != LIBXL_TOOSTACK_DOMID; so there is no reason
to restrict this for network driver domains any more.

This is a candidate for backporting to 4.3.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
CC: Ian Campbell <ian.campbell@citrix.com>
CC: Ian Jackson <ian.jackson@citrix.com>
CC: Jan Beulich <jbeulich@suse.com>
(cherry picked from commit 8f46b1cb99fe519ac39d10d0796c6be37fb1d178)

11 years agomake this tree's maintainership explicit
Jan Beulich [Fri, 13 Sep 2013 09:52:40 +0000 (11:52 +0200)]
make this tree's maintainership explicit

11 years agoNested VMX: Clear bit 31 of IA32_VMX_BASIC MSR
Yang Zhang [Thu, 12 Sep 2013 09:20:17 +0000 (11:20 +0200)]
Nested VMX: Clear bit 31 of IA32_VMX_BASIC MSR

The bit 31 of revision_id will set to 1 if vmcs shadowing enabled. And
according intel SDM, the bit 31 of IA32_VMX_BASIC MSR is always 0. So we
cannot set low 32 bit of IA32_VMX_BASIC to revision_id directly. Must clear
the bit 31 to 0.

Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
master commit: f3a4eb9253826d1e49e682314c8666b28fa0b717
master date: 2013-09-10 16:41:35 +0200

11 years agox86/xsave: fix migration from xsave-capable to xsave-incapable host
Jan Beulich [Thu, 12 Sep 2013 09:19:28 +0000 (11:19 +0200)]
x86/xsave: fix migration from xsave-capable to xsave-incapable host

With CPUID features suitably masked this is supposed to work, but was
completely broken (i.e. the case wasn't even considered when the
original xsave save/restore code was written).

First of all, xsave_enabled() wrongly returned the value of
cpu_has_xsave, i.e. not even taking into consideration attributes of
the vCPU in question. Instead this function ought to check whether the
guest ever enabled xsave support (by writing a [non-zero] value to
XCR0). As a result of this, a vCPU's xcr0 and xcr0_accum must no longer
be initialized to XSTATE_FP_SSE (since that's a valid value a guest
could write to XCR0), and the xsave/xrstor as well as the context
switch code need to suitably account for this (by always enforcing at
least this part of the state to be saved/loaded).

This involves undoing large parts of c/s 22945:13a7d1f7f62c ("x86: add
strictly sanity check for XSAVE/XRSTOR") - we need to cleanly
distinguish between hardware capabilities and vCPU used features.

Next both HVM and PV save code needed tweaking to not always save the
full state supported by the underlying hardware, but just the parts
that the guest actually used. Similarly the restore code should bail
not just on state being restored that the hardware cannot handle, but
also on inconsistent save state (inconsistent XCR0 settings or size of
saved state not in line with XCR0).

And finally the PV extended context get/set code needs to use slightly
different logic than the HVM one, as here we can't just key off of
xsave_enabled() (i.e. avoid doing anything if a guest doesn't use
xsave) because the tools use this function to determine host
capabilities as well as read/write vCPU state. The set operation in
particular needs to be capable of cleanly dealing with input that
consists of only the xcr0 and xcr0_accum values (if they're both zero
then no further data is required).

While for things to work correctly both sides (saving _and_ restoring
host) need to run with the fixed code, afaict no breakage should occur
if either side isn't up to date (other than the breakage that this
patch attempts to fix).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Yang Zhang <yang.z.zhang@intel.com>
Acked-by: Keir Fraser <keir@xen.org>
master commit: 4cc1344447a0458df5d222960f2adf1b65084fa8
master date: 2013-09-09 14:36:54 +0200

11 years agox86/xsave: initialization improvements
Jan Beulich [Thu, 12 Sep 2013 09:18:00 +0000 (11:18 +0200)]
x86/xsave: initialization improvements

- properly validate available feature set on APs
- also validate xsaveopt availability on APs
- properly indicate whether the initialization is on the BSP (we
  shouldn't be using "cpu == 0" checks for this)

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
master commit: c6066e78f4a66005b0d5d86c6ade32e2ab78923a
master date: 2013-08-30 10:56:07 +0200

11 years agoxmalloc: make whole pages xfree() clear the order field (ab)used by xmalloc()
Jan Beulich [Thu, 12 Sep 2013 09:15:24 +0000 (11:15 +0200)]
xmalloc: make whole pages xfree() clear the order field (ab)used by xmalloc()

Not doing this was found to cause problems with sequences of allocation
(multi-page), freeing, and then again allocation of the same page upon
boot when interrupts are still disabled (causing the owner field to be
non-zero, thus making the allocator attempt a TLB flush and, in its
processing, triggering an assertion).

Reported-by: Tomasz Wroblewski <tomasz.wroblewski@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Tomasz Wroblewski <tomasz.wroblewski@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
master commit: 0fbf3208d9c1a568aeeb61d9f4fbca03b1cfa1f8
master date: 2013-09-09 14:34:12 +0200

11 years agox86: allow guest to set/clear MSI-X mask bit (try 2)
Joby Poriyath [Thu, 12 Sep 2013 09:14:43 +0000 (11:14 +0200)]
x86: allow guest to set/clear MSI-X mask bit (try 2)

Guest needs the ability to enable and disable MSI-X interrupts
by setting the MSI-X control bit, for a passed-through device.
Guest is allowed to write MSI-X mask bit only if Xen *thinks*
that mask is clear (interrupts enabled). If the mask is set by
Xen (interrupts disabled), writes to mask bit by the guest is
ignored.

Currently, a write to MSI-X mask bit by the guest is silently
ignored.

A likely scenario is where we have a 82599 SR-IOV nic passed
through to a guest. From the guest if you do

  ifconfig <ETH_DEV> down
  ifconfig <ETH_DEV> up

the interrupts remain masked. On VF reset, the mask bit is set
by the controller. At this point, Xen is not aware that mask is set.
However, interrupts are enabled by VF driver by clearing the mask
bit by writing directly to BAR3 region containing the MSI-X table.

From dom0, we can verify that
interrupts are being masked using 'xl debug-keys M'.

Initially, guest was allowed to modify MSI-X bit.
Later this behaviour was changed.
See changeset 74c213c506afcd74a8556dd092995fd4dc38b225.

Signed-off-by: Joby Poriyath <joby.poriyath@citrix.com>
master commit: a35137373aa9042424565e5ee76dc0a3bb7642ae
master date: 2013-09-09 10:43:11 +0200

11 years agox86/EFI: properly handle run time memory regions outside the 1:1 map
Jan Beulich [Thu, 12 Sep 2013 09:14:01 +0000 (11:14 +0200)]
x86/EFI: properly handle run time memory regions outside the 1:1 map

Namely with PFN compression, MMIO ranges that the firmware may need
runtime access to can live in the holes that gets shrunk/eliminated by
PFN compression, and hence no mappings would result from simply
copying Xen's direct mapping table's L3 page table entries. Build
mappings for this "manually" in the EFI runtime call 1:1 page tables.

Use the opportunity to also properly identify (via a forcibly undefined
manifest constant) all the disabled code regions associated with it not
being acceptable for us to call SetVirtualAddressMap().

Signed-off-by: Jan Beulich <jbeulich@suse.com>
master commit: a350f3f43bcfac9c1591e28d8e43c505fcb172a5
master date: 2013-09-09 10:40:11 +0200

11 years agox86: Special case __HYPERVISOR_iret rather more when writing hypercall pages
Andrew Cooper [Thu, 12 Sep 2013 08:57:06 +0000 (10:57 +0200)]
x86: Special case __HYPERVISOR_iret rather more when writing hypercall pages

In all cases when a hypercall page is written, __HYPERVISOR_iret is first
written as a regular hypercall, then subsequently rewritten in its special
case.

For VMX and SVM, this means that following the ud2a instruction is 3 bytes of
an imm32 parameter.  For a ring3 kernel, this means that following the syscall
instruction is the second half of 'pop %r11'.

For a ring1 kernel, the iret case ends up as the same number of bytes as the
rest of the hypercalls, but it is pointless writing it twice, and is changed
for consistency.

Therefore, skip the loop iteration which would write the incorrect
__HYPERVISOR_iret hypercall.  This removes junk machine code from the tail and
makes disassemblers rather more happy when looking at the hypercall page.

Also, a miscellaneous whitespace fix in the comment for ring3 kernel.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
master commit: fca11da0ec956b17d7450d7776c3ffa22a8f538a
master date: 2013-07-16 11:10:45 +0200

11 years agohvmloader: fix SeaBIOS interface
Jan Beulich [Mon, 9 Sep 2013 09:51:20 +0000 (11:51 +0200)]
hvmloader: fix SeaBIOS interface

The SeaBIOS ROM image may validly exceed 128k in size, it's only our
interface code that so far assumed that it wouldn't. Remove that
restriction by setting the base address depending on image size.

Add a check to HVM loader so that too big images won't result in silent
guest failure anymore.

Uncomment the intended build-time size check for rombios, moving it
into a function so that it would actually compile.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
master commit: 5f2875739beef3a75c7a7e8579b6cbcb464e61b3
master date: 2013-09-05 11:47:03 +0200

11 years agoxen/docs: Correct documentation for the conswitch parameter
Andrew Cooper [Mon, 9 Sep 2013 09:50:20 +0000 (11:50 +0200)]
xen/docs: Correct documentation for the conswitch parameter

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
master commit: cc29e450d1abd2f8be67208dfb78046885a50cca
master date: 2013-09-04 18:19:01 +0100

11 years agoxend: fix file descriptor leak in pci utilities
Xi Xiong [Mon, 9 Sep 2013 09:49:46 +0000 (11:49 +0200)]
xend: fix file descriptor leak in pci utilities

A file descriptor leak was detected after creating multiple domUs with
pass-through PCI devices. This patch fixes the issue.

Signed-off-by: Xi Xiong <xixiong@amazon.com>
Reviewed-by: Matt Wilson <msw@amazon.com>
[msw: adjusted commit message]
Signed-off-by: Matt Wilson <msw@amazon.com>
master commit: 749019afca4fd002d36856bad002cc11f7d0ddda
master date: 2013-09-03 16:36:52 +0100

11 years agoxend: handle extended PCI configuration space when saving state
Steven Noonan [Mon, 9 Sep 2013 09:49:15 +0000 (11:49 +0200)]
xend: handle extended PCI configuration space when saving state

Newer PCI standards (e.g., PCI-X 2.0 and PCIe) introduce extended
configuration space which is larger than 256 bytes. This patch uses
stat() to determine the amount of space used to correctly save all of
the PCI configuration space. Resets handled by the xen-pciback driver
don't have this problem, as that code correctly handles saving
extended configuration space.

Signed-off-by: Steven Noonan <snoonan@amazon.com>
Reviewed-by: Matt Wilson <msw@amazon.com>
[msw: adjusted commit message]
Signed-off-by: Matt Wilson <msw@amazon.com>
master commit: 1893cf77992cc0ce9d827a8d345437fa2494b540
master date: 2013-09-03 16:36:47 +0100

11 years agopublic/hvm_xs_strings.h: Fix ABI regression for OEM SMBios strings
Andrew Cooper [Mon, 9 Sep 2013 09:48:28 +0000 (11:48 +0200)]
public/hvm_xs_strings.h: Fix ABI regression for OEM SMBios strings

The old code for OEM SMBios strings was:

        char path[20] = "bios-strings/oem-XX";
        path[(sizeof path) - 3] = '0' + ((i < 10) ? i : i / 10);
        path[(sizeof path) - 2] = (i < 10) ? '\0' : '0' + (i % 10);

Where oem-1 thru 9 specifically had no leading 0.

However, the definition of HVM_XS_OEM_STRINGS specifically requires leading
0s.

This regression was introduced by the combination of c/s 4d23036e709627 and
e64c3f71ceb662

I realise that this patch causes a change to the public headers.  However I
feel it is justified as:

* All toolstacks used to have to embed the magic string (and almost certainly
  still do)
* If by some miriacle a new toolstack has started using the new define will
  continue to work.
* The only intree consumer of the define is hvmloader itself.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
master commit: 0f4cb23c3ea5b987c49c9a9368e7a0d505ec064f
master date: 2013-08-30 10:40:48 +0200

11 years agohvmloader/smbios: Correctly count the number of tables written
Andrew Cooper [Mon, 9 Sep 2013 09:47:44 +0000 (11:47 +0200)]
hvmloader/smbios: Correctly count the number of tables written

Fixes regression indirectly introduced by c/s 4d23036e709627

That changeset added some smbios tables which were option based on the
toolstack providing appropriate xenstore keys.  The do_struct() macro would
unconditionally increment nr_structs, even if a table was not actually
written.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
master commit: 4aa19549e17650b9bfe2b31d7f52a95696d388f0
master date: 2013-08-30 10:40:29 +0200

11 years agox86: AVX instruction emulation fixes
Jan Beulich [Mon, 9 Sep 2013 09:46:26 +0000 (11:46 +0200)]
x86: AVX instruction emulation fixes

- we used the C4/C5 (first prefix) byte instead of the apparent ModR/M
  one as the second prefix byte
- early decoding normalized vex.reg, thus corrupting it for the main
  consumer (copy_REX_VEX()), resulting in #UD on the two-operand
  instructions we emulate

Also add respective test cases to the testing utility plus
- fix get_fpu() (the fall-through order was inverted)
- add cpu_has_avx2, even if it's currently unused (as in the new test
  cases I decided to refrain from using AVX2 instructions in order to
  be able to actually run all the tests on the hardware I have)
- slightly tweak cpu_has_avx to more consistently express the outputs
  we don't care about (sinking them all into the same variable)

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
master commit: 062919448e2f4b127c9c3c085b1a8e1d56a33051
master date: 2013-08-28 17:03:50 +0200

11 years agox86: don't allow Dom0 access to the MSI address range
Jan Beulich [Mon, 9 Sep 2013 09:45:16 +0000 (11:45 +0200)]
x86: don't allow Dom0 access to the MSI address range

In particular, MMIO assignments should not be done using this area.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by Xiantao Zhang <xiantao.zhang@intel.com>
master commit: 850188e1278cecd1dfb9b936024bee2d8dfdcc18
master date: 2013-08-27 11:11:38 +0200

11 years agoAMD IOMMU: add missing check
Jan Beulich [Fri, 6 Sep 2013 12:07:54 +0000 (14:07 +0200)]
AMD IOMMU: add missing check

We shouldn't accept IVHD tables specifying IO-APIC IDs beyond the limit
we support (MAX_IO_APICS, currently 128).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Suravee Suthikulpanit <suravee.suthikulapanit@amd.com>
master commit: 3785d30efe8264b899499e0883b10cc434bd0959
master date: 2013-08-29 09:31:37 +0200

11 years agoFix inactive timer list corruption on second S3 resume
Tomasz Wroblewski [Fri, 6 Sep 2013 12:03:40 +0000 (14:03 +0200)]
Fix inactive timer list corruption on second S3 resume

init_timer cannot be safely called multiple times on same timer since it does memset(0)
on the structure, erasing the auxiliary member used by linked list code. This breaks
inactive timer list in common/timer.c.

Moved resume_timer initialisation to ns16550_init_postirq, so it's only done once.

Signed-off-by: Tomasz Wroblewski <tomasz.wroblewski@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
master commit: 9e2c5938246546a5b3f698b7421640d85602b994
master date: 2013-08-28 10:18:39 +0200

11 years agox86/Intel: add support for Haswell CPU models
Jan Beulich [Fri, 6 Sep 2013 12:02:09 +0000 (14:02 +0200)]
x86/Intel: add support for Haswell CPU models

... according to their most recent public documentation.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
master commit: 3e787021fb2420851c7bdc3911ea53c728ba5ac0
master date: 2013-08-27 11:15:15 +0200

11 years agopygrub: add Debian extlinux.conf path
Ian Campbell [Fri, 16 Aug 2013 14:21:05 +0000 (15:21 +0100)]
pygrub: add Debian extlinux.conf path

This is Debian bug #697407.

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=697407

Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
(cherry picked from commit 258d27a1d9fb33a490bef1381f52d522225c3dca)

11 years agooxenstored: Protect oxenstored from malicious domains.
John Liu [Mon, 22 Jul 2013 21:23:10 +0000 (22:23 +0100)]
oxenstored: Protect oxenstored from malicious domains.

add check logic when read from IO ring, and if error happens,
then mark the reading connection as "bad", Unless vm reboot,
oxenstored will not handle message from this connection any more.

xs_ring_stubs.c: add a more strict check on ring reading
connection.ml, domain.ml: add getter and setter for bad flag
process.ml: if exception raised when reading from domain's ring,
            mark this domain as "bad"
xenstored.ml: if a domain is marked as "bad", do not handle it.

Signed-off-by: John Liu <john.liuqiming@huawei.com>
Acked-by: David Scott <dave.scott@eu.citrix.com>
(cherry picked from commit 704302ce9404c73cfb687d31adcf67094ab5bb53)

11 years agoNested VMX: Update APIC-v(RVI/SVI) when vmexit to L1
Yang Zhang [Tue, 27 Aug 2013 13:30:20 +0000 (15:30 +0200)]
Nested VMX: Update APIC-v(RVI/SVI) when vmexit to L1

If enabling APIC-v, all interrupts to L1 are delivered through APIC-v.
But when L2 is running, external interrupt will casue L1 vmexit with
reason external interrupt. Then L1 will pick up the interrupt through
vmcs12. when L1 ack the interrupt, since the APIC-v is enabled when
L1 is running, so APIC-v hardware still will do vEOI updating. The problem
is that the interrupt is delivered not through APIC-v hardware, this means
SVI/RVI/vPPR are not setting, but hardware required them when doing vEOI
updating. The solution is that, when L1 tried to pick up the interrupt
from vmcs12, then hypervisor will help to update the SVI/RVI/vPPR to make
sure the following vEOI updating and vPPR updating corrently.

Also, since interrupt is delivered through vmcs12, so APIC-v hardware will
not cleare vIRR and hypervisor need to clear it before L1 running.

Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
Acked-by: "Dong, Eddie" <eddie.dong@intel.com>
master commit: 84e6af58707520baf59c1c86c29237419e439afb
master date: 2013-08-22 10:59:01 +0200

11 years agoNested VMX: Clear APIC-v control bit in vmcs02
Yang Zhang [Tue, 27 Aug 2013 13:29:08 +0000 (15:29 +0200)]
Nested VMX: Clear APIC-v control bit in vmcs02

There is no vAPIC-v support, so mask APIC-v control bit when
constructing vmcs02.

Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
Acked-by: "Dong, Eddie" <eddie.dong@intel.com>
master commit: 375a1035002fb257087756a86e6caeda649fc0f1
master date: 2013-08-22 10:52:05 +0200

11 years agoNested VMX: Force check ISR when L2 is running
Yang Zhang [Tue, 27 Aug 2013 13:28:16 +0000 (15:28 +0200)]
Nested VMX: Force check ISR when L2 is running

External interrupt is allowed to notify CPU only when it has higher
priority than current in servicing interrupt. With APIC-v, the priority
comparing is done by hardware and hardware will inject the interrupt to
VCPU when it recognizes an interrupt. Currently, there is no virtual
APIC-v feature available for L1 to use, so when L2 is running, we still need
to compare interrupt priority with ISR in hypervisor instead via hardware.

Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
Acked-by: "Dong, Eddie" <eddie.dong@intel.com>
master commit: b35d0a26983843c092bfa353fd6b9aa8c3bf4886
master date: 2013-08-22 10:50:13 +0200

11 years agoNested VMX: Check whether interrupt is blocked by TPR
Yang Zhang [Tue, 27 Aug 2013 13:26:56 +0000 (15:26 +0200)]
Nested VMX: Check whether interrupt is blocked by TPR

If interrupt is blocked by L1's TPR, L2 should not see it and keep
running. Adding the check before L2 to retrive interrupt.

Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
Acked-by: "Dong, Eddie" <eddie.dong@intel.com>
master commit: 7fb5c6b9ef22915e3fcac95cd44857f4457ba783
master date: 2013-08-22 10:49:24 +0200

11 years agoVT-d: warn about Compatibility Format Interrupts being enabled by firmware
Jan Beulich [Tue, 27 Aug 2013 13:26:10 +0000 (15:26 +0200)]
VT-d: warn about Compatibility Format Interrupts being enabled by firmware

... as being insecure.

Also drop the second (redundant) read DMAR_GSTS_REG from enable_intremap().

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by Xiantao Zhang <xiantao.zhang@intel.com>
master commit: c9c6abab583d27fdca1d979a7f1d18ae30f54e9b
master date: 2013-08-21 16:44:58 +0200

11 years agoACPI: fix acpi_os_map_memory()
Jan Beulich [Tue, 27 Aug 2013 13:24:31 +0000 (15:24 +0200)]
ACPI: fix acpi_os_map_memory()

It using map_domain_page() was entirely wrong. Use __acpi_map_table()
instead for the time being, with locking added as the mappings it
produces get replaced with subsequent invocations. Using locking in
this way is acceptable here since the only two runtime callers are
acpi_os_{read,write}_memory(), which don't leave mappings pending upon
returning to their callers.

Also fix __acpi_map_table()'s first parameter's type - while benign for
unstable, backports to pre-4.3 trees will need this.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
ACPI: use ioremap() in acpi_os_map_memory()

This drops the post-boot use of __acpi_map_table() here again (together
with the somewhat awkward locking), in favor of using ioremap().

Signed-off-by: Jan Beulich <jbeulich@suse.com>
master commit: 2ee9cbf9d8eaeff6e21222905d22dbd58dc5fe29
master date: 2013-08-21 08:38:40 +0200
master commit: c5ba8ed4c6f005d332a49d93a3ef8ff2b690b256
master date: 2013-08-21 08:40:22 +0200

11 years agox86: correct public header's documentation of PAT MSR settings
Jan Beulich [Mon, 26 Aug 2013 10:46:54 +0000 (12:46 +0200)]
x86: correct public header's documentation of PAT MSR settings

The first (PAT6) column was wrong across the board, and the column for
PAT7 was missing altogether.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
master commit: 3829655bd3ad2b1150bd94955fc6988dec6b98f2
master date: 2013-08-23 09:23:24 +0200

11 years agoCorrect X2-APIC HVM emulation
Juergen Gross [Thu, 22 Aug 2013 09:28:28 +0000 (11:28 +0200)]
Correct X2-APIC HVM emulation

commit 6859874b61d5ddaf5289e72ed2b2157739b72ca5 ("x86/HVM: fix x2APIC
APIC_ID read emulation") introduced an error for the hvm emulation of
x2apic. Any try to write to APIC_ICR MSR will result in a GP fault.

Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
master commit: 69962e19ed432570f6cdcfdb5f6f22d6e3c54e6c
master date: 2013-08-22 11:24:00 +0200

11 years agoxen: Add stdbool.h workaround for BSD.
Tim Deegan [Tue, 20 Aug 2013 13:02:57 +0000 (15:02 +0200)]
xen: Add stdbool.h workaround for BSD.

On *BSD, stdbool.h lives in /usr/include, but we don't want to have
that on the search path in case we pick up any headers from the build
host's C libraries.

Copy the equivalent hack already in place for stdarg.h: on all
supported compilers the contents of stdbool.h are trivial, so just
supply the things we need in a xen/stdbool.h header.

Signed-off-by: Tim Deegan <tim@xen.org>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
Tested-by: Patrick Welche <prlw1@cam.ac.uk>
master commit: 7b9685ca4ed2fd723600ce66eb20a6d0c115b6cb
master date: 2013-08-15 22:00:45 +0100

11 years agox86/time: fix check for negative time in __update_vcpu_system_time()
Tim Deegan [Tue, 20 Aug 2013 13:01:47 +0000 (15:01 +0200)]
x86/time: fix check for negative time in __update_vcpu_system_time()

Clang points out that u64 stime variable is always >= 0.

Signed-off-by: Tim Deegan <tim@xen.org>
master commit: ab7f9a793c78dfea81c037b34b0dd2db7070d8f8
master date: 2013-08-15 13:17:10 +0200

11 years agox86/MTRR: fix range check in mtrr_add_page()
Jan Beulich [Tue, 20 Aug 2013 13:01:10 +0000 (15:01 +0200)]
x86/MTRR: fix range check in mtrr_add_page()

Extracted from Yinghai Lu's Linux commit d5c78673 ("x86: Fix /proc/mtrr
with base/size more than 44bits").

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
master commit: f67af6d5803b6a015e30cb490a94f9547cb0437c
master date: 2013-08-14 11:20:26 +0200

11 years agoVT-d: protect against bogus information coming from BIOS
Jan Beulich [Tue, 20 Aug 2013 13:00:13 +0000 (15:00 +0200)]
VT-d: protect against bogus information coming from BIOS

Add checks similar to those done by Linux: The DRHD address must not
be all zeros or all ones (Linux only checks for zero), and capabilities
as well as extended capabilities must not be all ones.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Ben Guthro <benjamin.guthro@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Tested-by: Ben Guthro <benjamin.guthro@citrix.com>
Acked by: Yang Zhang <yang.z.zhang@intel.com>
Acked-by: Xiantao Zhang <xiantao.zhang@intel.com>
master commit: e8e8b030ecf916fea19639f0b6a446c1c9dbe174
master date: 2013-08-14 11:18:24 +0200

11 years agoVMX: add boot parameter to enable/disable APIC-v dynamically
Yang Zhang [Tue, 20 Aug 2013 12:59:07 +0000 (14:59 +0200)]
VMX: add boot parameter to enable/disable APIC-v dynamically

Add a boot parameter to enable/disable the APIC-v dynamically. APIC-v is
enabled by default. User can use apicv=0 to disable it.

Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
master commit: 0c006b41a283a0a569c863d44abde5aa5750ae01
master date: 2013-08-13 17:47:16 +0200

11 years agox86/AMD: Inject #GP instead of #UD when unable to map vmcb
Suravee Suthikulpanit [Tue, 20 Aug 2013 12:58:12 +0000 (14:58 +0200)]
x86/AMD: Inject #GP instead of #UD when unable to map vmcb

According to AMD Programmer's Manual vol2, vmrun, vmsave and vmload
should inject #GP instead of #UD when unable to access memory
location for vmcb.  Also, the code should make sure that L1 guest
EFER.SVME is not zero.  Otherwise, #UD should be injected.

Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Reviewed-by: Tim Deegan <tim@xen.org>
master commit: 910daaf5aaa837624099c0fc5c373bea7202ff43
master date: 2013-08-13 14:24:16 +0200

11 years agox86/AMD: Fix nested svm crash due to assertion in __virt_to_maddr
Suravee Suthikulpanit [Tue, 20 Aug 2013 12:56:17 +0000 (14:56 +0200)]
x86/AMD: Fix nested svm crash due to assertion in __virt_to_maddr

Fix assertion in __virt_to_maddr when starting nested SVM guest
in debug mode. Investigation has shown that svm_vmsave/svm_vmload
make use of __pa() with invalid address.

Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Reviewed-by: Tim Deegan <tim@xen.org>
master commit: 85fc517ec3055e8e8d9c9e36e15a81e630237252
master date: 2013-08-13 14:22:14 +0200

11 years agolibelf: Fix typo in header guard macro
Patrick Welche [Tue, 20 Aug 2013 12:43:32 +0000 (14:43 +0200)]
libelf: Fix typo in header guard macro

s/__LIBELF_PRIVATE_H_/__LIBELF_PRIVATE_H__/

Signed-off-by: Patrick Welche <prlw1@cam.ac.uk>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
master commit: 0aec8823501f8ee058c1ba673d2ac3e0f3f2e8db
master date: 2013-08-08 12:47:38 +0100

11 years agoNested VMX: Flush TLBs and Caches if paging mode changed
Yang Zhang [Wed, 7 Aug 2013 14:55:37 +0000 (16:55 +0200)]
Nested VMX: Flush TLBs and Caches if paging mode changed

According to SDM, if paging mode is changed, then whole TLBs and caches will
be flushed. This is missed in nested handle logic. Also this fixed the issue
that 64 bits windows cannot boot up on top of L1 kvm.

Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
Acked-by: Keir Fraser <keir@xen.org>
master commit: e1ab5c77b44b7bd835a2c032fa4963b36545fdb3
master date: 2013-08-06 17:22:35 +0200

11 years agox86: refine FPU selector handling code for XSAVEOPT
Jan Beulich [Wed, 7 Aug 2013 14:55:05 +0000 (16:55 +0200)]
x86: refine FPU selector handling code for XSAVEOPT

Some extra tweaks are necessary to deal with the situation of XSAVEOPT
not writing the FPU portion of the save image (due to it detecting that
the register state did not get modified since the last XRSTOR).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Ben Guthro <ben.guthro@gmail.com>
Acked-by: Keir Fraser <keir@xen.org>
master commit: c58d9f2f4844c2ce8859a8d0f26a54cd058eb51f
master date: 2013-08-05 18:42:37 +0200

11 years agofix off-by-one mistakes in vm_alloc()
Jan Beulich [Wed, 7 Aug 2013 14:54:14 +0000 (16:54 +0200)]
fix off-by-one mistakes in vm_alloc()

Also add another pair of assertions to catch eventual further cases of
incorrect accounting.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
master commit: b0e55bd49725c7c0183eb18670997b9e5930adac
master date: 2013-08-05 18:40:23 +0200

11 years agox86/time: Update wallclock in shared info when altering domain time offset
Andrew Cooper [Wed, 7 Aug 2013 14:53:32 +0000 (16:53 +0200)]
x86/time: Update wallclock in shared info when altering domain time offset

domain_set_time_offset() udpates d->time_offset_seconds, but does not correct
the wallclock in the shared info, meaning that it is incorrect until the next
XENPF_settime hypercall from dom0 which resynchronises the wallclock for all
domains.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
master commit: 915a59f25c5eddd86bc2cae6389d0ed2ab87e69e
master date: 2013-07-18 09:16:15 +0200

11 years agox86: don't use destroy_xen_mappings() for vunmap()
Jan Beulich [Wed, 7 Aug 2013 14:52:34 +0000 (16:52 +0200)]
x86: don't use destroy_xen_mappings() for vunmap()

Its attempt to tear down intermediate page table levels may race with
map_pages_to_xen() establishing them, and now that
map_domain_page_global() is backed by vmap() this teardown is also
wasteful (as it's very likely to need the same address space populated
again within foreseeable time).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
master commit: 68caac7f6f4687241a24e804a9fca19aa26fe183
master date: 2013-07-17 10:21:33 +0200

11 years agox86/cpuidle: Change logging for unknown APIC IDs
Andrew Cooper [Wed, 7 Aug 2013 14:51:56 +0000 (16:51 +0200)]
x86/cpuidle: Change logging for unknown APIC IDs

Dom0 uses this hypercall to pass ACPI information to Xen.  It is not very
uncommon for more cpus to be listed in the ACPI tables than are present on the
system, particularly on systems with a common BIOS for a 2 and 4 socket server
varients.

As Dom0 does not control the number of entries in the ACPI tables, and is
required to pass everything it finds to Xen, change the logging.

There is now an single unconditional warning for the first unknown ID, and
further warnings if "cpuinfo" is requested by the user on the command line.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
master commit: 85047d9e4f4afeb73bca1e98f705a2f4f1d51c03
master date: 2013-07-17 08:45:20 +0200

11 years agoadjust x86 EFI build
Jan Beulich [Wed, 7 Aug 2013 14:49:39 +0000 (16:49 +0200)]
adjust x86 EFI build

While the rule to generate .init.o files from .o ones already correctly
included $(extra-y), the setting of the necessary compiler flag didn't
have the same. With some yet to be posted patch this resulted in build
breakage because of the compiler deciding not to inline a few functions
(which then results in .text not being empty as required for these
object files).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
master commit: 5656b93d215d7c5160790ea87758625ba1de16b1
master date: 2013-07-10 10:03:40 +0200

11 years agox86/mm: Ensure useful progress in alloc_l2_table()
Andrew Cooper [Wed, 7 Aug 2013 14:48:56 +0000 (16:48 +0200)]
x86/mm: Ensure useful progress in alloc_l2_table()

While debugging the issue which turned out to be XSA-58, a printk in this loop
showed that it was quite easy to never make useful progress, because of
consistently failing the preemption check.

One single l2 entry is a reasonable amount of work to do, even if an action is
pending, and also assures forwards progress across repeat continuations.

Tweak the continuation criteria to fail on the first iteration of the loop.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
master commit: d3a55d7d9bb518efe08143d050deff9f4ee80ec1
master date: 2013-07-04 10:33:18 +0200

11 years agoRevert "hvmloader: always include HPET table"
Jan Beulich [Mon, 15 Jul 2013 11:10:57 +0000 (13:10 +0200)]
Revert "hvmloader: always include HPET table"

This reverts commit e4fd0475a08fda414da27c4e57b568f147cfc07e.

Conflicts:
tools/firmware/hvmloader/acpi/build.c

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir.xen@gmail.com>
master commit: 4867685f7916bb594a67f2f64a28bbf5ecb4949c
master date: 2013-07-08 13:20:20 +0200

11 years agoiommu/amd: Workaround for erratum 787
Suravee Suthikulpanit [Mon, 15 Jul 2013 11:09:13 +0000 (13:09 +0200)]
iommu/amd: Workaround for erratum 787

The IOMMU interrupt handling in bottom half must clear the PPR log interrupt
and event log interrupt bits to re-enable the interrupt. This is done by
writing 1 to the memory mapped register to clear the bit. Due to hardware bug,
if the driver tries to clear this bit while the IOMMU hardware also setting
this bit, the conflict will result with the bit being set. If the interrupt
handling code does not make sure to clear this bit, subsequent changes in the
event/PPR logs will no longer generating interrupts, and would result if
buffer overflow. After clearing the bits, the driver must read back
the register to verify.

Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Adjust to apply on top of heavily modified patch 1. Adjust flow to get away
with a single readl() in each instance of the status register checks.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Tim Deegan <tim@xen.org>
Acked-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
master commit: 9eabb0735400e2b6059dfa3f0b47a426f61f570a
master date: 2013-07-02 08:50:41 +0200

11 years agoiommu/amd: Fix logic for clearing the IOMMU interrupt bits
Suravee Suthikulpanit [Mon, 15 Jul 2013 11:08:23 +0000 (13:08 +0200)]
iommu/amd: Fix logic for clearing the IOMMU interrupt bits

The IOMMU interrupt bits in the IOMMU status registers are
"read-only, and write-1-to-clear (RW1C).  Therefore, the existing
logic which reads the register, set the bit, and then writing back
the values could accidentally clear certain bits if it has been set.

The correct logic would just be writing only the value which only
set the interrupt bits, and leave the rest to zeros.

This patch also, clean up #define masks as Jan has suggested.

Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
With iommu_interrupt_handler() properly having got switched its readl()
from status to control register, the subsequent writel() needed to be
switched too (and the RW1C comment there was bogus).

Some of the cleanup went too far - undone.

Further, with iommu_interrupt_handler() now actually disabling the
interrupt sources, they also need to get re-enabled by the tasklet once
it finished processing the respective log. This also implies re-running
the tasklet so that log entries added between reading the log and re-
enabling the interrupt will get handled in a timely manner.

Finally, guest write emulation to the status register needs to be done
with the RW1C (and RO for all other bits) semantics in mind too.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Tim Deegan <tim@xen.org>
Acked-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
master commit: 2823a0c7dfc979db316787e1dd42a8845e5825c0
master date: 2013-07-02 08:49:43 +0200

11 years agox86: don't pass negative time to gtime_to_gtsc() (try 2)
Jan Beulich [Mon, 15 Jul 2013 11:07:08 +0000 (13:07 +0200)]
x86: don't pass negative time to gtime_to_gtsc() (try 2)

This mostly reverts commit eb60be3d ("x86: don't pass negative time to
gtime_to_gtsc()") and instead corrects __update_vcpu_system_time()'s
handling of this_cpu(cpu_time).stime_local_stamp dating back before the
start of a HVM guest (which would otherwise lead to a negative value
getting passed to gtime_to_gtsc(), causing scale_delta() to produce
meaningless output).

Flushing the value to zero was wrong, and printing a message for
something that can validly happen wasn't very useful either.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
master commit: 5ad914bc867c5a6a4957869c89918f4e1f9dd9c4
master date: 2013-07-02 08:48:03 +0200

11 years agoupdate Xen version to 4.3.1-pre
Jan Beulich [Mon, 15 Jul 2013 11:06:15 +0000 (13:06 +0200)]
update Xen version to 4.3.1-pre

11 years agorelease: Remove -rc from README ASCII art RELEASE-4.3.0
George Dunlap [Tue, 9 Jul 2013 10:46:56 +0000 (11:46 +0100)]
release: Remove -rc from README ASCII art

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
11 years agoupdate Xen version to 4.3.0
Jan Beulich [Mon, 8 Jul 2013 13:20:49 +0000 (15:20 +0200)]
update Xen version to 4.3.0

11 years agodocs: Pull Xen version from canonical location
Andrew Cooper [Tue, 2 Jul 2013 20:02:33 +0000 (21:02 +0100)]
docs: Pull Xen version from canonical location

rather than hard coding it and being wrong every time we branch for a release.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
(cherry picked from commit f487767ad0e58acb6c1ed3cc56daa0fb71b1f23a)

11 years agoConfig.mk: switch to debug?=n in preparation for the release
Ian Jackson [Mon, 1 Jul 2013 16:07:36 +0000 (17:07 +0100)]
Config.mk: switch to debug?=n in preparation for the release

11 years agoConfig.mk: Update QEMU_TAG and QEMU_UPSTREAM_REVISION for 4.3
Ian Jackson [Mon, 1 Jul 2013 15:51:43 +0000 (16:51 +0100)]
Config.mk: Update QEMU_TAG and QEMU_UPSTREAM_REVISION for 4.3

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
11 years agoConfig.mk: Fetch qemu trees from 4.3-testing branches
Ian Jackson [Mon, 1 Jul 2013 15:24:27 +0000 (16:24 +0100)]
Config.mk: Fetch qemu trees from 4.3-testing branches

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
11 years agolibxl: suppress device assignment to HVM guest when there is no IOMMU
Ian Jackson [Mon, 1 Jul 2013 14:20:28 +0000 (15:20 +0100)]
libxl: suppress device assignment to HVM guest when there is no IOMMU

This in effect copies similar logic from xend: While there's no way to
check whether a device is assigned to a particular guest,
XEN_DOMCTL_test_assign_device at least allows checking whether an
IOMMU is there and whether a device has been assign to _some_
guest.

For the time being, this should be enough to cover for the missing
error checking/recovery in other parts of libxl's device assignment
paths.

There remains a (functionality-, but not security-related) race in
that the iommu should be set up earlier, but this is too risky a
change for this stage of the 4.3 release.

This is a security issue, XSA-61.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agoxen/arm: Rework the way to compute dom0 DTB base address
Julien Grall [Thu, 27 Jun 2013 17:13:30 +0000 (18:13 +0100)]
xen/arm: Rework the way to compute dom0 DTB base address

If the DTB is loading right after the kernel, on some setup, Linux will
overwrite the DTB during the decompression step.

To be sure the DTB won't be overwritten by the decompression stage, load
the DTB near the end of the first memory bank and below 4Gib (if memory range is
greater).

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/arm: gic_shutdown_irq must only disable the right IRQ
Julien Grall [Fri, 28 Jun 2013 11:25:57 +0000 (12:25 +0100)]
xen/arm: gic_shutdown_irq must only disable the right IRQ

When GICD_ICENABLERn is read, all the 1s bit represent enabled IRQs.
Currently gic_shutdown_irq:
    - read GICD_ICENABLER
    - set the corresping bit to 1
    - write back the new value
That means, Xen will disable more IRQs than necessary.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agodocs: remove emtpy =item from xl.1
Olaf Hering [Thu, 27 Jun 2013 14:56:18 +0000 (16:56 +0200)]
docs: remove emtpy =item from xl.1

perl-5.18 is more strict, build fails with:
Expected text after =item, not a bullet

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/arm: Zeroed vgic ranks during the initialization
Julien Grall [Thu, 27 Jun 2013 19:58:39 +0000 (20:58 +0100)]
xen/arm: Zeroed vgic ranks during the initialization

vgic_rank contains data which inform the guest if an IRQ is
enabled/actived/pending...

The structure must be zeroed otherwise the guest can retrieve wrong GIC state.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agolibxc: xc_evtchn_open does not return -1 on error.
Vincent Bernardoff [Thu, 27 Jun 2013 12:01:53 +0000 (13:01 +0100)]
libxc: xc_evtchn_open does not return -1 on error.

Signed-off-by: Vincent Bernardoff <vincent.bernardoff@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agonested vmx: Fix the booting of L2 PAE guest
Dongxiao Xu [Thu, 27 Jun 2013 15:01:26 +0000 (17:01 +0200)]
nested vmx: Fix the booting of L2 PAE guest

When doing virtual VM entry and virtual VM exit, we need to
sychronize the PAE PDPTR related VMCS registers. With this fix,
we can boot 32bit PAE L2 guest (Win7 & RHEL6.4) on "Xen on Xen"
environment.

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
Tested-by: Yongjie Ren <yongjie.ren@intel.com>
Acked-by: Keir Fraser <keir@xen.org>
Acked-by: "Dong, Eddie" <eddie.dong@intel.com>
11 years agoAMD/intremap: Prevent use of per-device vector maps until irq logic is fixed
Andrew Cooper [Thu, 27 Jun 2013 12:01:18 +0000 (14:01 +0200)]
AMD/intremap: Prevent use of per-device vector maps until irq logic is fixed

XSA-36 changed the default vector map mode from global to per-device.  This is
because a global vector map does not prevent one PCI device from impersonating
another and launching a DoS on the system.

However, the per-device vector map logic is broken for devices with multiple
MSI-X vectors, which can either result in a failed ASSERT() or misprogramming
of a guests interrupt remapping tables.  The core problem is not trivial to
fix.

In an effort to get AMD systems back to a non-regressed state, introduce a new
type of vector map called per-device-global.  This uses per-device vector maps
in the IOMMU, but uses a single used_vector map for the core IRQ logic.

This patch is intended to be removed as soon as the per-device logic is fixed
correctly.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
11 years agogcov: Do not use mmap directly but use xc_hypercall_buffer_alloc
Frediano Ziglio [Wed, 12 Jun 2013 12:02:27 +0000 (13:02 +0100)]
gcov: Do not use mmap directly but use xc_hypercall_buffer_alloc

xencov.c did not compile on NetBSD so use xc_hypercall_buffer which is
more portable.

Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years ago4.3 release: Update README
George Dunlap [Mon, 17 Jun 2013 12:48:09 +0000 (13:48 +0100)]
4.3 release: Update README

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agopygrub: add fedora 19 grub.cfg example
Marcel J.E. Mol [Wed, 26 Jun 2013 18:29:37 +0000 (20:29 +0200)]
pygrub: add fedora 19 grub.cfg example

This grub.cfg from a default fedora 19 Beta install
caused pygrub failures.The previous pygrub commit
fixed taht. So this example file added for reference.

Signed-off-by: Marcel Mol <marcel@mesa.nl>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agopygrub/GrubConf: fix boot problem for fedora 19 grub.cfg (2nd attempt)
Marcel J.E. Mol [Mon, 24 Jun 2013 16:21:32 +0000 (18:21 +0200)]
pygrub/GrubConf: fix boot problem for fedora 19 grub.cfg (2nd attempt)

Booting a fedora 19 domU failed because a it could not properly
parse the grub.cfg file. This was cased by

set default="${next_entry}"

This statement actually is within an 'if' statement, so maybe it would
be better to skip code within if/fi blocks...
But this patch seems to work fine.

Signed-off-by: Marcel Mol <marcel@mesa.nl>
Acked-by: Ian Campbell <ian.campbell@citix.com>
Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
11 years agoXendomains was not correctly suspending domains when a STOP was issued.
Ian Murray [Sat, 22 Jun 2013 12:38:11 +0000 (13:38 +0100)]
Xendomains was not correctly suspending domains when a STOP was issued.

The regex was not selecting the { when parsing JSON output of xl list -l.
It was also not selecting (domain when parsing xl list -l when SXP selected.

Pefixed { with 4 spaces, and removed an extra ( before domain in the regex
string

Added quotes around the grep strings so the spaces inserted into the string
didn't not break the grepping.

This has now been tested against 4.3RC5

Signed-off-by: Ian Murray <murrayie@yahoo.co.uk>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
11 years agoQEMU_UPSTREAM_REVISION update 4.3.0-rc6
Ian Jackson [Thu, 27 Jun 2013 10:08:07 +0000 (11:08 +0100)]
QEMU_UPSTREAM_REVISION update

11 years agolibxl: Use QMP cpu-add to hotplug CPU with qemu-xen.
Anthony PERARD [Wed, 26 Jun 2013 15:54:31 +0000 (16:54 +0100)]
libxl: Use QMP cpu-add to hotplug CPU with qemu-xen.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agolibxl: Add "cpu-add" QMP command.
Anthony PERARD [Wed, 26 Jun 2013 15:54:30 +0000 (16:54 +0100)]
libxl: Add "cpu-add" QMP command.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
[ ijc -- rename index parameter to avoid Wshadow due to index(3) in strings.h ]

11 years agoUpdate SEABIOS_UPSTREAM_TAG
Ian Campbell [Wed, 26 Jun 2013 16:34:25 +0000 (17:34 +0100)]
Update SEABIOS_UPSTREAM_TAG

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoMerge branch 'staging' of ssh://xenbits.xen.org/home/xen/git/xen into staging
Ian Campbell [Wed, 26 Jun 2013 16:22:45 +0000 (17:22 +0100)]
Merge branch 'staging' of ssh://xenbits.xen.org/home/xen/git/xen into staging

11 years agotools/libxc: Fix memory leaks in xc_domain_save()
Andrew Cooper [Mon, 24 Jun 2013 15:47:05 +0000 (16:47 +0100)]
tools/libxc: Fix memory leaks in xc_domain_save()

Introduces outbuf_free() to mirror the currently existing outbuf_init().

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agolibxc: Fix guest boot on ARM after XSA-55
Julien Grall [Wed, 26 Jun 2013 13:23:35 +0000 (14:23 +0100)]
libxc: Fix guest boot on ARM after XSA-55

XSA-55 has exposed errors for guest creation on ARM:
    - domain virt_base was not defined;
    - xc_dom_alloc_segment allocates pfn from 0 instead of the RAM base address.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
11 years agolibxl: Fix assignment of devid value returned from libxl__device_nextid
Jim Fehlig [Tue, 25 Jun 2013 22:02:15 +0000 (16:02 -0600)]
libxl: Fix assignment of devid value returned from libxl__device_nextid

Commit 5420f265 has some misplaced parenthesis that caused devid
to be assigned 1 or 0 based on checking return value of
libxl__device_nextid < 0, e.g.

  devid = libxl__device_nextid(...) < 0

This works when only one instance of a given device type exists, but
subsequent devices of the same type will also have a devid = 1 if
libxl__device_nextid succeeds.  Fix by checking the value assigned to
devid, e.g.

  (devid = libxl__device_nextid(...)) < 0

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>