]> xenbits.xensource.com Git - qemu-xen-4.2-testing.git/log
qemu-xen-4.2-testing.git
12 years agoconsole: bounds check whenever changing the cursor due to an escape code
Ian Campbell [Wed, 5 Sep 2012 11:31:40 +0000 (12:31 +0100)]
console: bounds check whenever changing the cursor due to an escape code

This is XSA-17 / CVE-2012-3515

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoqemu-xen-trad: fix msi_translate with PV event delivery
Stefano Stabellini [Thu, 30 Aug 2012 15:11:32 +0000 (16:11 +0100)]
qemu-xen-trad: fix msi_translate with PV event delivery

When switching from msitranslate to straight msi we need to make sure
that we respect PV event delivery for the msi if the guest asked for it:

- completely disable MSI on the device in pt_disable_msi_translate;
- then enable MSI again (pt_msi_setup), mapping the correct pirq to it.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Tested-by: Rolu <rolu@roce.org>
12 years agoRevert "qemu-xen-traditional: use O_DIRECT to open disk images for IDE" xen-4.2.0-rc3
Ian Jackson [Tue, 14 Aug 2012 14:57:49 +0000 (15:57 +0100)]
Revert "qemu-xen-traditional: use O_DIRECT to open disk images for IDE"

This reverts commit 1307e42a4b3c1102d75401bc0cffb4eb6c9b7a38.

In fact after a lengthy discussion, we came up with the conclusion
that WRITEBACK is OK for IDE.
See: http://marc.info/?l=xen-devel&m=133311527009773

Therefore revert this which was committed in error.

12 years agomapcache: Fix invalidate if memory requested was not bucket aligned xen-4.2.0-rc2
Frediano Ziglio [Tue, 7 Aug 2012 17:17:27 +0000 (18:17 +0100)]
mapcache: Fix invalidate if memory requested was not bucket aligned

When memory is mapped in qemu_map_cache with lock != 0 a reverse mapping
is created pointing to the virtual address of location requested.
The cached mapped entry is saved in last_address_vaddr with the memory
location of the base virtual address (without bucket offset).
However when this entry is invalidated the virtual address saved in the
reverse mapping is used. This cause that the mapping is freed but the
last_address_vaddr is not reset.

Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agoqemu-traditional: fix no-return-in-nonvoid-function xen-4.2.0-rc1
Olaf Hering [Mon, 23 Jul 2012 16:56:13 +0000 (17:56 +0100)]
qemu-traditional: fix no-return-in-nonvoid-function

rpm post-build-checks found a few issues in qemu-xen-traditional and
marks them as errors.

I: Program returns random data in a function
E: xen no-return-in-nonvoid-function savevm.c:215
E: xen no-return-in-nonvoid-function /usr/src/packages/BUILD/xen-4.2.25602/non-dbg/stubdom/ioemu/xenfbfront.c:361

Signed-off-by: Olaf Hering <olaf@aepfle.de>
12 years agopassthrough: fix off-by-one in PCI config space register index check
Jan Beulich [Fri, 29 Jun 2012 16:06:25 +0000 (17:06 +0100)]
passthrough: fix off-by-one in PCI config space register index check

Register 255 (0xff) is still valid to be accessed.

Reported-by: Rolu <rolu@roce.org>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agoxendisk: set maximum number of grants to be used
Jan Beulich [Fri, 29 Jun 2012 15:58:05 +0000 (16:58 +0100)]
xendisk: set maximum number of grants to be used

Legacy (non-pvops) gntdev drivers may require this to be done when the
number of grants intended to be used simultaneously exceeds a certain
driver specific default limit.

upstream-commit: 64c27e5b1fdb6d94bdc0bda3b1869d7383a35c65

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
12 years agoxendisk: properly update stats in ioreq_release()
Jan Beulich [Fri, 29 Jun 2012 15:47:34 +0000 (16:47 +0100)]
xendisk: properly update stats in ioreq_release()

While for the "normal" case (called from blk_send_response_all())
decrementing requests_finished is correct, doing so in the parse error
case is wrong; requests_inflight needs to be decremented instead.

upstream-commit: ed5477664369c1e9de23b0e7e8f16a418573bd2a

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-traditional: disable msitranslate by default
Stefano Stabellini [Thu, 28 Jun 2012 14:44:50 +0000 (15:44 +0100)]
qemu-traditional: disable msitranslate by default

msitranslate is known to cause problems with some device drivers,
because it sets the real device in MSI mode while making the guest think
is actually in legacy interrupts mode. Some drivers are able to spot this
inconsistency and break (Nvidia drivers for example).

Disable the option by default.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
12 years agoqemu-xen-trad: fix sys-queue.h usage on BSD systems
Roger Pau Monne [Thu, 7 Jun 2012 18:44:01 +0000 (19:44 +0100)]
qemu-xen-trad: fix sys-queue.h usage on BSD systems

BSD systems already have a sys/queue.h file, which has more macros
than the one Qemu uses, and some header files depend on having that
macros defined (sys/disk.h for example). Disable sys-queue.h on BSD
systems and include the native one.

This is not a backport because the original patch is too dificult to
backport, it's commit 72cf2d4f0e181d0d3a3122e04129c58a95da713e.

Doing a diff -bB shows that the Qemu version is just a stripped
version of the original NetBSD header, with many macros removed, but
no new ones added.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agoqemu-xen-trad/block: get right partition size
Adam Hamsik [Thu, 7 Jun 2012 18:36:26 +0000 (19:36 +0100)]
qemu-xen-trad/block: get right partition size

use the correct way to get the size of a disk device or partition

This this a backport of d1f6fd8d1400ab356aee776b1ecc3ed1e89dbeaa.

From: Adam Hamsik <haad@netbsd.org>
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Backport-requested-by: Roger Pau Monne <roger.pau@citrix.com>
Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
12 years agoqemu-xen-trad/block: use a character device if a block device is given
Christoph Egger [Thu, 7 Jun 2012 18:35:28 +0000 (19:35 +0100)]
qemu-xen-trad/block: use a character device if a block device is given

On NetBSD a userland process is better with the character device
interface. In addition, a block device can't be opened twice; if a Xen
backend opens it, qemu can't and vice-versa.

This is a backport of 1de1ae0a7d956b3c87712bf2c09d277f99873f4c.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Backport-requested-by: Roger Pau Monne <roger.pau@citrix.com>
Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
12 years agoxenstore: Use <xenstore.h>
Ian Jackson [Mon, 14 May 2012 16:05:48 +0000 (17:05 +0100)]
xenstore: Use <xenstore.h>

<xs.h> is going away.

This change needs to be made in lockstep with xen-unstable.hg, which
will be done by a change to the QEMU_TAG in the xen-unstable.hg
changeset.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
12 years agopassthrough: Intel GPU passthrough, fix OpRegion mapping
Jean Guyader [Fri, 11 May 2012 11:40:42 +0000 (12:40 +0100)]
passthrough: Intel GPU passthrough, fix OpRegion mapping

The OpRegion shouldn't be mapped 1:1 because the address in the host
can't be used in the guest directly.

This patch traps read and write access to the opregion of the Intel
GPU config space (offset 0xfc).

To work correctly this patch needs a change in hvmloader.

HVMloader will allocate 2 pages for the OpRegion and write this address
on the config space of the Intel GPU. Qemu will trap and map the host
OpRegion to the guest. Any write to this offset after that won't have
any effect. Any read of this config space offset will return the address
in the guest.

Signed-off-by: Jean Guyader <jean.guyader@eu.citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
13 years agotimers: use INT64_MAX as max expiration
Yang Zhang [Tue, 3 Apr 2012 14:44:48 +0000 (15:44 +0100)]
timers: use INT64_MAX as max expiration

Currently, the max expiration time is 2147483647ns(INT32_MAX ns). This
is enough when guest is busy, but when guest is idle, the next timer
will be later than INT32_MAX ns. And those meaningless alarm will harm
the pkg C-state.

PS: Since the overflow will not happen with the expression((delta /
1000) + (delta % 1000 > 0 ? 1 : 0)), so i also removed the comments"
To avoid problems with overflow limit this to 2^32."

Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
13 years agoxen: introduce an event channel for buffered io event notifications
Stefano Stabellini [Tue, 3 Apr 2012 14:42:39 +0000 (15:42 +0100)]
xen: introduce an event channel for buffered io event notifications

Use the newly [November 2011] introduced HVM_PARAM_BUFIOREQ_EVTCHN to
receive notifications for buffered io events.  After the first
notification is received leave the event channel masked and setup a
timer to process the rest of the batch.  Once we have completed
processing the batch, unmask the event channel and delete the timer.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
13 years agoqemu-xen-traditional: QDISK fixes
Stefano Stabellini [Mon, 2 Apr 2012 16:55:05 +0000 (17:55 +0100)]
qemu-xen-traditional: QDISK fixes

- if ioreq->postsync call bdrv_flush when the operation is actually
  completed;
- do not increment aio_inflight when not submitting any operations.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agoqemu-xen-traditional: use O_DIRECT to open disk images with QDISK
Stefano Stabellini [Mon, 2 Apr 2012 16:54:36 +0000 (17:54 +0100)]
qemu-xen-traditional: use O_DIRECT to open disk images with QDISK

Also enable batch_maps, use_aio and disable syncwrite.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agoqemu-xen-traditional: use O_DIRECT to open disk images for IDE
Stefano Stabellini [Mon, 2 Apr 2012 16:54:08 +0000 (17:54 +0100)]
qemu-xen-traditional: use O_DIRECT to open disk images for IDE

[ Major performance fix. -iwj ]

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agoqemu-traditional/passthrough: adjust MSI-X device cleanup (bug 1809)
Jan Beulich [Mon, 2 Apr 2012 16:35:36 +0000 (17:35 +0100)]
qemu-traditional/passthrough: adjust MSI-X device cleanup (bug 1809)

To address http://bugzilla.xen.org/bugzilla/show_bug.cgi?id=1809,
pt_unregister_regions() also needs to use the newly introduced
_pt_iomem_helper() instead of calling xc_domain_memory_mapping()
directly, to take into consideration the hole created for the MSI-X
table.

For this to work, two calls in unregister_real_device() need to be
swapped, since otherwise we'd have

unregister_real_device()
  -> pt_config_delete()
    -> pt_msix_delete() (frees [and fails to clear] ->msix)
  -> pt_unregister_regions()
    -> _pt_iomem_helper() (with the patch below)
      -> has_msix_mapping() (uses ->msix)

And to be certain to prevent (catch) further/future use-after-free
instances, let's also clear dev->msix in pt_msix_delete().

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Yongjie Ren <yongjie.ren@intel.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
13 years agoqemu-xen: ignore console disconnect events for console/0
Stefano Stabellini [Thu, 1 Mar 2012 18:58:27 +0000 (18:58 +0000)]
qemu-xen: ignore console disconnect events for console/0

The first console has a different location compared to other PV devices
(console, rather than device/console/0) and doesn't obey the xenstore
state protocol. We already special case the first console in con_init
and con_initialise, we should also do it in con_disconnect.

This patch should be applied to 4.1 too.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
13 years agoIntel GPU passthrough: Host bridge config space
Jean Guyader [Mon, 20 Feb 2012 16:21:47 +0000 (16:21 +0000)]
Intel GPU passthrough: Host bridge config space

Expose more host bridge config space value to make the driver happy
for all the different revisions of the device.

Signed-off-by: Jean Guyader <jean.guyader@eu.citrix.com>
13 years agoqemu: Don't access /proc/bus/pci unless graphics pass-thru is enabled
George Dunlap [Mon, 13 Feb 2012 17:00:13 +0000 (17:00 +0000)]
qemu: Don't access /proc/bus/pci unless graphics pass-thru is enabled

A recent changeset introduced a bug whereby an initialization function
that reads /proc/bus/pci is called from graphics set-up functions even
if pass-through graphics are not enabled.  If qemu is run without
permission to this file, this causes qemu to fail during
initialization.

This patch re-works the functions so that the initialization happens
only if we actually need to do the pci host read or write.  It also
makes failures call abort().

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
13 years agoqemu-dm: fix unregister_iomem()
Jan Beulich [Tue, 7 Feb 2012 18:42:56 +0000 (18:42 +0000)]
qemu-dm: fix unregister_iomem()

This function (introduced quite a long time ago in
e7911109f4321e9ba0cc56a253b653600aa46bea - "disable qemu PCI
devices in HVM domains") appears to be completely broken, causing
the regression reported in
http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=1805 (due to
the newly added caller of it in
56d7747a3cf811910c4cf865e1ebcb8b82502005 - "qemu: clean up
MSI-X table handling"). It's unclear how the function can ever have
fulfilled its purpose: the value returned by iomem_index() is *not* an
index into mmio[].

Additionally, fix two problems:
- unregister_iomem() must not clear mmio[].start, otherwise
  cpu_register_physical_memory() won't be able to re-use the previous
  slot, thus causing a leak
- cpu_unregister_io_memory() must not check mmio[].size, otherwise it
  won't properly clean up entries (temporarily) squashed through
  unregister_iomem()

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Tested-by: Yongjie Ren <yongjie.ren@intel.com>
13 years agoe1000: bounds packet size against buffer size
Ian Campbell [Thu, 2 Feb 2012 13:47:06 +0000 (13:47 +0000)]
e1000: bounds packet size against buffer size

Otherwise we can write beyond the buffer and corrupt memory.  This is tracked
as CVE-2012-0029.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(Backported from qemu upstream 65f82df0d7a71ce1b10cd4c5ab08888d176ac840
 by Ian Campbell.)

Signed-off-by: Ian Campbell <Ian.Campbell@citrix.com>
13 years agoblock-vbd: update to new mini-os wait queue API (new linked list API)
Ian Campbell [Tue, 31 Jan 2012 15:42:38 +0000 (15:42 +0000)]
block-vbd: update to new mini-os wait queue API (new linked list API)

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
13 years agoqemu-xen: adjust MSI-X related log messages
Jan Beulich [Thu, 5 Jan 2012 17:16:46 +0000 (17:16 +0000)]
qemu-xen: adjust MSI-X related log messages

Several of these messages we coded using line continuation within a
string literal. This is generally not recommended and also lead to odd
sequences of many blanks in the middle of the messages.

The message indicating a discarded write due to MSI-X already being
enabled doesn't need to be issued when a write doesn't actually modify
the current value. Adjust the surrounding logic accordingly, and
eliminate some redundancy as well as the sometimes unnecessary access
to the physical MSI-X table.

Finally, adjust the wording of a few messages to be more precise and/or
more useful.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
13 years agoqemu-xen: fix sequence of operations in pt_msix_init()
Jan Beulich [Thu, 5 Jan 2012 17:15:46 +0000 (17:15 +0000)]
qemu-xen: fix sequence of operations in pt_msix_init()

Checking the return value of mmap() must be done before adjusting the
value, otherwise failure may not be detected.

Closing the file handle, on the other hand, can be done before checking
the return value.

Finally, printing the errno value without knowing whether the previous
function actually failed is bogus (and superfluous since a subsequent
message prints the strerror() representaton anyway).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
13 years agoqemu: clean up MSI-X table handling
Ian Jackson [Thu, 22 Dec 2011 14:46:31 +0000 (14:46 +0000)]
qemu: clean up MSI-X table handling

This patch does cleaning up of QEMU MSI handling. The fixes are:
1. Changes made to MSI-X table mapping handling to eliminate the small
windows in which guest could have access to physical MSI-X table.
2. MSI-X table is mapped as read-only to QEMU, as masking of MSI-X is
already in Xen now.
3. For registers that coexists inside the MSI-X table (this could be
only PBA I think), value read from physical page would be returned.

Signed-off-by: Shan Haitao <maillists.shan@gmail.com>
Consolidated duplicate code into _pt_iomem_helper(). Fixed formatting.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Haitao Shan <haitao.shan@intel.com>
Acked-by: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
13 years agoqemu_get_timer: Provide a comment about the behaviour on ts==NULL
Ian Jackson [Thu, 8 Dec 2011 16:38:06 +0000 (16:38 +0000)]
qemu_get_timer: Provide a comment about the behaviour on ts==NULL

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agoqemu_get_timer: always read the 64 bit value from the savefile
Ian Jackson [Thu, 8 Dec 2011 16:36:03 +0000 (16:36 +0000)]
qemu_get_timer: always read the 64 bit value from the savefile

qemu_get_timer: the 64 bit value needs to be read from the save file
even when the timer is not initialized otherwise following reads from
the savefile will read the wrong fields.

[ This fixes a regression in 68af5b51 -iwj. ]

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
13 years agoqemu_timer_pending/qemu_get_timer: cope with NULL timers
Ian Jackson [Mon, 5 Dec 2011 13:43:34 +0000 (13:43 +0000)]
qemu_timer_pending/qemu_get_timer: cope with NULL timers

qemu_timer_pending and qemu_get_timer: don't crash if the timer passed
as an argument is NULL.

[ Fixes regression: 13b06e700528 broke save/restore on Xen. -iwj ]

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
13 years agoqemu-xen: passthrough, add PT_LOG_DEV
Jean Guyader [Thu, 1 Dec 2011 18:23:34 +0000 (18:23 +0000)]
qemu-xen: passthrough, add PT_LOG_DEV

Cleanup.

Signed-off-by: Jean Guyader <jean.guyader@eu.citrix.com>
13 years agoqemu-xen: Clean pt-graphic, use defined value.
Jean Guyader [Thu, 1 Dec 2011 18:23:07 +0000 (18:23 +0000)]
qemu-xen: Clean pt-graphic, use defined value.

Used defined value for 0x8086 (PCI_VENDOR_ID_INTEL) and some PCI config
space offsets.

Signed-off-by: Jean Guyader <jean.guyader@eu.citrix.com>
13 years agoqemu-xen: Change prototype for pt_pci_host_read/write
Jean Guyader [Thu, 1 Dec 2011 18:22:28 +0000 (18:22 +0000)]
qemu-xen: Change prototype for pt_pci_host_read/write

Cleanup.

pt_pci_host_read/write now takes a struct pci_dev*.

Signed-off-by: Jean Guyader <jean.guyader@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agoincrease minimum timeout to 1h
Sefano Stabellini [Thu, 1 Dec 2011 17:52:39 +0000 (17:52 +0000)]
increase minimum timeout to 1h

There is no reason why the minimum timeout should be 10s, it could
easily be 1h and we would save lots of cpu cycles.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
13 years agoxen: don't initialize the RTC timers if xen is available
Sefano Stabellini [Thu, 1 Dec 2011 17:52:01 +0000 (17:52 +0000)]
xen: don't initialize the RTC timers if xen is available

Xen doesn't need full RTC emulation in Qemu because the RTC is already
emulated by the hypervisor. Hence don't initialize the RTC timers when Xen is
available so that Qemu doesn't need to wake up needlessly.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
13 years agoqemu-dm: open char devices "file:..." with O_APPEND
Ian Jackson [Mon, 28 Nov 2011 17:16:52 +0000 (17:16 +0000)]
qemu-dm: open char devices "file:..." with O_APPEND

The "file:..." character open method is used by serial and parallel
ports, to divert the output to a file (and these devices never produce
any input).  This is like a logfile, and so should be opened for
append.

In qemu-xen-unstable, this is used only for the qemu stderr by libxl.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
13 years agoqemu-xen: Don't redefine libpci (3.1.7) defines.
Jean Guyader [Tue, 22 Nov 2011 18:49:15 +0000 (18:49 +0000)]
qemu-xen: Don't redefine libpci (3.1.7) defines.

These values are already defined by the libpci heders in the version
3.1.7.

PCI_STATUS_66MHZ
PCI_STATUS_RESERVED2
PCI_STATUS_FAST_BACK
PCI_MSIX_TABSIZE

Signed-off-by: Jean Guyader <jean.guyader@eu.citrix.com>
13 years agoqemu-xen: add vkbd support for PV on HVM guests
Stefano Stabellini [Tue, 22 Nov 2011 16:12:40 +0000 (16:12 +0000)]
qemu-xen: add vkbd support for PV on HVM guests

Register the vkbd backend even when running as device emulator for HVM
guests: it is useful because it doesn't need a frequent timer like usb.

Check whether the XenInput DisplayState has been set in the initialise
state, rather than the input state.
In case the DisplayState hasn't been set and there is no vfb for this
domain, then set the XenInput DisplayState to the default one.

An equivalent patch has already been committed in upstream qemu.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
13 years agoqemu-xen: remove i386-dm/README.hvm-pv-magic-ioport-disable
Ian Campbell [Tue, 1 Nov 2011 18:42:55 +0000 (18:42 +0000)]
qemu-xen: remove i386-dm/README.hvm-pv-magic-ioport-disable

I have just proposed a patch to add this to xen-unstable.hg as
docs/misc/hvm-emulated-unplug.markdown. This repo is not a place where people
look for docs, plus we are transitioning to upstream qemu.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
13 years agoremove blktap when building for NetBSD
Roger Pau Monne [Thu, 6 Oct 2011 17:38:08 +0000 (18:38 +0100)]
remove blktap when building for NetBSD

NetBSD has no blktap support, so remove the use of the blktap if the
OS is NetBSD.

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
13 years agoqemu-char.c: fix incorrect CONFIG_STUBDOM handling
Ian Jackson [Tue, 28 Jun 2011 12:50:53 +0000 (13:50 +0100)]
qemu-char.c: fix incorrect CONFIG_STUBDOM handling

qemu-char.c:1123:7: warning: "CONFIG_STUBDOM" is not defined [-Wundef]

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agopassthrough: mask out upper bits in vendor id
Ian Jackson [Tue, 28 Jun 2011 12:49:35 +0000 (13:49 +0100)]
passthrough: mask out upper bits in vendor id

Making vendor_id u16 eliminates potential bogus upper bits that are
not part of the actual 16-bit vendor ID.  On some systems, upper bits
shows up with 0xffff.

Signed-off-by: Allen Kay <allen.m.kay@intel.com>
13 years agomapcache: remember the last page address rather then the last address_index
Stefano Stabellini [Tue, 21 Jun 2011 17:05:10 +0000 (18:05 +0100)]
mapcache: remember the last page address rather then the last address_index

A single address_index corresponds to multiple pages that might or
might not be mapped.  It is better to just remember the last page
address for the sake of this optimization, so that we are sure that it
is mapped.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
13 years agoqemu-xen: fix unmapping logic in hw/xen_console.c.
Wei Liu [Tue, 21 Jun 2011 16:58:47 +0000 (17:58 +0100)]
qemu-xen: fix unmapping logic in hw/xen_console.c.

Signed-off-by: Wei Liu <liuw@liuw.name>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
13 years agopassthrough: IGFX passthrough fix SNB GGC
Jean Guyader [Tue, 21 Jun 2011 16:56:35 +0000 (17:56 +0100)]
passthrough: IGFX passthrough fix SNB GGC

The GGC field have moved from 0x52 to 0x50 on Sandy Bridge.

Signed-off-by: Jean Guyader <jean.guyader@eu.citrix.com>
14 years agoqemu-xen: fix segfault with empty cdroms xen-4.1.0 xen-4.1.0-rc5 xen-4.1.0-rc6 xen-4.1.0-rc7 xen-4.1.0-rc8 xen-4.1.1 xen-4.1.1-rc1 xen-4.1.1-rc2 xen-4.1.2 xen-4.1.2-rc1 xen-4.1.2-rc2 xen-4.1.2-rc3
Stefano Stabellini [Fri, 11 Feb 2011 17:54:51 +0000 (17:54 +0000)]
qemu-xen: fix segfault with empty cdroms

When the cdrom is empty the params node in xenstore might be missing
completely.  Cope with it instead of segfaulting.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
14 years agovnc, xen: write vnc address and password to xenstore xen-4.1.0-rc4
Ian Jackson [Tue, 1 Feb 2011 17:32:38 +0000 (17:32 +0000)]
vnc, xen: write vnc address and password to xenstore

The xend protocol as actually implemented is:
  * xend writes:
     /vm/UUID/vncpasswd = "PASS"   (n0,rDOMID)
     /local/domain/0/backend/vfb/DOMID/0/vncunused = "0"   (n0,rDOMID)
     /local/domain/0/backend/vfb/DOMID/0/vnc = "1"   (n0,rDOMID)
     /local/domain/0/backend/vfb/DOMID/0/vnclisten = "ADDR"   (n0,rDOMID)
     /local/domain/0/backend/vfb/DOMID/0/vncdisplay = "PORT"   (n0,rDOMID)
     /local/domain/0/backend/vfb/DOMID/0/vncpasswd = "PASS"   (n0,rDOMID)
  * qemu reads /vm/UUID/vncpasswd and overwrites it with "\0"
  * qemu writes
     /local/domain/DOMID/console/vnc-port = "PORT"   (n0,rDOMID)
  * xm vncviewer reads entries from backend/vfb,
    as well as console/vnc-port.
Much of this is insane.

xl quite properly does not create anything in backend/vfb for an HVM
domain with no vfb.  But xl vncviewer needs to know the port number
and the address and the password.

So, for now, have qemu write these nodes too:
     /local/domain/DOMID/console/vnc-listen = "ADDR"   (n0,rDOMID)
     /local/domain/DOMID/console/vnc-pass = "PASS"   (n0,rDOMID)
This corresponds to the protocol actually currently implemented in
libxl.

We will revisit this after the 4.1 release and invent a non-insane
protocol.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
14 years agopassthrough: always read default pci passthrough settings
Stefano Stabellini [Fri, 4 Feb 2011 16:42:50 +0000 (16:42 +0000)]
passthrough: always read default pci passthrough settings

If there are no devices assigned to the domain at boot, we don't read
the default pci passthrough parameters.  This patch fixes it.  Reading
num_devs is completely useless hence I am removing it.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agoqemu-xen: disable buffering on the save file for stubdoms xen-4.1.0-rc2 xen-4.1.0-rc3
Stefano Stabellini [Fri, 21 Jan 2011 18:01:53 +0000 (18:01 +0000)]
qemu-xen: disable buffering on the save file for stubdoms

We need to issue reads with the exact number of bytes to read the
qemu-xen save file, and to do that this patch disables buffering on all
the savevm reads/writes for stubdoms.

[This is pretty horrid; hopefully there will be better solution for 4.2 -iwj]

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
14 years agoDisable xen_be_init in stubdom
Kamala Narasimhan [Fri, 21 Jan 2011 17:39:03 +0000 (17:39 +0000)]
Disable xen_be_init in stubdom

Do nothing in xen_be_init under stubdom.

Signed-off-by: Kamala Narasimhan <kamala.narasimhan@citrix.com>
14 years agofix segfault on con_disconnect
Stefano Stabellini [Thu, 20 Jan 2011 16:34:47 +0000 (16:34 +0000)]
fix segfault on con_disconnect

The test on xendev->gnttabdev in con_disconnect is wrong: what
differentiates the consoles is the dev number.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
14 years agokeymaps.c: fix use after free in del_key_range
Jan Beulich [Mon, 17 Jan 2011 18:00:37 +0000 (18:00 +0000)]
keymaps.c: fix use after free in del_key_range

Commit 99d53fbb69d3e03be61ae10506a304a3d08d792f introduced this, and
the compiler indirectly warned about it.

The patch is only compile tested (I don't even know how to reproduce
the original problem), but I suppose worth applying regardless.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Cc: Chun Yan Liu <cyliu@novell.com>
14 years agoqemu-xen: use dynticks instead of a static 10ms timeout xen-4.1.0-rc1
Stefano Stabellini [Tue, 11 Jan 2011 18:48:58 +0000 (18:48 +0000)]
qemu-xen: use dynticks instead of a static 10ms timeout

Use dynticks instead of polling the timers every 10ms.
This allows a qemu running in dom0 to wake up only when the next timer
goes off (that is every 100ms, because of the buffer_io_timer) instead
of every 10ms.

For the moment stubdoms still run with the old 10ms timeout because
minios doesn't support the posix timer_create interface yet.

Also disable the nographic_timer when CONFIG_DM because it is only
useful with tcg.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
14 years agobump RLIMIT_AS if restricted
Jan Beulich [Tue, 11 Jan 2011 18:38:59 +0000 (18:38 +0000)]
bump RLIMIT_AS if restricted

Mostly the same as is already being done for several other RLIMIT_*
values.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
14 years agofix '|' key display problem in en-us with altgr processing
Chun Yan Liu [Wed, 5 Jan 2011 23:48:36 +0000 (23:48 +0000)]
fix '|' key display problem in en-us with altgr processing

Commit f95d202ed644 handles altgr-insert problem.  Unfortunately, with
that patch, there is a problem in En-us keyboard: '|' (bar) cannot be
displayed. After checking keymap files, we found there are two
definitions to "bar" in en-us: bar 0x56 altgr (in "common") bar 0x2b
shift (in "en-us") First line is actually invalid in en-us
lanuage. The 2nd definition will cover the 1st one.

The previous change in didn't consider multi-definition case. It scans
keymap files, if keysym needs altgr, it will records that, after that,
if keysym is pressed but altgr not pressed, it will add an altgr press
opeartion. It is correct if all keysyms are unique and valid. But in
the above multi-definition case, there is problem: when reading bar
0x56 altgr (in "common") it will record altgr needed, but in fact,
that definition won't be used, it always use the 2nd definition and
won't need altgr. Then if the keysym is pressed, the code will still
add an altgr press operation, that will cause problem.

So, if we cannot avoid multi-definition in keymap files, the altgr
flag (whether altgr needed or not) should also be refreshed according
to the 2nd defintion. In the above case, when reading the 1st line, it
records altgr needed; then reading 2nd line, 2nd definition will cover
the 1st, meanwhile the altgr flag should be reset (the 2nd definition
doesn't need altgr, so altgr flag should be removed.)

Following patch supplements f95d202ed644, and solve the
problem.

Signed-off-by: Chun Yan Liu <cyliu@novell.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agoqemu-xen: if pirq == 0 fall back to emulated MSIs
Stefano Stabellini [Wed, 5 Jan 2011 23:16:54 +0000 (23:16 +0000)]
qemu-xen: if pirq == 0 fall back to emulated MSIs

If the pirq requested is 0, it probably means that the guest is
misconfigured, so fall back to the emulated code path.

This patch depends on "qemu-xen: support PV on HVM MSIX remapping".

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
14 years agoqemu-xen: support PV on HVM MSIX remapping
Stefano Stabellini [Wed, 5 Jan 2011 23:14:37 +0000 (23:14 +0000)]
qemu-xen: support PV on HVM MSIX remapping

Support PV on HVM MSIX remapping

The technique is the same used with MSI: if the guest enables an MSIX
passing 0 as vector number, then read the address and use it as pirq
number for the following mapping request to Xen.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
14 years agoqemu-xen: update for libxc gnttab interface change
Ian Campbell [Thu, 23 Dec 2010 15:29:37 +0000 (15:29 +0000)]
qemu-xen: update for libxc gnttab interface change

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
14 years agoqemu-xen: update for libxc evtchn interface change
Ian Campbell [Thu, 23 Dec 2010 15:21:52 +0000 (15:21 +0000)]
qemu-xen: update for libxc evtchn interface change

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
14 years agostubdom: fix stubdom build following dd9d12dc
Ian Jackson [Thu, 16 Dec 2010 15:50:06 +0000 (15:50 +0000)]
stubdom: fix stubdom build following dd9d12dc

dd9d12dc does not build with stubdoms because xen_disk isn't
supported.  Disable it in the stubdom case.

Original version of this patch by Stefano Stabellini.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agoxen_disk: support empty write barriers
Ian Jackson [Tue, 14 Dec 2010 18:42:20 +0000 (18:42 +0000)]
xen_disk: support empty write barriers

this patch can be applied to both qemu-xen and qemu and adds support
for empty write barriers to xen_disk.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
14 years agoxenfb: let xenfb_guest_copy() handle dept h=32 case
Ian Jackson [Tue, 14 Dec 2010 18:39:14 +0000 (18:39 +0000)]
xenfb: let xenfb_guest_copy() handle dept h=32 case

In hw/xenfb.c, xenfb_guest_copy only handles xenfb->depth=8 and 24
cases, I guess it assumes in xenfb->depth=16 or 32 cases, buffer is
shared. But that's not always the case: the code path that allows us
to have a shared buffer when xenfb->depth=16 or 32 is xenfb->do_resize
set, but on a guest vnc console, when enter CTRL+ALT+2 switch to qemu
monitor console then CTRL+ALT+1 back to guest window, the
xenfb->do_resize is not set, that is, buffer is not shared, and
xenfb_guest_copy does not handle xenfb->depth=32 case, the result is:
guest screen cannot be restored.

To fix above problem, this patch does two things:

1. Set xenfb->do_resize in xenfb_invalidate so that in console switch
case, buffer is shared when xenfb->depth=16 or 32. The screen cannot
be restored bug in above description can be solved.

2. To avoid that other special cases have the same problem, it's
better to let xenfb_guest_copy handle all cases, so add processing to
xenfb->depth=16 and 32 in xenfb_guest_copy.

Signed-off-by: Chun Yan Liu <cyliu@novell.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
14 years agoqemu-xen: support qdisk with stubdoms
Ian Jackson [Tue, 23 Nov 2010 17:57:17 +0000 (17:57 +0000)]
qemu-xen: support qdisk with stubdoms

In the qemu used as backend provider for stubdoms, register two qdisk
backends: one for the stubdom and one for the guest.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agoqemu-xen: support qdisk as disk backend
Ian Jackson [Tue, 23 Nov 2010 17:56:47 +0000 (17:56 +0000)]
qemu-xen: support qdisk as disk backend

Support qdisk in xenstore_parse_domain_config;
do not call xenstore_parse_domain_config with pv guests.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
14 years agoxen_disk: backport from upstream qemu
Ian Jackson [Tue, 23 Nov 2010 17:52:44 +0000 (17:52 +0000)]
xen_disk: backport from upstream qemu

xen_disk is a pure userspace blkback implementation that can be used to
provided a disk backend called qdisk.
It is particularly useful with a dom0 kernel that doesn't have blktap2
(Linux 2.6.37).

[ This is a cherry pick of git commit
  62d23efac8905a46277f666c909e826f91c12aa1
aka git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7223
  c046a42c-6fe2-441c-8c8c-71466251a162
originally from Gerd Hoffman and Anthony Ligouri, edited
by Stefano to fit into current qemu-xen-unstable. -iwj ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
14 years agoqemu-xen: build adjustments to support out-of-tree builds
Ian Jackson [Tue, 23 Nov 2010 16:40:08 +0000 (16:40 +0000)]
qemu-xen: build adjustments to support out-of-tree builds

QEMU by itself can be built outside of its source directory. With the
qemu repository being separate from the hypervisor/tools one it seems
to make sense to make use of this feature, but doing so requires a
couple of adjustments to the Xen changes to it. Basically, if
CONFIG_QEMU is found to indicate an existing directory, this directory
will be used rather than cloning the git repo into the build tree.

[ This is the qemu-xen half. -iwj ]

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years agopassthrough: let xen choose the pirq number
Ian Jackson [Fri, 19 Nov 2010 18:50:43 +0000 (18:50 +0000)]
passthrough: let xen choose the pirq number

When remapping an interrupt into the guest, let xen choose the pirq,
otherwise we might have to handle possible conflicts.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
14 years agopassthrough: support PV on HVM MSI remapping
Ian Jackson [Fri, 19 Nov 2010 18:50:07 +0000 (18:50 +0000)]
passthrough: support PV on HVM MSI remapping

If the guest enables an MSI passing 0 as vector number, then read the
address and use it as pirq number for the following mapping request to
Xen.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
14 years agopiix4acpi, xen: change in ACPI to match the change in the BIOS.
Ian Jackson [Tue, 9 Nov 2010 18:01:13 +0000 (18:01 +0000)]
piix4acpi, xen: change in ACPI to match the change in the BIOS.

Some change have been introduced in the Xen firmware to match QEMU's
BIOS.  So this patch adds the new sleep state values and handle old
and new ACPI IOPort mapping.

QEMU-Xen uses new ioport by default, but if it's a saved state with old
firmware, it unmaps the new ioport and maps the old one.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
14 years agostubdom: fix handing of dependency files
Ian Jackson [Mon, 8 Nov 2010 17:09:54 +0000 (17:09 +0000)]
stubdom: fix handing of dependency files

The previous change to switch qemu's make include directives to use
.*.d rather than *.d didn't consider the stubdom side, where no -MF
was passed to the compiler so far.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years agoblock-vvfat.c: fix warnings with _FORTIFY_SOURCE
Ian Jackson [Wed, 3 Nov 2010 12:46:45 +0000 (12:46 +0000)]
block-vvfat.c: fix warnings with _FORTIFY_SOURCE

In function 'snprintf',
    inlined from 'init_directories' at block-vvfat.c:868:10,
    inlined from 'vvfat_open' at block-vvfat.c:1065:24:
/usr/include/bits/stdio2.h:65:3: warning: call to __builtin___snprintf_chk will always overflow destination buffer

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Olaf Hering <olaf@aepfle.de>
14 years agopc.c: Fix compiler warning in load_linux
Ian Jackson [Wed, 3 Nov 2010 12:45:24 +0000 (12:45 +0000)]
pc.c: Fix compiler warning in load_linux

fix compile warning.

/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/ioemu-dir/hw/pc.c: In function 'load_linux':
/usr/src/packages/BUILD/xen-unstable.hg-4.1.21864/tools/ioemu-dir/hw/pc.c:713:39: warning: operation on 'seg[4]' may be undefined

Signed-off-by: Olaf Hering <olaf@aepfle.de>
14 years agoeliminate compiler warnings
Ian Jackson [Thu, 28 Oct 2010 11:27:08 +0000 (12:27 +0100)]
eliminate compiler warnings

No functional change intended.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years agoqemu: fix incremental rebuild
Ian Jackson [Thu, 28 Oct 2010 11:26:02 +0000 (12:26 +0100)]
qemu: fix incremental rebuild

While the .*.d dependency files get build nicely during the initial
build, they never got actually used: make's $(wildcard ) function acts
like the shell's, i.e. *.d doesn't match any file name starting with
'.' and hence none of the files would ever be used.

For the clean: rules the issue is the same, except here it should have
been very obvious that removing *.d won't do what was intended.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years agoe1000: Handle IO Port.
Ian Jackson [Thu, 21 Oct 2010 16:59:20 +0000 (17:59 +0100)]
e1000: Handle IO Port.

This patch introduces the two IOPorts on e1000, IOADDR and IODATA. The
IOADDR is used to specify which register we want to access when we read
or write on IODATA.

It also check the RDLEN register when a packet is received, if the value
is 0, the receive descriptor buffer is not set, so we don't accept any
network packets.

This patch fixes some weird behavior that I see when I use e1000 with
QEMU/Xen, the guest memory can be corrupted by this NIC because it will
write on memory that it doesn't own anymore after a reset. It's because
the kernel Linux use the IOPort to reset the network card instead of the
MMIO.

This patch also intruduces e1000_reset function.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
14 years agouse xc_domain_add_to_physmap instead of open coding xc_memory_op
Ian Jackson [Mon, 18 Oct 2010 16:24:50 +0000 (17:24 +0100)]
use xc_domain_add_to_physmap instead of open coding xc_memory_op

[ Compatibility note: requires xen-unstable changeset 90a64629f7c0 ]

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
14 years agoqemu: use xc_domain_populate_physmap_exact.
Ian Jackson [Mon, 18 Oct 2010 15:57:23 +0000 (16:57 +0100)]
qemu: use xc_domain_populate_physmap_exact.

This new function replaces xc_domain_memory_populate_physmap.

[ Compatibility note: requires xen-unstable changeset 5ec79c06b18a ]

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
14 years agoioemu: fix VNC altgr-insert behavior
Ian Jackson [Tue, 14 Sep 2010 16:31:43 +0000 (17:31 +0100)]
ioemu: fix VNC altgr-insert behavior

When access to a Xen DomU (Linux) from a VNC client in Windows, alt-gr
key is not working properly with Spanish keyboard. When Alt + another
key pressed, vncserver receives Altgr down, Altgr up and key down
messages in order, that causes incorrect output.

With following patch, when vncerver receives key down message, it
first check if the keysym needs altgr modifer, if it needs altgr
modifier but altgr is not 'down', sending altgr keycode before sending
key keycode.

Signed-off-by: Chunyan Liu <cyliu@novell.com>
14 years agopassthrough: Change some cryptic numerals into macros
Ian Jackson [Wed, 8 Sep 2010 15:38:09 +0000 (16:38 +0100)]
passthrough: Change some cryptic numerals into macros

This is just a trivial patch that turns some cryptic numerals in pci
code into macros

Signed-off-by: Liu Yuan yuan.b.liu@intel.com<mailto:yuan.b.liu@intel.com>
14 years agopassthrough: enabling IGD passthrough for Calpella and Sandybridge
Ian Jackson [Thu, 2 Sep 2010 18:08:58 +0000 (19:08 +0100)]
passthrough: enabling IGD passthrough for Calpella and Sandybridge

This patch enables IGD passthrough for Calpella and Sandybridge
platforms.  To minimize impact of these changes, it checks for
vendor_id of 0x8086 before creating another PCH device in the virtual
platform.  For opregion, it checks both vendor_ID of 0x8086 and a
non-zero PCI opregion value on device 0:2.0 before mapping the
opregion.

Signed-off-by: Allen Kay <allen.m.kay@intel.com>
14 years agoAllow -disable-opengl even if opengl support is not compiled in
Ian Jackson [Thu, 19 Aug 2010 17:10:43 +0000 (18:10 +0100)]
Allow -disable-opengl even if opengl support is not compiled in

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
14 years agopassthrough: graphics passthrough cleanup
Ian Jackson [Thu, 19 Aug 2010 16:45:33 +0000 (17:45 +0100)]
passthrough: graphics passthrough cleanup

This patch as originally titled Calpella/Sandybridge IGD passthrough.
In this revision, I have separated cleanup portion of the patch from
Calpella/Sandybridge portion.  This cleanup portion incorporates
inputs from Stephano and proposed patch from Isaku.  The main changes
are consolidating graphics passthrough specific code into
pt-graphics.c and removal of hardcoded intercepts for host bridge
(device 00:00.0) accesses in pci.c.

Signed-off-by: Allen Kay [allen.m.kay@intel.com<mailto:allen.m.kay@intel.com>]
Signed-off-by: Isaku Yamahata [yamahata@valinux.co.jp]
14 years agosupport multiple pv consoles for hvm guests too
Ian Jackson [Mon, 16 Aug 2010 12:29:36 +0000 (13:29 +0100)]
support multiple pv consoles for hvm guests too

This patch allows qemu to provide pv console backends for hvm guests too:

- initialize the pv console backends when emulating a "xen_fv" machine;

- separate the pv consoles and emulated serials on xenstore: pv
consoles use the console prefix and emulated serials use the serial
prefix;

- read the "output" node on xenstore to know where the output of a pv
console has to go.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
14 years agoMove the xenfb pointer handler to the connected method
Ian Jackson [Thu, 8 Jul 2010 16:33:29 +0000 (17:33 +0100)]
Move the xenfb pointer handler to the connected method

Ensure that we read "request-abs-pointer" after the frontend has written
it.  This means that we will correctly set up an ansolute or relative
pointer handler correctly.

Signed-off-by: John Haxby <john.haxby@oracle.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
14 years agoIntroduce a new 'connected' xendev op called when Connected.
Ian Jackson [Thu, 8 Jul 2010 16:31:57 +0000 (17:31 +0100)]
Introduce a new 'connected' xendev op called when Connected.

Rename the existing xendev 'connect' op to 'initialised' and introduce
a new 'connected' op.  This new op, if defined, is called when the
backend is connected.  Note that since there is no state transition this
may be called more than once.

Signed-off-by: John Haxby <john.haxby@oracle.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
14 years agoRevert "Wait for frontend state Connected before connecting the backend"
Ian Jackson [Fri, 2 Jul 2010 16:36:01 +0000 (17:36 +0100)]
Revert "Wait for frontend state Connected before connecting the backend"

As discussed on xen-devel.

This reverts commit 805ed3b20492d2f4bb465bfda65cedd286e23209.

14 years agostubdom: fix creation hang by not initialising xenfb_pv if nographic anthony.last_qemu_master
Ian Jackson [Tue, 29 Jun 2010 13:42:48 +0000 (14:42 +0100)]
stubdom: fix creation hang by not initialising xenfb_pv if nographic

Contributed-by: Eric Chanudet <eric.chanudet@citrix.com>
Modified-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
14 years agoFix ia64 build (for xc interface change)
Ian Jackson [Fri, 25 Jun 2010 14:27:09 +0000 (15:27 +0100)]
Fix ia64 build (for xc interface change)

The commit ffb0cf2a is insufficient on ia64.
This patch fixes it.

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
14 years agoFix read-only image file handling
Ian Jackson [Wed, 9 Jun 2010 16:10:59 +0000 (17:10 +0100)]
Fix read-only image file handling

Hi,
this is the patch for qemu-xen-3.4-testing to fix the read-only
image file handling since the image file was always treated as
read-write which means that all the HVM guests were able to
write to all the disk images available in domain configuration
file no matter what the mode of the image was defined. This
patch fixes this functionality to honor the O_RDONLY in the
BDRV_O_ACCESS flag in block.c and also fixes the IDE and SCSI
interfaces that uses it.

It's been tested on RHEL-5 with xen-3.4-testing version of
upstream xen with xen-3.4-testing qemu implementation. The
patch is applicable to qemu-xen-unstable.git as well with no
modifications.

When you want to mount an image that is set as read-only in the
domain configuration file but you omit to set mode to read-only
it results into I/O errors when processing the requests.
Remounting as read-only or unmounting and remounting using the
`mount /dev/* /path/to/mount -o ro` shall do the mounting the
correct way, i.e. with no I/O errors, so make sure you mount
those disks as read-only otherwise you can be getting errors like:

end_request: I/O error, dev hdb, sector 52
Buffer I/O error on device hdb1, logical block 1
lost page write due to I/O error on hdb1

and for IDE devices you'll be getting several additional DeviceFault
errors since mounting the device read-write (default setting) writes
some data onto a disk at the mount-time.

For SCSI devices the DATA PROTECT request sense has been added
as found at: http://en.wikipedia.org/wiki/SCSI_Request_Sense_Command

Michal

Signed-off-by: Michal Novotny <minovotn@redhat.com>
14 years agoChange callers of libxc to use new libxc API.
Ian Jackson [Thu, 15 Apr 2010 16:01:15 +0000 (17:01 +0100)]
Change callers of libxc to use new libxc API.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agoWait for frontend state Connected before connecting the backend
Ian Jackson [Fri, 21 May 2010 14:46:55 +0000 (15:46 +0100)]
Wait for frontend state Connected before connecting the backend

The frontend of the framebuffer set a value (request-abs-pointer) and go
to the state Connected.  The backend must read this value only when the
frontend has the state Connected.

From: Anthony PERARD <anthony.perard@citrix.com>
Tested-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
15 years agoImplement 'xm vcpu-set' command for HVM guest
Ian Jackson [Fri, 30 Apr 2010 16:41:45 +0000 (17:41 +0100)]
Implement 'xm vcpu-set' command for HVM guest

Currently Xen has 'xm vcpu-set' command for PV domain, but not
available for HVM domain.  This patch is use to enable 'xm vcpu-set'
command for HVM domain. It setup vcpu watch at xenstore, and at qemu
side, handle vcpu online/offline accordingly.  With this patch, 'xm
vcpu-set' command works for both PV and HVM guest with same format.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
15 years agoUpdate vcpu hotplug logic
Ian Jackson [Fri, 30 Apr 2010 16:41:18 +0000 (17:41 +0100)]
Update vcpu hotplug logic

Add vcpu online/offline check to avoid redundant SCI interrupt.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
15 years agopassthrough: fix segmentation fault after hotplug pass-through device xen-3.4.3-rc5-broken
Ian Jackson [Tue, 13 Apr 2010 11:07:33 +0000 (12:07 +0100)]
passthrough: fix segmentation fault after hotplug pass-through device

This patch fixed the QEMU segmentation fault after hotplug
pass-through devices with MSI-X for many times.

There is a wrong boundary check in cpu_register_io_memory that uses
io_index rather than io_mem_nb. After many times of hotplug of MSI-X
pass-through device, io_mem_read[] got extended to overwrite mmio_cnt,
then cause QEMU segmentation fault.

This fix sync with upstream QEMU code in exec.c, and free unused
io_mem_XXX element after hot removal.

Signed-off-by: Zhai Edwin <edwin.zhai@intel.com>
15 years agopassthrough: fix header type register emulation
Ian Jackson [Thu, 8 Apr 2010 15:56:24 +0000 (16:56 +0100)]
passthrough: fix header type register emulation

This patch fixes the emulation of latency timer and header type.
The change set of cc1a204423475ff7a918b11d78b9ae637f320e23
deleted the header type register emulation.
On the other hand, the change set of ec5e52d5cb2e6f8851c345b7c3095fe2030fff9c
tries to update header type emulation, however it wrongly
touches latency timer emulation part.
I think this was caused by mis-merging. This patch sorts it out.

Cc: Dexuan Cui <dexuan.cui@intel.com>
Cc: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Simon Horman <horms@verge.net.au>
15 years agoMake hweight32 function static xen-4.0.0 xen-4.0.0-rc8 xen-4.0.0-rc9
Ian Jackson [Wed, 24 Mar 2010 17:16:51 +0000 (17:16 +0000)]
Make hweight32 function static

Avoids compiler warning.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoAdd sanity check for vcpu config
Ian Jackson [Wed, 24 Mar 2010 17:15:12 +0000 (17:15 +0000)]
Add sanity check for vcpu config

Currently Xen/Qemu support max 128 vcpus. To avoid mis-setting
at config file, this patch add sanity check for vcpu config.
1. maxvcpus and vcpus should no more than HVM_MAX_VCPUS (128)
2. vcpus should no more than maxvcpus.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
15 years agoAllow changing CD for /dev/xvdX devices. xen-4.0.0-rc7
Ian Jackson [Thu, 18 Mar 2010 16:50:44 +0000 (16:50 +0000)]
Allow changing CD for /dev/xvdX devices.

We found the issue being not able to change CD on the HVM-Domain.
It is possible on the /dev/hdc device,
but it is impossible on the/dev/xvdc device.

We want to work it as all /dev/xvdX devices on the HVM-domain
 as well as on the PV-domain.

Signed-off-by: Takanori Kasai <kasai.takanori@jp.fujitsu.com>
The execution method is as follows.
----------------------------------------------------------------------
Domain configuration file:
 disk = ["tap:aio:/<guest image file>,xvda,w", ",xvdc:cdrom,r"]

Operation that assign CD:
 # xm block-configure <domain> file:<iso image> xvdc:cdrom r

Operation that releases CD
 # xm block-configure <domain> '' xvdc:cdrom r
----------------------------------------------------------------------