Skip to contentSkip to conversation

Fix pci_add not to exit on error & other fixes

PATCH In review Markus Armbruster 4 participants 14 messages Sep 25, 2009 – Sep 28, 2009

lore
Share & tools
lore
#1 lore raw

PATCH 1/6 Fix pci_vga_init() not to ignore bus argument

In reply to Markus Armbruster

Commit a414c306 converted all VGA devices to qdev. It used pci_create_simple() for all devices, except for this one it used pci_create(). That's wrong, because it uses PCI bus#0 regardless of the bus argument. Fix by switching to pci_create_noinit().

---
 hw/vga-pci.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/vga-pci.c +1 -1
index 6038cec..129ff48 100644
@@ -137,7 +137,7 @@ int pci_vga_init(PCIBus *bus,
 {
     PCIDevice *dev;
 
-    dev = pci_create("VGA", NULL);
+    dev = pci_create_noinit(bus, -1, "VGA");
     qdev_prop_set_uint32(&dev->qdev, "bios-offset", vga_bios_offset);
     qdev_prop_set_uint32(&dev->qdev, "bios-size", vga_bios_offset);
     qdev_init(&dev->qdev);
Signature · 1 line
1.6.2.5
#2 lore raw

PATCH 2/6 Fix pci_add storage not to exit on bad first argument

In reply to Markus Armbruster

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.

Use pci_get_bus_devfn() and pci_create_noinit() instead.

---
 hw/pci-hotplug.c |   12 ++++++++++--
 hw/pci.c         |    2 +-
 hw/pci.h         |    1 +
 3 files changed, 12 insertions(+), 3 deletions(-)
hw/pci-hotplug.c +10 -2
index f3dc421..d6093ba 100644
@@ -107,6 +107,8 @@ static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon,
     DriveInfo *dinfo = NULL;
     int type = -1;
     char buf[128];
+    PCIBus *bus;
+    int devfn;
 
     if (get_param_value(buf, sizeof(buf), "if", opts)) {
         if (!strcmp(buf, "scsi"))
@@ -134,16 +136,22 @@ static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon,
         dinfo = NULL;
     }
 
+    bus = pci_get_bus_devfn(&devfn, devaddr);
+    if (!bus) {
+        monitor_printf(mon, "Invalid PCI device address %s\n", devaddr);
+        return NULL;
+    }
+
     switch (type) {
     case IF_SCSI:
-        dev = pci_create("lsi53c895a", devaddr);
+        dev = pci_create_noinit(bus, devfn, "lsi53c895a");
         break;
     case IF_VIRTIO:
         if (!dinfo) {
             monitor_printf(mon, "virtio requires a backing file/device.\n");
             return NULL;
         }
-        dev = pci_create("virtio-blk-pci", devaddr);
+        dev = pci_create_noinit(bus, devfn, "virtio-blk-pci");
         qdev_prop_set_drive(&dev->qdev, "drive", dinfo);
         break;
     default:
hw/pci.c +1 -1
index 64d70ed..5be21d7 100644
@@ -265,7 +265,7 @@ int pci_read_devaddr(Monitor *mon, const char *addr, int *domp, int *busp,
     return 0;
 }
 
-static PCIBus *pci_get_bus_devfn(int *devfnp, const char *devaddr)
+PCIBus *pci_get_bus_devfn(int *devfnp, const char *devaddr)
 {
     int dom, bus;
     unsigned slot;
hw/pci.h +1 -0
index caba5c8..356405e 100644
@@ -260,6 +260,7 @@ int pci_bus_num(PCIBus *s);
 void pci_for_each_device(int bus_num, void (*fn)(PCIDevice *d));
 PCIBus *pci_find_bus(int bus_num);
 PCIDevice *pci_find_device(int bus_num, int slot, int function);
+PCIBus *pci_get_bus_devfn(int *devfnp, const char *devaddr);
 
 int pci_read_devaddr(Monitor *mon, const char *addr, int *domp, int *busp,
                      unsigned *slotp);
Signature · 1 line
1.6.2.5
#5 lore raw

PATCH 4/6 Fix pci_add nic not to exit on bad model

In reply to Markus Armbruster

Monitor command "pci_add ADDR nic model=MODEL" uses pci_nic_init() to create the NIC. When MODEL is unknown or "?", this prints to stderr and terminates the program.

Change pci_nic_init() not to treat "?" specially, and to return NULL on failure. Switch uses during startup to new convenience wrapper pci_nic_init_nofail(), which behaves just like pci_nic_init() used to do.

Bonus bug fix: we now check for qdev_init() failing there.

---
 hw/mips_malta.c        |    2 +-
 hw/pc.c                |    2 +-
 hw/pci.c               |   33 ++++++++++++++++++++++++++++++---
 hw/pci.h               |    2 ++
 hw/ppc440_bamboo.c     |    2 +-
 hw/ppc_newworld.c      |    2 +-
 hw/ppc_oldworld.c      |    2 +-
 hw/ppc_prep.c          |    2 +-
 hw/ppce500_mpc8544ds.c |    2 +-
 hw/r2d.c               |    2 +-
 hw/realview.c          |    2 +-
 hw/sun4u.c             |    2 +-
 hw/versatilepb.c       |    2 +-
 net.c                  |   41 +++++++++++++++++++++++++----------------
 net.h                  |    5 +++--
 15 files changed, 71 insertions(+), 32 deletions(-)
hw/mips_malta.c +1 -1
index e09e971..2137034 100644
@@ -489,7 +489,7 @@ static void network_init(void)
             /* The malta board has a PCNet card using PCI SLOT 11 */
             default_devaddr = "0b";
 
-        pci_nic_init(nd, "pcnet", default_devaddr);
+        pci_nic_init_nofail(nd, "pcnet", default_devaddr);
     }
 }
 
hw/pc.c +1 -1
index bc2875e..ac56495 100644
@@ -1351,7 +1351,7 @@ static void pc_init1(ram_addr_t ram_size,
         if (!pci_enabled || (nd->model && strcmp(nd->model, "ne2k_isa") == 0))
             pc_init_ne2k_isa(nd);
         else
-            pci_nic_init(nd, "e1000", NULL);
+            pci_nic_init_nofail(nd, "e1000", NULL);
     }
 
     piix4_acpi_system_hot_add_init();
hw/pci.c +30 -3
index 92262f7..e43b53e 100644
@@ -811,21 +811,48 @@ PCIDevice *pci_nic_init(NICInfo *nd, const char *default_model,
                         const char *default_devaddr)
 {
     const char *devaddr = nd->devaddr ? nd->devaddr : default_devaddr;
+    PCIBus *bus;
+    int devfn;
     PCIDevice *pci_dev;
     DeviceState *dev;
     int i;
 
-    i = qemu_check_nic_model_list(nd, pci_nic_models, default_model);
-    pci_dev = pci_create(pci_nic_names[i], devaddr);
+    i = qemu_find_nic_model(nd, pci_nic_models, default_model);
+    if (i < 0)
+        return NULL;
+
+    bus = pci_get_bus_devfn(&devfn, devaddr);
+    if (!bus) {
+        qemu_error("Invalid PCI device address %s for device %s\n",
+                   devaddr, pci_nic_names[i]);
+        return NULL;
+    }
+
+    pci_dev = pci_create_noinit(bus, devfn, pci_nic_names[i]);
     dev = &pci_dev->qdev;
     if (nd->id)
         dev->id = qemu_strdup(nd->id);
     dev->nd = nd;
-    qdev_init(dev);
+    if (qdev_init(dev) < 0)
+        return NULL;
     nd->private = dev;
     return pci_dev;
 }
 
+PCIDevice *pci_nic_init_nofail(NICInfo *nd, const char *default_model,
+                               const char *default_devaddr)
+{
+    PCIDevice *res;
+
+    if (qemu_show_nic_models(nd->model, pci_nic_models))
+        exit(0);
+
+    res = pci_nic_init(nd, default_model, default_devaddr);
+    if (!res)
+        exit(1);
+    return res;
+}
+
 typedef struct {
     PCIDevice dev;
     PCIBus *bus;
hw/pci.h +2 -0
index 356405e..51c5085 100644
@@ -254,6 +254,8 @@ PCIBus *pci_register_bus(DeviceState *parent, const char *name,
 
 PCIDevice *pci_nic_init(NICInfo *nd, const char *default_model,
                         const char *default_devaddr);
+PCIDevice *pci_nic_init_nofail(NICInfo *nd, const char *default_model,
+                               const char *default_devaddr);
 void pci_data_write(void *opaque, uint32_t addr, uint32_t val, int len);
 uint32_t pci_data_read(void *opaque, uint32_t addr, int len);
 int pci_bus_num(PCIBus *s);
hw/ppc440_bamboo.c +1 -1
index 8a6b7ce..a488240 100644
@@ -119,7 +119,7 @@ static void bamboo_init(ram_addr_t ram_size,
         for (i = 0; i < nb_nics; i++) {
             /* There are no PCI NICs on the Bamboo board, but there are
              * PCI slots, so we can pick whatever default model we want. */
-            pci_nic_init(&nd_table[i], "e1000", NULL);
+            pci_nic_init_nofail(&nd_table[i], "e1000", NULL);
         }
     }
 
hw/ppc_newworld.c +1 -1
index 6bd5234..d1a82bf 100644
@@ -320,7 +320,7 @@ static void ppc_core99_init (ram_addr_t ram_size,
                                serial_hds[0], serial_hds[1], ESCC_CLOCK, 4);
 
     for(i = 0; i < nb_nics; i++)
-        pci_nic_init(&nd_table[i], "ne2k_pci", NULL);
+        pci_nic_init_nofail(&nd_table[i], "ne2k_pci", NULL);
 
     if (drive_get_max_bus(IF_IDE) >= MAX_IDE_BUS) {
         fprintf(stderr, "qemu: too many IDE bus\n");
hw/ppc_oldworld.c +1 -1
index bb8c969..79f17e8 100644
@@ -333,7 +333,7 @@ static void ppc_heathrow_init (ram_addr_t ram_size,
                                serial_hds[1], ESCC_CLOCK, 4);
 
     for(i = 0; i < nb_nics; i++)
-        pci_nic_init(&nd_table[i], "ne2k_pci", NULL);
+        pci_nic_init_nofail(&nd_table[i], "ne2k_pci", NULL);
 
 
     if (drive_get_max_bus(IF_IDE) >= MAX_IDE_BUS) {
hw/ppc_prep.c +1 -1
index 0525b1e..a94cdde 100644
@@ -697,7 +697,7 @@ static void ppc_prep_init (ram_addr_t ram_size,
         if (strcmp(nd_table[i].model, "ne2k_isa") == 0) {
             isa_ne2000_init(ne2000_io[i], ne2000_irq[i], &nd_table[i]);
         } else {
-            pci_nic_init(&nd_table[i], "ne2k_pci", NULL);
+            pci_nic_init_nofail(&nd_table[i], "ne2k_pci", NULL);
         }
     }
 
hw/ppce500_mpc8544ds.c +1 -1
index 5044194..ea30816 100644
@@ -219,7 +219,7 @@ static void mpc8544ds_init(ram_addr_t ram_size,
     if (pci_bus) {
         /* Register network interfaces. */
         for (i = 0; i < nb_nics; i++) {
-            pci_nic_init(&nd_table[i], "virtio", NULL);
+            pci_nic_init_nofail(&nd_table[i], "virtio", NULL);
         }
     }
 
hw/r2d.c +1 -1
index ea19ff6..f8a5968 100644
@@ -236,7 +236,7 @@ static void r2d_init(ram_addr_t ram_size,
 
     /* NIC: rtl8139 on-board, and 2 slots. */
     for (i = 0; i < nb_nics; i++)
-        pci_nic_init(&nd_table[i], "rtl8139", i==0 ? "2" : NULL);
+        pci_nic_init_nofail(&nd_table[i], "rtl8139", i==0 ? "2" : NULL);
 
     /* Todo: register on board registers */
     if (kernel_filename) {
hw/realview.c +1 -1
index a18e773..c494a20 100644
@@ -125,7 +125,7 @@ static void realview_init(ram_addr_t ram_size,
             smc91c111_init(nd, 0x4e000000, pic[28]);
             done_smc = 1;
         } else {
-            pci_nic_init(nd, "rtl8139", NULL);
+            pci_nic_init_nofail(nd, "rtl8139", NULL);
         }
     }
 
hw/sun4u.c +1 -1
index 2c97d9d..333092f 100644
@@ -616,7 +616,7 @@ static void sun4uv_init(ram_addr_t RAM_size,
     }
 
     for(i = 0; i < nb_nics; i++)
-        pci_nic_init(&nd_table[i], "ne2k_pci", NULL);
+        pci_nic_init_nofail(&nd_table[i], "ne2k_pci", NULL);
 
     if (drive_get_max_bus(IF_IDE) >= MAX_IDE_BUS) {
         fprintf(stderr, "qemu: too many IDE bus\n");
hw/versatilepb.c +1 -1
index 29b85ae..e8ebdf1 100644
@@ -213,7 +213,7 @@ static void versatile_init(ram_addr_t ram_size,
             smc91c111_init(nd, 0x10010000, sic[25]);
             done_smc = 1;
         } else {
-            pci_nic_init(nd, "rtl8139", NULL);
+            pci_nic_init_nofail(nd, "rtl8139", NULL);
         }
     }
     if (usb_enabled) {
net.c +25 -16

62 lines not on this page · raw message

net.h +3 -2
index c93cc99..dfce8d6 100644
@@ -75,9 +75,10 @@ ssize_t qemu_send_packet_async(VLANClientState *vc, const uint8_t *buf,
 void qemu_purge_queued_packets(VLANClientState *vc);
 void qemu_flush_queued_packets(VLANClientState *vc);
 void qemu_format_nic_info_str(VLANClientState *vc, uint8_t macaddr[6]);
+int qemu_show_nic_models(const char *arg, const char *const *models);
 void qemu_check_nic_model(NICInfo *nd, const char *model);
-int qemu_check_nic_model_list(NICInfo *nd, const char * const *models,
-                              const char *default_model);
+int qemu_find_nic_model(NICInfo *nd, const char * const *models,
+                        const char *default_model);
 void qemu_handler_true(void *opaque);
 
 void do_info_network(Monitor *mon);
Signature · 1 line
1.6.2.5
#7 lore raw

PATCH 6/6 Rename pci_create_noinit() to pci_create()

In reply to Markus Armbruster

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

---
 hw/ide/pci.c     |    2 +-
 hw/pci-hotplug.c |    4 ++--
 hw/pci.c         |    6 +++---
 hw/pci.h         |    2 +-
 hw/vga-pci.c     |    2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)
hw/ide/pci.c +1 -1
index 89ecd44..58130d1 100644
@@ -443,7 +443,7 @@ void pci_cmd646_ide_init(PCIBus *bus, DriveInfo **hd_table,
 {
     PCIDevice *dev;
 
-    dev = pci_create_noinit(bus, -1, "CMD646 IDE");
+    dev = pci_create(bus, -1, "CMD646 IDE");
     qdev_prop_set_uint32(&dev->qdev, "secondary", secondary_ide_enabled);
     qdev_init(&dev->qdev);
 
hw/pci-hotplug.c +2 -2
index d6093ba..dfd2cf3 100644
@@ -144,14 +144,14 @@ static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon,
 
     switch (type) {
     case IF_SCSI:
-        dev = pci_create_noinit(bus, devfn, "lsi53c895a");
+        dev = pci_create(bus, devfn, "lsi53c895a");
         break;
     case IF_VIRTIO:
         if (!dinfo) {
             monitor_printf(mon, "virtio requires a backing file/device.\n");
             return NULL;
         }
-        dev = pci_create_noinit(bus, devfn, "virtio-blk-pci");
+        dev = pci_create(bus, devfn, "virtio-blk-pci");
         qdev_prop_set_drive(&dev->qdev, "drive", dinfo);
         break;
     default:
hw/pci.c +3 -3
index ec0fc7c..b3ba575 100644
@@ -810,7 +810,7 @@ PCIDevice *pci_nic_init(NICInfo *nd, const char *default_model,
         return NULL;
     }
 
-    pci_dev = pci_create_noinit(bus, devfn, pci_nic_names[i]);
+    pci_dev = pci_create(bus, devfn, pci_nic_names[i]);
     dev = &pci_dev->qdev;
     if (nd->id)
         dev->id = qemu_strdup(nd->id);
@@ -925,7 +925,7 @@ void pci_qdev_register_many(PCIDeviceInfo *info)
     }
 }
 
-PCIDevice *pci_create_noinit(PCIBus *bus, int devfn, const char *name)
+PCIDevice *pci_create(PCIBus *bus, int devfn, const char *name)
 {
     DeviceState *dev;
 
@@ -936,7 +936,7 @@ PCIDevice *pci_create_noinit(PCIBus *bus, int devfn, const char *name)
 
 PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name)
 {
-    PCIDevice *dev = pci_create_noinit(bus, devfn, name);
+    PCIDevice *dev = pci_create(bus, devfn, name);
     qdev_init(&dev->qdev);
     return dev;
 }
hw/pci.h +1 -1
index 689461f..7f034ff 100644
@@ -336,7 +336,7 @@ typedef struct {
 void pci_qdev_register(PCIDeviceInfo *info);
 void pci_qdev_register_many(PCIDeviceInfo *info);
 
-PCIDevice *pci_create_noinit(PCIBus *bus, int devfn, const char *name);
+PCIDevice *pci_create(PCIBus *bus, int devfn, const char *name);
 PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name);
 
 /* lsi53c895a.c */
hw/vga-pci.c +1 -1
index 129ff48..314ef03 100644
@@ -137,7 +137,7 @@ int pci_vga_init(PCIBus *bus,
 {
     PCIDevice *dev;
 
-    dev = pci_create_noinit(bus, -1, "VGA");
+    dev = pci_create(bus, -1, "VGA");
     qdev_prop_set_uint32(&dev->qdev, "bios-offset", vga_bios_offset);
     qdev_prop_set_uint32(&dev->qdev, "bios-size", vga_bios_offset);
     qdev_init(&dev->qdev);
Signature · 1 line
1.6.2.5
#0 lore raw

cover Fix pci_add not to exit on error & other fixes

Markus Armbruster (6):
Fix pci_vga_init() not to ignore bus argument Fix pci_add storage not to exit on bad first argument Make it obvious that pci_nic_init() can't fail Fix pci_add nic not to exit on bad model pci_create() is now unused, remove it
Rename pci_create_noinit() to pci_create()

 hw/ide/pci.c           |    2 +-
 hw/mips_malta.c        |    2 +-
 hw/pc.c                |    2 +-
 hw/pci-hotplug.c       |   12 ++++++-
 hw/pci.c               |   72 ++++++++++++++++++++++++-----------------------
 hw/pci.h               |    6 ++-
 hw/ppc440_bamboo.c     |    2 +-
 hw/ppc_newworld.c      |    2 +-
 hw/ppc_oldworld.c      |    2 +-
 hw/ppc_prep.c          |    2 +-
 hw/ppce500_mpc8544ds.c |    2 +-
 hw/r2d.c               |    2 +-
 hw/realview.c          |    2 +-
 hw/sun4u.c             |    2 +-
 hw/versatilepb.c       |    2 +-
 hw/vga-pci.c           |    2 +-
 net.c                  |   41 ++++++++++++++++----------
 net.h                  |    5 ++-
 18 files changed, 92 insertions(+), 70 deletions(-)
#4 lore raw

PATCH 3/6 Make it obvious that pci_nic_init() can't fail

Before this patch, pci_nic_init() returns NULL when it can't find the model in pci_nic_models[]. Except this can't happen, because qemu_check_nic_model_list() just searched for model in pci_nic_models[], and terminated the program on failure.

Repeating the search here is pointless. Instead, change qemu_check_nic_model_list() to return the model's array index.

---
 hw/pci.c |   25 +++++++++----------------
 net.c    |    6 +++---
 net.h    |    4 ++--
 3 files changed, 14 insertions(+), 21 deletions(-)
hw/pci.c +9 -16
index 5be21d7..92262f7 100644
@@ -815,22 +815,15 @@ PCIDevice *pci_nic_init(NICInfo *nd, const char *default_model,
     DeviceState *dev;
     int i;
 
-    qemu_check_nic_model_list(nd, pci_nic_models, default_model);
-
-    for (i = 0; pci_nic_models[i]; i++) {
-        if (strcmp(nd->model, pci_nic_models[i]) == 0) {
-            pci_dev = pci_create(pci_nic_names[i], devaddr);
-            dev = &pci_dev->qdev;
-            if (nd->id)
-                dev->id = qemu_strdup(nd->id);
-            dev->nd = nd;
-            qdev_init(dev);
-            nd->private = dev;
-            return pci_dev;
-        }
-    }
-
-    return NULL;
+    i = qemu_check_nic_model_list(nd, pci_nic_models, default_model);
+    pci_dev = pci_create(pci_nic_names[i], devaddr);
+    dev = &pci_dev->qdev;
+    if (nd->id)
+        dev->id = qemu_strdup(nd->id);
+    dev->nd = nd;
+    qdev_init(dev);
+    nd->private = dev;
+    return pci_dev;
 }
 
 typedef struct {
net.c +3 -3
index 3fdf1e6..0eba08b 100644
@@ -2358,8 +2358,8 @@ void qemu_check_nic_model(NICInfo *nd, const char *model)
     qemu_check_nic_model_list(nd, models, model);
 }
 
-void qemu_check_nic_model_list(NICInfo *nd, const char * const *models,
-                               const char *default_model)
+int qemu_check_nic_model_list(NICInfo *nd, const char * const *models,
+                              const char *default_model)
 {
     int i, exit_status = 0;
 
@@ -2369,7 +2369,7 @@ void qemu_check_nic_model_list(NICInfo *nd, const char * const *models,
     if (strcmp(nd->model, "?") != 0) {
         for (i = 0 ; models[i]; i++)
             if (strcmp(nd->model, models[i]) == 0)
-                return;
+                return i;
 
         fprintf(stderr, "qemu: Unsupported NIC model: %s\n", nd->model);
         exit_status = 1;
net.h +2 -2
index 1479826..c93cc99 100644
@@ -76,8 +76,8 @@ void qemu_purge_queued_packets(VLANClientState *vc);
 void qemu_flush_queued_packets(VLANClientState *vc);
 void qemu_format_nic_info_str(VLANClientState *vc, uint8_t macaddr[6]);
 void qemu_check_nic_model(NICInfo *nd, const char *model);
-void qemu_check_nic_model_list(NICInfo *nd, const char * const *models,
-                               const char *default_model);
+int qemu_check_nic_model_list(NICInfo *nd, const char * const *models,
+                              const char *default_model);
 void qemu_handler_true(void *opaque);
 
 void do_info_network(Monitor *mon);
Signature · 1 line
1.6.2.5
#6 lore raw

PATCH 5/6 pci_create() is now unused, remove it

In reply to Markus Armbruster
---
 hw/pci.c |   18 ------------------
 hw/pci.h |    1 -
 2 files changed, 0 insertions(+), 19 deletions(-)
hw/pci.c +0 -18
index e43b53e..ec0fc7c 100644
@@ -764,24 +764,6 @@ void pci_info(Monitor *mon)
     pci_for_each_device(0, pci_info_device);
 }
 
-PCIDevice *pci_create(const char *name, const char *devaddr)
-{
-    PCIBus *bus;
-    int devfn;
-    DeviceState *dev;
-
-    bus = pci_get_bus_devfn(&devfn, devaddr);
-    if (!bus) {
-        fprintf(stderr, "Invalid PCI device address %s for device %s\n",
-                devaddr, name);
-        exit(1);
-    }
-
-    dev = qdev_create(&bus->qbus, name);
-    qdev_prop_set_uint32(dev, "addr", devfn);
-    return (PCIDevice *)dev;
-}
-
 static const char * const pci_nic_models[] = {
     "ne2k_pci",
     "i82551",
hw/pci.h +0 -1
index 51c5085..689461f 100644
@@ -336,7 +336,6 @@ typedef struct {
 void pci_qdev_register(PCIDeviceInfo *info);
 void pci_qdev_register_many(PCIDeviceInfo *info);
 
-PCIDevice *pci_create(const char *name, const char *devaddr);
 PCIDevice *pci_create_noinit(PCIBus *bus, int devfn, const char *name);
 PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name);
 
Signature · 1 line
1.6.2.5
Acked-by on the v1 series
#8 lore raw
In reply to Markus Armbruster
Quoted 7 lines · Markus Armbruster

Markus Armbruster (6):
Fix pci_vga_init() not to ignore bus argument Fix pci_add storage not to exit on bad first argument Make it obvious that pci_nic_init() can't fail Fix pci_add nic not to exit on bad model pci_create() is now unused, remove it
Rename pci_create_noinit() to pci_create()

Nice cleanup.

cheers,
Gerd

#9 lore raw
Quoted 9 lines · Gerd Hoffmann
Quoted 7 lines · Markus Armbruster

Markus Armbruster (6):
Fix pci_vga_init() not to ignore bus argument Fix pci_add storage not to exit on bad first argument Make it obvious that pci_nic_init() can't fail Fix pci_add nic not to exit on bad model pci_create() is now unused, remove it
Rename pci_create_noinit() to pci_create()

Quoted 3 lines

Nice cleanup.

Thanks. 415 occurences of exit() outside tests remaining...

#10 lore raw
In reply to Markus Armbruster
Quoted 7 lines · On Fri, 25 Sep 2009 03:53:47 +0200 Markus Armbruster <[email protected]> wrote:

Markus Armbruster (6):
Fix pci_vga_init() not to ignore bus argument Fix pci_add storage not to exit on bad first argument Make it obvious that pci_nic_init() can't fail Fix pci_add nic not to exit on bad model pci_create() is now unused, remove it
Rename pci_create_noinit() to pci_create()

The Right Thing :) and it (obviously) fixes the problem with
pci_add for me.

The only nitpick is that by passing an invalid NIC on command
line would make qemu dump valid NIC models.. But not an issue, anyway.

#3 lore raw

[Qemu-devel] Re: [PATCH 2/6] Fix pci_add storage not to exit on bad first argument

In reply to Markus Armbruster
Quoted 2 lines · Markus Armbruster

Monitor command "pci_add ADDR storage ..." does its work in qemu_pci_hot_add_nic(). It called pci_create(..., ADDR) to create the

Oops, make that qmu_pci_hot_add_storage().

Quoted 6 lines

device. That's wrong, because pci_create() terminates the program when ADDR is invalid.

Use pci_get_bus_devfn() and pci_create_noinit() instead.

Acked-by on the v1 series
#11 lore raw
In reply to Markus Armbruster
Quoted 7 lines · Markus Armbruster

Markus Armbruster (6):
Fix pci_vga_init() not to ignore bus argument Fix pci_add storage not to exit on bad first argument Make it obvious that pci_nic_init() can't fail Fix pci_add nic not to exit on bad model pci_create() is now unused, remove it
Rename pci_create_noinit() to pci_create()

Looks like a good series to me too

Cheers,
Mark.

#12 lore raw
Quoted 9 lines · Mark McLoughlin
Quoted 7 lines · Markus Armbruster

Markus Armbruster (6):
Fix pci_vga_init() not to ignore bus argument Fix pci_add storage not to exit on bad first argument Make it obvious that pci_nic_init() can't fail Fix pci_add nic not to exit on bad model pci_create() is now unused, remove it
Rename pci_create_noinit() to pci_create()

Quoted 3 lines

Looks like a good series to me too

Oh, and IMHO, at least patches 3 and 4 makes sense for stable-0.11; patch 4 just needs an update for e1000 being the default model now

Patch 2 might make sense too with a little massaging

Cheers,
Mark.

#13 lore raw
Quoted 10 lines · Mark McLoughlin
Quoted 9 lines · Mark McLoughlin
Quoted 7 lines · Markus Armbruster

Markus Armbruster (6):
Fix pci_vga_init() not to ignore bus argument Fix pci_add storage not to exit on bad first argument Make it obvious that pci_nic_init() can't fail Fix pci_add nic not to exit on bad model pci_create() is now unused, remove it
Rename pci_create_noinit() to pci_create()

Quoted 8 lines
Quoted 3 lines

Looks like a good series to me too

Oh, and IMHO, at least patches 3 and 4 makes sense for stable-0.11; patch 4 just needs an update for e1000 being the default model now

Patch 2 might make sense too with a little massaging

Yes. The others are mere cleanup, doubt they're appropriate for stable.