]> xenbits.xensource.com Git - xen.git/log
xen.git
11 years agons16550: make usable on ARM
Ian Campbell [Fri, 20 Sep 2013 16:18:34 +0000 (17:18 +0100)]
ns16550: make usable on ARM

There are several aspects to this:
- Correctly conditionalise use of PCI
- Correctly conditionalise use of IO ports
- Add discovery via device tree
- Support different registers shift/stride and widths
- Add vuart hooks.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Keir Frser <keir@xen.org>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Cc: PranavkumarSawargaonkar<pranavkumar@linaro.org>
11 years agoxen/arm: replace io{read,write}{l,b} with {read,write}{l,b}
Ian Campbell [Mon, 9 Sep 2013 16:45:51 +0000 (17:45 +0100)]
xen/arm: replace io{read,write}{l,b} with {read,write}{l,b}

We appear to have invented the io versions ourselves for Xen on ARM, while x86
has the plain read/write. (and so does Linux FWIW)

read/write are used in common driver code (specifically ns16550) so instead of
keeping our own variant around lets replace it with the more standard ones.

At the same time resync with Linux making the "based on" comment in both sets of
io.h somewhat true (they don't look to have been very based on before...). Our
io.h is now consistent with Linux v3.11.

Note that iowrite and write take their arguments in the opposite order.

Also make asm-arm/io.h useful and include it where necessary instead of picking
up the include from mm.h. Remove the include from mm.h

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
11 years agoxen/arm: Implement ioremap.
Ian Campbell [Fri, 20 Sep 2013 16:18:32 +0000 (17:18 +0100)]
xen/arm: Implement ioremap.

Common code uses this, it expects an uncached mapping.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Julien Grall <julien.grall@linaro.org>
11 years agoxen: arm: rework placement of fdt in initial dom0 memory map
Ian Campbell [Tue, 17 Sep 2013 15:28:12 +0000 (16:28 +0100)]
xen: arm: rework placement of fdt in initial dom0 memory map

The 32-bit Linux kernel uses its lowmem direct mapping to access the FDT. The
lowmem mapping is around 0.75GiB but varies depending on the kernel's .config.
Our current scheme of loading the FDT as high as 4GB therefore fails with
larger amounts of dom0 RAM.

The upstream documentation has recently been update to provide more guidance
<http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=7824/1>. In
accordance with this load the kernel just below 128MiB (aligned to 2MB) and
the FDT just above, or if there is less RAM available then as high as
possible.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
11 years agoxen: arm: improve VMID allocation.
Ian Campbell [Tue, 17 Sep 2013 15:56:28 +0000 (16:56 +0100)]
xen: arm: improve VMID allocation.

The VMID field is 8 bits. Rather than allowing only up to 256 VMs per host
reboot before things start "acting strange" instead maintain a simple bitmap
of used VMIDs and allocate them statically to guests upon creation.

This limits us to 256 concurrent VMs which is a reasonable improvement.
Eventually we will want a proper scheme to allocate VMIDs on context switch.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
11 years agounmodified_drivers: enable unplug per default
Olaf Hering [Fri, 20 Sep 2013 09:41:08 +0000 (11:41 +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>
11 years agognttab: remove unused shared header lookup
Matthew Daley [Fri, 20 Sep 2013 09:40:00 +0000 (11:40 +0200)]
gnttab: remove unused shared header lookup

Coverity-ID: 1056171

Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Tim Deegan <tim@xen.org>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
11 years agosched_credit: filter node-affinity mask against online cpus
Dario Faggioli [Fri, 20 Sep 2013 09:37:28 +0000 (11:37 +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>
11 years agox86_emulate: fold wide reads
Jan Beulich [Fri, 20 Sep 2013 09:05:28 +0000 (11:05 +0200)]
x86_emulate: fold wide reads

With HVM's MMIO operand handling now being capable of splitting large
reads, there's no need to issue at most machine word size reads when
we really need wider operands.

Not that this is not done everywhere - there are a couple of cases
where keeping the reads separate is more natural (and folding them
would complicate the code rather than simplifying it).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
11 years agox86_emulate: fix flag setting for 8-bit signed multiplication
Jan Beulich [Fri, 20 Sep 2013 09:04:52 +0000 (11:04 +0200)]
x86_emulate: fix flag setting for 8-bit signed multiplication

We really need to check for a signed overflow of 8 bits, while the
previous check compared the sign-extended 8-bit result with the
zero-extended 16-bit one (which was wrong for all negative results).

Once at it
- also adjust the 16-bit comparison for symmetry
- improve the 8-bit multiplication (no need to zero-extend to 32-bits
  the sign-extended to 16 bits original 8-bit value)
- fold both signed multiplication variants

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
11 years agox86_emulate: PUSH <mem> must read source operand just once
Jan Beulich [Fri, 20 Sep 2013 09:03:53 +0000 (11:03 +0200)]
x86_emulate: PUSH <mem> must read source operand just once

... for the case of accessing MMIO.

Rather than doing the early operand type adjustment for just for that
case, do it for all of the 0xF6, 0xF7, and 0xFF groups (allowing some
other code to be dropped instead).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
11 years agox86_emulate: MOVSXD must read source operand just once
Jan Beulich [Fri, 20 Sep 2013 09:03:12 +0000 (11:03 +0200)]
x86_emulate: MOVSXD must read source operand just once

... for the case of accessing MMIO.

Also streamline the ARPL emulation a little, and add tests for both
instructions (the MOVSXD one requires a few other adjustments, as we
now need to run in a mode where the emulator's mode_64bit() returns
true).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
11 years agox86: fix dependencies of emulator test
Jan Beulich [Fri, 20 Sep 2013 09:02:47 +0000 (11:02 +0200)]
x86: fix dependencies of emulator test

Rather than mentioning the (linked) directory, mention the files thus
making sure things get rebuild as needed when the core emulator files
change.

Also enable debug info generation unconditionally, as this is testing
stuff only anyway.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
11 years agox86/HVM: properly handle MMIO reads and writes wider than a machine word
Jan Beulich [Fri, 20 Sep 2013 09:01:08 +0000 (11:01 +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>
11 years agotools: print xm deprecation warning to stderr
Ian Campbell [Wed, 18 Sep 2013 20:27:19 +0000 (21:27 +0100)]
tools: print xm deprecation warning to stderr

To avoid confusing anything which is parsing the output.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
11 years agox86: mark BUG()s and assertion failures as terminal.
Tim Deegan [Thu, 19 Sep 2013 14:38:09 +0000 (15:38 +0100)]
x86: mark BUG()s and assertion failures as terminal.

This helps avoid static analysis false-positives, and might lead to
better code density as the compiler knows it doesn't have to restore
spilled state &c.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Keir Fraser <keir@xen.org>
11 years agoVMX: fix failure path in construct_vmcs
George Dunlap [Wed, 18 Sep 2013 12:45:42 +0000 (14:45 +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>
11 years agox86/HVM: fix failure path in hvm_vcpu_initialise
George Dunlap [Wed, 18 Sep 2013 12:45:24 +0000 (14:45 +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>
11 years agotools: disable xend build by default
Ian Campbell [Thu, 12 Sep 2013 10:34:12 +0000 (11:34 +0100)]
tools: disable xend build by default

Add big warnings to configure, xend initscript and xm.

The big xm warning is displayed once (per boot, or per tmpreaper clean),
afterwards a single line warning is displayed.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agodocs: fix documentation index for hypercalls
Ian Campbell [Wed, 11 Sep 2013 09:48:19 +0000 (10:48 +0100)]
docs: fix documentation index for hypercalls

This was broken by 118104e5eaf2 "docs: Build docs for ARM as well as x86_64".

Move docs to hypercall/ARCH instead of hypercall-ARCH.

Support mulitple levels of subdirectories in gen-html-index tool.

This removes the need for a symlink hypercall->hypercall-x86_64 since there is
now a proper index at hypercall/index.html.

Update INDEX to human readable names for the architecture specific hypercalls.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
11 years agopassthrough/amd: Shuffle declaration.
Tim Deegan [Thu, 12 Sep 2013 11:05:18 +0000 (12:05 +0100)]
passthrough/amd: Shuffle declaration.

Coverity's parser chokes on seeing __section() before the type.

Coverity CID 1087190

Signed-off-by: Tim Deegan <tim@xen.org>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
11 years agopassthrough/amd: Missing 'break'
Tim Deegan [Thu, 12 Sep 2013 10:57:01 +0000 (11:57 +0100)]
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>
11 years agopassthrough/amd: Drop unnecessary lock lookup.
Tim Deegan [Thu, 12 Sep 2013 10:45:13 +0000 (11:45 +0100)]
passthrough/amd: Drop unnecessary lock lookup.

The lock's not used for anything, and AFAICT no locking is needed
since the IVRS tables are static after boot.

Coverity CID 1087199

Signed-off-by: Tim Deegan <tim@xen.org>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
11 years agoARM: parse separate DT properties for different commandlines
Andre Przywara [Fri, 13 Sep 2013 12:49:34 +0000 (13:49 +0100)]
ARM: parse separate DT properties for different commandlines

Currently we use the chosen/bootargs property as the Xen commandline
and rely on xen,dom0-bootargs for Dom0. However this brings issues
with bootloaders, which usually build bootargs by bootscripts for a
Linux kernel - and not for the entirely different Xen hypervisor.

Introduce a new possible device tree property "xen,xen-bootargs"
explicitly for the Xen hypervisor and make the selection of which to
use more fine grained:
- If xen,xen-bootargs is present, it will be used for Xen.
- If xen,dom0-bootargs is present, it will be used for Dom0.
- If xen,xen-bootargs is _not_ present, but xen,dom0-bootargs is,
  bootargs will be used for Xen. Like the current situation.
- If no Xen specific properties are present, bootargs is for Dom0.
- If xen,xen-bootargs is present, but xen,dom0-bootargs is missing,
  bootargs will be used for Dom0.

The aim is to allow common bootscripts to boot both Xen and native
Linux with the same device tree blob. If needed, one could hard-code
the Xen commandline into the DTB, leaving bootargs for Dom0 to be set
by the (non Xen-aware) bootloader.

I will send out a appropriate u-boot patch, which writes the content
of the "xen_bootargs" environment variable into the xen,xen-bootargs
dtb property.

Signed-off-by: Andre Przywara <andre.przywara@linaro.org>
Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/arm: Check if the device is available before using it
Julien Grall [Fri, 13 Sep 2013 12:49:33 +0000 (13:49 +0100)]
xen/arm: Check if the device is available before using it

It's possible to have a device description in the DTS but the device is not
wired.

device_init must check if the device is available before doing anything with
it.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/dts: replace get_val by dt_next_cell
Julien Grall [Fri, 13 Sep 2013 12:49:32 +0000 (13:49 +0100)]
xen/dts: replace get_val by dt_next_cell

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/dts: device_get_reg: cells are 32-bit big endian value
Julien Grall [Fri, 13 Sep 2013 12:49:31 +0000 (13:49 +0100)]
xen/dts: device_get_reg: cells are 32-bit big endian value

Device tree cells are 32-bit big endian value. Use __be32 to avoid confusion
later.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/dts: Clean up the exported API for device tree
Julien Grall [Fri, 13 Sep 2013 12:49:30 +0000 (13:49 +0100)]
xen/dts: Clean up the exported API for device tree

All Xen code has been converted to the new device tree API that uses a tree
structure to describe the DTS.

The Flat Device tree is still used by Xen during early boot stage, but only in
internal. Remove entirely unneeded functions or move to a static function.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/arm: exynos5: Blacklist MCT device
Julien Grall [Fri, 13 Sep 2013 12:49:29 +0000 (13:49 +0100)]
xen/arm: exynos5: Blacklist MCT device

The Multi Core Timer (MCT) is a Samsung specific device.
This device tries to route IRQ in non-boot CPU which is not yet handled by Xen.

The user will see randomly dom0 hang, but I'm not sure that is the real reason.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/arm: vexpress: Blacklist a list of board specific devices
Julien Grall [Fri, 13 Sep 2013 12:49:28 +0000 (13:49 +0100)]
xen/arm: vexpress: Blacklist a list of board specific devices

On Versatile there are a bunch of devices which must not be pass-through to any
guest (power management and cache coherency devices).

This commit also blacklists the HDLCD device because Xen is unable to correctly
map the framebuffer into dom0. Therefore, when Linux will try to access to the
framebuffer, Xen will receive a non-handled data access.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/arm: Remove devices used by Xen from dom0 device tree
Julien Grall [Fri, 13 Sep 2013 12:49:27 +0000 (13:49 +0100)]
xen/arm: Remove devices used by Xen from dom0 device tree

Devices used by Xen should not be pass-through to dom0. If the device is really
usefull for dom0 (for instance the timer and the GIC), it will recreate the
node.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/arm: Add new platform specific callback device_is_blacklist
Julien Grall [Fri, 13 Sep 2013 12:49:26 +0000 (13:49 +0100)]
xen/arm: Add new platform specific callback device_is_blacklist

Each platform code will list the device that must not pass-through to a guest.
Theses devices are used for: power management, timer,...

When theses devices are given to DOM0, it can controls the hardware and then
break the whole platform.

This callback is enough until we will start to care about power performance.
For this purpose, we may need to extend this interface to implement per-device
MMIO filtering to allow dom0 to continue to control devices which it owns which
happen to share e.g. a clock controller with Xen.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/arm: Create a fake timer node in dom0 device tree
Julien Grall [Fri, 13 Sep 2013 12:49:25 +0000 (13:49 +0100)]
xen/arm: Create a fake timer node in dom0 device tree

Recreate the timer node and remove hypervisor specific interrupt.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/arm: Create a fake GIC node in dom0 device tree
Julien Grall [Fri, 13 Sep 2013 12:49:24 +0000 (13:49 +0100)]
xen/arm: Create a fake GIC node in dom0 device tree

Recreate the GIC node and remove hypervisor specific ranges (vgic and hypervisor
controls).

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/arm: Create a fake cpus node in dom0 device tree
Julien Grall [Fri, 13 Sep 2013 12:49:23 +0000 (13:49 +0100)]
xen/arm: Create a fake cpus node in dom0 device tree

The number of cpus in dom0 can be different compare to the real number of
physical cpus.

For the moment, Xen assumes that the cpus are identical.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/arm: Create a fake PSCI node in dom0 device tree
Julien Grall [Fri, 13 Sep 2013 12:49:22 +0000 (13:49 +0100)]
xen/arm: Create a fake PSCI node in dom0 device tree

Xen uses PSCI to bring up secondary cpus for the guest.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/arm: Don't map disabled device in DOM0
Julien Grall [Fri, 13 Sep 2013 12:49:21 +0000 (13:49 +0100)]
xen/arm: Don't map disabled device in DOM0

Linux should cope with 'status = "disabled"' in the Device Tree.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/arm: Build DOM0 FDT by browsing the device tree structure
Julien Grall [Fri, 13 Sep 2013 12:49:20 +0000 (13:49 +0100)]
xen/arm: Build DOM0 FDT by browsing the device tree structure

Remove the usage of the FDT in benefit of the device tree structure.
The latter is easier to use and can embedded meta-data for Xen (ie: is the
device is used by Xen...).

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/dts: dt_find_interrupt_controller: accept multiple compatible strings
Julien Grall [Fri, 13 Sep 2013 12:49:19 +0000 (13:49 +0100)]
xen/dts: dt_find_interrupt_controller: accept multiple compatible strings

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/arm: Use dt_device_match to avoid multiple if conditions
Julien Grall [Fri, 13 Sep 2013 12:49:18 +0000 (13:49 +0100)]
xen/arm: Use dt_device_match to avoid multiple if conditions

There is some place in Xen ARM code where multiple if conditions is used
check the presence of a node or find a node.
These pieces of code can be replace by an array and using proper device tree
helpers.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/video: hdlcd: Use early_printk instead of printk
Julien Grall [Fri, 13 Sep 2013 12:49:17 +0000 (13:49 +0100)]
xen/video: hdlcd: Use early_printk instead of printk

The video driver is initialized before the console is correctly set up.
Therefore, printk will never output if there is no serial configured.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/video: hdlcd: Convert the driver to the new device tree API
Julien Grall [Fri, 13 Sep 2013 12:49:16 +0000 (13:49 +0100)]
xen/video: hdlcd: Convert the driver to the new device tree API

Avoid to use FDT API which will be removed soon

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian campbell <ian.campbell@citrix.com>
11 years agoxen/dts: Check the CPU ID is not greater than NR_CPUS
Julien Grall [Fri, 13 Sep 2013 12:49:15 +0000 (13:49 +0100)]
xen/dts: Check the CPU ID is not greater than NR_CPUS

On some board CPU IDs are not contiguous (for instance the Versatile Express
with big.LITTLE supports). If the CPU ID is greater than NR_CPUS Xen will hang
without any message. This is because console driver is not yet initialized and
hypervisor data abort uses printk.

For the moment check the CPU ID and print an warning if an error occured.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/dts: Check "reg" property length in process_multiboot_node
Julien Grall [Fri, 13 Sep 2013 12:49:14 +0000 (13:49 +0100)]
xen/dts: Check "reg" property length in process_multiboot_node

The device tree compiler (dtc) will only warn if the "reg" property doesn't
match #address-cells and #size-cells size. It won't update the different
property. Therefore, Xen needs to check if the size match both properties,
otherwise Xen can retrieve a wrong range.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/dts: Remove device_get_reg call in process_cpu_node
Julien Grall [Fri, 13 Sep 2013 12:49:13 +0000 (13:49 +0100)]
xen/dts: Remove device_get_reg call in process_cpu_node

The "reg" property is only composed of one uint32. device_get_reg can be
replaced by dt_read_number.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen: Use the right string comparison function in device tree
Julien Grall [Fri, 13 Sep 2013 12:49:12 +0000 (13:49 +0100)]
xen: Use the right string comparison function in device tree

When of_node_cmp and of_compat_cmp was introduced in commit fb97eb6
"xen/arm: Create a hierarchical device tree", they were copied from the wrong
Linux header.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/dts: Add new helpers to use the device tree
Julien Grall [Fri, 13 Sep 2013 12:49:11 +0000 (13:49 +0100)]
xen/dts: Add new helpers to use the device tree

List of new helpers taken from linux (commit 74b9272):
    - dt_property_read_string
    - dt_match_node
    - dt_find_maching_node
    - dt_device_is_available
    - dt_prop_cmp

Other new helpers:
    - dt_set_cell
    - dt_for_each_child
    - dt_set_range
    - dt_cells_to_size
    - dt_next_cell
    - dt_get_range
    - dt_node_name_is_equal
    - dt_node_path_is_equal
    - dt_property_name_is_equal

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/dts: Don't add a fake property "name" in the device tree
Julien Grall [Fri, 13 Sep 2013 12:49:10 +0000 (13:49 +0100)]
xen/dts: Don't add a fake property "name" in the device tree

On new Flat Device Tree version, the property "name" may not exist.
The property is never used in Xen code except to set the field "name" of
dt_device_node.

For convenience, remove the fake property. It will save space during the
creation of the dom0 FDT.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/dts: Prefix device tree macro by dt_
Julien Grall [Fri, 13 Sep 2013 12:49:09 +0000 (13:49 +0100)]
xen/dts: Prefix device tree macro by dt_

There is 2 macros: for_each_device_node and for_each_property_of_node
with a too generic name.

Also replace all call-site with the new function names.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/dts: Constify device_tree_flattened
Julien Grall [Fri, 13 Sep 2013 12:49:08 +0000 (13:49 +0100)]
xen/dts: Constify device_tree_flattened

The Flat Device Tree is given by the bootloader. Xen doesn't need to modify it.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agotools/hotplug: set mtu from bridge for tap interface
Charles Arnold [Mon, 16 Sep 2013 20:18:37 +0000 (14:18 -0600)]
tools/hotplug: set mtu from bridge for tap interface

With changeset 22885 support was added for setting the MTU in the vif-bridge
script for when a vif interface was set to 'online'.  The was not done for the
'add' operation.  The 'add' operation was added to the script for when tap
devices were specified (c/s 21944). With the setting of the MTU for the
'online' case was there a reason for omitting the 'add'?

This patch sets the MTU for both 'online' and 'add' in the vif-bridge script.

Signed-off-by: Charles Arnold <carnold@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agolibxl: Use LOG_ERRNO rather than ERRNOVAL in libxl_pci.c
George Dunlap [Mon, 16 Sep 2013 13:23:09 +0000 (14:23 +0100)]
libxl: Use LOG_ERRNO rather than ERRNOVAL in libxl_pci.c

The xc_* functions (now) return -1 on error and set errno.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
CC: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agoRevert "libxl, hotplug/Linux: default to phy backend for raw format file"
Ian Campbell [Mon, 16 Sep 2013 13:29:47 +0000 (14:29 +0100)]
Revert "libxl, hotplug/Linux: default to phy backend for raw format file"

This reverts commit 11a63a1660453269ddd1893c15d0a98133b33ca7. The change causes
issues with live migration.

11 years agoadd ARINC653 scheduler maintainers
Nathan Studer [Mon, 16 Sep 2013 11:12:14 +0000 (13:12 +0200)]
add ARINC653 scheduler maintainers

Previously the ARINC653 scheduler was indirectly maintained by
Kathy Hadley and Josh Holtrop being cc'd on changes by George
Dunlap.  Maintenance is currently being done by Robert VanVossen
and myself.  To avoid potential communication problems in the
future, make Robbie and I the official maintainers.

Signed-off-by: Nathan Studer <nate.studer@dornerworks.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agoAMD-Vi: also match IVRS overrides on device ID
Jan Beulich [Mon, 16 Sep 2013 10:24:19 +0000 (12:24 +0200)]
AMD-Vi: also match IVRS overrides on device ID

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
11 years agoAMD-Vi: Fix IVRS HPET special->handle override
Suravee Suthikulpanit [Mon, 16 Sep 2013 10:23:50 +0000 (12:23 +0200)]
AMD-Vi: Fix IVRS HPET special->handle override

Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
11 years agohvm/vpmu: Prevent dump handlers from incorrectly mutating state
Andrew Cooper [Mon, 16 Sep 2013 10:22:20 +0000 (12:22 +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>
11 years agoxen-mfndump: Use inttypes.h to format uint64_t types.
Ian Campbell [Sat, 14 Sep 2013 07:38:26 +0000 (08:38 +0100)]
xen-mfndump: Use inttypes.h to format uint64_t types.

Fixes 32-bit build:

cc1: warnings being treated as errors
xen-mfndump.c: In function 'dump_ptes_func':
xen-mfndump.c:236: error: format '%lx' expects type 'long unsigned int', but argument 3 has type 'uint64_t'
xen-mfndump.c: In function 'lookup_pte_func':
xen-mfndump.c:305: error: format '%lx' expects type 'long unsigned int', but argument 5 has type 'uint64_t'

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
11 years ago.gitignore: add tools/misc/xen-hptool
Dario Faggioli [Fri, 13 Sep 2013 13:11:37 +0000 (14:11 +0100)]
.gitignore: add tools/misc/xen-hptool

as ae763e4224304 ("tools/misc: introduce xen-mfndump") forgot to do so.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
11 years agosched/credit: Remove redundant assignments from alloc_* functions
Andrew Cooper [Fri, 13 Sep 2013 12:30:02 +0000 (14:30 +0200)]
sched/credit: Remove redundant assignments from alloc_* functions

Noticed because Coverity was complaining at the atomic_set(), but because of
the use of xzalloc(), these assignments of 0 are completely redundent.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
11 years agoMerge.
Jan Beulich [Fri, 13 Sep 2013 12:28:46 +0000 (14:28 +0200)]
Merge.

11 years agox86: machine_restart() must not call acpi_dmar_reinstate() twice
Jan Beulich [Fri, 13 Sep 2013 12:27:34 +0000 (14:27 +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>
11 years agotools/tests: tweak .gitignore
Andrew Cooper [Tue, 10 Sep 2013 13:53:50 +0000 (14:53 +0100)]
tools/tests: tweak .gitignore

c/s e7803f184a moved x86_emulate and friends into their own subdirectory.

c/s cc8ad39c1f introduced xen-access, but seemingly without an ingore.

For both of the above add/adjust the ingore rules for generated files.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
11 years agolibxl: Spice vdagent support for upstream qemu
Fabio Fantoni [Tue, 10 Sep 2013 14:46:13 +0000 (16:46 +0200)]
libxl: Spice vdagent support for upstream qemu

Usage:
- spicevdagent=1|0 (default=0)
Enables spice vdagent. The Spice vdagent is an optional component for
enhancing user experience and performing guest-oriented management
tasks. Its features includes: client mouse mode (no need to grab mouse
by client, no mouse lag), automatic adjustment of screen resolution,
copy and paste (text and image) between client and domU. It also
requires vdagent service installed on domU o.s. to work.

- spice_clipboard_sharing=1|0 (default=0)
Enables Spice clipboard sharing (copy/paste). It requires spicevdagent
enabled.

Signed-off-by: Fabio Fantoni <fabio.fantoni@m2r.biz>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxenstored: fix possible, but unlikely, stack overflow
Matthew Daley [Tue, 10 Sep 2013 14:34:22 +0000 (02:34 +1200)]
xenstored: fix possible, but unlikely, stack overflow

...when reading xenbus port from xenfs.

Coverity-ID: 1055741
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agokdd: fix free of array-typed value
Matthew Daley [Tue, 10 Sep 2013 14:34:21 +0000 (02:34 +1200)]
kdd: fix free of array-typed value

g->id is an array and is allocated as part of g itself; it's not a
separate allocation.

Coverity-ID: 1054980
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Tim Deegan <tim@xen.org>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
11 years agomini-os: handle possibly overlong _nodename in init_consfront
Matthew Daley [Tue, 10 Sep 2013 14:34:20 +0000 (02:34 +1200)]
mini-os: handle possibly overlong _nodename in init_consfront

The only current user that passes a non-NULL _nodename limits it to 64
bytes anyway.

Coverity-ID: 1054993
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
11 years agomini-os: fix use-after-free in xs_daemon_close event iteration
Matthew Daley [Tue, 10 Sep 2013 14:34:19 +0000 (02:34 +1200)]
mini-os: fix use-after-free in xs_daemon_close event iteration

We need to get the next pointer before the freeing of the event.

Coverity-ID: 1056173
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-By: Samuel Thibault <samuel.thibault@ens-lyon.org>
11 years agolibxl: correctly handle readlink() errors
Matthew Daley [Tue, 10 Sep 2013 14:34:18 +0000 (02:34 +1200)]
libxl: correctly handle readlink() errors

readlink() returns a ssize_t with a negative value on failure.

Coverity-ID: 1055566
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agolibxl: fix use-after-free in discard_events iteration
Matthew Daley [Tue, 10 Sep 2013 14:34:17 +0000 (02:34 +1200)]
libxl: fix use-after-free in discard_events iteration

We need to use the foreach variant which gets the next pointer before
the loop body is executed.

Coverity-ID: 1056193
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agolibxl: fix libxl__device_disk_from_xs_be to parse backend domid
Roger Pau Monne [Fri, 6 Sep 2013 10:36:26 +0000 (12:36 +0200)]
libxl: fix libxl__device_disk_from_xs_be to parse backend domid

libxl__device_disk_from_xs_be was ignoring the backend domid, setting
it to 0 by default. Fix this by parsing the backend disk path in order
to fetch the backend domid.

This fixes the issue reported when trying to block-detach disks that
have it's backend on a driver domain.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reported-by: G.R. <firemeteor@users.sourceforge.net>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxenstat: Fix buffer over-run with new_domains being negative.
Konrad Rzeszutek Wilk [Tue, 10 Sep 2013 15:08:30 +0000 (11:08 -0400)]
xenstat: Fix buffer over-run with new_domains being negative.

Coverity identified this as:
CID 1055740 Out-of-bounds read - "In xenstat_get_node:
Out-of-bounds read from a buffer (CWE-125)"

And sure enough, if xc_domain_getinfolist returns us -1, we will
try to use it later on in the for (i = 0; i < new_domains; ..)
loop.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
11 years agotools/misc: introduce xen-mfndump.
Dario Faggioli [Tue, 10 Sep 2013 17:54:20 +0000 (19:54 +0200)]
tools/misc: introduce xen-mfndump.

A little development and debugging tool, useful when looking
for information about MFN to PFN mappings, MFN/PFN mappings
in a guest's PTEs, etc.

This is what it can do as of now:

$ /usr/sbin/xen-mfndump
Usage: xen-mfndump <command> [args]
Commands:
  help                      show this help
  dump-m2p                  show M2P
  dump-p2m    <domid>       show P2M of <domid>
  dump-ptes   <domid> <mfn> show the PTEs in <mfn>
  lookup-pte  <domid> <mfn> find the PTE mapping <mfn>
  memcmp-mfns <domid1> <mfn1> <domid2> <mfn2>
                            (str)compare content of <mfn1> & <mfn2>

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agolibxc: introduce xc_map_domain_meminfo (and xc_unmap_domain_meminfo)
Dario Faggioli [Tue, 10 Sep 2013 17:54:12 +0000 (19:54 +0200)]
libxc: introduce xc_map_domain_meminfo (and xc_unmap_domain_meminfo)

And use it in xc_exchange_page(). This is basically because the
following change need something really similar to the set of
steps that are here abstracted in these two functions.

Despite of the change in the interface and in the signature of
some functions, this is pure code motion. No functional changes
involved.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agolibxc: allow for ctxt to be NULL in xc_vcpu_setcontext
Dario Faggioli [Tue, 10 Sep 2013 17:54:05 +0000 (19:54 +0200)]
libxc: allow for ctxt to be NULL in xc_vcpu_setcontext

Since, as can be seen in xen/common/domctl.c, that is legitimate
(it results in Xen calling vcpu_reset() on the vcpu).

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agolibxc: use xc_vcpu_getinfo() instead of calling do_domctl()
Dario Faggioli [Tue, 10 Sep 2013 17:53:57 +0000 (19:53 +0200)]
libxc: use xc_vcpu_getinfo() instead of calling do_domctl()

The wrapper is there already, so better use it in place of
all the stuff required to issue a call to do_domctl() for
XEN_DOMCTL_getdomaininfo.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agolibxc: use xc_vcpu_setcontext() instead of calling do_domctl()
Dario Faggioli [Tue, 10 Sep 2013 17:53:48 +0000 (19:53 +0200)]
libxc: use xc_vcpu_setcontext() instead of calling do_domctl()

The wrapper is there already, so better use it in place of
all the stuff required to issue a call to do_domctl() for
XEN_DOMCTL_setvcpucontext.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agolibxc: introduce xc_domain_get_guest_width()
Dario Faggioli [Tue, 10 Sep 2013 17:53:40 +0000 (19:53 +0200)]
libxc: introduce xc_domain_get_guest_width()

As a wrapper to XEN_DOMCTL_get_address_size, and use it
wherever the call was being issued directly via do_domctl(),
saving quite some line of code.

Actually, the function returns the guest width in bytes,
rather than directly what XEN_DOMCTL_get_address_size provides
(which is a number of bits), since that is what it is useful
almost everywhere.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen: arm: describe Xen boot protocol requirements
Ian Campbell [Fri, 30 Aug 2013 10:52:22 +0000 (11:52 +0100)]
xen: arm: describe Xen boot protocol requirements

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxl: fix `xl cpupool-list' behavior in case no pool name is provided
Dario Faggioli [Wed, 11 Sep 2013 11:06:22 +0000 (13:06 +0200)]
xl: fix `xl cpupool-list' behavior in case no pool name is provided

since it errors out, asking for at least one argument, and does
not display any useful output, which is wrong (we want the list
and the info about all the existing cpupools).

IOW, the output is as follows:

 ~# xl cpupool-list -c
 'xl cpupool-list' requires at least 1 argument.
 ...

While it should be as follows:

 ~# xl cpupool-list -c
 Name               CPU list
 Pool-0             0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
11 years agolibxl, hotplug/Linux: default to phy backend for raw format file
Wei Liu [Thu, 5 Sep 2013 14:11:31 +0000 (15:11 +0100)]
libxl, hotplug/Linux: default to phy backend for raw format file

Modify libxl to allow raw format file to use phy backend.

For the hotplug script part, learn from NetBSD's block hotplug script --
test the path and determine the actual type of file (block device or
regular file) then use the actual type to determine which branch to run.

With these changes, plus the current ordering of backend preference
(phy > qdisk > tap), we will use phy backend for raw format file by
default.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agoacpi/pmstat: fix check for empty name strings.
Tim Deegan [Thu, 12 Sep 2013 12:09:35 +0000 (13:09 +0100)]
acpi/pmstat: fix check for empty name strings.

These 'name' strings are actually arrays in their structs.  So the
address is never NULL: instead, we should check the first character to
detect cases where the field wasn't initialized.

Coverity CID 1055633

Signed-off-by: Tim Deegan <tim@xen.org>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
11 years agoehci-dbgp: avoid division by zero.
Tim Deegan [Thu, 12 Sep 2013 11:55:10 +0000 (12:55 +0100)]
ehci-dbgp: avoid division by zero.

Unlikely to ever see hardware reporting 0 ports, but might as well
fail gracefully if we do.

Coverity CID 1055266

Signed-off-by: Tim Deegan <tim@xen.org>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
11 years agoehci-dbgp: drop dead code.
Tim Deegan [Thu, 12 Sep 2013 11:58:11 +0000 (12:58 +0100)]
ehci-dbgp: drop dead code.

We can only reach this spot by breaking out of the scan loop,
so by construction ret > 0.

Coverity CID 1055259

Signed-off-by: Tim Deegan <tim@xen.org>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
11 years agocpufreq: missing check of copy_from_guest()
Tim Deegan [Thu, 12 Sep 2013 11:36:04 +0000 (12:36 +0100)]
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>
11 years agocpufreq: avoid integer overflows.
Tim Deegan [Thu, 12 Sep 2013 11:29:21 +0000 (12:29 +0100)]
cpufreq: avoid integer overflows.

The def_sampling_rate() one is, I think, a real bug.  The others were
spotted at the same time and are probably not bugs until we start
dealing with 40GHz CPus.

Coverity CID 1055682
Coverity CID 1055683

Signed-off-by: Tim Deegan <tim@xen.org>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
11 years agox86/mm: Don't dereference p2m pointer before NULL check.
Tim Deegan [Thu, 12 Sep 2013 08:56:12 +0000 (09:56 +0100)]
x86/mm: Don't dereference p2m pointer before NULL check.

Not a security bug, because in fact this is never called with a NULL
argument.

Coverity CID 1055955

Signed-off-by: Tim Deegan <tim@xen.org>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
11 years agolibxc/x86: fix page table creation for huge guests
Jan Beulich [Thu, 12 Sep 2013 15:41:04 +0000 (17:41 +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>
11 years agox86: fix memory cut-off when using PFN compression
Jan Beulich [Thu, 12 Sep 2013 07:52:53 +0000 (09:52 +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>
11 years agosched/arinc653: check for guest data transfer failures
Matthew Daley [Tue, 10 Sep 2013 15:16:02 +0000 (17:16 +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>
11 years agox86: add missing va_end to hypercall_xlat_continuation
Matthew Daley [Tue, 10 Sep 2013 15:15:35 +0000 (17:15 +0200)]
x86: add missing va_end to hypercall_xlat_continuation

Coverity-ID: 1056208
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
11 years agox86/mm: Fix possible increment of uninitialised variable
Andrew Cooper [Mon, 9 Sep 2013 17:43:40 +0000 (18:43 +0100)]
x86/mm: Fix possible increment of uninitialised variable

Discovered by Coverity, CID 1056101

When taking the continue branch on the first iteration of the loop,
gfn would indeed be uninitialised when incremented.  However, as gfn
is unconditionally constructed from i{1..4} before use in the loop
body, having it incremented in the loop header is useless.

Therefore, simply remove it.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Tim Deegan <tim@xen.org>
11 years agoNested VMX: Clear bit 31 of IA32_VMX_BASIC MSR
Yang Zhang [Tue, 10 Sep 2013 14:41:35 +0000 (16:41 +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>
11 years agox86/ioapic: avoid trying to access the -1th ioapic
Andrew Cooper [Tue, 10 Sep 2013 14:40:34 +0000 (16:40 +0200)]
x86/ioapic: avoid trying to access the -1th ioapic

Discovered by Coverity, CID 1055743

Depending on the contents of the mp_irqs/mp_ioapics from the MP table,
find_isa_irq_apic() might return -1, at which point calling
ioapic_read_entry() with it is bad.

In addition to bailing if pin is -1, bail if apic is -1.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
11 years agoconsole: buffer and show origin of guest PV writes
Daniel De Graaf [Tue, 10 Sep 2013 14:39:46 +0000 (16:39 +0200)]
console: buffer and show origin of guest PV writes

Guests other than domain 0 using the console output have previously been
controlled by the VERBOSE #define, but with no designation of which
guest's output was on the console. This patch converts the HVM output
buffering to be used by all domains except the hardware domain (dom0):
stripping non-printable characters, line buffering the output, and
prefixing it with the domain ID. This is especially useful for debugging
stub domains during early boot.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Keir Fraser <keir@xen.org>
11 years agolibelf: add hvm callback vector feature
Mukesh Rathor [Tue, 10 Sep 2013 14:38:43 +0000 (16:38 +0200)]
libelf: add hvm callback vector feature

Add XENFEAT_hvm_callback_vector to elf_xen_feature_names so we can
ensure the kernel supports all features required for PVH mode when
building a PVH domU here. Note, hvm callback is required for PVH.

Signed-off-by: Mukesh Rathor <mukesh.rathor@oracle.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agolibxl: ocaml: fix code intended to output comments before definitions
Rob Hoes [Thu, 22 Aug 2013 10:50:53 +0000 (11:50 +0100)]
libxl: ocaml: fix code intended to output comments before definitions

I'm not sure how useful these comments actually are but erred on the
side of fixing rather than removing.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agolibxl: idl: complete some enums in the IDL with their defaults
Rob Hoes [Thu, 22 Aug 2013 10:50:52 +0000 (11:50 +0100)]
libxl: idl: complete some enums in the IDL with their defaults

There are several enums in the IDL that are initialised to 0, while
the value 0 is not part of the enum itself. This creates problems for
language bindings generated from the IDL, such as the OCaml ones.

Added an explicit (0, "UNKNOWN") enum value where appropriate, or used
init_val to default to a sensible value.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agolibxl: idl: add domain_type field to libxl_dominfo struct
Rob Hoes [Thu, 22 Aug 2013 10:50:51 +0000 (11:50 +0100)]
libxl: idl: add domain_type field to libxl_dominfo struct

This allows a toolstack to find out whether a VM has booted as PV or HVM.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agolibxl: Add LIBXL_SHUTDOWN_REASON_UNKNOWN
Rob Hoes [Thu, 22 Aug 2013 10:50:49 +0000 (11:50 +0100)]
libxl: Add LIBXL_SHUTDOWN_REASON_UNKNOWN

libxl_dominfo.shutdown_reason is valid iff (shutdown||dying). This is a bit
annoying when generating language bindings since it needs all sorts of special
casing. Just introduce an explicit value instead.

Signed-off-by: Ian Campbell <ian.cambell@citrix.com>
Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>