pci: Bury dead legacy commands pci_add, pci_del
v2 cover pci: Bury dead legacy commands pci_add, pci_del
With great pleasure.
v2:
* Trivially rebases on master (041ccc9) plus my "[PULL 00/13]
QemuOpts: Convert various setters to Error"
(git://repo.or.cz/qemu/armbru.git tags/pull-error-2015-02-26)
Markus Armbruster (2):
pci-hotplug-old: Has been dead for five major releases, bury
pci: Give a few helpers internal linkage
default-configs/i386-softmmu.mak | 1 - default-configs/x86_64-softmmu.mak | 1 - device-hotplug.c | 7 +- hmp-commands.hx | 32 ---- hw/pci/Makefile.objs | 2 - hw/pci/pci-hotplug-old.c | 342 ------------------------------------- hw/pci/pci.c | 14 +- include/hw/pci/pci.h | 7 - include/sysemu/blockdev.h | 2 - include/sysemu/sysemu.h | 5 - stubs/Makefile.objs | 1 - stubs/pci-drive-hot-add.c | 10 -- 12 files changed, 10 insertions(+), 414 deletions(-) delete mode 100644 hw/pci/pci-hotplug-old.c delete mode 100644 stubs/pci-drive-hot-add.c
Signature · 1 line
1.9.3
PATCH v2 1/2 pci-hotplug-old: Has been dead for five major releases, bury
Commit 79ca616 (v1.6.0) accidentally disabled legacy x86-only HMP commands pci_add, pci_del: it defined CONFIG_PCI_HOTPLUG only as make variable, not as preprocessor macro, killing the code conditional on defined(CONFIG_PCI_HOTPLUG_OLD).
In all this time, nobody reported the loss. I only noticed it when I tried to test some error reporting change that forced me to touch this old crap again.
Fun: git-log hw/pci/pci-hotplug-old.c shows our faith in the backward compatibility god has been strong enough to sacrifice at its altar about a dozen times, but not strong enough to even once verify the legacy feature's still there, let alone works.
Remove the commands along with the code backing them.
--- default-configs/i386-softmmu.mak | 1 - default-configs/x86_64-softmmu.mak | 1 - device-hotplug.c | 7 +- hmp-commands.hx | 32 ---- hw/pci/Makefile.objs | 2 - hw/pci/pci-hotplug-old.c | 342 ------------------------------------- include/sysemu/blockdev.h | 2 - include/sysemu/sysemu.h | 5 - stubs/Makefile.objs | 1 - stubs/pci-drive-hot-add.c | 10 -- 10 files changed, 3 insertions(+), 400 deletions(-) delete mode 100644 hw/pci/pci-hotplug-old.c delete mode 100644 stubs/pci-drive-hot-add.c
default-configs/i386-softmmu.mak +0 -1
@@ -26,7 +26,6 @@ CONFIG_APPLESMC=y CONFIG_I8259=y CONFIG_PFLASH_CFI01=y CONFIG_TPM_TIS=$(CONFIG_TPM) -CONFIG_PCI_HOTPLUG_OLD=y CONFIG_MC146818RTC=y CONFIG_PAM=y CONFIG_PCI_PIIX=y
default-configs/x86_64-softmmu.mak +0 -1
@@ -26,7 +26,6 @@ CONFIG_APPLESMC=y CONFIG_I8259=y CONFIG_PFLASH_CFI01=y CONFIG_TPM_TIS=$(CONFIG_TPM) -CONFIG_PCI_HOTPLUG_OLD=y CONFIG_MC146818RTC=y CONFIG_PAM=y CONFIG_PCI_PIIX=y
device-hotplug.c +3 -4
@@ -30,7 +30,7 @@#include "sysemu/sysemu.h" #include "monitor/monitor.h" -DriveInfo *add_init_drive (const char *optstr) +static DriveInfo *add_init_drive (const char *optstr) {DriveInfo *dinfo;QemuOpts *opts;
@@ -69,9 +69,8 @@ void hmp_drive_add(Monitor *mon, const QDict *qdict)monitor_printf (mon,"OK\n" );break ;default : -if (pci_drive_hot_add (mon, qdict, dinfo)) { - goto err; - } +monitor_printf (mon,"Can't hot-add drive to type %d\n" , dinfo->type); + goto err; }return ;
hmp-commands.hx +0 -32
@@ -1149,38 +1149,6 @@ STEXI Add drive to PCI storage controller. ETEXI -#if defined(CONFIG_PCI_HOTPLUG_OLD) - { - .name = "pci_add", - .args_type = "pci_addr:s,type:s,opts:s?", - .params = "auto|[[<domain>:]<bus>:]<slot> nic|storage [[vlan=n][,macaddr=addr][,model=type]] [file=file][,if=type][,bus=nr]...", - .help = "hot-add PCI device", - .mhandler.cmd = hmp_pci_add, - }, -#endif - -STEXI -@item pci_add -@findex pci_add -Hot-add PCI device. -ETEXI - -#if defined(CONFIG_PCI_HOTPLUG_OLD) - { - .name = "pci_del", - .args_type = "pci_addr:s", - .params = "[[<domain>:]<bus>:]<slot>", - .help = "hot remove PCI device", - .mhandler.cmd = hmp_pci_del, - }, -#endif - -STEXI -@item pci_del -@findex pci_del -Hot remove PCI device. -ETEXI - { .name = "pcie_aer_inject_error", .args_type = "advisory_non_fatal:-a,correctable:-c,"
hw/pci/Makefile.objs +0 -2
@@ -7,5 +7,3 @@ common-obj-$(CONFIG_PCI) += pcie.o pcie_aer.o pcie_port.o common-obj-$(call lnot,$(CONFIG_PCI)) += pci-stub.o common-obj-$(CONFIG_ALL) += pci-stub.o - -common-obj-$(CONFIG_PCI_HOTPLUG_OLD) += pci-hotplug-old.o
hw/pci/pci-hotplug-old.c deleted +0 -342
342 lines not on this page · raw message
include/sysemu/blockdev.h +0 -2
@@ -63,8 +63,6 @@ DriveInfo *drive_new(QemuOpts *arg, BlockInterfaceType block_default_type);/* device-hotplug */ -DriveInfo *add_init_drive (const char *opts); -void qmp_change_blockdev (const char *device,const char *filename,const char *format,Error **errp);void hmp_commit (Monitor *mon,const QDict *qdict);
include/sysemu/sysemu.h +0 -5
@@ -174,11 +174,6 @@ extern int nb_option_roms;extern const char *prom_envs[MAX_PROM_ENVS ];extern unsigned int nb_prom_envs; -/* pci-hotplug */ -void hmp_pci_add (Monitor *mon,const QDict *qdict); -int pci_drive_hot_add (Monitor *mon,const QDict *qdict,DriveInfo *dinfo); -void hmp_pci_del (Monitor *mon,const QDict *qdict); -/* generic hotplug */ void hmp_drive_add (Monitor *mon,const QDict *qdict);
stubs/Makefile.objs +0 -1
@@ -24,7 +24,6 @@ stub-obj-y += mon-printf.o stub-obj-y += mon-set-error.o stub-obj-y += monitor-init.o stub-obj-y += notify-event.o -stub-obj-y += pci-drive-hot-add.o stub-obj-$(CONFIG_SPICE) += qemu-chr-open-spice.o stub-obj-y += qtest.o stub-obj-y += reset.o
stubs/pci-drive-hot-add.c deleted +0 -10
@@ -1,10 +0,0 @@ -#include <monitor/monitor.h> -#include <sysemu/sysemu.h> -#include <sysemu/blockdev.h> - -int pci_drive_hot_add (Monitor *mon,const QDict *qdict,DriveInfo *dinfo) -{ -/* On non-x86 we don't do PCI hotplug */ -monitor_printf (mon,"Can't hot-add drive to type %d\n" , dinfo->type); -return -1 ; -}
Signature · 1 line
1.9.3
PATCH v2 2/2 pci: Give a few helpers internal linkage
In reply to Markus ArmbrusterNone of them should be used in new code.
--- hw/pci/pci.c | 14 +++++++------- include/hw/pci/pci.h | 7 ------- 2 files changed, 7 insertions(+), 14 deletions(-)
hw/pci/pci.c +7 -7
@@ -539,8 +539,8 @@ static void pci_set_default_subsystem_id(PCIDevice *pci_dev)* Parse [[<domain>:]<bus>:]<slot>, return -1 on error if funcp == NULL * [[<domain>:]<bus>:]<slot>.<func>, return -1 on error */ -int pci_parse_devaddr (const char *addr,int *domp,int *busp, -unsigned int *slotp,unsigned int *funcp) +static int pci_parse_devaddr (const char *addr,int *domp,int *busp, +unsigned int *slotp,unsigned int *funcp) {const char *p;char *e;
@@ -598,7 +598,8 @@ int pci_parse_devaddr(const char *addr, int *domp, int *busp,return 0 ; } -PCIBus *pci_get_bus_devfn (int *devfnp,PCIBus *root,const char *devaddr) +static PCIBus *pci_get_bus_devfn (int *devfnp,PCIBus *root, +const char *devaddr) {int dom, bus;unsigned slot;
@@ -1605,10 +1606,9 @@ static const char * const pci_nic_names[] = { };/* Initialize a PCI NIC. */ -/* FIXME callers should check for failure, but don't */ -PCIDevice *pci_nic_init (NICInfo *nd,PCIBus *rootbus, -const char *default_model, -const char *default_devaddr) +static PCIDevice *pci_nic_init (NICInfo *nd,PCIBus *rootbus, +const char *default_model, +const char *default_devaddr) {const char *devaddr = nd->devaddr ? nd->devaddr : default_devaddr;PCIBus *bus;
include/hw/pci/pci.h +0 -7
@@ -370,9 +370,6 @@ void pci_device_set_intx_routing_notifier(PCIDevice *dev, PCIINTxRoutingNotifier notifier);void pci_device_reset (PCIDevice *dev); -PCIDevice *pci_nic_init (NICInfo *nd,PCIBus *rootbus, -const char *default_model, -const char *default_devaddr);PCIDevice *pci_nic_init_nofail (NICInfo *nd,PCIBus *rootbus,const char *default_model,const char *default_devaddr);
@@ -402,12 +399,8 @@ PCIBus *pci_device_root_bus(const PCIDevice *d);const char *pci_root_bus_path (PCIDevice *dev);PCIDevice *pci_find_device (PCIBus *bus,int bus_num,uint8_t devfn);int pci_qdev_find_device (const char *id,PCIDevice **pdev); -PCIBus *pci_get_bus_devfn (int *devfnp,PCIBus *root,const char *devaddr);void pci_bus_get_w64_range (PCIBus *bus,Range *range); -int pci_parse_devaddr (const char *addr,int *domp,int *busp, -unsigned int *slotp,unsigned int *funcp); -void pci_device_deassert_intx (PCIDevice *dev);typedef AddressSpace *(*PCIIOMMUFunc )(PCIBus *,void *,int );
Signature · 1 line
1.9.3