]> xenbits.xensource.com Git - xen.git/log
xen.git
13 years agolibxl: reimplement buffer for bootloading and drop data if buffer is full.
Roger Pau Monne [Wed, 2 Nov 2011 15:46:54 +0000 (15:46 +0000)]
libxl: reimplement buffer for bootloading and drop data if buffer is full.

Implement a buffer for the bootloading process that appends data to
the end until it's full. Drop the whole buffer if a timeout has
occurred and the buffer is full. Prevents the bootloader from getting
stuck when using ptys with small buffers.

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agolibxl: update prototype of libxl__spawn_check
Olaf Hering [Thu, 27 Oct 2011 09:54:16 +0000 (11:54 +0200)]
libxl: update prototype of libxl__spawn_check

libxl__spawn_check expects a malloc'd libxl__spawn_starting. The
currently only user of libxl__spawn_check gets a libxl__spawn_starting
and passes it on. Update prototype to not take a void pointer, and also
update comment in header file.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: document spawn related functions
Olaf Hering [Thu, 27 Oct 2011 09:39:11 +0000 (11:39 +0200)]
libxl: document spawn related functions

Group spawn related prototypes and add some documentation.
Remove unused prototype for libxl__log_child_exitstatus

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: add libxl__spawn_confirm_offspring_startup
Olaf Hering [Thu, 27 Oct 2011 09:23:29 +0000 (11:23 +0200)]
libxl: add libxl__spawn_confirm_offspring_startup

libxl__spawn_confirm_offspring_startup() is a generic version of
libxl__confirm_device_model_startup().

Use libxl__spawn_confirm_offspring_startup for device model.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: add libxl__wait_for_offspring function
Olaf Hering [Thu, 27 Oct 2011 09:23:24 +0000 (11:23 +0200)]
libxl: add libxl__wait_for_offspring function

libxl__wait_for_offspring() is a generic version of
libxl__wait_for_device_model().

Use libxl__wait_for_offspring for device model.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: add pid path to libxl__spawner_starting
Olaf Hering [Thu, 27 Oct 2011 09:20:25 +0000 (11:20 +0200)]
libxl: add pid path to libxl__spawner_starting

libxl_spawner_record_pid() should be able to write the pid to arbitrary paths.

v2:
 - use const char* for ->pid_path, and update comment

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: rename dm_xenstore_record_pid to libxl_spawner_record_pid
Olaf Hering [Thu, 27 Oct 2011 09:19:22 +0000 (11:19 +0200)]
libxl: rename dm_xenstore_record_pid to libxl_spawner_record_pid

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: rename libxl__device_model_starting
Olaf Hering [Thu, 27 Oct 2011 09:19:16 +0000 (11:19 +0200)]
libxl: rename libxl__device_model_starting

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agopassthrough: re-attempt ACS and ATS enabling when devices get reported by Dom0
Jan Beulich [Wed, 2 Nov 2011 12:53:05 +0000 (13:53 +0100)]
passthrough: re-attempt ACS and ATS enabling when devices get reported by Dom0

Since extended config space accesses may not be possible when
scan_pci_devices() runs (due to MMCFG resources not being reserved in
the E820 table, which the specification allows to be the case),
functionality enabling of which requires such must be re-attempted
when it is known whether MMCFG is safe to use.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: "Kay, Allen M" <allen.m.kay@intel.com>
13 years agoVT-d/ATS: cleanup
Jan Beulich [Wed, 2 Nov 2011 12:51:28 +0000 (13:51 +0100)]
VT-d/ATS: cleanup

- make acpi_find_matched_atsr_unit() consistent with
  acpi_find_matched_drhd_unit() (and constify their parameter)
- make ats_device() take a struct pci_dev * instead of seg:bus:devfn
  and additionally the matching DRHD (as its callers already worked
  that out)
- remove a stale prototype

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: "Kay, Allen M" <allen.m.kay@intel.com>
13 years agotools/ocaml: unify build process
Christoph Egger [Tue, 1 Nov 2011 19:03:38 +0000 (19:03 +0000)]
tools/ocaml: unify build process

Unify ocaml build process for different platforms.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agodocs: introduce an xl man page in pod format
Stefano Stabellini [Tue, 1 Nov 2011 18:44:34 +0000 (18:44 +0000)]
docs: introduce an xl man page in pod format

This is the initial version of an xl man page, based on the old xm man
page.  Almost every command implemented in xl should be present, a
notable exception are the tmem commands that are currently missing.
Further improvements and clarifications to this man page are very
welcome.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agodocs: install text documentation
Ian Campbell [Thu, 27 Oct 2011 08:55:22 +0000 (09:55 +0100)]
docs: install text documentation

Including markdown docs.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agoxl: add some example configuration files
Ian Campbell [Thu, 27 Oct 2011 08:55:14 +0000 (09:55 +0100)]
xl: add some example configuration files

These are much more minimal than the equivalent xmexamples but should
eventually reference a more complete document describing the available options.

These are based on the guest configuration files that I actually use day-to-day.

There is an unresolved reference to a document describing the complete syntax.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agodocs: add a document describing the xl vif syntax
Ian Campbell [Thu, 27 Oct 2011 08:54:28 +0000 (09:54 +0100)]
docs: add a document describing the xl vif syntax

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agounmodified_drivers: update README from http://wiki.xen.org/xenwiki/UnmodifiedDrivers
Ian Campbell [Wed, 26 Oct 2011 16:44:03 +0000 (17:44 +0100)]
unmodified_drivers: update README from http://wiki.xen.org/xenwiki/UnmodifiedDrivers

Add reference to the fact that these drivers are for "classic-Xen" kernels only
and do not work with PVops but point towards the PVHVM functionality in
mainstream.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agodocs: add some scaffolding for building HTML docs from markdown
Ian Campbell [Wed, 26 Oct 2011 16:23:37 +0000 (17:23 +0100)]
docs: add some scaffolding for building HTML docs from markdown

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agodocs: import HVM emulated device unplug protocol spec
Ian Campbell [Wed, 26 Oct 2011 16:20:21 +0000 (17:20 +0100)]
docs: import HVM emulated device unplug protocol spec

Convert to markdown as I go.

Currently this lives in qemu-xen.git i386-dm/README.hvm-pv-magic-ioport-disable
and I can never find it when I want it. As we transition to upstream qemu this
location becomes less useful.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agodocs: Add HowTo use QEMU upstream.
Anthony PERARD [Tue, 1 Nov 2011 18:28:50 +0000 (18:28 +0000)]
docs: Add HowTo use QEMU upstream.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agoxenstored: Fix processing of zero-length messages
Daniel De Graaf [Tue, 1 Nov 2011 18:25:17 +0000 (18:25 +0000)]
xenstored: Fix processing of zero-length messages

When a message with zero length is sent to xenstore, the body of the
message was not processed until the socket or ring had more data to
read; this will cause deadlocks if the requestor is waiting on a
response to continue.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agolibxl: add a flags argument to libxl_ctx_alloc.
Ian Campbell [Tue, 18 Oct 2011 12:36:43 +0000 (13:36 +0100)]
libxl: add a flags argument to libxl_ctx_alloc.

Currently unused but gives us scope for expansion in an ABI compatible manner
in the future.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: convert PCI device handling to device API
Ian Campbell [Tue, 18 Oct 2011 12:36:43 +0000 (13:36 +0100)]
libxl: convert PCI device handling to device API

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: reorder device functions to put functions for each device together.
Ian Campbell [Tue, 18 Oct 2011 12:36:43 +0000 (13:36 +0100)]
libxl: reorder device functions to put functions for each device together.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: convert VFB handling to device API
Ian Campbell [Tue, 18 Oct 2011 12:36:43 +0000 (13:36 +0100)]
libxl: convert VFB handling to device API

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: convert VKB handling to device API
Ian Campbell [Tue, 18 Oct 2011 12:36:43 +0000 (13:36 +0100)]
libxl: convert VKB handling to device API

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: remove libxl_device_console_add.
Ian Campbell [Tue, 18 Oct 2011 12:36:43 +0000 (13:36 +0100)]
libxl: remove libxl_device_console_add.

It has no callers, the only code which adds consoles in internal to libxl and
uses libxl__device_console_add directly.

Rather than worrying about what the public API should look like in this case
simply remove it, adding new APIs is much easier than fixing broken ones...

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: convert NIC handling to device API
Ian Campbell [Tue, 18 Oct 2011 12:36:42 +0000 (13:36 +0100)]
libxl: convert NIC handling to device API

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: convert disk handling to device API
Ian Campbell [Tue, 18 Oct 2011 12:36:42 +0000 (13:36 +0100)]
libxl: convert disk handling to device API

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: use more descriptive variable names in libxl__devices_destroy.
Ian Campbell [Tue, 18 Oct 2011 12:36:42 +0000 (13:36 +0100)]
libxl: use more descriptive variable names in libxl__devices_destroy.

It's not immediately clear that "l1" iterates over device types and "l2"
iterates over individual devices. Name things in a way which makes this more
obvious.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: merge libxl__device_del into libxl__device_remove
Ian Campbell [Tue, 18 Oct 2011 12:36:42 +0000 (13:36 +0100)]
libxl: merge libxl__device_del into libxl__device_remove

Note that the "wait" parameter added to libxl_device_remove is different to the
wait paramter previously used by similar functions. In the past not-wait meant
forced whereas now in means wait for a graceful shutdown, as opposed to setting
off a graceful shutdown but not waiting.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: use libxl__device in libxl_devices_destroy etc.
Ian Campbell [Tue, 18 Oct 2011 12:36:42 +0000 (13:36 +0100)]
libxl: use libxl__device in libxl_devices_destroy etc.

Use libxl__device in libxl_devices_destroy and
libxl__device_pci_remove_xenstore.

Doing this allows us to use the common functions for removing devices.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: do not remove unidentified frontend paths in libxl__devices_destroy
Ian Campbell [Tue, 18 Oct 2011 12:36:42 +0000 (13:36 +0100)]
libxl: do not remove unidentified frontend paths in libxl__devices_destroy

Currently this appears to only include "/local/domain/<domid>/device/suspend".
Ultimately the caller will nuke the whole guest directory anyway but not having
this function remove things which don't look like devices seems less
surprising.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: use IDL to define device front- and back-end kinds
Ian Campbell [Tue, 18 Oct 2011 12:36:42 +0000 (13:36 +0100)]
libxl: use IDL to define device front- and back-end kinds

I'd like to use the from_string functionality...

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: split forced and non-forced uses of libxl__device_del
Ian Campbell [Tue, 18 Oct 2011 12:36:42 +0000 (13:36 +0100)]
libxl: split forced and non-forced uses of libxl__device_del

Most forced users can now simply call libxl__device_destroy directly.

libxl__devices_destroy is something of a special case, it is really
just iterating over an opaque set of xenstore directories and removing
them. Until this can be refactored just do the force-remove case
manually, doing otherwise led to too much entanglement with the other
callers of libxl__device_destroy which do know about specific device
types.

For the time being do the same in libxl__device_pci_remove_xenstore.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: separate forced and non-forced device remove.
Ian Campbell [Tue, 18 Oct 2011 12:36:42 +0000 (13:36 +0100)]
libxl: separate forced and non-forced device remove.

The function libxl__device_destroy currently takes a force parameter however:

  * in the forced case we initiate a graceful shutdown and then
    immediately nuke the backend directory, quite likely before anyone
    got a chance to react.

  * the callers all have a "wait" variable and pass in "!wait" as the
    force argument which is confusing since not waiting is not really
    the same thing as forcing the destroy.

Therefore split the function into libxl__device_remove and
libxl__device_destroy. The former initiates a graceful shutdown which
the latter simply nukes the backend directory.

This makes some of the callers look a bit odd but that should fall out as I
continue to pull this piece of string.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: libxl_devid_to_* should take an integer device id
Ian Campbell [Tue, 18 Oct 2011 12:36:42 +0000 (13:36 +0100)]
libxl: libxl_devid_to_* should take an integer device id

Currently takes a string.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: reimplement devid->disk in terms of from_xs_be function.
Ian Campbell [Tue, 18 Oct 2011 12:36:42 +0000 (13:36 +0100)]
libxl: reimplement devid->disk in terms of from_xs_be function.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: reimplement devid->nic in terms of from_xs_be function.
Ian Campbell [Tue, 18 Oct 2011 12:36:42 +0000 (13:36 +0100)]
libxl: reimplement devid->nic in terms of from_xs_be function.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: update nic list API to use common device API style
Ian Campbell [Tue, 18 Oct 2011 12:36:42 +0000 (13:36 +0100)]
libxl: update nic list API to use common device API style

libxl_device_nic_list returns an array of libxl_device_nic and
libxl_device_nic_getinfo retrieves further information.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: do not read f.e. xenstore dir in disk list function
Ian Campbell [Tue, 18 Oct 2011 12:36:15 +0000 (13:36 +0100)]
libxl: do not read f.e. xenstore dir in disk list function

Instead store a duplicate of the "device-type" node in the backend dir
and use that instead.

This maintains the invariant that the list function is always "safe".

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: refactor code to construct disk from xenstore backend
Ian Campbell [Tue, 18 Oct 2011 09:35:56 +0000 (10:35 +0100)]
libxl: refactor code to construct disk from xenstore backend

Temporarily retain unsafe behaviour of reading f.e. directory.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: various fixes to libxl_device_disk_list (and internals)
Ian Campbell [Tue, 18 Oct 2011 09:35:55 +0000 (10:35 +0100)]
libxl: various fixes to libxl_device_disk_list (and internals)

- handle realloc errors
- remove redundancy of libxl__append_disk_list_of_type return value
  and ndisks paramter.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: add a comment describing the device interfaces.
Ian Campbell [Tue, 18 Oct 2011 09:35:55 +0000 (10:35 +0100)]
libxl: add a comment describing the device interfaces.

Subsequent patches will endeavour to make reality match this defined
interface.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: libxl_destroy_cpumap becomes libxl_cpumap_destroy
Ian Campbell [Tue, 18 Oct 2011 09:35:55 +0000 (10:35 +0100)]
libxl: libxl_destroy_cpumap becomes libxl_cpumap_destroy

Now that IDL type destructors are no longer libxl_*_destroy we can use the more
common libxl_NOUN_VERB structure here.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: idl: use "dispose" rather than "destroy" for function to free IDL types
Ian Campbell [Tue, 18 Oct 2011 09:35:55 +0000 (10:35 +0100)]
libxl: idl: use "dispose" rather than "destroy" for function to free IDL types

Destroy is an overloaded term which would commonly like to be used for actual
destructive operations, such as destroying a domain etc.

Dispose isn't a great term but it does the job.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: remove generated file testidl.c on clean
Ian Campbell [Tue, 18 Oct 2011 09:35:55 +0000 (10:35 +0100)]
libxl: remove generated file testidl.c on clean

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agonestedsvm: fix lazy fpu switching causing a triple fault
Christoph Egger [Fri, 28 Oct 2011 16:23:51 +0000 (17:23 +0100)]
nestedsvm: fix lazy fpu switching causing a triple fault

Fix FPU switching uncovered with Hyper-V: Do FPU switching always on
the n1 vmcb rather doing it on the current active vmcb.  The FPU state
between n1 and n2 vmcb is already synced in the vmrun and vmexit
emulation.

This fixes the situation where the n2 vmcb had the #NM intercept bit
set but the virtual vmcb did not.  That means it was believed the l1
guest can handle an #NM intercept but was actually wrong.

The result were three #GP's with error code 0x11 in the l1 guest.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agox86,hvm: enable VCPUOP_register_vcpu_info op in hvm hypercall
Zhenzhong Duan [Fri, 28 Oct 2011 16:20:21 +0000 (17:20 +0100)]
x86,hvm: enable VCPUOP_register_vcpu_info op in hvm hypercall

pvhvm running with more than 32 vcpus and pv_irq/pv_time enabled
need vcpu placement to work, or else it will softlockup.

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agohvmloader: Load DSDT table from parameter
Anthony PERARD [Fri, 28 Oct 2011 16:17:47 +0000 (17:17 +0100)]
hvmloader: Load DSDT table from parameter

In order to have two different DSDT tables for rombios and SeaBIOS,
this patch introduce a new parameter to acpi_build_tables() which
contain the DSDT table to load.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agohvmloader/acpi/dsdt: Fix PCI hotplug with the new qemu-xen.
Anthony PERARD [Fri, 28 Oct 2011 16:16:51 +0000 (17:16 +0100)]
hvmloader/acpi/dsdt: Fix PCI hotplug with the new qemu-xen.

The ACPI PIIX4 device in QEMU upstream as not the same behavior to
handle PCI hotplug. This patch introduce the necessary change to the
DSDT ACPI table to behave as expceted by the new QEMU.

To switch to this new DSDT table version, there is a new option
--dm-version to mk_dsdt.

Change are inspired by SeaBIOS DSDT source code.

There is few things missing with the new QEMU:
  - QEMU provide the plugged/unplugged status only per slot (and not
    per func like qemu-xen-traditionnal.
  - I did not include the _STA ACPI method that give the status of a
    device (present, functionning properly) because qemu-xen does not
    handle it.
  - I did not include the _RMV method that say if the device can be
    removed,
    because the IO port of QEMU that give this status always return
    true. In
    SeaBIOS table, they have a specific _RMV method for VGA, ISA that
    return
    false. But I'm not sure that we can do the same in Xen.

So, the only way to remove a device is from outside of the guest (like
with xl pci-detatch), and can not be initiated from inside.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agohvmloader: In mk_dsdt, Use __attribute__ format.
Anthony PERARD [Fri, 28 Oct 2011 16:15:32 +0000 (17:15 +0100)]
hvmloader: In mk_dsdt, Use __attribute__ format.

Use __attribute__((format(printf,..))) for the function _stmt to
prevent any mistake.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agohvmloader/acpi/dsdt: Move IO port range reservation
Anthony PERARD [Fri, 28 Oct 2011 16:14:35 +0000 (17:14 +0100)]
hvmloader/acpi/dsdt: Move IO port range reservation

This patch move the IO port range reservation from the dsdt.asl to
mk_dsdt.  This IO port range need to be generated by mk_dsdt, because
qemu-xen use different port. The IO port for qemu-xen will be added in
a later patch.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agohvmloader/acpi: Introduce --maxcpu option to mk_dsdt
Anthony PERARD [Fri, 28 Oct 2011 16:12:21 +0000 (17:12 +0100)]
hvmloader/acpi: Introduce --maxcpu option to mk_dsdt

With this new option, there is no need to compile mk_dsdt for each
DSDT table that we want.  The Makefile is a bit reorganize to handle
this new option and to prepare more change in a coming patch.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
13 years agox86: re-inject emulated level pirqs in PV on HVM guests if still
Stefano Stabellini [Thu, 27 Oct 2011 15:07:18 +0000 (16:07 +0100)]
x86: re-inject emulated level pirqs in PV on HVM guests if still
asserted

PV on HVM guests can loose level interrupts coming from emulated
devices if they have been remapped onto event channels.  The reason is
that we are missing the code to inject a pirq again in the guest when
the guest EOIs it, if it corresponds to an emulated level interrupt
and the interrupt is still asserted.

Fix this issue and also return error when the guest tries to get the
irq_status of a non-existing pirq.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agointerface: add 'discard-secure' and BLKIF_DISCARD_SECURE
Konrad Rzeszutek Wilk [Thu, 27 Oct 2011 15:04:48 +0000 (16:04 +0100)]
interface: add 'discard-secure' and BLKIF_DISCARD_SECURE

Alter the 'reserved' uint8_t to be used a 'flag'. We use only for one
flag: BLKIF_DISCARD_SECURE.

That flag can only be set if the backend has set 'discard-secure' to
one.  If backend has not set 'discard-secure' to one, that flag will
have no effect.

Acked-by: Jan Beulich <JBeulich@suse.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agointerface: Flesh out the BLKIF_OP_DISCARD description.
Konrad Rzeszutek Wilk [Thu, 27 Oct 2011 15:04:17 +0000 (16:04 +0100)]
interface: Flesh out the BLKIF_OP_DISCARD description.

We flesh out details on what is expected of 'feature-flush' and
what are some of the extra parameters that the frontend can read
from the backend. Those extra parameters are: : discard-aligment,
and discard-granularity.

Acked-by: Jan Beulich <JBeulich@suse.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agointerface: rename of trim to discard in blkif.h
Konrad Rzeszutek Wilk [Thu, 27 Oct 2011 15:03:51 +0000 (16:03 +0100)]
interface: rename of trim to discard in blkif.h

Just a simple sed s/trim/discard/. We are ignoring the comments
which are incorrect.

The reason for the name change is that TRIM is specific to ATA
while the operation can be done on top of SCSI interfaces too.
Hence the rename to something more generic.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agopygrub: example grub2 configuration file (fedora-16-with-xen.grub2)
Michael Young [Tue, 25 Oct 2011 18:22:09 +0000 (19:22 +0100)]
pygrub: example grub2 configuration file (fedora-16-with-xen.grub2)

Sample grub2 configuration file (some duplication removed) from Fedora 16
with a xen hypervisor installed

Signed-off-by: Michael Young <m.a.young@durham.ac.uk>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agopyrgrub: cope with configurations with set default="${saved_entry}" line
Michael Young [Tue, 25 Oct 2011 18:21:05 +0000 (19:21 +0100)]
pyrgrub: cope with configurations with set default="${saved_entry}" line

Fedora 16 grub2 configuration file can have lines like
    set default="${saved_entry}"
and a string containing an integer is expected

Signed-off-by: Michael Young <m.a.young@durham.ac.uk>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agopygrub: cope with configurations with submenus
Michael Young [Tue, 25 Oct 2011 18:20:06 +0000 (19:20 +0100)]
pygrub: cope with configurations with submenus

The grub2 configuration file in Fedora 16 can have one or more
menuentrys in a submenu, with configuration of the form
    submenu "Xen 4.1" {
    menuentry ... {
    ...
    }
    }
(this example occurs when the xen hypervisor is installed on the
guest)

Ignore the submenu line and the corresponding }

Signed-off-by: Michael Young <m.a.young@durham.ac.uk>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
13 years agopygrub: Allow GPT partition references
Michael Young [Tue, 25 Oct 2011 18:19:19 +0000 (19:19 +0100)]
pygrub: Allow GPT partition references

The grub2 configuration file in Fedora 16 can have GPT partition
references like (hd0,gpt2) so remove the "gpt" string where necessary

Signed-off-by: Michael Young <m.a.young@durham.ac.uk>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
13 years agopygrub: look in /boot/grub2 (for eg Fedora 16)
Michael Young [Tue, 25 Oct 2011 18:18:49 +0000 (19:18 +0100)]
pygrub: look in /boot/grub2 (for eg Fedora 16)

Fedora 16 puts grub configuration files in /boot/grub2/grub.cfg so
pygrub should look there as well

Signed-off-by: Michael Young <m.a.young@durham.ac.uk>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
13 years agopygrub: check all GPT partitions
Michael Young [Tue, 25 Oct 2011 18:15:54 +0000 (19:15 +0100)]
pygrub: check all GPT partitions

On Fedora 16 the first GPT partition is a boot partition for grub2 with
the grub2 configuration in the second partition.
Check all GPT partitions for grub configuration, not just the first.

[ Also remove now-inaccurate comment. -iwj ]

Signed-off-by: Michael Young <m.a.young@durham.ac.uk>
Tested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agolibxl: add missing "break;" to do_pci_remove
Ian Campbell [Tue, 25 Oct 2011 16:04:41 +0000 (17:04 +0100)]
libxl: add missing "break;" to do_pci_remove

Otherwise we erroneously fall through the LIBXL_DOMAIN_TYPE_PV case into the
"default: abort()".

(I'm sure we fixed this once already...)

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Tested-by: Dario Faggioli <dario.faggioli@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agohvm: Clean up I/O emulation
Christoph Egger [Tue, 25 Oct 2011 15:48:17 +0000 (16:48 +0100)]
hvm: Clean up I/O emulation

Move HVM io fields into a structure.
On MMIO instruction failure print out some more bytes.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agox86 pm: provide CC7/PC2 residency
Yang Zhang [Tue, 25 Oct 2011 15:46:47 +0000 (16:46 +0100)]
x86 pm: provide CC7/PC2 residency

Sandy bridge introduces new MSR to get cc7/pc2 residency (core C-state
7/package C-state 2). Print the cc7/pc2 residency when on sandy bridge
platform.

Signed-off-by: Yang Zhang <yang.z.zhang@intel.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agox86/hpet: fix cpumask allocation after 23990:1c8789852eaf
Jan Beulich [Mon, 24 Oct 2011 17:01:07 +0000 (18:01 +0100)]
x86/hpet: fix cpumask allocation after 23990:1c8789852eaf

hpet_fsb_cap_lookup(), if it doesn't find any FSB capable timer,
leaves hpet_events allocated, while hpet_events->cpumask may not have
been, As we're pretty generous with these one-time allocations already
(in that hpet_events doesn't get freed when no usable counters were
found, even if in that case only the first array entry [or none at
all] may get used), simply make the cpumask allocation in the legacy
case independent of whether hpet_events was NULL before.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Christoph Egger <Christoph.Egger@amd.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agox86/ucode-amd: fix regression from c/s 23871:503ee256fecf
Jan Beulich [Mon, 24 Oct 2011 17:00:20 +0000 (18:00 +0100)]
x86/ucode-amd: fix regression from c/s 23871:503ee256fecf

microcode_fits() must return distinct values for the success and
no-fit-but-no-error cases, so the caller can react accordingly. Make
it return 1 in the success case, and adjust its single caller.

Also remove an impossible code path - install_equiv_cpu_table(), which
gets called prior to microcode_fits(), never leaves equiv_cpu_table
being NULL without also returning an error.

Note that this is still awaiting testing on a system where the
regression was actually observed (which also requires a new enough
microcode_ctl package). Note also that this will need to be
backported to 4.0 and 4.1 (or the broken c/s that got backported
there reverted).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agonestedhvm: handle l2 guest MMIO access
Tim Deegan [Mon, 24 Oct 2011 10:29:08 +0000 (11:29 +0100)]
nestedhvm: handle l2 guest MMIO access

Hyper-V starts a root domain which effectively an l2 guest.
Hyper-V passes its devices through to the root domain and
let it do the MMIO accesses. The emulation is done by
Xen (host) and Hyper-V forwards the interrupts to the l2 guest.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
13 years agocpumask <=> xenctl_cpumap: allocate CPU masks and byte maps dynamically
Jan Beulich [Fri, 21 Oct 2011 07:45:24 +0000 (09:45 +0200)]
cpumask <=> xenctl_cpumap: allocate CPU masks and byte maps dynamically

Generally there was a NR_CPUS-bits wide array in these functions and
another (through a cpumask_t) on their callers' stacks, which may get
a little large for big NR_CPUS. As the functions can fail anyway, do
the allocation in there.

For the x86/MCA case this require a little code restructuring: By using
different CPU mask accessors it was possible to avoid allocating a mask
in the broadcast case. Also, this was the only user that failed to
check the return value of the conversion function (which could have led
to undefined behvior).

Also constify the input parameters of the two functions.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
13 years agox86/hpet: allocate CPU masks dynamically
Jan Beulich [Fri, 21 Oct 2011 07:44:47 +0000 (09:44 +0200)]
x86/hpet: allocate CPU masks dynamically

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
13 years agocredit: allocate CPU masks dynamically
Jan Beulich [Fri, 21 Oct 2011 07:44:03 +0000 (09:44 +0200)]
credit: allocate CPU masks dynamically

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
13 years agocpupools: allocate CPU masks dynamically
Jan Beulich [Fri, 21 Oct 2011 07:43:35 +0000 (09:43 +0200)]
cpupools: allocate CPU masks dynamically

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
13 years agox86/p2m: allocate CPU masks dynamically
Jan Beulich [Fri, 21 Oct 2011 07:42:47 +0000 (09:42 +0200)]
x86/p2m: allocate CPU masks dynamically

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Tim Deegan <tim@xen.org>
Acked-by: Keir Fraser <keir@xen.org>
--- 2011-10-18.orig/xen/arch/x86/hvm/nestedhvm.c 2011-10-11 17:24:46.000000000 +0200
+++ 2011-10-18/xen/arch/x86/hvm/nestedhvm.c 2011-10-18 16:45:02.000000000 +0200
@@ -114,9 +114,9 @@ nestedhvm_flushtlb_ipi(void *info)
 void
 nestedhvm_vmcx_flushtlb(struct p2m_domain *p2m)
 {
-    on_selected_cpus(&p2m->p2m_dirty_cpumask, nestedhvm_flushtlb_ipi,
+    on_selected_cpus(p2m->dirty_cpumask, nestedhvm_flushtlb_ipi,
         p2m->domain, 1);
-    cpumask_clear(&p2m->p2m_dirty_cpumask);
+    cpumask_clear(p2m->dirty_cpumask);
 }

 bool_t
--- 2011-10-18.orig/xen/arch/x86/mm/hap/nested_hap.c 2011-10-21 09:24:51.000000000 +0200
+++ 2011-10-18/xen/arch/x86/mm/hap/nested_hap.c 2011-10-18 16:44:35.000000000 +0200
@@ -88,7 +88,7 @@ nestedp2m_write_p2m_entry(struct p2m_dom
     safe_write_pte(p, new);

     if (old_flags & _PAGE_PRESENT)
-        flush_tlb_mask(&p2m->p2m_dirty_cpumask);
+        flush_tlb_mask(p2m->dirty_cpumask);

     paging_unlock(d);
 }
--- 2011-10-18.orig/xen/arch/x86/mm/p2m.c 2011-10-14 09:47:46.000000000 +0200
+++ 2011-10-18/xen/arch/x86/mm/p2m.c 2011-10-21 09:28:33.000000000 +0200
@@ -81,7 +81,6 @@ static void p2m_initialise(struct domain
     p2m->default_access = p2m_access_rwx;

     p2m->cr3 = CR3_EADDR;
-    cpumask_clear(&p2m->p2m_dirty_cpumask);

     if ( hap_enabled(d) && (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) )
         ept_p2m_init(p2m);
@@ -102,6 +101,8 @@ p2m_init_nestedp2m(struct domain *d)
         d->arch.nested_p2m[i] = p2m = xzalloc(struct p2m_domain);
         if (p2m == NULL)
             return -ENOMEM;
+        if ( !zalloc_cpumask_var(&p2m->dirty_cpumask) )
+            return -ENOMEM;
         p2m_initialise(d, p2m);
         p2m->write_p2m_entry = nestedp2m_write_p2m_entry;
         list_add(&p2m->np2m_list, &p2m_get_hostp2m(d)->np2m_list);
@@ -118,6 +119,11 @@ int p2m_init(struct domain *d)
     p2m_get_hostp2m(d) = p2m = xzalloc(struct p2m_domain);
     if ( p2m == NULL )
         return -ENOMEM;
+    if ( !zalloc_cpumask_var(&p2m->dirty_cpumask) )
+    {
+        xfree(p2m);
+        return -ENOMEM;
+    }
     p2m_initialise(d, p2m);

     /* Must initialise nestedp2m unconditionally
@@ -333,6 +339,9 @@ static void p2m_teardown_nestedp2m(struc
     uint8_t i;

     for (i = 0; i < MAX_NESTEDP2M; i++) {
+        if ( !d->arch.nested_p2m[i] )
+            continue;
+        free_cpumask_var(d->arch.nested_p2m[i]->dirty_cpumask);
         xfree(d->arch.nested_p2m[i]);
         d->arch.nested_p2m[i] = NULL;
     }
@@ -341,8 +350,12 @@ static void p2m_teardown_nestedp2m(struc
 void p2m_final_teardown(struct domain *d)
 {
     /* Iterate over all p2m tables per domain */
-    xfree(d->arch.p2m);
-    d->arch.p2m = NULL;
+    if ( d->arch.p2m )
+    {
+        free_cpumask_var(d->arch.p2m->dirty_cpumask);
+        xfree(d->arch.p2m);
+        d->arch.p2m = NULL;
+    }

     /* We must teardown unconditionally because
      * we initialise them unconditionally.
@@ -1200,7 +1213,7 @@ p2m_get_nestedp2m(struct vcpu *v, uint64
             if (p2m->cr3 == CR3_EADDR)
                 hvm_asid_flush_vcpu(v);
             p2m->cr3 = cr3;
-            cpu_set(v->processor, p2m->p2m_dirty_cpumask);
+            cpumask_set_cpu(v->processor, p2m->dirty_cpumask);
             p2m_unlock(p2m);
             nestedp2m_unlock(d);
             return p2m;
@@ -1217,7 +1230,7 @@ p2m_get_nestedp2m(struct vcpu *v, uint64
     p2m->cr3 = cr3;
     nv->nv_flushp2m = 0;
     hvm_asid_flush_vcpu(v);
-    cpu_set(v->processor, p2m->p2m_dirty_cpumask);
+    cpumask_set_cpu(v->processor, p2m->dirty_cpumask);
     p2m_unlock(p2m);
     nestedp2m_unlock(d);

--- 2011-10-18.orig/xen/include/asm-x86/p2m.h 2011-10-21 09:24:51.000000000 +0200
+++ 2011-10-18/xen/include/asm-x86/p2m.h 2011-10-18 16:39:34.000000000 +0200
@@ -198,7 +198,7 @@ struct p2m_domain {
      * this p2m and those physical cpus whose vcpu's are in
      * guestmode.
      */
-    cpumask_t          p2m_dirty_cpumask;
+    cpumask_var_t      dirty_cpumask;

     struct domain     *domain;   /* back pointer to domain */

13 years agoallocate CPU sibling and core maps dynamically
Jan Beulich [Fri, 21 Oct 2011 07:23:05 +0000 (09:23 +0200)]
allocate CPU sibling and core maps dynamically

... thus reducing the per-CPU data area size back to one page even when
building for large NR_CPUS.

At once eliminate the old __cpu{mask,list}_scnprintf() helpers.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
13 years agox86: allocate IRQ actions' cpu_eoi_map dynamically
Jan Beulich [Fri, 21 Oct 2011 07:22:02 +0000 (09:22 +0200)]
x86: allocate IRQ actions' cpu_eoi_map dynamically

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
13 years agoeliminate direct assignments of CPU masks
Jan Beulich [Fri, 21 Oct 2011 07:21:09 +0000 (09:21 +0200)]
eliminate direct assignments of CPU masks

Use cpumask_copy() instead of direct variable assignments for copying
CPU masks. While direct assignments are not a problem when both sides
are variables actually defined as cpumask_t (except for possibly
copying *much* more than would actually need to be copied), they must
not happen when the original variable is of type cpumask_var_t (which
may have lass space allocated to it than a full cpumask_t). Eliminate
as many of such assignments as possible (in several cases it's even
possible to collapse two operations [copy then clear one bit] into one
[cpumask_andnot()]), and thus set the way for reducing the allocation
size in alloc_cpumask_var().

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
13 years agoeliminate cpumask accessors referencing NR_CPUS
Jan Beulich [Fri, 21 Oct 2011 07:19:44 +0000 (09:19 +0200)]
eliminate cpumask accessors referencing NR_CPUS

... in favor of using the new, nr_cpumask_bits-based ones.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
13 years agointroduce and use nr_cpu_ids and nr_cpumask_bits
Jan Beulich [Fri, 21 Oct 2011 07:17:42 +0000 (09:17 +0200)]
introduce and use nr_cpu_ids and nr_cpumask_bits

The former is the runtime equivalent of NR_CPUS (and users of NR_CPUS,
where necessary, get adjusted accordingly), while the latter is for the
sole use of determining the allocation size when dynamically allocating
CPU masks (done later in this series).

Adjust accessors to use either of the two to bound their bitmap
operations - which one gets used depends on whether accessing the bits
in the gap between nr_cpu_ids and nr_cpumask_bits is benign but more
efficient.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
13 years agox86/mm/p2m: don't leak state if nested-p2m init fails.
Tim Deegan [Thu, 20 Oct 2011 14:36:01 +0000 (15:36 +0100)]
x86/mm/p2m: don't leak state if nested-p2m init fails.

Signed-off-by: Tim Deegan <tim@xen.org>
13 years agoxenpaging: disallow paging in a PoD guest
Olaf Hering [Thu, 20 Oct 2011 10:25:58 +0000 (11:25 +0100)]
xenpaging: disallow paging in a PoD guest

Disallow xenpaging in a PoD guest until coexistance between the two features
is properly implemented.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
13 years agoxenpaging: document p2m_mem_paging functions
Olaf Hering [Thu, 20 Oct 2011 10:25:58 +0000 (11:25 +0100)]
xenpaging: document p2m_mem_paging functions

Add some documentation for each of the p2m_mem_paging functions to describe
what they ought to do.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
13 years agoxenpaging: check p2mt in p2m_mem_paging functions
Olaf Hering [Thu, 20 Oct 2011 10:25:55 +0000 (11:25 +0100)]
xenpaging: check p2mt in p2m_mem_paging functions

Add checks to forward the p2m_ram_paging* state properly during page-in.

Resume can be called several times if several vcpus called populate for
the gfn. Finish resume only once.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
13 years agox86: move generic IRQ code out of io_apic.c
Jan Beulich [Wed, 19 Oct 2011 10:51:42 +0000 (12:51 +0200)]
x86: move generic IRQ code out of io_apic.c

While doing so, eliminate the use of struct irq_cfg and convert the
CPU mask accessors to the new style ones as far as possible.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
13 years agofold struct irq_cfg into struct irq_desc
Jan Beulich [Wed, 19 Oct 2011 10:50:54 +0000 (12:50 +0200)]
fold struct irq_cfg into struct irq_desc

struct irq_cfg really has become an architecture extension to struct
irq_desc, and hence it should be treated as such (rather than as IRQ
chip specific data, which it was meant to be originally).

For a first step, only convert a subset of the uses; subsequent
patches (partly to be sent later) will aim at fully eliminating the
use of the old structure type.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
13 years agolibxl: remove QMP warning when no pty style serial device is configured
Ian Campbell [Thu, 13 Oct 2011 09:44:27 +0000 (10:44 +0100)]
libxl: remove QMP warning when no pty style serial device is configured

If the serial device is not "pty" then there is nothing to do but this is not
an error. Removes a spurious warning if e.g. serial="file:/tmp/serial.log" is used:

libxl: error: libxl_qmp.c:137:register_serials_chardev_callback: Failed to store serial port information in xenstore: No such file or directory

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxc: osdep: report missing backends in common code
Ian Campbell [Thu, 13 Oct 2011 09:32:09 +0000 (10:32 +0100)]
libxc: osdep: report missing backends in common code

Backends were inconsistent about reporting and it's a pain to edit them all
when adding a new class of osdep.

Signed-off-by: Ian Campbell <Ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---
Requires Daniel De Graaf's "libxc: add xc_gntshr_* functions"

13 years agolibxl: libxl__e820_alloc must take a libxl__gc.
Ian Campbell [Thu, 13 Oct 2011 09:32:09 +0000 (10:32 +0100)]
libxl: libxl__e820_alloc must take a libxl__gc.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: correctly propagate errors from libxl_domain_resume
Ian Campbell [Thu, 13 Oct 2011 08:37:06 +0000 (09:37 +0100)]
libxl: correctly propagate errors from libxl_domain_resume

currently it return success no matter what.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agoocaml: align build output
Ian Campbell [Mon, 17 Oct 2011 16:05:30 +0000 (17:05 +0100)]
ocaml: align build output

Fix:
 MLI       op.mli
 MLI      op.cmi
 MLI       partial.mli
 MLI      partial.cmi
 MLI       packet.mli

Signed-off-by: Ian Cmpabell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agolibxl: probe disk backend type in libxl_device_disk_add
Ian Campbell [Thu, 13 Oct 2011 09:31:00 +0000 (10:31 +0100)]
libxl: probe disk backend type in libxl_device_disk_add

Without this "xl block-attach" does not work. On create do_domain_create already
catches this.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: add a test case for correct parsing of disk "backendtype" field
Ian Campbell [Fri, 7 Oct 2011 10:27:02 +0000 (11:27 +0100)]
libxl: add a test case for correct parsing of disk "backendtype" field

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agoxl: use libxl_device_disk_to_json to pretty print disk configuration
Ian Campbell [Fri, 7 Oct 2011 10:06:41 +0000 (11:06 +0100)]
xl: use libxl_device_disk_to_json to pretty print disk configuration

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agoxl: allow check-xl-disk-parse to run against installed xl as well as build dir
Ian Campbell [Fri, 7 Oct 2011 10:05:47 +0000 (11:05 +0100)]
xl: allow check-xl-disk-parse to run against installed xl as well as build dir

I can't run from the current directory since my build box isn't running Xen so
if ./xl doesn't exist use the installed version on the assumption that I've
copied the script to a test host.

I think running from the build dir needs the blktap2 libraries, so update
LD_LIBRARY_PATH as appropriate.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agolibxl: IDL: autogenerate functions to produce JSON from libxl data structures.
Ian Campbell [Fri, 7 Oct 2011 10:05:45 +0000 (11:05 +0100)]
libxl: IDL: autogenerate functions to produce JSON from libxl data structures.

Two functions are provided. TYPE_gen_json exposes an interface which is
compatible with the YAGL generator infrastructure. TYPE_to_string uses this to
produce a pretty printed string.

The TYPE_gen_json functions are defined in a new header libxl_json.h which is
not exposed via libxl.h due to the use of YAGL datatypes to avoid poluting the
namespace us libxl users which don't use the library themselves.  If a libxl
user is interested in integrating at the YAGL level then it should #include
this file itself.

Also update testidl to generate a random version of each IDL datastructure and
convert it to JSON. Unfortunately this requires a libxl_ctx and therefore the
test must be run on a Xen system now.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
13 years agohvmloader: Add the WAET since Microsoft are demanding it for Windows 8
Andrew Cooper [Fri, 14 Oct 2011 17:11:25 +0000 (18:11 +0100)]
hvmloader: Add the WAET since Microsoft are demanding it for Windows 8

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agohvmloader: Don't set hpet->header.length twice
Andrew Cooper [Fri, 14 Oct 2011 17:10:46 +0000 (18:10 +0100)]
hvmloader: Don't set hpet->header.length twice

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agoReturn -EINVAL when trying to kick/kill a nonexistent domain watchdog
Keir Fraser [Fri, 14 Oct 2011 17:08:04 +0000 (18:08 +0100)]
Return -EINVAL when trying to kick/kill a nonexistent domain watchdog

... to be more in-line with the NR_DOMAIN_WATCHDOG_TIMERS check at the
top of domain_watchdog(), and also to follow the
timer_(delete|settime)
POSIX API's EINVAL return value.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Also, replace EEXIST with ENOSPC when failing to allocate a new
domain watchdog.

Signed-off-by: Keir Fraser <keir@xen.org>
Committed-by: Keir Fraser <keir@xen.org>
13 years agox86/MSI: drop local cpumask_t variable from msi_compose_msg()
Jan Beulich [Fri, 14 Oct 2011 12:34:15 +0000 (14:34 +0200)]
x86/MSI: drop local cpumask_t variable from msi_compose_msg()

The function gets called only during initialization/resume (when no
other CPUs are running) or with the IRQ descriptor lock held, so
there's no way for the CPU mask to change under its feet.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
13 years agop2m: use xzalloc() for struct p2m_domain allocation
Jan Beulich [Fri, 14 Oct 2011 10:27:15 +0000 (12:27 +0200)]
p2m: use xzalloc() for struct p2m_domain allocation

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Tim Deegan <tim@xen.org>