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).
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>
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>
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>
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. ]
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>
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>
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>
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>
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>
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>
xen/arm: earlyprintk: export early_puts

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Cambpell <ian.campbell@citrix.com>
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>
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>
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>
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>
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>
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>
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>
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>