Statistics
| Branch: | Revision:

root / hw / qdev.c @ fa0be69a

History | View | Annotate | Download (20.6 kB)

# Date Author Comment
ff952ba2 02/03/2010 08:39 pm Markus Armbruster

qdev: Fix exit code for -device ?

Help was shoehorned into device creation, qdev_device_add(). Since
help doesn't create a device, it returns NULL, which looks to callers
just like failed device creation. Monitor handler do_device_add()
doesn't care, but main() exits unsuccessfully....

08350cf0 02/03/2010 08:39 pm Markus Armbruster

qdev: Add help for device properties

Option "-device DRIVER,?" and monitor command "device_add DRIVER,?"
print the supported properties instead of creating a device. The
former also terminates the program.

This is commit 2ba6edf0 (just reverted) done right....

117f8eb8 02/03/2010 08:39 pm Markus Armbruster

qdev: Add rudimentary help for property value

This provides the same information as reverted commit 2ba6edf0. Not
much, just better than nothing.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Anthony Liguori <>

98b19252 01/20/2010 04:25 pm Amit Shah

virtio-console: qdev conversion, new virtio-serial-bus

This commit converts the virtio-console device to create a new
virtio-serial bus that can host console and generic serial ports. The
file hosting this code is now called virtio-serial-bus.c.

The virtio console is now a very simple qdev device that sits on the...

458fb679 12/12/2009 03:59 pm Gerd Hoffmann

qdev: make compat stuff more generic

This patch renames the compat properties into global properties and
makes them more generic. The compatibility stuff is only one of
multiple possible users now.

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

70cca6d8 12/03/2009 06:04 pm Juan Quintela

qdev: enable vmstate_unregister() support

Now vmstate_unregister have the right type

Signed-off-by: Juan Quintela <>
Signed-off-by: Anthony Liguori <>

3ced9f7a 12/03/2009 05:41 pm Luiz Capitulino

qdev: Use QError for 'device not found' error

Please, note that we will lose the "Try -device '?' for a list"
hint as it's qdev specific.

Signed-off-by: Luiz Capitulino <>
Signed-off-by: Anthony Liguori <>

593831de 11/12/2009 07:23 pm Amit Shah

qdev: Check if unplug handler exists before calling it

A bus may have hotplugging enabled but not have the 'unplug'
callback defined, which would lead to a crash on trying to
unplug a device on the bus.

Fix by introducing an assert to check if the callback is valid....

0958b4cc 10/30/2009 03:39 pm Gerd Hoffmann

usb core: use qdev for -usbdevice

This patchs adds infrastructure to handle -usbdevice via qdev callbacks.
USBDeviceInfo gets a name field (for the -usbdevice driver name) and a
callback for -usbdevice parameter parsing.

The new usbdevice_create() function walks the qdev driver list and looks...

1cc33683 10/27/2009 07:28 pm Gerd Hoffmann

zap DeviceState->nd

No users left.
Also cleanup obsolete helper functions.

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

97b15621 10/27/2009 07:28 pm Gerd Hoffmann

virtio: use qdev properties for configuration.

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

ed16ab5a 10/27/2009 07:28 pm Gerd Hoffmann

qdev/net: common nic property bits

Add a new type for properties common to all nics.
Add helper functions and macros to deal with it.

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

283c7c63 10/15/2009 05:32 pm Mark McLoughlin

net: allow NICs to be connected to netdevs

Introduce a 'peer' member to VLANClientState as an alternative
to a vlan. The idea being that packets are transfered directly
from peer clients rather than going through a vlan.

Patchworks-ID: 35516
Signed-off-by: Mark McLoughlin <>...

5c17ca25 10/07/2009 04:54 pm Markus Armbruster

Clean up test for qdev_init() failure

Some callers test for != 0, some for < 0. Normalize to < 0.

Patchworks-ID: 35171
Signed-off-by: Markus Armbruster <>
Signed-off-by: Anthony Liguori <>

e23a1b33 10/07/2009 04:54 pm Markus Armbruster

New qdev_init_nofail()

Like qdev_init(), but terminate program via hw_error() instead of
returning an error value.

Use it instead of qdev_init() where terminating the program on failure
is okay, either because it's during machine construction, or because...

18cfeb52 10/07/2009 04:54 pm Markus Armbruster

Make qdev_init() destroy the device on failure

Before, every caller had to do this. Only two actually did.

Patchworks-ID: 35170
Signed-off-by: Markus Armbruster <>
Signed-off-by: Anthony Liguori <>

cdaed7c7 10/06/2009 10:46 pm Gerd Hoffmann

qdev: move comment

Move comment back next to main_system_bus to avoid confusion.

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

c8cd1fcd 10/05/2009 05:32 pm Amit Shah

qdev: show name of device that fails init

When initialising a device fails, show the name of the failing device.

The current behaviour is to silently exit on such errors.

Signed-off-by: Amit Shah <>
Signed-off-by: Anthony Liguori <>

7f23f812 10/05/2009 05:32 pm Michael S. Tsirkin

qemu/qdev: type safety in reset handler

Add type safety to qdev reset handlers, by declaring them as
DeviceState * rather than void *.

Signed-off-by: Michael S. Tsirkin <>
Signed-off-by: Anthony Liguori <>

ef80b466 10/05/2009 05:32 pm Gerd Hoffmann

store a pointer to QemuOpts in DeviceState, release it when zapping a device.

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

131ec1bd 10/05/2009 05:32 pm Gerd Hoffmann

qdev: device free fixups.

Two bug fixes: * When freeing a device we unregister even stuff we didn't register in
the first place because the ->init() callback failed. * When freeing a device with child busses attached, we fail to zap the
child bus (and the devices attached to it)....

d29275f1 10/05/2009 05:32 pm Gerd Hoffmann

Add exit callback to DeviceInfo.

This adds a exit callback for device destruction to DeviceInfo, so
we can hook cleanups into qdev device destruction.

Followup patches will put that into use.

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

3418bd25 10/05/2009 05:32 pm Gerd Hoffmann

qdev hotplug: infrastructure and monitor commands.

Adds device_add and device_del commands. device_add accepts accepts
the same syntax like the -device command line switch. device_del
expects a device id. So you should tag your devices with ids if you...

cd739fb6 10/05/2009 05:32 pm Gerd Hoffmann

allow qdev busses allocations be inplace

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

3df04ac3 09/25/2009 10:57 pm Mark McLoughlin

Fix coding style issue

Replace:

if (-1  foo())

with:

if (foo()  -1)

While this coding style is not in direct contravention of our currently
ratified CODING_STYLE treaty, it could be argued that the Article 3 of
the European Convention on Human Rights (prohibiting torture and "inhuman...

72cf2d4f 09/12/2009 10:36 am Blue Swirl

Fix sys-queue.h conflict for good

Problem: Our file sys-queue.h is a copy of the BSD file, but there are
some additions and it's not entirely compatible. Because of that, there have
been conflicts with system headers on BSD systems. Some hacks have been
introduced in the commits 15cc9235840a22c289edbe064a9b3c19c5f49896,...

959f733a 09/09/2009 10:57 pm Gerd Hoffmann

qdev: integrate reset

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

391a079e 09/09/2009 10:57 pm Gerd Hoffmann

qdev: integrate vmstate

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

d52affa7 09/09/2009 10:57 pm Gerd Hoffmann

qdev/scsi: add scsi bus support to qdev, convert drivers.

  • Add SCSIBus. * Add SCSIDeviceInfo, move device callbacks here. * add qdev/scsi helper functions. * convert drivers.

Adding scsi disks via -device works now, i.e. you can do:

-drive id=sda,if=none,......
75570088 09/09/2009 10:55 pm Gerd Hoffmann

qdev: add error message to qdev_device_add().

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

286c2321 08/28/2009 04:43 am Gerd Hoffmann

qdev error logging

Use the new qemu_error() function in qdev.c

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

81a322d4 08/28/2009 04:43 am Gerd Hoffmann

qdev: add return value to init() callbacks.

Sorry folks, but it has to be. One more of these invasive qdev patches.

We have a serious design bug in the qdev interface: device init
callbacks can't signal failure because the init() callback has no
return value. This patch fixes it....

22f2e344 08/10/2009 09:11 pm Gerd Hoffmann

fix qdev_print_devinfo()

snprintf returns number of bytes needed for the output, not the number
of bytes actually written. Thus the math is wrong ...

Spotted by Markus Armbruster.

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>...

f6c64e0e 08/10/2009 09:11 pm Gerd Hoffmann

rename "info qdrv" to "info qdm"

As requested by avi: driver != device model.

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>
Message-Id:

f31d07d1 08/10/2009 09:05 pm Gerd Hoffmann

QemuOpts: switch over -device.

Make -device switch use the QemuOpts framework.
Everything should continue to work like it did before.

New: "-set device.$id.$property=$value" works.

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>...

bb87ece5 08/10/2009 09:05 pm Christoph Egger

tolower -> qemu_tolower

Use qemu_tolower() instead of tolower().
Fixes warning on NetBSD.

Signed-off-by: Christoph Egger <>
Signed-off-by: Anthony Liguori <>
Message-Id:

1b524b04 07/30/2009 05:50 pm Gerd Hoffmann

qdev: factor out qdev_print_devinfo.

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

9316d30f 07/30/2009 05:50 pm Gerd Hoffmann

qdev/core: add monitor command to list all drivers

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

751c6a17 07/27/2009 10:08 pm Gerd Hoffmann

kill drives_table

First step cleaning up the drives handling. This one does nothing but
removing drives_table[], still it became seriously big.

drive_get_index() is gone and is replaced by drives_get() which hands
out DriveInfo pointers instead of a table index. This needs adaption in...

d271de9f 07/27/2009 04:39 pm Gerd Hoffmann

qdev: create default bus names.

Create a default bus name if none is passed to qbus_create().

If the parent device has DeviceState->id set it will be used to create
the bus name,. i.e. -device lsi,id=foo will give you a scsi bus named
"foo.0".

If there is no id BusInfo->name (lowercased) will be used instead, i.e....

8ffb1bcf 07/27/2009 04:39 pm Gerd Hoffmann

qdev: bus walker + qdev_device_add()

This patch implements a parser and qdev tree walker for bus paths and
adds qdev_device_add on top of this.

A bus path can be:
(1) full path, i.e. /i440FX-pcihost/pci.0/lsi/scsi.0
(2) bus name, i.e. "scsi.0". Best used together with id= to make...

a9ff9df1 07/17/2009 02:18 pm Blue Swirl

Suppress a Sparse warning

Move the export to a file used by both qdev.c and sysbus.c.

Signed-off-by: Blue Swirl <>

ccb63de3 07/17/2009 01:28 am Gerd Hoffmann

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....

81ebb98b 07/17/2009 01:28 am Gerd Hoffmann

qdev: factor out driver search to qdev_find_info()

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

b6b61144 07/17/2009 01:28 am Gerd Hoffmann

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....

3320e56e 07/17/2009 01:28 am Gerd Hoffmann

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...

ee6847d1 07/17/2009 01:28 am Gerd Hoffmann

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....

8167ee88 07/16/2009 11:47 pm Blue Swirl

Update to a hopefully more future proof FSF address

Signed-off-by: Blue Swirl <>

ae50b274 07/10/2009 12:58 am Mark McLoughlin

Don't leak VLANClientState on PCI hot remove

destroy_nic() requires that NICInfo::private by a PCIDevice pointer,
but then goes on to require that the same pointer matches
VLANClientState::opaque.

That is no longer the case for virtio-net since qdev and wasn't...

10c4c98a 07/09/2009 03:07 pm Gerd Hoffmann

qdev: replace bus_type enum with bus_info struct.

BusInfo is filled with name and size (pretty much like I did for
DeviceInfo as well). There is also a function pointer to print
bus-specific device information to the monitor. sysbus is hooked
up there, I've also added a print function for PCI....

042f84d0 07/09/2009 03:07 pm Gerd Hoffmann

qdev: remove DeviceType

The only purpose DeviceType serves is creating a linked list of
DeviceInfo structs. This removes DeviceType and add a next field to
DeviceInfo instead, so the DeviceInfo structs can be changed that way.
Elimitates a pointless extra level of indirection....

074f2fff 06/11/2009 03:47 pm Gerd Hoffmann

qdev: move name+size into DeviceInfo (v2)

Rationale: move device information from code to data structures.

v2: Adapt the drivers missed in the first version.

Signed-off-by: Gerd Hoffmann <>

f8e76fbf 06/11/2009 02:08 am Anthony Liguori

Merge branch 'net-queue'

  • net-queue: (28 commits)
    virtio-net: Increase filter and control limits
    virtio-net: Add new RX filter controls
    virtio-net: MAC filter optimization
    virtio-net: Fix MAC filter overflow handling
    virtio-net: reorganize receive_filter()...
b9aaf7f8 06/09/2009 09:38 pm Blue Swirl

Fix Sparse warning

Signed-off-by: Blue Swirl <>

463af534 06/09/2009 01:38 pm Mark McLoughlin

net: add fd_readv() handler to qemu_new_vlan_client() args

This, apparently, is the style we prefer - all VLANClientState
should be an argument to qemu_new_vlan_client().

Signed-off-by: Mark McLoughlin <>

cda9046b 06/09/2009 01:38 pm Mark McLoughlin

net: re-name vc->fd_read() to vc->receive()

VLANClientState's fd_read() handler doesn't read from file
descriptors, it adds a buffer to the client's receive queue.

Re-name the handlers to make things a little less confusing.

Signed-off-by: Mark McLoughlin <>

98ba2632 06/08/2009 08:36 pm Gerd Hoffmann

qdev: c99 initilaizers for bus_type_names

Signed-off-by: Gerd Hoffmann <>

db241f40 06/06/2009 04:49 am Paul Brook

Fix typo

Signed-off-by: Paul Brook <>

cae4956e 06/05/2009 05:53 pm Gerd Hoffmann

qdev: add monitor command to dump the tree.

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Paul Brook <>

1431b6a1 06/05/2009 05:52 pm Paul Brook

Record device property types

Record device property types, and provide a list of properties at device
registration time.

Add a "device" property type that holds a reference to annother device.

Signed-off-by: Paul Brook <>

aca312af 06/04/2009 01:24 pm Gerd Hoffmann

qdev: kill DeviceState->name

is redundant with DeviceState->type->name

Signed-off-by: Gerd Hoffmann <>

067a3ddc 05/26/2009 04:56 pm Paul Brook

Remove qdev irq sink handling

We have both IRQ sinks and GPIO inputs. These are in principle exactly
the same thing, so remove the former.

Signed-off-by: Paul Brook <>

02e2da45 05/23/2009 02:13 am Paul Brook

Add common BusState

Implement and use a common device bus state. The main side-effect is
that creating a bus and attaching it to a parent device are no longer
separate operations. For legacy code we allow a NULL parent, but that
should go away eventually....

89a740e1 05/17/2009 04:55 pm Paul Brook

Consistently use uint64_t for int properties

I apparently failed to do this properly on the first attempt.

Signed-off-by: Paul Brook <>

6f68ecb2 05/15/2009 12:35 am Paul Brook

qdev scsi bus infrastructure

Signed-off-by: Paul Brook <>

9d07d757 05/15/2009 12:35 am Paul Brook

PCI network qdev conversion

Signed-off-by: Paul Brook <>

aae9460e 05/15/2009 12:35 am Paul Brook

Basic qdev infrastructure.

Signed-off-by: Paul Brook <>

4d6ae674 05/15/2009 12:35 am Paul Brook

qdev child bus support

Signed-off-by: Paul Brook <>