Commit Graph
27133 Commits
Author SHA1 Message Date
Daniel De Graaf b05cb51b06 mini-os/tpmback: Replace UUID field with opaque pointer
Instead of only recording the UUID field, which may not be of interest
to all tpmback implementations, provide a user-settable opaque pointer
associated with the tpmback instance.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
2013-04-12 14:28:17 +01:00
Daniel De Graaf 368fcb5264 mini-os/tpmback: set up callbacks before enumeration
The open/close callbacks in tpmback cannot be properly initalized in
order to catch the initial enumeration events because init_tpmback
clears the callbacks and then asynchronously starts the enumeration of
existing tpmback devices. Fix this by passing the callbacks to
init_tpmback so they can be installed before enumeration.

This also removes the unused callbacks for suspend and resume.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
2013-04-12 14:28:17 +01:00
Daniel De Graaf e66cb3294f mini-os/tpm{back, front}: Allow device repoens
Allow the vtpm device to be disconnected and reconnected so that a
bootloader (like pv-grub) can submit measurements and return the vtpm
device to its initial state before booting the target kernel.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
2013-04-12 14:28:17 +01:00
Daniel De Graaf f494d9f3c3 mini-os/tpm{back, front}: Change shared page ABI
This changes the vTPM shared page ABI from a copy of the Xen network
interface to a single-page interface that better reflects the expected
behavior of a TPM: only a single request packet can be sent at any given
time, and every packet sent generates a single response packet. This
protocol change should also increase efficiency as it avoids mapping and
unmapping grants when possible. The vtpm xenbus device now requires a
feature-protocol-v2 node in xenstore to avoid conflicts with existing
(xen-patched) kernels supporting the old interface.

While the contents of the shared page have been defined to allow packets
larger than a single page (actually 4088 bytes) by allowing the client
to add extra grant references, the mapping of these extra references has
not been implemented; a feature node in xenstore may be used in the
future to indicate full support for the multi-page protocol. Most uses
of the TPM should not require this feature.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Cc: Jan Beulich <JBeulich@suse.com>
2013-04-12 14:28:17 +01:00
M A Young c1f0b21453 libxl: beautify json with YAJL2
xl list -l should produce readable output when built with yajl2 so
it is compatible with the xendomains script.

Signed-off-by: Michael Young <m.a.young@durham.ac.uk>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-04-12 12:21:02 +01:00
Ian Campbell 13d68fab40 tools+stubdom: install under /usr/local by default.
Now that the hotplug scripts have been fixed to remove hardcoded paths lets
try this again. From 26470:acaf29203cf9:

	This is the defacto (or FHS mandated?) standard location for software
	built from source, in order to avoid clashing with packaged software
	which is installed under /usr/bin etc.

	I think there is benefit in having Xen's install behave more like the
	majority of other OSS software out there.

	The major downside here is in the transition from 4.2 to 4.3 where
	people who have built from source will innevitably discover breakage
	because 4.3 no longer overwrites stuff in /usr like it used to so they
	pickup old stale bits from /usr instead of new stuff from /usr/local.

	Packages will use ./configure --prefix=/usr or whatever helper macro
	their package manager gives them. I have confirmed that doing this
	results in the same list of installed files as before this patch was
	applied.

	The hypervisor remains in /boot/ and there is no intention to move it.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
2013-04-12 10:20:25 +01:00
Ian Campbell cf38606aad libxl: regenerate libxlu cfg parser after 9e14c516b6
Fixup whitespace alignment while I'm there.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
2013-04-12 08:55:18 +01:00
Wei Liu edb13df2ae Switch to poll() in cxenstored's IO loop
Poll() can support more file descriptors than select(). We've done this for
xenconsoled, now do this for cxenstored as well.

The code is taken from xenconsoled and modified to adapt to cxenstored.

Note that poll() semantic is a bit different from select(). In Linux, if a fd
is set in IN/OUT fd_set and error occurs inside select(), this fd is still
considered readable / writable, and it is set in the returned IN/OUT fd_set.
So in later handle_input / handle_output, the connection will eventually be
talloc_free'ed(). After switching to poll(), we should take care of any error
right away, making the code clearer.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-04-11 15:42:44 +01:00
Wei Liu 1b7720cd4b mini-os: implement poll(2)
It is just a wrapper around select(2). This implementation mimics Linux's
do_poll.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2013-04-11 15:42:39 +01:00
Daniel De Graaf be8d8d634d stubdom/Makefile: Fix gmp extract rule
When NEWLIB_STAMPFILE is updated but gmp has already been extracted, the mv
command will incorrectly create a subdirectory instead of renaming. Remove the
old target before renaming to fix this.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-04-11 15:20:50 +01:00
Tim Deegan 7186e6718e arm: fix comment in HTCR setup.
Reported-by: Gihun Jung <gihun.jung@gmail.com>
Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-04-11 14:25:30 +01:00
Julien Grall b952c687fa xen/arm: Save/Restore GICH_APR register
Linux uses GICC_CTLR.EOImodeNS set to 0, which means both priority drop and
deactivate interrupt functionality are made when something is written in
GICC_EOIR.

As the ARM manual specifies: "having an active interrupt in the List registers
with a priority that is not set in the corresponding Active Priorities
register" when GICV_CTLR.EOImode (ie GICC_CTLR.EOImodeNS in the guest context)
result in unpredicable behavior, we need to save/restore GICH_APR.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-04-11 14:23:31 +01:00
Ian Campbell 3e27e36ca5 hotplug/Linux: Remove hardcoded paths
Use xen-hotplugpath.sh (as NetBSD does) which allows PREFIX etc to change.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Roger Pau Monne <roger.pau@citrix.com>
2013-04-11 13:19:57 +01:00
Ian Jackson 1386ee2fc2 Merge branch 'staging' of xenbits.xen.org:/home/xen/git/xen into staging 2013-04-11 13:18:40 +01:00
Choonho Son 9e14c516b6 xl: fix xl config parser
Bug: xl lexical analyzer cannot parse keyword which has .(dot) character like vif.default.script

ref: 733b9c524d
Error log: /etc/xen/xl.conf:28: config parsing error near `.default.script="vif-bridge"': lexical error

Signed-off-by: Choonho Son <choonho.son@gmail.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Roger Pau Monne <roger.pau@citrix.com>
2013-04-11 13:17:20 +01:00
Daniel De Graaf f3056b0fef MAINTAINERS: Add myself as VTPM maintainer
Matthew Fioravante will no longer be maintaining the vTPM code.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
2013-04-11 12:17:04 +01:00
David Scott 814963a664 ocaml: eventchn: remove the unused exception 'Eventchn.Error'
Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-04-11 12:03:12 +01:00
David Scott f417daeef0 ocaml: eventchn: add ocamldoc strings to the interface
Also add a reference to tools/libxc/xenctrl.h, which is where
the underlying C functions are defined.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-04-11 12:03:11 +01:00
David Scott 5aca10972b ocaml: eventchn: in the interface, we don't have to give implementation details
Remove the mention of the C function names from the .mli -- this is only
needed in the implementation .ml

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-04-11 12:03:11 +01:00
David Scott dfb9738cdc ocaml: eventchn: add a 'type t' to represent an event channel
It's a common OCaml convention to add a 'type t' in a module to
represent the main "thing" that the module is about. We add an
opaque type t and to_int/of_int functions for those who really
need it, in particular:

  1. to_int is needed for debug logging; and
  2. both to_int and of_int are needed for anyone who communicates
     a port number through xenstore.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-04-11 12:03:11 +01:00
Ian Campbell 0b1161e037 Merge branch 'xenstore-syslog' of git://github.com/djs55/xen into staging 2013-04-11 12:03:11 +01:00
David Scott 73154a195e MAINTAINERS: add entry for the OCaml tools
I hereby volunteer myself to maintain the OCaml tools (/tools/ocaml)
in particular:
  * the OCaml bindings
  * the OCaml xenstored

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-04-11 12:03:04 +01:00
Ian Campbell e8dec6c69a xen: arm: remove PSR_MODE_MASK from public interface.
This is also defined in sys/ptrace.h on arm64 which breaks the tools build due
to multiple definitions. I expect this is really a bug in the kernel and/or
glibc but we don't really need this symbol in the public headers, at least not
right now, so move it into include/asm instead.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2013-04-11 11:09:26 +01:00
Ian Campbell 0793e96282 xen: arm64 uses the same I/O ABI as arm32
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2013-04-11 11:09:26 +01:00
Ian Campbell 3dba45ee8a tools: memshr: arm64 support
I'm not mad keen on propagating these sorts of asm atomic operations throughout
our code base. Other options would be:

- use libatomic-ops, http://www.hpl.hp.com/research/linux/atomic_ops/, although
  this doesn't seem to be as widespread as I would like (not in RHEL5 for
  example)
- use a pthread lock. This is probably the simplest/best option but I wasn't
  able to figure out the locking hierarchy of this code

So I've copped out and just copied the appropriate inlines here.

I also nuked some stray ia64 support and fixed a coment in the arm32 version
while I was here.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2013-04-11 11:09:25 +01:00
Ian Campbell ae4b6f29a9 tools: libxc: arm64 support
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
2013-04-11 11:09:25 +01:00
Ian Campbell 2a6068822d tools: only check for Python devel tools if not cross-compiling.
tools/python and tools/pygrub are already skipped in tools/Makefile when
cross-compiling, so no point in checking for the prerequisites either.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2013-04-11 11:09:25 +01:00
Ian Campbell cc9b8e3f33 tools: only build blktap1 on x86
It does not cross-compile for ARM and no sane new port is going to use it.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2013-04-11 11:09:25 +01:00
Ian Campbell b073e110e8 blktap2: use sys/eventfd.h if it is available
arm64 only has the eventfd2 system call and using the libc wrapper when
available hides this from us. eventfd() has been in libc since glibc 2.8.

This code is already Linux specific.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2013-04-11 11:09:25 +01:00
Ian Campbell 1cc48e865b tools: Use AC_SYS_LARGEFILE instead of calling getconf(1)
getconf is not cross-compile friendly since it reports the features of the host
and not the target. There doesn't appear to be a $triplet-getconf.

AC_SYS_LARGEFILE arranges for #defines to appear in config.h however Xen's
build system expects these to be part of C{PP}FLAGS. Since I'm not confident
that everything in Xen includes config.h I instead arrange for the result of
running AC_SYS_LARGERFILE to end up in CFLAGS.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2013-04-11 11:09:25 +01:00
Jan Beulich eb60be3dd8 x86: don't pass negative time to gtime_to_gtsc()
scale_delta(), which is being called by that function, doesn't cope
with that.

Also print a warning message, so hopefully we can eventually figure why
occasionally a negative value results from the calculation in the first
place.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
2013-04-11 12:07:55 +02:00
Ian Campbell d1efb7702b xen: arm: define 64-bit guest hypercall calling convention.
As well as using x<N> rather than r<N> registers for passing arguments/results
as mandate the use of x16 as the hypercall number.

Add some pedantry about struct alignment layout referencing the ARM Procedure
Calling Standard to avoid confusion with the previous "OABI" convention. While
at it also mandate that hypercall argument structs are always little endian.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2013-04-11 10:05:01 +01:00
Ian Campbell 1f749f7822 arm: tweak/improve logging for host SMP
Make the "CPU<n> booted" message fit in with the surrounding logging.

Log which CPU is taking an unexpected trap.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2013-04-11 09:35:37 +01:00
Ian Campbell 8424523b15 arm: gic: fix build on arm64
lr_mask is a uint64_t and so needs to be printed with PRIx64.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2013-04-11 09:34:58 +01:00
Ian Campbell db453468d9 arm: vgic: fix race between evtchn upcall and evtchnop_send
On ARM the evtchn upcall is done by using a local PPI interrupt. However the
guest will clear the evtchn_upcall_pending bit before it EOIs that PPI (which
happens late). This means vgic_vcpu_inject_irq (called via
vcpu_mark_events_pending) sees the PPI as in flight and ends up not reinjecting
it, if this happens after the guest has finished its event channel processing
loop but before the EOI then we have lost the upcall.

To fix this we need to check if an evtchn upcall is pending when returning to
the guest and if so reinject the PPI.

We therefore also need to call gic_restore_pending_irqs on the exit to guest
path in order to pickup any newly inject IRQ and propagate it into a free LR.
This doesn't currently support bumping a lower priority interrupt out of the
LRs in order to inject a new higher priority interrupt. We don't yet implement
interrupt prioritisation (and guests don't use it either) so this will do for
now.

Since gic_restore_pending_irqs is now called in the return to guest path it is
called with interrupts disabled and accordingly must use the
irqsave/irqrestore spinlock primitives.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2013-04-11 09:31:52 +01:00
Ian Campbell 497afc5ad4 arm: vgic: typo s/securty/security/
At least we were consistent, but lets be correct too

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2013-04-11 09:27:45 +01:00
Ian Campbell b806c2736f arm: consolidate setup of hypervisor traps and second stage paging
In particular be sure to initisalise HCR_EL2 on secondary processors.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
[ ijc -- adjusted due to unapplied "trap guest WFI" by s/HCR_TWI// ]
2013-04-11 09:27:40 +01:00
Ian Campbell c0b352d198 arm: initialise VCPU SCTLR in vcpu_initialise
Ensuring a sane initial starting state for vcpus other than domain 0s.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2013-04-11 09:19:09 +01:00
Christoph Egger b0b42dc9a5 x86: allow AMD MSRs injected via xen-mceinj
Signed-off-by: Christoph Egger <chegger@amazon.de>
2013-04-11 10:11:44 +02:00
Jan Beulich d739470b94 x86: show handler for Xen-internal interrupts
... in 'i' debug key output.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
2013-04-10 18:27:32 +02:00
Jan Beulich fe017c59c4 x86/MSI: cleanup to prepare for multi-vector MSI
The major aspect being the removal of the overload of the MSI entry's
mask_base field for MSI purposes - a proper union is being installed
instead, tracking both the config space position needed and the number
of vectors used (which is going to be 1 until the actual multi-vector
MSI patches arrive).

It also corrects misleading information from debug key 'M': When
msi_get_mask_bit() returns a negative value, there's no mask bit, and
hence output shouldn't give the impression there is.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
2013-04-10 17:30:19 +02:00
Stefano Stabellini 94d166c010 xen/arm: phys_timer fixes
Do not unmask the emulated phys_timer when the related Xen timer
expires.
Do not inject the phys_timer interrupt if it is masked.

Do not let the user set CNTx_CTL_PENDING directly.

Set CNTx_CTL_PENDING when the phys_timer expires and clear it when the
phys_timer is disabled or the compare value is changed.

Define offset and cval as uint64_t given that they can't be negative and
they are used as uint64_t arguments.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-04-10 16:12:38 +01:00
Stefano Stabellini c96513ff9d xen/arm: don't set the internal Xen timer if virt_timer is masked
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-04-10 16:08:36 +01:00
Stefano Stabellini 0648a3437e xen/arm: dump gic debug info from arch_dump_domain_info
Print some useful GIC debug information when arch_dump_domain_info is
called ('q' debug key).

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-04-10 16:04:48 +01:00
Jan Beulich bd9be94eb2 x86: debugging code for platform timer wrap problem
This is intentionally adding code not well formatted (so it stands out)
and expected to be reverted as soon as the problem with the timer wraps
has been spotted.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
2013-04-09 13:33:52 +02:00
Tim Deegan 69b0fbfe60 x86: serialize page table population in map_domain_page_global()
Looking at map_domain_page_global, there doesn't seem to be any locking
preventing two CPUs from populating a page of global-map l1es at the
same time.

Signed-off-by: Tim Deegan <tim@xen.org>
2013-04-09 10:30:33 +02:00
George Dunlap c3a2148192 xl: Accept a list for usbdevice in config file
Allow the "usbdevice" key to accept a list of USB devices, and pass
them in using the new usbdevice_list domain build element.

For backwards compatibility, still accept singleton values.

Also update the xl.cfg manpage, adding information about how to pass
through host devices.

as applied:
 - Fix trailing whitespace and wrap some lines in xl_cmdimpl.c -iwj
v2:
 - Add some verbiage to make it clear that "usb" is for emulated devices
 - Reference qemu manual for more usbdevice options

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2013-04-08 18:03:05 +01:00
George Dunlap ac16730d03 libxl: Allow multiple USB devices on HVM domain creation
This patch allows an HVM domain to be created with multiple USB
devices.

Since the previous interface only allowed the passing of a single
device, this requires us to add a new element to the hvm struct of
libxl_domain_build_info -- usbdevice_list.  For API compatibility, the
old element, usbdevice, remains.

If hvm.usbdevice_list is set, each device listed will cause an extra
"-usbdevice [foo]" to be appended to the qemu command line.

Callers may set either hvm.usbdevice or hvm.usbdevice_list, but not
both; libxl will throw an error if both are set.

In order to allow users of libxl to write software compatible with
older versions of libxl, also define LIBXL_HAVE_BUILDINFO_USBDEVICE_LIST.
If this is defined, callers may use either hvm.usbdevice or
hvm.usbdevice_list; otherwise, only hvm.usbdevice will be available.

as applied:
 - Fix whitespace errors -iwj
v3:
 - Duplicate functionality in both "new" and "old", since we're not
   unifying the two anymore.
v2:
 - Throw an error if both usbdevice and usbdevice_list are set
 - Update and clarify definition based on feedback
 - Previous patches means this works for both traditional and upstream

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2013-04-08 18:00:29 +01:00
David Vrabel 0e6086a7de xl: default autoballoon option to "auto"
In xl.conf, autoballoon="auto" will do the right thing for most
people.  Make it the default (instead of "on").

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2013-04-08 17:05:46 +01:00
David Vrabel 48f4af18b3 xl: extend autoballoon xl.conf option with an "auto" option
autoballoon=1 is not recommened if dom0_mem was used to reduce the
amount of dom0 memory.  Instead of requiring users to change xl.conf
if they do this, extend the autoballoon option with a new choice:
"auto".

With autoballoon="auto", autoballooning will be disabled if dom0_mem
was used on the Xen command line.

For consistency, accept "on" and "off" as valid autoballoon options (1
and 0 are still accepted).

The default remains "on" for now.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2013-04-08 17:04:52 +01:00