Commit Graph
27574 Commits
Author SHA1 Message Date
Julien Grall e76acef363 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>
2013-09-17 15:29:12 +01:00
Julien Grall bc3cac5c78 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>
2013-09-17 15:29:10 +01:00
Julien Grall 64e2efcad8 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>
2013-09-17 15:29:08 +01:00
Julien Grall c04b69e769 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>
2013-09-17 15:29:03 +01:00
Julien Grall cb869df938 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>
2013-09-17 15:28:57 +01:00
Julien Grall 7cb187fa95 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>
2013-09-17 15:28:55 +01:00
Julien Grall 5b73b82d2f 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>
2013-09-17 15:28:51 +01:00
Julien Grall 42d85eed43 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>
2013-09-17 15:28:45 +01:00
Julien Grall fafd682c3e 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>
2013-09-17 15:28:41 +01:00
Julien Grall de6ba7028a 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>
2013-09-17 15:28:37 +01:00
Julien Grall ab26c1db44 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>
2013-09-17 15:28:33 +01:00
Julien Grall b8f1c5e703 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>
2013-09-17 15:28:28 +01:00
Julien Grall e60d11198f 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>
2013-09-17 15:28:23 +01:00
Julien Grall d90abf9aa6 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>
2013-09-17 15:28:18 +01:00
Julien Grall 34743911e7 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>
2013-09-17 15:28:13 +01:00
Julien Grall 2004c038ea 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>
2013-09-17 15:28:11 +01:00
Julien Grall 7a35c108b3 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>
2013-09-17 15:28:08 +01:00
Julien Grall 1fccdfce51 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>
2013-09-17 15:27:59 +01:00
Julien Grall 57e835e514 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>
2013-09-17 15:27:56 +01:00
Julien Grall 6db389ab3f 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>
2013-09-17 15:27:54 +01:00
Julien Grall c88d32f463 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>
2013-09-17 15:27:48 +01:00
Julien Grall 190ece328e 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>
2013-09-17 15:27:43 +01:00
Julien Grall dff2cc6324 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>
2013-09-17 15:27:37 +01:00
Julien Grall 9fe65ea739 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>
2013-09-17 15:27:15 +01:00
Charles Arnold f3f5f1927f 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>
2013-09-17 15:26:27 +01:00
George Dunlap c5e9596cd0 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>
2013-09-16 16:47:34 +01:00
Ian Campbell 0119ce9860 Revert "libxl, hotplug/Linux: default to phy backend for raw format file"
This reverts commit 11a63a1660. The change causes
issues with live migration.
2013-09-16 14:29:47 +01:00
Nathan Studer 0f395582b4 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>
2013-09-16 13:12:14 +02:00
Jan Beulich 3722827b37 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>
2013-09-16 12:24:19 +02:00
Suravee Suthikulpanit 2fd0975f4d AMD-Vi: Fix IVRS HPET special->handle override
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
2013-09-16 12:23:50 +02:00
Andrew Cooper 42c5b12140 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>
2013-09-16 12:22:20 +02:00
Ian Campbell 593470233f 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>
2013-09-14 08:40:17 +01:00
Dario Faggioli b639592b24 .gitignore: add tools/misc/xen-hptool
as ae763e4224 ("tools/misc: introduce xen-mfndump") forgot to do so.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
2013-09-13 14:11:37 +01:00
Andrew Cooper 4c57b3fbdf 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>
2013-09-13 14:30:02 +02:00
Jan Beulich c71a3e6d83 Merge. 2013-09-13 14:28:46 +02:00
Jan Beulich a54dc5f4fe 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>
2013-09-13 14:27:34 +02:00
Andrew Cooper 255d252c0a 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>
2013-09-13 13:18:43 +01:00
Fabio Fantoni 17b29c1cd8 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>
2013-09-13 13:18:18 +01:00
Matthew Daley ba033a204b 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>
2013-09-13 13:15:30 +01:00
Matthew Daley da89e7ef29 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>
2013-09-13 13:15:09 +01:00
Matthew Daley 6425b20c0f 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>
2013-09-13 13:15:02 +01:00
Matthew Daley 72b9c3e88c 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>
2013-09-13 13:14:51 +01:00
Matthew Daley ad6aa096e4 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>
2013-09-13 13:14:41 +01:00
Matthew Daley ceb556178d 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>
2013-09-13 13:14:37 +01:00
Roger Pau Monne a508caf0eb 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>
2013-09-13 13:13:31 +01:00
Konrad Rzeszutek Wilk 1438d36f96 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>
2013-09-13 13:12:29 +01:00
Dario Faggioli ae763e4224 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>
2013-09-13 13:10:10 +01:00
Dario Faggioli 266abb2407 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>
2013-09-13 13:10:07 +01:00
Dario Faggioli dfdfcdc6f7 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>
2013-09-13 13:10:05 +01:00
Dario Faggioli 2e2fa6ef60 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>
2013-09-13 13:10:02 +01:00