Jan Beulich [Mon, 11 Aug 2014 13:00:15 +0000 (15:00 +0200)]
x86/vHPET: use rwlock instead of simple one
This namely benefits guests heavily reading the main counter, but not
touching the HPET much otherwise. Note that due to the way
hpet_get_comparator() works hpet_read() has to special cases reads from
the comparator registers and use a write lock there instead of the read
one used for all other registers.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Roger Pau Monné [Mon, 11 Aug 2014 12:58:40 +0000 (14:58 +0200)]
x86/HVM: expose that grant table mappings update the IOMMU
Add a new CPUID flag for leaf 4 that indicates that grant/foreign
mappings update the IOMMU accordingly.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Roger Pau Monné [Mon, 11 Aug 2014 12:57:09 +0000 (14:57 +0200)]
amd-iommu: disable iommu_hap_pt_share with AMD IOMMUs
According to the comment in p2m.h, AMD IOMMUs don't work correctly
with page types different than p2m_ram_rw when the p2m is shared
between HAP and IOMMU, so disable this sharing when using AMD IOMMUs.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Jan Beulich [Fri, 8 Aug 2014 07:34:03 +0000 (09:34 +0200)]
x86_emulate: properly do IP updates and other side effects on success
The two MMX/SSE/AVX code blocks failed to update IP properly, and these
as well as get_reg_refix(), which "manually" updated IP so far, failed
to do the TF and RF processing needed at the end of successfully
emulated instructions.
Fix the test utility at once to check IP is properly getting updated,
and while at it macroize the respective code quite a bit, hopefully
making it easier to add further tests when the need arises.
Reported-by: Andrei LUTAS <vlutas@bitdefender.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
Reviewed-by: Andrew Cooper <andrew.cooper@citrix.com>
Jan Beulich [Fri, 8 Aug 2014 07:32:58 +0000 (09:32 +0200)]
pass-through: fix unbinding of MSI interrupts
Commit
568da4f8 ("pt-irq fixes and improvements") went a little too far
in its cleaning up of pt_irq_destroy_bind(): While neither of the two
lists need any maintenance, the actual unbinding still needs to be
done. Fix this and at once
- move all variables applying only to the PCI/MSI-translate cases into
scopes where they can't be used in error,
- limit the final (optional) log message to the cases it actually
applies and enhance it to make clear how much cleaning up was
actually done.
Reported-by: Sander Eikelenboom <linux@eikelenboom.it>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Tested-by: Sander Eikelenboom <linux@eikelenboom.it>
Paul Durrant [Fri, 8 Aug 2014 07:30:49 +0000 (09:30 +0200)]
x86/viridian: make logging less verbose
The use of gdprintk() adds uninteresting prefixes to the log lines, and
there's really too many lines. This patch reduces the verbosity.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Jan Beulich [Wed, 6 Aug 2014 16:02:41 +0000 (18:02 +0200)]
x86/HVM: command line option adjustments
Adding actual descriptions for them, hiding the hvm_debug= one from
non-debug builds (the option was recognized but didn't take any effect
so far), and adjusting some debug level specifiers to their purpose.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
Jan Beulich [Wed, 6 Aug 2014 16:01:55 +0000 (18:01 +0200)]
x86/APIC: command line option adjustments
Improving their documentation, and converting one option to boolean
since it has only boolean meaning.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Jan Beulich [Wed, 6 Aug 2014 16:00:40 +0000 (18:00 +0200)]
x86/ACPI: command line option adjustments
Improving their documentation, and converting one option to boolean
since it has only boolean meaning.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Ian Campbell [Mon, 4 Aug 2014 14:27:05 +0000 (15:27 +0100)]
autoconf: exec_prefix should default to $prefix not $ac_default_prefix
Otherwise "./configure --prefix=/usr" still ends up with exec_prefix=/usr/local
and therefore LIBDIR, PRIVATE_PREFIX and PRIVATE_BINDIR still point to
/usr/local/foo.
This was broken in
54f28913a2b3 "autoconf: xen: move standard path variables to
config/Paths.mk.in" which tried to add code to expand exec_prefix earlier.
Reported-by: Julien Grall <julien.grall@linaro.org>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Luis R. Rodriguez <mcgrof@suse.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Campbell [Mon, 4 Aug 2014 13:29:17 +0000 (14:29 +0100)]
Makefile inclusion of Paths.mk should be conditional
Since it may not exist when doing e.g. "make clean". There is
existing logic in the makefiles which will raise an error if an
actual build target is invoked without having run configure.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Campbell [Fri, 25 Jul 2014 15:31:46 +0000 (16:31 +0100)]
xen: arm: Add new str* primitives from Linux v3.16-rc6.
Imports:
0a42cb0 arm64: lib: Implement optimized string length routines
Author: zhichang.yuan <zhichang.yuan@linaro.org>
Signed-off-by: Zhichang Yuan <zhichang.yuan@linaro.org>
Signed-off-by: Deepak Saxena <dsaxena@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
192c4d9 arm64: lib: Implement optimized string compare routines
Author: zhichang.yuan <zhichang.yuan@linaro.org>
Signed-off-by: Zhichang Yuan <zhichang.yuan@linaro.org>
Signed-off-by: Deepak Saxena <dsaxena@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Ian Campbell [Fri, 25 Jul 2014 15:22:52 +0000 (16:22 +0100)]
xen: arm: update arm32 assembly primitives to Linux v3.16-rc6
bitops, cmpxchg, atomics: Import:
c32ffce ARM: 7984/1: prefetch: add prefetchw invocations for barriered atomics
Author: Will Deacon <will.deacon@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
atomics: In addition to the above import:
db38ee8 ARM: 7983/1: atomics: implement a better __atomic_add_unless for v6+
Author: Will Deacon <will.deacon@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
spinlocks: We have diverged from Linux, so no updates but note this in the README.
mem* and str*: Import:
d98b90e ARM: 7990/1: asm: rename logical shift macros push pull into lspush lspull
Author: Victor Kamensky <victor.kamensky@linaro.org>
Suggested-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Victor Kamensky <victor.kamensky@linaro.org>
Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
For some reason str* were mentioned under mem* in the README, fix.
libgcc: No changes, update baseline
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Ian Campbell [Fri, 25 Jul 2014 15:22:51 +0000 (16:22 +0100)]
xen: arm: update arm64 assembly primitives to Linux v3.16-rc6
The only really interesting changes here are the updates to mem* which update
to actually optimised versions and introduce an optimised memcmp.
bitops: No change to the bits we import. Record new baseline.
cmpxchg: Import:
60010e5 arm64: cmpxchg: update macros to prevent warnings
Author: Mark Hambleton <mahamble@broadcom.com>
Signed-off-by: Mark Hambleton <mahamble@broadcom.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
e1dfda9 arm64: xchg: prevent warning if return value is unused
Author: Will Deacon <will.deacon@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
e1dfda9 resolves the warning which previous caused us to skip
60010e508111.
Since arm32 and arm64 now differ (as do Linux arm and arm64) here the
existing definition in asm/system.h gets moved to asm/arm32/cmpxchg.h.
Previously this was shadowing the arm64 one but they happened to be identical.
atomics: Import:
8715466 arch,arm64: Convert smp_mb__*()
Author: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
This just drops some unused (by us) smp_mb__*_atomic_*.
spinlocks: No change. Record new baseline.
mem*: Import:
808dbac arm64: lib: Implement optimized memcpy routine
Author: zhichang.yuan <zhichang.yuan@linaro.org>
Signed-off-by: Zhichang Yuan <zhichang.yuan@linaro.org>
Signed-off-by: Deepak Saxena <dsaxena@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
280adc1 arm64: lib: Implement optimized memmove routine
Author: zhichang.yuan <zhichang.yuan@linaro.org>
Signed-off-by: Zhichang Yuan <zhichang.yuan@linaro.org>
Signed-off-by: Deepak Saxena <dsaxena@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
b29a51f arm64: lib: Implement optimized memset routine
Author: zhichang.yuan <zhichang.yuan@linaro.org>
Signed-off-by: Zhichang Yuan <zhichang.yuan@linaro.org>
Signed-off-by: Deepak Saxena <dsaxena@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
d875c9b arm64: lib: Implement optimized memcmp routine
Author: zhichang.yuan <zhichang.yuan@linaro.org>
Signed-off-by: Zhichang Yuan <zhichang.yuan@linaro.org>
Signed-off-by: Deepak Saxena <dsaxena@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
These import various routines from Linaro's Cortex Strings library.
Added assembler.h similar to on arm32 to define the various magic symbols
which these imported routines depend on (e.g. CPU_LE() and CPU_BE())
str*: No changes. Record new baseline.
Correct the paths in the README.
*_page: No changes. Record new baseline.
README previous said clear_page was unused while clear page was, which was
backwards.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Luis R. Rodriguez [Wed, 30 Jul 2014 16:40:03 +0000 (09:40 -0700)]
systemd: add xen systemd service and module files
This adds the systemd xen service / module files and integrates
support into the build system.
This goes in with AX_AVAILABLE_SYSTEMD() which will enable
systemd if development libraries have been found on your
build system. If you don't have systemd on target systems
for binaries built with systemd then the binary will not
work, you must explicitly disable systemd support if you
do not want to build systemd support.
When systemd libraries are present only systems that
have booted into systemd go through the systemd initialization,
otherwise the SysVinit is used.
These are originally based on the Fedora systemd files.
Changes made from Fedora's systemd files:
* split sockets into two files to claim different permissions
* Use /bin/sh -c exec to for a simple launcher implementation
* enables systemd socket activation for C xenstored and Ocaml
oxenstored
* use sd_notify(), so change the service to Type=notify, because of
this we remove the PIDFile specification as we don't care for it, and let
systemd do its magic for us, this also means we don't have to fork
so we use --no-fork with systemd
* defines a modules-load.d, its original source file will be shared
between systemd and old init systems
* simplify service files with ConditionVirtualization=xen which uses
the built in systemd virtualization backend detection, these
service files will not be available to start on systems that do not
boot with xen as a hypervisor
* use autoconf to replace @variable@ paths for us which piggy
backs on top of the latest autoconf changes to xen
* removes oxenstored service file in favor of a system variable which
controls which which xentored to use at run time, we avoid multiple
service files this way.
* simplifies startup to not require polling on the sockets
as initial socket management is handled by systemd, we just
take on the socket later once anything pokes at it, a simple nc -U
(as root) on any of the sockets files can activate the service for example.
Anything queued up will be sent to us once we start. Socket activation
should in theory also let us dynamically switch between xenstores but more
importantly we could upgrade xenstored while keeping all active
socket communication queued up, but in order to take advantage of
this we eventually would need to remove the requirement of not being
able to bring down the xenstored. Even though active sockets are
supported since most libxl communication doesn't triggger a check
on the unix socket first administrators are encouraged to enable
the xenstored.service to triggger an initialization of the xenstored
upon bring up. Some systems also never use unix sockets for
communication with the xenstored and as such active sockets will
not be used there.
* allow for xenstored configuration through *either* of these
configuration files:
- /etc/sysconfig/xenstored
- /etc/default/xenstored
The /etc/default/xenstored will let debian based systems do
the same, while SUSE/OpenSUSE/Fedora/RedHat can keep on chugging
with sysconfig. We leave these files all commented out by default
though given that for systemd we want to encourage not using them.
* ensures we create the run directory as most systems will likely
be using a tmpfs for run dirs for the pid files
* Some systems define the selinux context in the systemd Option for the
/var/lib/xenstored tmpfs:
Options=mode=755,context="system_u:object_r:xenstored_var_lib_t:s0"
For the upstream version we remove that and let systems specify the
context on their system /etc/default/xenstored or /etc/sysconfig/xenstored
$XENSTORED_MOUNT_CTX variable, with a default to none.
* takes advantage of the shared xendomains helper for the xendomains
service
* Add the new dom0 that gets kicked off for disk backend access into
its own systemd service associated to xen
We end up with these systemd files:
General requirements:
* proc-xen.mount
* var-lib-xenstored.mount
xenstored:
* xenstored.service
* xenstored.socket
* xenstored_ro.socket
* xenconsoled.service
* xen-qemu-dom0-disk-backend.service.in
Optional:
* xendomains.service
* xen-watchdog.service
As for integration with xen, we house keep all the systemd files
under a new directory tools/hotplug/Linux/systemd/ and will be targeted
by default when building on Linux systems if systemd development
libraries are present at build time.
The systemd files will be sanitized for meta @VARIABLES@ upon
configuration and installed upon the install target. Systems that
do not use systemd can still get systemd service unit files installed
if the build system enabled systemd support, this however does not
mandate a requirement of having systemd libraries present. Old init
scripts are always installed.
If you don't specify a prefix you will end up with the services
files under /usr/local/lib/systemd/system/ by default, and systemd
modules-load.d conf files under /usr/local/lib/modules-load.d/ which
systemd does look for (although it seems this is not documented).
Distributions are expected to provide their /usr/ prefix to end up in
the more generic location upon distribution install at
/usr/lib/systemd/system/ and /usr/lib/modules-load.d/ respectively.
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Jan Rękorajski <baggins@pld-linux.org>
Cc: M A Young <m.a.young@durham.ac.uk>
Cc: Jacek Konieczny <jajcus@jajcus.net>
Cc: xen-devel@lists.xenproject.org
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- ran autogen.sh ]
Luis R. Rodriguez [Wed, 30 Jul 2014 16:40:02 +0000 (09:40 -0700)]
autoconf: xen: enable explicit preference option for xenstored preference
As it stands oxenstored will be used by default if ocaml tools are
found, the init system will also try to use oxenstored first if its
found otherwise the cxenstored will be used. Lets simplify the init
script and let users be explicit about the preference through configure.
This adds support to let you be explicit about the xenstored preference,
you can only use one of these two options:
./configure --with-xenstored=xenstored
./configure --with-xenstored=oxenstored
We continue with the old behaviour and default oxenstored will be used
but only if you have ocaml dependencies. Since the xenstored preference
is explicit now and since we require configure substitutions for it we
make use of the AX_XEN_EXPAND_CONFIG() helpers as otherwise substitution
for SBINDIR is not propagated from the top level configuration.
All this allows us to simplify the init script to use the configured
xenstore from the start. We update the sysconfig/default xencommons file
with the paths for the different options though, this can be used by
users to override the default xenstored, this follows the old behaviour
but we now just explicitly provide the full configured paths for users.
As before, changing the xenstore requires a reboot.
In order to help with documentation we update the README with some
details on configure usage refer to the wiki [0] [1] [2] for more elaborate
details.
Since we are now parsing an entry within Paths.mk.in on tools we let
the move the parsing of the file to be the tool's configure.
[0] http://wiki.xen.org/wiki/Xenstored
[1] http://wiki.xen.org/wiki/XenStore
[2] http://wiki.xen.org/wiki/XenStoreReference
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Keir Fraser <keir@xen.org>
Cc: Tim Deegan <tim@xen.org>
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- ran autogen.sh ]
Luis R. Rodriguez [Wed, 30 Jul 2014 16:40:01 +0000 (09:40 -0700)]
xencommons: move module list into a generic place
This will allow us to share the same module list with
systemd, and lets us upkeep it in one place. Document this
while at it on the top level README and expand on the wiki:
http://wiki.xen.org/wiki/Category:Host_Configuration#Kernel_modules
In order to upkeep parallelism builds be explicit about the
requirement to complete all actions before any installation
targets.
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Roger Pau Monne [Wed, 23 Jul 2014 15:59:48 +0000 (17:59 +0200)]
libxc: expand cpuid features exposed to PVH guests
Expand the cpuid features exposed to PVH guests, this includes
exposing PSE, PGE and 1GB pages (which will be masked by the
hypervisor if not supported by the hardware).
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Ian Campbell [Fri, 25 Jul 2014 09:32:06 +0000 (10:32 +0100)]
xen: arm: Write to the correct PT when mapping the DTB on boot on arm64
We currently get away with this because when debug=y and earlyprintk is enabled
the previous block of (conditional) code would have set this up. Historically we
mostly got away with it even without those options because the pre paging code
would normally (at least on h/w we test) leave x4 set to the paddr of
boot_second.
This latent bug has always been present but was exposed by
ca59618967fe "xen:
arm: Handle 4K aligned hypervisor load address" (or one of the related patches)
since now x4 is quite likely to point to boot_third not boot_second.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Ian Campbell [Fri, 25 Jul 2014 09:32:12 +0000 (10:32 +0100)]
xen: arm: Correct comment in arm32 head.S
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Roger Pau Monné [Mon, 4 Aug 2014 11:46:54 +0000 (13:46 +0200)]
x86: fix cpuid reporting on PVH Dom0
dab11417d also caused some problems regarding HVM guest creation on
PVH Dom0, mainly the CR4 mask returned by hvm_cr4_guest_reserved_bits
changed from 0xfffffffffffff800 to 0xfffffffffffff893, which means HVM
guests created from a PVH Dom0 are unable to set VME, PVI, PSE or PGE
CR4 flags.
This is because cpuid on PVH guests mask PSE, PGE, PSE36 and VME
flags, so the white listing done in xc_cpuid_hvm_policy doesn't enable
those features, and the guest ends up with a very restrictive cpuid
policy.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Jan Beulich [Mon, 4 Aug 2014 11:46:03 +0000 (13:46 +0200)]
x86/HVM: extend LAPIC shortcuts around P2M lookups
... to all internally handled MMIO regions. It is in particular the
HPET page that, e.g. on Windows Server 2012 R2, can get heavily
accessed, and hence avoiding the unnecessary lookups is rather
beneficial (in the reported case a 40+-vCPU guest would previously not
have booted at all while with hvm_hap_nested_page_fault() shortcut
alone it was able to boot up in 18 minutes [i.e. still room for
improvement]).
Note the apparently unrelated addition of a is_hvm_vcpu() check to the
__hvm_copy() code: Afaict for PVH this shortcut should never have taken
effect (since there's no LAPIC in that case).
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Tim Deegan <tim@xen.org>
Don Slutz [Mon, 4 Aug 2014 11:45:08 +0000 (13:45 +0200)]
console: better handing of console_timestamps as a boolean_param
In order to handle all the old ways, change to use parse_bool().
Signed-off-by: Don Slutz <dslutz@verizon.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Restructure code to limit churn.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Jan Beulich [Mon, 4 Aug 2014 11:44:36 +0000 (13:44 +0200)]
convert "no-" command line option prefix into "=no" for OPT_CUSTOM
... to allow restoring/retaining previous behavior for options getting
converted from boolean to custom. Obviously that'll work only when no
other argument was specified for the option. Command line settings of
the form "no-<name>=<value>" will now be ignored as ambiguous (rather
than being interpreted as "<name>=<value>", i.e. ignoring the "no-"
prefix).
Reported-by: Don Slutz <dslutz@verizon.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Jan Beulich [Mon, 4 Aug 2014 11:43:03 +0000 (13:43 +0200)]
lz4: check for underruns
While overruns are already being taken care of, underruns (resulting
from overflows in the respective "op + length" (or similar) operations
weren't.
This is CVE-2014-4611.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Jan Beulich [Mon, 4 Aug 2014 11:42:34 +0000 (13:42 +0200)]
fix qemu building with older make
The $(or ...) builtin (uses introduced by commits
ffbf089357 and
8962a8f951) is supported only from make 3.81 onwards, yet we claim to
only require make 3.80. Introduce a good enough fallback.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Aravind Gopalakrishnan [Fri, 1 Aug 2014 14:48:30 +0000 (16:48 +0200)]
x86, amd_ucode: safeguard against #GP
When HW tries to load a corrupted patch, it generates #GP
and depending on 'noreboot' parameter on grub, the system
is either stuck in a reboot loop or is hung. Use wrmsr_safe
instead of wrmsrl so that we fail to load microcode gracefully.
Signed-off-by: Aravind Gopalakrishnan <aravind.gopalakrishnan@amd.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Aravind Gopalakrishnan [Fri, 1 Aug 2014 14:47:48 +0000 (16:47 +0200)]
x86, amd_ucode: fix coverity issues found in cpu_request_microcode()
This patch fixes issues reported by coverity.
- CID
1229147: dead code
- CID
1229148: possible resource leak of mc_amd due to goto out statements.
Coverity-IDs:
1229147,
1229148
Reported-by: Andrew Cooper<andrew.cooper3@citrix.com>
Signed-off-by: Aravind Gopalakrishnan <aravind.gopalakrishnan@amd.com>
Reviewed-by: Andrew Cooper<andrew.cooper3@citrix.com>
Vitaly Kuznetsov [Fri, 1 Aug 2014 14:46:40 +0000 (16:46 +0200)]
evtchn: make EVTCHNOP_reset suitable for kexec
It would be nice to allow guests to close all event channels in
ABI-agnostic way in case of kexec/kdump. EVTCHNOP_reset looks suitable
for this purpose. However control blocks for vcpus and event array need
cleanup when FIFO ABI is being used.
With this change a guest can simply do EVTCHNOP_reset before kexec in
both 2-level and FIFO cases. It is also important to perform store/console
channel remapping after such call.
The issue can also be solved by introducing a new EVTCHNOP operation but
it seems that EVTCHNOP_reset can be reused.
[The idea was suggested by Ian Campbell, Andrew Cooper, and David Vrabel]
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Feng Wu [Fri, 1 Aug 2014 14:40:39 +0000 (16:40 +0200)]
x86/hvm: always do SMAP check when updating secondary system time for guest
In this patch, we always do the SMAP check when updating secondary
system time for the guest when SMAP is enabled by it.
Signed-off-by: Feng Wu <feng.wu@intel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Feng Wu [Fri, 1 Aug 2014 14:39:17 +0000 (16:39 +0200)]
x86/hvm: always do SMAP check when updating runstate_guest(v)
In the current implementation, we honor the guest's CPL and AC
to determain whether do the SMAP check or not for runstate_guest(v).
However, this doesn't work. The VMCS feild is invalid when we try
to get geust's SS by hvm_get_segment_register(), since the
right VMCS has not beed loaded for the current VCPU.
In this patch, we always do the SMAP check when updating
runstate_guest(v) for the guest when SMAP is enabled by it.
Reported-by: Sander Eikelenboom <linux@eikelenboom.it>
Signed-off-by: Feng Wu <feng.wu@intel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Sander Eikelenboom <linux@eikelenboom.it>
Andrew Cooper [Fri, 1 Aug 2014 14:32:39 +0000 (16:32 +0200)]
x86/cpu: drop the num_siblings check against nr_cpu_ids
The printk() is missing a newline which resulted in console corruption.
However, nr_cpu_ids can be legitimately lower than valid num_sibling values
given certain compile or boot time configuration.
Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Jan Beulich [Fri, 1 Aug 2014 14:29:27 +0000 (16:29 +0200)]
x86/ACPI: allow CMOS RTC use even when ACPI says there is none
HP is setting the ACPI_FADT_NO_CMOS_RTC flag on newer systems,
regardless of whether they're being booted from UEFI. Add a command
line option to allow probing for a working RTC in that case.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Jan Beulich [Fri, 1 Aug 2014 14:28:48 +0000 (16:28 +0200)]
docs: make .txt files over-writable when building from r/o sources
Otherwise an incremental build will fail to overwrite the destination
files.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Dario Faggioli [Tue, 29 Jul 2014 16:07:09 +0000 (18:07 +0200)]
libxl: automatic NUMA placement affects soft affinity
vCPU soft affinity and NUMA-aware scheduling does not have
to be related. However, soft affinity is how NUMA-aware
scheduling is actually implemented, and therefore, by default,
the results of automatic NUMA placement (at VM creation time)
are also used to set the soft affinity of all the vCPUs of
the domain.
Of course, this only happens if automatic NUMA placement is
enabled and actually takes place (for instance, if the user
does not specify any hard and soft affiniy in the xl config
file).
This also takes care of the vice-versa, i.e., don't trigger
automatic placement if the config file specifies either an
hard (the check for which was already there) or a soft (the
check for which is introduced by this commit) affinity.
Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Dario Faggioli [Tue, 29 Jul 2014 16:06:52 +0000 (18:06 +0200)]
libxl/xl: make it possible to specify soft-affinity in domain config file
To do so, we add the vcpu_soft_affinity array to build_info, and
treat it much like vcpu_hard_affinity. The new config option is
called "cpus_soft".
Note that the vcpu_hard_affinity array, introduced in a previous
patch, and the vcpu_soft_affinity array, introduced here, share
the same LIBXL_HAVE_xxx macro, in libxl.h. That is called
LIBXL_HAVE_BUILDINFO_VCPU_AFFINITY_ARRAYS, and was introduced
together with vcpu_hard_affinity, but only inside a comment.
In this change, we uncomment, and hence properly define it.
In order to avoid having to issue separate calls to
libxl_set_vcpuaffinity() (one for hard affinity and one for soft
affinity) in libxl__build_pre(), in case the caller uses
b_info->cpumap (for the former) and b_info->vcpu_soft_affinity (for
the latter), we also set (again!) a new default for b_info->cpumap.
This allows, from this change on, to always and only deal with
b_info->vcpu_hard_affinity all around libxl internals.
Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Dario Faggioli [Tue, 29 Jul 2014 16:06:42 +0000 (18:06 +0200)]
xl: move the vcpu affinity parsing in a function
so that such parsing code can be used for both hard and soft
affinity, the support for which is introduced in the next
change.
This is pure code motion, no functional change intended.
Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Dario Faggioli [Tue, 29 Jul 2014 16:06:28 +0000 (18:06 +0200)]
xl: move away from the use of cpumap for hard affinity
and start using the vcpu_hard_affinity array instead. This is done
as when, in a subsequent patch ("libxl/xl: make it possible to
specify soft-affinity in domain config file") we will become able
to deal with soft affinity, code can be shared.
This change also enables more advanced VCPU to PCPU (hard, for now)
affinity specification, in case a list is used, like:
cpus = ["3-4", "2-6,^4"]
What it means is that VCPU 0 must be pinned to PCPU 3,4 and VCPU 1
to PCPUs 2,3,5,6 (before this change, cpus=[xx, yy] only supported
single values). Of course, the old (e.g., cpus=[2, 3]) syntax
continues to work.
Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Dario Faggioli [Tue, 29 Jul 2014 16:06:17 +0000 (18:06 +0200)]
xl: enable getting and setting soft affinity
Getting happens via `xl vcpu-list', which now looks like this:
# xl vcpu-list -s
Name ID VCPU CPU State Time(s) Affinity (Hard / Soft)
Domain-0 0 0 11 -b- 5.4 8-15 / all
Domain-0 0 1 11 -b- 1.0 8-15 / all
Domain-0 0 14 13 -b- 1.4 8-15 / all
Domain-0 0 15 8 -b- 1.6 8-15 / all
vm-test 3 0 4 -b- 2.5 0-12 / 0-7
vm-test 3 1 0 -b- 3.2 0-12 / 0-7
Setting happens by specifying two pCPU masks to the `xl vcpu-pin'
command, the first one will be hard affinity, the second soft
affinity. If only one mask is specified, it is only hard affinity
that is affected. To change only soft affinity, '-' can be used
as the hard affinity mask parameter, and it will be left alone.
xl manual page is updated accordingly.
Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Don Slutz [Mon, 28 Jul 2014 16:06:02 +0000 (12:06 -0400)]
xenbaked.c: Fix return handling for case of mmap failure
mmap() returns MAP_FAILED not NULL.
Signed-off-by: Don Slutz <dslutz@verizon.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Don Slutz [Mon, 28 Jul 2014 16:06:01 +0000 (12:06 -0400)]
libxl_internal.c: Fix return handling for case of mmap failure
mmap() returns MAP_FAILED not NULL.
Signed-off-by: Don Slutz <dslutz@verizon.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Don Slutz [Mon, 28 Jul 2014 16:06:00 +0000 (12:06 -0400)]
loadpolicy.c: Fix return handling for case of mmap failure
mmap() returns MAP_FAILED not NULL.
Signed-off-by: Don Slutz <dslutz@verizon.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Andrew Cooper [Tue, 29 Jul 2014 15:02:25 +0000 (17:02 +0200)]
x86/cpu: undo BIOS CPUID max_leaf limit before querying for features
If IA32_MISC_ENABLE[22] is set by the BIOS, CPUID.0.EAX will be limited to 3.
Lift this limit before considering whether to query CPUID.7[ECX=0].EBX for
features.
Without this change, dom0 is able to see this feature leaf (as the limit was
subsequently lifted), and will set features appropriately in HVM domain cpuid
policies.
The specific bug XenServer observed was the advertisement of the FSGSBASE
feature, but an inability to set CR4.FSGSBASE as Xen considered the bit to be
reserved as cpu_has_fsgsbase incorrectly evaluated as false.
This is a regression introduced by c/s
44e24f8567 "x86: don't call
generic_identify() redundantly" where the redundant call actually resampled
CPUID.7[ECX=0] properly to obtain the feature flags.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Aravind Gopalakrishnan [Tue, 29 Jul 2014 14:51:51 +0000 (16:51 +0200)]
x86, amd_ucode: remove needless cast
Missed cleaning up this cast as part of
0aacc28.
Doing that here; and we can remove 'off' variable as well,
just use *offset in it's place.
Signed-off-by: Aravind Gopalakrishnan <aravind.gopalakrishnan@amd.com>
Jan Beulich [Tue, 29 Jul 2014 14:51:26 +0000 (16:51 +0200)]
libxl: use libxl_fd_set_{cloexec,nonblock} helpers
... instead of open-coding them or not using them at all. This in
particular fixes a build (and presumably also runtime) problem on old
enough libc due to the recent introduction of a use of O_CLOEXEC. The
other two changes are only of cleanup kind.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Andrew Cooper [Mon, 28 Jul 2014 14:55:32 +0000 (16:55 +0200)]
x86/hvm: alter hpet_init() to take a domain rather than vcpu
There is nothing vcpu-specific about hpet_init(); all it does is follow the
vcpu's domain pointer to get at the domain vhpet state.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Mon, 28 Jul 2014 14:53:35 +0000 (16:53 +0200)]
annotate debugtrace_printk() with a printf compiler __attribute__
And fix up the resulting compilation issue.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Luis R. Rodriguez [Sat, 26 Jul 2014 02:14:17 +0000 (19:14 -0700)]
autoconf: xen: move standard path variables to config/Paths.mk.in
This moves all generic path variables to a new the config/Paths.mk.in
input source file to be processed at configure time, tons of files use
these so this just share them. This also paves the way to let us
easily dynamically configure these with autoconf, for now we leave the
same presets as was present before.
This work was prompted by looking for an autoconf way to do
replacements for the hotplug global file, while at it I realized
that a few other files use the same variables and have in places
around the tree the same constructs for generating their own
files. This makes use of the old buildmakevars2file() but generalizes
the definition of the paths at configure time and spreads the
new definitions out throughout the build system.
This has no impact on building the hypervisor and extras/mini-os,
you do not need to, and are not expected to, run configure to build
those targets.
While at it lets add some documentation on the for the two files on
the source file, we can expand further details on the wiki [0].
[0] http://wiki.xen.org/wiki/Category:Host_Configuration#System_wide_xen_configuration
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Keir Fraser <keir@xen.org>
Cc: Tim Deegan <tim@xen.org>
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- reran autogen.sh ]
Luis R. Rodriguez [Sat, 26 Jul 2014 02:14:16 +0000 (19:14 -0700)]
oxenstored: also fail if only 1 socket was given by systemd
Reported-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Luis R. Rodriguez [Sat, 26 Jul 2014 02:14:15 +0000 (19:14 -0700)]
cxenstored: also fail if only 1 socket was given by systemd
Reported-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Stefano Stabellini [Wed, 23 Jul 2014 13:37:23 +0000 (14:37 +0100)]
xen/arm: call vcpu_yield on WFE trap
No need to call vcpu_force_reschedule, is too expensive.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Stefano Stabellini [Wed, 23 Jul 2014 13:37:22 +0000 (14:37 +0100)]
xen: export do_yield as vcpu_yield
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
CC: JBeulich@suse.com
Ian Campbell [Sat, 26 Jul 2014 08:04:23 +0000 (09:04 +0100)]
xen: arm: Select ramdisk bootmodule early enough when building dom0
I thought in
0040b649d6df "xen: arm: Only lookup kernel/initrd bootmodule once
while building dom0" that I had identified place_modules as being soon enough,
but I was wrong, since write_properties wants to use it sooner.
Select the initrd boot module in kernel_probe at the same time we select the
kernel to avoid all this.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Andrew Cooper [Fri, 25 Jul 2014 09:55:11 +0000 (11:55 +0200)]
x86/gdbsx: security audit of {,un}pausevcpu and domstatus hypercalls
XEN_DOMCTL_gdbsx_domstatus is already safe. It loops at most over every vcpu
in a domain and breaks at the first vcpu with an event pending, marking it as
not-pending.
XEN_DOMCTL_gdbsx_pausevcpu had an incorrect bounds check against the vcpu id,
allowing an overflow of d->vcpu[] with an id between d->max_vcpus and
MAX_VIRT_CPUS. It was also able to overflow a vcpus pause count by many
repeated hypercalls.
The bounds check is fixed, and vcpu_pause() has been replaced with
vcpu_pause_by_systemcontroller() which cuts out at 255 uses.
XEN_DOMCTL_gdbsx_unpausevcpu suffered from the same bounds problems as its
pause counterpart, and is fixed in exactly the same way. Despite the
atomic_read(&v->pause_count), this code didn't successfully prevent against an
underflow of the vcpu pause count.
The vcpu_unpause() has been replaced with vcpu_pause_by_systemcontroller()
which correctly prevents against underflow. The printk() is updated to have a
proper guest logging level, and provide more useful information in the XSM
case of one domain having debugger privileges over another.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Tim Deegan <tim@xen.org>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Andrew Cooper [Fri, 25 Jul 2014 09:54:20 +0000 (11:54 +0200)]
common: introduce vcpu_{,un}pause_by_systemcontroller() helpers
Which will be used by following patches. Reorder the function declarations
for vcpu/domain pause/unpause to group by vcpu/domain and visually separate
them slightly.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Fri, 25 Jul 2014 09:53:31 +0000 (11:53 +0200)]
x86/gdbsx: invert preconditions for XEN_DOMCTL_gdbsx_{,un}pausevcpu hypercalls
c/s
3eb1c708ab "properly reference count DOMCTL_{,un}pausedomain hypercalls"
accidentally inverted the use of d->controller_pause_count.
Revert back to how it was originally, i.e. the XEN_DOMCTL_gdbsx_{,un}pausevcpu
hypercalls are only valid for a domain already paused by the system controller.
Reported-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Paul Durrant [Fri, 25 Jul 2014 09:51:57 +0000 (11:51 +0200)]
x86: fix ioreq-server event channel vulnerability
The code in hvm_send_assist_req_to_ioreq_server() and hvm_do_resume() uses
an event channel port number taken from the page of memory shared with the
emulator. This allows an emulator to corrupt values that are then blindly
used by Xen, leading to assertion failures in some cases. Moreover, in the
case of the default ioreq server the page remains in the guest p2m so a
malicious guest could similarly corrupt those values.
This patch changes the afforementioned functions to get the event channel
port number from an internal structure and also adds an extra check to
hvm_send_assist_req_to_ioreq_server() which will crash the domain should the
guest or an emulator corrupt the port number in the shared page.
Reported-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Luis R. Rodriguez [Thu, 17 Jul 2014 23:28:15 +0000 (16:28 -0700)]
oxenstored: force FD_CLOEXEC with Unix.set_close_on_exec on LSB init
Lets match the systemd active socket activation implementation and
ensure that FD_CLOEXEC is set by usin Unix.set_close_on_exec. David
notes oxenstored likely does not exec but there is no harm in being
careful just in case things change in the future.
Cc: David Scott <dave.scott@eu.citrix.com>
Cc: Anil Madhavapeddy <anil@recoil.org>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Vincent Hanquez <Vincent.Hanquez@eu.citrix.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Luis R. Rodriguez [Thu, 17 Jul 2014 23:28:14 +0000 (16:28 -0700)]
oxenstored: add support for systemd active sockets
This adds systemd socket activation support for the Ocaml xenstored.
Ocaml lacks systemd library support so we provide our own C helpers
as is done with other functionality lacking on Ocaml.
Active sockets enables oxenstored to be loaded only if required by a system
onto which Xen is installed on. Socket activation is handled by
systemd, once a port for a service which claims a socket is used
systemd will start the required services for it, on demand. For more
details on socket activation refer to Lennart's socket-activation
post regarding this [0].
An important difference with socket activation is that systemd will set
FD_CLOEXEC for us on the socket before giving it to us, we'll sprinkly
the Unix.set_close_on_exec for LSB init next as a separate commit.
Right now this code adds a no-op for this functionality, leaving the
enablement to be done later once systemd is properly hooked into
the build system. The socket activation is ordered in aligment with
the socket activation order passed on to systemd.
[0] http://0pointer.de/blog/projects/socket-activation2.html
Cc: David Scott <dave.scott@eu.citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Vincent Hanquez <Vincent.Hanquez@eu.citrix.com>
Acked-by: Dave Scott <Dave.Scott@citrix.com>
Acked-by: Anil Madhavapeddy <anil@recoil.org>
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
Luis R. Rodriguez [Thu, 17 Jul 2014 23:28:13 +0000 (16:28 -0700)]
cxenstored: add support for systemd active sockets
This adds systemd socket activation support for the C xenstored.
Active sockets enable xenstored to be loaded only if required by a system
onto which Xen is installed on. Socket activation is handled by
systemd, once a port for a service which claims a socket is used
systemd will start the required services for it, on demand. For more
details on socket activation refer to Lennart's socket-activation
post regarding this [0].
Right now this code adds a no-op for this functionality, leaving the
enablement to be done later once systemd is properly hooked into
the build system. The socket activation is ordered in aligment with
the socket activation order passed on to systemd.
[0] http://0pointer.de/blog/projects/socket-activation2.html
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Luis R. Rodriguez [Thu, 17 Jul 2014 23:28:12 +0000 (16:28 -0700)]
xenstored: enable usage of config.h on both xenstored and oxenstored
This will be used later for dynamic configuration paths on C code.
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
Ian Campbell [Mon, 21 Jul 2014 12:16:31 +0000 (13:16 +0100)]
xen: arm: document boot module compatibility based on ordering
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Chunyan Liu [Wed, 23 Jul 2014 09:42:09 +0000 (17:42 +0800)]
fix list_domain_details: check config data length=0
If domain is created through virsh, then in xl, one could see it
with 'xl list', but with 'xl list --long domU', it reports:
"Domain name must be specified."
The reason is xl config data does not exist but it still tries
to parse_config_data in current code.
Improve list_domain_details:
If len of config data is 0, just pass, do not go forward to
parse_config_data, otherwise, it will meet error like
"Domain name not specified" and exit. This error is not expected,
since if code enters list_domain_details, domain name validness
is already checked and domain does exist.
Length of config data is 0 may means: config data does not exist due
to some reason, like: domain is created by libvirt, or in destroying
domain process config data is cleared but domain fails to clean up.
No matter in which case, list_domain_details could just show empty
info, but not error like "Domain name not specified".
Signed-off-by: Chunyan Liu <cyliu@suse.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Andrew Cooper [Tue, 22 Jul 2014 16:17:16 +0000 (17:17 +0100)]
tools/xenconsoled: Log Xen boot messages at startup.
When xenconsoled starts, there will be log lines in the Xen console ring from
boot, even though VIRQ_CON_RING is not yet pending.
Add a force option to handle_hv_logs() which bypasses the event channel check,
allowing xenconsoled to drain the Xen boot messages when it starts, rather
than at the first subsequent time that VIRQ_CON_RING becomes set.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Andrew Cooper [Tue, 22 Jul 2014 16:17:15 +0000 (17:17 +0100)]
tools/xenconsoled: Possibly perform repeated xc_readconsolering() hypercalls
The size of the Xen console ring is runtime configurable, so the statically
sized 16k buffer is not necessarily sufficient. Make repeated
xc_readconsolering() hypercalls while Xen managed to completely fill the
provided buffer.
Also, change the buffer to being static to save on stack space.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Andrew Cooper [Tue, 22 Jul 2014 16:17:14 +0000 (17:17 +0100)]
tools/xenconsoled: Newline on 'Logfile Opened' messages
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
David Scott [Tue, 22 Jul 2014 15:05:18 +0000 (16:05 +0100)]
libxl IDL: the name of a KeyedUnion discriminator need not be 'type'
Signed-off-by: David Scott <dave.scott@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Olaf Hering [Tue, 22 Jul 2014 07:19:17 +0000 (09:19 +0200)]
stubdom: fix -Wextra usage in vtpm_emulator
If -Wextra is appended to CFLAGS it will enable all warnings. Previous
options such as -Wno-unused-parameters have no effect anymore. As a
result compilation will fail with gcc-4.3. Newer versions of gcc will
appearently remember -Wno-* options before -Wextra.
Rearrange warning options for gcc so that -Wextra comes before other -W
options. This fixes compilation of stubdom in SLES11.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Olaf Hering [Tue, 22 Jul 2014 07:19:16 +0000 (09:19 +0200)]
mini-os: tpm: remove usage of inline keyword
Compilation fails with gcc-4.3:
tpmback.c: In function 'tpmback_resp':
tpmback.c:148: error: inlining failed in call to 'tpmdev_check_req': call is unlikely and code size would grow
tpmback.c:165: error: called from here
tpmback.c: In function 'new_tpmif':
tpmback.c:384: error: inlining failed in call to '__init_tpmif': call is unlikely and code size would grow
tpmback.c:425: error: called from here
Adjust code to use static instead of inline, it has the same effect.
Change also tpmif_req_ready and tpmif_req_finished before they start to
cause failures.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Olaf Hering [Tue, 22 Jul 2014 07:19:15 +0000 (09:19 +0200)]
mini-os: tpm: fix array access in locality_enabled
gcc-4.3 fails to prove that array indices will remain positive. Add a
hint for the compiler and check the index value before using it.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Ian Campbell [Wed, 23 Jul 2014 16:45:30 +0000 (17:45 +0100)]
xen: arm: don't release modules which aren't in RAM into the heap
They might be in e.g. flash or something but more likely they could
be in a bank of RAM which we aren't handling or in RAM which the
bootloader hasn't told us about for some reason.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Cc: Fu Wei <fu.wei@linaro.org>
Cc: Roy Franz <roy.franz@linaro.org>
Ian Campbell [Mon, 21 Jul 2014 12:09:16 +0000 (13:09 +0100)]
xen: arm: Only lookup kernel/initrd bootmodule once while building dom0.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Ian Campbell [Mon, 21 Jul 2014 13:00:00 +0000 (14:00 +0100)]
xen: arm: Correctly use GLOBAL/ENTRY in head.S, avoid .global
Use ENTRY() for function entry points since it ensures correct
alignment where GLOBAL() doesn't. The exception is the initial start
label which must be at offset 0, so just use GLOBAL() to avoid the
possibility of realignment.
Since everything happens to already be aligned there should be no
difference to the actual binary. objdump agrees.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Ian Campbell [Mon, 21 Jul 2014 12:59:59 +0000 (13:59 +0100)]
xen: arm: ensure that the boot code is <4K in size
This avoids having to deal with the 1:1 boot mapping crossing a
section or page boundary.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Ian Campbell [Mon, 21 Jul 2014 12:59:58 +0000 (13:59 +0100)]
xen: arm: avoid unnecessary additional mappings in boot page tables.
If the identity map is created at one level then avoid creating
entries further down the boot page tables, since these will be aliases at
strange virtual address.
For example consider an arm32 system (for simplicity) with Xen loaded at
address 0x40402000. As a virtual address this corresponds to walking offsets 1,
2 and 2 at the first, second and third levels respectively.
When creating the identity map we will therefore create a 1GB super mapping at
0x40000000 for the identity map, which is the one we want to use.
However when considering the second level we will see the offset 2 and create a
2MB mapping in slot 2 of boot_second. Since boot_second is mapped in slot 0 of
boot_first this corresponds to an unwanted mapping from virtual address
0x00400000 to physical address 0x40400000.
We still do not handle the case where the load address is within the 2MB range
starting just after XEN_VIRT_START. This is not a regression but this patch
tries to provide a more useful diagnostic message. We do handle loading at
exactly XEN_VIRT_START.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Ian Campbell [Mon, 21 Jul 2014 12:59:57 +0000 (13:59 +0100)]
xen: arm: Do not use level 0 section mappings in boot page tables.
Level 0 does not support superpage mappings, meaning that systems on where Xen
is loaded above 512GB (I'm not aware of any such systems) the 1:1 mapping on
the boot page tables is invalid.
In order to avoid this issue we need an additional first level page table
mapped by the appropriate L0 slot and containing a 1:1 superpage mapping.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Ian Campbell [Mon, 21 Jul 2014 12:59:56 +0000 (13:59 +0100)]
xen: arm: Handle 4K aligned hypervisor load address.
Currently the boot page tables map Xen at XEN_VIRT_START using a 2MB section
mapping. This means that the bootloader must load Xen at a 2MB aligned address.
Unfortunately this is not the case with UEFI on the Juno platform where Xen
fails to boot. Furthermore the Linux boot protocol (which Xen claims to adhere
to) does not have this restriction, therefore this is our bug and not the
bootloader's.
Fix this by adding third level pagetables to the boot time pagetables, allowing
us to map a Xen which is aligned only to a 4K boundary. This only affects the
boot time page tables since Xen will later relocate itself to a 2MB aligned
address. Strictly speaking the non-boot processors could make use of this and
use a section mapping, but it is simpler if all processors follow the same boot
path.
Strictly speaking the Linux boot protocol doesn't even require 4K alignment
(and apparently Linux can cope with this), but so far all bootloaders appear to
provide it, so support for this is left for another day.
In order to use LPAE_ENTRIES in head.S we need to define it in an asm friendly
way.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
[ ijc -- properly format message "- FOO -\r\n" ]
Ian Campbell [Mon, 21 Jul 2014 12:59:55 +0000 (13:59 +0100)]
xen: arm: correct whitespace/comments and use #defines in head.S
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Ian Campbell [Mon, 21 Jul 2014 11:29:14 +0000 (12:29 +0100)]
libxc: disable valgrind integration when building for minios
The stubdom build system incorrectly picks up on the hosts
installation of Valgrind, which cannot work in a stubdom environment.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Tested-by: Simon Martin <furryfuttock@gmail.com>
Reviewed-by: Andrew Cooper<andrew.cooper3@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
[ ijc -- s/define/defined/ ]
Jan Beulich [Thu, 24 Jul 2014 06:58:10 +0000 (08:58 +0200)]
document IOMMU related command line options
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Aravind Gopalakrishnan [Wed, 23 Jul 2014 16:14:41 +0000 (18:14 +0200)]
x86, amd_ucode: support multiple container files appended together
This patch adds support for parsing through multiple AMD container
binaries concatenated together. It is a feature already present in Linux.
Link to linux patch:
http://lkml.kernel.org/r/
1370463236-2115-3-git-send-email-jacob.shin@amd.com
Other changes introduced:
- Define HDR_SIZE's explicitly for code clarity.
- Minor cleanup: Remove extra casts in that are used in
install_equiv_cpu_table()
Signed-off-by: Aravind Gopalakrishnan <aravind.gopalakrishnan@amd.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Andrew Cooper [Wed, 23 Jul 2014 16:08:47 +0000 (18:08 +0200)]
x86/kexec: fix kexec on systems which boot in x2apic mode
Moving straight from fully disabled to x2apic mode is an illegal state
transition, and causes an unconditional #GP fault. Bounce through xapic mode
to avoid the fault.
In addition, avoid bouncing through the various apic modes if the mode is
already correct.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Andrew Cooper [Wed, 23 Jul 2014 16:08:04 +0000 (18:08 +0200)]
x86/mem_event: prevent underflow of vcpu pause counts
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Tested-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
Reviewed-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Tested-by: Aravindh Puthiyaparambil <aravindp@cisco.com>
Andrew Cooper [Wed, 23 Jul 2014 16:07:11 +0000 (18:07 +0200)]
x86/mem_event: validate the response vcpu_id before acting on it
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Tim Deegan <tim@xen.org>
Reviewed-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Tested-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
Tamas K Lengyel [Wed, 23 Jul 2014 16:05:11 +0000 (18:05 +0200)]
x86/mem_event: fix regression affecting CR0 memory events
This is a patch repairing a regression in code previously functional in 4.1.x.
It appears that, during some refactoring work, call to hvm_memory_event_cr0 was lost.
This function was originally called in mov_to_cr() of vmx.c, but the commit
http://xenbits.xen.org/hg/xen-unstable.hg/rev/
1276926e3795 abstracted the
original code into generic functions up a level in hvm.c, dropping the call
in the process.
The same issue affected the CR3 and CR4 events, which were fixed in patch
http://xenbits.xensource.com/hg/xen-unstable.hg/rev/
7ab899e46347.
Signed-off-by: Tamas K Lengyel <tamas.lengyel@zentific.com>
Reviewed-by: Tim Deegan <tim@xen.org>
Andrew Cooper [Wed, 23 Jul 2014 16:04:28 +0000 (18:04 +0200)]
x86: fix pvh dom0 boot after
dab11417d
Changeset
dab11417d
"x86/HVM: consolidate and sanitize CR4 guest reserved bit determination"
did not take into account the fact that dom0 does not have a cpuid policy. As
a result, PVH dom0s would be given unexpected #GP faults on boot.
In addition to the restore case (where the toolstack has not had time to load
a cpuid policy), unconditionally exempt the hardware domain from needing a
policy.
Reported-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Tested-by: Roger Pau Monné <roger.pau@citrix.com>
Juergen Gross [Wed, 23 Jul 2014 16:03:19 +0000 (18:03 +0200)]
avoid crash when doing shutdown with active cpupools
When shutting down the machine while there are cpus in a cpupool other than
Pool-0 a crash is triggered due to cpupool handling rejecting offlining the
non-boot cpus in other cpupools.
It is easy to detect this case and allow offlining those cpus.
Reported-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Tested-by: Stefan Bader <stefan.bader@canonical.com>
Andrew Cooper [Wed, 23 Jul 2014 16:01:28 +0000 (18:01 +0200)]
x86: Remove USER_MAPPINGS_ARE_GLOBAL definition
It has been unconditionally enabled for 64bit Xen builds since 2006
c/s
6f562e72 "[XEN][X86_64] USe GLOBAL bit to build user mappings."
Adjust the order of definitions in x86_64/page.h to put the bit definitions
for pte flags together.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Ian Campbell [Fri, 18 Jul 2014 13:08:19 +0000 (14:08 +0100)]
xen: arm: update multiboot device tree bindings.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Ian Campbell [Fri, 18 Jul 2014 13:08:18 +0000 (14:08 +0100)]
xen: arm: support bootmodule type detection by ordering
Assign modules types based on the order in which they are defined in the FDT.
This is supported only for the dom0 kernel and ramdisk when given as the first
and second modules respectively, similar to how
http://wiki.xen.org/wiki?title=Xen_ARM_with_Virtualization_Extensions/Multiboot&oldid=11824
defined the default types from the bootloader side.
This is compatible with how Xen interprets the modules with x86 multiboot and I
think simplifies things for bootloaders which now need not contain similar
guessing code if they only care about the most basic case.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Ian Campbell [Fri, 18 Jul 2014 13:08:17 +0000 (14:08 +0100)]
xen: arm: store per-boot module type instead of relying on index
This is more natural and better matches how multiboot is actually supposed to
work.
As part of this we need to modify consider_modules to handle Xen not
necessarily being module zero any more. To do this we first register a module
for Xen at the original load address and then update after we have relocated.
This is also fixing a latent issue which is that get_xen_paddr() would not
consider Xen's current physical address when picking the target address which
was buggy because the relocation code cannot handle the possibility of the old
and new locations overlapping.
All callers of consider_modules now consider the full range instead of some
skipping slot 0.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Ian Campbell [Fri, 18 Jul 2014 13:08:16 +0000 (14:08 +0100)]
xen: arm: move device_tree_bootargs to bootfdt.c, renaming to boot_fdt_cmdline
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Ian Campbell [Fri, 18 Jul 2014 13:08:15 +0000 (14:08 +0100)]
xen: arm: move boot time fdt parsing into separate file.
Move the early code for walking the flattened device tree out of device_tree.c.
The intention is that eventually only the proper (i.e. unflattened) device
tree support will live in device_tree.c.
The new home is bootfdt.c to try and better reflect the purpose of the code.
Although in theory this early code could be generic in reality it is pretty ARM
specific, so place it under xen/arch/arm until a second user wants it.
As part of the move rename device_tree_early_init to boot_fdt_info. Drop
device_tree_dump, it is unused.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Ian Campbell [Fri, 18 Jul 2014 13:08:14 +0000 (14:08 +0100)]
xen: arm: rename early_info structs
There isn't really anything Device Tree specific about the early_info, we just
happen to get it from device tree (but in the future it might come e.g. from
UEFI or ACPI or something else).
Move the relevant structs out of device_tree.h and into asm/setup.h and rename to
be more neutral.
For now the code to parse the DT into the now arch specific structs remains in
common code.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Ian Campbell [Fri, 18 Jul 2014 13:08:13 +0000 (14:08 +0100)]
xen: arm: prefer typesafe max()/min() over MAX()/MIN()
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Ian Campbell [Fri, 18 Jul 2014 13:08:12 +0000 (14:08 +0100)]
xen: arm: /chosen/module@N/bootargs bootprotcol node is not deprecated
When using a multiboot capable bootloader this is exactly the field which
should be used.
Replace the deprecation wording with a reference to the information on the
priority of the bootargs fields.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Ian Campbell [Fri, 18 Jul 2014 13:08:11 +0000 (14:08 +0100)]
xen: arm: implement generic multiboot compatibility strings
This causes Xen to accept the more generic names specified in
http://wiki.xen.org/wiki/Xen_ARM_with_Virtualization_Extensions/Multiboot as of
2014-06-06.
These names are more generic than those proposed by Andre in
http://thread.gmane.org/gmane.linux.linaro.announce.boot/326 and those
used in earlier drafts of the /Multiboot wiki page.
This will allow bootloaders to not special case Xen (or at least to reduce
the amount which is required).
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Ian Campbell [Fri, 18 Jul 2014 13:33:59 +0000 (14:33 +0100)]
xen: arm: avoid reusing incorrect mappings when walking the p2m.
When we change which PT page we are mapping at a given level then we need to
invalidate any cached mappings further down the tree, otherwise we risk using
them because their offset might match but be based on a different offset
further up the table.
e.g. when remapping first then cur_first_offset and cur_second_offset (which
indicate the currently mapped second and third tables respectively) both become
invalid
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Dushyant Behl [Sun, 20 Jul 2014 20:52:59 +0000 (02:22 +0530)]
extras/mini-os/tpmback.c: fix compilation error.
This patch is with respect to the following discussion on xen-devel -
http://lists.xenproject.org/archives/html/xen-devel/2014-07/msg01991.html
The file extras/mini-os/tpmback.c was failing compilation on certain compilers
because of size mismatch between enum and int. Earlier the code used to read
value of enum using %d format, which failed compilation on some compilers:
tpmback.c: In function ‘tpmif_change_state’:
tpmback.c:350:4: error: format ‘%d’ expects argument of type ‘int *’,
but argument 3 has type ‘enum xenbus_state *’ [-Werror=format=]
if(sscanf(value, "%d", &readst) != 1) {
^
Now the value is read into an actual int variable and then assigned to the
enum.
Signed-off-by:- Dushyant Behl <myselfdushyantbehl@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
[ ijc -- added the actual error to the commit log ]
Ian Campbell [Mon, 14 Jul 2014 16:39:10 +0000 (17:39 +0100)]
xen: arm: flush TLB after overwriting 1:1 mapping in boot page tables
Otherwise a stale TLB entry can shadow the fixmap/UART or DTB mapping
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>