]> xenbits.xensource.com Git - qemu-xen-4.1-testing.git/log
qemu-xen-4.1-testing.git
15 years agoMerge branch 'pt.multifn'
Ian Jackson [Thu, 25 Jun 2009 17:40:33 +0000 (18:40 +0100)]
Merge branch 'pt.multifn'

Conflicts:
hw/piix4acpi.c

15 years agopassthrough: multi-function PCI in ACPI: rename slot to devfn
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]

15 years agopassthrough: multi-function PCI in ACPI
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]

15 years agopassthrough: Add AUTO_PHP_DEVFN_MULTI
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]

15 years agopassthrough: rename slot to devfn
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]

15 years agopassthrough: use devfn instead of slots as the unit for pass-through
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]

15 years agopassthrough: Read the PCI type bit from hardware
Ian Jackson [Thu, 25 Jun 2009 17:24:23 +0000 (18:24 +0100)]
passthrough: Read the PCI type bit from hardware

Preparation for multi-fucntion devices in guests.

When scanning the PCI bus a guest* will only look for
functions 2-7 if the multifunction bit is set.

Cc: Dexuan Cui <dexuan.cui@intel.com>
Cc: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
[2/8; cross-compatibility issues with xen-unstable.hg]

15 years agopassthrough: Read the interrupt pin from hardware
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]

15 years agohw/piix4acpi.c: cleanup logging
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.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
15 years agoimplement qemu_chr_open_pty for stubdoms
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 ]

15 years agoxs_rm xenstore command from xend after we read it
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.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
15 years agoqemu: implement support for secondary consoles in the console backend
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 ]

15 years agostdvga + videoram config option
Ian Jackson [Mon, 8 Jun 2009 16:45:42 +0000 (17:45 +0100)]
stdvga + videoram config option

Without this patch, guests cannot be created on ia64 because of
qemu-dm's error.

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
15 years agoadd a few missing statics and consts
Ian Jackson [Wed, 3 Jun 2009 14:47:52 +0000 (15:47 +0100)]
add a few missing statics and consts

attached patch fixes a few gcc warnings in ioemu.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
15 years agopass-through: only parse single BDFs.
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 '-'.

Cc: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
Cc: Edwin Zhai <edwin.zhai@intel.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
15 years agopass-through: non-idempotent __insert_to_pci_slot()
Ian Jackson [Wed, 3 Jun 2009 14:38:45 +0000 (15:38 +0100)]
pass-through: non-idempotent __insert_to_pci_slot()

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().

Cc: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
Cc: Edwin Zhai <edwin.zhai@intel.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
15 years agopass-through: Catch errors in do_pci_del()
Ian Jackson [Wed, 3 Jun 2009 14:38:09 +0000 (15:38 +0100)]
pass-through: Catch errors in do_pci_del()

(The strdup() is needed because the parsing of devname is destructive.)

Signed-off-by: Simon Horman <horms@verge.net.au>
15 years agopass-through: Make use of PCI_FUNC, PCI_SLOT and PCI_DEVFN macros
Ian Jackson [Wed, 3 Jun 2009 14:37:02 +0000 (15:37 +0100)]
pass-through: Make use of PCI_FUNC, PCI_SLOT and PCI_DEVFN macros

This is mostly cosmetic, but debug statements asside
I think that it does make things somewhat easier to work with.

Signed-off-by: Simon Horman <horms@verge.net.au>
15 years agopassthrough: hot-plug PCI devices at boot-time
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.

Cc: Edwin Zhai <edwin.zhai@intel.com>
Cc: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
15 years agopassthrough: fix %lx compiler warning
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'

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
15 years agoDisable another remnant of PCI IO space multiplex, for stubdom
Ian Jackson [Fri, 29 May 2009 14:03:17 +0000 (15:03 +0100)]
Disable another remnant of PCI IO space multiplex, for stubdom

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
15 years agoDisable PCI IO space multiplex for stubdom
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>
15 years agoioemu: passthrough: PCI IO space multiplex.
Ian Jackson [Thu, 28 May 2009 17:34:03 +0000 (18:34 +0100)]
ioemu: passthrough: PCI IO space multiplex.

use PCI IO space multiplexer driver and command register emulation twist

This depends on xen-unstable c/s
 19666:8bf58f09e45a2cb021df59ddfe518ebdc6334b78

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
15 years agoreplace stat("/etc/disable-guest-log-throttle") in xen_platform.c
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.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
15 years agofix cdrom eject, media change, stubdom fallback case
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.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
15 years agoblock-vbd: bounce misaligned read/write requests
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.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
15 years agofix stdvga + videoram config option
Ian Jackson [Thu, 21 May 2009 17:08:19 +0000 (18:08 +0100)]
fix stdvga + videoram config option

[There is an unfortunate] initial configuration check done by qemu that is
actually meaningless for us (at least on x86).

This patch should fix the problem.  I kept the check in place only in
case it might be of some use for the ia64 people.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
15 years agopass-through: porvide leading zero for vdevfn
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>
15 years agoqemu xen upstream synch (Gerd): [PATCH 7/7] xen_backend logging: add include
Ian Jackson [Tue, 19 May 2009 14:42:20 +0000 (15:42 +0100)]
qemu xen upstream synch (Gerd): [PATCH 7/7] xen_backend logging: add include

[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.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
15 years agoqemu xen upstream synch (Gerd): [PATCH 6/7] xenfb: kill unused variables
Ian Jackson [Tue, 19 May 2009 14:41:34 +0000 (15:41 +0100)]
qemu xen upstream synch (Gerd): [PATCH 6/7] xenfb: kill unused variables

[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.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
15 years agoqemu xen upstream synch (Gerd): [PATCH 5/7] logging fixups.
Ian Jackson [Tue, 19 May 2009 14:41:04 +0000 (15:41 +0100)]
qemu xen upstream synch (Gerd): [PATCH 5/7] logging fixups.

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.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
15 years agoqemu xen upstream synch (Gerd): [PATCH 4/7]: no malloc failure checks.
Ian Jackson [Tue, 19 May 2009 14:40:06 +0000 (15:40 +0100)]
qemu xen upstream synch (Gerd): [PATCH 4/7]: no malloc failure checks.

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.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
15 years agoqemu xen upstream synch (Gerd): [PATCH 3/7]: fix fsf address & compare style
Ian Jackson [Tue, 19 May 2009 14:38:44 +0000 (15:38 +0100)]
qemu xen upstream synch (Gerd): [PATCH 3/7]: fix fsf address & compare style

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.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
15 years agoqemu xen upstream synch (Gerd): [PATCH 2/7] merge review: delete comment
Ian Jackson [Tue, 19 May 2009 14:37:47 +0000 (15:37 +0100)]
qemu xen upstream synch (Gerd): [PATCH 2/7] merge review: delete comment

[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.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
15 years agoqemu xen upstream synch (Gerd): [PATCH 1/7] xenfb update.
Ian Jackson [Tue, 19 May 2009 14:36:46 +0000 (15:36 +0100)]
qemu xen upstream synch (Gerd): [PATCH 1/7] xenfb update.

[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.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
16 years agoFix DMA emualtion for ia64. xen-3.4.0
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>
16 years agopassthrough: pt_bar_mapping: use a better way to get the CMD value
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>
16 years agopassthrough: pt_bar_mapping etc.: use correct CMD for PCI BAR mapping etc.
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.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
16 years agoqemu-img-xen: Fix cow creation with raw image backing files
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>
16 years agopassthrough: don't call xc_deassign_device() xen-3.4.0-rc3
Ian Jackson [Wed, 29 Apr 2009 15:28:37 +0000 (16:28 +0100)]
passthrough: don't call xc_deassign_device()

This series of patches modify the order of resetting/deassigning
device.

I modify the order of resetting/deassigning device like below.

  When guest OS shutdowns or a device is hotremoved.
   1. Xend resets devices.
   2. Xend deassigns devices.

Because if devices are deassigned before the reset, dom0 memory may be
broken by DMA

This patch modifies ioemu not to call xc_deassign_device()

Signed-off-by: Yuji Shimada <shimada-yxb@necst.nec.co.jp>
16 years agodrop lwip network support in stubdoms
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:

-vif = [ '', 'ip=10.0.1.1,mac=aa:00:00:12:23:34']
+vif = ['ip=10.0.1.1,mac=aa:00:00:12:23:34']

this is the qemu part of the patch: we do not need to hard code 1 as the
starting vif for the tap interface anymore.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
16 years agopassthrough: Fix older kernel assigned device resume failure problem
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.

Signed-off-by: Liping Ke <Liping.Ke@intel.com>
Signed-off-by: Yu Zhao<yu.zhao@intel.com>
Acked-by: Yuji Shimada <shimada-yxb@necst.nec.co.jp>
16 years agoFix hvm guest cirrus_vga hvm s3 resume failure
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>
16 years agofix qcow2 backing file open
Ian Jackson [Mon, 20 Apr 2009 16:55:20 +0000 (17:55 +0100)]
fix qcow2 backing file open

Make `:'-less BDRV_O_FILE bdrv_open2 work again.
qcow2 opens its backing file this way.  Thanks to Yang Zhang for the patch.

Signed-off-by: Yang Zhang <yang.zhang@intel.com>
16 years agostubdom: fix network
Ian Jackson [Fri, 17 Apr 2009 16:41:32 +0000 (17:41 +0100)]
stubdom: fix network
Date: Fri, 17 Apr 2009 16:14:50 GMT

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.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
16 years agofix sdl mode
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>
16 years agopassthrough: guest MSI config on disable xen-3.4.0-rc2
Ian Jackson [Thu, 16 Apr 2009 10:47:04 +0000 (11:47 +0100)]
passthrough: guest MSI config on disable

It's possible for a guest to change the MSI vector or flags
when MSI is disabled, after it's first initialized. This patch
handles the address and data update when it's disabled.

Signed-off-by: Qing He <qing.he@intel.com>
16 years agoMerge branch 'stable_0_10'
Ian Jackson [Tue, 14 Apr 2009 16:35:05 +0000 (17:35 +0100)]
Merge branch 'stable_0_10'

Conflicts:

block.c
hw/cirrus_vga.c
hw/vga.c

16 years agofix std-vga cli option
Ian Jackson [Tue, 14 Apr 2009 12:31:27 +0000 (13:31 +0100)]
fix std-vga cli option

currently the std-vga qemu command line option does not work anymore,
this patch fixes the issue.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
16 years agomapcache fixes (Stefano)
Ian Jackson [Tue, 14 Apr 2009 11:03:01 +0000 (12:03 +0100)]
mapcache fixes (Stefano)

this patch makes the new mapcache code cleaner and fixes few problems
introduced by the recent mapcache improvements.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
16 years agoRecognise evdev(xx)_aliases(yy) and xfree86(xx)_aliases(yy) as keymap names.
aliguori [Mon, 13 Apr 2009 13:29:40 +0000 (13:29 +0000)]
Recognise evdev(xx)_aliases(yy) and xfree86(xx)_aliases(yy) as keymap names.

Newer Xorg use these with non-default kemaps (such as the ThinkPad keymap).

aliguori: this is from r7097 in trunk by balrog

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/branches/stable_0_10@7098 c046a42c-6fe2-441c-8c8c-71466251a162

16 years agoMake PCI config status register read-only
aliguori [Fri, 10 Apr 2009 20:49:44 +0000 (20:49 +0000)]
Make PCI config status register read-only

From the documentation I can find, this register is supposed to be read-only.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/branches/stable_0_10@7071 c046a42c-6fe2-441c-8c8c-71466251a162

16 years agoFix crash on resolution change -> screen dump -> vga redraw (Avi Kivity)
aliguori [Fri, 10 Apr 2009 18:36:38 +0000 (18:36 +0000)]
Fix crash on resolution change -> screen dump -> vga redraw (Avi Kivity)

The vga screen dump function updates last_width and last_height,
but does not change the DisplaySurface that these variables describe.
A consequent vga_draw_graphic() will therefore fail to resize the
surface and crash.

Fix by invalidating the display state after a screen dump, forcing
vga_draw_graphic() to reallocate the DisplaySurface.

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/branches/stable_0_10@7069 c046a42c-6fe2-441c-8c8c-71466251a162

16 years agopassthrough: Fix error handling when interrupt hypercall fails.
Ian Jackson [Wed, 8 Apr 2009 16:54:45 +0000 (17:54 +0100)]
passthrough: Fix error handling when interrupt hypercall fails.

This patch fixes error handling when interrupt hypercall fails.
This patch makes Interrupt Disable bit emulate type.

The policy of this patch is [ in a comment at the top of pass-through.c ]

Signed-off-by: Yuji Shimada <shimada-yxb@necst.nec.co.jp>
16 years agoFix ia64 HVM boot failure. Remove mmap bounce buffer in ia64.
Ian Jackson [Wed, 8 Apr 2009 16:39:00 +0000 (17:39 +0100)]
Fix ia64 HVM boot failure.  Remove mmap bounce buffer in ia64.

For Non-MAPCACHE case, to get the virtual address corresponding to
guest physical address, only an offset value is added to guest
physical address.  With this patch, ia64 HVM boot failure bug can be
fixed.

[ This reverts part of 2ed2ee1704a4ef956ecc61848c84d12aaa4419d5,
  once again removing the bounce buffer in the non-MAPCACHE
  version of cpu_physical_memory_map. -iwj ]

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
16 years agosync DisplayAllocator interface
Ian Jackson [Wed, 8 Apr 2009 16:32:57 +0000 (17:32 +0100)]
sync DisplayAllocator interface

this simple patch sync's the DisplayAllocator interface with upstream
qemu. The only non trivial change, is the new ability for sdl to support
the DisplayAllocator interface, hence improving performances (avoid a
memcpy) when the guest is in text mode or uses a color depth of 8bpp or
24bpp (no DisplayState surface sharing allowed).

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
16 years agoUpdate version for release
aliguori [Tue, 7 Apr 2009 01:57:17 +0000 (01:57 +0000)]
Update version for release

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/branches/stable_0_10@7012 c046a42c-6fe2-441c-8c8c-71466251a162

16 years agoFix find_device_type() to correctly identify floppy disk devices; (Luca Tettamanti)
aliguori [Tue, 7 Apr 2009 01:46:18 +0000 (01:46 +0000)]
Fix find_device_type() to correctly identify floppy disk devices; (Luca Tettamanti)
they are reported as DRIVE_REMOVABLE by win32.

Signed-off-by: Luca Tettamanti <kronos.it@gmail.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/branches/stable_0_10@7011 c046a42c-6fe2-441c-8c8c-71466251a162

16 years ago Fix savevm after BDRV_FILE size enforcement
aliguori [Sun, 5 Apr 2009 21:07:26 +0000 (21:07 +0000)]
 Fix savevm after BDRV_FILE size enforcement

 We now enforce that you cannot write beyond the end of a non-growable file.
 qcow2 files are not growable but we rely on them being growable to do
 savevm/loadvm.  Temporarily allow them to be growable by introducing a new
 API specifically for savevm read/write operations.

Reported-by: malc
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/branches/stable_0_10@7005 c046a42c-6fe2-441c-8c8c-71466251a162

16 years agostop dirty tracking just at the end of migration (Glauber Costa)
aliguori [Sun, 5 Apr 2009 19:33:41 +0000 (19:33 +0000)]
stop dirty tracking just at the end of migration (Glauber Costa)

If there is still work to do, it is not safe to assume we
can end the dirty tracking. Specifically, kvm can update the dirty
tracking log inside ram_save_block(), leaving pages still out of sync
if we go with the current code.

Based on a patch by Yaniv Kamay

Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/branches/stable_0_10@7002 c046a42c-6fe2-441c-8c8c-71466251a162

16 years agocreate qemu_file_set_error (Glauber Costa)
aliguori [Sun, 5 Apr 2009 19:33:37 +0000 (19:33 +0000)]
create qemu_file_set_error (Glauber Costa)

This is mainly for consistency, since we don't want
anything outside of savevm setting it explicitly. There
are current no users of that in qemu tree, but there
are potential candidates on kvm-userspace. And avi
is a nice guy, let's be nice with him.

Based on a patch by Yaniv Kamay

Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/branches/stable_0_10@7001 c046a42c-6fe2-441c-8c8c-71466251a162

16 years agopropagate error on failed completion (Glauber Costa)
aliguori [Sun, 5 Apr 2009 19:33:33 +0000 (19:33 +0000)]
propagate error on failed completion (Glauber Costa)

migrate_fd_put_ready() calls qemu_savevm_state_complete(),
but the later can fail.

If it happens, re-start the vm and propagate the error up

Based on a patch by Yaniv Kamay

Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/branches/stable_0_10@7000 c046a42c-6fe2-441c-8c8c-71466251a162

16 years agoqcow2: fix image creation for large, > ~2TB, images (Chris Wright)
aliguori [Sun, 5 Apr 2009 18:16:10 +0000 (18:16 +0000)]
qcow2: fix image creation for large, > ~2TB, images (Chris Wright)

When creating large disk images w/ qcow2 format, qcow2_create is hard
coded to creating a single refcount block.  This is insufficient for
large images, and will cause qemu-img to segfault as it walks off the
end of the refcount block.  Keep track of the space needed during image
create and create proper number of refcount blocks accordingly.

https://bugzilla.redhat.com/show_bug.cgi?id=491943

Signed-off-by: Chris Wright <chrisw@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/branches/stable_0_10@6988 c046a42c-6fe2-441c-8c8c-71466251a162

16 years agopci_add storage: fix error handling for 'if' parameter (Eduardo Habkost)
aliguori [Sun, 5 Apr 2009 18:16:04 +0000 (18:16 +0000)]
pci_add storage: fix error handling for 'if' parameter (Eduardo Habkost)

This fixes:

 - The error message to show the actual if= argument value. It was showing
   the filename instead, because 'buf' is reaused on the filename parsing.
 - A bug that makes a block device to be created even when an unsupported if= arg
   is passed to pci_add.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/branches/stable_0_10@6987 c046a42c-6fe2-441c-8c8c-71466251a162

16 years agoFix (at least one cause of) qcow2 corruption. (Nolan Leake)
aliguori [Sun, 5 Apr 2009 18:15:59 +0000 (18:15 +0000)]
Fix (at least one cause of) qcow2 corruption. (Nolan Leake)

qcow2's get_cluster_offset() scans forward in the l2 table to find other
clusters that have the same allocation status as the first cluster.
This is used by (among others) qcow_is_allocated().

Unfortunately, it was not checking to be sure that it didn't fall off
the end of the l2 table.  This patch adds that check.

The symptom that motivated me to look into this was that
bdrv_is_allocated() was returning false when there was in fact data
there.  This is one of many ways this bug could lead to data corruption.

I checked the other place that scans for consecutive unallocated blocks
(alloc_cluster_offset()) and it appears to be OK:
    nb_clusters = MIN(nb_clusters, s->l2_size - l2_index);
appears to prevent the same problem from occurring.

Signed-off-by: Nolan Leake <nolan <at> sigbus.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/branches/stable_0_10@6986 c046a42c-6fe2-441c-8c8c-71466251a162

16 years agoFix oops on 2.6.25 guest (Rusty Russell)
aliguori [Sun, 5 Apr 2009 18:15:54 +0000 (18:15 +0000)]
Fix oops on 2.6.25 guest (Rusty Russell)

I believe this is behind the following:
https://bugs.edge.launchpad.net/ubuntu/jaunty/+source/linux/+bug/331128

virtio_pci in 2.6.25 didn't do feature negotiation correctly: it acked every
bit.  Fortunately, we can detect this.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/branches/stable_0_10@6985 c046a42c-6fe2-441c-8c8c-71466251a162

16 years agoReinstate bounce-buffer-based cpu_physical_memory_[un]map for ia64
Ian Jackson [Fri, 3 Apr 2009 15:17:22 +0000 (16:17 +0100)]
Reinstate bounce-buffer-based cpu_physical_memory_[un]map for ia64

This patch fixes the compilation error caused by the change set
of 191158d4c289d1bf7c154ad6b51f776f680982d5.
ia64 doesn't support mapcache yet, so not-mapcache version
of cpu_physical_memory_map/unmap are still necessary.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
16 years agohw/battery_mgmt.c: remove some spurious externs
Ian Jackson [Fri, 3 Apr 2009 14:45:06 +0000 (15:45 +0100)]
hw/battery_mgmt.c: remove some spurious externs

Declarations of objects with external linkage should appear only in
header files.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
16 years agoxenstore: Set drives_table[].used
Ian Jackson [Fri, 3 Apr 2009 14:43:15 +0000 (15:43 +0100)]
xenstore: Set drives_table[].used

Setting this field, newly introduced upstream, prevents the core drive
option parser in vl.c from overwriting xenstore.c's work.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
16 years agoDisable chroot and runas facilities in stubdom.
Ian Jackson [Fri, 3 Apr 2009 14:10:12 +0000 (15:10 +0100)]
Disable chroot and runas facilities in stubdom.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
16 years agoPost-merge compilation fixes
Ian Jackson [Thu, 2 Apr 2009 15:22:28 +0000 (16:22 +0100)]
Post-merge compilation fixes

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
16 years agoMerge tag 'stable_0_10_0.branchpoint'
Ian Jackson [Thu, 2 Apr 2009 12:51:27 +0000 (13:51 +0100)]
Merge tag 'stable_0_10_0.branchpoint'

Conflicts:

Makefile.target
block-bochs.c
block-cloop.c
block-parallels.c
block.c
console.c
console.h
hw/ide.c
hw/pc.c
hw/pci.c
hw/pci.h
hw/usb-hid.c
hw/vga.c
loader.c
net.h
posix-aio-compat.c
vl.c
vnc.c

16 years agofix vga draw_text duplications
Ian Jackson [Tue, 31 Mar 2009 17:01:04 +0000 (18:01 +0100)]
fix vga draw_text duplications

the last qemu merge left some code dups in vga_draw_text, this patch
fixes them.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
16 years agoblock-vbd: implement support for splitting requests
Ian Jackson [Tue, 31 Mar 2009 16:19:49 +0000 (17:19 +0100)]
block-vbd: implement support for splitting requests

the main issue with stubdoms at the moment is that the new dma api does
not support an upper limit for the number of sectors in a single dma
transfer.
This means that block-vbd can issue blkfront_aio transfers that exceed
the blktap limit BLKIF_MAX_SEGMENTS_PER_REQUEST.
The attached qemu patch makes block-vbd split any request bigger than
the limit above.

The small xen patch is also needed to change struct blkfront_aiocb.
 [ The corresponding changeset in xen-unstable is 19463:f2cf89a4e762 -iwj ]

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
16 years agopassthrough: Update acpi_php_readb()'s comment
Ian Jackson [Tue, 31 Mar 2009 16:02:52 +0000 (17:02 +0100)]
passthrough: Update acpi_php_readb()'s comment

This relates to chagnes introduced in
"Allow any unused PCI device to be used for pass-through"
 [ ea4860c13aabe65622be97ae6796c3d646f499db ]

Signed-off-by: Simon Horman <horms@verge.net.au>
16 years agoxen_machine_fv: Add missing #include of qemu-aio.h
Ian Jackson [Tue, 31 Mar 2009 15:57:20 +0000 (16:57 +0100)]
xen_machine_fv: Add missing #include of qemu-aio.h

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
16 years agoxen: use mapcache for cpu_physical_memory_map
Ian Jackson [Tue, 31 Mar 2009 15:54:56 +0000 (16:54 +0100)]
xen: use mapcache for cpu_physical_memory_map

this patch improves qemu-xen's mapcache to be able to guarantee that
certain mappings are going to last until explicitly unmapped.
This capability is necessary to implement cpu_physical_memory_map and
cpu_physical_memory_unmap that are part of the new dma api.
This patch also provides the implementation of these two functions,
removing the one based on bounce buffers that we are currently using.

Current DMA throughput: ~10MB/s
DMA throughput with this patch:  ~27MB/s

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
16 years agopassthrough: Allow slots 1e and 1f to be used
Ian Jackson [Tue, 31 Mar 2009 15:52:24 +0000 (16:52 +0100)]
passthrough: Allow slots 1e and 1f to be used

This fixes an oversight in my recent patch "Allow any unused PCI device to
be used for pass-through" whereby attempts to use slots 1e and 1f for
pass-through would silently fail.

* This affects both static and manual selection of slots
* This affects both hot-plug and static pass-through

Signed-off-by: Simon Horman <horms@verge.net.au>
16 years agoide: wait for outstanding aio requests before unplugging the disk
Ian Jackson [Tue, 31 Mar 2009 15:51:03 +0000 (16:51 +0100)]
ide: wait for outstanding aio requests before unplugging the disk

this patch adds a wait on the completion of any outstanding aio requests
before unplugging the hard drive.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
16 years agoFixes from Christoph Egger
Ian Jackson [Tue, 31 Mar 2009 14:37:58 +0000 (15:37 +0100)]
Fixes from Christoph Egger

- xen-vl-exra.c: Only compile pci_emulation_add() w/  CONFIG_PASSTHROUGH
- Fix compiler confusion with tokens after #endif
- qemu-common.h: Fix merge botch with upstream
- qemu-xen.h: remove redundant declaration of pci_xen_platform_init
- xen_platform.c: take declaration of pci_xen_platform_init from
  xen_platform.h
- xen_platform.c: Make platform_fixed_ioport_save and
  platform_fixed_ioport_load static. They have no prototypes and aren't
  used elsewhere

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
16 years agopassthrugh: Fix double unbinding of INTx interrupt when PCI device hot-removed
Ian Jackson [Tue, 31 Mar 2009 10:46:09 +0000 (11:46 +0100)]
passthrugh: Fix double unbinding of INTx interrupt when PCI device hot-removed

This patch fixes double unbinding of INTx interrupt when PCI device is
hot-removed.

Signed-off-by: Yuji Shimada <shimada-yxb@necst.nec.co.jp>
16 years agopassthrough: Fix duplicated MAC addr when multi-port NIC assigned to HVM domain
Ian Jackson [Tue, 31 Mar 2009 10:45:38 +0000 (11:45 +0100)]
passthrough: Fix duplicated MAC addr when multi-port NIC assigned to HVM domain

This patch fixes duplicated MAC address when multi-port NIC is
assigned to HVM domain.

Currently multi-function device is shown as two single function
devices. e1000e driver and igb driver for linux add 1 to MAC address of
second port of multi-port NIC. But they don't add 1 to MAC address of
second port if NIC is single-function device. Because of this, the MAC
addresses of the first port and the second port are duplicated.

The patch make Header Type register passthrough-type. This means a
multi-function device is shown as two multi-function devices which
implement only one function. So e1000e driver and igb driver add 1 to
MAC address of second port.

When we use windows guest, the same issue occurs, the patch fix it.

Signed-off-by: Yuji Shimada <shimada-yxb@necst.nec.co.jp>
16 years agoioemu: Read pass-through vslot from xend
Ian Jackson [Tue, 31 Mar 2009 10:41:09 +0000 (11:41 +0100)]
ioemu: Read pass-through vslot from xend

This reads the vslot information supplied by xend, and should be
the final piece for this feature on the ioemu side.

There is also a xend portion of this patch which I will post separately.

Signed-off-by: Simon Horman <horms@verge.net.au>
16 years agoioemu: allow xend to specify the slot for pass-through devices
Ian Jackson [Tue, 31 Mar 2009 10:40:30 +0000 (11:40 +0100)]
ioemu: allow xend to specify the slot for pass-through devices

Currently a slot may be specified for a hot-plug device,
but not for a pass-through device that is inserted at boot time.
This patch adds support for the latter.

The syntax is:
     BUS:DEV.FUNC[@VSLOT]
e.g: 0000:00:1d:0@7

This may be important as recent changes that allow any free PCI
slot to be used for pass-through (and hotplug) may case pass-through
devices to be assigned in different locations to before. Amongst
other things, specifying the slot will allow users to move them
back, if there is a need.

There is also a xend portion of this patch, which will be posted separately.

Signed-off-by: Simon Horman <horms@vereg.net.au>
16 years agoioemu: Do slot parsing inside of next_bdf
Ian Jackson [Tue, 31 Mar 2009 10:38:55 +0000 (11:38 +0100)]
ioemu: Do slot parsing inside of next_bdf

Currently only hotplug provides vslot information from xend.
A subsequent patch will have xend provide this information
for boot-time inserted pass-through devices too.

With this in mind, this patch makes some infrastructure
to parse bdf + slot information.

Signed-off-by: Simon Horman <horms@verge.net.au>
16 years agoSH4: Add support for kernel cmdline
aurel32 [Tue, 31 Mar 2009 05:55:16 +0000 (05:55 +0000)]
SH4: Add support for kernel cmdline

Backport of revisions 6792, 6916, 6919 from trunk.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/branches/stable_0_10@6960 c046a42c-6fe2-441c-8c8c-71466251a162

16 years agochar: Fix closing of various char devices (Jan Kiszka)
aliguori [Sat, 28 Mar 2009 18:01:29 +0000 (18:01 +0000)]
char: Fix closing of various char devices (Jan Kiszka)

This patch fixes several issues around closing char devices. Affected
were pty (timer was left behind, even running), udp (no close handling
at all) and tcp (missing async IO handler cleanup). The bugs either
caused segfaults or stalled the qemu process. So far, hot-unplugging USB
serial adapters suffered from this.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/branches/stable_0_10@6912 c046a42c-6fe2-441c-8c8c-71466251a162

16 years agohost_device_remove: remove incorrect check for device name (Eduardo Habkost)
aliguori [Sat, 28 Mar 2009 15:51:46 +0000 (15:51 +0000)]
host_device_remove: remove incorrect check for device name (Eduardo Habkost)

There is no need to check for valid prefixes on the the device name
when removing it. If the device name is found on the vlan client list,
it can be removed, regardless of the prefix used on its name.

To reproduce the bug, just run this on the monitor:

 (qemu) host_net_add user name=foobar
 (qemu) host_net_remove 0 foobar
 invalid host network device foobar
 (qemu)

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/branches/stable_0_10@6890 c046a42c-6fe2-441c-8c8c-71466251a162

16 years agoEnable -k option on Win32 (Herve Poussineau)
aliguori [Sat, 28 Mar 2009 15:46:15 +0000 (15:46 +0000)]
Enable -k option on Win32 (Herve Poussineau)

Attached patch enables -k option on Win32. There is no reason to disable it.

Signed-off-by: Herve Poussineau <hpoussin@reactos.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/branches/stable_0_10@6889 c046a42c-6fe2-441c-8c8c-71466251a162

16 years agopassthrough: fix buffer overflow of vslots
Ian Jackson [Wed, 25 Mar 2009 11:38:29 +0000 (11:38 +0000)]
passthrough: fix buffer overflow of vslots

Assuming we assign n devices, strlen(direct_pci) can be 13n and the
length of the old 'vslots' is 13n/3 which is smaller than 5n+1 (1
slot_str takes 5 bytes).  So we have to malloc a bigger buffer for
vslots.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
16 years agopassthrough: Register dpci_infos.php_devs.pt_dev in a common location
Ian Jackson [Wed, 25 Mar 2009 11:35:42 +0000 (11:35 +0000)]
passthrough: Register dpci_infos.php_devs.pt_dev in a common location

Currently power_on_php_slot() sets dpci_infos.php_devs[i].pt_dev itself
after the call to register_real_device(). While pt_init relies on
power_on_php_slot() to set this pointer.

It seems sensible to use the same behaviour for both callers.

There are no other callers of register_real_device()

Signed-off-by: Simon Horman <horms@verge.net.au>
16 years agoioemu: call xenstore_store_serial_port_info() for xm console
Ian Jackson [Wed, 25 Mar 2009 11:29:54 +0000 (11:29 +0000)]
ioemu: call xenstore_store_serial_port_info() for xm console

call xenstore_store_serial_port_info() for xm console.
Without this patch, xm console doesn't work for hvm domain.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
[ Bug was introduced by me during most recent merge from upstream -iwj ]

16 years agoioemu: make more of passthrough.c and piix4acpi.c static
Ian Jackson [Wed, 25 Mar 2009 11:25:32 +0000 (11:25 +0000)]
ioemu: make more of passthrough.c and piix4acpi.c static

Make more of passthrough.c and piix4acpi.c static

Signed-off-by: Simon Horman <horms@verge.net.au>
16 years agopassthrough: unmap INTx interrupt on hot-remove
Ian Jackson [Tue, 24 Mar 2009 18:24:14 +0000 (18:24 +0000)]
passthrough: unmap INTx interrupt on hot-remove

This patch unmaps INTx interrupt on hot-remove.

Signed-off-by: Yuji Shimada <shimada-yxb@necst.nec.co.jp>
16 years agopassthrough: fix pt_chk_bar_overlap
Ian Jackson [Tue, 24 Mar 2009 18:23:29 +0000 (18:23 +0000)]
passthrough: fix pt_chk_bar_overlap

This patch fixes pt_chk_bar_overlap.

Current pt_chk_bar_overlap does not distinguish memory resources and
io resources. They are placed in different address space. So
pt_chk_bar_overlap should distinguish them.

Signed-off-by: Yuji Shimada <shimada-yxb@necst.nec.co.jp>
16 years agopassthrough: Fix MSI/MSI-X capability structure virtualization code
Ian Jackson [Tue, 24 Mar 2009 18:22:30 +0000 (18:22 +0000)]
passthrough: Fix MSI/MSI-X capability structure virtualization code

This patch fixes MSI/MSI-X capability structure virtualization code.

Currently, xen does not support multiple message (multiple vector).
So multiple message capable field should be emulated and fixed to 0
(single vector).

With the patch, my FC-HBA works when I assign it to guest domain where
windows 2008 runs.

In addition to this, initial values of emulated registers should be
the same with initial values defined in PCI spec. If initial values
are not defined, they should be 0. The emulated field mask and
read-only field mask are also fixed.

Signed-off-by: Yuji Shimada <shimada-yxb@necst.nec.co.jp>
16 years agocirrus: Do not clear vram area to 0xff when not yet allocated.
Ian Jackson [Tue, 24 Mar 2009 18:12:39 +0000 (18:12 +0000)]
cirrus: Do not clear vram area to 0xff when not yet allocated.

When restoring, the vram data pointer is not valid until (depending on
the version of the savefile) the guest has informed us what memory to
use.  Thus vram_ptr may be NULL.  In this patch we avoid attempting to
clear the video ram in this case.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
16 years agoFix getting the configuration of PCI pass-through from xenstore
Ian Jackson [Tue, 24 Mar 2009 13:31:27 +0000 (13:31 +0000)]
Fix getting the configuration of PCI pass-through from xenstore

This patch fixes getting the configuration of PCI pass-through from xenstore.

Signed-off-by: Yuji Shimada <shimada-yxb@necst.nec.co.jp>
Acked-by: Dexuan Cui <dexuan.cui@intel.com>
16 years agoioemu: emulate No_Soft_Reset in PMCSR
Ian Jackson [Tue, 24 Mar 2009 13:30:10 +0000 (13:30 +0000)]
ioemu: emulate No_Soft_Reset in PMCSR

When pci_power_mgmt=0, the No_Soft_Reset field in power
management control/status register of a PCI device needs to be
emulated and fixed to 1. This bit indicates that devices
transitioning from D3 to D0 because of PowerState commands do not
perform an internal reset.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
16 years agoDisable xen platform PCI device when xen_platform_pci=0 is specified
Ian Jackson [Mon, 23 Mar 2009 17:27:08 +0000 (17:27 +0000)]
Disable xen platform PCI device when xen_platform_pci=0 is specified

This patch is the ioemu side of the series.

- Alias the "platform_flags" byte of the ioport BAR to fixed byte port
  0x10, and don't remove existing "platform_flags" byte.

- Disable xen platform PCI device if "disable_pf" entry is 1. If there
  is not "disable_pf" entry, xen platform PCI device is enabled.

Signed-off-by: Yuji Shimada <shimada-yxb@necst.nec.co.jp>