Keir Fraser [Fri, 1 Aug 2008 09:05:36 +0000 (10:05 +0100)]
passthrough: fix corrupting register value in pt_pci_write_config().
I forgot to shift value read from real device. If the emulated register offset
is not aligned with 4 byte, the write emulation will not be handled well
because of corrupting register value read from real device.
The patch fixes this issue.
Keir Fraser [Fri, 1 Aug 2008 09:04:39 +0000 (10:04 +0100)]
passthru: fix libpci error handling.
libpci returns ALL F when error occurs. Currently, if libpci returns ALL
F, emulation stops. But it is possible that the field of real register
which is read by guest software is ALL F.
After applying this patch, if libpci returns ALL F, ioemu will log
warning message and continue the emulation.
Keir Fraser [Fri, 1 Aug 2008 09:01:05 +0000 (10:01 +0100)]
passthrough: fix writing handlers for base address registers.
- Current implementation can not work fine when base address registers
are accessed via 1 byte write access and 2 byte write access. This
patch enables them.
- Currently guest software can set address which is not aligned
with resource size and page size. The patch does not allow guest
software to set unaligned address.
Ian Jackson [Wed, 30 Jul 2008 15:46:30 +0000 (16:46 +0100)]
fix SDL mouse events processing
This fixes SDL mouse events processing:
- GetRelativeMouseState() always returns the last position, so when the
polling loop gets several mouse events in one go, we would send
useless 'no move' events, let's avoid that.
- So as to make sure we don't miss any mouse click / double click, we
should not use GetRelativeMouseState() to get the button state, but
rather keep records of the button state ourselves (I've requested SDL
developers to provide it directly in the event in SDL 1.3).
- bev->state doesn't contain the button state but whether the event is a press
or a release. Use bev->button instead.
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Ian Jackson [Wed, 30 Jul 2008 11:06:29 +0000 (12:06 +0100)]
Use fd signal trick to break us out of select; do not sigwait
* The sigwait approach to detecting aio does not work because some
versions of glibc forget to block signals on the private aio thread.
This means that blocking SIGUSR2 is ineffective; the signals can be
lost and the program can block in sigwait (!)
* Use of SIGUSR2 to interrupt select() does not work because signals
which arrive just before entry to select() do not interrupt it.
So instead we use the time-honoured self-pipe trick: in the signal
handler we write to a pipe, which we select on when we want to wait
for the signal, and which we read from (to empty out) just before
actually doing the `top half' processing which deals with the condition
to which the signal relates.
Following discussion on xen-devel and elsewhere, we have concluded
that the real problem here was that the S3 resume flag was in the ROM
memory region rather than the EBDA. This has been fixed in
xen-unstable 18120.
We can therefore keep the whole of the ROM/BIOS area readonly.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Tue, 22 Jul 2008 15:28:06 +0000 (16:28 +0100)]
Nicer fix for spurious messages from configure when GCC3 is missing.
This reverts b5123e05cce4be4c6c8c822fad0f0df4c053da06 and replaces it
with a nice simple change, namely to change test ... -a ... with
test ... && test ... . That provides shortcut evaluation.
Thanks to Andre Przywara who provided this one-line change as an
update to the previous commit.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Tue, 22 Jul 2008 15:23:47 +0000 (16:23 +0100)]
Pass --disable-gfx-check to allow VNC-only builds.
Qemu upstream inexplicably falls over during configuration if you will
be forced to use VNC for graphics, as if that were somehow an
unreasonable thing to do. So hit that check on the head.
Thanks to Christoph Egger for the report.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Tue, 22 Jul 2008 14:49:52 +0000 (15:49 +0100)]
Fix HVM direct kernel booting.
This was broken during the merge with qemu upstream.
Fixes:
* Properly update kernel loading address so that qemu actually
loads the kernel where we want it.
* Use 0x200000 not 0x20000 as the updated kernel loading address.
* Use stl_phys(real_addr+0x214,) rather than stl_p(header+0x214,),
as the header has already been copied into target memory so we
need to update it there.
Ian Jackson [Tue, 22 Jul 2008 10:52:24 +0000 (11:52 +0100)]
pci passthrough changes ported across from xen-unstable by Yuji Shimada
The patch contains following patches which have been applied to Xen
Unstable Changeset 17959-18076.
pci_config_passthrough_with_msi_msix.patch
[Xen-devel] [PATCH] Support more Capability Structures (including
MSI/MSI-X) and Device Specific Registers for pt device.
Yuji Shimada <shimada-yxb@necst.nec.co.jp>
Fri, 04 Jul 2008 15:26:52 +0900
fix_pt_iomap.patch
Re: [Xen-devel] [PATCH] Support more Capability Structures
(including MSI/MSI-X) and Device Specific Registers for pt device.
NISHIGUCHI Naoki <nisiguti@jp.fujitsu.com>
Tue, 08 Jul 2008 14:14:55 +0900
Ian Jackson [Fri, 18 Jul 2008 13:28:52 +0000 (14:28 +0100)]
Do not disturb old fd flags (eg O_APPEND) when setting nonblock.
socket_set_nonblock should not unconditionally call
fcntl(,F_SETFL,O_NONBLOCK) because that would clear other flags which
might be intentionally set on the fd.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Fri, 18 Jul 2008 13:24:17 +0000 (14:24 +0100)]
Always use nonblocking mode for qemu_chr_open_fd.
The rest of qemu assumes that IO operations on a CharDriverState do
not block. Currently there are a couple of cases where such a driver
was set up but the calls to set nonblocking mode were missing:
* qemu_chr_open_pty
* qemu_chr_open_pipe
* qemu_chr_open_stdio
This is fixed by adding two calls to socket_set_nonblock to
qemu_chr_open_fd.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Fri, 18 Jul 2008 13:33:07 +0000 (14:33 +0100)]
ide: enable single word DMA
Windows XP doesn't enable DMA by default on dvd-rom devices emulated by QEMU.
Furthermore if I try to manually enable DMA using Device Manager, the
DMA mode chosen by Windows is inexplicably one of the few modes
unsupported by QEMU: single word mode 2.
Since on virtual hardware single word DMA is not really slower than
multi word DMA, it makes sense for QEMU to support single word dma as
well.
This patch does exactly this. We also make sure that mdma is
deactivated when sdma is active and vice versa.
This has various compatibility problems, including breaking
restoration of old images. It is also likely that we will want to
increase this amount in the future.
Ian Jackson [Wed, 9 Jul 2008 11:32:09 +0000 (12:32 +0100)]
Store pty name in xenstore for the benefit of the tools.
This is a rather intrusive patch, because we need a mechanism to get
the ptsname out of the guts of the qemu startup code. This is a
first cut of such a thing which might eventually go upstream.
The main new interface is chr_getname, a new CharDriverState method.
If implemented it returns "<type> <name>" where currently "<type>" is
"pty" for ptys. If not implemented the function pointer may be null.
We import store_dev_info from xen-unstable (17987:9b35ae586cb8) and
eviscerate it appropriately.
Ian Jackson [Wed, 9 Jul 2008 10:38:33 +0000 (11:38 +0100)]
Do not rebuild every time ./xen-setup is run.
This involves saving config-host.h while we rerun config and
regenerate it, putting the saved version back, and then installing
the new version only if it has changed.
Ian Jackson [Tue, 8 Jul 2008 09:29:37 +0000 (10:29 +0100)]
fix disk format security vulnerability; do not guess format for qcow vbds
These are the accidentally dropped hunks of xen-unstable 17606 and 17646.
Particularly, 17606 is important:
* make the xenstore reader in qemu-dm's startup determine which
of qemu's block drivers to use according to the xenstore
backend `type' field. This `type' field typically comes from
the front of the drive mapping string in ioemu. The
supported cases are:
xm config file string `type' image format qemu driver
phy:[/dev/]<device> phy raw image bdrv_raw
file:<filename> file raw image bdrv_raw
tap:aio:<filename> tap raw image bdrv_raw
tap:qcow:<image> tap not raw autoprobe
tap:<cow-fmt>:<image> tap named format bdrv_<cow-fmt>
It is still necessary to autoprobe when the image is specified as
`tap:qcow:<image>', because qemu distinguishes `qcow' and `qcow2'
whereas blktap doesn't; `qcow' in xenstore typically means what
qemu calls qcow2. This is OK because qemu can safely distinguish
the different cow formats provided we know it's not a raw image.
Ian Jackson [Mon, 7 Jul 2008 14:30:10 +0000 (15:30 +0100)]
Fix remaining missing changes to update to xen-unstable 17958.
We had accidentally dropped some changes from 17737 to 17831.
Fixed by in xen-unstable:
hg update 17737
patch -p1 < vga-patch-from-xen-unstable-17737:c93a913c221f
hg diff -r 17831 tools/ioemu >patch
and then in qemu.git:
patch -R -U -p3 <.../patch
and fix up conflicts, which were:
Makefile.target - stubdom changes, defer for now
hw/vga.c - one easy fixup, one change already in our tree
hw/xenfb.c - already done completely earlier, so discard changes
Ian Jackson [Fri, 4 Jul 2008 15:35:26 +0000 (16:35 +0100)]
Merge with xen-unstable tip 17958
This was achieved with
hg diff -r{17831,17958} tools/ioemu
and feeding the result to patch and fixing up conflicts.
As an exception, xenfb.c was done the other way around:
* hg update 17737, apply vga-patch-from-xen-unstable-17737\:c93a913c221f
* diff that against git 79a235b20a6833fe5bdc78b52921cdd2ad12f284
(current qemu-xen tip)
* cp hg 17958's xenfb.c into git, apply patch from above, fixing up
changes; one change dropped (removal of call to fbfront_resize
in xenfb_pv_resize_shared)
Ian Jackson [Wed, 2 Jul 2008 17:38:07 +0000 (18:38 +0100)]
qemu-xen: Fix extendable images
bdrv_file_open should specify raw image format instead of
guessing. This fixes a segfault when bdrv_open2 wants to access
drv->flags. bdrv_file_open is used at least by qcow2.
Additionally, move the extensible flag from bdrv_host_device to
bdrv_raw. qcow2 wants to open the image file as an extensible file.
Ian Jackson [Tue, 1 Jul 2008 17:45:10 +0000 (18:45 +0100)]
blktap: Automatically start tapdisk-ioemu on demand
When a domain wants to use a tap:ioemu disk but has no device model,
start a tapdisk-ioemu instance as provider. Also, move the creation
and removal of communication pipes to xend so that qemu-dm doesn't
need the unwanted SIGHUP handler anymore.
Ian Jackson [Thu, 19 Jun 2008 09:21:17 +0000 (10:21 +0100)]
Set VNC password from xenstore.
Upstream doesn't appear to have a way to set the password other than
from the monitor, so we introduce this which is a bit messy.
When upstream's new option/config parsing is merged, we should make a
patch for upstream with a config option to read the password out of a
file or fd, and use that.