]> xenbits.xensource.com Git - xen.git/log
xen.git
10 years agoxen: arm: correctly handle removing a subset of a superpage mapping.
Ian Campbell [Mon, 14 Jul 2014 16:27:05 +0000 (17:27 +0100)]
xen: arm: correctly handle removing a subset of a superpage mapping.

This can be exercised for example via ballooning which will remove 4K
regions from anywhere in the address space.

Reported-by: Julien Grall <julien.grall@linaro.org>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
10 years agoxen: arm: when ALLOCATING p2m entries maddr is meaningless
Ian Campbell [Mon, 14 Jul 2014 16:27:04 +0000 (17:27 +0100)]
xen: arm: when ALLOCATING p2m entries maddr is meaningless

The maddr differs on each loop depending on the pages which happen to get
allocated.

There is already an assertion that maddr == 0.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
10 years agoxen: arm: use physical processor ID (MPIDR) when calling psci CPU_ON
Ian Campbell [Mon, 14 Jul 2014 16:21:47 +0000 (17:21 +0100)]
xen: arm: use physical processor ID (MPIDR) when calling psci CPU_ON

Xen's logical CPU map can differ from the underlying layout.

Also add an emacs magic block to this file.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
10 years agoxen: arm: Add Juno earlyprintk configuration
Ian Campbell [Mon, 14 Jul 2014 16:21:11 +0000 (17:21 +0100)]
xen: arm: Add Juno earlyprintk configuration

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
10 years agomini-os: use generic local_irq_enable function
Thomas Leonard [Wed, 16 Jul 2014 11:07:46 +0000 (12:07 +0100)]
mini-os: use generic local_irq_enable function

__sti is x86 specific.

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: x86_64: make thread stacks 16-byte aligned
Thomas Leonard [Wed, 16 Jul 2014 11:07:41 +0000 (12:07 +0100)]
mini-os: x86_64: make thread stacks 16-byte aligned

Otherwise, passing doubles to varargs functions causes a crash.

Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
10 years agotools/libxc: Shuffle definitions and uses of min()/max() macros
Andrew Cooper [Wed, 16 Jul 2014 14:32:05 +0000 (15:32 +0100)]
tools/libxc: Shuffle definitions and uses of min()/max() macros

Move the typesafe min() macro from xc_dom_decompress_unsafe_xz.c to
xc_private.h, and complement it with an equivalent max() macro.

Replace current users of type unsafe MIN()/MAX() macros, and remove their
scattered definitions.

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 agoarch/arm: let map_mmio_regions() use start and count
Arianna Avanzini [Mon, 14 Jul 2014 00:50:24 +0000 (02:50 +0200)]
arch/arm: let map_mmio_regions() use start and count

Currently, the arguments given to the function map_mmio_regions() to
describe the memory range to be mapped are the start and end page frame
numbers of the range to be mapped. However, this could give rise to
issues due to the range being inclusive or exclusive of the end gfn
given as parameter. This commit changes the interface of the function
to accept the start gfn and the number of gfns to be mapped.
This commit also changes the interface of the function map_one_mmio(),
helper for the xgene-storm platform, which is a wrapper for the function
map_mmio_regions() and does not need its arguments to be paddr_t.

NOTE: platform-specific code has not been tested, save for the
      sunxi and the Arndale Exynos 5 platforms (see the Tested-by
      below for the latter).

Signed-off-by: Arianna Avanzini <avanzini.arianna@gmail.com>
Acked-by: Julien Grall <julien.grall@citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@eu.citrix.com>
Tested-by: Julien Grall <julien.grall@citrix.com>
Cc: Dario Faggioli <dario.faggioli@citrix.com>
Cc: Paolo Valente <paolo.valente@unimore.it>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Jan Beulich <JBeulich@suse.com>
Cc: Keir Fraser <keir@xen.org>
Cc: Tim Deegan <tim@xen.org>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Eric Trudeau <etrudeau@broadcom.com>
Cc: Viktor Kleinik <viktor.kleinik@globallogic.com>
[ ijc -- remove stray extra parameter in xgene-storm.c ]

10 years agoarch/arm: let map_mmio_regions() take pfn as parameters
Arianna Avanzini [Mon, 14 Jul 2014 00:50:23 +0000 (02:50 +0200)]
arch/arm: let map_mmio_regions() take pfn as parameters

Currently, the map_mmio_regions() function, defined for the ARM
architecture, has parameters with paddr_t type. This interface,
however, needs caller functions to correctly page-align addresses
given as parameters to map_mmio_regions(). This commit changes the
function's interface to accept page frame numbers as parameters.
This commit also modifies caller functions in an attempt to adapt
them to the new interface.
This commit is meant to produce the minimum indispensable needed
changes; these are also instrumental to making the interface of
map_mmio_regions() symmetric with the unmap_mmio_regions() function,
that will be introduced in one of the next commits of the series
and will feature a pfn-based interface.

NOTE: platform-specific code has not been tested, save for the
      sunxi and the Arndale Exynos 5 platforms (see the Tested-by
      below for the latter).

Signed-off-by: Arianna Avanzini <avanzini.arianna@gmail.com>
Tested-by: Julien Grall <julien.grall@citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@eu.citrix.com>
Cc: Dario Faggioli <dario.faggioli@citrix.com>
Cc: Paolo Valente <paolo.valente@unimore.it>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Jan Beulich <JBeulich@suse.com>
Cc: Keir Fraser <keir@xen.org>
Cc: Tim Deegan <tim@xen.org>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Eric Trudeau <etrudeau@broadcom.com>
Cc: Viktor Kleinik <viktor.kleinik@globallogic.com>
10 years agoxl: 'xl vncviewer' accesses port 0 by any invalid domid
Chunyan Liu [Fri, 18 Jul 2014 06:18:04 +0000 (14:18 +0800)]
xl: 'xl vncviewer' accesses port 0 by any invalid domid

Currently, with command:
  xl vncviewer invalid_domid
it always brings user to the domU using vncport 5900.
The invalid domid could be an non-existing one or Dom0.
It's better to report error in this case.

Correct libxl_vncviewer_exec:
  In existing code, when vncport is NULL, it still continues
  and will show vncport 5900. So, with 'xl vncviewer 0' it also
  wrongly shows domU using vncport 5900. Correct it to report error
  if vncport is NULL.

Signed-off-by: Chunyan Liu <cyliu@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agomake: Make *-dir-force-update depend on *-dir-find
George Dunlap [Mon, 14 Jul 2014 16:15:24 +0000 (17:15 +0100)]
make: Make *-dir-force-update depend on *-dir-find

Make the targets depend on the "-find" targets, so that if the
subtrees are cloned if they haven't been cloned already.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
10 years agomake: Normalize config options for external trees
George Dunlap [Mon, 14 Jul 2014 16:15:23 +0000 (17:15 +0100)]
make: Normalize config options for external trees

We have four different external trees, and four different naming
conventions for specifying the URL, where they live, and what revision
to check out.

Normalize config options on the following bases:
 - QEMU_UPSTREAM
 - QEMU_TRADITIONAL
 - SEABIOS_UPSTREAM
 - OVMF_UPSTREAM

The following suffixes for all trees:
 - _URL : A remote repository to clone from
 - _REVISION : The revision to check out

And the following suffixes for the qemu trees:
 - _INTREE : The location of an inlined tree (for tarball releases)
 - _LOC : Where to actually look (either a directory or a URL)

The following parameters are still supported for backwards
compatibility:
 - CONFIG_QEMU          (=> QEMU_TRADITIONAL_LOC)
 - QEMU_REMOTE          (=> QEMU_TRADITIONAL_URL)
 - QEMU_TAG             (=> QEMU_TRADITIONAL_REVISION)
 - SEABIOS_UPSTREAM_TAG (=> SEABIOS_UPSTREAM_REVISION)

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
10 years agomake: Check tools/qemu-xen[-traditional] for qemu before downloading
George Dunlap [Mon, 14 Jul 2014 16:15:22 +0000 (17:15 +0100)]
make: Check tools/qemu-xen[-traditional] for qemu before downloading

Currently xen, qemu-xen, and qemu-xen-traditional are kept in separate
repositories, but when we release them as a tarball, qemu-xen and
qemu-xen-traditional are in-lined into the tools/ directory.

In order to make this "just work", at the moment developer doing the
release manually modifies Config.mk as part of the relase process so
that CONFIG_QEMU and QEMU_UPSTREAM_URL point into the tools/ directory
instead.

Modify Config.mk to automatically check there before trying a remote
repository.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
10 years agoxen/arm: Trap and yield on WFE instructions
Anup Patel [Wed, 16 Jul 2014 10:32:15 +0000 (16:02 +0530)]
xen/arm: Trap and yield on WFE instructions

If we have a Guest/DomU with two or more of its VCPUs running
on same host CPU then it can quite likely happen that these
VCPUs fight for same spinlock and one of them will waste CPU
cycles in WFE instruction. This patch makes WFE instruction
trap for VCPU and forces VCPU to yield its timeslice.

The KVM ARM/ARM64 also does similar thing for handling WFE
instructions. (Please refer,
https://lists.cs.columbia.edu/pipermail/kvmarm/2013-November/006259.html)

In general, this patch is more of an optimization for an
oversubscribed system having number of VCPUs more than
underlying host CPUs.

Signed-off-by: Anup Patel <anup.patel@linaro.org>
Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Tested-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- resolved conflict with "Adding helper function for WFI",
         nuked stray hard tab ]

10 years agoxen/arm : Adding helper function for WFI
Parth Dixit [Mon, 14 Jul 2014 13:51:53 +0000 (19:21 +0530)]
xen/arm : Adding helper function for WFI

WFI functionality is required at different places in xen.
Moving it to seperate helper function so that it is easier
to call WFI function and avoid duplication of code

Signed-off-by: Parth Dixit <parth.dixit@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoxenctrl: Make the headers C++ friendly
Razvan Cojocaru [Wed, 2 Jul 2014 16:30:33 +0000 (19:30 +0300)]
xenctrl: Make the headers C++ friendly

Moved an enum definition before the typedef that uses it.

Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agotools/Makefile: Build only a subset of things for rump kernels
Ian Jackson [Wed, 25 Jun 2014 11:38:35 +0000 (12:38 +0100)]
tools/Makefile: Build only a subset of things for rump kernels

Override the set of tools/ subdirectories for rump kernel builds.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agorump kernels: Handle rumpxen host in configure
Ian Jackson [Wed, 28 May 2014 16:04:52 +0000 (17:04 +0100)]
rump kernels: Handle rumpxen host in configure

Support
   ./configure --host=x86_64-rumpxen-netbsd
   ./configure --host=i386-rumpxen-netbsd

Setting --host tells configure we are cross compiling and therefore
has various automatic effects.

But in this patch we make some deliberate changes as well:
 * We disable a large number of configure tests for libraries
   etc. which don't exist.
 * We set CONFIG_RUMP in Tools.mk.
 * Hence, we automatically set XEN_OS.

(I have only tested the 32-bit build but I think the 64-bit build
should work just as well.)

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
---
v3: Add comment to `fi'
v2: Mention x86_64.
    Drop an erroneous whitespace change.

10 years agobuild system: Introduce nosharedlibs variable.
Ian Jackson [Wed, 28 May 2014 16:06:02 +0000 (17:06 +0100)]
build system: Introduce nosharedlibs variable.

Introduce a new build variable "nosharedlibs".

In tools/libxc use it instead of $(stubdom).
In tools/xenstore honour it, and build static clients.

If shared libs are disabled, do not try to install or symlink them.

Set nosharedlibs when building for MiniOS or NetBSDRump.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
---
v2: Clarify deliberate INSTALL_SHLIB and SYMLINK_SHLIB breakage.

10 years agobuild system: Introduce libextension variable
Ian Jackson [Wed, 28 May 2014 16:05:19 +0000 (17:05 +0100)]
build system: Introduce libextension variable

This variable is the suffix to use for finding libraries when doing
compile-time linking.  For now we always set it to ".so" - so no
functional change.

In a forthcoming patch it may take on different values.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agobuild system: Introduce INSTALL_SHLIB and SYMLINK_SHLIB
Ian Jackson [Wed, 25 Jun 2014 09:54:38 +0000 (10:54 +0100)]
build system: Introduce INSTALL_SHLIB and SYMLINK_SHLIB

INSTALL_SHLIB is like INSTALL_PROG but used only for shared libraries.
SYMLINK_SHLIB is the ln -sf rune for shared library symlinks.

Use these in the appropriate places in tools/libxc and tools/xenstore.

No functional change right now.  In a forthcoming patch these
variables might take on different values.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoxenstore: Make building of xenstored optional
Ian Jackson [Wed, 25 Jun 2014 09:54:54 +0000 (10:54 +0100)]
xenstore: Make building of xenstored optional

In principle it would be possible to make a rumpuser-xen-based stub
xenstored, but all the necessary pieces do not yet exist.

So provide a facility to disable compilation of xenstored, and use it
to disable it on rump kernels.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoxenstore: rump kernels: Look for /dev/xen/xenbus
Ian Jackson [Thu, 19 Jun 2014 17:54:35 +0000 (18:54 +0100)]
xenstore: rump kernels: Look for /dev/xen/xenbus

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agolibxc: rump kernels: Use standard xc_osdep_get_info
Ian Jackson [Wed, 28 May 2014 16:06:21 +0000 (17:06 +0100)]
libxc: rump kernels: Use standard xc_osdep_get_info

Do not try to support the dlopen-based xc indirection.

Introduce a local #define DO_DYNAMIC_OSDEP to centralise the condition.

Add comments to the #endifs.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
---
v2: Remove duplication by introducing DO_DYNAMIC_OSDEP.
    Add comments to the #endifs.

10 years agorump kernels: Start introducing new XEN_OS NetBSDRump
Ian Jackson [Wed, 28 May 2014 16:07:37 +0000 (17:07 +0100)]
rump kernels: Start introducing new XEN_OS NetBSDRump

Provide an entry in config/, and a copy of xen-sys privcmd.h.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoxenstore: In xenstore_client, avoid stack buffer in recursive function
Ian Jackson [Fri, 20 Jun 2014 10:54:56 +0000 (11:54 +0100)]
xenstore: In xenstore_client, avoid stack buffer in recursive function

do_ls is recursive.  It had a buffer of size around 5K allocated on
the stack.  This combination is not a very good idea: some
environments (eg, Mini-OS) have limited stack sizes (eg 64K).

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoxenstore: Use $(PTHREAD_LDFLAGS) and $(PTHREAD_LIBS) not -lpthread
Ian Jackson [Wed, 28 May 2014 16:06:50 +0000 (17:06 +0100)]
xenstore: Use $(PTHREAD_LDFLAGS) and $(PTHREAD_LIBS) not -lpthread

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---
v3: We need PTHREAD_LDFLAGS too (!)

10 years agolibxl: Fix duplicate libxl_ctx typedef.
Wen Congyang [Fri, 11 Jul 2014 03:32:33 +0000 (11:32 +0800)]
libxl: Fix duplicate libxl_ctx typedef.

commit de18e4c038306aeeca53e6e63e563036cafef162 introduces a build error with
older gcc:

In file included from xl.c:31:
libxl.h:582: error: redefinition of typedef ‘libxl_ctx’
libxl.h:348: note: previous declaration of ‘libxl_ctx’ was here

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- rewrote commit message ]

10 years agolibxl: Use proper path for 'do_flr' functionality.
Konrad Rzeszutek Wilk [Tue, 8 Jul 2014 19:00:37 +0000 (15:00 -0400)]
libxl: Use proper path for 'do_flr' functionality.

Commit f74035d3b1e827ff6ff1873e2f10feb011a8d0d2 "xl: PCI code cleanups"
introduced an regression where it changed the name from:
/sys/bus/pci/drivers/pciback/do_flr
to
libxl_sprintf(ctx, "%s/pciback/do_flr", SYSFS_PCI_DEV);

And SYSFS_PCI_DEV is "/sys/bus/pci/devices", meaning we would
do /sys/bus/pci/devices/pciback/do_flr. The proper define
should have been SYSFS_PCIBACK_DRIVER, which is what this patch does.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoinit-xenstore-domain: Add optional ramdisk argument.
James Bielman [Mon, 7 Jul 2014 21:52:24 +0000 (14:52 -0700)]
init-xenstore-domain: Add optional ramdisk argument.

- Added an optional argument to allow passing a ramdisk
  to the Xenstore domain built by init-xenstore-domain.
- This is needed for Xenstore/MAC to pass initial security
  policy.

Signed-off-by: James Bielman <jamesjb@galois.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agodocs: Tweak .gitignore
Andrew Cooper [Mon, 7 Jul 2014 10:27:33 +0000 (11:27 +0100)]
docs: Tweak .gitignore

* Remove ignores for removed docs.
* Introduce blanket ignores for the "output" directories, including txt/ which
  was previously missing.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoxen: arm: allocate more than one bank for 1:1 domain 0 if needed
Ian Campbell [Wed, 9 Jul 2014 12:07:46 +0000 (13:07 +0100)]
xen: arm: allocate more than one bank for 1:1 domain 0 if needed

Depending on where Xen and the initial modules were loaded into RAM we may not
be able to allocate a suitably contiguous block of memory for dom0. Especially
since the allocations made by alloc_domheap_pages are naturally aligned (e.g. a
1GB allocation must be at a 1GB boundary).

The alignment requirement in particular is a huge limitation, meaning that even
dom0_mem0=1G on a 2GB system is pretty likely to fail unless you are very
careful with your load addresses. People were also having trouble with dom0 >
128MB on the 1GB cubieboard2 when using fairly standard load addresses for
things.

This patch tries to allocate multiple banks of memory in order to try and
satisfy the entire requested domain 0 allocation. Sadly this turns out to be
pretty tricky to arrange (see the large comment in the code).

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Karim Raslan <karim.allah.ahmed@gmail.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
10 years agoxen: arm: use superpages in p2m when pages are suitably aligned
Ian Campbell [Wed, 9 Jul 2014 12:07:45 +0000 (13:07 +0100)]
xen: arm: use superpages in p2m when pages are suitably aligned

This creates superpage (1G and 2M) mappings in the p2m for both domU and dom0
when the guest and machine addresses are suitably aligned. This relies on the
domain builder to allocate suitably sized regions, this is trivially true for
1:1 mapped dom0's and was arranged for guests in a previous patch. A non-1:1
dom0's memory is not currently deliberately aligned.

Since ARM pagetables are (mostly) consistent at each level this is implemented
by refactoring the handling of a single level of pagetable into a common
function. The two inconsistencies are that there are no superpage mappings at
level zero and that level three entry mappings must set the table bit.

When inserting new mappings the code shatters superpage mappings as necessary,
but currently makes no attempt to coalesce anything again. In particular when
inserting a mapping which could be a superpage over an existing table mapping
we do not attempt to free that lower page table and instead descend into it.

Some p2m statistics are added to keep track of the number of each level of
mapping and the number of times we've had to shatter an existing mapping.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
10 years agoxen/arm: split vgic driver into generic and vgic-v2 driver
Vijaya Kumar K [Wed, 9 Jul 2014 04:56:20 +0000 (10:26 +0530)]
xen/arm: split vgic driver into generic and vgic-v2 driver

Existing vGIC driver has both generic code and hw specific
code. Segregate vGIC low level driver into vgic-v2.c and
keep generic code in existing vgic.c file.

Some static generic functions in vgic.c is made as non-static
so that these generic functions can be used in vGIC v2 driver.

vGIC v2 driver registers required callbacks to generic vGIC
driver. This helps to plug in next version of vGIC drivers
like vGIC v3. These callbacks are registered per domain

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: Remove REG macro in vgic driver
Vijaya Kumar K [Wed, 9 Jul 2014 04:56:19 +0000 (10:26 +0530)]
xen/arm: Remove REG macro in vgic driver

REG macro does not compute any value and offset
variable is no more required. Hence 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: calculate vgic irq rank based on register size
Vijaya Kumar K [Wed, 9 Jul 2014 04:56:18 +0000 (10:26 +0530)]
xen/arm: calculate vgic irq rank based on register size

vGIC irq rank was computed assuming the register offset is byte
size.Use the HSR abort address size in calculating register size.

So, with this patch following are achieved
   (1) In the code 'dabt.size != number' this number is always
       BYTE/HALF_WORD/WORD/DOUBLE defined by HSR register.
       Instead of checking for hard coded values use HSR abort
       address size values.
   (2) The vgic_rank_offset also depends on register size to
       compute the rank offset. Though there is no direct relation
       between rank offset computation and HSR dabt.size the same
       values are used to calculate irq rank.

This make vgic_rank_offset generic as it takes register
size as parameter to calculate irq rank instead of hard coding to
value 2 in previous patches

Also, output of REG_RANK_INDEX macro is modulo by 32 to make
sure register index is always within irq rank

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoxen/arm: move pending_irq structure to vgic header file
Vijaya Kumar K [Wed, 9 Jul 2014 04:56:17 +0000 (10:26 +0530)]
xen/arm: move pending_irq structure to vgic header file

gic.h requires definition of pending_irq structure defined
in domain.h and domain.h requires gic_state structure defined
in gic.h and hence there is inter-dependency between domain.h
and gic.h files.

So move pending_irq to vgic.h which is relevant place for this
structure and break domain.h and gic.h interdependency

By this move irq_to_pending function declaration from gic.h
to vgic.h

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
10 years agoxen/arm: move and rename is_vcpu_running function to sched.h
Vijaya Kumar K [Wed, 9 Jul 2014 04:56:16 +0000 (10:26 +0530)]
xen/arm: move and rename is_vcpu_running function to sched.h

is_vcpu_running function in vgic driver is generic. So move
this to sched.h and rename it as is_vcpu_online

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>
CC: jbeulich@suse.com
CC: keir@xen.org
CC: george.dunlap@citrix.com
10 years agolibxl/gentest.py: test deep copy functions
Wei Liu [Wed, 9 Jul 2014 09:45:30 +0000 (10:45 +0100)]
libxl/gentest.py: test deep copy functions

The test is done as followed:
1. initialise libxl_FOO struct A
2. deep-copy A to B
3. generate JSON string for A and B
4. compare two JSON strings

If two strings are identical then we're good.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agolibxl IDL: generate deep copy functions
Wei Liu [Wed, 9 Jul 2014 09:45:29 +0000 (10:45 +0100)]
libxl IDL: generate deep copy functions

Introduces copy_fn for a type.

For most builtin types we can use direct assignment. For those builtin
types which cannot use direct assignment we use the copy functions in
previous patch.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agolibxl: copy function for builtin types
Wei Liu [Wed, 9 Jul 2014 09:45:28 +0000 (10:45 +0100)]
libxl: copy function for builtin types

These functions will be used in later patch to deep-copy a structure.

Functions introduced:
 * libxl_string_list_copy
 * libxl_key_value_list_copy
 * libxl_hwcap_copy
 * libxl_mac_copy
 * libxl_cpuid_policy_list_copy
 * libxl_string_copy
 * libxl_bitmap_copy_alloc
 * libxl_ms_vm_genid_copy

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agolibxl/gentest.py: test JSON parser
Wei Liu [Wed, 9 Jul 2014 09:45:27 +0000 (10:45 +0100)]
libxl/gentest.py: test JSON parser

The test is done in following steps:

1. initialise libxl_FOO struct
2. generate JSON string A for libxl_FOO struct FOO1
3. convert JSON string A to libxl_FOO struct FOO2
4. generate JSON string B for libxl_FOO struct FOO2
5. compare A and B

If A and B are identical then we are good.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agolibxl IDL: generate code to parse libxl__json_object to libxl_FOO struct
Wei Liu [Wed, 9 Jul 2014 09:45:26 +0000 (10:45 +0100)]
libxl IDL: generate code to parse libxl__json_object to libxl_FOO struct

libxl_FOO_parse_json functions are generated.

Note that these functions are used to parse libxl__json_object to
libxl__FOO struct. They don't consume JSON string.

The new function definitions are generated to new header files called
__libxl_types_*_private.h so that they don't contaminate public header.
The suffix "private is chosen so we can avoid clashing with
libxl_types_internal.idl stuffs.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agolibxl: clean up namespace violation
Wei Liu [Wed, 9 Jul 2014 09:45:25 +0000 (10:45 +0100)]
libxl: clean up namespace violation

In 752f181f ("libxl_json: introduce parser functions for builtin types")
a bunch of parser functions were introduced. Unfortunately they
polluted the public namespace with a prefix "libxl_", while they should
be internal functions.

This patch changes the prefix to "libxl__". No functional change
introduced.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agolibxl/gentypes.py: don't generate default values
Wei Liu [Wed, 9 Jul 2014 09:45:24 +0000 (10:45 +0100)]
libxl/gentypes.py: don't generate default values

If a field:
    0. is not of aggregate type
and
    1. is of array type and the array is not empty
or  2. is of a type which has init_val and has been set to init_val,
or  3. is of builtin type and has been set to internal default value,
or  4. is of a type which has no init_val and has been set to 0

then there's no need to generate output for that field in JSON
output.

Note that 0 can result in output like
  {
    ...
    FOO : { }
    ...
  }
where FOO is aggregate type but all its fields are set to default, hence
no JSON output in {} at all. This is not pretty, but it's still valid
JSON. And the parser should be able to skip touching those fields in the
resulting C structures. When the parser consumes that generated JSON
object, all default values should be automatically filled in.

Also change some non-zero init_vals to LIBXL_* for better readability in
generated C code.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agolibxl_internal: functions to check default values for builtin types
Wei Liu [Wed, 11 Jun 2014 16:35:07 +0000 (17:35 +0100)]
libxl_internal: functions to check default values for builtin types

They will be used in later patch to determine whether we should generate
JSON output for a type. If that type has default value we just skip
generating JSON output.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoxen/arm: introduce PLATFORM_QUIRK_GUEST_PIRQ_NEED_EOI
Stefano Stabellini [Fri, 4 Jul 2014 14:39:44 +0000 (15:39 +0100)]
xen/arm: introduce PLATFORM_QUIRK_GUEST_PIRQ_NEED_EOI

GICH_LR_HW doesn't work as expected on X-Gene: request maintenance
interrupts and perform EOIs in the hypervisor for hardware interrupts as
a workaround.  Trigger this behaviour with a per platform option.

This patch assumes that GICC_DIR can be written on any pcpu for a given
SPI, not matter where GICC_IAR has been read before.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
CC: psawargaonkar@apm.com
CC: apatel@apm.com
10 years agoxen/arm: Some clean up in time.c
Julien Grall [Wed, 9 Jul 2014 13:34:54 +0000 (14:34 +0100)]
xen/arm: Some clean up in time.c

The file xen/arm/time.c contains some unused code:
    - calibrate_timer: firmware already set correctly CNTFRQ. If it's
    not the case the device tree will containt a property clock-frequency
    in the timer node
    - USE_HYP_TIMER: It's set unconditionally to 1. I didn't see any
    recent model having issue with the hyp timer. I think we can drop
    it safely.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agotools/python: Improve .gitignore and clean Makefile rule
Andrew Cooper [Mon, 7 Jul 2014 10:26:48 +0000 (11:26 +0100)]
tools/python: Improve .gitignore and clean Makefile rule

Ignore all intermediate python files, and use find in the clean rule as there
are no Makefiles in subdirectories to participate in a recursive clean.

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 agoxen: Install arch-arm directory headers
Julien Grall [Tue, 8 Jul 2014 17:04:48 +0000 (18:04 +0100)]
xen: Install arch-arm directory headers

Some headers for ARM are not installed on the host. This may make external
software relying on Xen headers failed to compile on ARM.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoxen/arm: Don't save/restore context for idle VCPU
Julien Grall [Mon, 7 Jul 2014 15:29:15 +0000 (16:29 +0100)]
xen/arm: Don't save/restore context for idle VCPU

When an idle VCPU is running, Xen will never exit the hypervisor mode.
Futhermore, some part of the VCPU/domain initialization is already skipped for
them to avoid memory consumption.

Actually each save/restore functions are checking themself if the vcpu is
an idle one or not. We can safely skipped the context switch in one place
and gain a bit of time when we {,un}schedule idle VCPU. This is because
the saving part will take care of disabling anything related to guest (such
as GICv).

Also replace every check of and idle VCPU in save/restore functions by an
ASSERT, to know if someone is calling them with an idle VCPU in argument.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agotools/xenctx: Correct use of xc_domain_{, un}pause()
Andrew Cooper [Fri, 4 Jul 2014 16:06:20 +0000 (17:06 +0100)]
tools/xenctx: Correct use of xc_domain_{, un}pause()

The previous code never worked correctly.  There was a TOCTOU race between
checking dominfo and pausing the domain.

Since c/s 3eb1c708, Xen properly reference counts pause hypercalls, so
unconditionally pause and unpause the domain.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoxen: arm: add some helpers for assessing p2m pte
Ian Campbell [Wed, 9 Jul 2014 12:07:44 +0000 (13:07 +0100)]
xen: arm: add some helpers for assessing p2m pte

Not terribly helpful right now, since they aren't widely used, but makes future
patches easier to read.

p2m_mapping is unused for the time-being and is therefore commented out
(otherwise the compiler complains about an unused function).

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
10 years agoxen: arm: handle superpage mappings in p2m_lookup
Ian Campbell [Wed, 9 Jul 2014 12:07:43 +0000 (13:07 +0100)]
xen: arm: handle superpage mappings in p2m_lookup

Currently none are actually created, but they will be shortly.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
10 years agoxen: arm: only put_page for p2m operations which require it.
Ian Campbell [Wed, 9 Jul 2014 12:07:42 +0000 (13:07 +0100)]
xen: arm: only put_page for p2m operations which require it.

In particular do not do it for CACHEFLUSH.

INSERT, RELINQUISH and REMOVE should all put the page (if the current pte is
valid). ALLOCATE doesn't need to since it asserts the current PTE must be
invalid.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
10 years agotools: arm: allocate large pages to guests.
Ian Campbell [Wed, 9 Jul 2014 12:07:41 +0000 (13:07 +0100)]
tools: arm: allocate large pages to guests.

Tries to allocate as many large (1G or 2M) pages as it can to the guest and tries
to align to the next larger size on each attempt so that we can attempt to
allocate even larger pages on the next iteration (this is currently only
exercised via a compile time debug option, which is left in place under a #if
0).

Since ARM page tables are consistent at each level there is a common helper
function which tries to allocate a levels worth of pages. The exception to this
consistency is level 0 which does not support table mappings (0.5TB
superpages!).

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
10 years agotools/libxc: pull min/max_t into xc_private.h
Ian Campbell [Wed, 9 Jul 2014 12:07:40 +0000 (13:07 +0100)]
tools/libxc: pull min/max_t into xc_private.h

There are generally useful.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
10 years agoxen: arm: dump vcpu gic info in arch_dump_vcpu_info
Ian Campbell [Wed, 9 Jul 2014 12:07:39 +0000 (13:07 +0100)]
xen: arm: dump vcpu gic info in arch_dump_vcpu_info

Instead of looping over vcpus in arch_dump_domain_info

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
10 years agotools: update to seabios rel-1.7.5
Ian Campbell [Thu, 26 Jun 2014 10:45:49 +0000 (11:45 +0100)]
tools: update to seabios rel-1.7.5

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Tested-by: Don Slutz <dslutz@verizon.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
10 years agoxen/arm: Fix PLATFORM_QUIRK_GIC_64K_STRIDE
Ian Campbell [Wed, 9 Jul 2014 12:30:54 +0000 (13:30 +0100)]
xen/arm: Fix PLATFORM_QUIRK_GIC_64K_STRIDE

The patch "xen/arm: use ioremap to map gic-v2 registers" handled this
quirk by mapping a 64K+1 page region, but the code continued to
assume that GICC_DIR was at offset 0x1000 from the start of the
mapping.

Fix this by mapping both pages of the GICC space independently and
adjusting the accessor function to use the correct page.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
Cc: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Cc: Anup Patel <anup.patel@linaro.org>
Acked-by: Julien Grall <julien.grall@linaro.org>
10 years agoxen/arm: Introduce accessors for GICv2 MMIO reads/writes
Ian Campbell [Wed, 9 Jul 2014 12:30:53 +0000 (13:30 +0100)]
xen/arm: Introduce accessors for GICv2 MMIO reads/writes

A future patch needs to make the accesses to GICC more complex. For consistency
introduce read/write wrappers for all three regions (GICD, GICC, GICH).

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
10 years agoxen: arm: ignore zero sized memory banks
Ian Campbell [Mon, 30 Jun 2014 15:38:20 +0000 (16:38 +0100)]
xen: arm: ignore zero sized memory banks

At least one platform (xgene) has a memory node which contains 4
banks, 3 of which are all zeroes.

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 agooxenstored: perform a 3-way merge of the quota after a transaction
Jerome Maloberti [Thu, 3 Jul 2014 14:02:18 +0000 (15:02 +0100)]
oxenstored: perform a 3-way merge of the quota after a transaction

At a beginning of a transaction, the quotas from the global store
are duplicated and modified by the transaction. If during the
transaction, an action associated to no transaction is concurrently
executed, the quotas of the global store are updated, and then the
updates are lost when the transaction merges.

We fix this problem by keeping another copy of the quota at the
beginning of the transaction, and performing a 3-way merge between
the quotas from the transaction and the "original" copy of the quota
onto the quota of the global store.

Signed-off-by: Jerome Maloberti <jerome.maloberti@citrix.com>
Signed-off-by: Euan Harris <euan.harris@citrix.com>
Acked-by: David Scott <dave.scott@citrix.com>
10 years agooxenstored: exempt dom0 from domU node quotas
Vincent Bernardoff [Thu, 3 Jul 2014 14:02:17 +0000 (15:02 +0100)]
oxenstored: exempt dom0 from domU node quotas

If a domU has exhausted its quota we still want the toolstack in dom0 to
be able to create new nodes in places like
  /local/domain/%d/control/shutdown

Without this patch, a domU which has exhausted its quota can only be
powered off, which is not as good as being able to request a clean
shutdown.

Signed-off-by: Thomas Sanders <thomas.sanders@citrix.com>
Signed-off-by: Euan Harris <euan.harris@citrix.com>
Acked-by: David Scott <dave.scott@citrix.com>
10 years agotools/libxc: Use xc_hvm_param_get() instead of xc_get_hvm_param()
Aravindh Puthiyaparambil [Thu, 3 Jul 2014 19:26:33 +0000 (12:26 -0700)]
tools/libxc: Use xc_hvm_param_get() instead of xc_get_hvm_param()

Use xc_hvm_param_get() instead of xc_get_hvm_param() as the latter has
been deprecated.

Signed-off-by: Aravindh Puthiyaparambil <aravindp@cisco.com>
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 agolibxc: Fix stub domain build breakage
Aravindh Puthiyaparambil [Fri, 4 Jul 2014 03:15:03 +0000 (20:15 -0700)]
libxc: Fix stub domain build breakage

Commit 447f613c (lzo: update LZO compression to current upstream
version) broke the stub domain build. This patch fixes the build
breakage.

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 Beulich <jbeulich@suse.com>
Signed-off-by: Aravindh Puthiyaparambil <aravindp@cisco.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoproperly reference count DOMCTL_{,un}pausedomain hypercalls
Andrew Cooper [Thu, 3 Jul 2014 14:51:13 +0000 (16:51 +0200)]
properly reference count DOMCTL_{,un}pausedomain hypercalls

For safety reasons, c/s 6ae2df93c27 "mem_access: Add helper API to setup
ring and enable mem_access" has to pause the domain while it performs a set of
operations.

However without properly reference counted hypercalls, xc_mem_event_enable()
now unconditionally unpauses a previously paused domain.

To prevent toolstack software running wild, there is an arbitrary limit of 255
on the toolstack pause count.  This is high enough for several components of
the toolstack to safely use, but prevents over/underflow of d->pause_count.

The previous domain_{,un}pause_by_systemcontroller() functions are updated to
return an error code.  domain_pause_by_systemcontroller() is modified to have
a common stub and take a pause_fn pointer, allowing for both sync and nosync
domain pauses.  domain_pause_for_debugger() has a hand-rolled nosync pause
replaced with the new domain_pause_by_systemcontroller_nosync(), and has its
variables shuffled slightly to avoid rereading current multiple times.

Suggested-by: Don Slutz <dslutz@verizon.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
With a couple of formatting adjustments:
Reviewed-by: Jan Beulich <jbeulich@suse.com>
10 years agolzo: properly check for overruns
Greg Kroah-Hartman [Thu, 3 Jul 2014 14:39:30 +0000 (16:39 +0200)]
lzo: properly check for overruns

The lzo decompressor can, if given some really crazy data, possibly
overrun some variable types.  Modify the checking logic to properly
detect overruns before they happen.

Reported-by: "Don A. Bailey" <donb@securitymouse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Original Linux commit: 206a81c18401c0cde6e579164f752c4b147324ce.

This is CVE-2014-4607 (but not a security issue in Xen, since the code
is only used for loading the Dom0 kernel and _inside_ an eventual DomU
for loading its kernel).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
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>