Commit Graph
30250 Commits
Author SHA1 Message Date
Stefano Stabellini d8e1ee8182 libxl_set_memory_target: only remove videoram from absolute targets
If the new target is relative to the current target, do not remove
videoram again: it has already been removed from the current target.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2015-02-02 14:33:12 +00:00
Julien Grall d0b2caa80f xen/arm: vgic-v2: message in the emulation code should be rate-limited
printk is not rated-limited by default. Therefore a malicious guest may
be able to flood the Xen console.

If we use gdprintk, unecessary information will be printed such as the
filename and the line. Instead use XENLOG_G_ERR combine with %pv.

This is XSA-118.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2015-01-29 15:56:24 +00:00
Julien Grall c96222cc6d xen/arm: vgic-v3: message in the emulation code should be rate-limited
printk by default is not rate-limited by default. Therefore a malicious guest
may be able to flood the Xen console.

If we use gdprintk, unnecessary information will be printed such as the
filename and the line. Instead use XENLOG_G_{ERR,DEBUG} combine with %pv.

Also remove the vGICv3 prefix which is not neccessary and update some
message which were wrong.

This is XSA-118.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2015-01-29 15:56:21 +00:00
Jan Beulich 9f7798eb6e gnttab: fix a printk() format specifier
... to fix arm32 build.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
2015-01-29 15:57:11 +01:00
Julien Grall 685b1dcb51 random: add missing include xen/cache.h
The commit f6c9698 " x86: allow reading MSR_IA32_TSC with XENPF_resource_op"
introduced a built regression on ARM platform.

random.c:8:28: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘boot_random’
 unsigned int __read_mostly boot_random;
                            ^
The define __read_mostly is defined in asm/cache.h which is included by
other headers on x86 but not on ARM. Include xen/cache.h to fix the
build.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2015-01-29 15:50:00 +01:00
Jan Beulich 7977148fee x86/shadow: use shorter constants for callback masks
private.h defining them I can't see why they couldn't be used here to
make the code easier to read.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Tim Deegan <tim@xen.org>
2015-01-29 13:46:17 +00:00
Jan Beulich 88d07de868 x86/shadow: adjust mask shadow_audit_tables() passes to hash_foreach()
It so far having been ~1 made most of the code preceding the call
pointless, but I assume this wasn't meant to be that way. Also replace
the remaining hard coded ~1 with an expression documenting the
intention a little better.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

Adjust again to use SHF_page_type_mask, at Jan's suggestion.

Signed-off-by: Tim Deegan <tim@xen.org>
2015-01-29 13:44:49 +00:00
Jan Beulich b8dbddd310 x86/shadow: convert non-const statics
To make obvious that such statics are safe to use, they should be
const. In some of the cases, they wouldn't even need to be static, but
keep them so upon the maintainer's request.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Tim Deegan <tim@xen.org>
2015-01-29 13:44:28 +00:00
Jan Beulich 54057a28f2 x86: support SMBIOS v3
While presumably of primary use to ARM64 (once the code gets
generalized), we should still support this more modern variant,
allowing for the actual DMI data to reside in memory above 4Gb.

While based on draft version 3.0.0d, it is assumed that the final
version of the specification will not render this implementation
invalid (not the least because Linux 3.19 already makes the same
assumption).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
2015-01-29 14:24:04 +01:00
David Vrabel d28f42f270 grant-table: defer releasing pages acquired in a grant copy
Acquiring a page for the source or destination of a grant copy is an
expensive operation.  A common use case is for two adjacent grant copy
ops to operate on either the same source or the same destination page.

Instead of always acquiring and releasing destination and source pages
for each operation, release the page once it is no longer valid for
the next op.

If either the source or destination domains changes both pages are
released as it is unlikely that either will still be valid.

XenServer's performance benchmarks show modest improvements in network
receive throughput (netback uses grant copy in the guest Rx path) and
no regressions in disk performance (using tapdisk3 which grant copies
as the backend).

                         Baseline   Deferred Release
Interhost receive to VM   7.2 Gb/s  ~9 Gbit/s
Interhost aggregate      24 Gb/s    28 Gb/s
Intrahost single stream  14 Gb/s    14 Gb/s
Intrahost aggregate      34 Gb/s    36 Gb/s
Aggregate disk write    900 MB/s   900 MB/s
Aggregate disk read     890 MB/s   890 MB/s

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Reviewed-by: Tim Deegan <tim@xen.org>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2015-01-29 14:22:22 +01:00
David Vrabel 3c72f8c2cf grant-table: refactor grant copy to reduce duplicate code
Much of the grant copy operation is identical for the source and
destination buffers.  Refactor the code into per-buffer functions.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Tim Deegan <tim@xen.org>
2015-01-29 14:21:00 +01:00
Jan Beulich 3c2550884d x86/shadow: make some log-dirty handling functions static
Noticed while introducing the stub replacement for disabling shadow
paging support at build time.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Tim Deegan <tim@xen.org>
2015-01-29 11:55:15 +00:00
Dan Carpenter 39798e95a9 bunzip2: off by one in get_next_block()
"origPtr" is used as an offset into the bd->dbuf[] array.  That array is
allocated in start_bunzip() and has "bd->dbufSize" number of elements so
the test here should be >= instead of >.

Later we check "origPtr" again before using it as an offset so I don't
know if this bug can be triggered in real life.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Trivial adjustments to make the respective Linux commit
b5c8afe5be51078a979d86ae5ae78c4ac948063d apply to Xen.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2015-01-28 16:50:08 +01:00
Jan Beulich e5f317bda1 x86: skip further initialization for idle domains
While in the end not really found necessary, early versions of the
patches to follow pointed out that we needlessly set up paging for idle
domains. Arranging for that to be skipped made me notice that we can at
once skip vMCE setup for them. Leverage to adjustment to further
re-arrange the way FPU setup gets skipped.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2015-01-28 16:38:20 +01:00
Chao Peng f6c9698d7f x86: allow reading MSR_IA32_TSC with XENPF_resource_op
Memory bandwidth monitoring requires system time information returned
along with the monitoring counter to verify the correctness of the
counter value and to calculate the time elapsed between two samplings.

Add MSR_IA32_TSC to the read path and it returns scaled system time(ns)
instead of raw timestamp to elimanate the needs to convert. The return
time is obfuscated with booting random to eliminate the potential abuse
of it. RESOURCE_ACCESS_MAX_ENTRIES is also increased to 3 so MSR_IA32_TSC
can be used together with an MSR write/read operation pair.

Signed-off-by: Chao Peng <chao.p.peng@linux.intel.com>

Fix uninitialized variable build error.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
2015-01-28 16:36:36 +01:00
Jan Beulich c2ba001caf kexec: prefer __copy_to_guest() when possible
It's slightly cheaper and safe as long a copy_from_guest() for the same
guest address range was issued before.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: David Vrabel <david.vrabel@citrix.com>
2015-01-28 16:32:01 +01:00
Andrew Cooper 89c381c30b docs/commandline: correct information for 'x2apic_phys' parameter
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
2015-01-28 16:31:07 +01:00
Jan Beulich 2eb41660bf x86: also use tzcnt instead of bsf in __scanbit()
... when available, i.e. by runtime patching. This saves the
conditional move, having a back-to-back dependency on BSF's (EFLAGS)
result.

The need to include asm/cpufeatures.h from asm/bitops.h requires a
workaround for an otherwise resulting circular header file dependency:
Provide a mode by which the including site of the former header can
request to only get the X86_FEATURE_* defines (and very little more)
from it, allowing it to nevertheless be included in its entirety later
on.

While doing this I also noticed that the function's "max" parameter was
pointlessly "unsigned long" - the function only returning
"unsigned int", this can't be of any use, and hence gets converted at
once, along with the necessary adjustments to CMOVZ's output operands.

Note that while only alternative_io() is needed by this change (and
hence gets pulled over from Linux), for completeness its input-only
counterpart alternative_input() gets added as well.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2015-01-28 16:29:46 +01:00
Wei Liu a4a0066eb1 libxl: correct function name
spaw_ -> spawn_

Signed-off-by: Wei Liu <wei.liu2@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>
2015-01-28 14:07:28 +00:00
Andrew Cooper 755a7aaee0 tools/libxc: Disable CONFIG_MIGRATE in stubdom environments
The legacy save/restore infrastructure requires several function pointers from
the toolstack (libxl or Xend in the past) in order to work, and for HVM guests
also need to be able to play around in dom0's filesystem to move the device
model save record.

Migration v2 changes some of this, but is similarly dependent on
toolstack-provided function pointers.

Someone who wishes to re-architect the interaction of moving parts for running
a domain might be in a position to re-enabled this, but for now, explicitly
fail with ENOSYS (from xc_nomigrate.c) rather than failing with an error about
a missing function pointer (or indeed falling over a NULL pointer on certain
paths).

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2015-01-28 13:28:46 +00:00
Andrew Cooper 3380f5b627 ocaml/xenctrl: Check return values from hypercalls
rather than blindly continuing and possibly using negative values.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Dave Scott <dave.scott@eu.citrix.com>
Acked-by: David Scott <dave.scott@citrix.com>
2015-01-28 13:10:56 +00:00
Oleksandr Tyshchenko 57255adfe1 xen/arm: split the init_xen_time() in 2 parts
Create preinit_xen_time() and move to it minimum required
subset of operations needed to properly initialized
cpu_khz and boot_count vars. This is allow us to use udelay()
immediately after the call.

Signed-off-by: Oleksandr Tyshchenko <oleksandr.tyshchenko@globallogic.com>
Reviewed-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2015-01-28 13:10:26 +00:00
Quan Xu 8e906a2a18 vTPM/TPM2: Record some infomation in docs/misc/vtpmmgr.txt about
'vtpmmgr on TPM 2.0'

Signed-off-by: Quan Xu <quan.xu@intel.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
2015-01-28 12:54:50 +00:00
Quan Xu b1fee946d3 vTPM/TPM2: Unind group keys and sectors data on disk
Signed-off-by: Quan Xu <quan.xu@intel.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
2015-01-28 12:54:50 +00:00
Quan Xu b80533f680 vTPM/TPM2: Bind group keys and sectors data on disk
Signed-off-by: Quan Xu <quan.xu@intel.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
2015-01-28 12:54:50 +00:00
Quan Xu b8d8733f89 vTPM/TPM2: Support TPM 2.0 bind and unbind data
Bind data with TPM2_RSA_Encrypt, which performs RSA encryption using
the indicated padding scheme according to PKCS#1v2.1(PKCS#1). If the
scheme of keyHandle is TPM_ALG_NULL, then the caller may use inScheme
to specify the padding scheme.
Unbind data with TPM2_RSA_Decrypt, which performs RSA decryption using
the indicated padding scheme according to PKCS#1v2.1(PKCS#1).

Signed-off-by: Quan Xu <quan.xu@intel.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
2015-01-28 12:54:50 +00:00
Quan Xu 98cbe87243 vTPM/TPM2: TPM 2.0 PCRs read
Signed-off-by: Quan Xu <quan.xu@intel.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
2015-01-28 12:54:50 +00:00
Quan Xu 71a7c55ad0 vTPM/TPM2: Support 'tpm2' extra command line.
Make vtpm-stubdom domain compatible to launch on TPM 1.x / TPM 2.0.
Add:
..
     extra="tpm2=1"
..
to launch vtpm-stubdom domain on TPM 2.0, ignore it on TPM 1.x. for
example,
vtpm-stubdom domain configuration on TPM 2.0:

  kernel="/usr/lib/xen/boot/vtpmmgr-stubdom.gz"
  memory=16
  disk=["file:/var/scale/vdisk/vmgr,hda,w"]
  name="vtpmmgr"
  iomem=["fed40,5"]
  extra="tpm2=1"

vtpm-stubdom domain configuration on TPM 1.x:

  kernel="/usr/lib/xen/boot/vtpmmgr-stubdom.gz"
  memory=16
  disk=["file:/var/scale/vdisk/vmgr,hda,w"]
  name="vtpmmgr"
  iomem=["fed40,5"]

Signed-off-by: Quan Xu <quan.xu@intel.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
2015-01-28 12:54:50 +00:00
Quan Xu df75aa4aa6 vTPM/TPM2: Add main entrance vtpmmgr2_init()
Accept commands from the vtpm-stubdom domains via the mini-os TPM
backend driver. The vTPM manager communicates directly with hardware
TPM 2.0 using the mini-os tpm2_tis driver.

Signed-off-by: Quan Xu <quan.xu@intel.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
2015-01-28 12:54:50 +00:00
Quan Xu 1710fc49a0 vTPM/TPM2: TPM2.0 TIS initialization and self test.
call the TPM 2.0 various registers that allow communication between
the TPM 2.0 and platform hardware and software. TPM2_SelfTest causes
the TPM 2.0 to perform a test of its capabilities.

Signed-off-by: Quan Xu <quan.xu@intel.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
2015-01-28 12:54:49 +00:00
Quan Xu 3334d916de vTPM/TPM2: Create and load SK on TPM 2.0
TPM2_Create is used to create an object that can be loaded into a
TPM using TPM2_Load(). If the command completes successfully, the
TPM will create the new object and return the object’s creation.
data (creationData), its public area (outPublic), and its encrypted
sensitive area (outPrivate). Preservation of the returned data is
the responsibility of the caller. The object will need to be loaded
(TPM2_Load()).
TPM2_Load is used to load objects into the TPM. This command is used
when both a TPM2B_PUBLIC and TPM2B_PRIVATE are to be loaded. If only
a TPM2B_PUBLIC is to be loaded, the TPM2_LoadExternal command is used.

Signed-off-by: Quan Xu <quan.xu@intel.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
2015-01-28 12:54:49 +00:00
Quan Xu b80507775d vTPM/TPM2: TPM 2.0 takes ownership and create SRK
TPM2_CreatePrimary is used to create a Primary Object under one of
the Primary Seeds or a Temporary Object under TPM_RH_NULL. The command
uses a TPM2B_PUBLIC as a template for the object to be created. The
command will create and load a Primary Object. The sensitive area is
not returned. Any type of object and attributes combination that is
allowed by TPM2_Create() may be created by this command. The constraints
on templates and parameters are the same as TPM2_Create() except that a
Primary Storage Key and a Temporary Storage Key are not constrained to
use the algorithms of their parents.

Signed-off-by: Quan Xu <quan.xu@intel.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
2015-01-28 12:54:49 +00:00
Quan Xu de438117e0 vTPM/TPM2: Add TPM 2.0 Exposed APIs
These TPM 2.0 Exposed APIs for the Mini-os to access TPM 2.0
hardware.

Signed-off-by: Quan Xu <quan.xu@intel.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
2015-01-28 12:54:49 +00:00
Quan Xu c574452cdd vTPM/TPM2: Add global data in vtpm_globals{}
These data is for the Mini-os to access TPM 2.0 hardware.

Signed-off-by: Quan Xu <quan.xu@intel.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
2015-01-28 12:54:49 +00:00
Quan Xu 2a10a705b3 vTPM/TPM2: TPM 2.0 data structures marshal
Add TPM 2.0 data structure marshal for packing and unpacking TPM
2.0 data structures.

Signed-off-by: Quan Xu <quan.xu@intel.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
2015-01-28 12:54:49 +00:00
Quan Xu d5123397bd vTPM/TPM2: Add TPM 2.0 data structures and commands definition
Add TPM 2.0 data structures on Trusted Platform Module Library Part 2:
Structures and Trust Platform Module Library Part 3: Commands.

Signed-off-by: Quan Xu <quan.xu@intel.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
2015-01-28 12:54:49 +00:00
Andrew Cooper 027af8cdb3 tools/libxl: Correct static pattern rule for pkgconfig files
Attempting to build libxl causes Make to emit the following warnings

andrewcoop@andrewcoop:xen.git$ make -C tools/libxl all
...
Makefile:253: target `xenlight.pc' doesn't match the target pattern
Makefile:253: target `xlutil.pc' doesn't match the target pattern
...

because the static pattern rule is malformed.  'Makefile' as the only
prereq-pattern does not contain a pattern.

The rule ends up working because of the use of $@.in where $< should have been
used, but lacked any dependency between a $FOO.pc and its .in source file.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2015-01-28 09:59:46 +00:00
Ian Campbell 2d61819c0b xen: arm: enable sync console in machine_reboot.
Otherwise the last thing printed is "(XE" or something.

In line with x86 also disable the watchdog and spin debugging.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Julien Grall <julien.grall@linaro.org>
2015-01-27 16:47:02 +00:00
Sander Eikelenboom 9ba80a722b libxl: Prevent qemu closing QMP socket on shutdown before libxl is done with it.
At present on shutdown when using pci-passthrough with qemu-xen, qemu
closes the QMP socket before libxl is done with it causing these
errors to be logged by libxl:

    Waiting for domain test (domid 1) to die [pid 11568]
    Domain 1 has shut down, reason code 0 0x0
    Action for shutdown reason code 0 is destroy
    Domain 1 needs to be cleaned up: destroying the domain
    libxl: error: libxl_qmp.c:443:qmp_next: Socket read error: Connection reset by peer
    libxl: error: libxl_qmp.c:701:libxl__qmp_initialize: Failed to connect to QMP
    libxl: error: libxl_qmp.c:686:libxl__qmp_initialize: Connection error: Connection refused
    libxl: error: libxl_dm.c:1588:kill_device_model: Device Model already exited
    Done. Exiting now

Prevent this by using the qemu '-no-shutdown' parameter which is
described as doing:

    "Don’t exit QEMU on guest shutdown, but instead only stop the emulation.
     This allows for instance switching to monitor to commit changes to the disk image."

So Qemu will stop emulating, but keeps the QMP socket open and waits
for libxl to kill the qemu process when it is done, preventing the
race and resulting in this to be logged by libxl:

    Waiting for domain test (domid 1) to die [pid 10859]
    Domain 1 has shut down, reason code 0 0x0
    Action for shutdown reason code 0 is destroy
    Domain 1 needs to be cleaned up: destroying the domain
    Done. Exiting now

Signed-off-by: Sander Eikelenboom <linux@eikelenboom.it>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2015-01-27 16:45:29 +00:00
Fabio Fantoni 296c7f3284 libxl: Spice streaming video setting support for upstream qemu
Usage:
spice_streaming_video=[filter|all|off]

Specifies what streaming video setting is to be used by spice (if
given),
otherwise the qemu default will be used.

Signed-off-by: Fabio Fantoni <fabio.fantoni@m2r.biz>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2015-01-27 16:41:31 +00:00
Fabio Fantoni bd71555985 libxl: Spice image compression setting support for upstream qemu
Usage:
spice_image_compression=[auto_glz|auto_lz|quic|glz|lz|off]

Specifies what image compression is to be used by spice (if given),
otherwise the qemu default will be used.

Signed-off-by: Fabio Fantoni <fabio.fantoni@m2r.biz>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2015-01-27 16:40:57 +00:00
Wei Liu ee016c2808 tools/Makefile: fix qemu-xen-traditional build
In d9740237a ("tools: unhook blktap1 from the build and remove all
references to it"), one spot was left unchanged, which leads to failure
in building qemu-xen-traditional.

Signed-off-by: Wei Liu <wei.liu2@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>
2015-01-27 16:37:50 +00:00
Wei Liu accc7f52ba tools: generate systemd service files only when systemd is available
Though that's not in any way harmful but it is on the other hand not
very useful.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
[ ijc -- rerun autogen.sh ]
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2015-01-27 16:35:59 +00:00
Wei Liu f9c9b12775 tools: fix "make distclean"
The original rule to target "distclean" in tools/Rules.mk was in effect
"make clean". It should be "make distclean".

However not all Makefiles in subdirectories have distclean target
defined. So this patch also adds a bunch of distclean targets to various
Makefiles. They only depend on clean target and don't have any actions
in most cases.

With the patch applied, following command outputs 0 results:

  find tools -name 'Makefile*' -exec grep -L 'distclean' {} \+ \
     | grep -v ocaml | grep -v libfsimage

Ocaml and libfsimage are known to have distclean defined in a dedicated
rules file.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2015-01-27 16:34:45 +00:00
Wei Liu 675b2d22a0 libxl: provide xlutil.pc
Please rerun autogen.sh after applying this patch.

Signed-off-by: Wei Liu <wei.liu2@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>
2015-01-27 16:34:05 +00:00
Wei Liu 8d057fc5ea libxl: delete xenlight.pc.in in distclean
That file is generated by configure. Deleting it in "make clean" leads
to rerun configure. Move it under distclean target.

Signed-off-by: Wei Liu <wei.liu2@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>
2015-01-27 16:34:05 +00:00
Julien Grall 5b5c40c0d1 libxc: introduce a per architecture scratch pfn for temporary grant mapping
The code to initialize the grant table in libxc uses
xc_domain_maximum_gpfn() + 1 to get a guest pfn for mapping the grant
frame and to initialize it.

This solution has two major issues:
    - The check of the return of xc_domain_maximum_gpfn is buggy because
    xen_pfn_t is unsigned and in case of an error -ERRNO is returned.
    Which is never catch with ( pfn <= 0 ).
    - The guest memory layout maybe filled up to the end, i.e
    xc_domain_maximum_gpfn() + 1 gives either 0 or an invalid PFN due to
    hardware limitation.

Futhermore, on ARM, xc_domain_maximum_gpfn() is not implemented and
return -ENOSYS. This will make libxc to use always the same PFN which
may colapse with an already mapped region (see xen/include/public/arch-arm.h
for the layout).

This patch only address the problem for ARM, the x86 version use the same
behavior (ie xc_domain_maximum_gpfn() + 1), as I'm not familiar with Xen x86.

A new function xc_core_arch_get_scratch_gpfn is introduced to be able to
choose the gpfn per architecture.

For the ARM version, we use the GUEST_GNTTAB_GUEST which is the base of
the region by the guest to map the grant table. At the build time,
nothing is mapped there.

At the same time correctly check the return of xc_domain_maximum_gpfn
for x86.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Roger Pau Monné <roger.pau@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: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2015-01-27 16:30:35 +00:00
Konrad Rzeszutek Wilk de4f284b3d x86: vcpu_destroy_pagetables() must not return -EINTR
.. otherwise it has the side effect that: domain_relinquish_resources
will stop and will return to user-space with -EINTR which it is not
equipped to deal with that error code; or vcpu_reset - which will
ignore it and convert the error to -ENOMEM..

The preemption mechanism we have for domain destruction is to return
-EAGAIN (and then user-space calls the hypercall again) and as such we need
to catch the case of:

domain_relinquish_resources
  ->vcpu_destroy_pagetables
    -> put_page_and_type_preemptible
       -> __put_page_type
           returns -EINTR

and convert it to the proper type. For:

XEN_DOMCTL_setvcpucontext
 -> vcpu_reset
   -> vcpu_destroy_pagetables

we need to return -ERESTART otherwise we end up returning -ENOMEM.

There are also other callers of vcpu_destroy_pagetables: arch_vcpu_reset
(vcpu_reset) are:
 - hvm_s3_suspend (asserts on any return code),
 - vlapic_init_sipi_one (asserts on any return code),

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
2015-01-26 12:51:09 +01:00
Jan Beulich b18b6daf65 x86: use tzcnt instead of bsf
Following a compiler change done in 2012, make use of the fact that for
non-zero input BSF and TZCNT produce the same numeric result (EFLAGS
setting differs), and that CPUs not knowing of TZCNT will treat the
instruction as BSF (i.e. ignore what looks like a REP prefix to them).
The assumption here is that TZCNT would never have worse performance
than BSF.

Also extend the asm() input in find_first_set_bit() to allow memory
operands.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2015-01-26 12:50:21 +01:00
Andrew Cooper 4b898944d3 x86/HVM: improve EFER validation error messages
The previous error message was very little use in identifying the actual
problem after the fact.  Now, hvm_efer_valid() will indicate the issue which
it objects to, which is far more useful for diagnosing issues from logs.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
2015-01-26 12:48:38 +01:00