]> xenbits.xensource.com Git - xen.git/log
xen.git
13 years agoxl: use json output by default
Ian Campbell [Tue, 7 Feb 2012 17:01:57 +0000 (17:01 +0000)]
xl: use json output by default

Move the sxp producing code off into a separate file. It is supported
for legacy reasons and needn't be updated other than the improve
compatibility with xm.

libxl_domain_config is not currently generated by the IDL (adding the
necessary support for Array types is on my to do list) so hand code
the json generation function for now.

Since this rather directly exposes a libxl data structure it's not
clear what sort of forward compatibility guarantees we can
make. However it seems like it should be as stable as libxl's own API
(which we are looking to stabilise)

(Gratuitous string.h include needed for memset in libxl_util.h)

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agoxl: Drop -l option to xl cpupool-list
Ian Campbell [Tue, 7 Feb 2012 16:50:17 +0000 (16:50 +0000)]
xl: Drop -l option to xl cpupool-list

The implementation (which was a nop) was removed back in 22838:aab67c1c6b87 but
this now causes "set but not used" warnings from some compilers. Might as well
just nuke the option entirely.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agox86/AMD: Add support for AMD's OSVW feature in guests.
Boris Ostrovsky [Tue, 7 Feb 2012 14:05:19 +0000 (15:05 +0100)]
x86/AMD: Add support for AMD's OSVW feature in guests.

In some cases guests should not provide workarounds for errata even when the
physical processor is affected. For example, because of erratum 400 on family
10h processors a Linux guest will read an MSR (resulting in VMEXIT) before
going to idle in order to avoid getting stuck in a non-C0 state. This is not
necessary: HLT and IO instructions are intercepted and therefore there is no
reason for erratum 400 workaround in the guest.

This patch allows us to present a guest with certain errata as fixed,
regardless of the state of actual hardware.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@amd.com>
Acked-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Jan Beulich <jbeulich@suse.com>
13 years agoFix error recovery path in __gnttab_map_grant_ref
Haoyu Zhang [Mon, 6 Feb 2012 21:23:41 +0000 (13:23 -0800)]
Fix error recovery path in __gnttab_map_grant_ref

In file grant_table.c function __gnttab_map_grant_ref, if
__get_paged_frame failed, the effect of _set_status  previously
called should be rollback, so the flag GTF_reading and _GTF_writing
will be recovered.

Signed-off-by: Haoyu Zhang <haoyu.zhang@huawei.com>
Signed-off-by: Liang Wang <hzwangliang.wang@huawei.com>
Acked-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Committed-by: Keir Fraser <keir@xen.org>
13 years agoIO-APIC: Reformat IO-APIC RTE debug info (v2)
Andrew Cooper [Mon, 6 Feb 2012 21:17:46 +0000 (13:17 -0800)]
IO-APIC: Reformat IO-APIC RTE debug info (v2)

Having the columns aligned makes for much easier reading.  Also remove
the commas which only add to visual clutter in combination with
spaces.

Furthermore, printing fewer characters makes it less likely that the
serial buffer will overflow resulting in loss of critical debugging
information.

Changes since v1:
 *  Format vector as hex rather than dec
 *  Contract some names
 *  destination mode uses 'L' or 'P' instead of full words
 *  trigger mode uses 'L' or 'E' instead of full words
 *  delivery mode uses short string instead of a number

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agoIOMMU: Update the maintainer list of VT-d
Xiantao Zhang [Mon, 6 Feb 2012 21:16:19 +0000 (13:16 -0800)]
IOMMU: Update the maintainer list of VT-d

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years ago.hgignore/.gitignore: Add some tools/tests binaries
Keir Fraser [Mon, 6 Feb 2012 21:15:03 +0000 (13:15 -0800)]
.hgignore/.gitignore: Add some tools/tests binaries

Signed-off-by: Keir Fraser <keir@xen.org>
13 years agoTools: build tests
Andres Lagar-Cavilla [Mon, 6 Feb 2012 21:12:58 +0000 (13:12 -0800)]
Tools: build tests

Build tests as part of the tools build.

It is enabled with CONFIG_TESTS in Config.mk

Currently disabled build of tests/regressions and tests/xen-access (in
32-bit mode) as they fail.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agoxen: Remove unused vsscanf/sscanf functions
Daniel De Graaf [Mon, 6 Feb 2012 13:08:03 +0000 (05:08 -0800)]
xen: Remove unused vsscanf/sscanf functions

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
13 years agoflask: Update flask_op hypercall structure
Daniel De Graaf [Mon, 6 Feb 2012 13:07:20 +0000 (05:07 -0800)]
flask: Update flask_op hypercall structure

Instead of placing string parsing inside the hypervisor, use binary
structures like other Xen hypercalls do.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
13 years ago.gitignore/.hgignore: add missing output files
Daniel De Graaf [Mon, 6 Feb 2012 13:04:32 +0000 (05:04 -0800)]
.gitignore/.hgignore: add missing output files

 - extras/mini-os/include/list.h (already in .hgignore)
 - tools/flask/flask-{get,set}-bool
 - tools/flask/loadpolicy no longer exists
 - tools/xenstore/init-xenstore-domain

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
13 years agotools/flask: remove libflask
Daniel De Graaf [Mon, 6 Feb 2012 13:03:32 +0000 (05:03 -0800)]
tools/flask: remove libflask

This library has been deprecated since July 2010; remove the in-tree
users and library.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
13 years agoia64: fix build (next instance)
Jan Beulich [Mon, 6 Feb 2012 16:40:05 +0000 (17:40 +0100)]
ia64: fix build (next instance)

A number of build problems crept in once again. Fix them.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
13 years agoFix x86_32 build
Tim Deegan [Thu, 2 Feb 2012 15:47:26 +0000 (15:47 +0000)]
Fix x86_32 build

Signed-off-by: Tim Deegan <tim@xen.org>
13 years agox86: avoid deadlock after a PCI SERR NMI
David Vrabel [Thu, 2 Feb 2012 15:28:58 +0000 (15:28 +0000)]
x86: avoid deadlock after a PCI SERR NMI

If a PCI System Error (SERR) is asserted it causes an NMI. If this NMI
occurs while the CPU is in printk() then Xen may deadlock as
pci_serr_error() calls console_force_unlock() which screws up the
console lock.

printk() isn't safe to call from NMI context so defer the diagnostic
message to a softirq.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Tested-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agoxsm/flask: Improve domain ID auditing in AVCs
Daniel De Graaf [Thu, 2 Feb 2012 15:26:55 +0000 (15:26 +0000)]
xsm/flask: Improve domain ID auditing in AVCs

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
13 years agoflask/policy: Add boolean example
Daniel De Graaf [Thu, 2 Feb 2012 15:25:23 +0000 (15:25 +0000)]
flask/policy: Add boolean example

This shows an example boolean (prot_doms_locked) which can be set at
runtime to prevent dom0 from mapping memory of domains of type
prot_domU_t.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
13 years agoflask: add flask-{get,set}-bool tools
Daniel De Graaf [Thu, 2 Feb 2012 15:24:53 +0000 (15:24 +0000)]
flask: add flask-{get,set}-bool tools

These utilities can be used to modify policy booleans, which allow
minor policy changes without reloading the security policy. This can
be used to make security policy change based on external information
such as time of day, user physical presence, completion of system
boot, or other relevant variables.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
13 years agolibflask: Add boolean manipulation functions
Daniel De Graaf [Thu, 2 Feb 2012 15:24:13 +0000 (15:24 +0000)]
libflask: Add boolean manipulation functions

Add wrappers for getting and setting policy booleans by name or ID.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
13 years agoxsm/flask: allow policy booleans to be addressed by name
Daniel De Graaf [Thu, 2 Feb 2012 15:23:43 +0000 (15:23 +0000)]
xsm/flask: allow policy booleans to be addressed by name

Booleans are currently only addressable by using a sequence number
that is not easily accessible to tools. Add new FLASK operations to
get/set booleans by name, and to get the name of a boolean given its
ID.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
13 years agoxen/xsm: fix incorrect handling of XSM hook return
Daniel De Graaf [Thu, 2 Feb 2012 15:23:04 +0000 (15:23 +0000)]
xen/xsm: fix incorrect handling of XSM hook return

If the XSM hook denied access, the execution incorrectly continued on
after an extra unlock domain.

Reported-by: John McDermott <john.mcdermott@nrl.navy.mil>
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
13 years agoflask/policy: use declare_domain for dom0_t
Daniel De Graaf [Thu, 2 Feb 2012 15:21:42 +0000 (15:21 +0000)]
flask/policy: use declare_domain for dom0_t

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
13 years agoflask/policy: Add user and constraint examples
Daniel De Graaf [Thu, 2 Feb 2012 15:21:13 +0000 (15:21 +0000)]
flask/policy: Add user and constraint examples

These examples show how to use constraints and the user field of the
security label to prevent communication between virtual machines of
different customers in a multi-tenant environment.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
13 years agoflask/policy: Policy build updates
Daniel De Graaf [Thu, 2 Feb 2012 15:20:40 +0000 (15:20 +0000)]
flask/policy: Policy build updates

Eliminate temporary files used in creating FLASK policy to improve
error reporting during policy build. Syntax errors now point to the
file and line number visible to the user, not the intermediate
temporary file.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
13 years agoxsm/flask: Remove useless back pointers
Daniel De Graaf [Thu, 2 Feb 2012 15:19:57 +0000 (15:19 +0000)]
xsm/flask: Remove useless back pointers

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
13 years agoxsm/flask: Improve error reporting for ocontexts
Daniel De Graaf [Thu, 2 Feb 2012 15:19:24 +0000 (15:19 +0000)]
xsm/flask: Improve error reporting for ocontexts

Instead of returning -EINVAL for all errors, return -EEXIST if adding
an entry that overlaps with an existing entry, and -ENOENT if
attempting to remove an entry that does not exist. Adding an ocontext
that already exists with the same SID is no longer an error.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
13 years agoxsm: Use mapped IRQ not PIRQ in unmap_domain_pirq
Daniel De Graaf [Thu, 2 Feb 2012 15:18:50 +0000 (15:18 +0000)]
xsm: Use mapped IRQ not PIRQ in unmap_domain_pirq

XSM permissions are defined in terms of IRQs, not PIRQs; use the
correct number when checking permission in unmap_domain_pirq.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
13 years agoxsm: Add xsm_map_domain_pirq hook
Daniel De Graaf [Thu, 2 Feb 2012 15:18:19 +0000 (15:18 +0000)]
xsm: Add xsm_map_domain_pirq hook

When checking permissions in map_domain_pirq, the msi_desc field of
the irq_desc is not yet populated with the PCI device being used. Pass
in the msi_info structure which contains the intended PCI device whose
label will be used in the security check.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
13 years agoxsm/flask: Use PCI device label for PCI-MSI IRQs
Daniel De Graaf [Thu, 2 Feb 2012 15:17:46 +0000 (15:17 +0000)]
xsm/flask: Use PCI device label for PCI-MSI IRQs

Because the PCI-MSI IRQ numbers are allocated dynamically, labeling
them by number is not useful. Instead, for all IRQs beyond
nr_irqs_gsi, use the associated msi_desc to find the PCI device and
use the label of the PCI device for the IRQ.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
13 years agoxsm: Add security label to IRQ debug output
Daniel De Graaf [Thu, 2 Feb 2012 15:17:11 +0000 (15:17 +0000)]
xsm: Add security label to IRQ debug output

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
13 years agoxsm: Add security labels to event-channel dump
Daniel De Graaf [Thu, 2 Feb 2012 15:16:34 +0000 (15:16 +0000)]
xsm: Add security labels to event-channel dump

In FLASK, event channel labels are distinct from the labels of the
domain using them. When debugging policy issues, it is useful to be
able to view the current label of event channels; add this label to
the event channel dump.

This patch also adds the IRQ associated with a PIRQ for event channels
bound to a PIRQ, and moves the xen_consumer flag to the front to
create more consistent alignment in the output.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
13 years agoUpdate QEMU_TAG, for CVE-2012-0029
Ian Jackson [Thu, 2 Feb 2012 13:50:48 +0000 (13:50 +0000)]
Update QEMU_TAG, for CVE-2012-0029

13 years agox86/mm: Fix balooning+sharing
Andres Lagar-Cavilla [Thu, 2 Feb 2012 12:27:31 +0000 (12:27 +0000)]
x86/mm: Fix balooning+sharing

Never mind that ballooning a shared page makes no sense. We still fix it
because it may be exercised.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Signed-off-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
13 years agox86/mm: Make debug_{gfn, mfn, gref} calls to sharing more useful and correct
Andres Lagar-Cavilla [Thu, 2 Feb 2012 12:23:18 +0000 (12:23 +0000)]
x86/mm: Make debug_{gfn, mfn, gref} calls to sharing more useful and correct

Have them used locked accesors to the gfn and the underlying shared mfn.

Have them return the number of shared refs to the underlying mfn.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
13 years agox86/mm: Make sharing ASSERT check more accurate
Andres Lagar-Cavilla [Thu, 2 Feb 2012 12:22:34 +0000 (12:22 +0000)]
x86/mm: Make sharing ASSERT check more accurate

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Signed-off-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
13 years agox86/mm: Fix paging stats
Andres Lagar-Cavilla [Thu, 2 Feb 2012 12:22:34 +0000 (12:22 +0000)]
x86/mm: Fix paging stats

There are several corner cases in which a page is paged back in, not by paging,
and the stats are not properly updated.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
13 years agox86/mm: Reorder locks used by shadow code in anticipation of synchronized p2m lookups
Andres Lagar-Cavilla [Thu, 2 Feb 2012 12:22:34 +0000 (12:22 +0000)]
x86/mm: Reorder locks used by shadow code in anticipation of synchronized p2m lookups

Currently, mm-locks.h enforces a strict ordering between locks in the mm
layer lest there be an inversion in the order locks are taken and thus
the risk of deadlock.

Once p2m lookups becoming synchronized, get_gfn* calls take the p2m lock, and a
new set of inversion arises.  Reorder some of the locks in the shadow code so
that even in this case no deadlocks happen.

After this, synchronized p2m lookups are in principle ready to be enabled in
shadow mode.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
13 years agox86/mm: Don't fail to nominate for paging on type flag, rather look at type count
Andres Lagar-Cavilla [Thu, 2 Feb 2012 12:22:34 +0000 (12:22 +0000)]
x86/mm: Don't fail to nominate for paging on type flag, rather look at type count

Xen doesn't clean the type flag when dropping the type count for a page to
zero. So, looking at the type flag when nominating a page for paging it's
incorrect. Look at the type count instead.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Signed-off-by: Adin Scannell <adin@scannell.ca>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
13 years agox86/mm: Remove p2m_ram_paging_in
Andres Lagar-Cavilla [Thu, 2 Feb 2012 12:22:34 +0000 (12:22 +0000)]
x86/mm: Remove p2m_ram_paging_in

This state in the paging state machine became unnecessary after the last
few updates.

Once eliminated, rename p2m_ram_paging_in_start to p2m_ram_paging_in.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
13 years agoxl: allow enable automatic fallback to ACPI events if PV control not available.
Ian Campbell [Tue, 31 Jan 2012 16:34:39 +0000 (16:34 +0000)]
xl: allow enable automatic fallback to ACPI events if PV control not available.

Add a -F (fallbacks) option to xl destroy|reboot to cause an ACPI shutdown or
reset event to be sent to the guest in the event that the guest does not
support the PV control interface.

This is not the default because the response to these triggers is an
guest-internal configuration.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
13 years agodocs: document /etc/xen/xl.conf
Ian Campbell [Tue, 31 Jan 2012 16:34:39 +0000 (16:34 +0000)]
docs: document /etc/xen/xl.conf

Signed-off-by: Ian Campbell <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: add named enum for timer mode.
Ian Campbell [Tue, 31 Jan 2012 16:34:39 +0000 (16:34 +0000)]
libxl: add named enum for timer mode.

Unlike previous iterations of this patch the enum values now match the
underlying domctl values.

I looked at updating xl.cfg(5) for these while I was here but frankly, even
after reading the comment in xen/include/public/hvm/params.h, I don't have a
clue what they mean, no_missed_ticks_pending in particular might as well be
written in klingon...

For the same reason I didn't try and give the enum more user-friendly names.

Signed-off-by: Ian Campbell <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: drop libxl_cpuarray -- topology was the only user.
Ian Campbell [Tue, 31 Jan 2012 16:34:39 +0000 (16:34 +0000)]
libxl: drop libxl_cpuarray -- topology was the only user.

Signed-off-by: Ian Campbell <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: expose cpu topology as a single list of cpu->{node,core,socket} maps.
Ian Campbell [Tue, 31 Jan 2012 16:34:39 +0000 (16:34 +0000)]
libxl: expose cpu topology as a single list of cpu->{node,core,socket} maps.

Rather than the previous tripple list which is more complicated to work with
and harder for language bindings.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
13 years agoocaml: Topology.get returns an array not a single element.
Ian Campbell [Tue, 31 Jan 2012 16:34:39 +0000 (16:34 +0000)]
ocaml: Topology.get returns an array not a single element.

The stub implementation appears to already be correct.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
13 years agoocaml: add helpers for Some/None option types.
Ian Campbell [Tue, 31 Jan 2012 16:34:39 +0000 (16:34 +0000)]
ocaml: add helpers for Some/None option types.

Signed-off-by: Ian Campbell <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: remove libxl_button_press in favour of libxl_send_trigger.
Ian Campbell [Tue, 31 Jan 2012 16:34:39 +0000 (16:34 +0000)]
libxl: remove libxl_button_press in favour of libxl_send_trigger.

send_trigger already included all the operations covered by button_press.

Rework send_trigger to take an enum instead of a string.

I stopped short at removing the xl "button-press" command but instead have
marked it as deprecated.

Signed-off-by: Ian Campbell <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: de-hard-tabbify idl.txt
Ian Campbell [Tue, 31 Jan 2012 16:34:39 +0000 (16:34 +0000)]
libxl: de-hard-tabbify idl.txt

Hard tabs were in the minority, nuke them.

Also we no longer supply the inaddr_ip builtin.

Signed-off-by: Ian Campbell <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: Rename libxl IDL infrastructure.
Ian Campbell [Tue, 31 Jan 2012 16:34:38 +0000 (16:34 +0000)]
libxl: Rename libxl IDL infrastructure.

Originally libxltypes.py provided the infrastructure and libxl.idl provided the
specific types.

In 23887:a543e10211f7 libxl.idl became libxl_types.idl (to allow for
libxl_types_internal.idl) which means we now have libxl_types.FOO and
libxltypes.FOO providing different things and annoying people in tab
completion.

Rename the infrastructure as idl.

Signed-off-by: Ian Campbell <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: only write "disable_pf" key to xenstore when it makes sense
Ian Campbell [Tue, 31 Jan 2012 16:34:38 +0000 (16:34 +0000)]
libxl: only write "disable_pf" key to xenstore when it makes sense

This key is only used by the traditional qemu-dm when servicing an HVM domain.

Signed-off-by: Ian Campbell <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: remove libxl_device_model_info.
Ian Campbell [Tue, 31 Jan 2012 16:34:38 +0000 (16:34 +0000)]
libxl: remove libxl_device_model_info.

All that is left here is the target domain's domid which we can pass around as
a parameter.

Signed-off-by: Ian Campbell <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: move "saved_state" to libxl__domain_build_state.
Ian Campbell [Tue, 31 Jan 2012 16:34:38 +0000 (16:34 +0000)]
libxl: move "saved_state" to libxl__domain_build_state.

This is internal to the library and need not be exposed to the user.

Signed-off-by: Ian Campbell <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: move device model selection variables to b_info.
Ian Campbell [Tue, 31 Jan 2012 16:34:32 +0000 (16:34 +0000)]
libxl: move device model selection variables to b_info.

Signed-off-by: Ian Campbell <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: remove uuid from device model info.
Ian Campbell [Tue, 31 Jan 2012 15:21:52 +0000 (15:21 +0000)]
libxl: remove uuid from device model info.

This should be managed by libxl and need not be exposed to the user.

Signed-off-by: Ian Campbell <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: Remove libxl_device_model_info.type.
Ian Campbell [Tue, 31 Jan 2012 15:21:52 +0000 (15:21 +0000)]
libxl: Remove libxl_device_model_info.type.

This is the type of the target guest which is part of the guest config.

Signed-off-by: Ian Campbell <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: move gfx_passthru setting to b_info->u.hvm
Ian Campbell [Tue, 31 Jan 2012 15:21:52 +0000 (15:21 +0000)]
libxl: move gfx_passthru setting to b_info->u.hvm

Although xl parsed this value for both PV and HVM domains (and then a second
time for HVM domains) inside libxl it only impacts HVM guests so I think this
is the right place for it.

Signed-off-by: Ian Campbell <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: HVM device configuration info build_info->u.hvm
Ian Campbell [Tue, 31 Jan 2012 15:21:52 +0000 (15:21 +0000)]
libxl: HVM device configuration info build_info->u.hvm

Signed-off-by: Ian Campbell <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: move HVM emulated GFX support into b_info->u.hvm
Ian Campbell [Tue, 31 Jan 2012 15:21:51 +0000 (15:21 +0000)]
libxl: move HVM emulated GFX support into b_info->u.hvm

Signed-off-by: Ian Campbell <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: use vfb[0] directly for xenpv device model
Ian Campbell [Tue, 31 Jan 2012 15:21:51 +0000 (15:21 +0000)]
libxl: use vfb[0] directly for xenpv device model

Rather than laundering it via dm info.

Signed-off-by: Ian Campbell <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: drop dm_info.dom_name
Ian Campbell [Tue, 31 Jan 2012 15:21:51 +0000 (15:21 +0000)]
libxl: drop dm_info.dom_name

This is always the same as the c_info name which we now have available.

Signed-off-by: Ian Campbell <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: remove redundant info from dm info.
Ian Campbell [Tue, 31 Jan 2012 15:21:51 +0000 (15:21 +0000)]
libxl: remove redundant info from dm info.

Remove "target_ram", "acpi", "vcpus" and "vcpu_avail" from device model info
and use domain_build_info instead. These must all be consistently specified to
both the domain and the device model, there is no need (and a great deal of
danger) in exposing a way for a user of libxl to set them differently.

Signed-off-by: Ian Campbell <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: now that dm creation takes domain_config stop passing down devices.
Ian Campbell [Tue, 31 Jan 2012 15:21:51 +0000 (15:21 +0000)]
libxl: now that dm creation takes domain_config stop passing down devices.

Signed-off-by: Ian Campbell <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: plumb libxl_domain_config down into device model creation.
Ian Campbell [Tue, 31 Jan 2012 14:41:00 +0000 (14:41 +0000)]
libxl: plumb libxl_domain_config down into device model creation.

Creating the device model derives lots of bits from the guest configuration.

Signed-off-by: Ian Campbell <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: define libxl_sdl_info to hold all info about the SDL config
Ian Campbell [Tue, 31 Jan 2012 14:41:00 +0000 (14:41 +0000)]
libxl: define libxl_sdl_info to hold all info about the SDL config

Signed-off-by: Ian Campbell <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: define libxl_spice_info to hold all info about the spice server
Ian Campbell [Tue, 31 Jan 2012 14:41:00 +0000 (14:41 +0000)]
libxl: define libxl_spice_info to hold all info about the spice server

Signed-off-by: Ian Campbell <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: define libxl_vnc_info to hold all info about the vnc info
Ian Campbell [Tue, 31 Jan 2012 14:40:59 +0000 (14:40 +0000)]
libxl: define libxl_vnc_info to hold all info about the vnc info

Reduces duplication in libxl_vfb and libxl_device_model.

Updated bindings but the python ones in particular are unlikely to be useful
until a user presents itself and fixes them up.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
13 years agoocaml: use libxl IDL type helpers for C argument passing
Ian Campbell [Tue, 31 Jan 2012 14:40:08 +0000 (14:40 +0000)]
ocaml: use libxl IDL type helpers for C argument passing

Makes handling of nested structs more correct.

Only change to the generated code right now is that the FOO_Val
(C->ocamlC) function for Enumeration types now takes the C argument by
value instead of reference.

Signed-off-by: Ian Campbell <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: use keyword arguments for field definitions in aggregate types.
Ian Campbell [Tue, 31 Jan 2012 14:39:57 +0000 (14:39 +0000)]
libxl: use keyword arguments for field definitions in aggregate types.

The original code is not so bad now that the comments are gone but this is
still a bit cleaner.

No change in the generated code.

Signed-off-by: Ian Campbell <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: remove comment support from IDL
Ian Campbell [Tue, 31 Jan 2012 14:39:57 +0000 (14:39 +0000)]
libxl: remove comment support from IDL

People typically don't look for comments in generated source and the syntax for
specifying them in the IDL makes things harder to follow.

Instead just use source code comments in the IDL itself.

I dropped a bunch of "foo bool # enable or disable foo" type comments. A lot of
the remainder still aren't terribly useful though.

No change to the generate code other than the comments being removed.

Signed-off-by: Ian Campbell <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: do not write/maintain "pool_name" in XenStore
Ian Campbell [Tue, 31 Jan 2012 14:39:57 +0000 (14:39 +0000)]
libxl: do not write/maintain "pool_name" in XenStore

Nothing that I can find ever reads this key.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: juergen.gross@ts.fujitsu.com
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
13 years agolibxl: name libxl_create_cpupool consistent with other functions.
Ian Campbell [Tue, 31 Jan 2012 14:39:57 +0000 (14:39 +0000)]
libxl: name libxl_create_cpupool consistent with other functions.

The pattern for the other cpupool functions is libxl_cpupool_<ACTION>
and in general we use libxl_<THING>_<ACTION>

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: juergen.gross@ts.fujitsu.com
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
13 years agolibxl: remove libxl_domain_create_info.poolname
Ian Campbell [Tue, 31 Jan 2012 14:39:57 +0000 (14:39 +0000)]
libxl: remove libxl_domain_create_info.poolname

It is redundant with poolid and allowing the user to specify both
opens up the possibility of a disconnect.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: juergen.gross@ts.fujitsu.com
[since v2 - correct default is 0 not -1]
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
13 years agox86: Use defines for bits of MSR_IA32_DEBUGCTLMSR instead of numbers
Dietmar Hahn [Wed, 1 Feb 2012 15:45:54 +0000 (16:45 +0100)]
x86: Use defines for bits of MSR_IA32_DEBUGCTLMSR instead of numbers

Signed-off-by: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
13 years agolibxl: add support for yajl 2.x
Roger Pau Monne [Tue, 31 Jan 2012 16:48:06 +0000 (16:48 +0000)]
libxl: add support for yajl 2.x

This patch adds support for yajl versions 2.x, while retaining 1.x
compatibility. All the needed ifdefs can be found in libxl_json.h.

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agomini-os: use BSD sys/queue.h instead of Linux list.h
Ian Campbell [Tue, 31 Jan 2012 16:06:14 +0000 (16:06 +0000)]
mini-os: use BSD sys/queue.h instead of Linux list.h

The latter is GPL which makes the whole of mini-os GPL rather than BSD
as intended. In tree users are all GPL or GPL-compatible but we should
fix this so that mini-os is BSD. Do so by using the same BSD
sys/queue.h as we use in libxl.

Tested with the builtin mini-os test app and qemu stubdomain, both of which
appear to still function as expected.

Move tools/libxl/external and the associated sed script to
tools/include/xen-external to allow more sensible access from mini-os.

Also add s/NULL/0/ in the sed script due to NULL not always being
defined in stubdom code when mini-os/wait.h is included.

As well as the obvious ABI changes there are a few API updates
associated with the change:

  - struct rw_semaphore.wait_list is unused
  - remove_waiter needs to take the wait_queue_head

The latter requires a qemu update, so there is also a QEMU_TAG
update in this changeset.

I sprinkled some extra-emacs local variables around the files I edited
which didn't have them.

I think this should be backported to the stable branches since
external users of mini-os may have been mislead into thinking they
could safely link mini-os against GPL-incompatible code.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
13 years agoxen: do not remap pirqs if !is_hvm_pv_evtchn_domain
Stefano Stabellini [Tue, 31 Jan 2012 11:39:37 +0000 (11:39 +0000)]
xen: do not remap pirqs if !is_hvm_pv_evtchn_domain

If the guest is an HVM guest and it is not using the vector callback
mechanism, refuse to remap pirqs onto event channels.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Tested-by: Paulian Bogdan Marinca <paulian@marinca.net>
Committed-by: Keir Fraser <keir@xen.org>
13 years agopublic/physdev.h: Fix __XEN_INTERFACE_VERSION__ typo.
Keir Fraser [Tue, 31 Jan 2012 11:37:03 +0000 (11:37 +0000)]
public/physdev.h: Fix __XEN_INTERFACE_VERSION__ typo.

Signed-off-by: Keir Fraser <keir@xen.org>
13 years agotools/libxc: remove volatile keyword for bitmap operations
Olaf Hering [Tue, 31 Jan 2012 11:35:07 +0000 (11:35 +0000)]
tools/libxc: remove volatile keyword for bitmap operations

All bitmaps maintained by xc_bitops.h are used in single threaded
applications. So nothing will change the bitmaps content, adding
volatile adds just unneeded memory reloads.

xenpaging uses bitmaps alot and using non-volatile versions will
slightly improve performance.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Keir Fraser <keir@xen.org>
13 years agotools/libxc: fix bitmap_alloc usage in xc_ia64_send_vcpumap
Olaf Hering [Tue, 31 Jan 2012 11:34:43 +0000 (11:34 +0000)]
tools/libxc: fix bitmap_alloc usage in xc_ia64_send_vcpumap

Changeset 23577:607474aeefe1 introduced an error in
xc_ia64_send_vcpumap(), bitmap_alloc() was not used correctly.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Keir Fraser <keir@xen.org>
13 years agomini-os: convert mlock macros to C functions
Olaf Hering [Tue, 31 Jan 2012 11:33:35 +0000 (11:33 +0000)]
mini-os: convert mlock macros to C functions

mlock and munlock are implemented as macros in mini-os. Their usage
requires casting in common code.  Convert them to C syntax and provide
an empty dummy function.  Remove the now unneeded (void) cast from two
munlock calls.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
13 years agoxenpaging: unify return value in nominate and evict
Olaf Hering [Mon, 30 Jan 2012 12:06:34 +0000 (13:06 +0100)]
xenpaging: unify return value in nominate and evict

Let p2m_mem_paging_nominate and p2m_mem_paging_evict return just one
error number. EINVAL is not very helpful in case of nominate, it can
happen if the pager tries to nominate a ballooned page. In this case the
gfn is not backed by a mfn, the pager can not know that.  Similar with
evict, anything can happen between nominate and evict.

This change helps the pager to decide if the returned error is from the
function itself, or if it happend earlier. In the latter case, it is
most likely fatal and should be handled as such.
nominate and evict return EBUSY, which is supposed to mean
"pager request reached target function, and failed."

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
13 years agolibxl: treat "dying" domains as destroyed
Ian Jackson [Mon, 30 Jan 2012 15:23:39 +0000 (15:23 +0000)]
libxl: treat "dying" domains as destroyed

Rename the DOMAIN_DESTROY event to DOMAIN_DEATH and have it trigger
when the domain goes into the state indicated by the domaininfo flag
"dying".

This fixes a race which could leak a daemonised xl process, which
would have ignored the domain becoming "dying" and would then wait
forever to be told the domain was destroyed.

After the domain becomes "dying" we can't generate an event when it is
actually destroyed because xenstored will eat the relevant
VIRT_DOM_EXC virq and not generate an @releaseDomain, since xenstored
discards its own record of the domain's existence as soon as it sees
the domain "dying" and will not trigger @releaseDomain watches for
domains it knows nothing about.  Arguably this is a bug in xenstored,
and the whole @releaseDomain machinery is rather poor, but let us not
fix that now.

Anyway, xl does not really want to know when the domain is ultimately
destroyed.  It is enough for xl to know that it is on the way out, in
the "dying" state (which leads later to destruction by Xen).

Also fix a bug where domain_death_xswatch_callback might read one
domain beyond the valid data in its domaininfos array, by correctly
ordering the checks for empty domain list, end of domain list, and our
domain being missing.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Tested-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
13 years agolibxl: domain_death_xswatch_callback: add some debug logging
Ian Jackson [Mon, 30 Jan 2012 15:23:38 +0000 (15:23 +0000)]
libxl: domain_death_xswatch_callback: add some debug logging

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
13 years agoxen: Preserve reserved grant entries when switching versions
Daniel De Graaf [Sat, 28 Jan 2012 13:49:41 +0000 (13:49 +0000)]
xen: Preserve reserved grant entries when switching versions

In order for the toolstack to use reserved grant table entries, the
grant table for a guest must be initialized prior to the guest's boot.
When the guest switches grant table versions (necessary if the guest
is using v2 grant tables, or on kexec if switching grant versions),
these initial grants will be cleared. Instead of clearing them,
preserve the grants across the type change.

Attempting to preserve v2-only features such as sub-page grants will
produce a warning and clear the resulting v1 grant entry.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
13 years agoxen: use XSM instead of IS_PRIV for getdomaininfo
Daniel De Graaf [Sat, 28 Jan 2012 13:49:05 +0000 (13:49 +0000)]
xen: use XSM instead of IS_PRIV for getdomaininfo

The XEN_DOMCTL_getdomaininfo domctl does not allow manipulation of
domains, only basic information such as size and state, so its use
does not fully justify making a domain privileged. XSM modules can
also provide fine-grained control over what domains are visible to
domains that call getdomaininfo.

If XSM is disabled (either at compile time or by using the dummy XSM
module) then there is no change in behavior: only IS_PRIV domains can
use this domctl. If enabled, the XSM module controls access.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
13 years agoxen: change virq parameters from int to uint32_t
Daniel De Graaf [Sat, 28 Jan 2012 13:48:34 +0000 (13:48 +0000)]
xen: change virq parameters from int to uint32_t

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
13 years agoxen: allow global VIRQ handlers to be delegated to other domains
Daniel De Graaf [Sat, 28 Jan 2012 13:48:03 +0000 (13:48 +0000)]
xen: allow global VIRQ handlers to be delegated to other domains

This patch sends global VIRQs to a domain designated as the VIRQ
handler
instead of sending all global VIRQ events to dom0. This is required in
order to run xenstored in a stubdom, because VIRQ_DOM_EXC must be sent
to xenstored for domain destruction to work properly.

This patch was inspired by the xenstored stubdomain patch series sent
to xen-devel by Alex Zeffertt in 2009.

Signed-off-by: Diego Ongaro <diego.ongaro@citrix.com>
Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agoxen: reinstate previously unused XENMEM_remove_from_physmap hypercall
Daniel De Graaf [Sat, 28 Jan 2012 13:47:24 +0000 (13:47 +0000)]
xen: reinstate previously unused XENMEM_remove_from_physmap hypercall

This patch reinstates the XENMEM_remove_from_physmap hypercall
which was removed in 19041:ee62aaafff46 because it was not used.

However, is now needed in order to support xenstored stub domains.
The xenstored stub domain is not priviliged like dom0 and so cannot
unilaterally map the xenbus page of other guests into it's address
space.  Therefore, before creating a domU the domain builder needs to
seed its grant table with a grant ref allowing the xenstored stub
domain to access the new domU's xenbus page.

At present domU's do not start with their grant table mapped.
Instead it gets mapped when the guest requests a grant table from
the hypervisor.

In order to seed the grant table, the domain builder first needs to
map it into dom0 address space.  But the hypercall to do this
requires a gpfn (guest pfn), which is an mfn for PV guest, but a pfn
for HVM guests.  Therfore, in order to seed the grant table of an
HVM guest, dom0 needs to *temporarily* map it into the guest's
"physical" address space.

Hence the need to reinstate the XENMEM_remove_from_physmap hypercall.

Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agoxen: introduce PHYSDEVOP_pirq_eoi_gmfn_v2
Stefano Stabellini [Sat, 28 Jan 2012 13:45:13 +0000 (13:45 +0000)]
xen: introduce PHYSDEVOP_pirq_eoi_gmfn_v2

PHYSDEVOP_pirq_eoi_gmfn changes the semantics of PHYSDEVOP_eoi.
In order to improve the interface this patch:

- renames PHYSDEVOP_pirq_eoi_gmfn to PHYSDEVOP_pirq_eoi_gmfn_v1;

- introduces PHYSDEVOP_pirq_eoi_gmfn_v2, that is like
  PHYSDEVOP_pirq_eoi_gmfn_v1 but it doesn't modify the behaviour of
  another hypercall;

- bump __XEN_LATEST_INTERFACE_VERSION__;

- #define PHYSDEVOP_pirq_eoi_gmfn to PHYSDEVOP_pirq_eoi_gmfn_v1 or
  PHYSDEVOP_pirq_eoi_gmfn_v2 depending on the __XEN_INTERFACE_VERSION.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agovesa: flush lfb after zeroing
Andrew Cooper [Sat, 28 Jan 2012 13:42:25 +0000 (13:42 +0000)]
vesa: flush lfb after zeroing

If Xen is going to relinquish the VGA console, flush the linear frame
buffer after zeroing it in vesa_endboot().

Failing to do so in some circumstances leads to the actual linear
framebuffer on the graphics card still containing the output of the
Xen boot console can lead to ugly graphics output when dom0 is setting
up the graphics card for its own use.

While the patch is quite large, it is mostly just code motion to
prevent having to forward declare lfb_flush().  The only functional
change to vesa_endboot() is to insert a call to lbf_flush().

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agoConsole: introduce console=none command line parameter
Andrew Cooper [Sat, 28 Jan 2012 13:41:42 +0000 (13:41 +0000)]
Console: introduce console=none command line parameter

Currenty, not specifying 'console=<foo>' on the command line causes
Xen to default to 'vga'.  Alternativly, the user can explicitly
specifiy 'console=vga|com1|com2'.

However, there is no way to specify that neither vga nor serial should
be used.  Specifying 'console=' does have the effect that neither vga
nor serial is set up, but at the cost of an "Bad console= option ''"
warning.

Therefore, expliticly support a 'console=none' option which does not
set up vga and does not set up serial, but does not trigger the bad
console warning.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agoamd iommu: disable iommu emulation on non-iommu systems
Wei Wang [Sat, 28 Jan 2012 13:40:36 +0000 (13:40 +0000)]
amd iommu: disable iommu emulation on non-iommu systems

Introduce a new flag to disable iommu emulation on old iommu systems.
This patch is taken from my v4 patch queue, which is till pending, to
make old or non-iommu system to run cleanly without interfered by
iommuv2 codes. This might be helpful to isolate iommuv2 code in
debugging unstable regressions. The reset part of v4 will be re-based.

Signed-off-by: Wei Wang <wei.wang2@amd.com>
Committed-by: Keir Fraser <keir@xen.org>
13 years agolibxl: allow for specifying the CPU affinity in the config file.
Dario Faggioli [Fri, 27 Jan 2012 19:17:03 +0000 (19:17 +0000)]
libxl: allow for specifying the CPU affinity in the config file.

Enable CPU affinity specification in a VM's config file with the
exact syntax `xl vcpu-pin' provides.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agolibxl: extend pCPUs specification for vcpu-pin.
Dario Faggioli [Fri, 27 Jan 2012 19:14:00 +0000 (19:14 +0000)]
libxl: extend pCPUs specification for vcpu-pin.

Allow for "^<cpuid>" syntax while specifying the pCPUs list
during a vcpu-pin. This enables doing the following:

 xl vcpu-pin 1 1 0-4,^2

and achieving:

 xl vcpu-list
 Name                                ID  VCPU   CPU State   Time(s) CPU Affinity
 ...
 Squeeze_pv                           1     1    3   -b-       2.4  0-1,3-4
 ...

Negative ranges are also supported, such as "0-4,^1-2" to
mean "0,3-4"

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agoxenpaging: make file_op largefile aware
Olaf Hering [Fri, 27 Jan 2012 19:03:37 +0000 (19:03 +0000)]
xenpaging: make file_op largefile aware

lseek() takes an off_t, the used "int << shiftsize" does not automatically
convert the int into a larger type. This leads to write errors with pagefiles
larger than 2G. Fix this by shifting an off_t instead of an int.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agotools/libxc: handle fallback in linux_privcmd_map_foreign_bulk properly
Olaf Hering [Fri, 27 Jan 2012 18:32:55 +0000 (18:32 +0000)]
tools/libxc: handle fallback in linux_privcmd_map_foreign_bulk properly

If the first ioctl fails with ENOENT it means the command is known. If a
second attempt to map each gfn happens to fail then there is no need to
run the fallback code. Some gfns are paged and the fallback code would
not fix the failure. Instead return the EINVAL to the caller.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agotools: memshrtool: tool to test and exercise the sharing subsystem
Andres Lagar-Cavilla [Fri, 27 Jan 2012 18:23:42 +0000 (18:23 +0000)]
tools: memshrtool: tool to test and exercise the sharing subsystem

This is demo code meant to showcase how to perform sharing
operations. It is useful for testing.

[ Added appropriate lines to .hgignore and .gitignore -iwj ]

Signed-off-by: Adin Scannell <adin@scannell.ca>
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agolibxl_qmp: fix qmp_next to cope with multiple lines read in a single buffer
Stefano Stabellini [Fri, 27 Jan 2012 17:58:20 +0000 (17:58 +0000)]
libxl_qmp: fix qmp_next to cope with multiple lines read in a single buffer

qmp_next doesn't handle multiple lines read together in a single
buffer correctly at the moment.  This patch fixes it.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agolibxl: fix mutex initialization
Roger Pau Monne [Fri, 27 Jan 2012 17:48:14 +0000 (17:48 +0000)]
libxl: fix mutex initialization

The macro PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP is not defined on
NetBSD, so define mutex attributes manually.

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agolibxl: fix upstream qemu binary name to what we actually install
Ian Campbell [Fri, 27 Jan 2012 17:09:04 +0000 (17:09 +0000)]
libxl: fix upstream qemu binary name to what we actually install

Binary is always qemu-system-i386 even for a 64 bit build.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>