aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 1 | /* |
| 2 | * QEMU PCI hotplug support |
| 3 | * |
| 4 | * Copyright (c) 2004 Fabrice Bellard |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | * of this software and associated documentation files (the "Software"), to deal |
| 8 | * in the Software without restriction, including without limitation the rights |
| 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 10 | * copies of the Software, and to permit persons to whom the Software is |
| 11 | * furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included in |
| 14 | * all copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 22 | * THE SOFTWARE. |
| 23 | */ |
| 24 | |
| 25 | #include "hw.h" |
| 26 | #include "boards.h" |
| 27 | #include "pci.h" |
| 28 | #include "net.h" |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 29 | #include "pc.h" |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 30 | #include "monitor.h" |
Gerd Hoffmann | 43b443b | 2009-10-30 09:54:00 +0100 | [diff] [blame] | 31 | #include "scsi.h" |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 32 | #include "virtio-blk.h" |
Mark McLoughlin | c59c7ea | 2009-10-06 12:17:15 +0100 | [diff] [blame] | 33 | #include "qemu-config.h" |
Blue Swirl | 2446333 | 2010-08-24 15:22:24 +0000 | [diff] [blame] | 34 | #include "blockdev.h" |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 35 | |
Juan Quintela | ce88f89 | 2009-10-08 00:00:00 +0200 | [diff] [blame] | 36 | #if defined(TARGET_I386) |
Markus Armbruster | 1f5f663 | 2009-06-18 15:14:09 +0200 | [diff] [blame] | 37 | static PCIDevice *qemu_pci_hot_add_nic(Monitor *mon, |
Mark McLoughlin | c59c7ea | 2009-10-06 12:17:15 +0100 | [diff] [blame] | 38 | const char *devaddr, |
| 39 | const char *opts_str) |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 40 | { |
Mark McLoughlin | c59c7ea | 2009-10-06 12:17:15 +0100 | [diff] [blame] | 41 | QemuOpts *opts; |
Gerd Hoffmann | 53e0d8a | 2009-12-10 11:11:05 +0100 | [diff] [blame] | 42 | PCIBus *bus; |
| 43 | int ret, devfn; |
| 44 | |
| 45 | bus = pci_get_bus_devfn(&devfn, devaddr); |
| 46 | if (!bus) { |
| 47 | monitor_printf(mon, "Invalid PCI device address %s\n", devaddr); |
| 48 | return NULL; |
| 49 | } |
| 50 | if (!((BusState*)bus)->allow_hotplug) { |
| 51 | monitor_printf(mon, "PCI bus doesn't support hotplug\n"); |
| 52 | return NULL; |
| 53 | } |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 54 | |
Gerd Hoffmann | 3329f07 | 2010-08-20 13:52:01 +0200 | [diff] [blame] | 55 | opts = qemu_opts_parse(qemu_find_opts("net"), opts_str ? opts_str : "", 0); |
Mark McLoughlin | c59c7ea | 2009-10-06 12:17:15 +0100 | [diff] [blame] | 56 | if (!opts) { |
Mark McLoughlin | c59c7ea | 2009-10-06 12:17:15 +0100 | [diff] [blame] | 57 | return NULL; |
| 58 | } |
| 59 | |
| 60 | qemu_opt_set(opts, "type", "nic"); |
| 61 | |
Mark McLoughlin | f6b134a | 2009-10-08 19:58:27 +0100 | [diff] [blame] | 62 | ret = net_client_init(mon, opts, 0); |
aliguori | eefb409 | 2009-04-17 17:10:47 +0000 | [diff] [blame] | 63 | if (ret < 0) |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 64 | return NULL; |
Markus Armbruster | 5607c38 | 2009-06-18 15:14:08 +0200 | [diff] [blame] | 65 | if (nd_table[ret].devaddr) { |
| 66 | monitor_printf(mon, "Parameter addr not supported\n"); |
| 67 | return NULL; |
| 68 | } |
Markus Armbruster | 1f5f663 | 2009-06-18 15:14:09 +0200 | [diff] [blame] | 69 | return pci_nic_init(&nd_table[ret], "rtl8139", devaddr); |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 70 | } |
| 71 | |
Markus Armbruster | 6fdb03d | 2010-02-18 18:41:52 +0100 | [diff] [blame] | 72 | static int scsi_hot_add(Monitor *mon, DeviceState *adapter, |
| 73 | DriveInfo *dinfo, int printinfo) |
Gerd Hoffmann | 30d335d | 2009-10-14 15:30:22 +0200 | [diff] [blame] | 74 | { |
| 75 | SCSIBus *scsibus; |
| 76 | SCSIDevice *scsidev; |
| 77 | |
| 78 | scsibus = DO_UPCAST(SCSIBus, qbus, QLIST_FIRST(&adapter->child_bus)); |
| 79 | if (!scsibus || strcmp(scsibus->qbus.info->name, "SCSI") != 0) { |
Markus Armbruster | 1ecda02 | 2010-02-18 17:25:24 +0100 | [diff] [blame] | 80 | error_report("Device is not a SCSI adapter"); |
Gerd Hoffmann | 30d335d | 2009-10-14 15:30:22 +0200 | [diff] [blame] | 81 | return -1; |
| 82 | } |
| 83 | |
| 84 | /* |
| 85 | * drive_init() tries to find a default for dinfo->unit. Doesn't |
| 86 | * work at all for hotplug though as we assign the device to a |
| 87 | * specific bus instead of the first bus with spare scsi ids. |
| 88 | * |
| 89 | * Ditch the calculated value and reload from option string (if |
| 90 | * specified). |
| 91 | */ |
| 92 | dinfo->unit = qemu_opt_get_number(dinfo->opts, "unit", -1); |
Markus Armbruster | 31e1ea3 | 2011-01-28 11:21:36 +0100 | [diff] [blame] | 93 | dinfo->bus = scsibus->busnr; |
Paolo Bonzini | ce4e7e4 | 2011-11-18 16:32:00 +0100 | [diff] [blame] | 94 | scsidev = scsi_bus_legacy_add_drive(scsibus, dinfo->bdrv, dinfo->unit, |
| 95 | false, -1); |
Markus Armbruster | fa66b90 | 2010-06-25 18:53:21 +0200 | [diff] [blame] | 96 | if (!scsidev) { |
| 97 | return -1; |
| 98 | } |
Gerd Hoffmann | 11f4d7f | 2009-12-10 11:11:07 +0100 | [diff] [blame] | 99 | dinfo->unit = scsidev->id; |
Gerd Hoffmann | 30d335d | 2009-10-14 15:30:22 +0200 | [diff] [blame] | 100 | |
| 101 | if (printinfo) |
Markus Armbruster | 6fdb03d | 2010-02-18 18:41:52 +0100 | [diff] [blame] | 102 | monitor_printf(mon, "OK bus %d, unit %d\n", |
| 103 | scsibus->busnr, scsidev->id); |
Gerd Hoffmann | 30d335d | 2009-10-14 15:30:22 +0200 | [diff] [blame] | 104 | return 0; |
| 105 | } |
| 106 | |
Alexander Graf | dd97aa8 | 2010-08-23 23:43:10 +0200 | [diff] [blame] | 107 | int pci_drive_hot_add(Monitor *mon, const QDict *qdict, |
| 108 | DriveInfo *dinfo, int type) |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 109 | { |
| 110 | int dom, pci_bus; |
| 111 | unsigned slot; |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 112 | PCIDevice *dev; |
Luiz Capitulino | f18c16d | 2009-08-28 15:27:14 -0300 | [diff] [blame] | 113 | const char *pci_addr = qdict_get_str(qdict, "pci_addr"); |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 114 | |
| 115 | switch (type) { |
| 116 | case IF_SCSI: |
Gerd Hoffmann | 4db49dc | 2009-09-25 21:42:47 +0200 | [diff] [blame] | 117 | if (pci_read_devaddr(mon, pci_addr, &dom, &pci_bus, &slot)) { |
| 118 | goto err; |
| 119 | } |
Isaku Yamahata | 5256d8b | 2011-01-27 15:56:36 +0900 | [diff] [blame] | 120 | dev = pci_find_device(pci_find_root_bus(dom), pci_bus, |
| 121 | PCI_DEVFN(slot, 0)); |
Gerd Hoffmann | 4db49dc | 2009-09-25 21:42:47 +0200 | [diff] [blame] | 122 | if (!dev) { |
| 123 | monitor_printf(mon, "no pci device with address %s\n", pci_addr); |
| 124 | goto err; |
| 125 | } |
Markus Armbruster | 6fdb03d | 2010-02-18 18:41:52 +0100 | [diff] [blame] | 126 | if (scsi_hot_add(mon, &dev->qdev, dinfo, 1) != 0) { |
Gerd Hoffmann | 30d335d | 2009-10-14 15:30:22 +0200 | [diff] [blame] | 127 | goto err; |
| 128 | } |
Gerd Hoffmann | 4db49dc | 2009-09-25 21:42:47 +0200 | [diff] [blame] | 129 | break; |
| 130 | default: |
| 131 | monitor_printf(mon, "Can't hot-add drive to type %d\n", type); |
| 132 | goto err; |
| 133 | } |
Gerd Hoffmann | 4db49dc | 2009-09-25 21:42:47 +0200 | [diff] [blame] | 134 | |
Alexander Graf | dd97aa8 | 2010-08-23 23:43:10 +0200 | [diff] [blame] | 135 | return 0; |
Gerd Hoffmann | 4db49dc | 2009-09-25 21:42:47 +0200 | [diff] [blame] | 136 | err: |
Alexander Graf | dd97aa8 | 2010-08-23 23:43:10 +0200 | [diff] [blame] | 137 | return -1; |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 138 | } |
| 139 | |
Markus Armbruster | 1f5f663 | 2009-06-18 15:14:09 +0200 | [diff] [blame] | 140 | static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon, |
| 141 | const char *devaddr, |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 142 | const char *opts) |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 143 | { |
Markus Armbruster | 1f5f663 | 2009-06-18 15:14:09 +0200 | [diff] [blame] | 144 | PCIDevice *dev; |
Sebastian Herbszt | 06c79f4 | 2009-08-16 14:07:54 +0200 | [diff] [blame] | 145 | DriveInfo *dinfo = NULL; |
Gerd Hoffmann | 751c6a1 | 2009-07-22 16:42:57 +0200 | [diff] [blame] | 146 | int type = -1; |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 147 | char buf[128]; |
Markus Armbruster | 49bd145 | 2009-09-25 03:53:49 +0200 | [diff] [blame] | 148 | PCIBus *bus; |
| 149 | int devfn; |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 150 | |
| 151 | if (get_param_value(buf, sizeof(buf), "if", opts)) { |
| 152 | if (!strcmp(buf, "scsi")) |
| 153 | type = IF_SCSI; |
| 154 | else if (!strcmp(buf, "virtio")) { |
| 155 | type = IF_VIRTIO; |
aliguori | 8707ecc | 2009-04-05 17:40:55 +0000 | [diff] [blame] | 156 | } else { |
| 157 | monitor_printf(mon, "type %s not a hotpluggable PCI device.\n", buf); |
Markus Armbruster | 1f5f663 | 2009-06-18 15:14:09 +0200 | [diff] [blame] | 158 | return NULL; |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 159 | } |
| 160 | } else { |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 161 | monitor_printf(mon, "no if= specified\n"); |
Markus Armbruster | 1f5f663 | 2009-06-18 15:14:09 +0200 | [diff] [blame] | 162 | return NULL; |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 163 | } |
| 164 | |
| 165 | if (get_param_value(buf, sizeof(buf), "file", opts)) { |
Gerd Hoffmann | 751c6a1 | 2009-07-22 16:42:57 +0200 | [diff] [blame] | 166 | dinfo = add_init_drive(opts); |
| 167 | if (!dinfo) |
Markus Armbruster | 1f5f663 | 2009-06-18 15:14:09 +0200 | [diff] [blame] | 168 | return NULL; |
Gerd Hoffmann | 751c6a1 | 2009-07-22 16:42:57 +0200 | [diff] [blame] | 169 | if (dinfo->devaddr) { |
Markus Armbruster | c2cc47a | 2009-06-18 15:14:10 +0200 | [diff] [blame] | 170 | monitor_printf(mon, "Parameter addr not supported\n"); |
| 171 | return NULL; |
| 172 | } |
Blue Swirl | 7432ff5 | 2009-08-23 06:12:54 +0000 | [diff] [blame] | 173 | } else { |
| 174 | dinfo = NULL; |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 175 | } |
| 176 | |
Markus Armbruster | 49bd145 | 2009-09-25 03:53:49 +0200 | [diff] [blame] | 177 | bus = pci_get_bus_devfn(&devfn, devaddr); |
| 178 | if (!bus) { |
| 179 | monitor_printf(mon, "Invalid PCI device address %s\n", devaddr); |
| 180 | return NULL; |
| 181 | } |
Gerd Hoffmann | 53e0d8a | 2009-12-10 11:11:05 +0100 | [diff] [blame] | 182 | if (!((BusState*)bus)->allow_hotplug) { |
| 183 | monitor_printf(mon, "PCI bus doesn't support hotplug\n"); |
| 184 | return NULL; |
| 185 | } |
Markus Armbruster | 49bd145 | 2009-09-25 03:53:49 +0200 | [diff] [blame] | 186 | |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 187 | switch (type) { |
| 188 | case IF_SCSI: |
Markus Armbruster | 499cf10 | 2009-09-25 03:53:53 +0200 | [diff] [blame] | 189 | dev = pci_create(bus, devfn, "lsi53c895a"); |
Gerd Hoffmann | 5b684b5 | 2009-10-13 13:59:55 +0200 | [diff] [blame] | 190 | if (qdev_init(&dev->qdev) < 0) |
| 191 | dev = NULL; |
Daniel P. Berrange | ec7efac | 2009-12-07 20:51:49 +0000 | [diff] [blame] | 192 | if (dev && dinfo) { |
Markus Armbruster | 6fdb03d | 2010-02-18 18:41:52 +0100 | [diff] [blame] | 193 | if (scsi_hot_add(mon, &dev->qdev, dinfo, 0) != 0) { |
Gerd Hoffmann | 30d335d | 2009-10-14 15:30:22 +0200 | [diff] [blame] | 194 | qdev_unplug(&dev->qdev); |
| 195 | dev = NULL; |
| 196 | } |
Gerd Hoffmann | 5b684b5 | 2009-10-13 13:59:55 +0200 | [diff] [blame] | 197 | } |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 198 | break; |
| 199 | case IF_VIRTIO: |
Blue Swirl | 7432ff5 | 2009-08-23 06:12:54 +0000 | [diff] [blame] | 200 | if (!dinfo) { |
| 201 | monitor_printf(mon, "virtio requires a backing file/device.\n"); |
| 202 | return NULL; |
| 203 | } |
Markus Armbruster | 499cf10 | 2009-09-25 03:53:53 +0200 | [diff] [blame] | 204 | dev = pci_create(bus, devfn, "virtio-blk-pci"); |
Markus Armbruster | 18846de | 2010-06-29 16:58:30 +0200 | [diff] [blame] | 205 | if (qdev_prop_set_drive(&dev->qdev, "drive", dinfo->bdrv) < 0) { |
| 206 | qdev_free(&dev->qdev); |
| 207 | dev = NULL; |
| 208 | break; |
| 209 | } |
Gerd Hoffmann | 5b684b5 | 2009-10-13 13:59:55 +0200 | [diff] [blame] | 210 | if (qdev_init(&dev->qdev) < 0) |
| 211 | dev = NULL; |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 212 | break; |
Markus Armbruster | 1f5f663 | 2009-06-18 15:14:09 +0200 | [diff] [blame] | 213 | default: |
| 214 | dev = NULL; |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 215 | } |
Markus Armbruster | 1f5f663 | 2009-06-18 15:14:09 +0200 | [diff] [blame] | 216 | return dev; |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 217 | } |
| 218 | |
Markus Armbruster | 6c6a58a | 2010-05-12 10:53:00 +0200 | [diff] [blame] | 219 | void pci_device_hot_add(Monitor *mon, const QDict *qdict) |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 220 | { |
| 221 | PCIDevice *dev = NULL; |
Luiz Capitulino | 1d4daa9 | 2009-08-28 15:27:15 -0300 | [diff] [blame] | 222 | const char *pci_addr = qdict_get_str(qdict, "pci_addr"); |
| 223 | const char *type = qdict_get_str(qdict, "type"); |
| 224 | const char *opts = qdict_get_try_str(qdict, "opts"); |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 225 | |
Jan Kiszka | e9283f8 | 2009-06-26 00:04:00 +0200 | [diff] [blame] | 226 | /* strip legacy tag */ |
| 227 | if (!strncmp(pci_addr, "pci_addr=", 9)) { |
| 228 | pci_addr += 9; |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 229 | } |
| 230 | |
Jan Kiszka | a62acdc | 2009-06-26 00:04:10 +0200 | [diff] [blame] | 231 | if (!opts) { |
| 232 | opts = ""; |
| 233 | } |
| 234 | |
Jan Kiszka | e9283f8 | 2009-06-26 00:04:00 +0200 | [diff] [blame] | 235 | if (!strcmp(pci_addr, "auto")) |
| 236 | pci_addr = NULL; |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 237 | |
Luiz Capitulino | 395560c | 2010-02-10 23:49:55 -0200 | [diff] [blame] | 238 | if (strcmp(type, "nic") == 0) { |
Jan Kiszka | e9283f8 | 2009-06-26 00:04:00 +0200 | [diff] [blame] | 239 | dev = qemu_pci_hot_add_nic(mon, pci_addr, opts); |
Luiz Capitulino | 395560c | 2010-02-10 23:49:55 -0200 | [diff] [blame] | 240 | } else if (strcmp(type, "storage") == 0) { |
Jan Kiszka | e9283f8 | 2009-06-26 00:04:00 +0200 | [diff] [blame] | 241 | dev = qemu_pci_hot_add_storage(mon, pci_addr, opts); |
Luiz Capitulino | 395560c | 2010-02-10 23:49:55 -0200 | [diff] [blame] | 242 | } else { |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 243 | monitor_printf(mon, "invalid type: %s\n", type); |
Luiz Capitulino | 395560c | 2010-02-10 23:49:55 -0200 | [diff] [blame] | 244 | } |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 245 | |
| 246 | if (dev) { |
Markus Armbruster | 6c6a58a | 2010-05-12 10:53:00 +0200 | [diff] [blame] | 247 | monitor_printf(mon, "OK domain %d, bus %d, slot %d, function %d\n", |
Isaku Yamahata | e075e78 | 2010-05-28 18:30:46 +0900 | [diff] [blame] | 248 | pci_find_domain(dev->bus), |
| 249 | pci_bus_num(dev->bus), PCI_SLOT(dev->devfn), |
Markus Armbruster | 6c6a58a | 2010-05-12 10:53:00 +0200 | [diff] [blame] | 250 | PCI_FUNC(dev->devfn)); |
| 251 | } else |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 252 | monitor_printf(mon, "failed to add %s\n", opts); |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 253 | } |
| 254 | #endif |
| 255 | |
Isaku Yamahata | f2b07c9 | 2010-06-15 12:48:36 +0900 | [diff] [blame] | 256 | static int pci_device_hot_remove(Monitor *mon, const char *pci_addr) |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 257 | { |
| 258 | PCIDevice *d; |
| 259 | int dom, bus; |
| 260 | unsigned slot; |
| 261 | |
Jan Kiszka | e9283f8 | 2009-06-26 00:04:00 +0200 | [diff] [blame] | 262 | if (pci_read_devaddr(mon, pci_addr, &dom, &bus, &slot)) { |
Luiz Capitulino | 053801b | 2010-02-10 23:49:56 -0200 | [diff] [blame] | 263 | return -1; |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 264 | } |
| 265 | |
Isaku Yamahata | 5256d8b | 2011-01-27 15:56:36 +0900 | [diff] [blame] | 266 | d = pci_find_device(pci_find_root_bus(dom), bus, PCI_DEVFN(slot, 0)); |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 267 | if (!d) { |
aliguori | 376253e | 2009-03-05 23:01:23 +0000 | [diff] [blame] | 268 | monitor_printf(mon, "slot %d empty\n", slot); |
Luiz Capitulino | 053801b | 2010-02-10 23:49:56 -0200 | [diff] [blame] | 269 | return -1; |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 270 | } |
Luiz Capitulino | 053801b | 2010-02-10 23:49:56 -0200 | [diff] [blame] | 271 | return qdev_unplug(&d->qdev); |
aliguori | 6f338c3 | 2009-02-11 15:21:54 +0000 | [diff] [blame] | 272 | } |
| 273 | |
Markus Armbruster | b752daf | 2010-05-12 10:53:01 +0200 | [diff] [blame] | 274 | void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict) |
Luiz Capitulino | 3818318 | 2009-08-28 15:27:08 -0300 | [diff] [blame] | 275 | { |
Markus Armbruster | b752daf | 2010-05-12 10:53:01 +0200 | [diff] [blame] | 276 | pci_device_hot_remove(mon, qdict_get_str(qdict, "pci_addr")); |
Luiz Capitulino | 3818318 | 2009-08-28 15:27:08 -0300 | [diff] [blame] | 277 | } |