Keir Fraser [Wed, 26 Mar 2008 15:50:45 +0000 (15:50 +0000)]
x86_emulate: HVM emulation of REP instructions should inject #PF only
if virt-to-phys lookup fails for the first repetition. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Wed, 26 Mar 2008 14:44:21 +0000 (14:44 +0000)]
ioemu: Fix L1 table endianess of qcow images created by tapdisk
The qemu/ioemu implementation of the qcow format uses a big endian L1
table. tapdisk omits the necessary conversion, so qcow images have the
wrong endianess and cannot be read by correct implementations of qcow.
This patch detects broken tapdisk images and converts their L1 tables
to big endian when the image file is opened in ioemu for the first
time. The fixed image has a new flag EXTHDR_L1_BIG_ENDIAN set in the
extended header.
Note that a converted image cannot be opened by tapdisk again.
Keir Fraser [Wed, 26 Mar 2008 13:21:42 +0000 (13:21 +0000)]
xenstored: Delay forking until after listening sockets are
opened. Also, in startup xend script, delay further startup until
xenstored initial child process has exited. This serialises xenstored
startup with that of other daemons (e.g., xenconsoled).
Keir Fraser [Wed, 26 Mar 2008 13:15:00 +0000 (13:15 +0000)]
minios: blkfront_aio_poll may reenter
if the callback calls blkfront_sync for instance.
In such a case, we would see responses and hence release grants
several times. We need to be more synchronous and stop when we detect
that we have re-entered.
This fixes HVM restore with stubdomains.
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Keir Fraser [Wed, 26 Mar 2008 13:13:50 +0000 (13:13 +0000)]
minios: more assertions
- assert that we never allocate or free the same grant twice
- assert that network packets do not exceed a page
- assert that incoming network event IDs make sense
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Keir Fraser [Wed, 26 Mar 2008 09:09:16 +0000 (09:09 +0000)]
xenfb: Dynamic modes support.
Attached patch adds dynamic frame buffer size support to the xenfb PV
backend QEMU xenfb. Backend sets feature-resize and handles the
resize frame buffer event.
Corresponding frontend LINUX patch is required for functionality but
this patch is not dependent on it, preserving backwards
compatibility.
Keir Fraser [Tue, 25 Mar 2008 10:57:50 +0000 (10:57 +0000)]
hvm acpi: Restrict to 15 Processor objects.
Some versions of Windows 2000 only support no more than 15 cpus in
ACPI table, otherwise it will cause a BSOD
KMODE_EXCEPTION_NOT_HANDLED. This patch decrease the cpu count in the
ACPI DSDT to 15.
Signed-off-by: Xu Dongxiao <dongxiao.xu@intel.com>
At the same time, fix the ACPI processor IDs in the Processor objects.
Keir Fraser [Tue, 25 Mar 2008 10:24:26 +0000 (10:24 +0000)]
ioemu: fix VNC case when switching from 32bpp to 24bpp
Even if we don't need to tell the client to redepth, we need to tell
e.g. xenfb that we can't share the buffer any more.
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Keir Fraser [Wed, 19 Mar 2008 14:12:12 +0000 (14:12 +0000)]
tapaio build fix
With some combinations of compiler flags (no optimization, -Werror),
the compiler may complain that the function doesn't have a return
statement (even if the function actually just never returns), reported
as bug 1128. This adds a dummy return statement.
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Keir Fraser [Wed, 19 Mar 2008 14:06:18 +0000 (14:06 +0000)]
x86_emulate: Return X86EMUL_UNHANDLEABLE if mode_iopl() or
mode_ring0() checks cannot be carried out.
Also fix handling of EFLAGS.IF in iret and popf. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Wed, 19 Mar 2008 10:33:13 +0000 (10:33 +0000)]
x86 ACPI sleep: Fix a bug when ACPI registers in System_Memory
Some ACPI registers may be in System_Memory but not System_IO space,
For these machines S3 fails since current Xen use I/O instructions (e.g.
inb(), outb(), etc.) to access ACPI registers. The patch attached fix
the bug by adding GAS (generic address structure) support ported from
Linux, which should also benefit later ACPI activity within Xen.
Keir Fraser [Wed, 19 Mar 2008 10:22:49 +0000 (10:22 +0000)]
Intel VTD: Ignore USB RMRR for HVM guest
USB controller RMRR (0xed000 - 0xeffff) conflicts with HVM guest bios
region. Setting identity mapping for it will cover the guest bios
region in p2m table. This causes system crash.
As VT-d spec says, USB controller RMRR is used in case of DMA
performed by a USB controller under BIOS SMM control for legacy
keyboard emulation. Whereas, current guest BIOS doesn't support
emulating stardand Keyboard/mouse, and it also doesn't support SMM
mode. Actually it is no chance to use USB controller RMRR now.
This patch ignores the USB controller RMRR for HVM guest.
Signed-off-by: Weidong Han <weidong.han@intel.com>
Keir Fraser [Wed, 19 Mar 2008 10:18:36 +0000 (10:18 +0000)]
Fix methods in SrvDomain class for inactive managed domains
This patch fixes methods in SrvDomain class for inactive managed
domains. They should use a domain name because inactive managed
domains don't have a domID.
Keir Fraser [Wed, 19 Mar 2008 10:15:01 +0000 (10:15 +0000)]
x86: Avoid dereference of 'struct page_info' for invalid MFNs.
Introduced by my changes to Samuel's transitive-privilege patch. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Tue, 18 Mar 2008 16:15:24 +0000 (16:15 +0000)]
x86: stub domains and page ownership for mapping in dom0
In the case of an ioemu stubdomain with SDL or vnc server running in
dom0, we want to have the stubdomain expose the HVM guest's video RAM
through PVFB.
However, to map the pages from dom0, xenfb uses xc_map_foreign_pages
with the stubdomain ID as domid (since that is what is advertised in
the PVFB protocol, and needed for other parts of the protocol), and
thus get_page_from_l1e() complains because the stubdomain is not the
owner of the pages. In such case, this patch checks that the
stubdomain has privileges on the actual owner of the pages, and then
accept the mapping.
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Keir Fraser [Tue, 18 Mar 2008 16:05:24 +0000 (16:05 +0000)]
x86: fix feature availability for PV guests
PV guests should not be allowed to believe features not currently
virtualized (in many cases, requiring special MSRs) are available. Of
course it is bad enough that to work on older hypervisors guests will
still need to special case this, but better fix it now than never.
Keir Fraser [Tue, 18 Mar 2008 15:26:35 +0000 (15:26 +0000)]
svm: Reported SS.DPL must equal CPL, as this is assumed by generic HVM
code despite the fact that AMD processors do not always maintain this
invariant.
Based on a bug report and proposed patch by Ben Guthro and Robert
Phillips of Virtual Iron.
Keir Fraser [Tue, 18 Mar 2008 15:23:25 +0000 (15:23 +0000)]
domain_shutdown() needs to vcpu_pause_nosync() rather than directly
incrementing the pause_count field. The latter ensures that the VCPU
gets descheduled --- synchronously in the case of the
currently-running VCPU.
Based on a bug report and proposed patch by Ben Guthro and Robert
Phillips of Virtual Iron.
Keir Fraser [Tue, 18 Mar 2008 15:00:33 +0000 (15:00 +0000)]
libxc: Variable-size gntdev support
This patch adds the ability to set the number of slots that may be
used for mapping grant references, using the gntdev user-space grant
reference mapping driver.
Keir Fraser [Tue, 18 Mar 2008 13:14:26 +0000 (13:14 +0000)]
Xend forgets to write the domain's VDI UUID into the domain state file
once the domain is started (before it's there). Once xend is restarted
it will not know the association between the VBD and VDI anymore due
to the missing UUID. This patch fixes this.
Keir Fraser [Tue, 18 Mar 2008 13:10:57 +0000 (13:10 +0000)]
vmx: fix debugctl handling
I recently realized that the original way of dealing with the DebugCtl
MSR on VMX failed to make use of the dedicated guest VMCS field. This
is fixed by this patch.
Keir Fraser [Tue, 18 Mar 2008 11:47:58 +0000 (11:47 +0000)]
ioemu: SDL rendering using OpenGL
Add opengl support for rendering the guest framebuffer in the SDL
window. SDL is needed anyway to open the window and handle the
events. Opengl rendering is optional and can be turned off at both
compile time and in the vm configuration file.
Some of the benefits of using opengl are:
- faster rendering, less CPU intensive, especially with good graphic
cards;
- makes the window resizing possible and hardware accelerated, thus
very efficient and smooth;
- allows other optimizations like sharing directly a buffer in vram
with the guest (not yet implemented).
Keir Fraser [Tue, 18 Mar 2008 11:34:44 +0000 (11:34 +0000)]
Fix domain suspend by xend stop
When I stopped xend by xend stop command, a domain suspend processing
is frequently failed. This patch solves the problem.
Step to reproduce:
1. xm new XXX on_xend_stop="suspend"
2. xm start XXX
3. xend stop
In the xend stop, if the domain suspend processing is slept by
state_updated.wait() of waitForShutdown(), then the domain suspend
processing is not waked up again because state_updated.notifyAll()
of _stateSet() is not executed.
For the reason, processing of _on_domains_changed() is waited by
domains_lock.acquire() because the domain suspend processing is
keeping domains_lock and sleeping. The domain suspend processing
got domains_lock at cleanup_domains().
Keir Fraser [Tue, 18 Mar 2008 11:31:39 +0000 (11:31 +0000)]
Allow libvirt to specify force, rm_cfg
When doing a 'virsh detach-disk' on a running domain, the disk is not
removed from the configuration file. Allow a caller to specify
whether or not to change the file.
Keir Fraser [Tue, 18 Mar 2008 11:29:18 +0000 (11:29 +0000)]
minios: Fix lost events
evtchn_bind_interdomain used to clear any already pending event before
binding a handler, because else the handler may be called before it is
ready. That however leads to missed events, which I had to workaround
for the HVM case.
This changes the semantics of bind_evtchn, and thus of all the
event channel binding functions (bind_virq, evtchn_alloc_unbound,
evtchn_bind_interdomain) into not unmasking the event itself, hence
letting the caller initialize properly before unmasking the port (e.g.
record the port number in an appropriate place).
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Keir Fraser [Tue, 18 Mar 2008 11:27:36 +0000 (11:27 +0000)]
stubdom: support save/restore by passing the -loadvm parameter,
letting the stubdomain access the save area, and having it watch the
correct xenstore node.
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Keir Fraser [Tue, 18 Mar 2008 11:07:00 +0000 (11:07 +0000)]
Convert XenAPI platform values to appropriate types.
XenAPI defines the platform attribute of a VM as a string-string map
but in various code paths in xend the platform entries are expected to be
another type, e.g. int. This patch defines the types of each platform
entry and converts the entry values to appropriate type when new domU
configuration is created via XenAPI.
Alternatively the values could be casted to appropriate type when used
but seems prudent to do the conversion when domU configuration is
created.
Keir Fraser [Tue, 18 Mar 2008 11:06:26 +0000 (11:06 +0000)]
Set device model when creating rfb console via XenAPI
When creating a rfb console via XenAPI the device model is not being
set to qemu-dm, resulting in no pvfb since qemu-dm is not launched
when domU is started. This patch sets device model when a rfb console
is created via XenAPI.
Keir Fraser [Tue, 18 Mar 2008 11:05:53 +0000 (11:05 +0000)]
Initialization of new domU config options via XenAPI
Many of the new domU config options related to hvm guests (e.g. hpet,
rtc_timeoffset, etc.) are not initialized with default values via
XenAPI, which prevents starting an hvm domU created through XenAPI.
This patch ensures the new options are set with appropriate default
values in XendConfig platform sanity check.
Keir Fraser [Tue, 18 Mar 2008 11:02:00 +0000 (11:02 +0000)]
Each TAP/TUN device name for a HVM guest includes its domain ID.
The TAP/TUN devices are used for connection to a HVM domain, but there
is no relationship between each name of the devices and its domain
ID. This patch assigns a HVM domain ID to each TAP/TUN device name.
Keir Fraser [Tue, 18 Mar 2008 10:58:47 +0000 (10:58 +0000)]
Use ioemu block drivers through blktap.
Add support for a tap:ioemu pseudo driver. Devices using this driver
won't use tapdisk (containing the code duplication) any more, but will
connect to the qemu-dm of the domain. In this way no working
configuration should be broken right now as you can still choose to
use the tapdisk drivers.
Keir Fraser [Tue, 18 Mar 2008 10:51:20 +0000 (10:51 +0000)]
x86: Clean ups and fixes after bitops changes.
Firstly, the vlapic bitops need fewer casts.
Secondly, the minimum-alignment check is unnecessary and also breaks
the build (page_info's type_info field has alignment == 1). It is an
unnecessary check because bitops operate on only one bit of the word
they access, so lack of atomicity of the read and writeback does not
matter -- furthermore the LOCKed variants are guaranteed atomic
regardless of alignment.