OSDN Git Service

qmiga/qemu.git
15 years agoqdev: add user-specified identifier to devices.
Gerd Hoffmann [Wed, 15 Jul 2009 11:43:34 +0000 (13:43 +0200)]
qdev: add user-specified identifier to devices.

Add id field to DeviceState.  Make "info qtree" print it.

This helps users and management apps identifying devices in monitor
output, which is especially useful with otherwise identical devices
such as two virtio disks.

This patch doesn't add a way to set the id, followup patches will do.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqdev/compat: add pc-0.10 machine type.
Gerd Hoffmann [Wed, 15 Jul 2009 11:48:22 +0000 (13:48 +0200)]
qdev/compat: add pc-0.10 machine type.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqdev: add no_user, alias and desc
Gerd Hoffmann [Wed, 15 Jul 2009 11:43:33 +0000 (13:43 +0200)]
qdev: add no_user, alias and desc

no_user: prevent users from adding certain devices.
desc: description of the device.
alias: to allow user friendly shortcuts on the command line, i.e.
  -device usbmouse  instead of  -device "QEMU USB Mouse"  or
  -device lsi       instead of  -device lsi53c895a

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqdev/compat: compat property infrastructure.
Gerd Hoffmann [Wed, 15 Jul 2009 11:48:21 +0000 (13:48 +0200)]
qdev/compat: compat property infrastructure.

This add support for switching devices into a compatibility mode
using device properties.  Machine types can have a list of properties
for specific devices attached to allow the easy creation of machine
types compatible to older qemu versions.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqdev: factor out driver search to qdev_find_info()
Gerd Hoffmann [Wed, 15 Jul 2009 11:43:32 +0000 (13:43 +0200)]
qdev: factor out driver search to qdev_find_info()

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agocleanup: drop unused struct elements from VirtIOPCIProxy.
Gerd Hoffmann [Wed, 15 Jul 2009 11:48:20 +0000 (13:48 +0200)]
cleanup: drop unused struct elements from VirtIOPCIProxy.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqdev: rework device properties.
Gerd Hoffmann [Wed, 15 Jul 2009 11:43:31 +0000 (13:43 +0200)]
qdev: rework device properties.

This patch is a major overhaul of the device properties.  The properties
are saved directly in the device state struct now, the linked list of
property values is gone.

Advantages:
  * We don't have to maintain the list with the property values.
  * The value in the property list and the value actually used by
    the device can't go out of sync any more (used to happen for
    the pci.devfn == -1 case) because there is only one place where
    the value is stored.
  * A record describing the property is required now, you can't set
    random properties any more.

There are bus-specific and device-specific properties.  The former
should be used for properties common to all bus drivers.  Typical
use case is bus addressing, i.e. pci.devfn and i2c.address.

Properties have a PropertyInfo struct attached with name, size and
function pointers to parse and print properties.  A few common property
types have PropertyInfos defined in qdev-properties.c.  Drivers are free
to implement their own very special property parsers if needed.

Properties can have default values.  If unset they are zero-filled.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomonitor: Add port write command
Jan Kiszka [Tue, 14 Jul 2009 08:20:11 +0000 (10:20 +0200)]
monitor: Add port write command

Useful for testing hardware emulations or manipulating its state to
stress guest drivers.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoInitialize PS2 keyboard / mouse state on reset
Dinesh Subhraveti [Wed, 15 Jul 2009 01:30:53 +0000 (18:30 -0700)]
Initialize PS2 keyboard / mouse state on reset

Currently only common PS2 state is initialized, leaving keyboard and
mouse specific state to contain stale values.

Signed-off-by: Dinesh Subhraveti <dineshs@us.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agofix segfault in setting migration speed
Glauber Costa [Tue, 14 Jul 2009 22:26:51 +0000 (18:26 -0400)]
fix segfault in setting migration speed

Hi,

Whoever wrote this migrate_set_speed function is totally stupid.

Any failed or completed migration keeps its state to allow probing of
migration data, but has no associated file anymore. It is, thus,
possible to crash qemu by calling migrate_set_speed after a migration
is finished (or failed, or cancelled), but before another one starts.

This patch fixes it.

Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoRemove dead i386 assembly code from softmmu_header.h
Stuart Brady [Sun, 12 Jul 2009 19:09:40 +0000 (20:09 +0100)]
Remove dead i386 assembly code from softmmu_header.h

This patch removes dead i386 assembly code from softmmu_header.h.

The code is conditional on ASM_SOFTMMU, which is never defined.
Optimisation for the fast path is already handled by tcg_out_qemu_ld()
and tcg_out_qemu_st(), so there seems to be little need for this code.

Signed-off-by: Stuart Brady <stuart.brady@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqemu-io: use BDRV_O_FILE to implement the growable open option
Christoph Hellwig [Wed, 15 Jul 2009 21:11:21 +0000 (23:11 +0200)]
qemu-io: use BDRV_O_FILE to implement the growable open option

Instead of doing our own check for protocols which fails because raw isn't
formally a protocol but special cased in find_protocol specify the BDRV_O_FILE
option to use the same code as bdrv_file_open does.

While we're at it also add the missing documentation for -g to the main
qemu-io help string.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agotlb flush cleanup
Igor Kovalenko [Sat, 11 Jul 2009 22:15:40 +0000 (02:15 +0400)]
tlb flush cleanup

Use static empty variable s_cputlb_empty_entry to clear entries,
also reset addend member when clearing entries.
This helps running with valgrind/memcheck

Signed-off-by: igor.v.kovalenko@gmail.com
--
Kind regards,
Igor V. Kovalenko
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoReset HPET config register on hpet_reset
Beth Kon [Mon, 13 Jul 2009 23:43:13 +0000 (19:43 -0400)]
Reset HPET config register on hpet_reset

Without this, after system reset, hpet does not detect transition from
non-legacy to legacy mode.

Signed-off-by: Beth Kon <eak@us.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqemu-io: Implement bdrv_load_vmstate/bdrv_save_vmstate
Kevin Wolf [Wed, 15 Jul 2009 10:06:58 +0000 (12:06 +0200)]
qemu-io: Implement bdrv_load_vmstate/bdrv_save_vmstate

The load_vmstate and save_vmstate functions are implemented as a
variation of the normal read/write operation, enabled by the -b option.
This is the same mechanism as is used to switch from read/write to
pread/pwrite.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoHandle vga= in -append
Pascal Terjan [Mon, 13 Jul 2009 15:46:42 +0000 (17:46 +0200)]
Handle vga= in -append

Here is a patch I had sent twice to the list 2 years ago.
Hopefuly this time someone will be interested

It adds support for passing vga mode to linux kernel through
vga= option in -append

Signed-off-by: Pascal Terjan <pterjan@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoioport: use uint{32, 16, 8}_t for ioport value and pio_addr_t for ioport address.
Isaku Yamahata [Tue, 14 Jul 2009 10:10:43 +0000 (19:10 +0900)]
ioport: use uint{32, 16, 8}_t for ioport value and pio_addr_t for ioport address.

Using int for cpu_{in, out}[bwl] is inconsistent with other part
because for address or value, uintN_t is used by other qemu part.
At least, softmmu, CPU{Read, Write}MemoryFunc, pci, target_phys_addr_t
and the callers of cpu_{in, out}[bwl]().
This patch removes the inconsistency.

IO port has its own address space so define pio_addr_t as uint32_t
because PCI io space width is 32bit.
And use uint{32, 16, 8}_t for ioport value.
Changing signedness of value might cause subtle issue. However
only a suspicious caller is kvm_handle_io() which is ok. And other callers
pass unsigned value in the first place.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Cc: Stuart Brady <sdbrady@ntlworld.com>
Cc: Anthony Liguori <anthony@codemonkey.ws>
Cc: Samuel Thibault <samuel.thibault@gnu.org>
Cc: Tristan Gingold <gingold@adacore.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoioport: remove some #ifdef DEBUG_UNUSED_IOPORT.
Isaku Yamahata [Tue, 14 Jul 2009 10:10:42 +0000 (19:10 +0900)]
ioport: remove some #ifdef DEBUG_UNUSED_IOPORT.

remove some #ifdef DEBUG_UNUSED_IOPORT in ioport.c
and use PRIx32 where appropriate

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Cc: Anthony Liguori <anthony@codemonkey.ws>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoraw-posix: Handle errors in raw_create
Stefan Weil [Sat, 11 Jul 2009 14:43:37 +0000 (16:43 +0200)]
raw-posix: Handle errors in raw_create

In qemu-iotests, some large images are created using qemu-img.

Without checks for errors, qemu-img will just create an
empty image, and later read / write tests will fail.

With the patch, failures during image creation are detected
and reported.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoomit 3DNOW! CPUID bits from qemu64 CPU model
Andre Przywara [Thu, 16 Jul 2009 12:49:31 +0000 (14:49 +0200)]
omit 3DNOW! CPUID bits from qemu64 CPU model

Since we recently do not disable 3DNOW! support anymore, we should
avoid setting the bits in the default qemu64 CPU model to ease
migration. TCG does not support it anyway and even AMD deprecates
it's usage nowadays.
If you want to use it in KVM, use the phenom, athlon or host CPU
model.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agohonor -S on incoming migration
Paolo Bonzini [Tue, 14 Jul 2009 16:07:50 +0000 (18:07 +0200)]
honor -S on incoming migration

-S is not honored by qemu on incoming migration.  If a domain is migrated
while paused, thus, it will start running on the remote machine; this
is wrong.

Given the trivial patch to fix this, it looks more like a thinko
than anything else, probably dating back to the qemu-kvm merge.
The interesting part is that the -S mechanism was in fact *used* when
migrating (setting autostart = 0) and the incoming migration code was
starting the VM at the end of the migration.

Since I was removing the vm_start from there, I also corrected a related
imprecision.  The code was doing a vm_stop "just in case", but we can
be sure that the VM is not running---the vm_start call in vl.c has not
been reached yet.  So the vm_stop is removed together with the vm_start.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoUpdate to a hopefully more future proof FSF address
Blue Swirl [Thu, 16 Jul 2009 20:47:01 +0000 (20:47 +0000)]
Update to a hopefully more future proof FSF address

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoSparc32: convert slavio interrupt controller to qdev
Blue Swirl [Thu, 16 Jul 2009 14:15:34 +0000 (14:15 +0000)]
Sparc32: convert slavio interrupt controller to qdev

Also increase QDEV_MAX_IRQ.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoSparc32: refactor CPU init
Blue Swirl [Thu, 16 Jul 2009 13:48:20 +0000 (13:48 +0000)]
Sparc32: refactor CPU init

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoSparc32: convert memory to qdev
Blue Swirl [Thu, 16 Jul 2009 13:48:14 +0000 (13:48 +0000)]
Sparc32: convert memory to qdev

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoSparc32: convert boot prom to qdev
Blue Swirl [Thu, 16 Jul 2009 13:48:10 +0000 (13:48 +0000)]
Sparc32: convert boot prom to qdev

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoSparc32: convert iommu to qdev
Blue Swirl [Thu, 16 Jul 2009 13:47:55 +0000 (13:47 +0000)]
Sparc32: convert iommu to qdev

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoSparc32: convert cs4231 to qdev
Blue Swirl [Thu, 16 Jul 2009 13:47:45 +0000 (13:47 +0000)]
Sparc32: convert cs4231 to qdev

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoSparc32: fix SDL zooming with TCX
Blue Swirl [Thu, 16 Jul 2009 13:45:57 +0000 (13:45 +0000)]
Sparc32: fix SDL zooming with TCX

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoDon't copy multiboot.bin into pc-bios after built
Anthony Liguori [Sat, 11 Jul 2009 13:56:38 +0000 (08:56 -0500)]
Don't copy multiboot.bin into pc-bios after built

That dirties the working directory of the tree.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoFix multiboot.bin build on mingw32
Anthony Liguori [Sat, 11 Jul 2009 13:48:29 +0000 (08:48 -0500)]
Fix multiboot.bin build on mingw32

This combination of ld/object was suggested by Bartlomiej Celary

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoFix non-ACPI Timer Interrupt Routing - v3
Anthony Liguori [Sat, 11 Jul 2009 13:20:57 +0000 (08:20 -0500)]
Fix non-ACPI Timer Interrupt Routing - v3

v1 -> v2 adds comment suggested by Ryan.
v2 -> v3 clarifies comment and corrects entry count

Signed-off-by: Beth Kon <eak@us.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agopci.c: remove unnecessary #ifdef DEBUG_PCI.
Isaku Yamahata [Tue, 7 Jul 2009 06:59:22 +0000 (15:59 +0900)]
pci.c: remove unnecessary #ifdef DEBUG_PCI.

remove unnecessary #ifdef DEBUG_PCI.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoreplace bdrv_{get, put}_buffer with bdrv_{load, save}_vmstate
Christoph Hellwig [Fri, 10 Jul 2009 21:11:57 +0000 (23:11 +0200)]
replace bdrv_{get, put}_buffer with bdrv_{load, save}_vmstate

The VM state offset is a concept internal to the image format.  Replace
the old bdrv_{get,put}_buffer method that require an index into the
image file that is constructed from the VM state offset and an offset
into the vmstate with the bdrv_{load,save}_vmstate that just take an
offset into the VM state.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agobios: Fix multiple calls into smbios_load_ex
Anthony Liguori [Fri, 10 Jul 2009 19:52:56 +0000 (14:52 -0500)]
bios: Fix multiple calls into smbios_load_ex

We're marking the used entry bitmap in smbios_load_external() for each
type we check, regardless of whether we loaded anything.  This makes
subsequent calls behave as if we've already loaded the tables from qemu
and can result in missing tables (ex. multiple type4 entries on an SMP
guest).  Only mark the bitmap if we actually load something.

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agogdbstub: x86: Support for setting segment registers
Jan Kiszka [Sat, 27 Jun 2009 07:53:51 +0000 (09:53 +0200)]
gdbstub: x86: Support for setting segment registers

This allows to set segment registers via gdb also in system emulation
mode. Basic sanity checks are applied and nothing is changed if they
fail. But screwing up the target via this interface will never be
complicated, so I avoided being too paranoid here.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agogdbstub: x86: Refactor register access
Jan Kiszka [Sat, 27 Jun 2009 07:53:51 +0000 (09:53 +0200)]
gdbstub: x86: Refactor register access

Clarify gdb's register set layout by using constants for
cpu_gdb_read/write_register.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agogdbstub: Add vCont support
Jan Kiszka [Sat, 27 Jun 2009 07:53:51 +0000 (09:53 +0200)]
gdbstub: Add vCont support

This patch adds support for the vCont remote gdb command. It is used by
gdb 6.8 or better to switch the debugging focus for single-stepping
multi-threaded targets, ie. multi-threaded application in user mode
emulation or VCPUs in system emulation.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoslirp: Fix default netmask to 255.255.255.0
Anthony Liguori [Fri, 10 Jul 2009 17:43:14 +0000 (12:43 -0500)]
slirp: Fix default netmask to 255.255.255.0

This got broken between a13a4126c8 and c92ef6a22d: old slirp code used
255.255.255.0.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoRegenerate BIOS and add patches for -boot option
Anthony Liguori [Fri, 10 Jul 2009 16:56:35 +0000 (11:56 -0500)]
Regenerate BIOS and add patches for -boot option

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoUpdate boot option documentation
Jan Kiszka [Wed, 1 Jul 2009 22:19:02 +0000 (00:19 +0200)]
Update boot option documentation

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd boot menu control via command line switch
Jan Kiszka [Wed, 1 Jul 2009 22:19:02 +0000 (00:19 +0200)]
Add boot menu control via command line switch

Disable the lengthy BIOS prompt for selecting a boot device by default,
but let the user reenable it via '-boot menu=on'.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd boot-once support
Jan Kiszka [Wed, 1 Jul 2009 22:19:02 +0000 (00:19 +0200)]
Add boot-once support

This allows to specify an exceptional boot order only for the first
startup of the guest. After reboot, qemu will switch back to the default
order (or what was specified via 'order='). Makes installing from CD
images and then booting the freshly set up harddisk more handy.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd qemu_unregister_reset
Jan Kiszka [Wed, 1 Jul 2009 22:19:02 +0000 (00:19 +0200)]
Add qemu_unregister_reset

Will be used by '-boot once=...', and should also help in other use
cases.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoRework reset handler management
Jan Kiszka [Wed, 1 Jul 2009 22:19:02 +0000 (00:19 +0200)]
Rework reset handler management

Convert the reset handler maintenance code to TAILQ services.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoMove boot_set callback backend
Jan Kiszka [Wed, 1 Jul 2009 22:19:02 +0000 (00:19 +0200)]
Move boot_set callback backend

Move registration function for the boot_set callback handler and provide
qemu_boot_set so that it can also be used outside the monitor code.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoRework -boot option
Jan Kiszka [Wed, 1 Jul 2009 22:19:02 +0000 (00:19 +0200)]
Rework -boot option

This patch changes the boot command line option to the canonical format

 -boot [order=drives][,...]

where 'drives' is using the same format as the old -boot. The format
switch allows to add the 'menu' and 'once' options in later patches. The
old format is still understood and will be processed at least for a
transition time.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd a pc-0-10 machine type for compatibility with 0.10.x
Mark McLoughlin [Wed, 8 Jul 2009 10:48:03 +0000 (11:48 +0100)]
Add a pc-0-10 machine type for compatibility with 0.10.x

Add a pc-0-10 machine type to allow a pc machine to be created with
virtio block and console devices compatibility with qemu-0.10.x.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoChange default PCI class of virtio-console to PCI_CLASS_SERIAL_OTHER
Mark McLoughlin [Tue, 7 Jul 2009 11:09:58 +0000 (12:09 +0100)]
Change default PCI class of virtio-console to PCI_CLASS_SERIAL_OTHER

We're using PCI_CLASS_DISPLAY_OTHER now, but qemu-kvm.git is using
PCI_CLASS_OTHERS because:

  "As a PCI_CLASS_DISPLAY_OTHER, it reduces primary display somehow on
   Windows XP (possibly Windows disables acceleration since it fails
   to find a driver)."

While this is valid, many versions of X will get confused by it.
Class major number of 0 gets treated as a possibly prehistoric VGA
device, and then the autoconfig logic gets confused trying to figure
out whether the virtio console or the pv vga device are the real VGA.

We should really set a proper class ID. 0x0780 (serial / other) seems
most appropriate. This shouldn't require any kernel changes, the
modalias for virtio looks like:

  alias:          pci:v00001AF4d*sv*sd*bc*sc*i*

so won't care what the base class or subclass are.

It shows up in the guest as:

  00:05.0 Communication controller: Qumranet, Inc. Virtio console

A new qdev type is introduced to allow devices using the old class
to be created for compatibility with qemu-0.10.x.

Reported-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoChange default PCI class of virtio-blk to PCI_CLASS_STORAGE_SCSI
Mark McLoughlin [Tue, 7 Jul 2009 11:09:10 +0000 (12:09 +0100)]
Change default PCI class of virtio-blk to PCI_CLASS_STORAGE_SCSI

Windows virtio driver cannot pass DTM (certification) tests while the
storage class is PCI_CLASS_STORAGE_UNKNOWN.

A new qdev type is introduced to allow devices using the old class
to be created for compatibility with qemu-0.10.x.

Reported-by: Dor Laor <dlaor@redhat.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoSparc32: convert sparc32_dma to qdev
Blue Swirl [Wed, 15 Jul 2009 20:45:19 +0000 (20:45 +0000)]
Sparc32: convert sparc32_dma to qdev

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoAvoid SIGSEGV when dumping cpu state without enabled logging
malc [Wed, 15 Jul 2009 16:52:47 +0000 (20:52 +0400)]
Avoid SIGSEGV when dumping cpu state without enabled logging

Signed-off-by: malc <av1474@comtv.ru>
15 years agoConvert fdc to qdev
Blue Swirl [Wed, 15 Jul 2009 14:41:54 +0000 (14:41 +0000)]
Convert fdc to qdev

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoSparc32: convert slavio timers to qdev
Blue Swirl [Wed, 15 Jul 2009 08:53:09 +0000 (08:53 +0000)]
Sparc32: convert slavio timers to qdev

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoSparc32/PPC: convert escc to qdev
Blue Swirl [Wed, 15 Jul 2009 08:51:32 +0000 (08:51 +0000)]
Sparc32/PPC: convert escc to qdev

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoSparc32: convert slavio_misc to qdev
Blue Swirl [Mon, 13 Jul 2009 16:51:27 +0000 (16:51 +0000)]
Sparc32: convert slavio_misc to qdev

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoSparc32: convert idreg to qdev
Blue Swirl [Mon, 13 Jul 2009 16:11:08 +0000 (16:11 +0000)]
Sparc32: convert idreg to qdev

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agotarget-ppc: enable PPC_MFTB for 44x
Baojun Wang [Fri, 3 Jul 2009 11:27:39 +0000 (19:27 +0800)]
target-ppc: enable PPC_MFTB for 44x

According to PPC440 user manual, PPC 440 supports ``mftb'' even it's a
preserved instruction:

PPC440_UM2013.pdf, p.445, table A-3

when I compile a kernel (2.6.30, bamboo_defconfig/440EP &
canyonlands/460EX), I can see ``mftb'' by using ppc-xxx-objdump
vmlinux

I have also checked the ppc 440x[456], 460S, 464, they also should support mftb.

The following patch enable mftb for all ppc 440 variants, including:
440EP, 440GP, 440x4, 440x5 and 460

Signed-off-by: Baojun Wang <wangbj@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
15 years agoppc tcg: fix wrong bit/mask of wrteei
Baojun Wang [Fri, 3 Jul 2009 10:56:57 +0000 (18:56 +0800)]
ppc tcg: fix wrong bit/mask of wrteei

Signed-off-by: Baojun Wang <wangbj@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
15 years agogdb-xml: fix hacks in powerpc register numbering
Nathan Froyd [Fri, 5 Jun 2009 02:02:28 +0000 (19:02 -0700)]
gdb-xml: fix hacks in powerpc register numbering

The powerpc xml files contained a hack--an empty, non-existent
register--for getting the register numbers to line up for
newer (XML-aware) and older (non-XML-aware) GDB.  While this hack worked
in some cases, it didn't work in all cases, notably when the user used
`finish' or `continue': GDB would attempt to read the non-existent
register and QEMU would complain.

This patch fixes things up properly.  Instead of inserting a fake
register, we explicitly declare the floating-point and SPE registers to
start at 71.  This action accomplishes the same thing as the nasty hack,
except that now GDB never tries to fetch the non-existant register 70.

Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
15 years agotarget-ppc: fix evmergelo and evmergelohi
Nathan Froyd [Thu, 4 Jun 2009 20:46:41 +0000 (13:46 -0700)]
target-ppc: fix evmergelo and evmergelohi

For 32-bit PPC targets, we translated:

evmergelo rX, rX, rY

as:

rX-lo = rY-lo
rX-hi = rX-lo

which is wrong, because we should be transferring rX-lo first.  This
problem is fixed by swapping the order in which we write the parts of
rX.

Similarly, we translated:

evmergelohi rX, rX, rY

as:

rX-lo = rY-hi
rX-hi = rX-lo

In this case, we can't swap the assignment statements, because that
would just cause problems for:

evmergelohi rX, rY, rX

Instead, we detect the first case and save rX-lo in a temporary
variable:

tmp = rX-lo
rX-lo = rY-hi
rX-hi = tmp

These problems don't occur on PPC64 targets because we don't split the
SPE registers into hi/lo parts for such targets.

Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
15 years agotarget-ppc: fix typo in _cpu_ppc_load_decr
Tristan Gingold [Mon, 27 Apr 2009 08:55:47 +0000 (10:55 +0200)]
target-ppc: fix typo in _cpu_ppc_load_decr

Use parameter 'next' to fix the hdecr case.
Also pass 'next' by value instead of pointer (more easy to read and no
performance issue for an always_inline function).

Signed-off-by: Tristan Gingold <gingold@adacore.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
15 years agoSparc32/Sparc64/PPC: convert m48txx to qdev
Blue Swirl [Sun, 12 Jul 2009 20:07:07 +0000 (20:07 +0000)]
Sparc32/Sparc64/PPC: convert m48txx to qdev

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoSparc32: convert tcx to qdev
Blue Swirl [Sun, 12 Jul 2009 19:21:36 +0000 (19:21 +0000)]
Sparc32: convert tcx to qdev

Also increase QDEV_MAX_MMIO.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoSparc32: use the OpenFirmware name for ecc
Blue Swirl [Sun, 12 Jul 2009 18:43:24 +0000 (21:43 +0300)]
Sparc32: use the OpenFirmware name for ecc

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agotarget-mips: remove useless code in gen_st_cond()
Aurelien Jarno [Sun, 12 Jul 2009 13:09:01 +0000 (15:09 +0200)]
target-mips: remove useless code in gen_st_cond()

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
15 years agoFix MIPS SC
Paul Brook [Sun, 12 Jul 2009 12:08:59 +0000 (13:08 +0100)]
Fix MIPS SC

Fix botched merge of op_ldst_sc calls to match actual implementation.
Thanks to Aurelien Jarno for diagnosing this.

Signed-off-by: Paul Brook <paul@codesourcery.com>
15 years agoSparc64: convert ebus to qdev
Blue Swirl [Sun, 12 Jul 2009 08:54:49 +0000 (08:54 +0000)]
Sparc64: convert ebus to qdev

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agosparc64: trap handling corrections
Igor Kovalenko [Sun, 12 Jul 2009 08:35:31 +0000 (12:35 +0400)]
sparc64: trap handling corrections

On Sun, Jul 12, 2009 at 12:09 PM, Blue Swirl<blauwirbel@gmail.com> wrote:
> On 7/12/09, Igor Kovalenko <igor.v.kovalenko@gmail.com> wrote:
>> Good trap handling is required to process interrupts.
>>  This patch fixes the following:
>>
>>  - sparc64 has no wim register
>>  - sparc64 has no psret register, use IE bit of pstate
>>   extract IE checking code to cpu_interrupts_enabled
>>  - alternate globals are not available if cpu has GL feature
>>   in this case bit AG of pstate is constant zero
>>  - write to pstate must actually write pstate
>>   even if cpu has GL feature
>>
>>  Also timer interrupt is handled using do_interrupt.
>
> A bit too much for one patch. Please also remove the code instead of
> commenting out.

I now excluded timer interrupt related part.
To my mind other changes are essentially tied together.

> PUT_PSR for Sparc64 needs CC_OP = CC_OP_FLAGS; like Sparc32.

Fixed, please find attached the updated version.

--
Kind regards,
Igor V. Kovalenko

15 years agoSparc32: convert eccmemctl to qdev
Blue Swirl [Sun, 12 Jul 2009 08:16:55 +0000 (08:16 +0000)]
Sparc32: convert eccmemctl to qdev

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agosparc64: fix helper_st_asi little endian case typo
Igor Kovalenko [Sat, 11 Jul 2009 20:57:03 +0000 (00:57 +0400)]
sparc64: fix helper_st_asi little endian case typo

On Sun, Jul 12, 2009 at 12:43 AM, Stuart Brady<sdbrady@ntlworld.com> wrote:
> On Sat, Jul 11, 2009 at 10:22:18PM +0400, Igor Kovalenko wrote:
>> It is clear that intention is to byte-swap value to be written, not
>> the target address.
>
> @@ -1949,13 +1949,13 @@ void helper_st_asi(target_ulong addr, ta
>     case 0x89: // Secondary LE
>         switch(size) {
>         case 2:
> -            addr = bswap16(addr);
> +            addr = bswap16(val);
>             ^^^^
> Shouldn't that be 'val = bswap16(val)' (and likewise for the 32-bit and
> 64-bit cases)?  Also needs a 'signed-off-by:'...
>
> Cheers,
> --
> Stuart Brady
>

Thanks, that part I did not runtime-tested.
Not sure if those asi stores are of any use for user-mode emulator.

Please find attached the corrected version.

Signed-off-by: igor.v.kovalenko@gmail.com
--
Kind regards,
Igor V. Kovalenko

15 years agosparc64: really initialize irq
Igor Kovalenko [Sun, 12 Jul 2009 07:43:00 +0000 (07:43 +0000)]
sparc64: really initialize irq

Allocate irq just before passing it to pci bridge initialization
and actually use it to initialize pci bridge.

Signed-off-by: igor.v.kovalenko@gmail.com
--
Kind regards,
Igor V. Kovalenko

15 years agosparc64: unify mmu tag matching code
Igor Kovalenko [Sun, 12 Jul 2009 07:41:42 +0000 (07:41 +0000)]
sparc64: unify mmu tag matching code

This patch extracts common part of sparc64 tag
matching code used by IMMU and DMMU lookups.

Signed-off-by: igor.v.kovalenko@gmail.com
--
Kind regards,
Igor V. Kovalenko

15 years agosparc64: mmu bypass mode correction
Igor Kovalenko [Sun, 12 Jul 2009 07:41:42 +0000 (07:41 +0000)]
sparc64: mmu bypass mode correction

This Implement physical address truncation in mmu bypass mode.
IMMU bypass is also active when cpu enters RED_STATE

Signed-off-by: igor.v.kovalenko@gmail.com
--
Kind regards,
Igor V. Kovalenko

15 years agoFix PCI IRQ breakage
Paul Brook [Sat, 11 Jul 2009 21:46:05 +0000 (22:46 +0100)]
Fix PCI IRQ breakage

Zero initialize the PCI bus irq count.

Signed-off-by: Paul Brook <paul@codesourcery.com>
15 years agoRevert "Fix the PCI header type of APB"
Blue Swirl [Sat, 11 Jul 2009 08:38:39 +0000 (08:38 +0000)]
Revert "Fix the PCI header type of APB"

This reverts commit e8d2a88755b849bdadaf80d19e342eade3c017bc.

15 years agoFix APB by reverting 16eaedf2668e9b347a59d73346fcc4c764c58348 partially
Blue Swirl [Sat, 11 Jul 2009 08:20:24 +0000 (08:20 +0000)]
Fix APB by reverting 16eaedf2668e9b347a59d73346fcc4c764c58348 partially

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoIndent ac97 and es1370 according to audio formatting
Anthony Liguori [Fri, 10 Jul 2009 20:32:03 +0000 (15:32 -0500)]
Indent ac97 and es1370 according to audio formatting

For the sake of consistency.  I pulled in the wrong patches from Gerd when
he did the qdev conversion.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoblock: Clean up after deleting BHs
Avi Kivity [Tue, 23 Jun 2009 13:20:36 +0000 (16:20 +0300)]
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>
15 years agoflush pending aio requests
Glauber Costa [Mon, 6 Jul 2009 13:32:09 +0000 (09:32 -0400)]
flush pending aio requests

When we finish migration, there may be pending async io requests
in flight. If we don't flush it before stage3 starting, it might be
the case that the guest loses it.

Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agokvm: Work around borken MSR_GET_INDEX_LIST
Jan Kiszka [Thu, 2 Jul 2009 20:04:48 +0000 (22:04 +0200)]
kvm: Work around borken MSR_GET_INDEX_LIST

Allocate enough memory for KVM_GET_MSR_INDEX_LIST as older kernels shot
far beyond their limits, corrupting user space memory.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqemu/virtio: mark msi vectors used on load
Michael S. Tsirkin [Sun, 5 Jul 2009 13:02:34 +0000 (16:02 +0300)]
qemu/virtio: mark msi vectors used on load

Usage of msi vectors is controlled by the guest and so needs to be
restored on load. Do this for msi vectors used by the virtio device.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqemu/msi: missing braces
Michael S. Tsirkin [Sun, 5 Jul 2009 12:58:52 +0000 (15:58 +0300)]
qemu/msi: missing braces

MSIX present bit is tested incorrectly, and only happens to work because
the bit we are testing is 0x1.  Add braces to fix this.

Reported-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqemu/msi: clean used vectors state on load
Michael S. Tsirkin [Sun, 5 Jul 2009 12:58:44 +0000 (15:58 +0300)]
qemu/msi: clean used vectors state on load

Clean up msix vector usage state on load. Since guest might have control
over it through the device, the device will have to load this state from
file.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqcow2: Fix L1 table memory allocation
Kevin Wolf [Tue, 7 Jul 2009 16:09:42 +0000 (18:09 +0200)]
qcow2: Fix L1 table memory allocation

Contrary to what one could expect, the size of L1 tables is not cluster
aligned. So as we're writing whole sectors now instead of single entries,
we need to ensure that the L1 table in memory is large enough; otherwise
write would access memory after the end of the L1 table.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqcow1: Fix qcow_aio_writev
Kevin Wolf [Tue, 30 Jun 2009 13:37:17 +0000 (15:37 +0200)]
qcow1: Fix qcow_aio_writev

Pass is_write = 1 to qcow_aio_setup when writing.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoPrefer sysfs for USB host devices
Mark McLoughlin [Fri, 3 Jul 2009 08:28:02 +0000 (09:28 +0100)]
Prefer sysfs for USB host devices

Scanning for devices via /sys/bus/usb/devices/ and using them via the
/dev/bus/usb/<bus>/<device> character devices is the prefered method
on modern kernels, so try that first.

When using SELinux and libvirt, qemu will have access to /sys/bus/usb
but not /proc/bus/usb, so although the current code will work just
fine, it will generate SELinux AVC warnings.

See also:

  https://bugzilla.redhat.com/508326

Reported-by: Daniel Berrange <berrange@redhat.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agousb-ohci: Fix endianness issue
Michael Buesch [Wed, 8 Jul 2009 19:54:28 +0000 (21:54 +0200)]
usb-ohci: Fix endianness issue

This fixes a possible endianness issue in the usb-ohci hw module.
hcca.frame and ohci->frame_number are 16bit, so use cpu_to_le16().

Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoMake sure to mark MCE defines as ULL
Anthony Liguori [Fri, 10 Jul 2009 18:39:34 +0000 (13:39 -0500)]
Make sure to mark MCE defines as ULL

Fixes build on 32-bit

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqemu-io: fix memory leak
Kevin Wolf [Fri, 10 Jul 2009 11:33:52 +0000 (13:33 +0200)]
qemu-io: fix memory leak

qemu-io leaks the request buffer whenever the read or write function isn't
executed completely down the "normal" code path.

[hch: also fix the aio and vectored variants the same way]

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
15 years agoqemu-io: add flag to mark files growable
Christoph Hellwig [Fri, 10 Jul 2009 11:33:47 +0000 (13:33 +0200)]
qemu-io: add flag to mark files growable

Add a -g flag to the open command and the main qemu-io command line to
allow opening a file growable.  This is only allowed for protocols,
mirroring the limitation exposed through bdrv_file_open.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
15 years agoqemu-io: better input validation for vector-based commands
Christoph Hellwig [Fri, 10 Jul 2009 11:33:42 +0000 (13:33 +0200)]
qemu-io: better input validation for vector-based commands

Fix up a couple of issues with validating the input of the various
length arguments for the vectored I/O commands:

 - do the alignment check on each length instead the always 0 count argument
 - use a long long varibale for the cvtnum return value so that we can check
   wether it wasn't a number
 - check for a too large argument instead of truncating it

Also refactor it into a common helper for all four calers and avoid parsing
the numbers twice.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
15 years agoqemu-io: small cleanups for the aio code
Christoph Hellwig [Fri, 10 Jul 2009 11:33:38 +0000 (13:33 +0200)]
qemu-io: small cleanups for the aio code

Address a couple of review comments from Kevin.

Signed-off-by: Christoph Hellwig <hch@lst.de>
15 years agoDisable kqemu by default at run time
Anthony Liguori [Thu, 9 Jul 2009 22:28:08 +0000 (17:28 -0500)]
Disable kqemu by default at run time

 -no-kqemu -> -enable-kqemu

kqemu is still present at compile time by default

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoMake sure to only vm_start() a failed migration if we were running to begin
Anthony Liguori [Thu, 9 Jul 2009 18:25:47 +0000 (13:25 -0500)]
Make sure to only vm_start() a failed migration if we were running to begin
with.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAllow setting qemu process name v2
Andi Kleen [Thu, 2 Jul 2009 07:34:17 +0000 (09:34 +0200)]
Allow setting qemu process name v2

Set the Linux process name to the name argument specified with name. I find
this useful to see which guests are taking CPU time in top.

This doesn't affect ps, which checks argv[0], but rewriting the
environment uses much more code, so I only used this simple way.

v2: Use separate process= argument, no prefixes.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoconfigure: Append extra cflags and ldflags
Jan Kiszka [Tue, 30 Jun 2009 19:29:03 +0000 (21:29 +0200)]
configure: Append extra cflags and ldflags

In order to allow overriding flags that are set by configure, we have to
append them instead of prepending as it is done so far.

v2: Clarify documentation.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqemu: remove control vector save
Michael S. Tsirkin [Wed, 1 Jul 2009 13:28:06 +0000 (16:28 +0300)]
qemu: remove control vector save

control vector is saved/restored by virtio-pci,
it does not belong in virtio.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agofix segfault in msix_save
Michael S. Tsirkin [Wed, 1 Jul 2009 13:28:00 +0000 (16:28 +0300)]
fix segfault in msix_save

This fixes segfault reported by Kevin Wolf,
and simplifies the code in msix_save.

Reported-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoUnregister savevm callback in eeprom93xx_free()
Mark McLoughlin [Wed, 1 Jul 2009 22:06:19 +0000 (23:06 +0100)]
Unregister savevm callback in eeprom93xx_free()

Otherwise if you hot remove an eepro100 NIC and then migrate,
you get:

  Unknown savevm section or instance 'eeprom' 0

on the destination side.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>