]> xenbits.xensource.com Git - people/royger/xen.git/log
people/royger/xen.git
6 years agox86/efi: split compiler vs linker support efi.v3 gitlab/efi.v3
Roger Pau Monne [Wed, 18 Jul 2018 09:59:03 +0000 (11:59 +0200)]
x86/efi: split compiler vs linker support

So that an ELF binary with support for EFI services will be built when
the compiler supports the MS ABI, regardless of the linker support for
PE.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Daniel Kiper <daniel.kiper@oracle.com>
---
Changes since v1:
 - New in this version.

6 years agox86/efi: move the logic to detect PE build support
Roger Pau Monne [Wed, 18 Jul 2018 09:59:02 +0000 (11:59 +0200)]
x86/efi: move the logic to detect PE build support

So that it can be used by other components apart from the efi specific
code. By moving the detection code creating a dummy efi/disabled file
can be avoided.

This is required so that the conditional used to define the efi symbol
in the linker script can be removed and instead the definition of the
efi symbol can be guarded using the preprocessor.

The motivation behind this change is to be able to build Xen using lld
(the LLVM linker), that at least on version 6.0.0 doesn't work
properly with a DEFINED being used in a conditional expression:

ld    -melf_x86_64_fbsd  -T xen.lds -N prelink.o --build-id=sha1 \
    /root/src/xen/xen/common/symbols-dummy.o -o /root/src/xen/xen/.xen-syms.0
ld: error: xen.lds:233: symbol not found: efi

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Daniel Kiper <daniel.kiper@oracle.com>
---
Changes since v2:
 - Use CFLAGS-y to append the XEN_BUILD_PE define.
 - Check that XEN_BUILD_PE is set to 'y' in order to build the PE
   binary.

Changes since v1:
 - Rename variable.
 - Remove usage of the efi/disabled file.

6 years agogrant_table: use term 'mfn' for machine frame numbers...
Paul Durrant [Wed, 18 Jul 2018 08:39:23 +0000 (10:39 +0200)]
grant_table: use term 'mfn' for machine frame numbers...

...rather than more ambiguous term 'frame'.

There are many places in the grant table code that use a variable or
field name '.*frame' to refer to a quantity that is strictly an MFN, and
even has type mfn_t.
This patch is a purely cosmetic patch that substitutes 'frame' with 'mfn'
in those places to make the purpose of the variable or field name more
obvious.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: George Dunlap <George.Dunlap@eu.citrix.com>
6 years agox86/HPET: adjustments to constants and their use
Jan Beulich [Wed, 18 Jul 2018 08:38:03 +0000 (10:38 +0200)]
x86/HPET: adjustments to constants and their use

Drop HPET_TN_ROUTE_SHIFT as redundant with HPET_TN_ROUTE.

Introduce HPET_TN_INT_ROUTE_CAP paralleling the other HPET_TN_*_CAP
constants, making it necessary to rename the such named constant in
hvm/hpet.c. Use MASK_EXTR() / MASK_INSR() instead of kind of open-
coding them.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
6 years agox86/vHPET: replace literal numbers
Jan Beulich [Wed, 18 Jul 2018 08:37:21 +0000 (10:37 +0200)]
x86/vHPET: replace literal numbers

Also drop the unused HPET_TN_CFG_BITS_READONLY_OR_RESERVED.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
6 years agox86/HVM: avoid memory_type_changed() invocations when possible
Jan Beulich [Wed, 18 Jul 2018 08:36:40 +0000 (10:36 +0200)]
x86/HVM: avoid memory_type_changed() invocations when possible

They're expensive, and nothing changes if MTRRs are disabled and any of
the ranges gets changed, or if fixed range MTRRs are disabled and any of
them gets changed.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
6 years agox86/HVM: improve a few state load checks
Jan Beulich [Wed, 18 Jul 2018 08:35:39 +0000 (10:35 +0200)]
x86/HVM: improve a few state load checks

Using plain int for instance numbers looks quite dangerous without
being aware that hvm_load_instance() returns an unsigned quantity. Make
this more explicit. Also replace uint16_t uses by unsigned int.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
6 years agox86/msr: Drop stale comment for vcpu_msrs.spec_ctrl
Andrew Cooper [Tue, 10 Jul 2018 13:01:29 +0000 (14:01 +0100)]
x86/msr: Drop stale comment for vcpu_msrs.spec_ctrl

More than the bottom two bits are now defined, and the MSR policy work has
shown that using non-architectural representations turns out to be problematic
for more than just asm code.  As the architectural representation is the
expected default, we don't need to justify why we are using it.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
6 years agox86/svm Fixes and cleanup to svm_inject_event()
Andrew Cooper [Mon, 28 May 2018 14:19:23 +0000 (14:19 +0000)]
x86/svm Fixes and cleanup to svm_inject_event()

 * State adjustments (and debug tracing) for #DB/#BP/#PF should not be done
   for `int $n` instructions.  Updates to %cr2 occur even if the exception
   combines to #DF.
 * Don't opencode DR_STEP when updating %dr6.
 * Simplify the logic for calling svm_emul_swint_injection() as in the common
   case, every condition needs checking.
 * Fix comments which have become stale as code has moved between components.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
6 years agox86/pv: Avoid locked bit manipulation in register_guest_callback()
Andrew Cooper [Wed, 14 Mar 2018 15:20:05 +0000 (15:20 +0000)]
x86/pv: Avoid locked bit manipulation in register_guest_callback()

Changes to arch.vgc_flags are made to current in syncrhonous context only, and
don't need to be locked.  (The only other changes are via
arch_set_info_guest(), which operates on descheduled vcpus only).

Replace the {set,clear}_bit() calls with compiler-visible bitwise operations.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
6 years agotools: --with-system-{ovmf,seabios,ipxe} should provide absolute paths
Wei Liu [Mon, 16 Jul 2018 14:02:55 +0000 (15:02 +0100)]
tools: --with-system-{ovmf,seabios,ipxe} should provide absolute paths

The paths shouldn't be set to "yes". We ask the user to set absolute
paths because Xen's build system doesn't know where to search, and the
build machine doesn't necessarily have those binaries present in the
first place.

Reported-by: Anthony Perard <anthony.perard@citrix.com>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
6 years agotools: provide --with-system-ipxe
Wei Liu [Mon, 16 Jul 2018 14:02:54 +0000 (15:02 +0100)]
tools: provide --with-system-ipxe

This option lets user specify which binary is to be used as ipxe. If
it is specified, the in-tree ipxe will not be built. This option is in
line with other --with-system-* options we provide.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
6 years agotools: load IPXE from standalone file
Wei Liu [Mon, 16 Jul 2018 14:02:53 +0000 (15:02 +0100)]
tools: load IPXE from standalone file

Do not embed IPXE into Rombios anymore. Instead, it is loaded by the
toolstack from a file as a separate module.

Ability to let user specify an IPXE blob will come later.

No user visible change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
6 years agolibxc: allow HVM guest to have modules
Wei Liu [Mon, 16 Jul 2018 14:02:52 +0000 (15:02 +0100)]
libxc: allow HVM guest to have modules

Lift the loading code out of PVH specific branch. Take the chance to
make the debug message more useful.

Now the code needs to handle virt_base being UNSET_ADDR, which it is
for HVM guest.  In case virt_base is not set, it should be treated as
zero.  In case PVH and PV, virt_base is set by the respective loader
by parsing the binary.

IPXE will be loaded as a module of Rombios.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
6 years agoipxe: produce a single binary from its build
Wei Liu [Mon, 16 Jul 2018 14:02:51 +0000 (15:02 +0100)]
ipxe: produce a single binary from its build

And switch hvmloader/Makefile to use that binary. This will help later
when we change hvmloader to pick a user provided binary.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
6 years agoTools.mk.in: drop unused variables
Wei Liu [Mon, 16 Jul 2018 14:02:50 +0000 (15:02 +0100)]
Tools.mk.in: drop unused variables

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
6 years agoallow cpu_down() to be called earlier
Jan Beulich [Mon, 16 Jul 2018 13:15:12 +0000 (15:15 +0200)]
allow cpu_down() to be called earlier

The function's use of the stop-machine logic has so far prevented its
use ahead of the processing of the "ordinary" initcalls. Since at this
early time we're in a controlled environment anyway, there's no need for
such a heavy tool. Additionally this ought to have less of a performance
impact especially on large systems, compared to the alternative of
making stop-machine functionality available earlier.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
6 years agoconsole: avoid printing no or null time stamps
Jan Beulich [Mon, 16 Jul 2018 13:12:19 +0000 (15:12 +0200)]
console: avoid printing no or null time stamps

During early boot timestamps aren't very useful, as they're all zero
(in "boot" mode) or absent altogether (in "date" and "datems" modes).
Log "boot" format timestamps when the date formats aren't available yet,
and log raw timestamps when boot ones are still all zero. Also add a
"raw" mode.

For the ARM side get_cycles() to produce a meaningful value, ARM's
cycle_t gets changed to uint64_t.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Julien Grall <julien.grall@arm.com>
6 years agodocs/pvh: document initial MTRR state
Roger Pau Monné [Mon, 16 Jul 2018 13:11:42 +0000 (15:11 +0200)]
docs/pvh: document initial MTRR state

Provided to both Dom0 and DomUs.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
6 years agolibxc/pvh: set default MTRR type to write-back
Roger Pau Monné [Mon, 16 Jul 2018 13:11:22 +0000 (15:11 +0200)]
libxc/pvh: set default MTRR type to write-back

And enable MTRR. This allows to provide a sane initial MTRR state for
PVH DomUs. This will have to be expanded when pci-passthrough support
is added to PVH guests, so that MMIO regions of devices are set as
UC.

Note that initial MTRR setup is done by hvmloader for HVM guests,
that's not used by PVH guests.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
6 years agohvm/mtrr: copy hardware state for Dom0
Roger Pau Monné [Mon, 16 Jul 2018 13:10:49 +0000 (15:10 +0200)]
hvm/mtrr: copy hardware state for Dom0

Copy the state found on the hardware when creating a PVH Dom0. Since
the memory map provided to a PVH Dom0 is based on the native one using
the same set of MTRR ranges should provide Dom0 with a sane MTRR state
without having to manually build it in Xen.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
6 years agohvm/mtrr: use the hardware number of variable ranges for Dom0
Roger Pau Monné [Mon, 16 Jul 2018 13:10:09 +0000 (15:10 +0200)]
hvm/mtrr: use the hardware number of variable ranges for Dom0

Expand the size of the variable ranges array to match the size of the
underlying hardware, this is a preparatory change for copying the
hardware MTRR state for Dom0.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
6 years agohvm/mtrr: add emacs local variables block with formatting info
Roger Pau Monné [Mon, 16 Jul 2018 13:09:50 +0000 (15:09 +0200)]
hvm/mtrr: add emacs local variables block with formatting info

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
6 years agox86/mtrr: split "enabled" field into two boolean flags
Jan Beulich [Mon, 16 Jul 2018 13:09:12 +0000 (15:09 +0200)]
x86/mtrr: split "enabled" field into two boolean flags

The code hopefully is more readable this way.

Also switch have_fixed to bool, seeing that it already is used as a
boolean.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
[switched to use MASK_*]
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
6 years agox86/HVM: improve MTRR load checks
Jan Beulich [Mon, 16 Jul 2018 13:08:02 +0000 (15:08 +0200)]
x86/HVM: improve MTRR load checks

We should not assume that the incoming set of values contains exactly
MTRR_VCNT variable range MSRs. Permit a smaller amount and reject a
bigger one. As a result the save path then also needs to no longer use
a fixed upper bound, in turn requiring unused space in the save record
to be zeroed up front.

Also slightly refine types where appropriate.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
[switch to use MASK_EXTR to get VCNT]
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
6 years agotools: remove local links to the x86 headers
Roger Pau Monne [Thu, 12 Jul 2018 16:48:06 +0000 (18:48 +0200)]
tools: remove local links to the x86 headers

In the x86 test harness and the fuzzer, and instead create a link in
the tools/include directory that can be used by all the tools.

No functional change.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
6 years agotools: bump library version numbers to 4.12
Wei Liu [Tue, 10 Jul 2018 13:23:28 +0000 (14:23 +0100)]
tools: bump library version numbers to 4.12

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
6 years agoautomation/build: update stretch-i386 dockerfile
Wei Liu [Fri, 13 Jul 2018 07:05:54 +0000 (08:05 +0100)]
automation/build: update stretch-i386 dockerfile

We don't need to specify /bin/bash in the entry point rune, otherwise
non-interactive invocation of the container would fail with something
like:

+ C=debian:stretch-i386
+ export CONTAINER=registry.gitlab.com/xen-project/xen/debian:stretch-i386
+ CONTAINER=registry.gitlab.com/xen-project/xen/debian:stretch-i386
+ cd /local/work/COMMITTER/xen-32.git
+ git fetch origin
+ con git reset --hard origin/staging
*** Ensuring registry.gitlab.com/xen-project/xen/debian:stretch-i386 is up to date
*** Launching container ...
/usr/bin/git: /usr/bin/git: cannot execute binary file

While at it, use shorthand "linux32".

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Doug Goldstein <cardoe@cardoe.com>
6 years agoxen: oprofile/nmi_int.c: Drop unwanted sexual reference lld_v10 gitlab/lld_v10
Ian Jackson [Thu, 12 Jul 2018 14:36:11 +0000 (15:36 +0100)]
xen: oprofile/nmi_int.c: Drop unwanted sexual reference

This is not really very nice.

This line doesn't have much value in itself.  The rest of this comment
block is pretty clear what it wants to convey.  So delete it.

(While we are here, adopt the CODING_STYLE-mandated formatting.)

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Lars Kurth <lars.kurth.xen@gmail.com>
Acked-by: George Dunlap <dunlapg@umich.edu
Acked-by: Jan Beulich <JBeulich@suse.com>
---
v3: Restore erroneously-dropped tab.
v2: Delete the comment entirely.

6 years agoautomation/build: build ovmf
Wei Liu [Wed, 11 Jul 2018 13:16:16 +0000 (14:16 +0100)]
automation/build: build ovmf

Install nasm and build ovmf with gcc on x86.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Doug Goldstein <cardoe@cardoe.com>
6 years agox86: replace '||' usage in the linker script
Roger Pau Monné [Thu, 12 Jul 2018 08:48:18 +0000 (10:48 +0200)]
x86: replace '||' usage in the linker script

With '|'. The result is the same, and the later works with lld. Fixes
the following error when building Xen with lld:

ld    -melf_x86_64_fbsd  -T xen.lds -N prelink.o --build-id=sha1 \
    /root/src/xen/xen/common/symbols-dummy.o -o /root/src/xen/xen/.xen-syms.0
ld: error: xen.lds:260: malformed number: |
>>> ASSERT(__image_base__ > (((((((((261 >> 8) * 0xffff000000000000) | (261 << 39))) + ((1 << 39) / 2)) + (64 << 30)) + (1 << 30)) + (1 << 30))) ||
>>>                                                                                                                                               ^

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
6 years agox86/shadow: fetch CPL just once in sh_page_fault()
Jan Beulich [Thu, 12 Jul 2018 08:47:33 +0000 (10:47 +0200)]
x86/shadow: fetch CPL just once in sh_page_fault()

This isn't as much of an optimization than to avoid triggering a gcc bug
affecting 5.x ... 7.x, triggered by any asm() put inside the ad hoc
"rewalk" loop and taking as an (output?) operand a register variable
tied to %rdx (an "rdx" clobber is fine). The issue is due to an apparent
collision in register use with the modulo operation in vtlb_hash(),
which (with optimization enabled) involves a multiplication of two
64-bit values with the upper half (in %rdx) of the 128-bit result being
of interest.

Such an asm() was originally meant to be implicitly introduced into the
code when converting most indirect calls through the hvm_funcs table to
direct calls (via alternative instruction patching); that model was
switched to clobbers due to further compiler problems, but I think the
change here is worthwhile nevertheless.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Tim Deegan <tim@xen.org>
6 years agox86/shim: fully ignore "nosmp" and "maxcpus="
Jan Beulich [Thu, 12 Jul 2018 08:46:58 +0000 (10:46 +0200)]
x86/shim: fully ignore "nosmp" and "maxcpus="

In the shim case, the number of CPUs should be solely controlled by the
guest configuration file. Make sure the command line options are fully
(and not just partially) ignored.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
6 years agomm/page_alloc: correct first_dirty calculations during block merging
Sergey Dyasli [Thu, 12 Jul 2018 08:45:11 +0000 (10:45 +0200)]
mm/page_alloc: correct first_dirty calculations during block merging

Currently it's possible to hit an assertion in alloc_heap_pages():

Assertion 'first_dirty != INVALID_DIRTY_IDX || !(pg[i].count_info & PGC_need_scrub)' failed at page_alloc.c:988

This can happen because a piece of logic to calculate first_dirty
during block merging in free_heap_pages() is missing for the following
scenario:

1. Current block's first_dirty equals to INVALID_DIRTY_IDX
2. Successor block is free but its first_dirty != INVALID_DIRTY_IDX
3. The successor is merged into current block
4. Current block's first_dirty still equals to INVALID_DIRTY_IDX

This will trigger the assertion during allocation of such block in
alloc_heap_pages() because there will be pages with PGC_need_scrub
bit set despite the claim of first_dirty that the block is scrubbed.

Add the missing piece of logic and slightly update the comment for
the predecessor case to better capture the code's intent.

Fixes 1a37f33ea613 ("mm: Place unscrubbed pages at the end of pagelist")

Signed-off-by: Sergey Dyasli <sergey.dyasli@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
6 years agoxen/arm: setup: Move in init code only used at boot in setup.c
Julien Grall [Wed, 11 Jul 2018 19:19:00 +0000 (12:19 -0700)]
xen/arm: setup: Move in init code only used at boot in setup.c

Some of the functions implemented in setup.c are only used at boot but
not yet marked as such.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
6 years agoxen/libfdt: Put all libfdt in init
Julien Grall [Mon, 2 Jul 2018 16:19:09 +0000 (17:19 +0100)]
xen/libfdt: Put all libfdt in init

Libfdt is used for:
    - Unflatten the Flatten Device-Tree (FDT) blob
    - Create Device-Tree for the Hardware-Domain

Both use are done during the initialization of Xen. So move all the
libfdt to init.

Note that the runes was borrowed from libelf Makefile.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
6 years agoxen: Don't build libelf for Arm
Julien Grall [Mon, 2 Jul 2018 16:19:08 +0000 (17:19 +0100)]
xen: Don't build libelf for Arm

Now that ELF support has been dropped to boot Dom0, no-one is using
libelf within the hypervisor.

Introduce a config option to select libelf on x86 and keep unselected
for Arm.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
6 years agoxen/arm: Drop support for loading ELF Dom0 kernel
Julien Grall [Mon, 2 Jul 2018 16:19:07 +0000 (17:19 +0100)]
xen/arm: Drop support for loading ELF Dom0 kernel

The code has been around since the beginning of Xen Arm. However, I am
not aware of any user and the code is pretty bogus:
    1) It is assuming virtual address == physical address.
    2) The cache is not cleaned after the Image is loaded but the Image
    is started with Cache disabled.
    3) There are not clear ABI with the guest.

Xen is currently supporting 3 other formats (zImage, Image, U-boot Image)
as well as gzip compressed version of each formats. All of them are well
documented and widely use.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
6 years agoxen/arm: kernel: Move in init all the code/data of kernel.c
Julien Grall [Mon, 2 Jul 2018 16:19:06 +0000 (17:19 +0100)]
xen/arm: kernel: Move in init all the code/data of kernel.c

The file kernel.c only contains code/data used during the
initialization. So move everything to init and mark the file as such.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
6 years agoxen/arm: domain_build: Move in init all code/data of domain_build.c
Julien Grall [Mon, 2 Jul 2018 16:19:05 +0000 (17:19 +0100)]
xen/arm: domain_build: Move in init all code/data of domain_build.c

The file domain_build.c only contains code/data used during the
initialization. So move everything to init and mark the file as such.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
6 years agoxen/arm: Remove the variable dom0_11_mapping and open-code the value
Julien Grall [Mon, 2 Jul 2018 16:19:04 +0000 (17:19 +0100)]
xen/arm: Remove the variable dom0_11_mapping and open-code the value

Dom0 (aka hardware domain on Arm) is always direct mapped. Rather than
using a global variable to store a const, directly open-code it or
replace the use with is_domain_direct_mapped(...) macros.

This will also help a follow-up patch to move all domain_build.c in
init.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
6 years agoautomation: fix builds with clang
Doug Goldstein [Tue, 10 Jul 2018 22:58:58 +0000 (17:58 -0500)]
automation: fix builds with clang

a75703b2f0f585a2fc6a7bcdb7d16a61bcf5e6b0 unconditionally enabled
building of rombios and stubdoms but unfortunately these two pieces do
not build successfully with clang. rombios unconditionally depends on
the build of iPXE and upstream iPXE does not support building with
clang. Similiarly the build of the stubdoms depends on the build of
newlib which does not support being built with clang.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
6 years agotools/libxencall: enforce proper alignment of hypercall buffers
Juergen Gross [Fri, 8 Jun 2018 09:51:12 +0000 (11:51 +0200)]
tools/libxencall: enforce proper alignment of hypercall buffers

xencall_alloc_buffer() is used throughout Xen tools for allocating
hypercall buffers. Allocation is done at page granularity. For simple
administration each allocated set of pages contains a small header
holding the number of pages of that set. The hypercall buffer is
located directly after the 4 byte sized header, leading to a wrong
alignment for e.g. pointers.

Repair that by using a 16 byte sized header enforcing the same
alignment as malloc().

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
6 years agoxl/vsnd: initialise rc in dryrun path
Wei Liu [Tue, 10 Jul 2018 13:43:34 +0000 (14:43 +0100)]
xl/vsnd: initialise rc in dryrun path

Reported-by: Coverity
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
6 years agoxl/vsnd: use xcalloc to allocate memory for parser
Wei Liu [Tue, 10 Jul 2018 13:41:16 +0000 (14:41 +0100)]
xl/vsnd: use xcalloc to allocate memory for parser

... because it handles errors for us.

Reported-by: Coverity
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
6 years agolibxl/vsnd: add missing error checks
Wei Liu [Tue, 10 Jul 2018 13:35:11 +0000 (14:35 +0100)]
libxl/vsnd: add missing error checks

Reported-by: Coverity
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
6 years agodoc: correct intel_psr_cat_cdp.pandoc syntax
Juergen Gross [Tue, 8 May 2018 06:47:31 +0000 (08:47 +0200)]
doc: correct intel_psr_cat_cdp.pandoc syntax

"make -C docs all" fails due to incorrect markdown syntax in
intel_psr_cat_cdp.pandoc. Correct it.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
[ wei: update changelog section ]
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
6 years agodocs: adjust release management doc
Juergen Gross [Tue, 10 Jul 2018 13:14:56 +0000 (15:14 +0200)]
docs: adjust release management doc

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
6 years agoMAINTAINERS: use https for git trees
Wei Liu [Tue, 10 Jul 2018 08:13:43 +0000 (09:13 +0100)]
MAINTAINERS: use https for git trees

Commit message stolen from a reply from Ian:

The git protocol is not just unencrypted, but also unauthenticated.
In theory it is possible to verify the signed tags for actual
releases, but that is a cumbersome process which I very much doubt
anyone really does.

As for the various branch tips, there is currently no way (unless you
have a shell account on xenbits) to get any kind of authenticated
value.

Conversely, if you use an https url, you get some cryptographic
authentication of what you are cloning.  The crypto there is far from
perfect but it is massively better than nothing.

Additionally, in general, using and supporting https also means that
*what users are accessing* is encrypted.  This enhances user privacy.
In the specific case of the git trees on xenbits this is a very minor
consideration.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
6 years agoMAINTAINERS: drop USB PV DRIVERS entry
Wei Liu [Tue, 10 Jul 2018 08:07:28 +0000 (09:07 +0100)]
MAINTAINERS: drop USB PV DRIVERS entry

Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
6 years agox86/pvh: clarify Dom0 PVH build error message
Roger Pau Monné [Tue, 10 Jul 2018 10:23:19 +0000 (12:23 +0200)]
x86/pvh: clarify Dom0 PVH build error message

Avoid having error messages with the same text. No functional change.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
6 years agox86/spec-ctrl: command line handling adjustments
Jan Beulich [Tue, 10 Jul 2018 10:22:31 +0000 (12:22 +0200)]
x86/spec-ctrl: command line handling adjustments

For one, "no-xen" should not imply "no-eager-fpu", as "eager FPU" mode
is to guard guests, not Xen itself, which is also expressed so by
print_details().

And then opt_ssbd, despite being off by default, should also be cleared
by the "no" and "no-xen" sub-options.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
6 years agodocs: add PV sound device config
Oleksandr Grytsov [Fri, 15 Jun 2018 10:15:18 +0000 (13:15 +0300)]
docs: add PV sound device config

Update documentation with virtual sound device

Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
6 years agoxl: add vsnd CLI commands
Oleksandr Grytsov [Fri, 15 Jun 2018 10:15:17 +0000 (13:15 +0300)]
xl: add vsnd CLI commands

Add CLI commands to attach, detach and list virtual sound devices

Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
6 years agoxl: add PV sound condif parser
Oleksandr Grytsov [Fri, 15 Jun 2018 10:15:16 +0000 (13:15 +0300)]
xl: add PV sound condif parser

Add config parser for virtual sound devices

Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
6 years agolibxl: add vsnd list and info
Oleksandr Grytsov [Fri, 15 Jun 2018 10:15:15 +0000 (13:15 +0300)]
libxl: add vsnd list and info

Add getting vsnd list and info API

Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
6 years agolibxl: add PV sound device
Oleksandr Grytsov [Fri, 15 Jun 2018 10:15:14 +0000 (13:15 +0300)]
libxl: add PV sound device

Add PV sound device described in sndif.h

Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
6 years agolibxl/xl: rename id to unique-id in vdispl xen store
Oleksandr Grytsov [Tue, 12 Jun 2018 15:40:46 +0000 (18:40 +0300)]
libxl/xl: rename id to unique-id in vdispl xen store

In the display protocol connector's id is named as unique-id. This patch renames
it in the libxl/xl code and uses XENDISPL_FIELD... definitions from the protocol
header.

Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
6 years agoReplace http: with https: in MAINTAINERS file
Lars Kurth [Tue, 1 May 2018 12:34:01 +0000 (13:34 +0100)]
Replace http: with https: in MAINTAINERS file

Requested by Ian Jackson, see
https://lists.xenproject.org/archives/html/xen-devel/2018-04/msg02286.html

The patch also fixes the location of linux-2.6.18-xen.hg (it is currently
pointing to an alias)

Signed-off-by: Lars Kurth <lars.kurth@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
6 years agoReplace occurances of xen.org with xenproject.org
Lars Kurth [Tue, 1 May 2018 12:34:00 +0000 (13:34 +0100)]
Replace occurances of xen.org with xenproject.org

This is a general clean-up activity. It also avoids mails being
sent to xen-devel@lists.xenproject.org and xen-devel@lists.xen.org
when used with add_maintainers.pl/git send-email.

Signed-off-by: Lars Kurth <lars.kurth@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Released-acked-by: Juergen Gross <jgross@suse.com>
6 years agobuild: fix include paths in FreeBSD
Roger Pau Monne [Mon, 2 Jul 2018 08:28:26 +0000 (10:28 +0200)]
build: fix include paths in FreeBSD

FreeBSD package manager uses /usr/local/ as the default install path,
but that's not part of the compiler search path, so add it using the
APPEND_{LIB/INCLUDES} variables.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
6 years agotests/xs: use ENOENT instead of ENODATA
Roger Pau Monne [Mon, 2 Jul 2018 08:28:25 +0000 (10:28 +0200)]
tests/xs: use ENOENT instead of ENODATA

ENODATA is not part of the standard set of errno values, so use
ENOENT instead. This fixes the build on FreeBSD.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
6 years agotests: disable x86 emulator test harness when using clang
Roger Pau Monne [Mon, 2 Jul 2018 08:28:24 +0000 (10:28 +0200)]
tests: disable x86 emulator test harness when using clang

clang is not capable of building the x86 emulator test harness, so
disconnect it from the clang build until it can be fixed.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
6 years agofirmware/seabios: fix build on systems with non GNU toolchains
Roger Pau Monne [Mon, 2 Jul 2018 08:28:23 +0000 (10:28 +0200)]
firmware/seabios: fix build on systems with non GNU toolchains

SeaBIOS requires gcc and GNU ld in order to build, so allow setting
SEABIOSCC and SEABIOSLD by the caller when building in order to pass
the path to the compiler and linker that should be used when building
SeaBIOS.

Note that the LD32BIT-y variable was used by FreeBSD builds and is no
longer needed due to the ability to select the LD to use for SeaBIOS
builds, so remove it.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
6 years agoautomation: build more stuff on x86 with docker
Wei Liu [Mon, 9 Jul 2018 15:11:15 +0000 (16:11 +0100)]
automation: build more stuff on x86 with docker

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Doug Goldstein <cardoe@cardoe.com>
6 years agoautomation: introduce stretch-i386.dockerfile
Wei Liu [Tue, 22 May 2018 16:30:39 +0000 (17:30 +0100)]
automation: introduce stretch-i386.dockerfile

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Doug Goldstein <cardoe@cardoe.com>
6 years agoautomation: install some packages for CentOS from EPEL
Wei Liu [Mon, 9 Jul 2018 14:24:19 +0000 (15:24 +0100)]
automation: install some packages for CentOS from EPEL

They are needed to build tools.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Doug Goldstein <cardoe@cardoe.com>
6 years agostubdom: disable newlib's need for texinfo
Doug Goldstein [Mon, 9 Jul 2018 17:05:46 +0000 (12:05 -0500)]
stubdom: disable newlib's need for texinfo

newlib has a hardcoded dependency on texinfo, which in turn means that
Xen has this dependency when building the stub domains. The files that
newlib generates are never used or exposed by the Xen build system so
its really a wasted effort to require a heavy (size wise) package for
the build of something that's thrown away. Instead of adding it as a
requirement this patches out the code path in newlib that uses it so
that the files are never generated.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
6 years agox86/msr: Rename the msr policy objects
Andrew Cooper [Thu, 5 Jul 2018 15:25:39 +0000 (15:25 +0000)]
x86/msr: Rename the msr policy objects

After attempting to develop the infrastructure, it turns out that the choice
of naming is suboptimal.

Rename msr_domain_policy to just msr_policy to mirror the CPUID side of
things, and alter the 'dp' variable name convention to 'mp'.  While altering
all the names, export all of the system msr_policy objects (which are already
global symbols).

Rename msr_vcpu_policy to vcpu_msrs and switch 'vp' to 'msrs' in code.  Update
the arch_vcpu field name to match.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
6 years agoxen: Introduce an xmemdup() helper
Andrew Cooper [Thu, 5 Jul 2018 14:19:00 +0000 (14:19 +0000)]
xen: Introduce an xmemdup() helper

... and use it in place of the opencoded instances.

For consistency, restructure init_domain_cpuid_policy() to be like
init_{domain,vcpu}_msr_policy() by operating on the local pointer where
possible.

No change in behaviour.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
6 years agotools/libs: Fix stable library ABI breakage from c/s e1ed22be85
Andrew Cooper [Mon, 9 Jul 2018 09:13:48 +0000 (10:13 +0100)]
tools/libs: Fix stable library ABI breakage from c/s e1ed22be85

For libxengnttab.map, introducing a new VERS* section must be matched with a
equivalent SONAME bump.

For libxencall.map, the hunk as presented would have been ok, if Xen 4.11
hadn't been released between xencall_buffers_never_fault() and xencall_fd()
being introduced.  Given the timing of the release, xencall_fd() needs moving
into a new VERS_1.2 section.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
6 years agox86: drop dead asm-offsets definitions
Jan Beulich [Mon, 9 Jul 2018 08:53:32 +0000 (10:53 +0200)]
x86: drop dead asm-offsets definitions

UREGS_user_sizeof had a use long, long ago on x86, and apparently was
blindly cloned into ARM code.

The uses of UREGS_saved_upcall_mask and UREGS_{ds,es,fs,gs} disappeared
in 71eb3a65e3 ("VMX: streamline entry.S code") and 110b2d6e8a ("SVM:
streamline entry.S code").

There are other ARM side UREGS_* which look to be unused, but I'd prefer
to leave deciding on their disposition to ARM folks.

irq_caps_offset and next_in_list_offset were introduced in 57b0566668
("Re-enable MSI support") without any user.

VCPU_failsafe_{addr,sel} and _VGCF_failsafe_disables_events uses went
away in d9b7ef209a ("x86: drop failsafe callback invocation from
assembly").

CPUINFO_processor_id looks to have been introduced without user by
917335d8b3 ("x86: Avoid assumptions about C struct layouts from asm
code").

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Julien Grall <julien.grall@arm.com>
6 years agox86: consolidate legacy FPU state loading
Jan Beulich [Mon, 9 Jul 2018 08:52:50 +0000 (10:52 +0200)]
x86: consolidate legacy FPU state loading

First of all introduce a helper function instead of replicating almost
the same code for PV and HVM. The differences between the two pieces of
code actually points out an issue (which is also addressed here): In
the HVM case FCW would not have been set to FCW_RESET in certain cases
(note for example that XRSTOR loads FCW_DEFAULT rather then FCW_RESET
when the respective xstate_bv bit is clear).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
6 years agox86: reduce IRQs disabled section in flush_area_local()
Jan Beulich [Mon, 9 Jul 2018 08:51:33 +0000 (10:51 +0200)]
x86: reduce IRQs disabled section in flush_area_local()

Only the pre_flush() / post_flush() section actually needs to run with
interrupts disabled.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
6 years agox86: correctly set nonlazy_xstate_used when loading full state
Jan Beulich [Mon, 9 Jul 2018 08:51:02 +0000 (10:51 +0200)]
x86: correctly set nonlazy_xstate_used when loading full state

In this case, just like xcr0_accum, nonlazy_xstate_used should always be
set to the intended new value, rather than possibly leaving the flag set
from a prior state load.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
6 years agox86: fix dependency tracking for asm/indirect_thunk_asm.h
Jan Beulich [Mon, 9 Jul 2018 08:49:37 +0000 (10:49 +0200)]
x86: fix dependency tracking for asm/indirect_thunk_asm.h

Including the header solely at the assembler level means the compiler
can't record the header as a dependency in .*.o.d files. Arrange for the
header to be include-able at the C level instead.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
6 years agoxen: Port the array_index_nospec() infrastructure from Linux
Andrew Cooper [Fri, 6 Jul 2018 11:06:10 +0000 (12:06 +0100)]
xen: Port the array_index_nospec() infrastructure from Linux

This is as the infrastructure appeared in Linux 4.17, adapted slightly for
Xen.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Julien Grall <julien.grall@arm.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
6 years agotools/tests/depriv-fd-checker: Support checking of Linux tun devices
Ian Jackson [Wed, 30 May 2018 15:49:25 +0000 (16:49 +0100)]
tools/tests/depriv-fd-checker: Support checking of Linux tun devices

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
6 years agotools/tests/depriv: Install depriv-fd-checker in our private libexec directory
Ian Jackson [Fri, 25 May 2018 16:04:22 +0000 (17:04 +0100)]
tools/tests/depriv: Install depriv-fd-checker in our private libexec directory

osstest is going to want to call it, and should not be expected to
fish it out of the build tree.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
6 years agotools/tests: Allow a test subdir to have `install' and `uninstall' targets
Ian Jackson [Fri, 25 May 2018 16:01:15 +0000 (17:01 +0100)]
tools/tests: Allow a test subdir to have `install' and `uninstall' targets

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
6 years agotools/tests/depriv: New test utility for deprivilege auditing
Ian Jackson [Fri, 25 May 2018 14:40:27 +0000 (15:40 +0100)]
tools/tests/depriv: New test utility for deprivilege auditing

I have chosen to licence this utility as LGPL-v2.1-only, similar to
other LGPL elements of the Xen tools, because it may want to be moved
into or combined with osstest or some other project at some point in
the future, so it wants a licence compatible with osstest's AGPLv3+.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
6 years agolibxl: Provide better error message when qemu restrict user not found
Ian Jackson [Mon, 14 May 2018 13:33:50 +0000 (14:33 +0100)]
libxl: Provide better error message when qemu restrict user not found

Add mention of LIBXL_QEMU_USER_RANGE_BASE, in case that is what the
user was intending.

Cc: Anthony Perard <anthony.perard@citrix.com>
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
6 years agotools: xencall, xengnttab, xengntshr: Provide access to internal fds
Ian Jackson [Fri, 4 May 2018 15:29:17 +0000 (16:29 +0100)]
tools: xencall, xengnttab, xengntshr: Provide access to internal fds

I want this to support my qemu depriv descriptor audit tool.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
6 years agolibxc: Provide access to internal handles
Ian Jackson [Fri, 4 May 2018 15:00:42 +0000 (16:00 +0100)]
libxc: Provide access to internal handles

In order to support auditing of qemu depriv, my audit tool wants to
know the fd of a privcmd handle on which it can easily make
hypercalls.  xencall provides such a handle, but has no cooked
facilities for making hypercalls.  So I open a libxc handle.  That
means I need to get the privcmd fd out of the libxc handle.

ISTM that it is best to do this by providing an interface to get the
underlying library handles for a libxc handle.  This kind of interface
is quite common elsewhere and has not caused problems.

libxc is not a stable API so the downside risk of providing this
access is not significant.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
6 years agolibxc: Drop declarations of osdep_privcmd_open and _close
Ian Jackson [Fri, 4 May 2018 14:41:27 +0000 (15:41 +0100)]
libxc: Drop declarations of osdep_privcmd_open and _close

These functions are no longer defined or used anywhere.  The
declarations should have been deleted when the definitions were.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
6 years agox86/vpt: split part of pt_intr_post into a separate helper
Roger Pau Monné [Thu, 5 Jul 2018 13:44:35 +0000 (15:44 +0200)]
x86/vpt: split part of pt_intr_post into a separate helper

No functional change.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
6 years agox86/vpt: convert periodic_time fields to bool
Roger Pau Monné [Thu, 5 Jul 2018 13:43:54 +0000 (15:43 +0200)]
x86/vpt: convert periodic_time fields to bool

No functional change.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
6 years agox86/vhpet: check that the set interrupt route is valid
Roger Pau Monné [Thu, 5 Jul 2018 13:43:28 +0000 (15:43 +0200)]
x86/vhpet: check that the set interrupt route is valid

The value written by the guest must be valid according to the mask
provided in the interrupt routing capabilities register. If the
interrupt is not valid set it to the first valid IRQ in the
capabilities field if the timer is enabled, else just clear the field.

Also refuse to start any timer that has an invalid interrupt route.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
6 years agox86/vpt: fix create_periodic_time to check the irq parameter
Roger Pau Monné [Thu, 5 Jul 2018 13:42:59 +0000 (15:42 +0200)]
x86/vpt: fix create_periodic_time to check the irq parameter

Instead of the stale value inside the periodic_time struct.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
6 years agoEFI: add EFI_LOAD_OPTION support
Tamas K Lengyel [Thu, 5 Jul 2018 13:29:44 +0000 (15:29 +0200)]
EFI: add EFI_LOAD_OPTION support

When booting Xen via UEFI the Xen config file can contain multiple
sections each describing different boot options. It is currently only
possible to choose which section to boot with if the buffer contains a
string. UEFI provides a different standard to pass optional arguments
to an application, and in this patch we make Xen properly parse this
buffer, thus making it possible to have separate EFI boot options
present for the different config sections.

Signed-off-by: Tamas K Lengyel <tamas@tklengyel.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
6 years agox86/mtrr: introduce mask to get VCNT from MTRRcap MSR
Roger Pau Monné [Thu, 5 Jul 2018 13:28:56 +0000 (15:28 +0200)]
x86/mtrr: introduce mask to get VCNT from MTRRcap MSR

No functional change.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
6 years agox86/mm: suppress vm_events caused by page-walks
Alexandru Isaila [Thu, 5 Jul 2018 13:25:20 +0000 (15:25 +0200)]
x86/mm: suppress vm_events caused by page-walks

This patch is adding a way to enable/disable inguest pagefault
events. It introduces the xc_monitor_inguest_pagefault function
and adds the inguest_pagefault_disabled in the monitor structure.
This is needed by the introspection so it will only get gla
faults and not get spammed with other faults.
In p2m_mem_access_check() we emulate so no event will get sent.

Signed-off-by: Alexandru Isaila <aisaila@bitdefender.com>
Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
6 years agohvm/svm: enable EMUL_UNIMPLEMENTED events on svm
Alexandru Isaila [Thu, 5 Jul 2018 13:20:23 +0000 (15:20 +0200)]
hvm/svm: enable EMUL_UNIMPLEMENTED events on svm

Signed-off-by: Alexandru Isaila <aisaila@bitdefender.com>
Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
6 years agox86/cpu: add support for zhaoxin x86 platform
DavidWang [Thu, 5 Jul 2018 13:13:28 +0000 (15:13 +0200)]
x86/cpu: add support for zhaoxin x86 platform

Zhaoxin is a x86 IC designer. Its SOC products support both CPU
virtualization and I/O virtualization, which are compatible with Intel
VMX and VT-d respectively. Zhaoxin has 'Shanghai' CPU vendor ID.

Signed-off-by: DavidWang <davidwang@zhaoxin.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
6 years agotools: Move ARRAY_SIZE() into xen-tools/libs.h
Andrew Cooper [Wed, 4 Jul 2018 13:32:31 +0000 (14:32 +0100)]
tools: Move ARRAY_SIZE() into xen-tools/libs.h

xen-tools/libs.h currently contains a shared BUILD_BUG_ON() implementation and
is used by some tools.  Extend this to include ARRAY_SIZE and clean up all the
opencoding.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
6 years agoprocess docs: Final branching checklist steps
Ian Jackson [Mon, 25 Jun 2018 14:49:37 +0000 (15:49 +0100)]
process docs: Final branching checklist steps

Document two steps which were done this time, and last time:
(i) setting off an early osstest run
(ii) sending the mail confirming it's done.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
6 years agoprocess docs: Add some detail about changes during branching
Ian Jackson [Mon, 25 Jun 2018 14:48:32 +0000 (15:48 +0100)]
process docs: Add some detail about changes during branching

Split out the required work for the new and old branches and be more
specific about what is to be done.  In the RT checklist, reformat and
expand the "turn off debug" instructions.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
6 years agoprocess docs: Drop some obsolete stuff
Ian Jackson [Mon, 25 Jun 2018 14:46:25 +0000 (15:46 +0100)]
process docs: Drop some obsolete stuff

* Drop reference to long-gone Citrix-internal HG trees
* Drop reference to RT-accessible web pages; web page editing
  is now handled via the RM, community manager, etc.
* Drop reference to git description files; this is not needed
  because now we have one tree with all branches, not one per branch

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
6 years agotools/ocaml: Drop int_array_of_uuid_string()
Andrew Cooper [Fri, 16 Mar 2018 14:04:53 +0000 (14:04 +0000)]
tools/ocaml: Drop int_array_of_uuid_string()

This function is entirely internal to xenctrl stubs, and serves only to
convert the uuid string to an integer array (making 16 memory allocations as
it goes), while the C stubs turns the integer array back into a binary array.

Instead, pass the string all the way down into C, and have sscanf() unpack it
directly into a xen_domain_handle_t object.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Christian Lindig <christian.lindig@citrix.com>
6 years agotools/ocaml: Drop domain_create_flag_table[]
Andrew Cooper [Fri, 16 Mar 2018 13:32:04 +0000 (13:32 +0000)]
tools/ocaml: Drop domain_create_flag_table[]

This is a logarithm in disguise.  Update the logic to match how
x86_arch_emulation_flags works in c/s 9d683b5e37 and b38d96f596.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Christian Lindig <christian.lindig@citrix.com>