Ian Jackson [Mon, 16 Mar 2009 16:50:49 +0000 (16:50 +0000)]
Fix option parsing; override upstream `-d' option for `domain'.
Pending change to xend to pass arguments differently, we need to
suppress the -d logfile parameter. Also we accidentally dropped
HAS_ARG from -vcpus during the merge.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Tue, 10 Mar 2009 18:17:31 +0000 (18:17 +0000)]
introducing a DisplayAllocator interface
This patch introduces a new DisplayAllocator interface to allow
frontends to allocate the DisplaySurface for the graphic device to use.
At the moment it is used only by xenfbfront, to be able to page align
the displaysurface and also keep the same backing data across multiple
DisplaySurface resize.
Howeveri in the near future it is going to be a useful improvement for
SDL as well.
Ian Jackson [Tue, 10 Mar 2009 18:16:52 +0000 (18:16 +0000)]
fix xenfb frontend and backend
Due to the DisplayState changes the initialization order is changed
as well.
Now graphic devices are the first to be initialized and only after them
any display frontend is initialized.
Obviously this change has a direct consequence on the xenfb backend and
frontend and this patch takes care of adapting them to the new
initialization order.
Ian Jackson [Tue, 10 Mar 2009 18:13:07 +0000 (18:13 +0000)]
fix screendump (Stefano Stabellini)
this patch fixes the screendump functionality that was recently broken;
it must be applied *after* PATCH 5, 6 and 7 of the original displaystate
change patch series.
In fact the other patches make much easier to solve the screendump
problem because they make the console switching mechanism more robust.
This patch changes the graphical_console_init function to return an
allocated DisplayState instead of a QEMUConsole.
This patch contains just the graphical_console_init change and few other
modifications mainly in console.c and vl.c.
It was necessary to move the display frontends (e.g. sdl and vnc)
initialization after machine->init in vl.c.
This patch does *not* include any required changes to any device, these
changes come with the following patches.
Patch 6/7
This patch changes the QEMUMachine init functions not to take a
DisplayState as an argument because is not needed any more;
In few places the graphic hardware initialization function was called
only if DisplayState was not NULL, now they are always called.
Apart from these cases, the rest are all mechanical substitutions.
Patch 7/7
This patch updates the graphic device code to use the new
graphical_console_init function.
As for the previous patch, in few places graphical_console_init was called
only if DisplayState was not NULL, now it is always called.
Apart from these cases, the rest are all mechanical substitutions.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
As adapted by Stefano to qemu-xen-unstable in his posting:
[Xen-devel] [PATCH 6 of 13] graphical_console_init change
which also contains several following fixes.
Ian Jackson [Tue, 10 Mar 2009 18:04:43 +0000 (18:04 +0000)]
exploiting the new interface in vnc.c (Stefano Stabellini)
This patch exploits the new DisplaySurface and PixelFormat structures in
vnc, making the code easier to read allowing further improvements.
Compared to the last version I fixed a bug that prevented the hextile
encoding from working properly.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
As adapted by Stefano to qemu-xen-unstable in his posting:
[Xen-devel] [PATCH 5 of 13] exploiting the new interface in vnc.c
This patch changes the DisplayState interface adding support for
multiple frontends at the same time (sdl and vnc) and implements most
of the benefit of the shared_buf patch without the added complexity.
Currently DisplayState is managed by sdl (or vnc) and sdl (or vnc) is
also responsible for allocating the data and setting the depth.
Vga.c (or another backend) will do any necessary conversion.
The idea is to change it so that is vga.c (or another backend) together
with console.c that fully manage the DisplayState interface allocating
data and setting the depth (either 16 or 32 bit, if the guest uses a
different resolution or is in text mode, vga.c (or another backend) is
in charge of doing the conversion seamlessly).
The other idea is that DisplayState supports *multiple* frontends
like sdl and vnc; each of them can register some callbacks to be called
when a display event occurs.
The interesting changes are:
- the new structures and related functions in console.h and console.c
in particular the following functions are very helpful to manage a
DisplaySurface:
- console_select and qemu_console_resize in console.c
this two functions manage multiple consoles on a single host display
- moving code around in hw/vga.c
as for the shared_buf patch this is necessary to be able to handle a dynamic
DisplaySurface bpp
- changes to vga_draw_graphic in hw/vga.c
this is the place where the DisplaySurface buffer is shared with the
videoram, when possible;
Compared to the last version the only changes are:
- do not remove support to dpy_copy in cirrus_vga
- change the name of the displaysurface handling functions
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
As adapted by Stefano to qemu-xen-unstable in his posting:
[Xen-devel] [PATCH 4 of 13] DisplayState interface change
Ian Jackson [Tue, 10 Mar 2009 17:59:47 +0000 (17:59 +0000)]
remove bgr (Stefano Stabellini)
Do not handle bgr host displays in the backends.
Right now a bgr flag exists so that sdl can set it, if the SDL_Surface
is bgr.
Afterwards the graphic device (e.g. vga.c) does the needed conversion.
With this patch series is sdl that is responsible for rendering the format
provided by the graphic device that must provide a DisplaySurface
(ds->surface) in 16 or 32 bpp, rgb.
Afterwards sdl creates a SDL_Surface from the given DisplaySurface and
blits it into the main SDL_Surface using SDL_BlitSurface.
Everything is handled by sdl transparently, because SDL_BlitSurface is
perfectly capable of handling bgr displays by itself.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Patch adapted for qemu-xen-unstable by Stefano Stabellini. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Patch adapted for qemu-xen-unstable by Stefano Stabellini. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Also additional fixes supplied by Stefano in his message
[Xen-devel] [PATCH 2 of 13] Introduce accessors for DisplayState Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Ian Jackson [Tue, 10 Mar 2009 17:56:42 +0000 (17:56 +0000)]
Implement "info chardev" command. (Gerd Hoffmann)
This patch makes qemu keep track of the character devices in use and
implements a "info chardev" monitor command to print a list.
qemu_chr_open() sticks the devices into a linked list now. It got a new
argument (label), so there is a name for each device. It also assigns a
filename to each character device. By default it just copyes the
filename passed in. Individual drivers can fill in something else
though. qemu_chr_open_pty() sets the filename to name of the pseudo tty
allocated.
Ian Jackson [Mon, 2 Mar 2009 11:21:51 +0000 (11:21 +0000)]
Override default cache mode for disk images to write-back
Upstream qemu changed the default cache mode to write-through (ie,
O_DSYNC) which is much slower. We do not need this as we have
explicit control of cacheing with the IDE cache control commands.
Original patch by Yang Zhang modified by Ian Jackson.
Signed-off-by: Yang Zhang <yang.zhang@intel.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Mon, 2 Mar 2009 11:15:37 +0000 (11:15 +0000)]
wake up PCI passthru device on boot
Commit 8c771eb6294afc5b3754a9e3de51568d4e5986c2 enables a guest
OS to program D0-D3hot states, thus PCI passsthru devices transit
into D3hot state when the guest Windows shutdown.
That disables reboot from passthru devices because the device is
not active in the POST phase. Actually, the option ROM can't be read
from the guest bios.
Ian Jackson [Mon, 2 Mar 2009 11:13:44 +0000 (11:13 +0000)]
passthrough: MSI-X mask bit acceleration
Read MSI-X mask bit directly from the device, since buffered version
may not be up-to-date when MSI-X mask bit interception is working.
Also rebind every MSI-X vector on guest PCI BAR rebalancing so that
MSI-X mask bit intercept handler can get the correct gpa
[ Also, fix declaration of pt_msix_update_remap in pt-msi.h, which
was misspelled pt_msi_update_remap. -iwj ]
Signed-off-by: Qing He <qing.he@intel.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
The anonymouys structure inside PHPSlots only has one element,
so things can be simplified by moving the element into PHPSlots
and removing the anonymous structure.
Ian Jackson [Mon, 23 Feb 2009 11:33:56 +0000 (11:33 +0000)]
Cleanup PCI passthrough code
The patch cleanups the code of PCI passthrough.
- Use LIST_FOREACH(). Don't use lh_first, le_next directly.
- Use pci_{read, write}_block instead of "switch(len) case [124]
pci_{read, write}_{byte, word, long}();".
- Eliminate duplicate codes using PT_MEARGE_VALUE macro.
- Define PCI_ERR_* macro in pass-through.h if libpci is old.
- Remove the unreasonable loop from pt_aer_reg_{save,restore}.
- Enable pt_aer_reg_{save,restore}, even if libpci is old.
- Fix ro_mask and remove unnecessary pt_xxx_reg_write functions.
- Add "Error:" or "Warning:" to messages.
- Remove verbose messages.
Trailing whitespace does not survive some people's mailers, with the
result that their patches do not apply. Therefore in this commit I'm
removing it from the pass-through code, which is currently entirely in
the Xen tree.
This change is the result of this rune:
perl -i~ -pe 's/[\t ]*$//' hw/pass-through.[ch] hw/pt-msi.[ch]
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Thu, 19 Feb 2009 17:55:54 +0000 (17:55 +0000)]
fix raw_aio_remove list walk bug
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cherry picked and cross-ported by Ian Jackson
from Stefano's submission to qemu-devel, 18 Feb 2009 16:56:16 GMT.
Ian Jackson [Fri, 6 Feb 2009 16:16:06 +0000 (16:16 +0000)]
hw/pass-through.c: workaround for old libpci
Old versions of libpci (including the ones on the automatic tests
which control Xen staging propagation) do not define
PCI_LIB_VERSION or the PCI_ERR_{UNCOR_MASK,...} constants.
This means that change 8c771eb6294afc5b3754a9e3de51568d4e5986c2 breaks
the build. In this changeset I apply what is intended to be a
workaround for this problem but it may not be completely correct; this
is therefore perhaps an interim fix.
The potential problem is that the save/restore of some PCI passthrough
error handling registers (across suspend/resume) may not work properly
with old versions of libpci. However non-passthrough and non-suspect
use cases should now be fine.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Thu, 5 Feb 2009 15:54:13 +0000 (15:54 +0000)]
Enable guest OS to program D0-D3hot states of an assigned device
This patch enables guest OS to program D0-D3hot states of assigned
device.
This patch is revised version based on the review comments.
- Use LIST_FOREACH(). Don't use lh_first, le_next directly.
- Use pci_{read, write}_block instead of "switch(len) case [124]
pci_{read, write}_{byte, word, long}():".
Ian Jackson [Thu, 5 Feb 2009 14:45:25 +0000 (14:45 +0000)]
fix raw_aio_read/write error handling
Currently when qemu_paio_read or qemu_paio_write return an error we call
qemu_aio_release without removing the request from the list.
I know that in the current implementation qemu_paio_write/read don't return
any error, but still the behavior is wrong, especially considering
that the implementation of these two functions is likely to change in is
the future.
This patch fixes the problem adding a raw_aio_remove function that
removes the callback from the queue and also calls qemu_aio_release.
raw_aio_remove is called by raw_aio_read, raw_aio_write and
raw_aio_cancel.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Backported-by: Ian Jackson <ian.jackson@eu.citrix.com>
edgar_igl [Tue, 3 Feb 2009 23:06:34 +0000 (23:06 +0000)]
Partialy fix mmap at EOF for large pagesize targets in user-mode.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6510 c046a42c-6fe2-441c-8c8c-71466251a162
aurel32 [Tue, 3 Feb 2009 19:55:35 +0000 (19:55 +0000)]
SH4: Fix warning when compiling sh7750_regnames.c
This patch fixes a warning when compiling sh7750_regnames.c which is
caused by sh7750_regnames.h (which contains the prototype of regname())
not being included.
aliguori [Mon, 2 Feb 2009 17:10:57 +0000 (17:10 +0000)]
Add phenom CPU descriptor (Alexander Graf)
As part of my ongoing effort to make nested SVM useful, I started working to get
VMware ESX run inside KVM.
VMware couples itself pretty tightly to the CPUID, so it's a good idea to emulate
a machine that officially supports SVM and should thus exploit the powers of
nested virtualization.
This patch adds a Phenom CPU identifier, that resembles a real-world phenom
CPU as closely as possible.
Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6501 c046a42c-6fe2-441c-8c8c-71466251a162
aliguori [Mon, 2 Feb 2009 15:58:51 +0000 (15:58 +0000)]
Move the framebuffer update package out (Alexander Graf)
Currently the send_framebuffer_update_raw and send_framebuffer_update_hextile
respectively send a send_framebuffer_update packet themselves. We need to reuse
send_framebuffer_update_raw for zlib encoding though, so let's move it out.
Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6498 c046a42c-6fe2-441c-8c8c-71466251a162
aliguori [Mon, 2 Feb 2009 15:58:47 +0000 (15:58 +0000)]
Move buffer functions up (Alexander Graf)
We will need to use buffer functions in code that will end up being
below the current buffer functions. In order to not introduce any
function stub defines, let's just move them up.
Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6497 c046a42c-6fe2-441c-8c8c-71466251a162
aliguori [Mon, 2 Feb 2009 15:58:43 +0000 (15:58 +0000)]
Add some tight awareness to vnc.c (Alexander Graf)
This patch enables the vnc server to understand fundamental tight extensions.
It changes from a "Hextile or not" scheme when sending framebuffer updates to
a "preferred encoding", namely the last one set.
While this is not perfect, as actually a list of "preferred encodings" should
be kept, it's good enough for now.
Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6496 c046a42c-6fe2-441c-8c8c-71466251a162
aliguori [Mon, 2 Feb 2009 15:58:29 +0000 (15:58 +0000)]
Use VNC protocol defines (Alexander Graf)
Now that we have nice defines for all sorts of constants, let's
use them!
This patch also takes the "feature variables", currently called has_*
into a single feature int. This way adding new features is a lot
easier and doesn't clutter the VncState struct.
Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6494 c046a42c-6fe2-441c-8c8c-71466251a162
aliguori [Mon, 2 Feb 2009 15:58:25 +0000 (15:58 +0000)]
Split VNC defines to vnc.h (Alexander Graf)
The VNC protocol contains quite some constants, some of which are
currently hardcoded in the vnc.c code. This is not exactly pretty.
Let's move all those constants out to vnc.h, so they are clearly
separated. While at it, I also included other defines that will be
used later in this patch series.
Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6493 c046a42c-6fe2-441c-8c8c-71466251a162
blueswir1 [Sun, 1 Feb 2009 19:26:20 +0000 (19:26 +0000)]
Add and use #defines for PCI device classes
This patch adds and uses #defines for PCI device classes and subclases,
using a new pci_config_set_class() function, similar to the recently
added pci_config_set_vendor_id() and pci_config_set_device_id().
Change since v1: fixed compilation of hw/sun4u.c
Signed-off-by: Stuart Brady <stuart.brady@gmail.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6491 c046a42c-6fe2-441c-8c8c-71466251a162
aurel32 [Fri, 30 Jan 2009 20:15:32 +0000 (20:15 +0000)]
linux-user: fix signal.c warning
This patch fixes:
linux-user/signal.c:1403: warning: no previous prototype for 'do_sigreturn_v1'
linux-user/signal.c:1473: warning: no previous prototype for 'do_sigreturn_v2'
linux-user/signal.c:1511: warning: no previous prototype for 'do_rt_sigreturn_v1'
linux-user/signal.c:1552: warning: no previous prototype for 'do_rt_sigreturn_v2'
aurel32 [Fri, 30 Jan 2009 20:09:01 +0000 (20:09 +0000)]
linux-user: identify running binary in /proc/self/exe
Some applications like to test /proc/self/exe to find
out who they are. Fake the result of readlink() for
them. Use realpath() to return full path to binary
(which the links /proc/self/exe are)
aurel32 [Fri, 30 Jan 2009 19:59:17 +0000 (19:59 +0000)]
linux-user: Add generic env variable handling
Adds support for qemu to modify target process environment
variables using -E and -U commandline switches. This replaces
eventually the -drop-ld-preload flag.
aurel32 [Fri, 30 Jan 2009 19:48:17 +0000 (19:48 +0000)]
linuw-user fix: read() and acct() on NULL arguments
Returning efault in these cases is not correct. Originally
proposed by Thayne Harbaugh in 2007:
http://www.mail-archive.com/qemu-devel@nongnu.org/msg14658.html
aliguori [Thu, 29 Jan 2009 19:59:04 +0000 (19:59 +0000)]
check SCSI read/write requests against max LBA (Rik van Riel)
The bdrv layer uses a signed offset. Furthermore, block-raw-posix
only seeks when that offset is positive. Passing a negative offset
to block-raw-posix can result in data being written at the current
seek cursor's position.
It may be possible to exploit this to seek to the end of the disk
and extend the virtual disk by writing data to a negative sector
offset. After a reboot, this could lead to the guest having a
larger disk than it had before.
Close the hole by sanity checking the lba against the size of the
disk.
Signed-off-by: Rik van Riel <riel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6475 c046a42c-6fe2-441c-8c8c-71466251a162
aliguori [Thu, 29 Jan 2009 17:02:17 +0000 (17:02 +0000)]
MTRR support on x86, part 2 (Carl-Daniel Hailfinger)
Load and save MTRR state together with machine state.
Add support for the MTRRcap MSR which is used by the latest Bochs BIOS
and some operating systems.
Fix a typo in ext2_feature_name.
With this patch, MTRR emulation should be good enough to not trigger any
sanity checks in well behaved BIOS/kernel code.
Some corner cases for BIOS/firmware usage remain to be implemented, but
that can be deferred to another patch.
Also, MTRR accesses on hardware not supporting MTRRs should cause #GP.
That can be enforced by another patch as well.
Currently when qemu_paio_read or qemu_paio_write return an error we call
qemu_aio_release without removing the request from the list.
I know that in the current implementation qemu_paio_write\read don't return
any error, but still the behavior is wrong, especially considering
that the implementation of these two functions is likely to change in is
the future.
This patch fixes the problem adding a raw_aio_remove function that
removes the callback from the queue and also calls qemu_aio_release.
raw_aio_remove is called by raw_aio_read, raw_aio_write and
raw_aio_cancel.
aliguori [Wed, 28 Jan 2009 21:58:29 +0000 (21:58 +0000)]
SCSI divide capacity by s->cluster_size (Rik van Riel)
Paul Brook pointed out that the number of sectors reported
by the SCSI read capacity commands needs to be divided by
s->cluster_size, because bdrv_get_geometry reports the number
of 512 byte sectors, while emulated CDROMs report 2048 byte
sectors back to the guest.
This has no consequences for emulated hard disks, which use
a cluster size of 1.
aliguori: fixed typo
Signed-off-by: Rik van Riel <riel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6469 c046a42c-6fe2-441c-8c8c-71466251a162
aliguori [Wed, 28 Jan 2009 21:58:25 +0000 (21:58 +0000)]
support >2TB SCSI disks (Rik van Riel)
Implement SCSI READ(16), WRITE(16) and SAI READ CAPACITY(16) commands,
so SCSI disks larger than 2TB can work with guests that support these
newer SCSI commands.
The cast to (uint64_t) is needed because otherwise gcc will use a
signed int, which gets sign extended into uint64_t lba, resulting
in bad block numbers for READ 10 and READ 16 with block numbers
larger than 2^31.
Signed-off-by: Rik van Riel <riel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6468 c046a42c-6fe2-441c-8c8c-71466251a162
aliguori [Wed, 28 Jan 2009 21:58:22 +0000 (21:58 +0000)]
fix signed/unsigned overflows in SCSI disk (Rik van Riel)
Sector numbers can overflow on a virtual scsi disk of over 1TB
in size. Qemu's bdrv_read expects an int64_t, so fix the overflow
by going to that data type.
On large disks, we clip the capacity to 2TB instead of returning
"capacity modulo 2TB".
Turn sector_count into an unsigned to prevent a signed/unsigned
overflow with SCSI transfers larger than 2TB. We're unlikely to
ever hit this bug, but fixing it is just one line.
Signed-off-by: Rik van Riel <riel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6467 c046a42c-6fe2-441c-8c8c-71466251a162