Statistics
| Branch: | Revision:

root / hw / pci-hotplug.c @ 45b23ff8

History | View | Annotate | Download (8.2 kB)

# Date Author Comment
2446333c 08/24/2010 06:22 pm Blue Swirl

Rearrange block headers

Changing block.h or blockdev.h resulted in recompiling most objects.

Move DriveInfo typedef and BlockInterfaceType enum definitions
to qemu-common.h and rearrange blockdev.h use to decrease churn.

Signed-off-by: Blue Swirl <>

3329f07b 08/23/2010 01:11 am Gerd Hoffmann

QemuOpts: make most qemu_*_opts static

Switch tree to lookup-by-name using qemu_find_opts().
Also hook up virtfs options so qemu_find_opts works for them too.

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

f2b07c92 07/11/2010 11:14 pm Isaku Yamahata

pci hotplug: make pci_device_hot_remove() static

Signed-off-by: Isaku Yamahata <>
Acked-by: Gerd Hoffmann <>
Signed-off-by: Michael S. Tsirkin <>

f8b6cc00 07/02/2010 02:18 pm Markus Armbruster

qdev: Decouple qdev_prop_drive from DriveInfo

Make the property point to BlockDriverState, cutting out the DriveInfo
middleman. This prepares the ground for block devices that don't have
a DriveInfo.

Currently all user-defined ones have a DriveInfo, because the only way...

18846dee 07/02/2010 02:18 pm Markus Armbruster

block: Catch attempt to attach multiple devices to a blockdev

For instance, -device scsi-disk,drive=foo -device scsi-disk,drive=foo
happily creates two SCSI disks connected to the same block device.
It's all downhill from there.

Device usb-storage deliberately attaches twice to the same blockdev,...

fa66b909 07/02/2010 02:18 pm Markus Armbruster

scsi: scsi_bus_legacy_handle_cmdline() can fail, fix callers

None of its callers checks for failure. scsi_hot_add() can crash
because of that:

(qemu) drive_add 4 if=scsi,format=host_device,file=/dev/sg1
scsi-generic: scsi generic interface too old
Segmentation fault (core dumped)...

666daa68 06/04/2010 04:20 pm Markus Armbruster

blockdev: Collect block device code in new blockdev.c

Anything that moves hundreds of lines out of vl.c can't be all bad.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

e075e788 05/31/2010 04:39 pm Isaku Yamahata

pci-hotplug: make them aware of pci domain.

add helper function which converts root bus to pci domain.
make them aware of pci domain.

Signed-off-by: Isaku Yamahata <>
Signed-off-by: Michael S. Tsirkin <>

6c6a58ae 05/19/2010 06:04 pm Markus Armbruster

Revert "PCI: Convert pci_device_hot_add() to QObject"

Short story: We don't want pci_add in QMP. Long story follows.

pci_add can do two things:

  • Hot plug a PCI NIC. device_add is more general.
  • Hot plug a PCI disk controller, and a drive connected to it....
b752daf0 05/19/2010 06:04 pm Markus Armbruster

Revert "monitor: Convert do_pci_device_hot_remove() to QObject"

We don't want pci_del in QMP. Use device_del instead.

This reverts commit 6848d827162fea039f2658414a4adb6164a4f9b0.

Conflicts:

hw/pci-hotplug.c
sysemu.h

Signed-off-by: Markus Armbruster <>

7f5b7d3e 04/25/2010 09:58 pm Blue Swirl

x86: remove dead assignments, spotted by clang analyzer

Value stored is never read.

Signed-off-by: Blue Swirl <>

c389c43e 04/19/2010 12:46 am Markus Armbruster

error: Drop extra messages after qemu_opts_set() and qemu_opts_parse()

Both functions report errors nicely enough now, no need for additional
messages.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Luiz Capitulino <>

8212c64f 03/16/2010 06:45 pm Markus Armbruster

qemu-option: Move the implied first name into QemuOptsList

We sometimes permit omitting the first option name, for example
-device foo is short for -device driver=foo. The name to use
("driver" in the example) is passed as argument to qemu_opts_parse()....

1ecda02b 03/16/2010 05:58 pm Markus Armbruster

error: Replace qemu_error() by error_report()

error_report() terminates the message with a newline. Strip it it
from its arguments.

This fixes a few error messages lacking a newline:
net_handle_fd_param()'s "No file descriptor named %s found", and
tap_open()'s "vnet_hdr=1 requested, but no kernel support for...

6fdb03d5 03/16/2010 05:55 pm Markus Armbruster

error: Don't abuse qemu_error() for non-error in scsi_hot_add()

Commit 30d335d6 converted an informational message from
monitor_printf() to qemu_error(), probably because the latter doesn't
need a mon argument. A later commit will make qemu_error() print...

395560c8 02/19/2010 11:18 pm Luiz Capitulino

Monitor: Convert pci_device_hot_add() to cmd_new_ret()

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

053801bc 02/19/2010 11:18 pm Luiz Capitulino

Monitor: Convert pci_device_hot_remove() to cmd_new_ret()

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

ba144141 02/10/2010 09:46 pm Luiz Capitulino

Monitor: remove unneeded checks

It's not needed to check the return of qobject_from_jsonf()
anymore, as an assert() has been added there.

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

ec7efac4 12/18/2009 07:26 pm Daniel P. Berrange

Fix backcompat for hotplug of SCSI controllers

SCSI controllers have no trouble existing without any attached
disks. This could be achieved with the (legacy) monitor syntax

pci_add pci_addr=auto storage if=scsi

This is now denied with

scsi requires a backing file/device....
7a344f7a 12/12/2009 03:59 pm Luiz Capitulino

PCI: Convert pci_device_hot_add() to QObject

Return a QDict with information about the just added device.

This commit should not change user output.

Please, note that this patch does not do error handling
conversion. In error conditions the handler still calls...

53e0d8af 12/12/2009 03:59 pm Gerd Hoffmann

pci: don't abort() when trying to hotplug with acpi off.

The PCI bus on x86 requires ACPI for hotplug support, thus disbling ACPI
also disables hotplug for the PCI bus. This patch makes qemu check
whenever the PCI bus in question can handle hotplug before trying to add...

11f4d7f4 12/12/2009 03:59 pm Gerd Hoffmann

scsi: fix drive hotplug.

This patch fills the DriveInfo->unit after hotplugging a scsi disk.
It makes a difference when auto-assigning a scsi id, where unit was
left filled with '-1' instead of the actual scsi id.

With this patch applied the the drive naming logic in drive_init() works...

c469e1dd 12/01/2009 05:51 pm Isaku Yamahata

pci: s/pci_find_host_bus/pci_find_root_bus/g

This patch renames pci_find_host_bus() to pci_find_root_bus()
as suggested by "Michael S. Tsirkin" <>.

Signed-off-by: Isaku Yamahata <>
Signed-off-by: Michael S. Tsirkin <>

e822a52a 11/09/2009 04:43 pm Isaku Yamahata

pci: make pci configuration transaction more accurate.

This patch sorts out/enhances pci code to track pci bus topology
more accurately.
- Track host bus bridge with pci domain number. Although the
current qemu implementation supports only pci domian 0 yet....

43b443b6 11/09/2009 04:43 pm Gerd Hoffmann

scsi: move scsi-disk.h -> scsi.h

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

6848d827 10/27/2009 07:28 pm Luiz Capitulino

monitor: Convert do_pci_device_hot_remove() to QObject

Errors are still directly printed, as we are only converting
regular output.

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

5b684b5a 10/27/2009 07:28 pm Gerd Hoffmann

hotplug: fix "pci_add storage if=scsi"

Explicitly add the drive to the bus of the newly created scsi adapter
instead of hoping that scsi_bus_legacy_handle_cmdline() picks it up
correctly.

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

30d335d6 10/27/2009 07:28 pm Gerd Hoffmann

hotplug: more fixes for scsi disk hotplug.

Changes:
- create common scsi_hot_add function for adding a scsi disk to
a adapter.
- Add sanity checks. You can't drive_add disks to the VGA any more.
- Ignore the unit value calculated by drive_init, add a comment...

9ad4531e 10/27/2009 07:28 pm Gerd Hoffmann

kill dead nic unplug code.

Cleanup on unplug happens via qdev->exit() callback now.

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

f6b134ac 10/15/2009 05:32 pm Mark McLoughlin

net: handle -netdevice options

Same as for -net except for:

- only tap, user, vde and socket types are supported
- the vlan parameter is not allowed
- the name parameter is not allowed but the id parameter is
required

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

ce88f890 10/12/2009 05:42 pm Juan Quintela

TARGET_I386 is always defined if TARGET_X86_64 is defined

Patchworks-ID: 35378
Signed-off-by: Juan Quintela <>
Signed-off-by: Anthony Liguori <>

33e66b86 10/07/2009 04:54 pm Markus Armbruster

Check return value of qdev_init()

But do so only where it may actually fail. Leave the rest for the
next commit.

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

c59c7ea9 10/06/2009 10:36 pm Mark McLoughlin

Port PCI NIC hotplug to QemuOpts

Signed-off-by: Mark McLoughlin <>
Signed-off-by: Anthony Liguori <>

dc1c9fe8 10/06/2009 10:36 pm Mark McLoughlin

Final net cleanup after conversion to QemuOpts

Now that net_client_init() has no users, kill it off and rename
net_client_init_from_opts().

There is no further need for the old code in net_client_parse() either.
We use qemu_opts_parse() 'firstname' facitity for that. Instead, move...

e52eb611 10/06/2009 10:36 pm Anthony Liguori

Revert "Fix exit on 'pci_add' Monitor command"

This reverts commit 0148fde54c2478ea8a47c8dbfe4c0fb8bda4d996.

As requested by Luiz.

Signed-off-by: Anthony Liguori <>

49bd1458 10/05/2009 05:32 pm Markus Armbruster

Fix pci_add storage not to exit on bad first argument

Monitor command "pci_add ADDR storage ..." does its work in
qemu_pci_hot_add_nic(). It called pci_create(..., ADDR) to create the
device. That's wrong, because pci_create() terminates the program
when ADDR is invalid....

499cf102 10/05/2009 05:32 pm Markus Armbruster

Rename pci_create_noinit() to pci_create()

It's qdev_create() specialized for PCI, so name it accordingly.

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

3f84865a 10/05/2009 05:32 pm Gerd Hoffmann

pci: windup acpi-based hotplug

Switch over acpi-based PCI hotplug for pc over to the new
qdev-based pci hotplugging.

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

56a14938 10/05/2009 05:32 pm Gerd Hoffmann

drive cleanup fixes.

Changes: * drive_uninit() wants a DriveInfo now. * drive_uninit() also calls bdrv_delete(),
so callers don't need to do that. * drive_uninit() calls are moved over to the ->exit()
callbacks, destroy_bdrvs() is zapped. * setting bdrv->private is not needed any more as the...

4db49dc0 10/05/2009 05:32 pm Gerd Hoffmann

refactor drive_hot_add

move pci device lookup into the "case IF_SCSI" section, so we
can do something else for other interface types.

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

7101174e 10/05/2009 05:32 pm Gerd Hoffmann

allow if=none for drive_add

Allow adding unconnected host drives by specifying if=none like it is
possible with -drive. They can be put in use with drive attributes,
like this:

drive_add dummy if=none,id=mydisk,file=/some/disk.img
device_add virtio-blk-pci,drive=mydisk...
a36a344d 10/05/2009 05:32 pm Gerd Hoffmann

pci: use qdev for device destruction.

pci_unregister_device is static now and hooked into Devicestate->exit.
qdev_free(pci_device) works now.

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

0148fde5 10/05/2009 05:32 pm Luiz Capitulino

Fix exit on 'pci_add' Monitor command

If the user issues one of the following commands to the Monitor:

pci_add pci_addr=auto nic model=None
pci_add pci_addr=auto nic model=?

QEMU will exit, because the function used to perform sanity
checks (qemu_check_nic_model_list()) exits on error....

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

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,......
d54908a5 09/04/2009 05:37 pm Luiz Capitulino

monitor: Port handler_1 to use QDict

This commit ports command handlers that receive one argument to use
the new monitor's dictionary.

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

f18c16de 09/04/2009 05:37 pm Luiz Capitulino

monitor: Port handler_2 to use QDict

This commit ports command handlers that receive two arguments to use
the new monitor's dictionary.

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

1d4daa91 09/04/2009 05:37 pm Luiz Capitulino

monitor: Port handler_3 to use QDict

This commit ports command handlers that receive three arguments to use
the new monitor's dictionary.

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

38183186 09/04/2009 05:37 pm Luiz Capitulino

Add wrappers to functions used by the Monitor

Some functions exported to be used by the Monitor as command
handlers are also called in other places as regular functions.

When those functions got ported to use the Monitor dictionary
to pass argments, the callers will have to setup a dictionary...

06c79f4e 08/28/2009 03:33 am Sebastian Herbszt

pci-hotplug: initialize dinfo to NULL in pci_device_hot_add

Suppress the following compiler warning emitted by at least gcc version 4.2.1 (SUSE Linux)
and gcc version 3.4.5 (mingw32 special):

hw/pci-hotplug.c: In function 'pci_device_hot_add':
hw/pci-hotplug.c:102: warning: 'dinfo' may be used uninitialized in this function...

7432ff5d 08/23/2009 09:12 am Blue Swirl

Rearrange to suppress gcc 3.3.5 warning about unused variable

Signed-off-by: Blue Swirl <>

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

qdev-ify virtio-blk.

First user of the new drive property. With this patch applied host
and guest config can be specified separately, like this:

-drive if=none,id=disk1,file=/path/to/disk.img
-device virtio-blk-pci,drive=disk1

You can set any property for virtio-blk-pci now. You can set the pci...

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

e9283f8b 06/29/2009 10:18 pm Jan Kiszka

monitor: Drop pci_addr prefix from hotplug commands

The "pci_addr=" prefix currently required by pci_add/remove and
drive_add has no practical use. Drop it, but still silently accept it
for backward compatibility.

Signed-off-by: Jan Kiszka <>...

a62acdc0 06/29/2009 10:18 pm Jan Kiszka

monitor: Make pci_add device options truely optional

Signed-off-by: Jan Kiszka <>
Signed-off-by: Anthony Liguori <>

5607c388 06/22/2009 06:15 pm Markus Armbruster

Support addr=... in option argument of -net nic

Make net_client_init() accept addr=, put the value into struct
NICinfo. Use it in pci_nic_init(), and remove arguments bus and
devfn.

Don't support addr= in third argument of monitor command pci_add,
because that clashes with its first argument. Admittedly unelegant....

1f5f6638 06/22/2009 06:15 pm Markus Armbruster

Make first argument of monitor command pci_add work

Simply pass the PCI address through qemu_pci_hot_add_nic() to
pci_nic_init() and through qemu_pci_hot_add_storage() to pci_create().

Before, pci_device_hot_add() passed along the PCI bus to use, and
ignored any user-specified slot....

c2cc47a4 06/22/2009 06:15 pm Markus Armbruster

Support addr=... in option argument of -drive if=virtio

Make drive_init() accept addr=, put the value into struct DriveInfo.
Use it in all the places that create virtio-blk-pci devices:
pc_init1(), bamboo_init(), mpc8544ds_init().

Don't support addr= in third argument of monitor command pci_add and...

d3fa1e0f 06/16/2009 11:18 pm Markus Armbruster

qdev: Fix regression in "pci_add ... storage if=virtio, ..."

qemu_pci_hot_add_storage() runs qdev_init() twice. Broken in commit
07e3af9a "Virtio-blk qdev conversion".

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

10ae5a7a 06/09/2009 01:38 pm Jan Kiszka

net: Improve parameter error reporting

As host network devices can also be instantiated via the monitor, errors
should then be reported to the related monitor instead of stderr. This
requires larger refactoring, so this patch starts small with introducing...

53c25cea 05/18/2009 08:26 pm Paul Brook

Separate virtio PCI code

Split the PCI host bindings from the VRing transport implementation.

Signed-off-by: Paul Brook <>

07e3af9a 05/15/2009 12:35 am Paul Brook

Virtio-blk qdev conversion

Signed-off-by: Paul Brook <>

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

LSI SCSI qdev conversion

Signed-off-by: Paul Brook <>

eefb4091 04/17/2009 08:10 pm aliguori

Don't fail PCI hotplug if no NIC model is supplied (Mark McLoughlin)

It's perfectly fine to not supply a NIC model when adding
a new NIC - we supply the default model to pci_nic_init()
and it uses that if one wasn't explicitly supplied.

Signed-off-by: Mark McLoughlin <>...

8707ecca 04/05/2009 08:40 pm aliguori

pci_add storage: fix error handling for 'if' parameter (Eduardo Habkost)

This fixes:

- The error message to show the actual if= argument value. It was showing
the filename instead, because 'buf' is reaused on the filename parsing.
- A bug that makes a block device to be created even when an unsupported if= arg...
376253ec 03/06/2009 01:01 am aliguori

monitor: Rework API (Jan Kiszka)

Refactor the monitor API and prepare it for decoupled terminals:
term_print functions are renamed to monitor_* and all monitor services
gain a new parameter (mon) that will once refer to the monitor instance
the output is supposed to appear on. However, the argument remains...

6f338c34 02/11/2009 05:21 pm aliguori

qemu: PCI device, disk and host network hot-add / hot-remove (Marcelo Tosatti)

Add monitor command to hot-add PCI devices (nic and storage).

Syntax is:

pci_add pci_addr=[[<domain>:]<bus>:]<slot> nic|storage params

It returns the domain, bus and slot for the newly added device on success....