Commit Graph
16266 Commits
Author SHA1 Message Date
Keir Fraser cb9e907b6f acm, xm: Propagate error codes.
Fix propagation of error codes to the shell in some of the security
related xm commands.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
2007-10-30 09:33:49 +00:00
Keir Fraser 818a831762 qemu vnc auth 4/4: XenD config for VNC TLS protocol
This patch adds support to XenD for configuring the previously added
TLS encryption and x509 certificate validation. At this time I have
only enabled this config to be done system-wide via
/etc/xen/xend-config.sxp. Since it requires the admin to add
certificates on the local FS, there's not much point in making it per
VM. The x509 certificates are located in /etc/xen/vnc. Since this
requires a special VNC client program (GTK-VNC,
virt-viewer/virt-manager or VeNCrypt viewer) the use of TLS is
disabled by default. Admins can enable it if they are using a suitable
client.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2007-10-30 09:32:10 +00:00
Keir Fraser 02b1dc06bf qemu vnc auth 3/4: Add VNC auth support from upstream QEMU
This patch adds in the upstream QEMU VNC authentication code. This
spports the previous VNC password auth scheme, as well as the VeNCrypt
protocol extension. The latter allows for performing a TLS handshake,
and client verification of the server identify using x509
certificates. It is also possible for the server to request a client
certificate and validate that as a simple auth scheme. The code
depends on GNU TLS for SSL APIs, and the configure script will
auto-detect this.

The image.py code is changed to  deal with the new syntax for the -vnc
option.  In particular password authentication is now enabled by
giving the 'password' flag,

eg -vnc 0.0.0:1,password

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2007-10-30 09:30:49 +00:00
Keir Fraser 7891d8064f qemu vnc auth 2/4: Revert current VNC auth support
This patch reverts the current Xen specific implementation of VNC
authentication from the QEMU code. This is basically reverting
11840:02506a744315. The idea here is to get the VNC code back to more
closely match upstream QEMU, before applying the upstream auth
patches.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2007-10-30 09:24:17 +00:00
Keir Fraser 5b52d6724c qemu vnc auth 1/4: QEMU event handler bug fix
This patch pulls in an upstream QEMU fix for dealing with a problem in
the event dispatcher where a write callback gets unregistered while a
write event is pending from poll. Without this the QEMU process with
deference a NULL pointer and crash.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2007-10-30 09:22:27 +00:00
Keir Fraser 27d2e52b7c xend: Reduce xenstore transactions when listing domains
In summary, this allows a xenstore transaction object to be passed
around the various device controllers, so that they don't have to do
lots of singleton transactions. Transactions have very heavy I/O
impact from xenstored so reducing their number is important.

When running 3 guests, this patch reduces the impact of 'xm list
--long' from 176 transactions, scaling O(n) with guests, to 26
transactions with O(1) scaling.

I have previously attempted to also address the same issue with 'xm
create' but that's much harder since the device front/back handshake
requires that XenD use a number of small transactions. So i've not
changed anything here.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2007-10-30 09:19:43 +00:00
Keir Fraser e33d4a7316 x86: allow pv guests to disable TSC for applications
Linux, under CONFIG_SECCOMP, has been capable of hiding the TSC from
processes for quite a while. This patch enables this to actually work
for pv kernels, by allowing them to control CR4.TSD (and, as a simple
thing to do at the same time, CR4.DE).

Applies cleanly only on top of the previously submitted debug register
handling patch.

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

Also clean up CR4 and EFER handling, and hack-n-slash header file
inclusion madness to get the tree building again.

Signed-off-by: Keir Fraser <keir@xensource.com>
2007-10-29 16:49:02 +00:00
Keir Fraser 8fbfe1c9c1 x86: Remove dead code from arch_get_info_guest().
Signed-off-by: Keir Fraser <keir@xensource.com>
2007-10-29 15:05:27 +00:00
Keir Fraser 14012a15e8 xenconsoled: Rate-limit activity caused by each domU.
Allow each domU to fire its event channel at most 30 times every 200ms.
Signed-off by: Daniel P. Berrange <berrange@redhat.com>
2007-10-29 14:43:19 +00:00
Keir Fraser ee41f1c835 Allow incremental access to hypervisor console log.
Signed-off-by: Keir Fraser <keir@xensource.com>
2007-10-29 12:56:27 +00:00
Keir Fraser 70ee40b004 x86: Clean up NMI delivery logic. Allow set_trap_table vector 2 to be
specified as not disabling event delivery, just like any other vector.
Signed-off-by: Keir Fraser <keir@xensource.com>
2007-10-29 09:49:39 +00:00
Keir Fraser 8ee4d89b72 x86, hvm: Clean up code style in stdvga code and do not compile for
32-bit hypervisor (it doesn't work).
Signed-off-by: Keir Fraser <keir@xensource.com>
2007-10-29 09:17:38 +00:00
Keir Fraser 20e7b4098f x86, vt-d: Move out isa irq mapping from hvm_do_IRQ_dpci()
Setting isa irq mapping in hvm_do_IRQ_dpci() costs time when each
interrupt occurs, and it doesn't update isa irq mapping when pci_link
is updated.

Signed-off-by: Weidong Han <weidong.han@intel.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
2007-10-29 09:16:59 +00:00
Keir Fraser 5ef7bed4e4 xend, acm: Trigger a script when a resource's label changes
This patch triggers a script when a resource's label changes. The xend
config file should provide a variable 'resource-label-change-script'
that can then be launched.

Signed-off-by; Stefan Berger <stefanb@us.ibm.com>
2007-10-29 08:46:34 +00:00
Keir Fraser a99192d1d7 xend, acm: Fix bad indentation
Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
2007-10-29 08:45:58 +00:00
Keir Fraser 5305e6b3be Fix PVFB device initialization
The final series of patches I sent out lost 2 hunks in the big
refactoring patches I did thanks to a messed up rebase/rediff :-( This
patch fixes the device nodename initialization so that watches work
correctly.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2007-10-26 17:16:14 +01:00
Keir Fraser 7f71fbd32b x86: Replace FLUSH_LEVEL() parameter to flush_area() with rather
clearer FLUSH_ORDER(). Also remove bogus assertion.
Signed-off-by: Keir Fraser <keir@xensource.com>
2007-10-26 16:06:49 +01:00
Keir Fraser 0059b250dc serial: Check index argument before indexing into an array.
Pointed out by Christoph Egger, and worth fixing for clarity even if
it's not necessarily a bug.
Signed-off-by: Keir Fraser <keir@xensource.com>
2007-10-26 15:14:38 +01:00
Keir Fraser 7c5ba0bb00 Fire watch for non-dom0 backend when frontend is removed from xenstore
in a transaction.
Signed-off-by: Max Zhen <max.zhen@sun.com>
2007-10-26 11:48:58 +01:00
Keir Fraser 70ad570b27 x86/64: paravirt 32-on-64 call gate support
As we realized while trying out NetWare's ring 3 support, call gates
didn't work for 32-bit guests on 64-bit hypervisor. Since x86-64
doesn't know 16- or 32-bit call gates, the only option was to emulate
them. The code here was developed against 3.0.4, so hasn't been
checked for potential integration possibilities with the much improved
emulator; nevertheless I want to supply this patch.

As was realized in the course of creating this patch, 64-bit gates
don't work either, and will also need to be emulated if any
environment intends to use them. The patch changes behavior here in
that rather silently permitting the use of 64-bit gates (with possibly
difficult to understand exceptions happening on the first instruction
of the call/jump target) the call/jump itself will now fault, with the
error code indicating the gate that was attempted to be used. I intend
to complete the emulation to also cover 64-bit gates, but there is one
issue that first needs to be addressed: Whether a gate transitions
from user to kernel mode doesn't depend on the gate, but rather on the
descriptor referenced by the selector held in the gate. As the two can
change independently, this decision can be made only at the point of
use of the gate, and consequently descriptors for kernel code segments
must become distinguishable from user ones, which they currently
aren't as they both get their DPL forced to 3. An initial thought here
is to possibly leverage the otherwise meaningless conforming bit
(i.e. forcing it on for all user code segments, and off for kernel
ones, where then the distinction can be made at the point the
descriptor gets verified/fixed up based of the kernel supplied DPL
[wouldn't work for old guests when setting the DPL to 3 was still
required to be done by the guest]).

The patch also changes behavior of check_descriptor() in that no
modification is done to the descriptor anymore unless all verification
steps passed, and in that the selector RPL of selectors in call gates
no longer gets fixed up (a comment elsewhere in the code correctly
states that the RPL field here isn't used for anything by the
processor); really, this field is now used on 64-bits to store the
original DPL of the gate, because the architectural one now gets
forced to zero.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2007-10-26 11:40:10 +01:00
Keir Fraser 333e063a9e Clean up xen/xsm/xsm_policy.c compilation warning on !x86.
Signed-off-by: Atsushi SAKAI <sakaia@jp.fujitsu.com>
2007-10-26 10:57:03 +01:00
Keir Fraser 7ce59f7340 LAPIC timer accounting fix
Offset emulated local APIC timer so it doesn't tick during guest's
timer related processing. Otherwise, guests using the local APIC for
process accounting can see long sequences of process ticks incorrectly
charged to interrupt processing.

Signed-off-by: Ben Guthro <bguthro@virtualron.com>
Signed-off-by: Gary Grebus <ggrebus@virtualiron.com>
2007-10-26 10:55:50 +01:00
Keir Fraser d73a484a61 x86: Fix 32-bit build, and remove pragma usage in public headers (and
use of volatile too).
Signed-off-by: Keir Fraser <keir@xensource.com>
2007-10-26 10:55:32 +01:00
Keir Fraser a0e7ccf686 x86, hvm: Allow Cirrus VGA BIOS to clear framebuffer with minimal PIO writes.
Signed-off-by: Ben Guthro <bguthro@virtualron.com>
Signed-off-by: Gary Grebus <ggrebus@virtualiron.com>
2007-10-26 10:41:07 +01:00
Keir Fraser 1ad6a137c3 x86, hvm, vt-d: Kill timer in iommu domain destroy
Signed-off-by: Weidong Han <weidong.han@intel.com>
2007-10-26 10:33:12 +01:00
Keir Fraser 3ed09ac11b x86, hvm: Improve standard VGA performance
This patch improves the performance of Standard VGA,
the mode used during Windows boot and by the Linux
splash screen.

It does so by buffering all the stdvga programmed output ops
and memory mapped ops (both reads and writes) that are sent to QEMU.

We maintain locally essential VGA state so we can respond
immediately to input and read ops without waiting for
QEMU.  We snoop output and write ops to keep our state
up-to-date.

PIO input ops are satisfied from cached state without
bothering QEMU.

PIO output and mmio ops are passed through to QEMU, including
mmio read ops.  This is necessary because mmio reads
can have side effects.

I have changed the format of the buffered_iopage.
It used to contain 80 elements of type ioreq_t (48 bytes each).
Now it contains 672 elements of type buf_ioreq_t (6 bytes each).
Being able to pipeline 8 times as many ops improves
VGA performance by a factor of 8.

I changed hvm_buffered_io_intercept to use the same
registration and callback mechanism as hvm_portio_intercept
rather than the hacky hardcoding it used before.

In platform.c, I fixed send_timeoffset_req() to sets its
ioreq size to 8 (rather than 4), and its count to 1 (which
was missing).

Signed-off-by: Ben Guthro <bguthro@virtualron.com>
Signed-off-by: Robert Phillips <rphillips@virtualiron.com>
2007-10-26 10:32:20 +01:00
Keir Fraser af287919fd x86: Fix MTRR/PAT virtualisation on PAE
Various 'long's should be 'u64's.

Signed-off-by: Disheng Su <disheng.su@intel.com>
2007-10-26 10:00:10 +01:00
Keir Fraser e451db15ef hvm: Clean up firmware compilation warnings.
Signed-off-by: Atsushi SAKAI <sakaia@jp.fujitsu.com>
2007-10-26 09:58:43 +01:00
Keir Fraser 617d4311ef hvm, x86: Allow virtual timer mode to be specified.
In HVM config file:
timer_mode=0 # Default: virtual time is delayed when timer ticks are
             # missed dur to preemption
timer_mode=1 # Virtual time always equals wall time, even while missed
             # ticks are pending

From: Haitao Shan <haitao.shan@intel.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
2007-10-26 09:56:54 +01:00
Keir Fraser 5afede5ce6 xentrace: Fix race in updating consumer ring index.
From: George Dunlap <gdunlap@xensource.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
2007-10-25 17:27:57 +01:00
Keir Fraser 223f057f70 ia64, qemu-dm: Trivial build fix.
Signed-off-by: Alex Williamson <alex.williamson@hp.com>
2007-10-25 16:52:05 +01:00
Keir Fraser bb59a254af pv-on-hvm: fixes for unmodified drivers build and modern Linux
- The adjustments to README and overrides.mk are generic.
- The removal of explicit linux/config.h inclusion should also not
  cause any issues.
- The introduction of irq_handler_t should eliminiate warnings on
  2.6.19+ kernels (I didn't check they're there, but since the
  request_irq prototype changed, I'm sure there's at least
  one. However, as a result changes to the Linux tree are expected to
  be required.
- The change setup_xen_features -> xen_setup_features follows the
  naming in mainline 2.6.23 but would apparently also require changes
  to the Linux tree.
- The changes SA_* -> IRQF_ and  pci_module_init ->
  pci_register_driver should also not cause issues.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2007-10-25 15:54:19 +01:00
Keir Fraser 80273cb18f qemu: Add extra tracing around logdirty bitmap setup.
Signed-off-by: Ben Guthro <bguthro@virtualron.com>
Signed-off-by: Gary Grebus <ggrebus@virtualiron.com>
2007-10-25 15:04:33 +01:00
Keir Fraser 0f69f64f5c hvm: In xenstore_process_logdirty_event(), if a stale shared memory
key is encountered reset 'seg' to NULL so the shared memory
initialization can be retried later.

Signed-off-by: Ben Guthro <bguthro@virtualron.com>
Signed-off-by: Robert Phillips <rphillips@virtualiron.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
2007-10-25 15:01:59 +01:00
Keir Fraser d3d5422041 hvm: Improve and limit the messages for unexpected mmio accesses to
the platform device.

Signed-off-by: Ben Guthro <bguthro@virtualron.com>
Signed-off-by: Gary Grebus <ggrebus@virtualiron.com>
2007-10-25 14:57:08 +01:00
Keir Fraser e069a5b473 hvm,x86: Add more vmxassist opcodes for Ubuntu 7.0.4 support
Signed-off-by: Ben Guthro <bguthro@virtualron.com>
Signed-off-by: Gary Grebus <ggrebus@virtualiron.com>
2007-10-25 14:55:37 +01:00
Keir Fraser f8e2c1f126 pv-qemu 10/10: Make xenconsoled ignore doms with qemu-dm
This patch writes a field /local/vm/DOMID/console/type taking the
value 'ioemu' or 'xenconsoled'. If xenconsoled sees a type that is
not its own, then it skips handling of that guest. The qemu-dm
process doesn't need to read this field since it will only attach
to the console if given the -serial pty arg which XenD already
ensures matches this xenstore field.

The overall behaviour is that if a paravirt guest has a qemu-dm
process running then that handles the console, otherwise the
xenconsoled handles it. The former is more functional, with the
exception of not currently supporting persistent logging to a
file at the same time as exposing a PTY.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2007-10-25 14:45:47 +01:00
Keir Fraser f8ffd3b21f pv-qemu 9/10: XenD device model re-factoring
This patches adapts XenD so that it is capable of starting a qemu-dm
device model for both paravirt and fullyvirt guests. A paravirt guest
will only be given a device model if it has a VFB configured, or the
user explicitly include the device_model option in the config
config. This avoids unnecessary overhead for those wanting a minimal
paravirt guest.

The bulk of this patch involves moving code from the HVMImageHandler
into the base ImageHandler class. The HVMImageHandler and
LinuxImageHandler subclasses now merely containing a couple of
overrides to set some specific command line flags. The most important
is -M xenpv, vs -M xenfv.

The XenConfig class has a minor refactoring to add a has_rfb() method
to avoid duplicating code in a couple of places. Instead of hardcoding
DEFAULT_DM it now uses the xen.util.auxbin APIs to locate it - this
works on platforms where qemu-dm is in /usr/lib64 instead of
/usr/lib. As before paravirt only gets a default qemu-dm if using a
VFB.

The vfbif.py class is trimmed out since it no longer needs to spawn a
daemon. A few other misc fixes deal with qemu-dm interactions when
saving/restoring, and in particular recovering from save failures (or
checkpointing).

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2007-10-25 14:45:07 +01:00
Keir Fraser 36a48e9d87 pv-qemu 8/10: Add pv console to QEMU paravirt machine
This patch adds a paravirt console driver to qemu-dm. This is used
when the QEMU machine type is 'xenpv', connecting to the ring buffer
provided by the guest kernel. The '-serial' command line flag controls
how the guest console is exposed.

For parity with xenconsoled the '-serial pty' arg can be used. For
guests which are running a qemu-dm device model, the xenconsoled
daemon is no longer needed for guest consoles. The code for the
xen_console.c is based on the original code in
tools/console/daemon/io.c, but simplified; since its only dealing with
a single guest there's no state tracking to worry about.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2007-10-25 14:42:40 +01:00
Keir Fraser 0830ea747f pv-qemu 7/10: Async negotiation with xenfb frontend
This patch re-factors the paravirt console xenfb_attach_dom
method. The original method blocks the caller until the front &
backends have both switched to the connected state. This isn't an
immediate problem, but patches which follow will extend qemu to also
handle the text console so blocking on graphics console startup will
block the text console processing.

The new code is basically a state machine. It starts off with a watch
waiting for the KBD backend to switch to 'initialized' mode, then does
the same for the FB backend. Now it waits for KBD & FB frontend
devices to initialize, reading & mapping the framebuffer & its config
at the appropriate step. When the KBD frontend finally reaches the
connected state it registers a graphical console with QEMU and sets up
the various framebuffer, mouse & keyboard event handlers. If a client
connects to the VNC server before this is completed, then they will
merely see a text console (or perhaps the monitor if configured that
way).

The main difference from previous versions of this patch, is that at
the suggestion of Markus Armbruster, I'vere-ordered the individual
static functions so they are in order-of-call, rather than
reversed. Although I now have to pre-declare them, it is much easier
to read the code. I have also fixed the keycode -> keysym translations
to match previous behaviour.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2007-10-25 14:41:35 +01:00
Keir Fraser d9d3893da9 pv-qemu 6/10: Merge private & public xenfb structs
This patch merges the public & private structs from the paravirt FB
into a single struct. Since QEMU is the only consumer of this code
there is no need  for the artifical pub/priv split. Merging the two
will make it possible to more tightly integrate with QEMU's event
loop and do asynchronous non-blocking negoiation with the frontend
devices (see next patch).

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2007-10-25 14:40:19 +01:00
Keir Fraser 10aca7bae9 pv-qemu 5/10: Refactor QEMU console integration
This patch moves a bunch of code out of the xen_machine_pv.c file and
into the xenfb.c file. This is simply a re-factoring to facilitate the
two patches which follow.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2007-10-25 14:39:33 +01:00
Keir Fraser 59e7941a6c pv-qemu 4/10: Refactor xenfb event handlers
This patch is a simple code re-factoring to move the event loop
integration directly into the xenfb.c file. It is to facilitate
the patches which follow.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2007-10-25 14:38:47 +01:00
Keir Fraser 8731b7b939 pv-qemu: Remove standalone xenfb code
This patch removes all trace of the standalone paravirt framebuffer
daemon. With this there is no longer any requirement for
LibVNCServer. Everything is handled by the QEMU device model. The
xenfb.c and xenfb.h files are now moved (without code change) into
tools/ioemu/hw/ & the temporary Makefile hack from the previous patch
is removed.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2007-10-25 14:37:23 +01:00
Keir Fraser 3bc128ebcf pv-qemu 2/10: Add a QEMU machine type for paravirt guests
This patch adds a paravirt machine type to QEMU. This can be requested
by passing the arg '-M xenpv' to qemu-dm. Aside from -d, and
-domain-name, the only other args that are processed are the VNC / SDL
graphics related args. Any others will be ignored. A tweak to
helper2.c was made to stop it setting up a file handler watch when
there are no CPUs registered.

The paravirt machine is in hw/xen_machine_pv.c and registers an
instance of the xenfb class, integrating it with the QEMU event loop
and key/mouse handlers. A couple of methods were adding to xenfb.h to
allow direct access to the file handles for xenstore & the event
channel.

The vfbif.py device controller is modified to launch qemu-dm instead
of the old xen-vncfb / sdlfb daemons.

When receiving framebuffer updates from the guest, the update has to
be copied into QEMU's copy of the framebuffer. This is because QEMU
stores the framebuffer in the format that is native to the SDL
display, or VNC client. This is not neccessarily the same as the guest
framebuffer which is always 32bpp. If there is an exact depth match we
use memcpy for speed, but in the non-matching case we have to fallback
to slow code to convert pixel formats. It fully supports all features
of the paravirt framebuffer including the choice between absolute &
relative pointers. The overall VIRT memory image size is about same as
old xen-vncfb, but the resident memory size is a little increased due
to copy of the framebuffer & some QEMU static state overhead. Most of
this is shared across QEMU processes.

To avoid both moving the xenfb.c and making changes to it in the same
patch, this just uses a Makefile hack to link against the xenfb.o from
the tools/xenfb/ directory. This will be removed in the following
patch.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2007-10-25 14:35:04 +01:00
Keir Fraser 5bfefa417d pv-qemu 1/10: Add a QEMU machine type for fullvirt guests
This patch does a (no functional change) re-arrangement of the code
for starting up a fully virtualized guest. In particular it creates a
new QEMU machine type for Xen fullyvirt guests which can be specified
with '-M xenfv'. For compatibility this is in fact made to be the
default. The code for setting up memory maps is moved out of vl.c, and
into hw/xen_machine_fv.c. This is basically to ensure that it can be
easily skipped when we add a paravirt machine type in the next patch.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2007-10-25 14:33:01 +01:00
Keir Fraser 3d98e9d1ce x86: Save/restore new syscall/sysenter context info.
Signed-off-by: Keir Fraser <keir@xensource.com>
2007-10-25 14:24:52 +01:00
Tim Deegan 86c13a4d4d [XEN] Remove dead code.
No vcpu ever runs with guest_table == phys_table any more.
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
2007-10-25 12:39:22 +01:00
Keir Fraser 87bdb45d76 xen: Fix new domctl/sysctl structs to be 32-/64-bit invariant.
Signed-off-by: Keir Fraser <keir@xensource.com>
2007-10-25 11:38:04 +01:00
Keir Fraser 12c3839b0d xend: fix hvm domain restore failure when using vncdisplay option.
Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
2007-10-25 09:44:11 +01:00