]> xenbits.xensource.com Git - qemu-xen-4.3-testing.git/log
qemu-xen-4.3-testing.git
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
----------------------------------------------------------------------

15 years agoFix const-correctness in dma bitmap hex parser
Ian Jackson [Thu, 18 Mar 2010 16:48:03 +0000 (16:48 +0000)]
Fix const-correctness in dma bitmap hex parser

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoFix vcpu hotplug bug: get correct vcpu_avail bitmap
Ian Jackson [Thu, 18 Mar 2010 16:45:51 +0000 (16:45 +0000)]
Fix vcpu hotplug bug: get correct vcpu_avail bitmap

Currently qemu has a bug: When maxvcpus > 64, qemu will get wrong
vcpu bitmap (s->cpus_sts[i]) since it only get bitmap from a long variable.

This patch, cooperate with another xend python patch, is to fix this bug.
This patch get hex string from xend, transfer it to correct vcpu_avail bitmap
which saved at an uint32_t array.

Signed-off-By: Liu, Jinsong <jinsong.liu@intel.com>
(This is [PATCH 2/2], the other half is in xen-unstable.hg)

15 years agoEnable sound xen-4.0.0-rc6
Ian Jackson [Tue, 9 Mar 2010 17:55:41 +0000 (17:55 +0000)]
Enable sound

This enables sound emulation by fixing the missing feature in configure.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Contributed-by: Christian Motschke <christian@motschke.de>
(Trivial 3-line patch supplied without S-o-b from contributor.)

15 years agopassthrough: gfx_passthru: warning when vgabios rom has invalid checksum xen-4.0.0-rc5
Ian Jackson [Mon, 1 Mar 2010 16:14:50 +0000 (16:14 +0000)]
passthrough: gfx_passthru: warning when vgabios rom has invalid checksum

In the native environment, the VGABIOS, the expansion ROM on the
graphics card, is placed into the 0C0000h address space, and then
executed. Of course, the checksum of the ROM must be valid.

After this initialization, the system BIOS, the actual BIOS of the M/B,
can resize the expansion ROM code to reduce the amount of occupied
space. If the system BIOS resizes it, a new checksum must be calculated
and stored in the ROM image that is on the RAM.

So, normally, shadowed VGABIOS, that is placed in 0C0000h, is already
modified and its checksum must be recalculated.

Qemu-dm copies 0C0000h's contents of the dom0 to guest's 0C0000h.
Guest re-uses dom0's used-up VGABIOS.

The problem that I mentioned is about this recalculated checksum.

System BIOS must guarantee the checksum after the resizing, but,
some M/B does not.
However, after adjusting the checksum, guest seems to work, and
current qemu-dm does so. The buggy system BIOS might just forgets
to recalculate.

Signed-off-by: Noboru Iwamatsu <n_iwamatsu@jp.fujitsu.com>
Acked-by: Weidong Han <weidong.han@intel.com>
15 years agoWhen xen_platform_pci=0 also disable fixed Xen platform ioports
Ian Jackson [Thu, 18 Feb 2010 15:36:29 +0000 (15:36 +0000)]
When xen_platform_pci=0 also disable fixed Xen platform ioports

disable_pf should affect the platform's fixed ioport (used for device
hot unplug etc.)

Contributed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agopassthrough: magic protocol passthrough fix no-passthrough compile xen-4.0.0-rc4
Ian Jackson [Tue, 16 Feb 2010 17:48:20 +0000 (17:48 +0000)]
passthrough: magic protocol passthrough fix no-passthrough compile

Changeset 60b80e3ee319e908069d1603e5b73f815acdffac broke the build
when CONFIG_PASSTHROUGH was not set.

It also failed to #include a necessary header file, generating a
compiler warning.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agopassthrough: magic protocol passthrough fix fix
Ian Jackson [Tue, 16 Feb 2010 16:09:06 +0000 (16:09 +0000)]
passthrough: magic protocol passthrough fix fix

The previous changeset 60b80e3ee319e908069d1603e5b73f815acdffac had a
bug qemu-xen-unstable, in that test_pci_slot is only in 3.4-testing.
This patch makes it use the new devfn-based interface.

Contributed-by: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agopassthrough: magic ioport protocol no longer unplugs passthrough NICs xen-4.0.0-rc3
Ian Jackson [Mon, 15 Feb 2010 14:08:53 +0000 (14:08 +0000)]
passthrough: magic ioport protocol no longer unplugs passthrough NICs

On Fri, 12 Feb 2010, Zhai, Edwin wrote:
> [bugs:]
>
> 1. Pass-through NICs are also unplugged, although them have different
>    path with vnif and emulated NIC.

You are right, that is a bug and this patch should fix it.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
15 years agopassthrough: support Intel IGD passthrough with VT-D
Ian Jackson [Thu, 4 Feb 2010 17:04:48 +0000 (17:04 +0000)]
passthrough: support Intel IGD passthrough with VT-D

Some registers of Intel IGD are mapped in host bridge, so it needs to
passthrough these registers of physical host bridge to guest because
emulated host bridge in guest doesn't have these mappings.

Some VBIOSs and drivers ssume the IGD BDF (bus:device:function) is
always 00:02.0, so this patch reserves 00:02.0 for assigned IGD in
guest.

(Patch modified slightly by Ian Jackson.)

Signed-off-by: Weidong Han <weidong.han@intel.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoFix lost serial TX interrupts. Report receive overruns.
Ian Jackson [Mon, 1 Feb 2010 16:33:52 +0000 (16:33 +0000)]
Fix lost serial TX interrupts.  Report receive overruns.

This patch corrects emulation errors in QEMU's 16550 uart emulation,
which cause compatibility issues with FreeBSD's uart(9) driver.

   o Implement receive overrun status.  The FreeBSD uart(9) driver
     relies on this status in it's probe routine to determine the size
     of the FIFO supported.
   o As per the 16550 spec, do not overwrite the RX FIFO on an RX overrun.
   o Do not allow TX or RX FIFO overruns to increment the data valid count
     beyond the size of the FIFO.
   o For reads of the IIR register, only clear the "TX holding register
     empty" (THRE) interrupt if the read reports this interrupt.  This
     is required by the specification and avoids losing TX interrupts
     when other, higher priority interrupts (usually RX) are reported first.

This patch also includes a fix for a second cause of lost TX interrupts,
which was submitted by Jergen Lock, and is already in the latest QEMU.

   o If a receive interrupt is suppressed due to the FIFO not yet filling
     to its interrupt threshold, do not also supress any pending THRE
     interrupt.

A version of this patch, against the latest QEMU, has also been submitted
to the qemu-devel mailing list.

Signed-off-by: Justin T. Gibbs <gibbs@FreeBSD.org>
(cherry picked from commit 0994c7a1c4f4026f25f9b80f9b3816fc165ede4d)

15 years agouse new (replacement) mmap-batch ioctl xen-4.0.0-rc2
Ian Jackson [Thu, 14 Jan 2010 18:27:13 +0000 (18:27 +0000)]
use new (replacement) mmap-batch ioctl

Signed-off-by: Jan Beulich <jbeulich@novell.com>
From:
[PATCH, RFC 3/4] qemu: use new (replacement) mmap-batch ioctl

15 years agopassthrough: fix a printf format specifier xen-4.0.0-rc1
Ian Jackson [Fri, 8 Jan 2010 17:57:10 +0000 (17:57 +0000)]
passthrough: fix a printf format specifier

This addresses a compiler warning and makes the log entry meaningful
on 32-bit.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agopassthrough: Fix MSI-x devices assignment.
Ian Jackson [Mon, 4 Jan 2010 17:49:06 +0000 (17:49 +0000)]
passthrough: Fix MSI-x devices assignment.

Currenlty, assigned MSI-x devices fails to
work due to incorrect table_offset_adjust setting.
The last field msix_entryof struct pt_msix_info is
a variable-size array, so there shouldn't be any field
after it, otherwise they maybe destroyed
when access msix_entry.

Signed-off-by: Xiantao Zhang <xiantao.zhang@xiantao.zhang@intel.com>
15 years agopassthrough: always use hw intx and always get it from the same place
Ian Jackson [Mon, 4 Jan 2010 17:48:14 +0000 (17:48 +0000)]
passthrough: always use hw intx and always get it from the same place

The assumption that function zero always uses INTA tuns out not
to be true in the wild. This leaves us with three options.

1) Always use INTA

   This was the case before multi-function pass-through was possible.
   But with the advent of multi-function pass-through this may lead
   to excessive virtual GSI sharing.

2) Fix emulation to use INTA for function zero

3) Always use the hardware value for INTx

There doesn't seem to be much between 2) and 3) but the latter seems
slightly cleaner so I advocate that approach.

Cc: Tom Rotenberg <tom.rotenberg@gmail.com>
Cc: Edwin Zhai <edwin.zhai@intel.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
[patch 2/2] qemu-xen: pass-through: always use hw intx

From:

[patch 0/2] qemu-xen: pass-through: always use hw intx
pass-through: always use hw intx and always get it from the same place

The assumption that function zero always uses INTA tuns out not
to be true in the wild. This leaves us with three options.

1) Always use INTA

   This was the case before multi-function pass-through was possible.
   But with the advent of multi-function pass-through this may lead
   to excessive virtual GSI sharing.

2) Fix emulation to use INTA for function zero

3) Always use the hardware value for INTx

There doesn't seem to be much between 2) and 3) but the latter seems
slightly cleaner so I advocate that approach.

15 years agopassthrough: move pci_read_intx() and pci_intx()
Ian Jackson [Mon, 4 Jan 2010 17:47:03 +0000 (17:47 +0000)]
passthrough: move pci_read_intx() and pci_intx()

Move pci_read_intx() and pci_intx() to above pt_irqpin_reg_init().
This is requred for a subsequent patch where pt_irqpin_reg_init()
calls pci_read_intx().

Cc: Tom Rotenberg <tom.rotenberg@gmail.com>
Cc: Edwin Zhai <edwin.zhai@intel.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
[patch 1/2] qemu-xen: pass-through: move pci_read_intx() and pci_intx()

From:

[patch 0/2] qemu-xen: pass-through: always use hw intx
pass-through: always use hw intx and always get it from the same place

The assumption that function zero always uses INTA tuns out not
to be true in the wild. This leaves us with three options.

1) Always use INTA

   This was the case before multi-function pass-through was possible.
   But with the advent of multi-function pass-through this may lead
   to excessive virtual GSI sharing.

2) Fix emulation to use INTA for function zero

3) Always use the hardware value for INTx

There doesn't seem to be much between 2) and 3) but the latter seems
slightly cleaner so I advocate that approach.

15 years agoHVM vcpu add/remove: qemu logic for vcpu add/revmoe
Ian Jackson [Mon, 4 Jan 2010 17:12:44 +0000 (17:12 +0000)]
HVM vcpu add/remove: qemu logic for vcpu add/revmoe

-- at qemu side, get vcpu_avail which used for original cpu avail map;
-- setup gpe ioread/iowrite at qmeu;
-- setup vcpu add/remove user interface through monitor;
-- setup SCI logic;

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
[ PATCH 4/4 ] HVM vcpu add/remove: qemu logic for vcpu add/revmoe

15 years agoimplement cdrom eject from the guest
Ian Jackson [Mon, 4 Jan 2010 16:21:55 +0000 (16:21 +0000)]
implement cdrom eject from the guest

Hi all,
this patch allows a guest to eject the cdrom: when qemu detects that a
cdrom eject request ahs been issued by the guest, it writes eject to the
corresponding xenstore frontend, so that the toolstack can take care of
removing the current cdrom frontend\backend couple and create an empty one
instead.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
15 years agostubdom: fix cdrom changing
Ian Jackson [Mon, 4 Jan 2010 16:21:02 +0000 (16:21 +0000)]
stubdom: fix cdrom changing

Hi all,
the current code to change a cdrom doesn't work with stubdoms:

- media_filename set at boot time doesn't have the proper
value (that in the stubdom case is the frontend path and not the
filename);

- when a cdrom watch event is triggered, the code to decide whether the
new cdrom is valid and different from the current cdrom doesn't work for
stubdoms;

both issues are fixed by this patch, in particular now media_filename
consistently holds the frontend path for stubdoms while bs->filename
holds the filename (like in the normal qemu case) to allow comparisons
with the old cdrom filename.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
15 years agopassthrough: Fix no_wb not to crash on unknown registers
Ian Jackson [Mon, 7 Dec 2009 12:25:54 +0000 (12:25 +0000)]
passthrough: Fix no_wb not to crash on unknown registers

e2b98415256cb264bc25e6df539ec0dc9d1b85b0 broke things sometimes:

 If pt_find_reg_grp() fails and returns NULL, it will jump to out:,
 but at this time reg is still NULL (pt_find_reg() is not reached)
 which leads to a NULL dereference.

This patch fixes it.

Submitted-By: Qing He <qing.he@intel.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoxen_console: fix memory leak "type"
Ian Jackson [Fri, 4 Dec 2009 16:15:10 +0000 (16:15 +0000)]
xen_console: fix memory leak "type"

Memory leak in con_init.

Signed-off-by: Wei Kong <weikong.cn@gmail.com>
15 years agopassthough: add no_wb option for pci conf write
Ian Jackson [Fri, 6 Nov 2009 18:11:50 +0000 (18:11 +0000)]
passthough: add no_wb option for pci conf write

Current pt_pci_write_config always writes back to real pci conf
space. However, in the case of MSI address and data registers,
if guest changes the affinity of the interrupt, stale data will
be written to these registers. This is particularly a problem
if Xen uses per-CPU vector, where the interrupt in question fails
to work. This patch fixes this by adding an option to disable the
write back of certain controls.

Signed-off-by: Qing He <qing.he@intel.com>
15 years agoEnlarge the size of the global mmio_space mmio[].
Ian Jackson [Fri, 6 Nov 2009 18:10:44 +0000 (18:10 +0000)]
Enlarge the size of the global mmio_space mmio[].

With the Multi-Function passthrough, we're actually able to assign more than
32 functions to guest, so we should enlarge the MAX_MMIO. 1024 should be big
enough.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
15 years agofix drive name parsing (any_hdN erroneous local declaration)
Ian Jackson [Wed, 4 Nov 2009 17:07:57 +0000 (17:07 +0000)]
fix drive name parsing (any_hdN erroneous local declaration)

In xenstore_parse_domain_config(), 'any_hdN' is overridden by local version
accidentally.

Contributed-by: Xiaowei Yang <xiaowei.yang@intel.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoExtend max vcpu number for HVM guest
Ian Jackson [Thu, 29 Oct 2009 13:00:31 +0000 (13:00 +0000)]
Extend max vcpu number for HVM guest

Reduce size of Xen-qemu shared ioreq structure to 32 bytes. This has two
advantages:
 1. We can support up to 128 VCPUs with a single shared page
 2. If/when we want to go beyond 128 VCPUs, a whole number of ioreq_t
structures will pack into a single shared page, so a multi-page array will
have no ioreq_t straddling a page boundary

Also, while modifying qemu, replace a 32-entry vcpu-indexed array with a
dynamically-allocated array.

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoAlign MSI-X table mmap/munmap
Ian Jackson [Fri, 23 Oct 2009 16:53:23 +0000 (17:53 +0100)]
Align MSI-X table mmap/munmap

Force msi-x init mmap to a page boundary or mmap fails with:
   pt_msix_init: Error: Can't map physical MSI-X table: Invalid argument

Signed-off-by: Bruce Edge <bruce.edge@gmail.com>
15 years agofix few small memory leaks in qemu vga.c xenstore.c
Ian Jackson [Thu, 22 Oct 2009 17:38:47 +0000 (18:38 +0100)]
fix few small memory leaks in qemu vga.c xenstore.c

running qemu with valgrind I found few small memory leaks, this patch
fixes them.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
15 years agopassthrough: fix security issue with stubdoms
Ian Jackson [Wed, 21 Oct 2009 15:42:15 +0000 (16:42 +0100)]
passthrough: fix security issue with stubdoms

this patch series fixes the outstanding security problem with stubdoms
and pci passthrough.
The idea is to allow mmio, irq and ioport remapping not only if the
current domain IS_PRIV_FOR but also if the current domain has
permissions over those mmio areas, irqs and ioports.
This way a stubdom can only remap resources that currently "owns".
This patch series also moves the de\assign_device hypercalls from the
list of hypercalls made by qemu\stubdom to xend.

The two patches must be applied at the same time otherwise pci
passthrough won't work for HVM guests.

[PATCH 2 of 2] qemu: do not call xc_assign_device

This patch removes the call to xc_assign_device from qemu.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
15 years agousb hotplug in qemu-dm via xm
Ian Jackson [Tue, 20 Oct 2009 14:16:34 +0000 (15:16 +0100)]
usb hotplug in qemu-dm via xm

Add the two commands( "xm usb-add" and "xm usb-del") to add or delete
the usb device instead of do it in QEMU console.

Signed-off-by: James Song Wei <jsong@novell.com<mailto:jsong@novell.com>>
15 years agopassthrough: support passthrough in stubdoms
Ian Jackson [Tue, 13 Oct 2009 17:16:42 +0000 (18:16 +0100)]
passthrough: support passthrough in stubdoms

Few changes are needed in qemu to enable pci passthrough in stubdoms:

- we need to explicitely ask for PCI_FILL_IDENT and PCI_FILL_CLASS to
pcilib, otherwise it won't return them by default;

- we need to postpone pcilib initialization otherwise it will fail
because the pci backend is not configured yet in the pci hotplug case;

- we have to read the pci related nodes on xenstore from the guest's
path.

[PATCH 7 of 7] qemu: passthrough support in stubdoms
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
15 years agoblock: Clean up after deleting BHs
Ian Jackson [Wed, 7 Oct 2009 14:57:18 +0000 (15:57 +0100)]
block: Clean up after deleting BHs

Commit 6a7ad299 ("Call qemu_bh_delete at bdrv_aio_bh_cb") deletes emulated
aio bottom halves to prevent endless accumulation.  However, it leaves a
stale ->bh pointer, which is then waited on when the aio is reused.

Zeroing the pointer fixes the issue, allowing vmdk format images to be used.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
[ Backported from 6bbff9a0b495918309074ac60375be5f9dc868b3
  by Stefano Stabellini. ]

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoCall qemu_bh_delete at bdrv_aio_bh_cb.
Ian Jackson [Wed, 7 Oct 2009 14:53:58 +0000 (15:53 +0100)]
Call qemu_bh_delete at bdrv_aio_bh_cb.

Also replave qemu_bh_cancel with qemu_bh_delete in bdrv_aio_cancel_em.
 Otherwise the bh will live forever in the bh list.

Signed-off-by: Dor Laor <dor@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
[ Backported from 6bbff9a0b495918309074ac60375be5f9dc868b3
  by Stefano Stabellini. ]

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoImprove block range checks
Kevin Wolf [Fri, 8 May 2009 12:47:24 +0000 (14:47 +0200)]
Improve block range checks

This patch makes the range checks for block requests more strict: It fixes a
potential integer overflow and checks for negative offsets. Also, it adds the
check for compressed writes.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit fbb7b4e0804d2168f24142eebf7552adde1968dc)

15 years agocheck for bs->drv in bdrv_flush (Christoph Hellwig)
Ian Jackson [Wed, 7 Oct 2009 14:51:55 +0000 (15:51 +0100)]
check for bs->drv in bdrv_flush (Christoph Hellwig)

All the bdrv_ helpers should check for bs->drv being zero as that means
there is no backend image open.  bdrv_flush fails to perform that check
and can thus cause NULL pointer dereferences.

Found using qemu-io.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6943 c046a42c-6fe2-441c-8c8c-71466251a162

[ Backported from 6bbff9a0b495918309074ac60375be5f9dc868b3
  by Stefano Stabellini. ]

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoFix DMA API when handling an immediate error from block layer (Avi Kivity)
Ian Jackson [Wed, 7 Oct 2009 14:49:32 +0000 (15:49 +0100)]
Fix DMA API when handling an immediate error from block layer (Avi Kivity)

The block layer may signal an immediate error on an asynchronous request
by returning NULL.  The DMA API did not handle this correctly, returning
an AIO request which would never complete (and which would crash if
cancelled).

Fix by detecting the failure and propagating it.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6893 c046a42c-6fe2-441c-8c8c-71466251a162

[ Backported from 6bbff9a0b495918309074ac60375be5f9dc868b3
  by Stefano Stabellini. ]

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoFix vectored aio bounce handling immediate errors (Avi Kivity)
aliguori [Sat, 28 Mar 2009 16:11:20 +0000 (16:11 +0000)]
Fix vectored aio bounce handling immediate errors (Avi Kivity)

If a bounced vectored aio fails immediately (the inner aio submission
returning NULL) then the bounce handler erronously returns an aio
request which will never be completed (and which crashes when cancelled).

Fix by detecting that the inner request has failed and propagating the
error.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6892 c046a42c-6fe2-441c-8c8c-71466251a162
(cherry picked from commit c240b9af599d20e06a58090366be682684bd8555)

15 years agoMove block dma helpers aiocb to store dma state (Avi Kivity)
Ian Jackson [Wed, 7 Oct 2009 14:44:55 +0000 (15:44 +0100)]
Move block dma helpers aiocb to store dma state (Avi Kivity)

Use the dedicated dma aiocb to store intermediate state for dma block
transactions.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6874 c046a42c-6fe2-441c-8c8c-71466251a162

[ Backported from 6bbff9a0b495918309074ac60375be5f9dc868b3
  by Stefano Stabellini. ]

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoUse vectored aiocb storage to store vector translation state (Avi Kivity)
aliguori [Fri, 20 Mar 2009 18:26:12 +0000 (18:26 +0000)]
Use vectored aiocb storage to store vector translation state (Avi Kivity)

Now that we have a dedicated acb pool for vector translation acbs, we can
store the vector translation state in the acbs instead of in an external
structure.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6873 c046a42c-6fe2-441c-8c8c-71466251a162
(cherry picked from commit 3fb94d56c6adc96ffc4a81b58c752cc4ccfae39c)

15 years agoImplement cancellation method for dma async I/O (Avi Kivity)
aliguori [Fri, 20 Mar 2009 18:26:07 +0000 (18:26 +0000)]
Implement cancellation method for dma async I/O (Avi Kivity)

Move the dma helpers to a private aio pool, and implement a cancellation
method for them.  Should prevent issues when cancelling I/O while dma is
in progress.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6872 c046a42c-6fe2-441c-8c8c-71466251a162
(cherry picked from commit 6512a2a7106480c19183d6466a6845bc9bdf6ec0)

15 years agoConvert vectored aio emulation to use a dedicated pool (Avi Kivity)
aliguori [Fri, 20 Mar 2009 18:26:03 +0000 (18:26 +0000)]
Convert vectored aio emulation to use a dedicated pool (Avi Kivity)

This allows us to remove a hack in the vectored aio cancellation code.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6871 c046a42c-6fe2-441c-8c8c-71466251a162
(cherry picked from commit c07a9008ac6985cd5a15909c2b9977d982defc12)

15 years agoRefactor aio callback allocation to use an aiocb pool (Avi Kivity)
Ian Jackson [Wed, 7 Oct 2009 14:36:19 +0000 (15:36 +0100)]
Refactor aio callback allocation to use an aiocb pool (Avi Kivity)

Move the AIOCB allocation code to use a dedicate structure, AIOPool.  AIOCB
specific information, such as the AIOCB size and cancellation routine, is
moved into the pool.

At present, there is exactly one pool per block format driver, maintaining
the status quo.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6870 c046a42c-6fe2-441c-8c8c-71466251a162

[ Backported from 6bbff9a0b495918309074ac60375be5f9dc868b3
  by Stefano Stabellini. ]

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agorevert "fix qemu memory leak in block interface"
Ian Jackson [Wed, 7 Oct 2009 14:34:26 +0000 (15:34 +0100)]
revert "fix qemu memory leak in block interface"

"fix qemu memory leak in block interface" is not going to be needed any
more thanks to the refactoring of the block layer.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
15 years agoallow logdirty commands while paused (unbreaks 60dbe1+8f09f4)
Ian Jackson [Wed, 23 Sep 2009 14:07:47 +0000 (15:07 +0100)]
allow logdirty commands while paused (unbreaks 60dbe1+8f09f4)

60dbe1+8f09f4 breaks HVM live migration: 60dbe1 causes xc_save to
attempt to disable logdirty mode while qemu is paused. 8f09f4 disables
most commands, including logdirty, while the domain is paused. So
xc_save times out waiting for qemu to respond to the logdirty disable
command, and live migration fails. Logdirty commands issued while
paused should not affect the stability of ioemu.

Signed-off-by: Brendan Cully <brendan@cs.ubc.ca>
15 years agopassthrough: basic graphics passthrough support
Ian Jackson [Fri, 18 Sep 2009 15:41:42 +0000 (16:41 +0100)]
passthrough: basic graphics passthrough support

basic gfx passthrough support:
  - add a vga type for gfx passthrough
  - retrieve VGA bios from host 0xC0000, then load it to guest 0xC0000
  - register/unregister legacy VGA I/O ports and MMIOs for passthroughed gfx

Signed-off-by: Ben Lin <ben.y.lin@intel.com>
Signed-off-by: Weidong Han <weidong.han@intel.com>
Acked-by: Jean Guyader <jean.guyader@critix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agopxe: Don't look for PXE ROMs when running as a DM
Ian Jackson [Fri, 18 Sep 2009 15:32:58 +0000 (16:32 +0100)]
pxe: Don't look for PXE ROMs when running as a DM

Searching for PXE ROMs in attached NICs is unnecessary as the ROM
that is used is included in the hvmloader binary. In the case where
there are only pass-through NICs it will cause the boot to fail
as the NICs are not known to qemu-xen at the time that this check is made.
In other words, without this change PXE boot from a pass-through
device will fail.

This has likely been broken since I changed around the pass-through
code so that devices passed-through at boot-time are handled by hot-plug.

Signed-off-by: Simon Horman <horms@verge.net.au>
15 years agofix a compilation error if not defined MAPCACHE (eg ia64)
Ian Jackson [Fri, 18 Sep 2009 15:31:56 +0000 (16:31 +0100)]
fix a compilation error if not defined MAPCACHE (eg ia64)

60dbe1d43827cf9a57b619a8736da2319489d432 cannot be compiled on ia64:
  exec-dm.c: In function 'cpu_physical_memory_map':
  exec-dm.c:805: error: 'l' undeclared (first use in this function)
This patch fixes it.

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
15 years agoMerge branch 'latara'
Ian Jackson [Fri, 11 Sep 2009 17:34:25 +0000 (18:34 +0100)]
Merge branch 'latara'

15 years agoconsistently use TARGET_PAGE_SIZE in block-vbd.c
Ian Jackson [Fri, 11 Sep 2009 17:23:19 +0000 (18:23 +0100)]
consistently use TARGET_PAGE_SIZE in block-vbd.c

Attached patch makes ioemu's block-vbd.c use of TARGET_PAGE_SIZE.
Fixes build error on NetBSD when building stubdom.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
15 years agonon-passthrough acpi fix
Ian Jackson [Fri, 11 Sep 2009 17:20:53 +0000 (18:20 +0100)]
non-passthrough acpi fix

Attached patch fixes ACPI problems with GPE
when ioemu build w/o CONFIG_PASSTHROUGH.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
15 years agofix HVM log dirty issue
Ian Jackson [Fri, 4 Sep 2009 15:25:35 +0000 (16:25 +0100)]
fix HVM log dirty issue

These patches fix some issues for HVM log dirty in qemu:
* Add necessary logging dirty in qemu to avoid guest error with
intensive disk access when live migration
* Take place of shared memory between qemu and migration tools by new
added hypercall, which is clean and simple

Signed-Off-By: Zhai, Edwin <edwin.zhai@intel.com>
Also revert commit 32710fbdc75e055f73a63d246737ce615b9109e9.
  "[stubdom] fix the crash of HVM live migration with intensive disk access"
 as this is the proper fix.   -iwj

15 years agoFix to eject cdrom on HVM Domain
Ian Jackson [Fri, 4 Sep 2009 15:19:54 +0000 (16:19 +0100)]
Fix to eject cdrom on HVM Domain

We tried to eject cdrom(/dev/hdc) on HVM Domain.
But, cdrom media are not ejected from the cdrom device on HostOS.

The module to eject the cdrom device has already been implemented in
qemu-dm.
 But, all devices are opened as raw device for VBD.
Therefore, the module to eject the cdrom device is not work.

The cdrom device was corrected to open as a physical device on HostOS.
When eject is executed on HVM Domain, cdrom media are ejected from the
cdrom device on HostOS.

This patch corrected the problem.
Signed-off-by: Takanori Kasai <kasai.takanori@jp.fujitsu.com>
15 years agoignore xenstore events while paused
Ian Jackson [Fri, 4 Sep 2009 15:17:39 +0000 (16:17 +0100)]
ignore xenstore events while paused

when qemu is paused it shouldn't try to handle xenstore events,
especially because when xend removes nodes on xenstore some
spurious events could be generated causing qemu to exit unexpectedly.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
15 years agodisable log-throttling in xen_platform after boot
Ian Jackson [Fri, 4 Sep 2009 15:15:27 +0000 (16:15 +0100)]
disable log-throttling in xen_platform after boot

currently log throttling in xen_platform can be disabled only if a
particular key is present on xenstore at boot time.
Obviously this requirement makes it difficult to use.
This patch fixes the issue creating a watch on xenstore on the node

/local/domain/$DOMID/log-throttling

so whenever a developer wants to disable log throttling, he just has to
write 0 to /local/domain/$DOMID/log-throttling at any moment after boot.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
15 years agoremove check on ram_size
Ian Jackson [Fri, 4 Sep 2009 15:13:52 +0000 (16:13 +0100)]
remove check on ram_size

the initial check on the ram_size in qemu is completely unnecessary and
it is even broken on systems where dom0 is 32 bits while xen is 64 bits.
This patch solves the problem removing the check.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
15 years agofix qemu memory leak in block interface
Ian Jackson [Fri, 4 Sep 2009 15:12:28 +0000 (16:12 +0100)]
fix qemu memory leak in block interface

the qemu block interface leaks memory every time a read or write request
is issued, this patch fixes it.
This is also the bug that is causing stubdomains to crash under high
disk IO.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
15 years ago[stubdom] fix the crash of HVM live migration with intensive disk access
Ian Jackson [Fri, 4 Sep 2009 15:10:46 +0000 (16:10 +0100)]
[stubdom] fix the crash of HVM live migration with intensive disk access

Intensive disk access, e.g. sum of big file, during HVM live migration would
cause guest error even file system crash. Guest dmesg said
"attempt to access beyond end of device
hda1: rw=0, want=10232032112, limit=10474317"

Current map cache used by qemu dma doesn't mark the page dirty, so that these
pages(probably holding DMA data struct) are not transferred in the last
iteration during live migration.

This patch fixes it, and also merges the qemu's original dirty bitmap used by
other devices such as vga.

Signed-Off-By: Zhai Edwin <edwin.zhai@intel.com>
15 years agoDisable xenstore_dom_chmod in stubdom build.
Ian Jackson [Mon, 10 Aug 2009 17:02:56 +0000 (18:02 +0100)]
Disable xenstore_dom_chmod in stubdom build.

This change:

    commit ad202d4194eab87d3645f13e7726a4d609e42fe8
    Author: Ian Jackson <ian.jackson@eu.citrix.com>
    Date:   Tue Jul 21 15:29:43 2009 +0100

add per domain low level xenstore functions [PATCH 2/3]
add per domain low level xenstore functions (read/chmod/write/watch).

broke the stubdom build because minios's fork/version of libxenstore
does not have the xenstore chmod operation.  As xenstore_dom_chmod
is not currently used in stubdom, #if it out.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agofix vnc screen corruption bugs and viewer exits
Ian Jackson [Tue, 4 Aug 2009 14:35:46 +0000 (15:35 +0100)]
fix vnc screen corruption bugs and viewer exits

I have been having problems with display corruption using raw
encoding.

I have also been having issues with the vncviewer client exiting with
"rect too big".

These problems appear when there are rapid changes to the framebuffer
contents. [I've been using "find /" in my tests to generate a lot of text
output.]

The root cause of both problems appears to be the changing of
the underlying framebuffer data during the creation of the update.
[Hextile makes multiple passes over the data and gets badly
confused if the data changes..]

The attached patch pulls the pixel data from the "stable" old_data
buffer rather than directly from the (changing) display surface.

Submitted-by: Andrew Thomas <andrew.thomas@oracle.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agopassthrough: support the assignment of the VF of Intel 82599 10GbE Controller
Ian Jackson [Tue, 4 Aug 2009 14:28:14 +0000 (15:28 +0100)]
passthrough: support the assignment of the VF of Intel 82599 10GbE Controller

The datasheet is available at
http://download.intel.com/design/network/datashts/82599_datasheet.pdf

See 'Table 9.7. VF PCIe Configuration Space' of the datasheet, the PCI
Express Capability Structure of the VF of Intel 82599 10GbE Controller looks
trivial, e.g., the PCI Express Capabilities Register is 0, so the Capability
Version is 0 and pt_pcie_size_init() would fail.

We should not try to expose the PCIe cap of the device to guest.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
15 years agopassthrough: Use physical INTX for virtual PCI functions
Ian Jackson [Tue, 4 Aug 2009 14:25:30 +0000 (15:25 +0100)]
passthrough: Use physical INTX for virtual PCI functions

Allow virtual functions to use the legacy interrupt pin of the
corresponding physical device.  This is already half-implemented
by the code that uses pci_read_intx() in pass-through.c. This fills
in a missing piece.

An alternate solution is to reverse the previously applied pci_read_intx()
code and revert to always using INTA. However, that seems likely to lead to
excessive sharing of interrupt pins when multi-function pass-through is
used.

Tested-by: Tom Rotenberg <tom.rotenberg@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
15 years agodefault the videoram to 4MB when it is not set
Ian Jackson [Tue, 4 Aug 2009 14:24:56 +0000 (15:24 +0100)]
default the videoram to 4MB when it is not set

this patch sets the videoram size to 4MB in case the size is not set
explicitly by the user or the toolstack.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
15 years agoadd two missing cirrus_update_memory_access
Ian Jackson [Tue, 4 Aug 2009 14:23:43 +0000 (15:23 +0100)]
add two missing cirrus_update_memory_access

the cirrus emulation code misses two calls to
cirrus_update_memory_access; this fact together with the condition on the
call to cirrus_update_memory_access in cirrus_bitblt_reset can cause
segfaults in qemu.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
15 years agouse XC_PAGE_SIZE in xenfbfront (fix stubdom build on NetBSD)
Ian Jackson [Tue, 21 Jul 2009 15:08:24 +0000 (16:08 +0100)]
use XC_PAGE_SIZE in xenfbfront (fix stubdom build on NetBSD)

Apropos of a report from Christoph Egger about misuse of PAGE_SIZE in
xenfbfront; change references to XC_PAGE_SIZE which is correct in our
context.  This fix suggested by Stefano Stabillini.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agopassthrough: Fix pci bar remapping when guest probes width with all-1 BAR
Ian Jackson [Tue, 21 Jul 2009 14:33:30 +0000 (15:33 +0100)]
passthrough: Fix pci bar remapping when guest probes width with all-1 BAR

When guest code tries to get the block size of mmio, it will write all "1"s
into pci bar register and then qemu will return all "0"s to the don't care
bits in the emulated bar register to indicate the block size to guest code.
In this case, we should not create p2m mapping in  pt_bar_reg_write() and
pt_exp_rom_bar_reg_write(). Attached patch fixes this issue, additional
comment can be found in the patch.

Signed-off-by: Wei Wang <wei.wang2@amd.com>
15 years agoadd low level functions from the root (read/write). [PATCH 3/3]
Ian Jackson [Tue, 21 Jul 2009 14:30:18 +0000 (15:30 +0100)]
add low level functions from the root (read/write).  [PATCH 3/3]

This is a series of patch to complete the xenstore interface in qemu.

1: create a callback mecanism for xenstore watches.
2: add per domain low level xenstore functions (read/chmod/write/watch).
3: add low level functions from the root (read/write).

Signed-off-by: Jean Guyader <jean.guyader@citrix.com>
15 years agoadd per domain low level xenstore functions [PATCH 2/3]
Ian Jackson [Tue, 21 Jul 2009 14:29:43 +0000 (15:29 +0100)]
add per domain low level xenstore functions [PATCH 2/3]

add per domain low level xenstore functions (read/chmod/write/watch).

This is a series of patch to complete the xenstore interface in qemu.

1: create a callback mecanism for xenstore watches.
2: add per domain low level xenstore functions (read/chmod/write/watch).
3: add low level functions from the root (read/write).

Signed-off-by: Jean Guyader <jean.guyader@citrix.com>
15 years agocreate a callback mechanism for xenstore watches [PATCH 1/3]
Ian Jackson [Tue, 21 Jul 2009 14:27:00 +0000 (15:27 +0100)]
create a callback mechanism for xenstore watches [PATCH 1/3]

This is a series of patch to complete the xenstore interface in qemu.

1: create a callback mecanism for xenstore watches.
2: add per domain low level xenstore functions (read/chmod/write/watch).
3: add low level functions from the root (read/write).

Signed-off-by: Jean Guyader <jean.guyader@citrix.com>
15 years agopass-through: pt_reset_interrupt_and_io_mapping(): use hw INTX
Ian Jackson [Mon, 20 Jul 2009 11:26:39 +0000 (12:26 +0100)]
pass-through: pt_reset_interrupt_and_io_mapping(): use hw INTX

This fixes a few things that I missed in previous patches:

* Use the hw INTX rather than INTA in pt_reset_interrupt_and_io_mapping()
  This is consistent with other uses of pci_intx()
* Remove now inaccurate "/* fix virtual interrupt pin to INTA# */" comments
* Use PCI_SLOT()

Signed-off-by: Simon Horman <horms@verge.net.au>
15 years agoDo not #include <pci/header.h> unless CONFIG_PASSTHROUGH
Ian Jackson [Mon, 20 Jul 2009 11:22:59 +0000 (12:22 +0100)]
Do not #include <pci/header.h> unless CONFIG_PASSTHROUGH

Attached patch fixes an ioemu build error on NetBSD where
CONFIG_PASSTHROUGH is not (yet) defined.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
15 years agoportability fixes for qemu-ifup
Ian Jackson [Thu, 9 Jul 2009 14:33:48 +0000 (15:33 +0100)]
portability fixes for qemu-ifup

Attached patch applies portability fixes to ioemu's qemu-ifup script:
- rename qemu-ifup to qemu-ifup-Linux
- add qemu-ifup-NetBSD for NetBSD
- Build system picks the right one and installs just that under the
  conventional name.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
15 years agoAlways treat floppy images as raw
Ian Jackson [Wed, 8 Jul 2009 14:52:31 +0000 (15:52 +0100)]
Always treat floppy images as raw

The fix for the image format guessing vulnerability breaks raw floppy
images.  In our environment it is difficult to apply the same
configuration change as envisaged upstream, so instead we arrange to
always treat a floppy image as raw.

Two-line patch supplied by James Harper <james.harper@bendigoit.com.au>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
(cherry picked from commit f2ce5c35f60bb606bd3ddb55c361bb8a9aad5c5c)

[ Also originally committed as 342846c1eecc972fcfae84d9d1ae65a318101792
  Mistakenly dropped from qemu-xen-unstable.git and now reapplied.
  Thanks to report from James Harper.   -iwj ]