]> xenbits.xensource.com Git - xen.git/log
xen.git
11 years agoRevert "xen/arm: Allocate memory for dom0 from the bottom with the 1:1 Workaround"
Ian Campbell [Wed, 2 Apr 2014 12:03:36 +0000 (13:03 +0100)]
Revert "xen/arm: Allocate memory for dom0 from the bottom with the 1:1 Workaround"

This reverts commit 6c21cb36e263de2db8716b477157a5b6cd531e1e.

The Linux = issue which this works around was fixed in v3.13 via f52bb722547f
"ARM: mm: Correct virt_to_phys patching for 64 bit physical addresses".

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
11 years agoxen: arm32: don't force the compiler to allocate a dummy register
Ian Campbell [Thu, 3 Apr 2014 08:59:43 +0000 (09:59 +0100)]
xen: arm32: don't force the compiler to allocate a dummy register

TLBIALLH, ICIALLU and BPIALL make no use of their register argument. Instead
of making the compiler allocate a dummy register just hardcode r0, there is no
need to represent this in the inline asm since the register is neither
clobbered nor used in any way.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
11 years agoxen: arm: flush TLB on all CPUs when setting or clearing fixmaps
Ian Campbell [Thu, 3 Apr 2014 08:59:42 +0000 (09:59 +0100)]
xen: arm: flush TLB on all CPUs when setting or clearing fixmaps

These mappings are global and therefore need flushing on all processors. Add
flush_all_xen_data_tlb_range_va which accomplishes this.

Likewise when removing the early mappings

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
[ ijc -- fixed coding style ]

11 years agoxen: arm: consolidate body of flush_xen_data_tlb_range_va_local
Ian Campbell [Thu, 3 Apr 2014 08:59:41 +0000 (09:59 +0100)]
xen: arm: consolidate body of flush_xen_data_tlb_range_va_local

This is almost identical on both sub architectures.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
[ ijc -- fixed coding style ]

11 years agoxen: arm: clarify naming of the Xen TLB flushing functions
Ian Campbell [Thu, 3 Apr 2014 08:59:40 +0000 (09:59 +0100)]
xen: arm: clarify naming of the Xen TLB flushing functions

All of the flush_xen_*_tlb functions operate on the local processor only. Add
_local to the name and update the comments to clarify.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
11 years agox86/mm: fix checks against max_mapped_pfn
Jan Beulich [Thu, 3 Apr 2014 07:47:28 +0000 (08:47 +0100)]
x86/mm: fix checks against max_mapped_pfn

This value is an inclusive one, i.e. this fixes an off-by-one in memory
sharing and an off-by-two in shadow code.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Tim Deegan <tim@xen.org>
11 years agox86/HVM: fix setting mem access to default
Jan Beulich [Wed, 2 Apr 2014 08:09:33 +0000 (09:09 +0100)]
x86/HVM: fix setting mem access to default

commit 3b0bcb89 ("x86/mm/p2m: Move p2m code in HVMOP_[gs]et_mem_access
into p2m.c") introduced an off-by-one mistake forcing an input of
HVMMEM_access_default to always fail. Since related, also eliminate the
inefficient setup of an on-stack array for each function invocation.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Tim Deegan <tim@xen.org>
11 years agox86/HVM: fix preemption handling in do_hvm_op() (try 2)
Jan Beulich [Wed, 2 Apr 2014 08:09:00 +0000 (09:09 +0100)]
x86/HVM: fix preemption handling in do_hvm_op() (try 2)

Just like previously done for some mem-op hypercalls, undo preemption
using the interface structures (altering it in ways the caller may not
expect) and replace it by storing the continuation point in the high
bits of sub-operation argument.

This also changes the "nr" fields of struct xen_hvm_track_dirty_vram
(operation already limited to 1Gb worth of pages) and struct
xen_hvm_modified_memory to be only 32 bits wide, consistent with those
of struct xen_set_mem{type,access}. If that's not acceptable for some
reason, we'd need to shrink the HVMOP_op_bits (while still enforcing
the [then higher] limit resulting from the need to be able to encode
the continuation).

Whether (and if so how) to adjust xc_hvm_track_dirty_vram(),
xc_hvm_modified_memory(), xc_hvm_set_mem_type(), and
xc_hvm_set_mem_access() to reflect the 32-bit restriction on "nr" is
unclear: If the APIs need to remain stable, all four functions should
probably check that there was no truncation. Preferably their
parameters would be changed to uint32_t or unsigned int, though.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Tim Deegan <tim@xen.org>
11 years agox86/mm: Fix compile with DEBUG_TRACE_DUMP turned on
Aravindh Puthiyaparambil [Tue, 1 Apr 2014 00:32:54 +0000 (17:32 -0700)]
x86/mm: Fix compile with DEBUG_TRACE_DUMP turned on

Signed-off-by: Aravindh Puthiyaparambil <aravindp@cisco.com>
Acked-by: Tim Deegan <tim@xen.org>
11 years agocommon/domctl: some functions are only used internally
Julien Grall [Wed, 2 Apr 2014 15:46:35 +0000 (17:46 +0200)]
common/domctl: some functions are only used internally

The list of function above are only used internally in common/domctl.c.
    - bitmap_to_xenctl_bitmap
    - xenctl_bitmap_to_bitmap
    - nodemask_to_xenctl_bitmap
    - xenctl_bitmap_to_nodemask

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Keir Fraser <keir@xen.org>
11 years agoMerge branch 'staging' of ssh://xenbits.xen.org/home/xen/git/xen into staging
Ian Campbell [Wed, 2 Apr 2014 13:15:56 +0000 (14:15 +0100)]
Merge branch 'staging' of ssh://xenbits.xen.org/home/xen/git/xen into staging

11 years agons16550: make some initialisation common
Ian Campbell [Wed, 26 Mar 2014 11:55:55 +0000 (11:55 +0000)]
ns16550: make some initialisation common

Should avoid accidents like forgetting to init lsr_mask for DT devices in the
future.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Keir Fraser <keir@xen.org>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
11 years agons16550: setup default lsr_mask for DT systems too
Ian Campbell [Wed, 26 Mar 2014 11:55:54 +0000 (11:55 +0000)]
ns16550: setup default lsr_mask for DT systems too

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Tested-By: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Tested-By: Chen Baozi <baozich@gmail.com>
Cc: keir@xen.org
11 years agocrypto: rijndael: fix compilation with Clang 3.5
Julien Grall [Tue, 1 Apr 2014 16:24:43 +0000 (18:24 +0200)]
crypto: rijndael: fix compilation with Clang 3.5

Td0, Td1, Td2, Td3, Td4 are only used when NEED_RIJNDAEL is defined.

rijndael.c:383:18: error: unused variable 'Td0' [-Werror,-Wunused-const-variable]
static const u32 Td0[256] = {
                 ^
rijndael.c:449:18: error: unused variable 'Td1' [-Werror,-Wunused-const-variable]
static const u32 Td1[256] = {
                 ^
rijndael.c:515:18: error: unused variable 'Td2' [-Werror,-Wunused-const-variable]
static const u32 Td2[256] = {
                 ^
rijndael.c:581:18: error: unused variable 'Td3' [-Werror,-Wunused-const-variable]
static const u32 Td3[256] = {
                 ^
rijndael.c:647:18: error: unused variable 'Td4' [-Werror,-Wunused-const-variable]
static const u32 Td4[256] = {

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Keir Fraser <keir@xen.org>
11 years agoevtchn: rearrange fields
Daniel De Graaf [Tue, 1 Apr 2014 16:22:40 +0000 (18:22 +0200)]
evtchn: rearrange fields

Event channel arrays are allocated in blocks with EVTCHNS_PER_BUCKET
elements, which must be a power of 2.  When XSM is disabled, struct
evtchn is 32 bytes including padding; however, when XSM is enabled, the
structure becomes larger and EVTCHNS_PER_BUCKET is halved.  Rearranging
some of the fields in struct evtchn allows a 4-byte XSM field to fit
within the 32-byte structure.

This rearrangement turns the xen_consumer field of struct evtchn into a
bitfield and adjusts the xen_consumers array to fit the number of
addressable elements from this value.  Since there are currently only
two users of this array, only 3 bits (7 values) are reserved.  This
field is also used rarely enough that the slight overhead from applying
a bitmask should not cause problems.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
11 years agofix sed usage in build rules
Jan Beulich [Tue, 1 Apr 2014 16:21:43 +0000 (18:21 +0200)]
fix sed usage in build rules

Apparently FreeBSD sed is more picky than GNU sed, wanting a semicolon
at the end of a brace enclosed statement list.

Reported-by: Roger Pau Monné<roger.pau@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
11 years agoinclude: fix Makefile for FreeBSD
Jan Beulich [Tue, 1 Apr 2014 16:20:58 +0000 (18:20 +0200)]
include: fix Makefile for FreeBSD

Don't use non-standard extensions:
- \t in bracket expressions
- \+ in basic regular expressions

Reported-by: Roger Pau Monné<roger.pau@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Roger Pau Monné<roger.pau@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
11 years agoVMX: fix PAT value seen by guest
Jan Beulich [Tue, 1 Apr 2014 14:49:18 +0000 (16:49 +0200)]
VMX: fix PAT value seen by guest

The XSA-60 fixes introduced a window during which the guest PAT gets
forced to all zeros. This shouldn't be visible to the guest. Therefore
we need to intercept PAT MSR accesses during that time period.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Liu Jinsong <jinsong.liu@intel.com>
11 years agokexec: propagate ENOMEM result in error handling
Matthew Daley [Tue, 1 Apr 2014 14:48:02 +0000 (16:48 +0200)]
kexec: propagate ENOMEM result in error handling

...otherwise if kimage_alloc_control_page fails (presumably due to
out-of-memory; see the invocation just before this one), the caller of
do_kimage_alloc will think the call was successful.

Signed-off-by: Matthew Daley <mattd@bugfuzz.com>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
11 years agocpupool: cpupool_unassign_cpu is only used internally
Julien Grall [Tue, 1 Apr 2014 14:44:50 +0000 (16:44 +0200)]
cpupool: cpupool_unassign_cpu is only used internally

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
11 years agopv-grub: correct sizeof usage
Matthew Daley [Sat, 29 Mar 2014 05:08:08 +0000 (18:08 +1300)]
pv-grub: correct sizeof usage

We were lucky that sizeof(frame) >= sizeof(*frame) anyway.

Signed-off-by: Matthew Daley <mattd@bugfuzz.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/arm: Replace early_{printk, panic} call to {printk, panic} call
Julien Grall [Thu, 13 Mar 2014 15:09:18 +0000 (15:09 +0000)]
xen/arm: Replace early_{printk, panic} call to {printk, panic} call

Now that the console supports earlyprintk, we can get a rid of
early_printk and early_panic calls.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/console: Add support for early printk
Julien Grall [Thu, 13 Mar 2014 15:09:17 +0000 (15:09 +0000)]
xen/console: Add support for early printk

On ARM, a function (early_printk) was introduced to output message when the
serial port is not initialized.

This solution is fragile because the developper needs to know when the serial
port is initialized, to use either early_printk or printk. Moreover some
functions (mainly in common code), only use printk. This will result to a loss
of message sometimes.

Directly call early_printk in console code when the serial port is not yet
initialized. For this purpose use serial_steal_fn.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Keir Fraser <keir@xen.org>
11 years agoxen/arm: Rename EARLY_PRINTK compile option to CONFIG_EARLY_PRINTK
Julien Grall [Thu, 13 Mar 2014 15:09:16 +0000 (15:09 +0000)]
xen/arm: Rename EARLY_PRINTK compile option to CONFIG_EARLY_PRINTK

Most of common compile option start with CONFIG_. Rename EARLY_PRINTK option
to CONFIG_EARLY_PRINTK to be compliant.

This option will be used in common code (eg console) later.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/arm: earlyprintk: export early_puts
Julien Grall [Thu, 13 Mar 2014 15:09:15 +0000 (15:09 +0000)]
xen/arm: earlyprintk: export early_puts

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Cambpell <ian.campbell@citrix.com>
11 years agoxen/arm: earlyprintk: move early_flush in early_puts
Julien Grall [Thu, 13 Mar 2014 15:09:14 +0000 (15:09 +0000)]
xen/arm: earlyprintk: move early_flush in early_puts

early_puts function will be exported to be used in the console code. To
avoid loosing characters (see why in commit cafdceb "xen/arm: avoid lost
characters with early_printk), early_flush needs to be called in this
function.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/serial: Don't leak memory mapping if the serial initialization has failed
Julien Grall [Fri, 28 Mar 2014 15:11:57 +0000 (15:11 +0000)]
xen/serial: Don't leak memory mapping if the serial initialization has failed

The memory mapping leaked when the serial driver failed to retrieve
the IRQ. We can safely move the call to ioremap after.

Also use ioremap_cache instead of ioremap_attr in some serial drivers.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
11 years agoxen/arm: Don't need to export p2m_load_VTTBR
Julien Grall [Wed, 19 Mar 2014 15:43:39 +0000 (15:43 +0000)]
xen/arm: Don't need to export p2m_load_VTTBR

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Tim Deegan <tim@xen.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/arm: Use p2m_restore_state in construct_dom0
Julien Grall [Wed, 19 Mar 2014 15:43:38 +0000 (15:43 +0000)]
xen/arm: Use p2m_restore_state in construct_dom0

The address translation functions used while building dom0 rely on certain EL1
state being configured. In particular they are subject to the behaviour of
SCTLR_EL1.M (stage 1 MMU enabled).

The Xen (and Linux) boot protocol require that the kernel be entered with the
MMU disabled but they don't say anything explicitly about exception levels
other than the one which is active when entering the kernels. Arguably the
protocol could be said to apply to all exception levels but in any case we
should cope with this and setup the EL1 state as necessary.

Fu Wei discovered this when booting Xen from grub.efi over UEFI, it's not
clear whether grub or UEFI is responsible for leaving stage 1 MMU enabled.

Use directly the newly created function p2m_restore_state to retrieve a
correct EL1 state to translate an address.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Reported-by: Fu Wei <fu.wei@linaro.org>
Acked-by: Tim Deegan <tim@xen.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/arm: Move p2m context save/restore in a separate function
Julien Grall [Wed, 19 Mar 2014 15:43:37 +0000 (15:43 +0000)]
xen/arm: Move p2m context save/restore in a separate function

Introduce p2m_{save,restore}_state to save/restore p2m context.

The both functions will take care of:
    - VTTBR: contains the pointer to the domain P2M
    - Update HCR_RW if the domain is 64 bit
    - SCTLR: contains bit to know if the MMU is enabled or not

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Tim Deegan <tim@xen.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agodocs/Makefile: Split the install target
Andrew Cooper [Fri, 28 Mar 2014 11:24:05 +0000 (11:24 +0000)]
docs/Makefile: Split the install target

Split the current install target into two subtargets, install-man-pages and
install-html, with the main install target depending on both.

This helps packagers who want the man pages to put in appropriate rpms/debs,
but don't want to build the html developer docs.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
11 years agodocs: Honour --{en, dis}able-xend when building docs
Andrew Cooper [Fri, 28 Mar 2014 11:24:04 +0000 (11:24 +0000)]
docs: Honour --{en, dis}able-xend when building docs

If a user has specified --disable-xend, they wont want the manpages either.

Propagating this parameters requires reorganising the way in which the
makefile chooses which documents to build.

There is now a split of {MAN1,MAN5,MARKDOWN,TXT}SRC-y to select which
documentation to build, which is separate from the patsubst section which
generates appropriate paths to trigger the later rules.

The manpages are quite easy to split between xend, xl and xenstore, and have
been.  Items from misc/ are much harder and been left.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
[ ijc -- reran autogen.sh as requested. ]

11 years agotools/libxl: Introduce libxl__malloc()
Andrew Cooper [Thu, 27 Mar 2014 17:41:55 +0000 (17:41 +0000)]
tools/libxl: Introduce libxl__malloc()

For those large allocations which are going to be filled immediately, where
redundantly clearing the memory would just be a waste of time.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
11 years agotools/libxl: Correct libxl__zalloc() to take an unsigned number of bytes
Andrew Cooper [Thu, 27 Mar 2014 17:41:54 +0000 (17:41 +0000)]
tools/libxl: Correct libxl__zalloc() to take an unsigned number of bytes

Convert 'int bytes' to 'size_t size' to mirror malloc(3) which it is
imitating, and calloc(3) which it is actually using.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
11 years agoMAINTAINERS: Add ARM UART drivers to "ARM ARCHITECTURE" part
Julien Grall [Wed, 12 Mar 2014 10:12:29 +0000 (10:12 +0000)]
MAINTAINERS: Add ARM UART drivers to "ARM ARCHITECTURE" part

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Keir Fraser <keir@xen.org>
11 years agoRevert "x86/HVM: fix preemption handling in do_hvm_op()"
Jan Beulich [Tue, 1 Apr 2014 08:41:29 +0000 (10:41 +0200)]
Revert "x86/HVM: fix preemption handling in do_hvm_op()"

This reverts commit 8bad6c5626129ffba04dbab3a38115b6f3669596
(clearly broken for 32-bit callers, reportedly broken also
for 64-bit Dom0 with qemu-trad).

11 years agopublic/platform.h: replace unsigned long with xen_ulong_t
Stefano Stabellini [Fri, 28 Mar 2014 12:48:39 +0000 (13:48 +0100)]
public/platform.h: replace unsigned long with xen_ulong_t

Replace unsigned long with xen_ulong_t in public/platform.h.
Also replace unsigned int with uint32_t for clarity. It is safe because
unsigned int are 4 byte sized and 4 byte aligned an all the supported
architectures.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
11 years agox86/vMTRR: pass domain to mtrr_*_msr_set()
Jan Beulich [Fri, 28 Mar 2014 12:44:44 +0000 (13:44 +0100)]
x86/vMTRR: pass domain to mtrr_*_msr_set()

This is in preparation for the next patch, and mtrr_def_type_msr_set()
and mtrr_fix_range_msr_set() in sync with mtrr_var_range_msr_set() in
this regard.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Tim Deegan <tim@xen.org>
11 years agox86/EPT: relax treatment of APIC MFN
Jan Beulich [Fri, 28 Mar 2014 12:43:25 +0000 (13:43 +0100)]
x86/EPT: relax treatment of APIC MFN

There's no point in this being mapped UC by the guest due to using a
respective PAT index - set the ignore-PAT flag to true.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Tim Deegan <tim@xen.org>
11 years agox86/EPT: also dump permissions and memory types
Jan Beulich [Fri, 28 Mar 2014 12:42:43 +0000 (13:42 +0100)]
x86/EPT: also dump permissions and memory types

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Tim Deegan <tim@xen.org>
11 years agox86/EPT: simplification and cleanup
Jan Beulich [Fri, 28 Mar 2014 12:37:10 +0000 (13:37 +0100)]
x86/EPT: simplification and cleanup

- drop rsvd*_ prefixes from fields not really reserved anymore
- replace odd uses of <expr> ? 1 : 0
- drop pointless variables from ept_set_entry()
- streamline IOMMU mirroring code in ept_set_entry()
- don't open code is_epte_valid() (and properly use it when dumping)
- streamline entry cloning in ept_split_super_page()
- compact dumping code and output

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Tim Deegan <tim@xen.org>
11 years agox86/p2m: make p2m_change_type() behavior match p2m_change_entry_type_global()'s
Jan Beulich [Fri, 28 Mar 2014 12:36:19 +0000 (13:36 +0100)]
x86/p2m: make p2m_change_type() behavior match p2m_change_entry_type_global()'s

- don't reset access permissions
- don't shatter super pages

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Tim Deegan <tim@xen.org>
11 years agox86/HVM: correct CPUID leaf 80000008 handling
Jan Beulich [Fri, 28 Mar 2014 12:33:34 +0000 (13:33 +0100)]
x86/HVM: correct CPUID leaf 80000008 handling

CPUID[80000008].EAX[23:16] have been given the meaning of the guest
physical address restriction (in case it needs to be smaller than the
host's), hence we need to mirror that into vCPUID[80000008].EAX[7:0].

Enforce a lower limit at the same time, as well as a fixed value for
the virtual address bits, and zero for the guest physical address ones.

In order for the vMTRR code to see these overrides we need to make it
call hvm_cpuid() instead of domain_cpuid(), which in turn requires
special casing (and relaxing) the controlling domain.

This additionally should hide an ordering problem in the tools: Both
xend and xl appear to be restoring a guest from its image before
setting up the CPUID policy in the hypervisor, resulting in
domain_cpuid() returning all zeros and hence the check in
mtrr_var_range_msr_set() failing if the guest previously had more than
the minimum 36 physical address bits.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Tim Deegan <tim@xen.org>
11 years agox86/HVM: fix preemption handling in do_hvm_op()
Jan Beulich [Fri, 28 Mar 2014 12:31:23 +0000 (13:31 +0100)]
x86/HVM: fix preemption handling in do_hvm_op()

Just like previously done for some mem-op hypercalls, undo preemption
using the interface structures (altering it in ways the caller may not
expect) and replace it by storing the continuation point in the high
bits of sub-operation argument.

This also changes the "nr" fields of struct xen_hvm_track_dirty_vram
(operation already limited to 1Gb worth of pages) and struct
xen_hvm_modified_memory to be only 32 bits wide, consistent with those
of struct xen_set_mem{type,access}. If that's not acceptable for some
reason, we'd need to shrink the HVMOP_op_bits (while still enforcing
the [then higher] limit resulting from the need to be able to encode
the continuation).

Whether (and if so how) to adjust xc_hvm_track_dirty_vram(),
xc_hvm_modified_memory(), xc_hvm_set_mem_type(), and
xc_hvm_set_mem_access() to reflect the 32-bit restriction on "nr" is
unclear: If the APIs need to remain stable, all four functions should
probably check that there was no truncation. Preferably their
parameters would be changed to uint32_t or unsigned int, though.

As a minor cleanup, along with introducing the switch-wide "pfn" the
redundant "d" is also being converted to a switch-wide one.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Tim Deegan <tim@xen.org>
11 years agox86/HVM: simplify do_hvm_op()
Jan Beulich [Fri, 28 Mar 2014 12:30:10 +0000 (13:30 +0100)]
x86/HVM: simplify do_hvm_op()

- boundary checks in HVMOP_modified_memory, HVMOP_set_mem_type, and
  HVMOP_set_mem_access: all of these already check for overflow, so
  there's no need to range check the first _and_ last PFN (checking
  the last one suffices)
- copying back interface structures that were previously copied from
  guest memory can use __copy_to_...(), since copy_from_...() already
  did the address range validation

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Tim Deegan <tim@xen.org>
11 years agoxend/pvscsi: recognize also SCSI CDROM devices
Olaf Hering [Tue, 11 Feb 2014 14:27:24 +0000 (15:27 +0100)]
xend/pvscsi: recognize also SCSI CDROM devices

Attaching a CDROM device with 'xm scsi-attach domU /dev/sr0 0:0:0:0'
fails because for some reason the sr driver was not handled at all in
the match list. With the change the above command succeeds and the
device is attached.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Matt Wilson <msw@amazon.com>
11 years agotools/xend: move assert to exception block
Olaf Hering [Mon, 10 Feb 2014 07:57:34 +0000 (08:57 +0100)]
tools/xend: move assert to exception block

The two assert in restore trigger sometimes after hundreds of
migrations. If they trigger the destination host will not destroy the
newly created, yet empty guest. After a second migration attempt to this
host there will be two guets with the same name and uuid. This situation
is poorly handled by the xm tools.
With this change the empty guest will be destroyed.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Matt Wilson <msw@amazon.com>
11 years agoAvoid said the /dev/xvd* is already defined after
Yi Li [Wed, 19 Mar 2014 14:54:16 +0000 (22:54 +0800)]
Avoid said the /dev/xvd* is already defined after

open a vhd file failed

For example:
[root@dom0_134_103 ~]# xm block-attach 0
tap2:tapdisk:vhd:/root/liyi***.vhd /dev/xvdz  w
Error: ('create', '-avhd:/root/liyi***.vhd') failed (512  )
Usage: xm block-attach <Domain> <BackDev> <FrontDev> <Mode> [BackDomain]
Create a new virtual block device.

[root@dom0_134_103 ~]# xm block-attach 0
tap2:tapdisk:vhd:/root/liyi.vhd /dev/xvdz  w
Error: The device "/dev/xvdz" is already defined
Usage: xm block-attach <Domain> <BackDev> <FrontDev> <Mode> [BackDomain]

Create a new virtual block device.

Signed-off-by: Yi Li <peteryili@tencent.com>
Acked-by: Matt Wilson <msw@amazon.com>
11 years agolibxc: domain restore: fold redundant variables
Jan Beulich [Mon, 24 Mar 2014 12:14:05 +0000 (12:14 +0000)]
libxc: domain restore: fold redundant variables

"vcpuextstate_size" being non-zero fully expresses "vcpuextstate" being
true - drop the latter.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/arm: Add support for XSM
Julien Grall [Fri, 21 Mar 2014 15:22:14 +0000 (15:22 +0000)]
xen/arm: Add support for XSM

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/xsm: Add support for device tree
Julien Grall [Fri, 21 Mar 2014 15:22:13 +0000 (15:22 +0000)]
xen/xsm: Add support for device tree

This patch adds a new module "xen,xsm-policy" to allow the user to load the XSM
policy when Xen is booting.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/xsm: Add xsm_core_init function
Julien Grall [Fri, 21 Mar 2014 15:22:12 +0000 (15:22 +0000)]
xen/xsm: Add xsm_core_init function

This function contains non-specific architecture code (mostly the tail of
xsm_multiboot_init). It will be used later to avoid code duplication.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
11 years agoxen/xsm: Don't use multiboot by default to initialize XSM
Julien Grall [Fri, 21 Mar 2014 15:22:11 +0000 (15:22 +0000)]
xen/xsm: Don't use multiboot by default to initialize XSM

Multiboot protocol is only used by x86. When XSM support for ARM will be
introduced, another way will be used to retrieve the policy blob.

Introduce CONFIG_MULTIBOOT to compile XSM specific multiboot code and
rename xsm_init into xsm_multiboot_init to avoid confusion.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Keir Fraser <keir@xen.org>
11 years agox86: identify which vcpu's CR4 is being badly modified
Andrew Cooper [Wed, 26 Mar 2014 14:36:13 +0000 (15:36 +0100)]
x86: identify which vcpu's CR4 is being badly modified

When the toolstack is setting vcpu state on behalf of a migrating guest, the
domain/vcpu reference from gdprintk() identifies the toolstack, not the
affected domain.

After this change, the error looks more like:

  (XEN) d0 attempted to change d6v0's CR4 flags 00002660 -> 01876000

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
11 years agocredit2: Some functions are only used internally
Julien Grall [Wed, 26 Mar 2014 14:35:15 +0000 (15:35 +0100)]
credit2: Some functions are only used internally

The list of function above are only used internally in common/sched_credit2.c
    - migrate
    - update_max_weight

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
11 years agocommon: sched_sedf: Remove unused functions
Julien Grall [Wed, 26 Mar 2014 14:34:29 +0000 (15:34 +0100)]
common: sched_sedf: Remove unused functions

Clang 3.5 will fail to compile xen/common/sched_sedf.c because some function
are not used:

sched_sedf.c:141:20: error: unused function 'extraq_add_head' [-Werror,-Wunused-function]
static inline void extraq_add_head(struct vcpu *d, int i)
                       ^
sched_sedf.c:147:20: error: unused function 'extraq_add_tail' [-Werror,-Wunused-function]
static inline void extraq_add_tail(struct vcpu *d, int i)

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
11 years agoxsm: flask: flask_disable is only used internally
Julien Grall [Wed, 26 Mar 2014 14:33:01 +0000 (15:33 +0100)]
xsm: flask: flask_disable is only used internally

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
11 years agoxsm: flask: ss: remove unused function determine_oocontext
Julien Grall [Wed, 26 Mar 2014 14:32:49 +0000 (15:32 +0100)]
xsm: flask: ss: remove unused function determine_oocontext

This function is not used neither exported.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
11 years agoxsm: flask: Remove unused function avc_sidcmp
Julien Grall [Wed, 26 Mar 2014 14:29:34 +0000 (15:29 +0100)]
xsm: flask: Remove unused function avc_sidcmp

Fix compilation with Clang 3.5:

avc.c:657:19: error: unused function 'avc_sidcmp' [-Werror,-Wunused-function]
static inline int avc_sidcmp(u32 x, u32 y)
                      ^

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
11 years agox86: enforce preemption in HVM_set_mem_access / p2m_set_mem_access()
Jan Beulich [Tue, 25 Mar 2014 14:23:57 +0000 (15:23 +0100)]
x86: enforce preemption in HVM_set_mem_access / p2m_set_mem_access()

Processing up to 4G PFNs may take almost arbitrarily long, so
preemption is needed here.

This is XSA-89.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Tim Deegan <tim@xen.org>
11 years agoevtchn: optimize XSM ssid field
Daniel De Graaf [Mon, 24 Mar 2014 09:55:26 +0000 (10:55 +0100)]
evtchn: optimize XSM ssid field

When FLASK is the only enabled implementation of the XSM hooks in Xen,
some of the abstractions required to handle multiple XSM providers are
redundant and only produce unneeded overhead.  This patch reduces the
memory overhead of enabling XSM on event channels by replacing the
untyped ssid pointer from struct evtchn with a union containing the
contents of the structure.  This avoids an additional heap allocation
for every event channel, and on 64-bit systems, reduces the size of
struct evtchn by 4 bytes.  If an out-of-tree XSM module needs the full
flexibility of the generic evtcnn ssid pointer, defining the symbol
XSM_NEED_GENERIC_EVTCHN_SSID will include a suitable pointer field.

This also cleans up the unused selinux_checkreqprot declaration left
from the Linux port.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
11 years agoxsm: Reduce compiler command line clutter
Daniel De Graaf [Mon, 24 Mar 2014 09:54:27 +0000 (10:54 +0100)]
xsm: Reduce compiler command line clutter

Move the preprocessor definitions for all FLASK parameters other than
the enable flag off the compiler command line and into config.h, which
is the preferred location for such definitions.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
11 years agosysctl: annotate struct pm_cx_stat's pc[]/cc[]
Jan Beulich [Mon, 24 Mar 2014 09:49:19 +0000 (10:49 +0100)]
sysctl: annotate struct pm_cx_stat's pc[]/cc[]

Suggested-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
11 years agox86: fix determination of bit count for struct domain allocations
Jan Beulich [Mon, 24 Mar 2014 09:48:03 +0000 (10:48 +0100)]
x86: fix determination of bit count for struct domain allocations

We can't just add in the hole shift value, as the hole may be at or
above the 44-bit boundary. Instead we need to determine the total bit
count until reaching 32 significant (not squashed out) bits in PFN
representations.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
11 years agox86/pvh: disallow PHYSDEVOP_pirq_eoi_gmfn_v2/v1
Mukesh Rathor [Mon, 24 Mar 2014 08:47:59 +0000 (09:47 +0100)]
x86/pvh: disallow PHYSDEVOP_pirq_eoi_gmfn_v2/v1

A call to do_physdev_op with PHYSDEVOP_pirq_eoi_gmfn_v2/v1 will corrupt
struct hvm_domain when it writes to domain->arch.pv_domain.pirq_eoi_map.
Disallow that. Currently, such a path exists for linux dom0 pvh.

Signed-off-by: Mukesh Rathor <mukesh.rathor@oracle.com>
11 years agox86: drop unused Transmeta definitions
Jan Beulich [Mon, 24 Mar 2014 08:00:56 +0000 (09:00 +0100)]
x86: drop unused Transmeta definitions

Signed-off-by: Jan Beulich <jbeulich@suse.com>
11 years agoxl: console connection: Print errno value from exec
Ian Jackson [Wed, 19 Mar 2014 14:24:22 +0000 (14:24 +0000)]
xl: console connection: Print errno value from exec

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
11 years agoxl: Remove clone-and-hack in do_daemonize
Ian Jackson [Wed, 19 Mar 2014 14:07:05 +0000 (14:07 +0000)]
xl: Remove clone-and-hack in do_daemonize

do_daemonize had open-coded handling of the results from xl_waitpid.

Instead, break out the meat of console_child_report into a new
function child_report (which returns an error code), and use it.

No functional change other than a change to the message printed if
forking the daemonic child fails.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
11 years agoxl: Abolish vncviewer_child_report
Ian Jackson [Mon, 14 Oct 2013 15:20:20 +0000 (16:20 +0100)]
xl: Abolish vncviewer_child_report

vncviewer_child_report was very similar to console_child_report.

We can abolish vncviewer_child_report by adding an xlchildnum
parameter to console_child_report.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
11 years agoxl: Introduce children[].description and xl_report_child_exitstatus
Ian Jackson [Mon, 14 Oct 2013 15:13:19 +0000 (16:13 +0100)]
xl: Introduce children[].description and xl_report_child_exitstatus

We record the descriptive string for the child in the children[]
array, and use it when reporting the exit status.

The only functional change is that the message reported for the
migration child is changed from "migration target process" to
"migration transport process".

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
11 years agoxl: remove needless error checking from calls to xl_fork
Ian Jackson [Mon, 14 Oct 2013 15:01:49 +0000 (16:01 +0100)]
xl: remove needless error checking from calls to xl_fork

xl_fork cannot fail - it exits instead.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
11 years agoPV-GRUB: fix blk access at end of disk
Samuel Thibault [Fri, 21 Mar 2014 01:56:56 +0000 (02:56 +0100)]
PV-GRUB: fix blk access at end of disk

GRUB usually always loads a whole disk track, even if that means going
beyond the end of the disk.  We thus have to gracefully return an error,
instead of letting the blkfront go panic.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agotools: fix --enable-xenapi typo error
Yixun Lan (dlan) [Thu, 20 Mar 2014 22:44:16 +0000 (06:44 +0800)]
tools: fix --enable-xenapi typo error

typo in tools/configure.ac cause --enable-xenapi does not works
lead to variables XML2_CONFIG, CURL_CONFIG not set

Signed-off-by: Yixun Lan (dlan) <dennis.yxun@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/arm: domain_vgic_init: Check xzalloc_* return
Julien Grall [Thu, 20 Mar 2014 13:51:26 +0000 (13:51 +0000)]
xen/arm: domain_vgic_init: Check xzalloc_* return

The allocations for shared_irqs and pending_irqs are not checked and use
later. This may lead to a Xen segfault if the hypervisor run out of memory.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agominios (blkfront): Add more information on block error
Samuel Thibault [Thu, 20 Mar 2014 12:10:22 +0000 (13:10 +0100)]
minios (blkfront): Add more information on block error

This notably prints the offset and size of the block operation in error.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/arm: Guard correctly asm-arm/platforms/exynos5.h
Julien Grall [Wed, 19 Mar 2014 21:27:49 +0000 (21:27 +0000)]
xen/arm: Guard correctly asm-arm/platforms/exynos5.h

Fix compilation with clang 3.5:

/local/home/julien/works/arndale/xen/xen/include/asm/platforms/exynos5.h:1:9: error: '__ASM_ARM_PLATFORMS_EXYNOS5_H' is used as a header guard here, followed by #define of a different macro [-Werror,-Wheader-guard]
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/local/home/julien/works/arndale/xen/xen/include/asm/platforms/exynos5.h:2:9: note: '__ASM_ASM_PLATFORMS_EXYSNO5_H' is defined here; did you mean '__ASM_ARM_PLATFORMS_EXYNOS5_H'?
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __ASM_ARM_PLATFORMS_EXYNOS5_H

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agotools/xen-access: don't use libxc internals directly.
Tim Deegan [Wed, 19 Mar 2014 10:35:35 +0000 (11:35 +0100)]
tools/xen-access: don't use libxc internals directly.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Tested-by: Aravindh Puthiyaparambil <aravindp@cisco.com>
11 years agoxenstore: set READ_THREAD_STACKSIZE to a sane value
Roger Pau Monne [Fri, 7 Mar 2014 12:22:58 +0000 (13:22 +0100)]
xenstore: set READ_THREAD_STACKSIZE to a sane value

On FreeBSD PTHREAD_STACK_MIN is 2048 by default, which is obviously
too low. Set the default back to the previous value (16 * 1024), or if
that's too low set it to PTHREAD_STACK_MIN.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@citrix.com>
11 years agoxen/xsm: flask: Add missing header in hooks.c
Julien Grall [Mon, 17 Mar 2014 14:06:01 +0000 (14:06 +0000)]
xen/xsm: flask: Add missing header in hooks.c

nr_static_irqs and nr_irqs is defined in asm/irq.h (on both x86 and ARM).

Include directly the header in hooks.c to avoid compilation failure on ARM.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/xsm: flask: flask_copying_string is taking a XEN_GUEST_HANDLE as first param
Julien Grall [Mon, 17 Mar 2014 14:06:00 +0000 (14:06 +0000)]
xen/xsm: flask: flask_copying_string is taking a XEN_GUEST_HANDLE as first param

Rather than x86, on ARM XEN_GUEST_HANDLE and XEN_GUEST_HANDLE_PARAM are
not compatible. This will result to a compilation failure on ARM when XSM
will be enabled.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/xsm: flask: MSI is PCI specific
Julien Grall [Mon, 17 Mar 2014 14:05:59 +0000 (14:05 +0000)]
xen/xsm: flask: MSI is PCI specific

MSI is not yet support on ARM and will break the compilation when XSM_ENABLE=y.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/xsm: flask: Rename variable "bool" in "b"
Julien Grall [Mon, 17 Mar 2014 14:05:58 +0000 (14:05 +0000)]
xen/xsm: flask: Rename variable "bool" in "b"

On ARM, the compilation is failing with the following error:
In file included from flask_op.c:21:0:
./include/conditional.h:24:43: error: two or more data types in declaration specifiers
./include/conditional.h:25:42: error: two or more data types in declaration specifiers

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/xsm: flask: Fix compilation when CONFIG_COMPAT=n
Julien Grall [Mon, 17 Mar 2014 14:05:57 +0000 (14:05 +0000)]
xen/xsm: flask: Fix compilation when CONFIG_COMPAT=n

The commit f7d29f7b "flask: add compat mode guest support" introduces
build breakage on ARM when XSM is enabled. It's because ARM doesn't use
compat mode.

flask_op.c:794:34: fatal error: compat/event_channel.h: No such file or directory
 #include <compat/event_channel.h>

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/xsm: xsm_do_mca is x86 specific
Julien Grall [Mon, 17 Mar 2014 14:05:56 +0000 (14:05 +0000)]
xen/xsm: xsm_do_mca is x86 specific

xsm_do_mca is only used by x86. Only define the function for x86 to
avoid usage on ARM.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/xsm: xsm functions for PCI passthrough is not x86 specific
Julien Grall [Mon, 17 Mar 2014 14:05:55 +0000 (14:05 +0000)]
xen/xsm: xsm functions for PCI passthrough is not x86 specific

Protect xsm functions for PCI passthrough by HAS_PASSTHROUGH && HAS_PCI

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian campbell <ian.campbell@citrix.com>
11 years agoxen/arm: next_module: Skip module if the size is 0
Julien Grall [Mon, 17 Mar 2014 14:05:54 +0000 (14:05 +0000)]
xen/arm: next_module: Skip module if the size is 0

When the the module size is 0, it means that the module was not provided by
the user. It can happen, if the user choose to boot without initrd.

In this case, both fields (start and size) are zeroed. Therefore, next_module
will return 0 every time if there is other non-zero module after this one. This
can happen when the XSM module is added.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/arm: Correctly define size_t
Julien Grall [Mon, 17 Mar 2014 14:05:53 +0000 (14:05 +0000)]
xen/arm: Correctly define size_t

Flask code use %zu to print size_t variable. On ARM, size_t always defined
to unsigned long which make ARM build failed.

Fix it by using __SIZE_TYPE__.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/arm: Remove the parameter "attrindx" in copy_from_paddr
Julien Grall [Mon, 17 Mar 2014 14:05:52 +0000 (14:05 +0000)]
xen/arm: Remove the parameter "attrindx" in copy_from_paddr

copy_from_paddr is only used with BUFFERABLE, there is some place where
DEV_SHARED was used by mistake.

The parameter "attrindx" can be safely remove and let copy_from_paddr to map
every page with BUFFERABLE attribute.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxen/arm: kernel: Don't hardcode flash address
Julien Grall [Mon, 17 Mar 2014 14:05:51 +0000 (14:05 +0000)]
xen/arm: kernel: Don't hardcode flash address

Xen is loaded either by U-boot or the bootwrapper. Both of them
correctly set xen multiboot module for the kernel in the device tree.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agolibxl: multidev: Clarify internal API doc comment
Ian Jackson [Wed, 15 Jan 2014 14:33:21 +0000 (14:33 +0000)]
libxl: multidev: Clarify internal API doc comment

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
11 years agoxl: Pass -v options on to migration receiver
Ian Jackson [Tue, 7 Jan 2014 18:40:05 +0000 (18:40 +0000)]
xl: Pass -v options on to migration receiver

Compute a -v option to pass to the migration receiver.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
---
v2: Use minmsglevel_default to initialise minmsglevel.

11 years agoxl: migration: pass -t to xl migrate-receive
Ian Jackson [Tue, 7 Jan 2014 18:23:04 +0000 (18:23 +0000)]
xl: migration: pass -t to xl migrate-receive

If we ourselves are using cr-based overwriting for logging to stderr,
pass -t to the migration receiver so that it knows to do the same
(since its stderr is normally the pipe from sshd).

This requires, of course, that the receiver support that option.  This
is OK from a compatibility point of view because we support migration
to newer, but not necessarily to older, versions.  (If unsupported
backwards migration is still desired the use of -s "" allows the
remote invocation rune to be overridden by a command of one's choice.)

This fixes a regression introduced in 2f80ac9c0e8f, where migration
messages from the receiver would not use of the overwriting protocol.

CC: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
11 years agoxl: New -t option ("tty") to force \r-based messages
Ian Jackson [Tue, 7 Jan 2014 18:19:18 +0000 (18:19 +0000)]
xl: New -t option ("tty") to force \r-based messages

Provide a new xl global option -t which passes
XTL_STDIOSTREAM_PROGRESS_USE_CR to xentoollog.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agoxentoollog: provide XTL_STDIOSTREAM_PROGRESS_USE_CR
Ian Jackson [Tue, 7 Jan 2014 18:07:30 +0000 (18:07 +0000)]
xentoollog: provide XTL_STDIOSTREAM_PROGRESS_USE_CR

Provide flags
  XTL_STDIOSTREAM_PROGRESS_USE_CR
  XTL_STDIOSTREAM_PROGRESS_NO_CR
to allow the caller to force, or disable, the use of \r-based
overwriting of progress messages.

In the implementation, rename the variable "tty" to "progress_use_cr".

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agolibxl: hotplug scripts: stdin < /dev/null
Ian Jackson [Tue, 18 Mar 2014 16:37:18 +0000 (16:37 +0000)]
libxl: hotplug scripts: stdin < /dev/null

Give hotplug scripts /dev/null for stdin.  That way if they try read
anything anything (which really they shouldn't), nothing odd will
happen.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Roger Pau Monne <roger.pau@citrix.com>
CC: Vasiliy Tolstov <v.tolstov@selfip.ru>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
11 years agolibxl: hotplug scripts: stdout >& stderr
Ian Jackson [Tue, 18 Mar 2014 16:33:06 +0000 (16:33 +0000)]
libxl: hotplug scripts: stdout >& stderr

Plumb hotplug scripts' stdout to stderr.  That way if they print
anything (which really they shouldn't), it won't get mixed up with
the application's stdout.  (Eg, perhaps with an xl migration
stream...)

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Vasiliy Tolstov <v.tolstov@selfip.ru>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agolibxl: Make libxl_exec tolerate foofd<=2
Ian Jackson [Tue, 18 Mar 2014 17:04:36 +0000 (17:04 +0000)]
libxl: Make libxl_exec tolerate foofd<=2

Make passing 0, 1, or 2 as stdinfd, stdoutfd or stderrfd work
properly.

Also, document the meaning of the fd arguments.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Roger Pau Monne <roger.pau@citrix.com>
CC: Vasiliy Tolstov <v.tolstov@selfip.ru>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
11 years agotools/console: xenconsole tolerate tty errors
Ian Jackson [Thu, 27 Feb 2014 17:46:49 +0000 (17:46 +0000)]
tools/console: xenconsole tolerate tty errors

Since 28d386fc4341 (XSA-57), libxl writes an empty value for the
console tty node, with read-only permission for the guest, when
setting up pv console "frontends".  (The actual tty value is later set
by xenconsoled.)   Writing an empty node is not strictly necessary to
stop the frontend from writing dangerous values here, but it is a good
belt-and-braces approach.

Unfortunately this confuses xenconsole.  It reads the empty value, and
tries to open it as the tty.  xenconsole then exits.

Fix this by having xenconsole treat an empty value the same way as no
value at all.

Also, make the error opening the tty be nonfatal: we just print a
warning, but do not exit.  I think this is helpful in theoretical
situations where xenconsole is racing with libxl and/or xenconsoled.

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>
---
v2: Combine two conditions and move the free

11 years agotools/console: reset tty when xenconsole fails
Ian Jackson [Mon, 24 Feb 2014 15:16:19 +0000 (15:16 +0000)]
tools/console: reset tty when xenconsole fails

If xenconsole (the client program) fails, it calls err.  This would
previously neglect to reset the user's terminal to sanity.  Use atexit
to do so.

This routinely happens in Xen 4.4 RC5 with pygrub because libxl
writes the value "" to the tty xenstore key when using xenconsole.
After this patch this just results in a harmless error message.

Reported-by: M A Young <m.a.young@durham.ac.uk>
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: M A Young <m.a.young@durham.ac.uk>
CC: Ian Campbell <Ian.Campbell@citrix.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---
v2: Fix whitespace error (reintroduce hard tab)
    Fix commit message not to claim ignorance about root cause

11 years agotools/libxl: libxl_list_domain: fix typo in error message
Julien Grall [Tue, 18 Mar 2014 20:40:49 +0000 (20:40 +0000)]
tools/libxl: libxl_list_domain: fix typo in error message

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>