]> xenbits.xensource.com Git - xen.git/log
xen.git
10 years agolzo: update LZO compression to current upstream version
Markus F.X.J. Oberhumer [Thu, 3 Jul 2014 14:38:06 +0000 (16:38 +0200)]
lzo: update LZO compression to current upstream version

This commit updates the kernel LZO code to the current upsteam version
which features a significant speed improvement - benchmarking the Calgary
and Silesia test corpora typically shows a doubled performance in
both compression and decompression on modern i386/x86_64/powerpc machines.

Signed-off-by: Markus F.X.J. Oberhumer <markus@oberhumer.com>
Original Linux commit: 8b975bd3f9089f8ee5d7bbfd798537b992bbc7e7.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agomini-os: add BUILD_BUG_ON()
Jan Beulich [Thu, 3 Jul 2014 14:37:22 +0000 (16:37 +0200)]
mini-os: add BUILD_BUG_ON()

Just copy over what the hypervisor currently uses (comments dropped due
to being of unknown origin; the implementation was done by me anyway).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Acked-by: Tim Deegan <tim@xen.org>
10 years agolibxl/arm: Rename set_interrupt_ppi to set_interrupt and handle SPIs
Julien Grall [Mon, 16 Jun 2014 16:18:04 +0000 (17:18 +0100)]
libxl/arm: Rename set_interrupt_ppi to set_interrupt and handle SPIs

The function will be used later during device passthrough to create
interrupts in the device tree. Those interrupts are usually SPIs.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agolibxl/arm: Introduce DT_IRQ_TYPE_*
Julien Grall [Mon, 16 Jun 2014 16:18:03 +0000 (17:18 +0100)]
libxl/arm: Introduce DT_IRQ_TYPE_*

Avoid to use hardcode value when the interrupt type is set.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoxen/arm: add DRA7 platform definition
Andrii Tseglytskyi [Thu, 3 Jul 2014 09:55:28 +0000 (12:55 +0300)]
xen/arm: add DRA7 platform definition

DRA7 platform definition is added to already existing
OMAP5 data. Data definitions, needed for DRA7 are
almost common for OMAP5 family.

Signed-off-by: Andrii Tseglytskyi <andrii.tseglytskyi@globallogic.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoxen/arm: dra7: Add UART base address for early logging
Andrii Tseglytskyi [Thu, 3 Jul 2014 09:55:27 +0000 (12:55 +0300)]
xen/arm: dra7: Add UART base address for early logging

DRA7 platform uses UART1 for console logging. Patch adds
its address to make early printk working.

Signed-off-by: Andrii Tseglytskyi <andrii.tseglytskyi@globallogic.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoxen/dt: add match for non-available nodes
Andrii Anisov [Thu, 3 Jul 2014 09:55:26 +0000 (12:55 +0300)]
xen/dt: add match for non-available nodes

Signed-off-by: Andrii Anisov <andrii.anisov@globallogic.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoxen/arm: Small fixes after GICv2 changes by commit ee65c87
Julien Grall [Wed, 2 Jul 2014 13:19:20 +0000 (14:19 +0100)]
xen/arm: Small fixes after GICv2 changes by commit ee65c87

The commit ee65c87 moves the GICv2 code in a separate file. Even though this
patch is only deals with code movement, a comment was modify for no reason.

Also rename gicv_v2_init into gicv2v_setup which is what the function does
and less confusing with the other function called gicv2_init.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agolibxc: Relocate internal-only mem_event functions to xc_private.h
Tamas K Lengyel [Wed, 2 Jul 2014 12:04:04 +0000 (14:04 +0200)]
libxc: Relocate internal-only mem_event functions to xc_private.h

The public xenctrl.h header exposes several internal-only functions of the mem_event system. As one of these functions (xc_mem_event_enable) had been previously used for a different purpose, relocating the entire set of xc_mem_event_* functions makes it easier for an external user of the library to determine which version of the mem_access system libxc exposes.

Signed-off-by: Tamas K Lengyel <tamas.k.lengyel@tum.de>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoxen/arm: Drop reference on foreign page when guest_physmap_add_entry has failed
Julien Grall [Tue, 1 Jul 2014 15:16:55 +0000 (16:16 +0100)]
xen/arm: Drop reference on foreign page when guest_physmap_add_entry has failed

When a foreign page is added to the guest p2m, we take a reference on this page.
Currently if the mapping has failed when a leak a reference, this will result
to the guest will foreign guest will became a zombie as soon as it's destroyed.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agotools/pygrub: Make pygrub understand default entry in string format
Boris Ostrovsky [Fri, 27 Jun 2014 14:07:31 +0000 (10:07 -0400)]
tools/pygrub: Make pygrub understand default entry in string format

Currently pygrub can only correctly parse grub2's default attribute when it is
specified as a number. If it is set to ${saved_entry} or ${next_entry} then
the first image (i.e. entry number 0) is selected. If any other value is
specified (typically this would be the string in menuentry) pygrub will crash.

This patch will allow pygrub to interpret default attribute if it is specified
as a string (note that in case of submenus only the leaf string will be
considered).

Also issue a warning if default is set to ${saved_entry} or ${next_entry}.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoxen/arm: Implement reset for sunxi.
Denis Schneider [Thu, 3 Jul 2014 10:08:49 +0000 (11:08 +0100)]
xen/arm: Implement reset for sunxi.

Enable hardware resets on Allwinner sunxi devices.

Signed-off-by: Denis Schneider <v1ne2go@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agolibxl: fix the bug which will cause heap to break down
Li Liang [Mon, 30 Jun 2014 00:48:37 +0000 (08:48 +0800)]
libxl: fix the bug which will cause heap to break down

If the JSON message contains more bytes than QMP_RECEIVE_BUFFER_SIZE,
this bug will break down the heap, that leads to core dump. One more
byte should be allocated to contain the appended null character.

Signed-off-by: Li Liang <liangx.z.li@intel.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoremus: make postcopy callback asynchronous
Yang Hongyang [Wed, 2 Jul 2014 08:09:11 +0000 (16:09 +0800)]
remus: make postcopy callback asynchronous

Make postcopy callback asynchronous.
This is a prepare patch of the following patch series.

Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
10 years agoMAINTAINERS: Add Yang Hongyang to REMUS part
Yang Hongyang [Fri, 6 Jun 2014 05:57:35 +0000 (13:57 +0800)]
MAINTAINERS: Add Yang Hongyang to REMUS part

Add Yang Hongyang as co-maintainer of REMUS.

Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
Acked-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
10 years agoMAINTAINERS: Update maintained files of REMUS part
Yang Hongyang [Wed, 25 Jun 2014 07:26:15 +0000 (15:26 +0800)]
MAINTAINERS: Update maintained files of REMUS part

delete tools/remus and add docs/README.remus

Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
Acked-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
10 years agoremus: add wikipage link to remus README
Yang Hongyang [Wed, 25 Jun 2014 07:26:14 +0000 (15:26 +0800)]
remus: add wikipage link to remus README

http://nss.cs.ubc.ca/remus/ does not exists, replace it
with Remus wikipage.

Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
10 years agoremus: move remus README to docs directory
Yang Hongyang [Wed, 25 Jun 2014 07:26:13 +0000 (15:26 +0800)]
remus: move remus README to docs directory

We do not need a separate directory to store remus README, just
move it to docs/ directory.

Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
Acked-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
10 years agoremus: remove old remus script
Yang Hongyang [Wed, 25 Jun 2014 07:26:12 +0000 (15:26 +0800)]
remus: remove old remus script

Since xend already deleted, the old remus script which based on
xend no longer functional, remove it.

Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
Acked-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
[ ijc -- removed "SUBDIR-y += remus" from tools/Makefile ]

10 years agolibxl: add support for FreeBSD uuid implementation
Roger Pau Monne [Fri, 27 Jun 2014 14:06:28 +0000 (16:06 +0200)]
libxl: add support for FreeBSD uuid implementation

Add the FreeBSD specific uuid implementation. Since uuid_t is not
defined as an array, but as a struct on FreeBSD, use a union with a
array in order to be able to return the uuid as a bytearray.

Also, added a libxl internal compile time assert macro, that is used
to assert that the size of uuid_t is the same as the union used in
libxl.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoautoconf: update m4/pkg.m4
Luis R. Rodriguez [Fri, 13 Jun 2014 01:18:47 +0000 (18:18 -0700)]
autoconf: update m4/pkg.m4

The provenance of the m4 pkg.m4 macro library was not documented
and it was not clear how and if we can update this without breaking
things. Document where this comes from, update us to the latest
release from git and put a warning about avoiding private evolutions
so that instead things go upstream.

The pkg-config m4 macro library comes from the upstream pkg-config
git repository [0]. If you update the m4 library update this file
with provenance and last commit ID information. For documentation
on how to use this read the pkg-config(1) man page.

Tree: git://anongit.freedesktop.org/pkg-config

The last synch was from commit:

commit 4f0084d9d3b8726a797a373c7ec5e406000995d0
Author: Dan Nicholson <dbn.lists@gmail.com>
Date:   Mon Feb 3 15:59:18 2014 -0800

    glib: Fix Makefiles to suppress warnings from automake

    With the newly added glib.mk, some of the noinst_* variables need to use
    += in the evaluation to avoid multiple definition warnings from
    automake.

Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Keir Fraser <keir@xen.org>
Cc: Tim Deegan <tim@xen.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
[ ijc -- ran autogen.sh ]

10 years agoautoconf: xen: force a refresh with autoconf
Luis R. Rodriguez [Fri, 13 Jun 2014 01:18:46 +0000 (18:18 -0700)]
autoconf: xen: force a refresh with autoconf

With some new functionality introduced we can't keep around the old cache,
but more specifically at times autogen.sh can produce inconsistent
results without considering all files obsolete. The cost of considering
all files obsolete is small so just force it.

Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Keir Fraser <keir@xen.org>
Cc: Tim Deegan <tim@xen.org>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agotools/xendomains: move to libexec and use a smaller init helper
Luis R. Rodriguez [Fri, 13 Jun 2014 01:18:45 +0000 (18:18 -0700)]
tools/xendomains: move to libexec and use a smaller init helper

The xendomains script can be reused with systemd systems as it
does not control services or sockets per se, but does a one shot
scrape of domUs it needs start bring up, stop, reload so we're
going to reuse it. This moves the core of the script to libexec
and leaves only a helper on init.

Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Jan Rękorajski <baggins@pld-linux.org>
Cc: M A Young <m.a.young@durham.ac.uk>
Cc: Jacek Konieczny <jajcus@jajcus.net>
Cc: xen-devel@lists.xenproject.org
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agotools/xendomains: do space cleanups
Luis R. Rodriguez [Fri, 13 Jun 2014 01:18:44 +0000 (18:18 -0700)]
tools/xendomains: do space cleanups

This has no functional changes. This is just to prepare the file
to be moved, so you won't blind your eyes or get git am to complain.

Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Jan Rękorajski <baggins@pld-linux.org>
Cc: M A Young <m.a.young@durham.ac.uk>
Cc: Jacek Konieczny <jajcus@jajcus.net>
Cc: xen-devel@lists.xenproject.org
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
10 years agotools/xendomains: make xl the default and remove xm usage
Luis R. Rodriguez [Fri, 13 Jun 2014 01:18:43 +0000 (18:18 -0700)]
tools/xendomains: make xl the default and remove xm usage

xm is gone so make xl the default and remove xm stuff.

Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Jan Rękorajski <baggins@pld-linux.org>
Cc: M A Young <m.a.young@durham.ac.uk>
Cc: Jacek Konieczny <jajcus@jajcus.net>
Cc: xen-devel@lists.xenproject.org
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
10 years agox86: drop pointless CONFIG_X86_HT
Jan Beulich [Wed, 2 Jul 2014 12:52:12 +0000 (14:52 +0200)]
x86: drop pointless CONFIG_X86_HT

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
10 years agomwait-idle: fine-tune IVT residency targets
Len Brown [Wed, 2 Jul 2014 12:51:18 +0000 (14:51 +0200)]
mwait-idle: fine-tune IVT residency targets

Ivy Town processors have slightly different properties
than Ivy Bridge processors, particuarly as socket count grows.
Here we add dedicated tables covering 1-2 socket,
3-4 socket, and > 4 socket IVT configurations.

This reduces the frequency of deep transitions on those systems,
which can impact throughput.

Signed-off-by: Len Brown <len.brown@intel.com>
Socket count determination needs to be done differently for us: The
relevant code runs in a pre-SMP initcall, and hence can't use
cpu_to_socket() (as only the boot CPU's cpu_data[].phys_proc_id got set
up by that time). As a replacement the patch introduces
apicid_to_socket(), thus estimating the socket count based on the boot
CPU's internal topology information (if all CPUs in a system are the
same, wich ought to be the common case, this estimate will be precise).

Note that apicid_to_socket() handles Intel topology determination only
for now, as the mwait-idle driver currently only supports Intel CPUs.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
10 years agomwait-idle: add CPU model 54 (Atom N2000 series)
Jan Kiszka [Wed, 2 Jul 2014 12:50:46 +0000 (14:50 +0200)]
mwait-idle: add CPU model 54 (Atom N2000 series)

Add CPU ID for Atom N2600/N2800 processors. Datasheets indicate support
for this, detailed information about potential quirks or limitations are
missing, though. So we just reuse the definition for the previous ATOM
series. Tests on N2800 systems showed that this addition is fine an can
reduce power consumption by about 0.25 W (personally confirmed on Intel
DN2800MT).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
10 years agomwait-idle: support Bay Trail
Len Brown [Wed, 2 Jul 2014 12:50:17 +0000 (14:50 +0200)]
mwait-idle: support Bay Trail

Bay Trail (BYT) is a family of Silvermont-core Atom Processor SOCs,
including the Intel Atom Processor Z36xxx and Z37xxx Series.

Although it shares the Silvermont core with Avoton,
BYT is optimized for mobile, and thus it supports
different power saving CPU idle states.

Note that not all versions of Bay Trail HW support all
of the states listed in the driver.

Signed-off-by: Len Brown <len.brown@intel.com>
Tested-by: Aubrey Li <aubrey.li@linux.intel.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
10 years agomwait-idle: allow sparse sub-state numbering, for Bay Trail
Len Brown [Wed, 2 Jul 2014 12:49:37 +0000 (14:49 +0200)]
mwait-idle: allow sparse sub-state numbering, for Bay Trail

Like acpi_idle, mwait-idle compared sub-state numbers
to the number of supported sub-states -- discarding
sub-states numbers that were numbered >= the number of states.

But some Bay Trail SOCs use sparse sub-state numbers,
so we can't make such a comparison if we are going
to access those states.

So now we simply check that _some_ sub-states are
supported for the given state, and assume that the
sub-state number in our driver is valid.

In practice, the driver is correct, and even if it were not,
the hardware clips invalid sub-state requests to valid ones.

No entries in the driver require this change,
but Bay Trail will need it.

Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
10 years agox86: always store APIC ID of CPU
Jan Beulich [Wed, 2 Jul 2014 12:48:13 +0000 (14:48 +0200)]
x86: always store APIC ID of CPU

So far for non-Intel CPUs struct cpuinfo_x86's apicid field didn't get
set, despite MCE code consuming it.

Do some formatting/ordering adjustment to the touched code at once.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
10 years agominios: fix incorrect {, un}likely() definitions
Andrew Cooper [Wed, 2 Jul 2014 12:46:42 +0000 (14:46 +0200)]
minios: fix incorrect {, un}likely() definitions

As identified in e5545fb6, likely() and unlikely() must convert their
expressions to booleans before comparing to 1 or 0, to avoid truncation
issues.

While editing this file, add inclusion guards.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
10 years agoxen/arm: move vgic defines to vgic header file
Vijaya Kumar K [Tue, 1 Jul 2014 06:41:16 +0000 (12:11 +0530)]
xen/arm: move vgic defines to vgic header file

gic.h contains defines of vgic. Move these to vgic
header file. Also move inline functions and defines/macros
in vgic.c to vgic.h. These vgic functions and macros
can be used by other GIC HW specific VGIC drivers,

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
10 years agoxen/arm: prefix byte_read and byte_write functions with vgic
Vijaya Kumar K [Tue, 1 Jul 2014 06:41:15 +0000 (12:11 +0530)]
xen/arm: prefix byte_read and byte_write functions with vgic

prefix byte_read and byte_write vgic functions with vgic_
to make these function vgic specific.

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoxen/arm: switch to dynamic allocation of vgic rank
Vijaya Kumar K [Tue, 1 Jul 2014 06:41:14 +0000 (12:11 +0530)]
xen/arm: switch to dynamic allocation of vgic rank

vgic_irq_rank structure contains gic specific data elements.
Move this out of domain.h to new vgic header file vgic.h
Allocate memory dynamically in vgic driver.

This patch reduces the size of domain struct and helps to
keep domain struct within PAGE_SIZE when future GIC hw versions
are added

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoxen/arm: use device api to detect GIC version
Vijaya Kumar K [Tue, 1 Jul 2014 06:41:13 +0000 (12:11 +0530)]
xen/arm: use device api to detect GIC version

Run through the device tree to detect
compatible GIC version and initialize GIC driver

Also change DT_MATCH_GIC to DT_MATCH_GIC_V2 to point
the GIC HW version to add later GIC versions

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoxen/arm: move GIC context data structure to gic driver
Vijaya Kumar K [Tue, 1 Jul 2014 06:41:12 +0000 (12:11 +0530)]
xen/arm: move GIC context data structure to gic driver

arch_domain in domain.h defines all the GIC registers
that needs to be saved/restored directly.

These GIC registers are GIC HW version specific. The number
of registers and size of registers varies with GIC version.
So move these registers to gic.h file and make a union of these
registers. This helps to define GIC HW version specific
structure to this union for later GIC versions.

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoxen/arm: segregate and split GIC low level functionality
Vijaya Kumar K [Tue, 1 Jul 2014 06:41:11 +0000 (12:11 +0530)]
xen/arm: segregate and split GIC low level functionality

GIC driver contains both generic and hardware specific low
level functionality in gic.c file.

With this patch, low level functionality is moved to separate
file gic-v2.c and generic code is kept in gic.c file

Callbacks are registered by low level driver with generic driver
and are called wherever required.

The locking mechanism is not changed.

This helps to separate generic and hardware functionality
and implement future hardware version drivers.

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Tested-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoxen/arm: use ioremap to map gic-v2 registers
Vijaya Kumar K [Tue, 1 Jul 2014 06:41:10 +0000 (12:11 +0530)]
xen/arm: use ioremap to map gic-v2 registers

gic-v2 driver uses fixmap to map the registers.
Instead use ioremap to access mmio registers.

With this patch, gic-v2 register definitions are updated
to use absolute offset address instead of dividing the
register offset by 4.

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoxen/arm: make sgi handling generic
Vijaya Kumar K [Tue, 1 Jul 2014 06:41:09 +0000 (12:11 +0530)]
xen/arm: make sgi handling generic

move all the hw specific sgi handling functionality
to one function and use it.

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agox86: move alternative.c data fully into .init.*
Jan Beulich [Mon, 30 Jun 2014 14:01:03 +0000 (16:01 +0200)]
x86: move alternative.c data fully into .init.*

This wasn't done upon the initial addition of the file since the
section processing needs some adjustment for this: We can't mark the
two arrays needing relocations as either __initdata or __initconst, as
both have the potential of creating section conflicts (with -fPIC the
compiler may want to mark the section writable due to the necessary
relocations, colliding with other __initconst uses, and if the compiler
chooses to use the provided section name, __initdata on a constant
object might collide with other __initdata uses). However, local data
known to be referenced only by init code/data can also safely be moved
into .init.*. Hence the respective logic is being tweaked such that it
won't complain on non-empty .*.local sections.

While at it also drop the non-local section names from
SPECIAL_DATA_SECTIONS - they can't be safely converted.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
10 years agoVT-d/ATS: correct and clean up dev_invalidate_iotlb()
Jan Beulich [Mon, 30 Jun 2014 13:57:40 +0000 (15:57 +0200)]
VT-d/ATS: correct and clean up dev_invalidate_iotlb()

While this was intended to only do cleanup (replace the two bogus
"ret |= " constructs, and a simple formatting correction), this now
also
- fixes the bit manipulations for size_order > 0
  a) correct an off-by-one in the use of size_order for shifting (till
     now double the requested size got invalidated)
  b) in fact setting bit 12 and up if necessary (without which too
     small a region might have got invalidated)
  c) making them capable of dealing with regions of 4Gb size and up
- corrects the return value handling, such that a later iteration's
  success won't clear an earlier iteration's error indication
- uses PCI_BDF2() instead of open coding it
- bail immediately on bad passed in invalidation type, rather than
  repeatedly printing the same message for each ATS-capable device, at
  once also no longer hiding that failure from the caller

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Yang Zhang <yang.z.zhang@intel.com>
10 years agodocs: update docs for the ~/platform/generation-id key
David Vrabel [Fri, 27 Jun 2014 13:57:53 +0000 (14:57 +0100)]
docs: update docs for the ~/platform/generation-id key

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoxl: generate a new random VM generation ID if requested
David Vrabel [Fri, 27 Jun 2014 13:57:52 +0000 (14:57 +0100)]
xl: generate a new random VM generation ID if requested

If the "generation_id" option is set in the domain configuration,
generate and set a new random VM generation ID every time a domain is
created or restored.

xl lacks the infrastructure to fully track the lifecycle of VM images
as they are snapshotted and cloned (etc) so always using a new ID is
the safe option and ensures that a new one will be used where it matters.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agolibxl: allow a generation ID to be specified at domain creation
David Vrabel [Fri, 27 Jun 2014 13:57:51 +0000 (14:57 +0100)]
libxl: allow a generation ID to be specified at domain creation

Toolstacks may specify a VM generation ID using the u.hvm.ms_vm_genid
field in the libxl_domain_build_info structure, when creating a
domain.

The toolstack is responsible for providing the correct generation ID
according to the Microsoft specification (e.g., generating new random
ones with libxl_ms_vm_genid_generate() as appropriate when restoring).

Although the specification requires that a ACPI Notify event is raised
if the generation ID is changed, the generation ID is never changed
when the domain is in a state to receive such an event (it's either
newly created or suspended).

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Cc: David Scott <dave.scott@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoxen/arm: remove unused parameter in do_sgi call
Vijaya Kumar K [Thu, 26 Jun 2014 05:33:56 +0000 (11:03 +0530)]
xen/arm: remove unused parameter in do_sgi call

othercpu parameter in do_sgi is unused

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoxen/arm: make mmio handlers domain specific
Vijaya Kumar K [Thu, 26 Jun 2014 05:33:54 +0000 (11:03 +0530)]
xen/arm: make mmio handlers domain specific

register mmio handlers at runtime and make mmio handlers
domain specific and check handlers are removed.

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoxen/arm: move io.h as mmio.h to include folder
Vijaya Kumar K [Thu, 26 Jun 2014 05:33:53 +0000 (11:03 +0530)]
xen/arm: move io.h as mmio.h to include folder

io.h is local to arch/arm folder. move this file as mmio.h
file to include/asm-arm folder as it might be
required for inclusion in other header files in future.

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agotools/mce: add more MCE types to xen-mceinj
David Vrabel [Mon, 23 Jun 2014 17:57:01 +0000 (18:57 +0100)]
tools/mce: add more MCE types to xen-mceinj

Add a non-fatal MCE for AMD CPUs.

Add a fatal (PCC set) MCE for Intel CPUs.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Christoph Egger <chegger@amazon.de>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agotools/mce: refactor xen-mceinj to ease injection of other MCEs
David Vrabel [Mon, 23 Jun 2014 17:57:00 +0000 (18:57 +0100)]
tools/mce: refactor xen-mceinj to ease injection of other MCEs

Make the set of MCEs that xen-mceinj can inject by data-driven instead
of a whole pile of cut-and-paste functions.

There is no functional change.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Christoph Egger <chegger@amazon.de>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agotools/mce: use calloc() instead of malloc()/memset() in xen-mceinj
David Vrabel [Mon, 23 Jun 2014 17:56:59 +0000 (18:56 +0100)]
tools/mce: use calloc() instead of malloc()/memset() in xen-mceinj

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Christoph Egger <chegger@amazon.de>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agotools/mce: clarify xen-mceinj usage
David Vrabel [Mon, 23 Jun 2014 17:56:58 +0000 (18:56 +0100)]
tools/mce: clarify xen-mceinj usage

Correctly name --page option and make it clear that it takes a
parameter.  Use consistent formatting for help message.

Remove unused options.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agotools/mce: remove extra newlines from xen-mceinj error message
David Vrabel [Mon, 23 Jun 2014 17:56:57 +0000 (18:56 +0100)]
tools/mce: remove extra newlines from xen-mceinj error message

err() calls perror() which appends a newline.

Make Lprintf() also append a newline so err() and Lprintf() are
consistent.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Christoph Egger <chegger@amazon.de>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agolibxc: fix printf formatting error surfaced by 66f8c6
Roger Pau Monne [Thu, 19 Jun 2014 16:32:48 +0000 (18:32 +0200)]
libxc: fix printf formatting error surfaced by 66f8c6

The privcmd hypercall op and arguments on BSDs are unsigned long, so
use the proper printf format especifiers.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agolibxl: remove the gate that only allows block or regular backing images
Roger Pau Monne [Thu, 19 Jun 2014 16:32:47 +0000 (18:32 +0200)]
libxl: remove the gate that only allows block or regular backing images

On FreeBSD ZVOLs/disks/partitions are char devices, so libxl must
allow it's usage. This is already taken care in the OS-specific bits
of libxl by libxl__try_phy_backend, so remove the generic gate.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoconfigure: make the libaio test conditional on blktap{1, 2}
Roger Pau Monne [Thu, 19 Jun 2014 16:32:45 +0000 (18:32 +0200)]
configure: make the libaio test conditional on blktap{1, 2}

libaio is only required for blktap{1,2}, so make the check conditional
on whether the user has requested blktap{1,2} or not.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- reran autogen.sh ]

10 years agoconfigure: set blktap2 availability on configure
Roger Pau Monne [Thu, 19 Jun 2014 16:32:44 +0000 (18:32 +0200)]
configure: set blktap2 availability on configure

blktap2 will be enabled by default on Linux systems only, also give
the oportunity to disable it from configure.

Remove the gate in the Makefile that only allows enabling blktap{1,2}
on Linux, since this is now done in a more flexible way on configure.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- reran autogen.sh ]

10 years agoxen/arm: Add some useful debug in coprocessor trapping
Julien Grall [Thu, 19 Jun 2014 14:09:49 +0000 (15:09 +0100)]
xen/arm: Add some useful debug in coprocessor trapping

XSA-93 adds a couple of new functions to trap coprocessor registers. They
unconditionally inject an undefined instruction to guest.

When debugging an OS at early stage, it may be hard to know why the guest
received an UNDEFINED. Add some debug message to help the developer when Xen
is built in debug mode.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoxen/arm: Init traps very early
Julien Grall [Thu, 19 Jun 2014 14:02:16 +0000 (15:02 +0100)]
xen/arm: Init traps very early

The function init_traps sets up the handler taken when Xen hits a
BUG_ON/ASSERT.

If an error happen before init_traps is called, we lose the backtrace.

When a trap is taken from HYP mode, we need to:
    - get the processor ID, percpu has to be initialized and the
      smp_processor_id correctly set.
    - initialize current, even though it's not used for the time being. Move
      the debug sanity earlier.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Tested-by: Naresh Bhat <naresh.bhat@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- fixed typos and rewrapped commit log ]

10 years agotools/libxc: Improve the *_FIELD() macros
Andrew Cooper [Wed, 18 Jun 2014 17:18:37 +0000 (18:18 +0100)]
tools/libxc: Improve the *_FIELD() macros

The {GET,SET,MEMCPY,MEMSET_ARRAY}_FIELD() macros previously required
'dinfo->guest_width' to exist in scope, which is somewhat antisocial, and
makes them awkward to use in other contexts.

Update these macros to take guest width as a parameter, and in all cases pass
dinfo->guest_width.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agolibxc, libxl, hvmloader: strip out outdated VM generation ID implementation
David Vrabel [Wed, 18 Jun 2014 16:12:54 +0000 (17:12 +0100)]
libxc, libxl, hvmloader: strip out outdated VM generation ID implementation

The VM generation ID support in libxc/libxl was based on a draft
specification which subsequently changed considerably.  Remove much of
the code in anticipation of introducing something simpler that
conforms to the current specification from Microsoft.

Switch to using a HVM param (HVM_PARAM_VM_GENERATION_ID_ADDR) instead
of the hvmloader/generation-id-address XenStore key.  This simplifies
save/restore since it only needs to transfer the value of this param.

There are no changes to the migration stream format or the public
libxl API.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- updated xc_nomigrate.c for interface change ]

10 years agohvm: add HVM_PARAM_VM_GENERATION_ID_ADDR
David Vrabel [Wed, 18 Jun 2014 16:12:53 +0000 (17:12 +0100)]
hvm: add HVM_PARAM_VM_GENERATION_ID_ADDR

HVM_PARAM_VM_GENERATION_ID_ADDR is the guest physical address of the
VM Generation ID.  This parameter will be written by hvmloader and read
by the toolstack when updating the gen. ID (e.g., after restoring from a
snapshot).

A HVM parameter is easier for the save/restore code to work with (than
a XenStore key).

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
10 years agohvmloader: add helper functions to get/set HVM params
David Vrabel [Wed, 18 Jun 2014 16:12:52 +0000 (17:12 +0100)]
hvmloader: add helper functions to get/set HVM params

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agolibxl: add libxl__random_bytes() which fills a buffer with random bytes
David Vrabel [Wed, 18 Jun 2014 16:12:51 +0000 (17:12 +0100)]
libxl: add libxl__random_bytes() which fills a buffer with random bytes

The random bytes are obtained from /dev/urandom and are suitable for
almost all uses (except for generating long-lived secure keys).

Documentation suggests that /dev/urandom is widely available on Unix-like
systems (such FreeBSD and NetBSD).

A public libxl_random_bytes() (or similar) could be trivially added,
if this required in the future.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agolibxc: add xc_hvm_param_get/set() to get/set 64-bit values
David Vrabel [Wed, 18 Jun 2014 16:12:50 +0000 (17:12 +0100)]
libxc: add xc_hvm_param_get/set() to get/set 64-bit values

HVMOP_get_param and HVMOP_set_param take a uint32_t for the parameter
index and a uint64_t for the value.  So add xc_hvm_param_get() and
xc_hvm_param_set() that take the same types.

The existing xc_get_hvm_param() and xc_set_hvm_param() are retained
for compatibility but are deprecated.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- dropped one hunk against xen-access.c which didn't apply due to
         intervening changes ]

10 years agomini-os: use irqs_disabled() helper in schedule
Thomas Leonard [Thu, 26 Jun 2014 11:28:33 +0000 (12:28 +0100)]
mini-os: use irqs_disabled() helper in schedule

Testing whether the result of local_irq_save is zero doesn't work on
ARM.

Suggested by Julien Grall.
Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
10 years agomini-os: enable test_xenbus again
Thomas Leonard [Thu, 26 Jun 2014 11:28:32 +0000 (12:28 +0100)]
mini-os: enable test_xenbus again

The old code said "Xenbus tests disabled, because of a Xend bug".
Since xend doesn't exist any longer, we can enable these again.

Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
10 years agomini-os: moved unlikely/likely macros to new compiler.h
Thomas Leonard [Thu, 26 Jun 2014 11:28:31 +0000 (12:28 +0100)]
mini-os: moved unlikely/likely macros to new compiler.h

Requested by Julien Grall.

Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
10 years agomini-os: moved __pte to x86
Thomas Leonard [Thu, 26 Jun 2014 11:28:30 +0000 (12:28 +0100)]
mini-os: moved __pte to x86

We don't need to define this on ARM. Suggested by Julien Grall.

Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
10 years agomini-os: added arch_unbind_ports
Thomas Leonard [Thu, 26 Jun 2014 11:28:29 +0000 (12:28 +0100)]
mini-os: added arch_unbind_ports

This allows closing any ports opened by the arch-specific code.
ARM will use it for the debug port.

Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
10 years agomini-os: add missing casts to MM printk
Thomas Leonard [Thu, 26 Jun 2014 11:28:27 +0000 (12:28 +0100)]
mini-os: add missing casts to MM printk

The code previously assumed that a long was 64-bits.

Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
10 years agomini-os: don't require XEN_HAVE_PV_UPCALL_MASK
Thomas Leonard [Thu, 26 Jun 2014 11:28:26 +0000 (12:28 +0100)]
mini-os: don't require XEN_HAVE_PV_UPCALL_MASK

This isn't available on ARM.

Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
10 years agomini-os: added arch_init_gnttab
Karim Raslan [Thu, 26 Jun 2014 11:28:25 +0000 (12:28 +0100)]
mini-os: added arch_init_gnttab

Moves some x86-specific code into arch/x86.

Signed-off-by: Karim Allah Ahmed <karim.allah.ahmed@gmail.com>
[talex5@gmail.com: split into multiple patches]
Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
10 years agomini-os: whitespace
Thomas Leonard [Thu, 26 Jun 2014 11:28:24 +0000 (12:28 +0100)]
mini-os: whitespace

Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
10 years agomini-os: switched initial C entry point to arch_init
Karim Raslan [Thu, 26 Jun 2014 11:28:23 +0000 (12:28 +0100)]
mini-os: switched initial C entry point to arch_init

Signed-off-by: Karim Allah Ahmed <karim.allah.ahmed@gmail.com>
[talex5@gmail.com: separated from big ARM commit]
[talex5@gmail.com: restored comment, moved prototypes to headers]
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
[talex5@gmail.com: restored stack address printk on x86]
[talex5@gmail.com: moved first printk's after start_info setup on x86]
Signed-off-by: Thomas Leonard <talex5@gmail.com>
10 years agomini-os: made off_t type signed
Thomas Leonard [Thu, 26 Jun 2014 11:28:22 +0000 (12:28 +0100)]
mini-os: made off_t type signed

POSIX requires this.

Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
10 years agomini-os: use unbind_evtchn in unbind_all_ports
Thomas Leonard [Thu, 26 Jun 2014 11:28:21 +0000 (12:28 +0100)]
mini-os: use unbind_evtchn in unbind_all_ports

This marks the channel as closed, in case someone tries to use it again.

Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
10 years agomini-os: fixed format string error in unbind_evtchn
Thomas Leonard [Thu, 26 Jun 2014 11:28:20 +0000 (12:28 +0100)]
mini-os: fixed format string error in unbind_evtchn

Would crash if HYPERVISOR_event_channel_op returned an error code.
The other changes in this commit are just fixing indentation.

Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Ian Campbell <ian.cammpbell@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
10 years agomini-os: fixed shutdown thread
Thomas Leonard [Thu, 26 Jun 2014 11:28:19 +0000 (12:28 +0100)]
mini-os: fixed shutdown thread

Before, it read "" and started a shutdown immediately. Now, it waits for
a non-empty value and then actually shuts down.

Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
[talex5@gmail.com: avoid declaration-after-statement in kernel.c]
Signed-off-by: Thomas Leonard <talex5@gmail.com>
10 years agomini-os: build fixes
Thomas Leonard [Thu, 26 Jun 2014 11:28:18 +0000 (12:28 +0100)]
mini-os: build fixes

Make .o rules depend on the includes. Before, only the final link step
depended on setting up the includes directory, making parallel builds
unreliable.

Make symlinks use explicit make rules instead of using a phony target.
Avoids unnecessary rebuilds.

[talex5@gmail.com: bring back "make links", for stubdom]
Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
10 years agolibxl/xl: push VCPU affinity pinning down to libxl
Wei Liu [Fri, 20 Jun 2014 16:19:37 +0000 (18:19 +0200)]
libxl/xl: push VCPU affinity pinning down to libxl

This patch introduces an array of libxl_bitmap called "vcpu_hard_affinity"
in libxl IDL to preserve VCPU to PCPU mapping. This is necessary for libxl
to preserve all information to construct a domain.

The array accommodates at most max_vcpus elements, each containing the
affinity of the respective VCPU. If less than max_vcpus bitmaps are
present, the VCPUs associated to the missing elements will just stay with
their default affinity (they'll be free to execute on every PCPU).

In case both this new field, and the already existing cpumap field are
used, the content of the array will override what's set in cpumap. (In
xl, we make sure that this never happens in xl, by using only one of the
two at any given time.)

The proper macro to mark the API change (called
LIBXL_HAVE_BUILDINFO_VCPU_AFFINITY_ARRAYS) is added but it is commented.
It will be uncommented by the patch in the series that completes the
process, by adding the "vcpu_soft_affinity" array. This is because, after
all, these two fields are being added sort-of together, and are very
very similar, in both meaning and usage, so it makes sense for them to
share the same marker.

This patch was originally part of Wei's series about pushing as much
information as possible on domain configuration in libxl, rather than
xl. See here, for more details:
  http://lists.xen.org/archives/html/xen-devel/2014-06/msg01026.html
  http://lists.xen.org/archives/html/xen-devel/2014-06/msg01031.html

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agolibxl: Change default for b_info->{cpu, node}map to "not allocated"
Dario Faggioli [Fri, 20 Jun 2014 16:19:29 +0000 (18:19 +0200)]
libxl: Change default for b_info->{cpu, node}map to "not allocated"

by avoiding allocating them in libxl__domain_build_info_setdefault.
In fact, back in 7e449837 ("libxl: provide _init and _setdefault for
libxl_domain_build_info") and a5d30c23 ("libxl: allow for explicitly
specifying node-affinity"), it was decided that the default for these
fields was for them to be allocated and filled.

That is now causing problem, whenever we have to figure out whether
the caller is using or not one of those fields. In fact, when we see
a full bitmap, is it just the default value, or is the user that
wants it that way?

Since that kind of knowledge has become important, change the default
to be "bitmap not allocated". It then becomes easy to know whether a
libxl caller is using one of the fields, just by checking whether the
bitmap is actually there with a non-zero size.

This is very important for the following patches introducing new ways
of specifying hard and soft affinity. It also allows us to improve
the checks around NUMA automatic placement, during domain creation
(and that bit is done in this very patch).

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agolibxl: get and set soft affinity
Dario Faggioli [Fri, 20 Jun 2014 16:19:12 +0000 (18:19 +0200)]
libxl: get and set soft affinity

Make space a new cpumap in vcpu_info, called cpumap_soft,
for retrieving soft affinity, and amend the relevant API
accordingly.

libxl_set_vcpuaffinity() now takes two cpumaps, one for hard
and one for soft affinity (LIBXL_API_VERSION is exploited to
retain source level backword compatibility). Either of the
two cpumap can be NULL, in which case, only the affinity
corresponding to the non-NULL cpumap will be affected.

Getting soft affinity happens indirectly (see, e.g.,
`xl vcpu-list'), as it is already for hard affinity).

This commit also introduces some logic to check whether the
affinity which will be used by Xen to schedule the vCPU(s)
does actually match with the cpumaps provided. In fact, we
want to allow every possible combination of hard and soft
affinity to be set, but we warn the user upon particularly
weird situations (e.g., hard and soft being disjoint sets
of pCPUs).

This very change also update the error handling for calls
to libxl_set_vcpuaffinity() in xl, as that can now be any
libxl error code, not just only -1.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agolibxc: get and set soft and hard affinity
Dario Faggioli [Fri, 20 Jun 2014 16:19:01 +0000 (18:19 +0200)]
libxc: get and set soft and hard affinity

by using the flag and the new cpumap arguments introduced in
the parameters of the DOMCTL_{get,set}_vcpuaffinity hypercalls.

Now, both xc_vcpu_setaffinity() and xc_vcpu_getaffinity() have
a new flag parameter, to specify whether the user wants to
set/get hard affinity, soft affinity or both. They also have
two cpumap parameters instead of only one. This way, it is
possible to set/get both hard and soft affinity at the same
time (and, in case of set, each one to its own value).

In xc_vcpu_setaffinity(), the cpumaps are IN/OUT parameters,
as it is for the corresponding arguments of the
DOMCTL_set_vcpuaffinity hypercall. What Xen puts there is the
hard and soft effective affinity, that is what Xen will actually
use for scheduling.

In-tree callers are also fixed to cope with the new interface.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agolibxc/libxl: bump library SONAMEs
Dario Faggioli [Fri, 20 Jun 2014 16:18:53 +0000 (18:18 +0200)]
libxc/libxl: bump library SONAMEs

The following two patches break both libxc and libxl ABI and
API, so we better bump the MAJORs.

Of course, for libxl, proper measures are taken (in the
relevant patch) in order to guarantee API stability.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoxen: arm: Implement OSDLR_EL1 trap as RAZ/WO.
Ian Campbell [Fri, 13 Jun 2014 12:15:04 +0000 (13:15 +0100)]
xen: arm: Implement OSDLR_EL1 trap as RAZ/WO.

I'm not sure why this wasn't added at the same time as the other
debug registers.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
10 years agoxen: arm: take FIQ exceptions to Xen not guest by setting HCR_EL2.FMO
Ian Campbell [Thu, 26 Jun 2014 08:53:42 +0000 (09:53 +0100)]
xen: arm: take FIQ exceptions to Xen not guest by setting HCR_EL2.FMO

As with HCR_EL2.{IMO,AMO} we want to route FIQs to Xen not the guest. See ARM
ARM DDI 0406C.b B1.8.4.

So far none of the platforms which we support use FIQ for anything, but when we
end up supporting one it would be far better to surprise Xen with them than
whatever guest happens to be running...

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
10 years agoxen: arm: make sure gcc doesn't use floating-point registers on arm64
Ian Campbell [Thu, 26 Jun 2014 16:30:14 +0000 (17:30 +0100)]
xen: arm: make sure gcc doesn't use floating-point registers on arm64

By using -mgeneral-regs-only which is the Aarch64 equivalent to
-msoft-float.

Otherwise gcc will corrupt the d* registers, which we don't save/restore when
trapping to/from the hypervisor.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
10 years agoQEMU_TAG update
Ian Jackson [Wed, 25 Jun 2014 14:58:02 +0000 (15:58 +0100)]
QEMU_TAG update

10 years agoxen: arm: initialise the grant_table_gpfn array on allocation
Ian Campbell [Wed, 25 Jun 2014 12:58:59 +0000 (13:58 +0100)]
xen: arm: initialise the grant_table_gpfn array on allocation

Avoids leaking uninitialised memory via the grant table setup hypercall.

This is XSA-101.

Reported-by: Julien Grall <julien.grall@linaro.org>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoVT-d/qinval: make further functions static
Jan Beulich [Wed, 25 Jun 2014 12:43:46 +0000 (14:43 +0200)]
VT-d/qinval: make further functions static

... and with that change their return types to void as they can't
actually fail, simplifying error handling in their callers.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
10 years agoslightly consolidate code in free_domheap_pages()
Jan Beulich [Wed, 25 Jun 2014 12:43:04 +0000 (14:43 +0200)]
slightly consolidate code in free_domheap_pages()

... to combine the three scrubbing paths into a single one.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoVT-d/qinval: eliminate redundant locking
Jan Beulich [Wed, 25 Jun 2014 12:42:15 +0000 (14:42 +0200)]
VT-d/qinval: eliminate redundant locking

The qinval-specific lock would only ever get used with the IOMMU's
register lock already held. Along with dropping the lock also drop
another unused field from struct qi_ctrl.

Furthermore the gen_*_dsc() helpers become pretty pointless with the
lock dropped - being each used only in a single place, simply fold
them into their callers.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
10 years agox86/HVM: consolidate and sanitize CR4 guest reserved bit determination
Jan Beulich [Wed, 25 Jun 2014 12:40:34 +0000 (14:40 +0200)]
x86/HVM: consolidate and sanitize CR4 guest reserved bit determination

First of all, this is needed by just a single source file, so it gets
moved there instead of getting fed to the compiler for most other
source files too. With that it becomes sensible for this to no longer
be a macro, allowing elimination of the mostly redundant helpers
hvm_vcpu_has_{smep,smap}(). And finally, following the model SMEP and
SMAP already used, tie the determination of reserved bits to the
features the guest is shown rather than the host's.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
10 years agotools/libxl: Fix free() of wild pointer in libxl__initiate_device_remove()
Andrew Cooper [Wed, 18 Jun 2014 18:04:14 +0000 (19:04 +0100)]
tools/libxl: Fix free() of wild pointer in libxl__initiate_device_remove()

libxl__initiate_device_remove() had a preexisting error path issue where
libxl_dominfo_dispose() could be called on a libxl_dominfo object before it
had been initialised with libxl_dominfo_init().

This was safe until c/s ab44401 added the pointer ssid_label, which point
libxl_dominfo_dispose() free()s.

Unconditionally initialise info in libxl__initiate_device_remove() before
taking an error path which will free it.

Coverity-ID: 1223212
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
10 years agotools/libxc: Fix missing break in xc_domain_bind_pt_irq()
Andrew Cooper [Wed, 18 Jun 2014 17:44:44 +0000 (18:44 +0100)]
tools/libxc: Fix missing break in xc_domain_bind_pt_irq()

c/s 568da4f8 "pt-irq fixes and improvements" accidentally forgot a break when
refactoring xc_domain_bind_pt_irq() which results in bind->u.pci.bus being
clobbered by isa_irq for PCI and MSI_TRANSLATE interrupts.

Coverity-ID: 1223210
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Jan Beulich <JBeulich@suse.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
10 years agoblktap2: Fix two 'maybe uninitialized' variables
Dario Faggioli [Fri, 20 Jun 2014 14:09:00 +0000 (16:09 +0200)]
blktap2: Fix two 'maybe uninitialized' variables

for which gcc 4.9.0 complains about, like this:

block-qcow.c: In function `get_cluster_offset':
block-qcow.c:431:3: error: `tmp_ptr' may be used uninitialized in this function
[-Werror=maybe-uninitialized]
   memcpy(tmp_ptr, l1_ptr, 4096);
   ^
block-qcow.c:606:7: error: `tmp_ptr2' may be used uninitialized in this
function [-Werror=maybe-uninitialized]
   if (write(s->fd, tmp_ptr2, 4096) != 4096) {
       ^
cc1: all warnings being treated as errors
/home/dario/Sources/xen/xen/xen.git/tools/blktap2/drivers/../../../tools/Rules.mk:89:
 recipe for target 'block-qcow.o' failed
make[5]: *** [block-qcow.o] Error 1

The proper behavior is to return upon allocation failure.
About what to return, 0 seems the best option, looking
at both the function and the call sites.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
10 years agolibxl: Rewind toolstack_save_fd in libxl_save_helper when using remus
Yang Hongyang [Fri, 20 Jun 2014 06:59:34 +0000 (14:59 +0800)]
libxl: Rewind toolstack_save_fd in libxl_save_helper when using remus

Commit b327a3f421bb57d262b7d1fb3c43b710852b103b moved the rewinding of
toolstack_save_fd to libxl.  This breaks remus, because in remus mode,
toolstack_save_cb will be called in every checkpoint, and if we don't
rewind it in libxl_save_helper, it will surely fail.

This fix is just a hack: in fact the whole toolstack save thing should
be done in libxl.  But for now (until migration v2) this fix should
solve both remus and Jason Adryuk's use case.

Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
Tested-by: Jason Andryuk <andryuk@aero.org>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
10 years agolibxc: Fix xc_mem_event.c compilation for ARM
Julien Grall [Mon, 23 Jun 2014 13:27:58 +0000 (14:27 +0100)]
libxc: Fix xc_mem_event.c compilation for ARM

The commit 6ae2df9 "mem_access: Add helper API to setup ring and enable
mem_access¨ break libxc compilation for ARM.

This is because xc_map_foreign_map and xc_domain_decrease_reservation_exact
is taking an xen_pfn_t in parameters. On ARM, xen_pfn_t is always an uin64_t.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Cc: Aravindh Puthiyaparambil <aravindp@cisco.com>
Cc: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
10 years agomem_access: Add helper API to setup ring and enable mem_access
Aravindh Puthiyaparambil [Tue, 20 May 2014 23:35:44 +0000 (16:35 -0700)]
mem_access: Add helper API to setup ring and enable mem_access

tools/libxc: Add helper function to setup ring for mem events
This patch adds a helper function that maps the ring, enables mem_event
and removes the ring from the guest physmap while the domain is paused.
This can be used by all mem_events but is only enabled for mem_access at
the moment.

tests/xen-access: Use helper API to setup ring and enable mem_access
Prior to this patch, xen-access was setting up the ring page in a way
that would give a malicous guest a window to write in to the shared ring
page. This patch fixes this by using the helper API that does it safely
on behalf of xen-access.

This is XSA-99.

Signed-off-by: Aravindh Puthiyaparambil <aravindp@cisco.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>