]> xenbits.xensource.com Git - people/royger/xen.git/log
people/royger/xen.git
11 years agolibxl: init: libxl__poller_init and _get take gc
Ian Jackson [Tue, 17 Dec 2013 15:20:25 +0000 (15:20 +0000)]
libxl: init: libxl__poller_init and _get take gc

Change libxl__poller_init and libxl__poller__get to take a libxl__gc*
rather than a libxl_ctx*.  The gc is not used for memory allocation
but simply to provide the standard local variable "gc" expected by the
convenience macros.  Doing this makes the error logging more
convenient.

Hence, convert the logging calls to use the LOG* convenience macros.

And consequently, change the call sites, and the function bodies to
use CTX rather than ctx.

Also convert a call to malloc() (with error check) in
libxl__poller_get, to libxl__zalloc (no error check needed).

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agolibxl: init: Provide a gc later in libxl_ctx_alloc
Ian Jackson [Tue, 17 Dec 2013 15:22:40 +0000 (15:22 +0000)]
libxl: init: Provide a gc later in libxl_ctx_alloc

Provide libxl__gc *gc for the second half of libxl_ctx_alloc.
(For the first half of the function, gc is in scope but set to NULL.)

This makes it possible to make gc-requiring calls.  For example, it
makes error logging more convenient.

Make use of this by changing the logging calls to use the LOG*
convenience macros.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agox86/Intel: work around Xeon 7400 series erratum AAI65
Jan Beulich [Mon, 17 Mar 2014 15:47:22 +0000 (16:47 +0100)]
x86/Intel: work around Xeon 7400 series erratum AAI65

Linux commit 40e2d7f9b5dae048789c64672bf3027fbb663ffa ("x86 idle:
Repair large-server 50-watt idle-power regression") tells us that this
applies not just to the named Xeon 7400 series, but also NHM-EX and
WSM-EX; sadly Intel's documentation is so badly searchable that I
wasn't able to locate the respective errata (and hence can't quote
their numbers here).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
11 years agoVT-d: fix RMRR handling
Jan Beulich [Mon, 17 Mar 2014 15:45:04 +0000 (16:45 +0100)]
VT-d: fix RMRR handling

Removing mapped RMRR tracking structures in dma_pte_clear_one() is
wrong for two reasons: First, these regions may cover more than a
single page. And second, multiple devices (and hence multiple devices
assigned to any particular guest) may share a single RMRR (whether
assigning such devices to distinct guests is a safe thing to do is
another question).

Therefore move the removal of the tracking structures into the
counterpart function to the one doing the insertion -
intel_iommu_remove_device(), and add a reference count to the tracking
structure.

Further, for the handling of the mappings of the respective memory
regions to be correct, RMRRs must not overlap. Add a respective check
to acpi_parse_one_rmrr().

And finally, with all of this being VT-d specific, move the cleanup
of the list as well as the structure type definition where it belongs -
in VT-d specific rather than IOMMU generic code.

Note that this doesn't address yet another issue associated with RMRR
handling: The purpose of the RMRRs as well as the way the respective
IOMMU page table mappings get inserted both suggest that these regions
would need to be marked E820_RESERVED in all (HVM?) guests' memory
maps, yet nothing like this is being done in hvmloader. (For PV guests
this would also seem to be necessary, but may conflict with PV guests
possibly assuming there to be just a single E820 entry representing all
of its RAM.)

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Xiantao Zhang <xiantao.zhang@intel.com>
11 years agoxen: arm: increase priority of SGIs used as IPIs
Ian Campbell [Mon, 17 Mar 2014 11:31:02 +0000 (11:31 +0000)]
xen: arm: increase priority of SGIs used as IPIs

Code such as on_selected_cpus expects/requires that an IPI can preempt a
processor which is just handling a normal interrupt. Lacking this property can
result in a deadlock between two CPUs trying to IPI each other from interrupt
context.

For the time being there is only two priorities, IRQ and IPI, although it is
also conceivable that in the future some IPIs might be higher priority than
others. This could be used to implement a better BUG() than we have now, but I
haven't tackled that yet.

Tested with a debug patch which sends a local IPI from a keyhandler, which is
run in serial interrupt context.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Cc: Oleksandr Tyshchenko <oleksandr.tyshchenko@globallogic.com>
11 years agoxen/arm: Remove asm-arm/processor-ca{15, 7}.h headers
Julien Grall [Wed, 5 Mar 2014 04:46:26 +0000 (12:46 +0800)]
xen/arm: Remove asm-arm/processor-ca{15, 7}.h headers

Theses headers are not in the right directory and are not used anymore.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Reviewed-by: Tim Deegan <tim@xen.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/arm: Remove processor specific setup in vcpu_initialise
Julien Grall [Wed, 5 Mar 2014 04:46:25 +0000 (12:46 +0800)]
xen/arm: Remove processor specific setup in vcpu_initialise

This patch introduces the possibility to have specific processor callbacks
that can be called in various place.

Currently VCPU initialisation code contains processor specific setup (for
Cortex A7 and Cortex A15) for the ACTRL registers. It's possible to have
processor with a different layout for this register.

Move this setup in a specific callback for ARM v7 processor.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Reviewed-by: Tim Deegan <tim@xen.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: marc.ceeeee@gmail.com
11 years agoxen/arm64: Implement lookup_processor_type as a dummy function
Julien Grall [Wed, 5 Mar 2014 04:46:24 +0000 (12:46 +0800)]
xen/arm64: Implement lookup_processor_type as a dummy function

ARM64 implementation doesn't yet have specific code per processor.
This function will be used in a later patch.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Reviewed-by: Tim Deegan <tim@xen.org>
Acked-by: Ian campbell <ian.campbell@citrix.com>
11 years agoxen/arm32: Introduce lookup_processor_type
Julien Grall [Wed, 5 Mar 2014 04:46:23 +0000 (12:46 +0800)]
xen/arm32: Introduce lookup_processor_type

Looking for a specific proc_info structure is already implemented in assembly.
Implement lookup_processor_type to avoid duplicate code between C and
assembly.

This function searches the proc_info_list structure following the processor
ID. If the search fail, it will return NULL, otherwise a pointer to this
structure for the specific processor.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Reviewed-by: Tim Deegan <tim@xen.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/arm32: head.S: Remove CA15 and CA7 specific includes
Julien Grall [Wed, 5 Mar 2014 04:46:22 +0000 (12:46 +0800)]
xen/arm32: head.S: Remove CA15 and CA7 specific includes

head.S only contains generic code. It should not include headers for a
specific processor.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Reviewed-by: Tim Deegan <tim@xen.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/arm32: proc-v7.S: Rename v7_init and ACTLR_V7_SMP
Julien Grall [Wed, 5 Mar 2014 04:46:21 +0000 (12:46 +0800)]
xen/arm32: proc-v7.S: Rename v7_init and ACTLR_V7_SMP

The function v7_init and the define ACTLR_V7_SMP are Cortex A15/A7
specific.

To avoid misuse when new ARMv7 processors will be supported, create one
label per processor type and rename ACTLR_V7_SMP in ACTRL_CAXX_SMP

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Reviewed-by: Tim Deegan <tim@xen.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agolibxl: arm: do not create /chosen/bootargs in DTB if no cmdline is specified
Ian Campbell [Wed, 26 Feb 2014 12:13:00 +0000 (12:13 +0000)]
libxl: arm: do not create /chosen/bootargs in DTB if no cmdline is specified

Otherwise we deference a NULL pointer.

I saw this while experimenting with libvirt on Xen on ARM, xl already checks
that the command line is non NULL and provides "" as a default.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Cc: george.dunlap@citrix.com>
11 years agoxen/arm: Clean and invalidate dcache for boot pagetables
Oleksandr Tyshchenko [Tue, 11 Mar 2014 13:19:45 +0000 (15:19 +0200)]
xen/arm: Clean and invalidate dcache for boot pagetables

We need to invalidate dcache too after zeroing boot pagetables
to avoid unpredictable behavior which may take place after
non-boot CPUs enable their caches.

So, replace clean_xen_dcache() macro by a clean_and_invalidate_xen_dcache()
for boot pagetables.

Signed-off-by: Oleksandr Tyshchenko <oleksandr.tyshchenko@globallogic.com>
Reviewed-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/arm: Introduce clean_and_invalidate_xen_dcache() macro
Oleksandr Tyshchenko [Tue, 11 Mar 2014 13:19:44 +0000 (15:19 +0200)]
xen/arm: Introduce clean_and_invalidate_xen_dcache() macro

This macro is very similar to clean_xen_dcache(), but it performs
clean and invalidate dcache.

Also modify flush_page_to_ram() to call
clean_and_invalidate_xen_dcache_va_range() function.

Signed-off-by: Oleksandr Tyshchenko <oleksandr.tyshchenko@globallogic.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agotools: update config.{sub,guess}
Ian Jackson [Fri, 14 Mar 2014 12:00:11 +0000 (12:00 +0000)]
tools: update config.{sub,guess}

Update to versions from Debian Wheezy's autotools-dev package (20120608.1)

Adds ARM aarch64 support.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agounlzma: fix build of stubdom unsafe decompressors
Andrew Cooper [Fri, 14 Mar 2014 12:07:38 +0000 (13:07 +0100)]
unlzma: fix build of stubdom unsafe decompressors

c/s b683d68c386 changed the packing attribute on struct lzma_header.  However,
this is 3rd library code used by stubdomains.

Revert the change to lzma_header alone to avoid needless divergence from its
source.

Reported-by: Sander Eikelenboom <linux@eikelenboom.it>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
11 years agodocs/vtpm: explain dom0 physical TPM access caveats
Daniel De Graaf [Wed, 12 Mar 2014 14:37:40 +0000 (10:37 -0400)]
docs/vtpm: explain dom0 physical TPM access caveats

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agox86/tboot: Use an integer_param for "tboot="
Andrew Cooper [Fri, 14 Mar 2014 08:48:39 +0000 (09:48 +0100)]
x86/tboot: Use an integer_param for "tboot="

rather than using a string param and manually parsing it.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
11 years agox86_emulate: Shuffle use of __attribute__((packed))
Andrew Cooper [Fri, 14 Mar 2014 08:46:34 +0000 (09:46 +0100)]
x86_emulate: Shuffle use of __attribute__((packed))

Also include #defines for the test code to allow compilation.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
11 years agoarm: shuffle use of __attribute__((packed))
Andrew Cooper [Fri, 14 Mar 2014 08:45:24 +0000 (09:45 +0100)]
arm: shuffle use of __attribute__((packed))

This is all mechanical shuffling.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agox86: shuffle use of __attribute__((packed))
Andrew Cooper [Fri, 14 Mar 2014 08:44:40 +0000 (09:44 +0100)]
x86: shuffle use of __attribute__((packed))

This is almost all manual shuffling of __attribute__((packed)) statements to
__packed at the head of the structure.

The only different change is in tboot.h, removing some now-redundant ifdefs.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
11 years agocommon: shuffle use of __attribute__((packed))
Andrew Cooper [Fri, 14 Mar 2014 08:43:37 +0000 (09:43 +0100)]
common: shuffle use of __attribute__((packed))

This introduced a formal define in compiler.h, and is otherwise manual
shuffling of __attribute__((packed)) statements to __packed at the head of the
structure.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
11 years agofunctional cleanup for __attribute__((packed)) changes
Andrew Cooper [Fri, 14 Mar 2014 08:42:28 +0000 (09:42 +0100)]
functional cleanup for __attribute__((packed)) changes

This is to separate the functional changes from the noop consistency changes.

* Pack struct cper_mce_record rather than creating a structure named __packed
* Remove unreferenced struct xgt_desc
* Use two u16's rather than two u32 16-bit bitfields

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
Also drop now pointless (and always having been bogus) pack pragmas.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
11 years agolibxl: Add none to vga parameter
Fabio Fantoni [Thu, 13 Mar 2014 14:25:47 +0000 (15:25 +0100)]
libxl: Add none to vga parameter

Usage:
  vga="none"

Make possible to not have an emulated vga on hvm domUs.

Signed-off-by: Fabio Fantoni <fabio.fantoni@m2r.biz>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
Tested-by: Paul Durrant <paul.durrant@citrix.com>
11 years agotools/mfndump: Avoid unintentional NULL dereference
Andrew Cooper [Thu, 13 Mar 2014 11:09:07 +0000 (11:09 +0000)]
tools/mfndump: Avoid unintentional NULL dereference

If we failed to open an xc interface, using xch to log an error will end in
tears.  Print to stderr instead, as we are bailing immediately later.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Coverity-id: 1191885
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Dario Faggioli <dario.faggioli@citrix.com>
11 years agotools/libxc: fix errno handling for HVM in xc_domain_save
Ian Jackson [Thu, 13 Mar 2014 17:59:49 +0000 (17:59 +0000)]
tools/libxc: fix errno handling for HVM in xc_domain_save

The previous patch (dda0b77d "tools/libxc: pass errno to callers of
xc_domain_save") did not jump to the proper label if the domU is HVM.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Reviewed-by: Olaf Hering <olaf@aepfle.de>
11 years agotools/xcutils: xc_save: avoid allocing local constant string
Lai Jiangshan [Tue, 11 Mar 2014 14:15:24 +0000 (22:15 +0800)]
tools/xcutils: xc_save: avoid allocing local constant string

cmd_str doesn't need to be allocated.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agolibxl: simplify libxl__dirname()
Lai Jiangshan [Tue, 11 Mar 2014 14:15:22 +0000 (22:15 +0800)]
libxl: simplify libxl__dirname()

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agolibxl: fix memory leak in libxl__strndup()
Lai Jiangshan [Tue, 11 Mar 2014 14:15:21 +0000 (22:15 +0800)]
libxl: fix memory leak in libxl__strndup()

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agoMerge branch 'staging' of ssh://xenbits.xen.org/home/xen/git/xen into staging
Ian Campbell [Thu, 13 Mar 2014 13:58:27 +0000 (13:58 +0000)]
Merge branch 'staging' of ssh://xenbits.xen.org/home/xen/git/xen into staging

11 years agoconsole: Traditional console timestamps including milliseconds
Andrew Cooper [Thu, 13 Mar 2014 13:38:37 +0000 (14:38 +0100)]
console: Traditional console timestamps including milliseconds

Suggested-by: Don Slutz <dslutz@verizon.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
11 years agoconsole: provide timestamps as an offset since boot
Andrew Cooper [Thu, 13 Mar 2014 13:37:58 +0000 (14:37 +0100)]
console: provide timestamps as an offset since boot

This adds a new "Linux style" console timestamp method, which is shorter and
more useful than the current date/time timestamps with single-second
granularity.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
11 years agox86/time: initialise time earlier during start_secondary()
Andrew Cooper [Thu, 13 Mar 2014 13:37:04 +0000 (14:37 +0100)]
x86/time: initialise time earlier during start_secondary()

It is safe to do so, and useful for "[second.microseconds]" style timestamps
on printk()s during secondary bringup.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
11 years agotime: move wallclock_time() declaration into common code
Andrew Cooper [Thu, 13 Mar 2014 13:36:22 +0000 (14:36 +0100)]
time: move wallclock_time() declaration into common code

It is called from common code, but has architecture specific implementations.
Have one declaration instead of two.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
11 years agox86: make hypercall preemption checks consistent
Jan Beulich [Thu, 13 Mar 2014 13:27:51 +0000 (14:27 +0100)]
x86: make hypercall preemption checks consistent

- never preempt on the first iteration (ensure forward progress)
- never preempt on the last iteration (pointless/wasteful)

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Tim Deegan <tim@xen.org>
Acked-by: Keir Fraser <keir@xen.org>
11 years agocommon: make hypercall preemption checks consistent
Jan Beulich [Thu, 13 Mar 2014 13:26:35 +0000 (14:26 +0100)]
common: make hypercall preemption checks consistent

- never preempt on the first iteration (ensure forward progress)
- do cheap checks first

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Tim Deegan <tim@xen.org>
Acked-by: Keir Fraser <keir@xen.org>
11 years agox86: fix pirq path for pvh
Mukesh Rathor [Thu, 13 Mar 2014 13:24:19 +0000 (14:24 +0100)]
x86: fix pirq path for pvh

Just like hvm, pirq eoi shared page is not there for pvh. pvh should
not touch any pv_domain fields.

Signed-off-by: Mukesh Rathor <mukesh.rathor@oracle.com>
11 years agolibxl: Fix carefd lock leak in save callout
Ian Jackson [Mon, 24 Feb 2014 14:19:15 +0000 (14:19 +0000)]
libxl: Fix carefd lock leak in save callout

If libxl_pipe fails we leave the carefd locked, which translates to
the atfork lock remaining held.  This would probably cause the process
to deadlock shortly afterwards.

Of course libxl_pipe is very unlikely to fail unless things are
already going very badly.  This bug has not been observed anywhere as
far as we are aware.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
CC: George Dunlap <george.dunlap@eu.citrix.com>
11 years agolibxl: Hold the atfork lock while closing carefd
Ian Jackson [Mon, 24 Feb 2014 14:19:14 +0000 (14:19 +0000)]
libxl: Hold the atfork lock while closing carefd

This avoids the process being forked while a carefd is recorded in the
list but the actual fd has been closed.  If that happened, a
subsequent libxl_postfork_child_noexec would attempt to close the fd
again.  If we are lucky that results in a harmless warning; but if we
are unlucky the fd number has been reused and we close an unrelated
fd.

This race has not been observed anywhere as far as we are aware.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
CC: George Dunlap <george.dunlap@eu.citrix.com>
11 years agoxen: arm: correctly write release target in smp_spin_table_cpu_up
Ian Campbell [Tue, 14 Jan 2014 16:55:04 +0000 (16:55 +0000)]
xen: arm: correctly write release target in smp_spin_table_cpu_up

flush_xen_data_tlb_range_va() is clearly bogus since it flushes the tlb, not
the data cache. Perhaps what was meant was flush_xen_dcache(), but the address
was mapped with ioremap_nocache and hence isn't cached in the first place.
Accesses should be via writeq though, so do that.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
11 years agoxen: arm: prevent building with CONFIG_EARLY_PRINTK if not a debug build
Ian Campbell [Wed, 5 Mar 2014 01:02:29 +0000 (01:02 +0000)]
xen: arm: prevent building with CONFIG_EARLY_PRINTK if not a debug build

early printk on ARM is tied to debug being enabled, so error out instead of silently and unexpectedly building without early printk when asked.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
11 years agotools/xen-mceinj: Fix depency for the install rule
Andrew Cooper [Tue, 25 Feb 2014 10:54:14 +0000 (10:54 +0000)]
tools/xen-mceinj: Fix depency for the install rule

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Liu Jinsong <jinsong.liu@intel.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
11 years agoserial: Expand the PCI serial quirks for OXPCIe200 and OXPCIe952 1 Native UART
Konrad Rzeszutek Wilk [Fri, 7 Mar 2014 17:59:39 +0000 (12:59 -0500)]
serial: Expand the PCI serial quirks for OXPCIe200 and OXPCIe952 1 Native UART

This covers all of the OXPCIe952 1 Native UART and
OXPCIe200 1 Native UART chipsets.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
11 years agopci: Use #defines for PCI vendors.
Konrad Rzeszutek Wilk [Mon, 10 Mar 2014 16:53:52 +0000 (12:53 -0400)]
pci: Use #defines for PCI vendors.

Instead of having hard-coded values. We only do PCI vendors
as Jan requested and put all PCI device vendors in one
new file.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
[v1: Sorted them based on their numerical values per Jan's review]
Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
11 years agoserial: Seperate the PCI device ids and parameters (v1)
Konrad Rzeszutek Wilk [Fri, 7 Mar 2014 17:44:30 +0000 (12:44 -0500)]
serial: Seperate the PCI device ids and parameters (v1)

This will allow us to re-use the parameters for multiple PCI
devices.

No functional change.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
[v1: s/nr/idx/ of the enum, use __initconst and const by Jan's review]
Reviewed-by: Jan Beulich <jbeulich@suse.com>
11 years agoserial: Support OXPCIe952 aka Oxford Semiconductor Ltd Device c138 (1415:c138)
Konrad Rzeszutek Wilk [Sat, 1 Mar 2014 20:08:07 +0000 (15:08 -0500)]
serial: Support OXPCIe952 aka Oxford Semiconductor Ltd Device c138 (1415:c138)

Because they are PCIe and machine nowadys have those instead of
PCI, and they are inexpensive.

Tested with 1415:c138. Should also work on 0xc11f, 0xc11b models
of that chip.

Also on  OXPCIe200 1 Native UART 1415: 0xc40b, 0xc40f, 0xc41b,
0xc41f, 0xc42b, 0xc42f, 0xc43b, 0xc43f, 0xc44b, 0xc44f, 0xc45b
0xc45f, 0xc46b, 0xc46f, 0xc47b, 0xc47f, 0xc48b, 0xc48f, 0xc49b
0xc49f, 0xc4ab, 0xc4af, 0xc4bb, 0xc4bf, 0xc4cb, 0xc4cf

but since I don't have any of those cards this patch does not
enable it.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
[v1: Init for ARM and add offset to virt addr]
[v2: Remove the offset usage]
Tested-by: Aravind Gopalakrishnan <aravind.gopalakrishnan@amd.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
11 years agoserial: Fix COM1 assumption if pci_uart_config did not find the AMT card.
Konrad Rzeszutek Wilk [Fri, 7 Mar 2014 15:45:04 +0000 (10:45 -0500)]
serial: Fix COM1 assumption if pci_uart_config did not find the AMT card.

The io_base by default is set to be 0x3f8 for COM1 and 0x2f8 for COM2
in __setup_xen. Then we call 'ns16550_init' which copies those in
the appropriate uart, which then calls 'ns16550_parse_port_config'
to deal with parameter parsing. If the 'amt' parameter has been
specified we further call 'pci_uart_config code' which scans the PCI bus.

If it does not find the AMT device it would overwrite the io_base with
0x3f8 regardless whether this is COM1 or COM2 - but only if 'amt'
parameter had been specified.

The overwrite is a way to set it back to the failsafe defaults -
except for COM2 it is bogus.

Note again - if an AMT card is found, this over-write will not happen.

This in theory (as I don't have a machine with two COM ports
readily available) means that if the user specified 'com2=9600,8n1,amt'
and the device did not have an AMT serial device, instead of using
0x2f8 for the io_base it ends up using 0x3f8 - and we don't get the
output on COM2. If the user had done 'com2=9600,8n1' we would never
get in this path so this bug would never manifest itself
(because we don't end up scanning for the AMT device).

We also unconditionally reset the IRQ value - so we would never get the
proper interrupt when falling back to the legacy 0x3f8 and 0x2f8 COM ports.
That is OK - as we would end up using the polling mode - while
not the best - it still would work.

Lastly the clock_hz is also set to the default one (UART_CLOCK_HZ,
which is the same for legacy COM1 and COM2 ports)- that is strictly
not a bug, but it is redundant and not needed.

This bug was introduced with the original AMT support and I cannot
recall why it was done that way - it is a bug.

Fix it by saving the original io_base before starting the
scan of the PCI bus. If we don't find an serial PCI device (because
we did not exit out of the loop using return) then
assign the original io_base value back.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
[v1: Also remove the irq override spotted by Jan]
[v2: Add more details to the commit description]
Reviewed-by: Jan Beulich <jbeulich@suse.com>
11 years agoserial: Skip over PCIe device which have no quirks (fix AMT regression).
Konrad Rzeszutek Wilk [Wed, 5 Mar 2014 19:38:33 +0000 (14:38 -0500)]
serial: Skip over PCIe device which have no quirks (fix AMT regression).

The "ns16550: Add support for UART present in Broadcom TruManage
capable NetXtreme chips" implies that only devices that are have
an MMIO BAR and are in the quirks table should be processed.

Even the comment at the end says so:

 If we have an io_base, then we succeeded in the lookup

But the code was checking for the !io_base - which is to say if
the io_base was 0 then we would skip scanning. But io_base
always has a value - it is set by 'ns16550_init' to a default
value - so it would never hit the 'continue' path.

This means that if we have an communication device followed by
a serial AMT device we would pick the communication device instead
of the AMT device.

See:
00:16.0 Communication controller: Intel Corporation Cougar Point HECI Controller #1 (rev 04)
        Subsystem: Intel Corporation Device 2008
        Flags: bus master, fast devsel, latency 0, IRQ 11
        Memory at fb12a000 (64-bit, non-prefetchable) [size=16]
00:16.3 Serial controller: Intel Corporation Cougar Point KT Controller (rev 04) (prog-if 02 [16550])
        Subsystem: Intel Corporation Device 2008
        Flags: bus master, 66MHz, fast devsel, latency 0, IRQ 17
        I/O ports at f0e0 [size=8]
        Memory at fb129000 (32-bit, non-prefetchable) [size=4K]

pci 0000:00:16.0: [8086:1c3a] type 00 class 0x078000
pci 0000:00:16.3: [8086:1c3d] type 00 class 0x070002

And Xen picks 00:16.0 as its console when using 'com1=115200,8n1,amt'.

This patch fixes it and allows us to use AMT again by zeroing
out io_base to zero. If the scan did not work, the io_base is
set back to a default value (the 'pci_uart_config' does that
already at its end).

Tested-by: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
CC: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
CC: Thomas Lendacky <Thomas.Lendacky@amd.com>
CC: Keir Fraser <keir@xen.org>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
11 years agotools/libxl: Don't read off the end of tinfo[]
Andrew Cooper [Tue, 18 Feb 2014 15:59:05 +0000 (15:59 +0000)]
tools/libxl: Don't read off the end of tinfo[]

It is very common for BIOSes to advertise more cpus than are actually present
on the system, and mark some of them as offline.  This is what Xen does to
allow for later CPU hotplug, and what BIOSes common to multiple different
systems do to to save fully rewriting the MADT in memory.

An excerpt from `xl info` might look like:

...
nr_cpus                : 2
max_cpu_id             : 3
...

Which shows 4 CPUs in the MADT, but only 2 online (as this particular box is
the dual-core rather than the quad-core SKU of its particular brand)

Because of the way Xen exposes this information, a libxl_cputopology array is
bounded by 'nr_cpus', while cpu bitmaps are bounded by 'max_cpu_id + 1'.

The current libxl code has two places which erroneously assume that a
libxl_cputopology array is as long as the number of bits found in a cpu
bitmap, and valgrind complains:

==14961== Invalid read of size 4
==14961==    at 0x407AB7F: libxl__get_numa_candidate (libxl_numa.c:230)
==14961==    by 0x407030B: libxl__build_pre (libxl_dom.c:167)
==14961==    by 0x406246F: libxl__domain_build (libxl_create.c:371)
...
==14961==  Address 0x4324788 is 8 bytes after a block of size 24 alloc'd
==14961==    at 0x402669D: calloc (in/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==14961==    by 0x4075BB9: libxl__zalloc (libxl_internal.c:83)
==14961==    by 0x4052F87: libxl_get_cpu_topology (libxl.c:4408)
==14961==    by 0x407A899: libxl__get_numa_candidate (libxl_numa.c:342)
...

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
11 years agocoverity: Store the modelling file in the source tree.
Andrew Cooper [Wed, 19 Feb 2014 17:00:48 +0000 (17:00 +0000)]
coverity: Store the modelling file in the source tree.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Coverity Team <coverity@xenproject.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxl: Comment error handling in dolog
Ian Jackson [Wed, 19 Feb 2014 14:03:30 +0000 (14:03 +0000)]
xl: Comment error handling in dolog

Coverity-ID: 1087116
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
CC: coverity@xenproject.org
11 years agolibxl: Fix error path in libxl_device_events_handler
Ian Jackson [Wed, 19 Feb 2014 14:03:29 +0000 (14:03 +0000)]
libxl: Fix error path in libxl_device_events_handler

libxl_device_events_handler would fail to call AO_ABORT if it failed;
instead it would simply return rc.  (This leaves the egc etc. from the
now-abolished stack frame potentially live, and leaves the ctx
locked.)

In xl, this is of no consequence, because xl will immediately exit in
this situation.  This is very likely to be true in any other callers
(of which we don't know of any, anyway).

Coverity-ID: 1181840
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
CC: coverity@xenproject.org
11 years agoxl: honor more top level vfb options
Wei Liu [Tue, 28 Jan 2014 15:38:01 +0000 (15:38 +0000)]
xl: honor more top level vfb options

Now that SDL and keymap options for VFB can also be specified in top
level options. Documentation is also updated.

This fixes bug #31 and further possible problems.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Cc: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agotools: require OCaml version 3.09.3 or greater
Roger Pau Monne [Tue, 11 Feb 2014 10:38:24 +0000 (11:38 +0100)]
tools: require OCaml version 3.09.3 or greater

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Tested-by: Don Slutz <dslutz@verizon.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@citrix.com>
11 years agotools: rerun autogen.sh after version change
Ian Campbell [Wed, 12 Mar 2014 13:59:12 +0000 (13:59 +0000)]
tools: rerun autogen.sh after version change

94ad20b737bb "README, xen/Makefile: Branching for 4.5" changed the version.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/pygrub: grub2/grub.cfg from RHEL 7 has new commands in menuentry
Joby Poriyath [Tue, 4 Feb 2014 18:10:35 +0000 (18:10 +0000)]
xen/pygrub: grub2/grub.cfg from RHEL 7 has new commands in menuentry

menuentry in grub2/grub.cfg uses linux16 and initrd16 commands
instead of linux and initrd. Due to this RHEL 7 (beta) guest failed to
boot after the installation.

In addition to this, RHEL 7 menu entries have two different single-quote
delimited strings on the same line, and the greedy grouping for menuentry
parsing gets both strings, and the options inbetween.

Signed-off-by: Joby Poriyath <joby.poriyath@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: george.dunlap@citrix.com
11 years agoxen/arm: setup_dt_irq: don't enable the IRQ if the creation has failed
Julien Grall [Fri, 24 Jan 2014 16:43:36 +0000 (16:43 +0000)]
xen/arm: setup_dt_irq: don't enable the IRQ if the creation has failed

For now __setup_dt_irq can only fail if the action is already set. If in the
future, the function is updated we don't want to enable the IRQ.

Assuming the function can fail with action = NULL, when Xen will receive the
IRQ it will segfault because do_IRQ doesn't check if action is NULL.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/arm{32, 64}: fix section shift when mapping 2MB block in boot page table
Chen Baozi [Sun, 16 Feb 2014 16:09:26 +0000 (00:09 +0800)]
xen/arm{32, 64}: fix section shift when mapping 2MB block in boot page table

Section shift for level-2 page table should be #21 rather than #20. Besides,
since there are {FIRST,SECOND,THIRD}_SHIFT macros defined in asm/page.h, use
these macros instead of hard-coded shift value.

Signed-off-by: Chen Baozi <baozich@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/arm: pass a struct pending_irq* as parameter to gic helper functions
Stefano Stabellini [Tue, 17 Dec 2013 16:16:37 +0000 (16:16 +0000)]
xen/arm: pass a struct pending_irq* as parameter to gic helper functions

gic_add_to_lr_pending and gic_set_lr should take a struct pending_irq*
as parameter instead of the virtual_irq number and the priority
separately and doing yet another irq_to_pending lookup.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxend: remove ia64 from xend sources
Olaf Hering [Thu, 6 Mar 2014 16:13:52 +0000 (17:13 +0100)]
xend: remove ia64 from xend sources

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agopygrub: remote ia64 from pygrub
Olaf Hering [Thu, 6 Mar 2014 16:13:51 +0000 (17:13 +0100)]
pygrub: remote ia64 from pygrub

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agolibxc: remove ia64 from xg_private.h
Olaf Hering [Thu, 6 Mar 2014 16:13:50 +0000 (17:13 +0100)]
libxc: remove ia64 from xg_private.h

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agostubdom: remove ia64 from stubdom
Olaf Hering [Thu, 6 Mar 2014 16:13:49 +0000 (17:13 +0100)]
stubdom: remove ia64 from stubdom

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agodocs: remove ia64 from tmem-internals.html
Olaf Hering [Thu, 6 Mar 2014 16:13:48 +0000 (17:13 +0100)]
docs: remove ia64 from tmem-internals.html

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agodocs: remove ia64 from kexec_and_kdump.txt
Olaf Hering [Thu, 6 Mar 2014 16:13:46 +0000 (17:13 +0100)]
docs: remove ia64 from kexec_and_kdump.txt

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agotools: remove duplicate #includes
Matthew Daley [Thu, 5 Dec 2013 08:37:38 +0000 (21:37 +1300)]
tools: remove duplicate #includes

(From first party code; ie. not including tdb)

Signed-off-by: Matthew Daley <mattd@bugfuzz.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agolibxl: fix typo in comment
Ian Campbell [Tue, 18 Feb 2014 10:49:03 +0000 (10:49 +0000)]
libxl: fix typo in comment

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
11 years agopvh: call pit_init for pvh also
Mukesh Rathor [Tue, 11 Mar 2014 12:56:50 +0000 (13:56 +0100)]
pvh: call pit_init for pvh also

During halt of a pvh guest, the guest may do speaker shutdown. This
results in call to handle_speaker_io in xen. It will hang on the vpit
spin lock because it has not been initialized.
Since, pit_init is also called for both pv and hvm, the call is
moved to a more generic place.

Signed-off-by: Mukesh Rathor <mukesh.rathor@oracle.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
11 years agox86/MTRR: optionally print boot time state
Jan Beulich [Tue, 11 Mar 2014 12:55:50 +0000 (13:55 +0100)]
x86/MTRR: optionally print boot time state

... helping diagnosing eventual issues. Taken from Linux, with quite
a bit of cleanup.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
11 years agox86/MTRR: consolidation
Jan Beulich [Tue, 11 Mar 2014 12:53:38 +0000 (13:53 +0100)]
x86/MTRR: consolidation

- use a single set of manifest constants (the ones from msr-index.h)
- drop unnecessary MSR index constants
- get hvm_msr_{read,write}_intercept() in line with the rest of the
  MTRR emulation code regarding the number of emulated MTRRs
- remove use of hardcoded numbers where expressions can be used (at
  once serving as documentation)
- centrally check mtrr_state.have_fixed in get_fixed_ranges(), making
  unnecessary the cpu_has_mtrr check in mtrr_save_fixed_ranges

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
11 years agoAdd a "make rpmball" target
George Dunlap [Mon, 10 Mar 2014 12:46:56 +0000 (12:46 +0000)]
Add a "make rpmball" target

Build a simplistic dummy package, similar to "make debball", for
developers on rpm-based systems.

[ Fixed some trailing whitespace -iwj ]

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
CC: Ian Jackson <ian.jackson@citrix.com>
CC: Ian Campbell <ian.campbell@citrix.com>
CC: Dario Faggioli <dario.faggioli@citrix.com>
CC: Olaf Hering <olaf@aepfle.de>
CC: Don Slutz <dslutz@verizon.com>
CC: M A Young <m.a.young@durham.ac.uk>
Tested-by: Don Slutz <dslutz@verizon.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agotools/libxc: pass errno to callers of xc_domain_save
Olaf Hering [Tue, 11 Mar 2014 09:30:50 +0000 (10:30 +0100)]
tools/libxc: pass errno to callers of xc_domain_save

Callers of xc_domain_save use errno to print diagnostics if the call
fails. But xc_domain_save does not preserve the actual errno in case of
a failure.

This change preserves errno in all cases where code jumps to the label
"out". In addition a new label "exit" is added to catch also code which
used to do just "return 1".

Now libxl_save_helper:complete can print the actual error string.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agotools/libxc: preserve errno in ERROR and DRINTF macros
Olaf Hering [Tue, 11 Mar 2014 09:30:49 +0000 (10:30 +0100)]
tools/libxc: preserve errno in ERROR and DRINTF macros

This simplifies a changes made in a follow-up patch.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agotools/xcutils: Free xtl loggers after use
Andrew Cooper [Mon, 10 Mar 2014 17:06:16 +0000 (17:06 +0000)]
tools/xcutils: Free xtl loggers after use

While not much of a functional change, this prevents irritating warnings from
valgrind when trying to analyse xc_domain_{save,restore}() themselves.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
11 years agotools/ocaml: Ingore more OCaml test binaries
Andrew Cooper [Tue, 25 Feb 2014 18:46:14 +0000 (18:46 +0000)]
tools/ocaml: Ingore more OCaml test binaries

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: David Scott <dave.scott@eu.citrix.com>
Acked-by: David Scott <dave.scott@eu.citrix.com>
11 years agotools/libxc: assign positive values to errno
Olaf Hering [Fri, 7 Mar 2014 09:15:07 +0000 (10:15 +0100)]
tools/libxc: assign positive values to errno

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agotools/libxc: remove double inclusion of errno.h
Olaf Hering [Fri, 7 Mar 2014 09:15:06 +0000 (10:15 +0100)]
tools/libxc: remove double inclusion of errno.h

xc_private.h includes errno.h already

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agotools: Use --no-print-directory instead of grep for debball version
George Dunlap [Mon, 10 Mar 2014 12:46:55 +0000 (12:46 +0000)]
tools: Use --no-print-directory instead of grep for debball version

Save a fork, and also avoid :) being interpreted as a smiley.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
11 years agoxmalloc: handle correctly page allocation when align > size
Julien Grall [Mon, 10 Mar 2014 13:40:50 +0000 (14:40 +0100)]
xmalloc: handle correctly page allocation when align > size

When align is superior to size, we need to retrieve the order from
align during multiple page allocation. I guess it was the goal of the commit
fb034f42 "xmalloc: make close-to-PAGE_SIZE allocations more efficient".

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Keir Fraser <keir@xen.org>
11 years agoxenstored: add --master-domid to support domain builder
Daniel De Graaf [Tue, 4 Mar 2014 22:51:34 +0000 (17:51 -0500)]
xenstored: add --master-domid to support domain builder

When a domain builder stub domain is used, the initial xenstore
connection to domain 0 may use a different domain ID as the endpoint;
allow this domain ID to be specified on the command line.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
11 years agolibxl: Add LIBXL_HAVE_DEVICE_PCI_SEIZE
Ian Jackson [Mon, 10 Mar 2014 12:09:22 +0000 (12:09 +0000)]
libxl: Add LIBXL_HAVE_DEVICE_PCI_SEIZE

This was part of
  [PATCH v2 2/2] xl: Add "seize" option to PCI devices
but I accidentally applied v1.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
11 years agoxl: Add "seize" option to PCI devices
George Dunlap [Tue, 4 Mar 2014 13:38:19 +0000 (13:38 +0000)]
xl: Add "seize" option to PCI devices

The "seize" option tells the toolstack to attempt to automatically
unbind devices and re-bind them to the pciback driver.  This should
make creating VMs that habitually use pass-through (such as driver domain
VMs and gaming VMs) easier to use and manage.

[Whitespace error fixed by iwj.]

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
11 years agolibxl: Fail domain creation if pci assignment fails
George Dunlap [Tue, 4 Mar 2014 13:38:18 +0000 (13:38 +0000)]
libxl: Fail domain creation if pci assignment fails

Actually pay attention to the return value of libxl__device_pci_add.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
11 years agox86/time: always count s_time from Xen boot
Tim Deegan [Mon, 10 Mar 2014 10:18:49 +0000 (11:18 +0100)]
x86/time: always count s_time from Xen boot

Timestamped printks() can call NOW() before init_xen_time().
Set a baseline TSC as soon as we've calibrated the TSC rate,
so that NOW() consistently counts from boot time.

Signed-off-by: Tim Deegan <tim@xen.org>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
11 years agox86/schedule: remove noreturn from schedule_tail() function pointer
Andrew Cooper [Mon, 10 Mar 2014 10:18:05 +0000 (11:18 +0100)]
x86/schedule: remove noreturn from schedule_tail() function pointer

XenServer has recently had a support case where this bugframe in
context_switch() was hit, presumably from a corrupt function pointer as the
vcpu pointer was fine.

On balance, it is better to leave the bugframe around for peace of mind in
exceptional circumstances, than to use the optimisations provided by noreturn.

At any meaningful levels of optimisation, the noreturn causes the bugframe to
be optimised out, meaning that any exceptional returns fall into unlikely
branches, which will result in very weird behaviour.

The unreachable() in BUG() does the useful part of noreturn for us, allowing
the compiler not to mess about restoring stack frames etc, but causes a ud2
instruction to be present.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
11 years agox86/mwait_idle: support Intel Atom Processor C2000 product family
Len Brown [Mon, 10 Mar 2014 10:14:25 +0000 (11:14 +0100)]
x86/mwait_idle: support Intel Atom Processor C2000 product family

Support the "Intel(R) Atom(TM) Processor C2000 Product Family",
formerly code-named Avoton.  It is based on the next generation
Intel Atom processor architecture, formerly code-named Silvermont.

Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
11 years agox86/MCE: mctelem_init() cleanup
Jan Beulich [Mon, 10 Mar 2014 10:12:30 +0000 (11:12 +0100)]
x86/MCE: mctelem_init() cleanup

The function can be __init with its caller taking care of only calling
it on the BSP. And with that all its static variables can be dropped.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper@citrix.com>
Reviewed-by: Liu Jinsong <jinsong.liu@intel.com>
11 years agokexec: identify which cpu the kexec image is being executed on
Andrew Cooper [Mon, 10 Mar 2014 10:11:28 +0000 (11:11 +0100)]
kexec: identify which cpu the kexec image is being executed on

A patch to this effect has been in XenServer for a little while, and has
proved to be a useful debugging point for servers which have different
behaviours depending when crashing on the non-bootstrap processor.

Moving the printk() from kexec_panic() to one_cpu_only() means that it will
only be printed for the cpu which wins the race along the kexec path.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: David Vrabel <david.vrabel@citrix.com>
11 years agox86/HVM: adjust data definitions in mtrr.c
Jan Beulich [Mon, 10 Mar 2014 10:06:40 +0000 (11:06 +0100)]
x86/HVM: adjust data definitions in mtrr.c

- use proper section attributes
- use initializers where possible
- clean up pat_type_2_pte_flags()

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
11 years agox86/HVM: use manifest constants / enumerators for memory types
Jan Beulich [Mon, 10 Mar 2014 10:05:51 +0000 (11:05 +0100)]
x86/HVM: use manifest constants / enumerators for memory types

... instead of literal numbers, thus making it possible for the reader
to understand the code without having to look up the meaning of these
numbers.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
11 years agox86/HVM: consolidate passthrough handling in epte_get_entry_emt()
Jan Beulich [Mon, 10 Mar 2014 10:04:36 +0000 (11:04 +0100)]
x86/HVM: consolidate passthrough handling in epte_get_entry_emt()

It is inconsistent to depend on iommu_enabled alone: For a guest
without devices passed through to it, it is of no concern whether the
IOMMU is enabled.

There's one rather special case to take care of: VMX code marks the
LAPIC access page as MMIO. The added assertion needs to take this into
consideration, and the subsequent handling of the direct MMIO case was
inconsistent too: That page would have been WB in the absence of an
IOMMU, but UC in the presence of it, while in fact the cachabilty of
this page is entirely unrelated to an IOMMU being in use.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: "Xu, Dongxiao" <dongxiao.xu@intel.com>
Acked-by: Keir Fraser <keir@xen.org>
11 years agox86/HVM: fix memory type merging in epte_get_entry_emt()
Jan Beulich [Mon, 10 Mar 2014 10:03:53 +0000 (11:03 +0100)]
x86/HVM: fix memory type merging in epte_get_entry_emt()

Using the minimum numeric value of guest and host specified memory
types is too simplistic - it works only correctly for a subset of
types. It is in particular the WT/WP combination that needs conversion
to UC if the two types conflict.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: "Xu, Dongxiao" <dongxiao.xu@intel.com>
Acked-by: Keir Fraser <keir@xen.org>
11 years agox86/hvm: refine the judgment on IDENT_PT for EMT
Dongxiao Xu [Mon, 10 Mar 2014 10:02:25 +0000 (11:02 +0100)]
x86/hvm: refine the judgment on IDENT_PT for EMT

When trying to get the EPT EMT type, the judgment on
HVM_PARAM_IDENT_PT is not correct which always returns WB type if
the parameter is not set. Remove the related code.

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
We can't fully drop the dependency yet, but we should certainly avoid
overriding cases already properly handled. The reason for this is that
the guest setting up its MTRRs happens _after_ the EPT tables got
already constructed, and no code is in place to propagate this to the
EPT code. Without this check we're forcing the guest to run with all of
its memory uncachable until something happens to re-write every single
EPT entry. But of course this has to be just a temporary solution.

In the same spirit we should defer the "very early" (when the guest is
still being constructed and has no vCPU yet) override to the last
possible point.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: "Xu, Dongxiao" <dongxiao.xu@intel.com>
Acked-by: Keir Fraser <keir@xen.org>
11 years agox86/shadow: add a clarifying assertion
Jan Beulich [Thu, 6 Mar 2014 11:32:48 +0000 (11:32 +0000)]
x86/shadow: add a clarifying assertion

... documenting that we don't have to worry about merging guest
provided flags with the ones we want to enforce ourselves.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Tim Deegan <tim@xen.org>
11 years agoRevert "credit: change default timeslice to 5ms"
Jan Beulich [Thu, 6 Mar 2014 12:44:42 +0000 (13:44 +0100)]
Revert "credit: change default timeslice to 5ms"

This reverts commit 348dee3b8afb72cb4713d2e6600b4e86e0cc1723
(retracted by author/maintainer).

11 years agotmem: drop a gross goto usage
Konrad Rzeszutek Wilk [Thu, 6 Mar 2014 11:23:25 +0000 (12:23 +0100)]
tmem: drop a gross goto usage

No need to do it that way.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
11 years agocredit: change default timeslice to 5ms
George Dunlap [Thu, 6 Mar 2014 11:19:39 +0000 (12:19 +0100)]
credit: change default timeslice to 5ms

The 30ms timeslice was chosen nearly a decade ago now, with cpu
"burning" workloads in mind.  In the mean time, processors have gotten
faster and VMEXITs have gotten faster.  A timeslice of 30ms has a
major cost when running latency-sensitive workloads like network or
audio streaming: getting caught behind just one or two other VMs can
introduce a processing delay of up to 60ms, and the "round-robin"
nature of the credit scheduler means this delay may be introduced
every time the VM yields for periods of time.

The XenServer performance team at Citrix have done extensive testing
with various timeslices, including 30ms, 10ms, 5ms, and 2ms.  None of
the workloads exhibited any performance degradation with a 5ms
timeslice.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Reviewed-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
11 years agox86/hvm: assert that we we saved a sane number of MSRs.
Tim Deegan [Thu, 27 Feb 2014 15:06:33 +0000 (15:06 +0000)]
x86/hvm: assert that we we saved a sane number of MSRs.

Just as a backstop measure against later changes that add MSRs to the
save function without updating the count in the init function.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
11 years agobitmaps/bitops: Clarify tests for small constant size.
Tim Deegan [Thu, 28 Nov 2013 15:40:48 +0000 (15:40 +0000)]
bitmaps/bitops: Clarify tests for small constant size.

No semantic changes, just makes the control flow a bit clearer.

I was looking at this bcause the (-!__builtin_constant_p(x) | x__)
formula is too clever for Coverity, but in fact it always takes me a
minute or two to understand it too. :)

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
11 years agox86/mem_sharing: drop unused variable.
Tim Deegan [Thu, 28 Nov 2013 15:02:39 +0000 (15:02 +0000)]
x86/mem_sharing: drop unused variable.

Coverity CID 1087198

Signed-off-by: Tim Deegan <tim@xen.org>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>