Ian Jackson [Fri, 6 Nov 2009 18:11:50 +0000 (18:11 +0000)]
passthough: add no_wb option for pci conf write
Current pt_pci_write_config always writes back to real pci conf
space. However, in the case of MSI address and data registers,
if guest changes the affinity of the interrupt, stale data will
be written to these registers. This is particularly a problem
if Xen uses per-CPU vector, where the interrupt in question fails
to work. This patch fixes this by adding an option to disable the
write back of certain controls.
Ian Jackson [Fri, 6 Nov 2009 18:10:44 +0000 (18:10 +0000)]
Enlarge the size of the global mmio_space mmio[].
With the Multi-Function passthrough, we're actually able to assign more than
32 functions to guest, so we should enlarge the MAX_MMIO. 1024 should be big
enough.
Ian Jackson [Thu, 29 Oct 2009 13:00:31 +0000 (13:00 +0000)]
Extend max vcpu number for HVM guest
Reduce size of Xen-qemu shared ioreq structure to 32 bytes. This has two
advantages:
1. We can support up to 128 VCPUs with a single shared page
2. If/when we want to go beyond 128 VCPUs, a whole number of ioreq_t
structures will pack into a single shared page, so a multi-page array will
have no ioreq_t straddling a page boundary
Also, while modifying qemu, replace a 32-entry vcpu-indexed array with a
dynamically-allocated array.
Ian Jackson [Wed, 21 Oct 2009 15:42:15 +0000 (16:42 +0100)]
passthrough: fix security issue with stubdoms
this patch series fixes the outstanding security problem with stubdoms
and pci passthrough.
The idea is to allow mmio, irq and ioport remapping not only if the
current domain IS_PRIV_FOR but also if the current domain has
permissions over those mmio areas, irqs and ioports.
This way a stubdom can only remap resources that currently "owns".
This patch series also moves the de\assign_device hypercalls from the
list of hypercalls made by qemu\stubdom to xend.
The two patches must be applied at the same time otherwise pci
passthrough won't work for HVM guests.
[PATCH 2 of 2] qemu: do not call xc_assign_device
This patch removes the call to xc_assign_device from qemu.
Ian Jackson [Wed, 7 Oct 2009 14:57:18 +0000 (15:57 +0100)]
block: Clean up after deleting BHs
Commit 6a7ad299 ("Call qemu_bh_delete at bdrv_aio_bh_cb") deletes emulated
aio bottom halves to prevent endless accumulation. However, it leaves a
stale ->bh pointer, which is then waited on when the aio is reused.
Zeroing the pointer fixes the issue, allowing vmdk format images to be used.
Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
[ Backported from 6bbff9a0b495918309074ac60375be5f9dc868b3
by Stefano Stabellini. ]
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Wed, 7 Oct 2009 14:53:58 +0000 (15:53 +0100)]
Call qemu_bh_delete at bdrv_aio_bh_cb.
Also replave qemu_bh_cancel with qemu_bh_delete in bdrv_aio_cancel_em.
Otherwise the bh will live forever in the bh list.
Signed-off-by: Dor Laor <dor@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
[ Backported from 6bbff9a0b495918309074ac60375be5f9dc868b3
by Stefano Stabellini. ]
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Kevin Wolf [Fri, 8 May 2009 12:47:24 +0000 (14:47 +0200)]
Improve block range checks
This patch makes the range checks for block requests more strict: It fixes a
potential integer overflow and checks for negative offsets. Also, it adds the
check for compressed writes.
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit fbb7b4e0804d2168f24142eebf7552adde1968dc)
Ian Jackson [Wed, 7 Oct 2009 14:51:55 +0000 (15:51 +0100)]
check for bs->drv in bdrv_flush (Christoph Hellwig)
All the bdrv_ helpers should check for bs->drv being zero as that means
there is no backend image open. bdrv_flush fails to perform that check
and can thus cause NULL pointer dereferences.
Found using qemu-io.
Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6943 c046a42c-6fe2-441c-8c8c-71466251a162
Ian Jackson [Wed, 7 Oct 2009 14:49:32 +0000 (15:49 +0100)]
Fix DMA API when handling an immediate error from block layer (Avi Kivity)
The block layer may signal an immediate error on an asynchronous request
by returning NULL. The DMA API did not handle this correctly, returning
an AIO request which would never complete (and which would crash if
cancelled).
Fix by detecting the failure and propagating it.
Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6893 c046a42c-6fe2-441c-8c8c-71466251a162
If a bounced vectored aio fails immediately (the inner aio submission
returning NULL) then the bounce handler erronously returns an aio
request which will never be completed (and which crashes when cancelled).
Fix by detecting that the inner request has failed and propagating the
error.
Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6892 c046a42c-6fe2-441c-8c8c-71466251a162
(cherry picked from commit c240b9af599d20e06a58090366be682684bd8555)
aliguori [Fri, 20 Mar 2009 18:26:12 +0000 (18:26 +0000)]
Use vectored aiocb storage to store vector translation state (Avi Kivity)
Now that we have a dedicated acb pool for vector translation acbs, we can
store the vector translation state in the acbs instead of in an external
structure.
Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6873 c046a42c-6fe2-441c-8c8c-71466251a162
(cherry picked from commit 3fb94d56c6adc96ffc4a81b58c752cc4ccfae39c)
aliguori [Fri, 20 Mar 2009 18:26:07 +0000 (18:26 +0000)]
Implement cancellation method for dma async I/O (Avi Kivity)
Move the dma helpers to a private aio pool, and implement a cancellation
method for them. Should prevent issues when cancelling I/O while dma is
in progress.
Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6872 c046a42c-6fe2-441c-8c8c-71466251a162
(cherry picked from commit 6512a2a7106480c19183d6466a6845bc9bdf6ec0)
Ian Jackson [Wed, 7 Oct 2009 14:36:19 +0000 (15:36 +0100)]
Refactor aio callback allocation to use an aiocb pool (Avi Kivity)
Move the AIOCB allocation code to use a dedicate structure, AIOPool. AIOCB
specific information, such as the AIOCB size and cancellation routine, is
moved into the pool.
At present, there is exactly one pool per block format driver, maintaining
the status quo.
Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6870 c046a42c-6fe2-441c-8c8c-71466251a162
Ian Jackson [Wed, 23 Sep 2009 14:07:47 +0000 (15:07 +0100)]
allow logdirty commands while paused (unbreaks 60dbe1+8f09f4)
60dbe1+8f09f4 breaks HVM live migration: 60dbe1 causes xc_save to
attempt to disable logdirty mode while qemu is paused. 8f09f4 disables
most commands, including logdirty, while the domain is paused. So
xc_save times out waiting for qemu to respond to the logdirty disable
command, and live migration fails. Logdirty commands issued while
paused should not affect the stability of ioemu.
Ian Jackson [Fri, 18 Sep 2009 15:41:42 +0000 (16:41 +0100)]
passthrough: basic graphics passthrough support
basic gfx passthrough support:
- add a vga type for gfx passthrough
- retrieve VGA bios from host 0xC0000, then load it to guest 0xC0000
- register/unregister legacy VGA I/O ports and MMIOs for passthroughed gfx
Signed-off-by: Ben Lin <ben.y.lin@intel.com> Signed-off-by: Weidong Han <weidong.han@intel.com> Acked-by: Jean Guyader <jean.guyader@critix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Fri, 18 Sep 2009 15:32:58 +0000 (16:32 +0100)]
pxe: Don't look for PXE ROMs when running as a DM
Searching for PXE ROMs in attached NICs is unnecessary as the ROM
that is used is included in the hvmloader binary. In the case where
there are only pass-through NICs it will cause the boot to fail
as the NICs are not known to qemu-xen at the time that this check is made.
In other words, without this change PXE boot from a pass-through
device will fail.
This has likely been broken since I changed around the pass-through
code so that devices passed-through at boot-time are handled by hot-plug.
Ian Jackson [Fri, 18 Sep 2009 15:31:56 +0000 (16:31 +0100)]
fix a compilation error if not defined MAPCACHE (eg ia64)
60dbe1d43827cf9a57b619a8736da2319489d432 cannot be compiled on ia64:
exec-dm.c: In function 'cpu_physical_memory_map':
exec-dm.c:805: error: 'l' undeclared (first use in this function)
This patch fixes it.
Ian Jackson [Fri, 4 Sep 2009 15:25:35 +0000 (16:25 +0100)]
fix HVM log dirty issue
These patches fix some issues for HVM log dirty in qemu:
* Add necessary logging dirty in qemu to avoid guest error with
intensive disk access when live migration
* Take place of shared memory between qemu and migration tools by new
added hypercall, which is clean and simple
Signed-Off-By: Zhai, Edwin <edwin.zhai@intel.com>
Also revert commit 32710fbdc75e055f73a63d246737ce615b9109e9.
"[stubdom] fix the crash of HVM live migration with intensive disk access"
as this is the proper fix. -iwj
Ian Jackson [Fri, 4 Sep 2009 15:19:54 +0000 (16:19 +0100)]
Fix to eject cdrom on HVM Domain
We tried to eject cdrom(/dev/hdc) on HVM Domain.
But, cdrom media are not ejected from the cdrom device on HostOS.
The module to eject the cdrom device has already been implemented in
qemu-dm.
But, all devices are opened as raw device for VBD.
Therefore, the module to eject the cdrom device is not work.
The cdrom device was corrected to open as a physical device on HostOS.
When eject is executed on HVM Domain, cdrom media are ejected from the
cdrom device on HostOS.
This patch corrected the problem. Signed-off-by: Takanori Kasai <kasai.takanori@jp.fujitsu.com>
Ian Jackson [Fri, 4 Sep 2009 15:17:39 +0000 (16:17 +0100)]
ignore xenstore events while paused
when qemu is paused it shouldn't try to handle xenstore events,
especially because when xend removes nodes on xenstore some
spurious events could be generated causing qemu to exit unexpectedly.
Ian Jackson [Fri, 4 Sep 2009 15:15:27 +0000 (16:15 +0100)]
disable log-throttling in xen_platform after boot
currently log throttling in xen_platform can be disabled only if a
particular key is present on xenstore at boot time.
Obviously this requirement makes it difficult to use.
This patch fixes the issue creating a watch on xenstore on the node
/local/domain/$DOMID/log-throttling
so whenever a developer wants to disable log throttling, he just has to
write 0 to /local/domain/$DOMID/log-throttling at any moment after boot.
Ian Jackson [Fri, 4 Sep 2009 15:13:52 +0000 (16:13 +0100)]
remove check on ram_size
the initial check on the ram_size in qemu is completely unnecessary and
it is even broken on systems where dom0 is 32 bits while xen is 64 bits.
This patch solves the problem removing the check.
Ian Jackson [Fri, 4 Sep 2009 15:12:28 +0000 (16:12 +0100)]
fix qemu memory leak in block interface
the qemu block interface leaks memory every time a read or write request
is issued, this patch fixes it.
This is also the bug that is causing stubdomains to crash under high
disk IO.
Ian Jackson [Fri, 4 Sep 2009 15:10:46 +0000 (16:10 +0100)]
[stubdom] fix the crash of HVM live migration with intensive disk access
Intensive disk access, e.g. sum of big file, during HVM live migration would
cause guest error even file system crash. Guest dmesg said
"attempt to access beyond end of device
hda1: rw=0, want=10232032112, limit=10474317"
Current map cache used by qemu dma doesn't mark the page dirty, so that these
pages(probably holding DMA data struct) are not transferred in the last
iteration during live migration.
This patch fixes it, and also merges the qemu's original dirty bitmap used by
other devices such as vga.
add per domain low level xenstore functions [PATCH 2/3]
add per domain low level xenstore functions (read/chmod/write/watch).
broke the stubdom build because minios's fork/version of libxenstore
does not have the xenstore chmod operation. As xenstore_dom_chmod
is not currently used in stubdom, #if it out.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Tue, 4 Aug 2009 14:35:46 +0000 (15:35 +0100)]
fix vnc screen corruption bugs and viewer exits
I have been having problems with display corruption using raw
encoding.
I have also been having issues with the vncviewer client exiting with
"rect too big".
These problems appear when there are rapid changes to the framebuffer
contents. [I've been using "find /" in my tests to generate a lot of text
output.]
The root cause of both problems appears to be the changing of
the underlying framebuffer data during the creation of the update.
[Hextile makes multiple passes over the data and gets badly
confused if the data changes..]
The attached patch pulls the pixel data from the "stable" old_data
buffer rather than directly from the (changing) display surface.
Submitted-by: Andrew Thomas <andrew.thomas@oracle.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Tue, 4 Aug 2009 14:28:14 +0000 (15:28 +0100)]
passthrough: support the assignment of the VF of Intel 82599 10GbE Controller
The datasheet is available at
http://download.intel.com/design/network/datashts/82599_datasheet.pdf
See 'Table 9.7. VF PCIe Configuration Space' of the datasheet, the PCI
Express Capability Structure of the VF of Intel 82599 10GbE Controller looks
trivial, e.g., the PCI Express Capabilities Register is 0, so the Capability
Version is 0 and pt_pcie_size_init() would fail.
We should not try to expose the PCIe cap of the device to guest.
Ian Jackson [Tue, 4 Aug 2009 14:25:30 +0000 (15:25 +0100)]
passthrough: Use physical INTX for virtual PCI functions
Allow virtual functions to use the legacy interrupt pin of the
corresponding physical device. This is already half-implemented
by the code that uses pci_read_intx() in pass-through.c. This fills
in a missing piece.
An alternate solution is to reverse the previously applied pci_read_intx()
code and revert to always using INTA. However, that seems likely to lead to
excessive sharing of interrupt pins when multi-function pass-through is
used.
Tested-by: Tom Rotenberg <tom.rotenberg@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
Ian Jackson [Tue, 4 Aug 2009 14:23:43 +0000 (15:23 +0100)]
add two missing cirrus_update_memory_access
the cirrus emulation code misses two calls to
cirrus_update_memory_access; this fact together with the condition on the
call to cirrus_update_memory_access in cirrus_bitblt_reset can cause
segfaults in qemu.
Ian Jackson [Tue, 21 Jul 2009 15:08:24 +0000 (16:08 +0100)]
use XC_PAGE_SIZE in xenfbfront (fix stubdom build on NetBSD)
Apropos of a report from Christoph Egger about misuse of PAGE_SIZE in
xenfbfront; change references to XC_PAGE_SIZE which is correct in our
context. This fix suggested by Stefano Stabillini.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Tue, 21 Jul 2009 14:33:30 +0000 (15:33 +0100)]
passthrough: Fix pci bar remapping when guest probes width with all-1 BAR
When guest code tries to get the block size of mmio, it will write all "1"s
into pci bar register and then qemu will return all "0"s to the don't care
bits in the emulated bar register to indicate the block size to guest code.
In this case, we should not create p2m mapping in pt_bar_reg_write() and
pt_exp_rom_bar_reg_write(). Attached patch fixes this issue, additional
comment can be found in the patch.
Ian Jackson [Mon, 20 Jul 2009 11:26:39 +0000 (12:26 +0100)]
pass-through: pt_reset_interrupt_and_io_mapping(): use hw INTX
This fixes a few things that I missed in previous patches:
* Use the hw INTX rather than INTA in pt_reset_interrupt_and_io_mapping()
This is consistent with other uses of pci_intx()
* Remove now inaccurate "/* fix virtual interrupt pin to INTA# */" comments
* Use PCI_SLOT()
Ian Jackson [Thu, 9 Jul 2009 14:33:48 +0000 (15:33 +0100)]
portability fixes for qemu-ifup
Attached patch applies portability fixes to ioemu's qemu-ifup script:
- rename qemu-ifup to qemu-ifup-Linux
- add qemu-ifup-NetBSD for NetBSD
- Build system picks the right one and installs just that under the
conventional name.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Ian Jackson [Wed, 8 Jul 2009 14:52:31 +0000 (15:52 +0100)]
Always treat floppy images as raw
The fix for the image format guessing vulnerability breaks raw floppy
images. In our environment it is difficult to apply the same
configuration change as envisaged upstream, so instead we arrange to
always treat a floppy image as raw.
Two-line patch supplied by James Harper <james.harper@bendigoit.com.au> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
(cherry picked from commit f2ce5c35f60bb606bd3ddb55c361bb8a9aad5c5c)
[ Also originally committed as 342846c1eecc972fcfae84d9d1ae65a318101792
Mistakenly dropped from qemu-xen-unstable.git and now reapplied.
Thanks to report from James Harper. -iwj ]
Ian Jackson [Tue, 30 Jun 2009 14:22:14 +0000 (15:22 +0100)]
cpu_unregister_map_client: fix memory leak
fix memory leak in cpu_unregister_map_client() and cpu_notify_map_clients().
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
[ Picked out of qemu-devel submission for exec.c, because we have a
clone-and-hack of the cpu_*map* code :-( -iwj ]
Ian Jackson [Thu, 25 Jun 2009 17:33:09 +0000 (18:33 +0100)]
passthrough: multi-function PCI in ACPI: rename slot to devfn
This is a companion to the previous patch "qemu-xen: pass-through:
multi-function PCI in ACPI". It does not make any functional changes,
rather it just renames slot to devfn as appropriate.
Cc: Dexuan Cui <dexuan.cui@intel.com> Cc: Masaki Kanno <kanno.masaki@jp.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
[7/8; cross-compatibility issues with xen-unstable.hg]
Ian Jackson [Thu, 25 Jun 2009 17:32:29 +0000 (18:32 +0100)]
passthrough: multi-function PCI in ACPI
This changes the interface beween qemu-xen and the ACPI portion
of hvmlader. As such it breaks compatibility with older
hvmloaders and a companion patch to hvmloader is needed.
There is a subsequent "noise" companion to this change
which changes slot to devfn as appropriate.
Cc: Dexuan Cui <dexuan.cui@intel.com> Cc: Masaki Kanno <kanno.masaki@jp.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
[6/8; cross-compatibility issues with xen-unstable.hg]
Ian Jackson [Thu, 25 Jun 2009 17:32:01 +0000 (18:32 +0100)]
passthrough: Add AUTO_PHP_DEVFN_MULTI
Up until now there has been a signle magic value that xend can pass to
qemu-xen to signify that qemu-xen should choose a devfn for a pass-through
function.
When supporting multi-function devices in guests, it is useful for xend to
be able to sepcify if a function is to appear in a guest as a
single-function deveice, or as part of a multi-function device.
By adding AUTO_PHP_DEVFN_MULTI to suplement the existing AUTO_PHP_DEVFN,
this patch achieves that goal.
This patch does not break compatibility with xend as the value chosen for
AUTO_PHP_DEVFN_MULTI could never validly be sent by xend up until now.
However, there is a companion change to xend in order to make use of this
feature.
Cc: Dexuan Cui <dexuan.cui@intel.com> Cc: Masaki Kanno <kanno.masaki@jp.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
[5/8; cross-compatibility issues with xen-unstable.hg]
Ian Jackson [Thu, 25 Jun 2009 17:31:24 +0000 (18:31 +0100)]
passthrough: rename slot to devfn
This is the noisy companion to the previous patch "qemu-xen: pass-through:
use devfn instead of slots as the unit for pass-through". It just renames
slot to devfn in various places.
Cc: Dexuan Cui <dexuan.cui@intel.com> Cc: Masaki Kanno <kanno.masaki@jp.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
[4/8; cross-compatibility issues with xen-unstable.hg]
Ian Jackson [Thu, 25 Jun 2009 17:30:25 +0000 (18:30 +0100)]
passthrough: use devfn instead of slots as the unit for pass-through
This is part of support for multi-function PCI devices in guests
Instead of reading a slot number from xend, read a devfn.
This and subsequent other changes will allow xend to ask
for more than one function to be inserted into a single slot -
by specifying which function of the slot should be used.
This is a minimal patch for this change. A subsequent
patch that has a lot of noise to rename slot to devfn follows.
This patch breaks compatibility with xend and corresponding
patches to xend are required.
Cc: Dexuan Cui <dexuan.cui@intel.com> Cc: Masaki Kanno <kanno.masaki@jp.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
[3/8; cross-compatibility issues with xen-unstable.hg]
Ian Jackson [Thu, 25 Jun 2009 17:26:00 +0000 (18:26 +0100)]
passthrough: Read the interrupt pin from hardware
Preparation for multi-fucntion devices in guests.
Up until now guests have only seen devices with one function,
so it is both safe and sensible to always use INTA. But if
if multiple functions appear, it makes sense to use
the interrupt pin specified by the hardware.
Cc: Dexuan Cui <dexuan.cui@intel.com> Cc: Masaki Kanno <kanno.masaki@jp.fujitsu.com> Cc: Yuji Shimada <shimada-yxb@necst.nec.co.jp> Signed-off-by: Simon Horman <horms@verge.net.au>
[1/8; cross-compatibility issues with xen-unstable.hg]
Ian Jackson [Thu, 18 Jun 2009 14:23:53 +0000 (15:23 +0100)]
hw/piix4acpi.c: cleanup logging
this is a simple cleanup patch for logging in piix4acpi: it replaces all
the calls to fprintf with calls to a specific logging function that has
3 simple logging levels.
Ian Jackson [Thu, 18 Jun 2009 14:22:16 +0000 (15:22 +0100)]
implement qemu_chr_open_pty for stubdoms
this is an updated version of the patch "implement qemu_chr_open_pty for
stubdoms": qemu_chr_open_pty is now based on posix_openpt instead of
openpty(void).
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
[ This depends on the corresponding minios change, which is
19790:01ad2654815a ]
Ian Jackson [Thu, 18 Jun 2009 13:53:58 +0000 (14:53 +0100)]
xs_rm xenstore command from xend after we read it
in xenstore_process_dm_command_event(), xs_rm the
command node after we read it.
As Ian Jackson pointed out: "when we start processing a command we
should delete it from xenstore immediately, so that future watch
triggerings either don't see the command or actually see genuine new
invocations".
The patch is used to overcome a race condition that occurs after
changeset 19679: ec2bc4b9fa32 (xend: hot-plug PCI devices at
boot-time) and could break the device assignment of hvm guest:
ioemu's xs_watch() fires the 'command' for the 1st time and xend's
signalDeviceModel('pci-ins',...) fires it for the 2nd time -- without
the patch, the 2nd time watch handling would try to invoke
xenstore_process_dm_command_event() again and since the 'parameter'
node has been changed to hold vslot by ioemu, the second time would
fail and set 'parameter' to "no free hotplug slots" at the end of the
2nd handling; and, if xend runs slower, xend would treat the
'parameter' of the 2nd time as that of the 1st time and destroy the
guest.
Ian Jackson [Tue, 16 Jun 2009 17:14:30 +0000 (18:14 +0100)]
qemu: implement support for secondary consoles in the console backend
[PATCH 5 of 5] qemu: implement support for secondary
This patch adds support for secondary consoles in the console backend.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
[ Patches 1-3 are to xen-unstable but do not have compatibility
implications, we believe. Patch 4 is awaiting revision. -iwj ]
Ian Jackson [Wed, 3 Jun 2009 14:39:26 +0000 (15:39 +0100)]
pass-through: only parse single BDFs.
As of "qemu-xen: hot-plug PCI devices at boot-time", the BDF string
that is parsed always contains a single bdf, not multiple bdf's delimited
by a '-'.
As of "qemu-xen: hot-plug PCI devices at boot-time" register_real_dev()
no longer needs to call __insert_to_pci_slot() and thus there
is no need for __insert_to_pci_slot() to be idempotent.
This is because register_real_dev()'s now only has one caller,
power_on_php_slot(), which always passes a valid e_slot to
register_real_dev().
Ian Jackson [Mon, 1 Jun 2009 09:45:42 +0000 (10:45 +0100)]
passthrough: hot-plug PCI devices at boot-time
Currently there are two interfaces to pass-through PCI devices:
1. A method driven through per-device xenstore entries that is used at boot-time
2. An event-based method used for hot-plug.
This seems somewhat redundant and makes extending the code cumbersome
and prone to error - often the change needs to be made twice, in
two different ways.
This patch removes support for the boot-time protocol from qemu-xen.
There is a companion patch for xend which uses the hot-plug protocol
at boot time.
Ian Jackson [Fri, 29 May 2009 14:42:23 +0000 (15:42 +0100)]
passthrough: fix %lx compiler warning
This patch removes the following warning for x86-32 by PRIx64.
pass-through.c: In function 'pt_iomul_ioport_write':
pass-through.c:1140: warning: format '%lx' expects type 'long unsigned int', but argument 9 has type 'uint64_t'
pass-through.c: In function 'pt_iomul_ioport_read':
pass-through.c:1166: warning: format '%lx' expects type 'long unsigned int', but argument 9 has type 'uint64_t'
Ian Jackson [Fri, 29 May 2009 11:14:23 +0000 (12:14 +0100)]
Disable PCI IO space multiplex for stubdom
Changeset c675fef021550faeafa60577abd18347a172f220 breaks the stubdom
build. The ioctl machinery used is not available in stubdom, so let
us disable this feature in stubdom and return matters to the previous
state if CONFIG_STUBDOM.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Thu, 28 May 2009 17:24:49 +0000 (18:24 +0100)]
replace stat("/etc/disable-guest-log-throttle") in xen_platform.c
currently xen_platform reads /etc/disable-guest-log-throttle at boot to
decide whether is going to throttle guest logging or not.
When using stubdom this is the only code in qemu that rely on
fs-backend, apart from saving and loading the statefile for migration.
This patch removes the read from /etc and adds a read from xenstore
instead.
Ian Jackson [Thu, 21 May 2009 17:45:39 +0000 (18:45 +0100)]
fix cdrom eject, media change, stubdom fallback case
this patch fixes few cdrom handling issues:
- when a cdrom medium event occurs and the new filename is NULL,
we should eject the emulated cdrom instead of just ignoring the event;
- when a cdrom medium event occurs and we are in a stubdom, we have to
pass the xenstore path of the frontend to bdrv_open instead of the
filename;
- when we try and fail to open a cdrom (or disk) in a stubdom we should
not fall back to the usual "non-stubdom" code path because is useless
and wrong.
Ian Jackson [Thu, 21 May 2009 17:09:17 +0000 (18:09 +0100)]
block-vbd: bounce misaligned read/write requests
Bounce any read or write request with a buffer not aligned, a sector
number not aligned or an offset not aligned according to the sector size
reported by blkfront.
Ian Jackson [Thu, 21 May 2009 16:57:38 +0000 (17:57 +0100)]
pass-through: porvide leading zero for vdevfn
This is consistent with the format used elsewhere.
At this time this inconsistency manifests in the output of pci-list
for functions that have been hot-plugged.
While the pci-list output could be unified inside xm or xend by,
for example parsing the string as an integer and then formating it
as a string, there seems to be no disadvantage in making the
string representation used consistent.
Cc: Masaki Kanno <kanno.masaki@jp.fujitsu.com> Cc: Dexuan Cui <dexuan.cui@intel.com> Signed-off-by: Simon Horman <horms@verge.net.au>
[This is] a series of patches for qemu-xen, making the code identical
to the xen support patches being submitted to upstream qemu. The review
process on qemu-devel resulted in a number of fixes and cleanups in the
backend code, this is where most of the changes come from.
There are also some xenfb changes due to displaystate reorganization and
xenfb being merged in steps due to that.
[This is] a series of patches for qemu-xen, making the code identical
to the xen support patches being submitted to upstream qemu. The review
process on qemu-devel resulted in a number of fixes and cleanups in the
backend code, this is where most of the changes come from.
There are also some xenfb changes due to displaystate reorganization and
xenfb being merged in steps due to that.
Use new logging API.
Kill a few fprintf(stderr, "...") calls.
[This is] a series of patches for qemu-xen, making the code identical
to the xen support patches being submitted to upstream qemu. The review
process on qemu-devel resulted in a number of fixes and cleanups in the
backend code, this is where most of the changes come from.
There are also some xenfb changes due to displaystate reorganization and
xenfb being merged in steps due to that.
qemu_malloc() will never return errors. It will abort instead.
Thus no checks for failure are needed.
[This is] a series of patches for qemu-xen, making the code identical
to the xen support patches being submitted to upstream qemu. The review
process on qemu-devel resulted in a number of fixes and cleanups in the
backend code, this is where most of the changes come from.
There are also some xenfb changes due to displaystate reorganization and
xenfb being merged in steps due to that.
changes coming from upstream merge review (style only, no code changes).
- Update FSF address.
- Fix strage compare style.
[This is] a series of patches for qemu-xen, making the code identical
to the xen support patches being submitted to upstream qemu. The review
process on qemu-devel resulted in a number of fixes and cleanups in the
backend code, this is where most of the changes come from.
There are also some xenfb changes due to displaystate reorganization and
xenfb being merged in steps due to that.
[This is] a series of patches for qemu-xen, making the code identical
to the xen support patches being submitted to upstream qemu. The review
process on qemu-devel resulted in a number of fixes and cleanups in the
backend code, this is where most of the changes come from.
There are also some xenfb changes due to displaystate reorganization and
xenfb being merged in steps due to that.
[This is] a series of patches for qemu-xen, making the code identical
to the xen support patches being submitted to upstream qemu. The review
process on qemu-devel resulted in a number of fixes and cleanups in the
backend code, this is where most of the changes come from.
There are also some xenfb changes due to displaystate reorganization and
xenfb being merged in steps due to that.
Ian Jackson [Fri, 8 May 2009 16:26:01 +0000 (17:26 +0100)]
Fix DMA emualtion for ia64.
For DMA in native system, operating system depends on platform
flushes icache of memory touched by DMA operations.
But as to virtual DMA of virtual machine, dma emulation code has to
use explicit instructions to flush icahce,otherwise,
guest may use old icache and leads to guest's crash.
Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com> Signed-off-by: Yang Zhang <yang.zhang@intel.com>
Ian Jackson [Fri, 8 May 2009 16:15:39 +0000 (17:15 +0100)]
passthrough: pt_bar_mapping: use a better way to get the CMD value
The pt_pci_read_config(&ptdev->dev, PCI_COMMAND, 2) in 5d767b7b3fac52336f59e5b40d8befa6b1909937 is not proper as Yuji Shimada
points out: "pt_pci_read_config emulates access to read the registers
from guest software. Many functions which are not relevant are
executed in pt_pci_read_config. So side effects may occur"; instead,
we can "remove emu_mask from writable_mask in pt_cmd_reg_write and
then we can get the proper value from reg_entry->data". Thanks for
Yuji's review and Simon Horman's test.
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com> Tested-by: Simon Horman <horms@verge.net.au> Reviewed-by: Yuji Shimada <shimada-yxb@necst.nec.co.jp>
Ian Jackson [Tue, 5 May 2009 14:22:17 +0000 (15:22 +0100)]
passthrough: pt_bar_mapping etc.: use correct CMD for PCI BAR mapping etc.
dbb8aafa702b8b4f5568e08641d98471fd04e0f8 has a bug:
The virtual CMD value we get from reg_entry->data is not the proper
value because reg_entry->data only holds the emulated bits and the
PCI_COMMAND_IO/PCI_COMMAND_MEMORY bits are not in it. Instead, we can
use pt_pci_read_config(&ptdev->dev, PCI_COMMAND, 2) to get the proper
value.
We should only update the mapping of the related BAR, NOT the mappings
of ALL BARs.
In pt_exp_rom_bar_reg_write(), we should also update the mapping. And
for PCI_ROM_SLOT, when the PCI_ROM_ADDRESS_ENABLE bit is 0, we should
not have the mapping.
Ian Jackson [Tue, 5 May 2009 14:20:50 +0000 (15:20 +0100)]
qemu-img-xen: Fix cow creation with raw image backing files
Previously
dd if=/dev/zero of=raw_image count=100
./qemu-img-xen create -b raw_image -f qcow2 cow_image
would fail because it would attempt to autodetect the format of
base_image. With this change, it works. However,
./qemu-img-xen create -b cow_image -f qcow2 cow_image_2
will now fail because we now always expect the backing file to be raw.
Thanks to Xin Li and Dongxiao Xu for the bug report.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Thu, 23 Apr 2009 15:35:09 +0000 (16:35 +0100)]
drop lwip network support in stubdoms
in order to simplify network support in ioemu stubdoms, I am dropping
lwip based networking.
Network support is still provided the same way: using the tap
interface, created in qemu using netfront.
The lwip stack is still available to avoid additional compilation
issues.
However the stubdom is not going to have its own vif anymore,
this means that the only vnc server supported is the one in dom0.
You can still enable the vnc server in a stubdom at compile time, if
you want so.
Probably the most important change caused by this patch to xen users is
that you don't have to specify two vif in the stubdom config file
anymore, but just one:
Ian Jackson [Wed, 22 Apr 2009 15:16:40 +0000 (16:16 +0100)]
passthrough: Fix older kernel assigned device resume failure problem
We found when do S3 resume, some older kernel(such as rh5.1)
cmd register might be restored before BAR registers, Since
pt_bar_mapping is done when writing cmd register, it will cause
mapping incorrect address.
It's the root_cause of when doing RH5.1 HVM S3, assigned e1000e
network card fails to resume back. (set pci_power_mgmt=1 in guest
config file, let PM support device enter D3 hot state during guest S3)
we should call pt_bar_mapping in pt_bar_reg_write to avoid this problem
for supporting older kernels.
Ian Jackson [Tue, 21 Apr 2009 14:45:18 +0000 (15:45 +0100)]
Fix hvm guest cirrus_vga hvm s3 resume failure
This patch is for fixing hvm guest cirrus_vga hvm s3 resume failure.
We found latest Qemu (after Mar 3.10) will cause HVM guest vga fails
to resume back from S3. It's because vga_bios_init is not only needed
during init, but also needed after cirrus_vga reset (hvm s3 will do
qemu_reset).
Also, we found the outdated s->vram_ptr reset will cause s3 resume
screen black, so we remove it. (win2000 boot up does not need it now)
We verified the fix with the latest cs/qemu.
[ Patch modified slightly by Ian Jackson to reduce code motion. ]
Signed-off-by: Liping Ke<liping.ke@intel.com> Signed-off-by: Ke Yu<ke.yu@intel.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
this patch fixes network support in ioemu stubdoms.
At the moment in order to provide a working network interface to the
guest you still need to specify a vif in both the guest and stubdom
config files.
Ian Jackson [Fri, 17 Apr 2009 16:40:32 +0000 (17:40 +0100)]
fix sdl mode
When I use "sdl=1 vnc=0" in hvm guest config file, qemu-dm would exit
due to a de-reference to a NULL pointer. The regression is introduced
by 3793d85f111a0dfe055ca8ac17a9d1881af43240. The attached patch fixes
the issue.
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>