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

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>