Add remove_boot_device_path() function for hot-unplug device
PATCH v3 1/1 Add remove_boot_device_path() function for hot-unplug device
Add remove_boot_device_path() function to remove bootindex when hot-unplug a device. This patch fixed virtio-blk/virtio-net/scsi-disk/scsi-generic device.
---
This patch also fixed bug1086603, ref:
https://bugzilla.redhat.com/show_bug.cgi?id=1086603
This version of patch delete dev and suffix parameter from function remove_boot_device_path().
--- hw/block/virtio-blk.c | 1 + hw/net/virtio-net.c | 1 + hw/scsi/scsi-disk.c | 1 + hw/scsi/scsi-generic.c | 1 + include/sysemu/sysemu.h | 1 + vl.c | 15 +++++++++++++++ 6 files changed, 20 insertions(+)
hw/block/virtio-blk.c +1 -0
@@ -752,6 +752,7 @@ static void virtio_blk_device_unrealize(DeviceState *dev, Error **errp)unregister_savevm (dev,"virtio-blk" , s);blockdev_mark_auto_del (s->bs);virtio_cleanup (vdev); +remove_boot_device_path (s->conf->bootindex); }static Property virtio_blk_properties[] = {
hw/net/virtio-net.c +1 -0
@@ -1645,6 +1645,7 @@ static void virtio_net_device_unrealize(DeviceState *dev, Error **errp)g_free (n->vqs);qemu_del_nic (n->nic);virtio_cleanup (vdev); +remove_boot_device_path (n->nic_conf.bootindex); }static void virtio_net_instance_init (Object *obj)
hw/scsi/scsi-disk.c +1 -0
@@ -2156,6 +2156,7 @@ static void scsi_destroy(SCSIDevice *dev)scsi_device_purge_requests (&s->qdev,SENSE_CODE (NO_SENSE ));blockdev_mark_auto_del (s->qdev.conf.bs); +remove_boot_device_path (s->qdev.conf.bootindex); }static void scsi_disk_resize_cb (void *opaque)
hw/scsi/scsi-generic.c +1 -0
@@ -390,6 +390,7 @@ static void scsi_destroy(SCSIDevice *s) {scsi_device_purge_requests (s,SENSE_CODE (NO_SENSE ));blockdev_mark_auto_del (s->conf.bs); +remove_boot_device_path (s->conf.bootindex); }static int scsi_generic_initfn (SCSIDevice *s)
include/sysemu/sysemu.h +1 -0
@@ -193,6 +193,7 @@ void rtc_change_mon_event(struct tm *tm);void add_boot_device_path (int32_t bootindex,DeviceState *dev,const char *suffix); +void remove_boot_device_path (int32_t bootindex);char *get_boot_devices_list (size_t *size,bool ignore_suffixes);DeviceState *get_boot_device (uint32_t position);
vl.c +15 -0
@@ -1189,6 +1189,21 @@ void add_boot_device_path(int32_t bootindex, DeviceState *dev,QTAILQ_INSERT_TAIL (&fw_boot_order, node, link); } +void remove_boot_device_path (int32_t bootindex) +{ +FWBootEntry *node, *next_node; + +if (bootindex ==-1 ) { +return ; + } + + QTAILQ_FOREACH_SAFE(node, &fw_boot_order, link, next_node) +if (node->bootindex == bootindex) { +QTAILQ_REMOVE (&fw_boot_order, node, link); +return ; + } +} +DeviceState *get_boot_device (uint32_t position) {uint32_t counter =0 ;
Signature · 1 line
1.9.0
Hi,
Am 19.05.2014 17:03, schrieb Jun Li:
Quoted 8 lines
Add
remove_boot_device_path()function to remove bootindex when hot-unplug a device. This patch fixed virtio-blk/virtio-net/scsi-disk/scsi-generic device.Signed-off-by Jun Li <[email protected]>---
This patch also fixed bug1086603, ref:
https://bugzilla.redhat.com/show_bug.cgi?id=1086603
Quoted 6 lines
This version of patch delete dev and suffix parameter from function
remove_boot_device_path().--- hw/block/virtio-blk.c | 1 + hw/net/virtio-net.c | 1 + hw/scsi/scsi-disk.c | 1 + hw/scsi/scsi-generic.c | 1 +
On v1 I believe I reminded you of spapr_llan. Your patch is adding a new remove_*() function, but is using it only for roughly half of the devices that currently call add_boot_device_path(). Why? I can understand that ISA devices will not be hot-unpluggable, but all PCI and USB devices are.
hw/block/fdc.c: add_boot_device_path(isa->bootindexA, dev, "/floppy@0"); hw/block/fdc.c: add_boot_device_path(isa->bootindexB, dev, "/floppy@1"); hw/block/virtio-blk.c: add_boot_device_path(s->conf->bootindex, dev, "/disk@0,0"); hw/core/loader.c: add_boot_device_path(bootindex, NULL, devpath); hw/i386/kvm/pci-assign.c: add_boot_device_path(dev->bootindex, &pci_dev->qdev, NULL); hw/ide/qdev.c: add_boot_device_path(dev->conf.bootindex, &dev->qdev, hw/misc/vfio.c: add_boot_device_path(vdev->bootindex, &pdev->qdev, NULL); hw/net/e1000.c: add_boot_device_path(d->conf.bootindex, dev,
"/ethernet-phy@0");hw/net/eepro100.c: add_boot_device_path(s->conf.bootindex,&pci_dev->qdev, "/ethernet-phy@0");hw/net/ne2000.c: add_boot_device_path(s->c.bootindex, &pci_dev->qdev,
"/ethernet-phy@0");hw/net/pcnet.c: add_boot_device_path(s->conf.bootindex, dev,
"/ethernet-phy@0");hw/net/rtl8139.c: add_boot_device_path(s->conf.bootindex, d,
"/ethernet-phy@0");hw/net/spapr_llan.c: add_boot_device_path(dev->nicconf.bootindex,
DEVICE(dev), "");hw/net/virtio-net.c: add_boot_device_path(n->nic_conf.bootindex, dev,
"/ethernet-phy@0");hw/net/vmxnet3.c: add_boot_device_path(s->conf.bootindex, dev,
"/ethernet-phy@0");hw/scsi/scsi-disk.c: add_boot_device_path(s->qdev.conf.bootindex,&dev->qdev, NULL);hw/scsi/scsi-generic.c: add_boot_device_path(s->conf.bootindex,&s->qdev, NULL);hw/usb/dev-network.c: add_boot_device_path(s->conf.bootindex,&dev->qdev, "/ethernet@0");hw/usb/host-libusb.c: add_boot_device_path(s->bootindex, &udev->qdev,
NULL);hw/usb/redirect.c: add_boot_device_path(dev->bootindex, &udev->qdev,
NULL);
Quoted 33 lines
include/sysemu/sysemu.h | 1 + vl.c | 15 +++++++++++++++ 6 files changed, 20 insertions(+)hw/block/virtio-blk.c +1
-0@@ -752,6 +752,7 @@ static void virtio_blk_device_unrealize(DeviceState *dev, Error **errp)unregister_savevm (dev,"virtio-blk" , s);blockdev_mark_auto_del (s->bs);virtio_cleanup (vdev); +remove_boot_device_path (s->conf->bootindex); }static Property virtio_blk_properties[] = {hw/net/virtio-net.c +1
-0@@ -1645,6 +1645,7 @@ static void virtio_net_device_unrealize(DeviceState *dev, Error **errp)g_free (n->vqs);qemu_del_nic (n->nic);virtio_cleanup (vdev); +remove_boot_device_path (n->nic_conf.bootindex); }static void virtio_net_instance_init (Object *obj)hw/scsi/scsi-disk.c +0
-0
hw/scsi/scsi-disk.c static void scsi_destroy(SCSIDevice *dev) · line 2159
Quoted 4 lines
hw/scsi/scsi-disk.c +1
-0@@ -2156,6 +2156,7 @@ static void scsi_destroy(SCSIDevice *dev)scsi_device_purge_requests (&s->qdev,SENSE_CODE (NO_SENSE ));blockdev_mark_auto_del (s->qdev.conf.bs); +remove_boot_device_path (s->qdev.conf.bootindex);
Didn't I previously ask that you use dev->config.bootindex here? Pointers to parent's struct shouldn't be accessed anywhere except VMStateDescription.
Quoted 34 lines
hw/scsi/scsi-disk.c +0
-0}static void scsi_disk_resize_cb (void *opaque)hw/scsi/scsi-generic.c +1
-0@@ -390,6 +390,7 @@ static void scsi_destroy(SCSIDevice *s) {scsi_device_purge_requests (s,SENSE_CODE (NO_SENSE ));blockdev_mark_auto_del (s->conf.bs); +remove_boot_device_path (s->conf.bootindex); }static int scsi_generic_initfn (SCSIDevice *s)include/sysemu/sysemu.h +1
-0@@ -193,6 +193,7 @@ void rtc_change_mon_event(struct tm *tm);void add_boot_device_path (int32_t bootindex,DeviceState *dev,const char *suffix); +void remove_boot_device_path (int32_t bootindex);char *get_boot_devices_list (size_t *size,bool ignore_suffixes);DeviceState *get_boot_device (uint32_t position);vl.c +0
-0@@ -1189,6 +1189,21 @@ void add_boot_device_path(int32_t bootindex, DeviceState *dev,QTAILQ_INSERT_TAIL (&fw_boot_order, node, link); }
vl.c void add_boot_device_path(int32_t bootindex, DeviceState *dev, · line 1200
Quoted 10 lines
vl.c +9
-0+void remove_boot_device_path (int32_t bootindex) +{ +FWBootEntry *node, *next_node; + +if (bootindex ==-1 ) { +return ; + } + +QTAILQ_FOREACH_SAFE (node, &fw_boot_order, link, next_node)
Coding Style requires braces around the below single-statement if.
vl.c void add_boot_device_path(int32_t bootindex, DeviceState *dev, · line 1209
Quoted 9 lines
vl.c +6
-0+if (node->bootindex == bootindex) { +QTAILQ_REMOVE (&fw_boot_order, node, link); +return ; + } +} +DeviceState *get_boot_device (uint32_t position) {uint32_t counter =0 ;
Regards,
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Quoted 18 lines · Andreas Färber
Hi,
Am 19.05.2014 17:03, schrieb Jun Li:
Quoted 8 lines
Add
remove_boot_device_path()function to remove bootindex when hot-unplug a device. This patch fixed virtio-blk/virtio-net/scsi-disk/scsi-generic device.Signed-off-by Jun Li <[email protected]>---
This patch also fixed bug1086603, ref:
https://bugzilla.redhat.com/show_bug.cgi?id=1086603Quoted 6 lines
This version of patch delete dev and suffix parameter from function
remove_boot_device_path().--- hw/block/virtio-blk.c | 1 + hw/net/virtio-net.c | 1 + hw/scsi/scsi-disk.c | 1 + hw/scsi/scsi-generic.c | 1 +
Quoted 5 lines
On v1 I believe I reminded you of
spapr_llan. Your patch is adding a new remove_*() function, but is using it only for roughly half of the devices that currently calladd_boot_device_path(). Why? I can understand that ISA devices will not be hot-unpluggable, but all PCI and USB devices are.
Can we remove the device from boot path automatically when it's going away?
Quoted 141 lines
hw/block/fdc.c: add_boot_device_path(isa->bootindexA, dev, "/floppy@0"); hw/block/fdc.c: add_boot_device_path(isa->bootindexB, dev, "/floppy@1"); hw/block/virtio-blk.c: add_boot_device_path(s->conf->bootindex, dev, "/disk@0,0"); hw/core/loader.c: add_boot_device_path(bootindex, NULL, devpath); hw/i386/kvm/pci-assign.c: add_boot_device_path(dev->bootindex, &pci_dev->qdev, NULL); hw/ide/qdev.c: add_boot_device_path(dev->conf.bootindex, &dev->qdev, hw/misc/vfio.c: add_boot_device_path(vdev->bootindex, &pdev->qdev, NULL); hw/net/e1000.c: add_boot_device_path(d->conf.bootindex, dev,"/ethernet-phy@0");
hw/net/eepro100.c: add_boot_device_path(s->conf.bootindex,&pci_dev->qdev, "/ethernet-phy@0");hw/net/ne2000.c: add_boot_device_path(s->c.bootindex,&pci_dev->qdev,
"/ethernet-phy@0");hw/net/pcnet.c: add_boot_device_path(s->conf.bootindex, dev,
"/ethernet-phy@0");hw/net/rtl8139.c: add_boot_device_path(s->conf.bootindex, d,
"/ethernet-phy@0");hw/net/spapr_llan.c: add_boot_device_path(dev->nicconf.bootindex,
DEVICE(dev), "");hw/net/virtio-net.c: add_boot_device_path(n->nic_conf.bootindex, dev,
"/ethernet-phy@0");hw/net/vmxnet3.c: add_boot_device_path(s->conf.bootindex, dev,
"/ethernet-phy@0");hw/scsi/scsi-disk.c: add_boot_device_path(s->qdev.conf.bootindex,&dev->qdev, NULL);hw/scsi/scsi-generic.c: add_boot_device_path(s->conf.bootindex,&s->qdev, NULL);hw/usb/dev-network.c: add_boot_device_path(s->conf.bootindex,&dev->qdev, "/ethernet@0");hw/usb/host-libusb.c: add_boot_device_path(s->bootindex,&udev->qdev,
NULL);hw/usb/redirect.c: add_boot_device_path(dev->bootindex,&udev->qdev,
NULL);Quoted 33 lines
include/sysemu/sysemu.h | 1 + vl.c | 15 +++++++++++++++ 6 files changed, 20 insertions(+)hw/block/virtio-blk.c +1
-0@@ -752,6 +752,7 @@ static void virtio_blk_device_unrealize(DeviceState *dev, Error **errp)unregister_savevm (dev,"virtio-blk" , s);blockdev_mark_auto_del (s->bs);virtio_cleanup (vdev); +remove_boot_device_path (s->conf->bootindex); }static Property virtio_blk_properties[] = {hw/net/virtio-net.c +1
-0@@ -1645,6 +1645,7 @@ static void virtio_net_device_unrealize(DeviceState *dev, Error **errp)g_free (n->vqs);qemu_del_nic (n->nic);virtio_cleanup (vdev); +remove_boot_device_path (n->nic_conf.bootindex); }static void virtio_net_instance_init (Object *obj)hw/scsi/scsi-disk.c +0
-0hw/scsi/scsi-disk.c static void scsi_destroy(SCSIDevice *dev) · line 2159
Quoted 4 lines
hw/scsi/scsi-disk.c +1
-0@@ -2156,6 +2156,7 @@ static void scsi_destroy(SCSIDevice *dev)scsi_device_purge_requests (&s->qdev,SENSE_CODE (NO_SENSE ));blockdev_mark_auto_del (s->qdev.conf.bs); +remove_boot_device_path (s->qdev.conf.bootindex);Didn't I previously ask that you use
dev->config.bootindexhere? Pointers to parent's struct shouldn't be accessed anywhere except VMStateDescription.Quoted 34 lines
hw/scsi/scsi-disk.c +0
-0}static void scsi_disk_resize_cb (void *opaque)hw/scsi/scsi-generic.c +1
-0@@ -390,6 +390,7 @@ static void scsi_destroy(SCSIDevice *s) {scsi_device_purge_requests (s,SENSE_CODE (NO_SENSE ));blockdev_mark_auto_del (s->conf.bs); +remove_boot_device_path (s->conf.bootindex); }static int scsi_generic_initfn (SCSIDevice *s)include/sysemu/sysemu.h +1
-0@@ -193,6 +193,7 @@ void rtc_change_mon_event(struct tm *tm);void add_boot_device_path (int32_t bootindex,DeviceState *dev,const char *suffix); +void remove_boot_device_path (int32_t bootindex);char *get_boot_devices_list (size_t *size,bool ignore_suffixes);DeviceState *get_boot_device (uint32_t position);vl.c +0
-0@@ -1189,6 +1189,21 @@ void add_boot_device_path(int32_t bootindex, DeviceState *dev,QTAILQ_INSERT_TAIL (&fw_boot_order, node, link); }vl.c void add_boot_device_path(int32_t bootindex, DeviceState *dev, · line 1200
Quoted 10 lines
vl.c +9
-0+void remove_boot_device_path (int32_t bootindex) +{ +FWBootEntry *node, *next_node; + +if (bootindex ==-1 ) { +return ; + } + +QTAILQ_FOREACH_SAFE (node, &fw_boot_order, link, next_node)Coding Style requires braces around the below single-statement if.
vl.c void add_boot_device_path(int32_t bootindex, DeviceState *dev, · line 1209
Quoted 9 lines
vl.c +6
-0+if (node->bootindex == bootindex) { +QTAILQ_REMOVE (&fw_boot_order, node, link); +return ; + } +} +DeviceState *get_boot_device (uint32_t position) {uint32_t counter =0 ;Regards,
AndreasSignature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Am 19.05.2014 17:57, schrieb Michael S. Tsirkin:
Quoted 19 lines · Andreas Färber
Quoted 18 lines
Hi,
Am 19.05.2014 17:03, schrieb Jun Li:
Quoted 14 lines
Add
remove_boot_device_path()function to remove bootindex when hot-unplug a device. This patch fixed virtio-blk/virtio-net/scsi-disk/scsi-generic device.Signed-off-by Jun Li <[email protected]>---
This patch also fixed bug1086603, ref:
https://bugzilla.redhat.com/show_bug.cgi?id=1086603This version of patch delete dev and suffix parameter from function
remove_boot_device_path().--- hw/block/virtio-blk.c | 1 + hw/net/virtio-net.c | 1 + hw/scsi/scsi-disk.c | 1 + hw/scsi/scsi-generic.c | 1 +
Quoted 8 lines
Quoted 5 lines
On v1 I believe I reminded you of
spapr_llan. Your patch is adding a new remove_*() function, but is using it only for roughly half of the devices that currently calladd_boot_device_path(). Why? I can understand that ISA devices will not be hot-unpluggable, but all PCI and USB devices are.Can we remove the device from boot path automatically when it's going away?
I'm not familiar with that code myself; assuming that only one path gets registered per device, I guess we could add a field to DeviceState and if non-NULL call the unregistration from device_set_unrealize().
Jun, if that works it would save you some work.
Regards,
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Quoted 24 lines · Andreas Färber
Am 19.05.2014 17:57, schrieb Michael S. Tsirkin:
Quoted 23 lines · Andreas Färber
Quoted 22 lines
Hi,
Am 19.05.2014 17:03, schrieb Jun Li:
Quoted 8 lines
Add
remove_boot_device_path()function to remove bootindex when hot-unplug a device. This patch fixed virtio-blk/virtio-net/scsi-disk/scsi-generic device.Signed-off-by Jun Li <[email protected]>---
This patch also fixed bug1086603, ref:
https://bugzilla.redhat.com/show_bug.cgi?id=1086603Quoted 6 lines
This version of patch delete dev and suffix parameter from function
remove_boot_device_path().--- hw/block/virtio-blk.c | 1 + hw/net/virtio-net.c | 1 + hw/scsi/scsi-disk.c | 1 + hw/scsi/scsi-generic.c | 1 +On v1 I believe I reminded you of
spapr_llan. Your patch is adding a new remove_*() function, but is using it only for roughly half of the devices that currently calladd_boot_device_path(). Why? I can understand that ISA devices will not be hot-unpluggable, but all PCI and USB devices are.
Quoted 7 lines
Quoted 2 lines
Can we remove the device from boot path automatically when it's going away?
I'm not familiar with that code myself; assuming that only one path gets registered per device, I guess we could add a field to DeviceState and if non-NULL call the unregistration from
device_set_unrealize().Jun, if that works it would save you some work.
Hi Andreas,
Add a field to DeviceState is another method to fix this issue.
But when using this method, should delete add_boot_device_path() and add boot path in register per device. I can not estimate the potential issues. Could any guy give your opinion? I will do some researches this weekend. Thx.
Add remove_boot_device_path(), we can call this function where it
needs. It's easy to realize. :-)
Best Regards,
Jun Li
Hi Andreas,
Quoted 17 lines · Andreas Färber
Hi,
Am 19.05.2014 17:03, schrieb Jun Li:
Quoted 8 lines
Add
remove_boot_device_path()function to remove bootindex when hot-unplug a device. This patch fixed virtio-blk/virtio-net/scsi-disk/scsi-generic device.Signed-off-by Jun Li <[email protected]>---
This patch also fixed bug1086603, ref:
https://bugzilla.redhat.com/show_bug.cgi?id=1086603Quoted 6 lines
This version of patch delete dev and suffix parameter from function
remove_boot_device_path().--- hw/block/virtio-blk.c | 1 + hw/net/virtio-net.c | 1 + hw/scsi/scsi-disk.c | 1 + hw/scsi/scsi-generic.c | 1 +
Quoted 5 lines
On v1 I believe I reminded you of
spapr_llan. Your patch is adding a new remove_*() function, but is using it only for roughly half of the devices that currently calladd_boot_device_path(). Why? I can understand that ISA devices will not be hot-unpluggable, but all PCI and USB devices are.
Yes, as I am not so family with spapr_llan, so just fixed roughly half of the devices. I have checked the following files.
Quoted 1 line
hw/block/fdc.c:add_boot_device_path(isa->bootindexA, dev, "/floppy@0");
No need here, ISA not support hot-unplug.
Quoted 1 line
hw/block/fdc.c:add_boot_device_path(isa->bootindexB, dev, "/floppy@1");
No need here, ISA not support hot-unplug.
Quoted 2 lines
hw/block/virtio-blk.c: add_boot_device_path(s->conf->bootindex, dev,
"/disk@0,0");
Has done.
Quoted 1 line
hw/core/loader.c:add_boot_device_path(bootindex, NULL, devpath);
No need here.
Quoted 2 lines
hw/i386/kvm/pci-assign.c: add_boot_device_path(dev->bootindex,&pci_dev->qdev, NULL);
I will add in assigned_exitfn().
Quoted 1 line
hw/ide/qdev.c: add_boot_device_path(dev->conf.bootindex,&dev->qdev,
ide doesn't support hot-unplug. so no need here.
Quoted 1 line
hw/misc/vfio.c:add_boot_device_path(vdev->bootindex, &pdev->qdev, NULL);
I will add in vfio_exitfn().
Quoted 2 lines
hw/net/e1000.c: add_boot_device_path(d->conf.bootindex, dev,
"/ethernet-phy@0");
I will add in pci_e1000_uninit().
Quoted 2 lines
hw/net/eepro100.c: add_boot_device_path(s->conf.bootindex,&pci_dev->qdev, "/ethernet-phy@0");
I will add in pci_nic_uninit().
Quoted 2 lines
hw/net/ne2000.c: add_boot_device_path(s->c.bootindex,&pci_dev->qdev,
"/ethernet-phy@0");
I will add in ci_ne2000_exit().
Quoted 2 lines
hw/net/pcnet.c: add_boot_device_path(s->conf.bootindex, dev,
"/ethernet-phy@0");
No need here.
Quoted 2 lines
hw/net/rtl8139.c: add_boot_device_path(s->conf.bootindex, d,
"/ethernet-phy@0");
I will in add pci_rtl8139_uninit().
Quoted 2 lines
hw/net/spapr_llan.c: add_boot_device_path(dev->nicconf.bootindex,
DEVICE(dev), "");
No need here.
Quoted 2 lines
hw/net/virtio-net.c: add_boot_device_path(n->nic_conf.bootindex, dev,
"/ethernet-phy@0");
I will add in virtio_net_device_unrealize().
Quoted 2 lines
hw/net/vmxnet3.c: add_boot_device_path(s->conf.bootindex, dev,
"/ethernet-phy@0");
I will add in vmxnet3_pci_uninit().
Quoted 2 lines
hw/scsi/scsi-disk.c: add_boot_device_path(s->qdev.conf.bootindex,&dev->qdev, NULL);
has done.
Quoted 2 lines
hw/scsi/scsi-generic.c: add_boot_device_path(s->conf.bootindex,&s->qdev, NULL);
it doesn't support hot-unplug, so no need here.
Quoted 2 lines
hw/usb/dev-network.c: add_boot_device_path(s->conf.bootindex,&dev->qdev, "/ethernet@0");
no need here.
Quoted 2 lines
hw/usb/host-libusb.c: add_boot_device_path(s->bootindex,&udev->qdev,
NULL);
No need here.
Quoted 2 lines
hw/usb/redirect.c: add_boot_device_path(dev->bootindex,&udev->qdev,
NULL);
No need here. Generic pass-through doesn't support hot-unplug.
Quoted 35 lines
Quoted 35 lines
include/sysemu/sysemu.h | 1 + vl.c | 15 +++++++++++++++ 6 files changed, 20 insertions(+)hw/block/virtio-blk.c +1
-0@@ -752,6 +752,7 @@ static void virtio_blk_device_unrealize(DeviceState *dev, Error **errp)unregister_savevm (dev,"virtio-blk" , s);blockdev_mark_auto_del (s->bs);virtio_cleanup (vdev); +remove_boot_device_path (s->conf->bootindex); }static Property virtio_blk_properties[] = {hw/net/virtio-net.c +1
-0@@ -1645,6 +1645,7 @@ static void virtio_net_device_unrealize(DeviceState *dev, Error **errp)g_free (n->vqs);qemu_del_nic (n->nic);virtio_cleanup (vdev); +remove_boot_device_path (n->nic_conf.bootindex); }static void virtio_net_instance_init (Object *obj)hw/scsi/scsi-disk.c +0
-0@@ -2156,6 +2156,7 @@ static void scsi_destroy(SCSIDevice *dev)
Quoted 6 lines
hw/scsi/scsi-disk.c static void scsi_destroy(SCSIDevice *dev) · line 2159
Quoted 3 lines
hw/scsi/scsi-disk.c +1
-0scsi_device_purge_requests (&s->qdev,SENSE_CODE (NO_SENSE ));blockdev_mark_auto_del (s->qdev.conf.bs); +remove_boot_device_path (s->qdev.conf.bootindex);Didn't I previously ask that you use
dev->config.bootindexhere? Pointers to parent's struct shouldn't be accessed anywhere except VMStateDescription.
ok.
Quoted 35 lines
Quoted 35 lines
hw/scsi/scsi-disk.c +0
-0}static void scsi_disk_resize_cb (void *opaque)hw/scsi/scsi-generic.c +1
-0@@ -390,6 +390,7 @@ static void scsi_destroy(SCSIDevice *s) {scsi_device_purge_requests (s,SENSE_CODE (NO_SENSE ));blockdev_mark_auto_del (s->conf.bs); +remove_boot_device_path (s->conf.bootindex); }static int scsi_generic_initfn (SCSIDevice *s)include/sysemu/sysemu.h +1
-0@@ -193,6 +193,7 @@ void rtc_change_mon_event(struct tm *tm);void add_boot_device_path (int32_t bootindex,DeviceState *dev,const char *suffix); +void remove_boot_device_path (int32_t bootindex);char *get_boot_devices_list (size_t *size,bool ignore_suffixes);DeviceState *get_boot_device (uint32_t position);vl.c +0
-0@@ -1189,6 +1189,21 @@ void add_boot_device_path(int32_t bootindex, DeviceState *dev,QTAILQ_INSERT_TAIL (&fw_boot_order, node, link); }
Quoted 10 lines
vl.c void add_boot_device_path(int32_t bootindex, DeviceState *dev, · line 1200
Quoted 9 lines
vl.c +9
-0+void remove_boot_device_path (int32_t bootindex) +{ +FWBootEntry *node, *next_node; + +if (bootindex ==-1 ) { +return ; + } + +QTAILQ_FOREACH_SAFE (node, &fw_boot_order, link, next_node)Coding Style requires braces around the below single-statement if.
ok. I will submit a update version later. Thank you very much.
Best Regards,
Jun Li