[PATCH 4/4] pci-assign: Remove broken -pcidevice and pci_add host

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



These qemu-kvm-only interfaces were broken by b560a9ab9b, but no one
complained loud enough to get them fixed again. As we have properly
working "-device pci-assign"/"device_add" and we won't push this
upstream anyway, there is likely no point in restoring the interface.

Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxxxxxxx>
CC: Markus Armbruster <armbru@xxxxxxxxxx>
CC: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 hmp-commands.hx        |    2 +-
 hw/device-assignment.c |   63 ------------------------------------------------
 hw/device-assignment.h |    7 -----
 hw/ipf.c               |    6 ----
 hw/pc.c                |    6 ----
 hw/pci-hotplug.c       |   22 ----------------
 qemu-options.hx        |    5 ----
 vl.c                   |   14 ----------
 8 files changed, 1 insertions(+), 124 deletions(-)

diff --git a/hmp-commands.hx b/hmp-commands.hx
index 9406496..ba6de28 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -806,7 +806,7 @@ ETEXI
     {
         .name       = "pci_add",
         .args_type  = "pci_addr:s,type:s,opts:s?",
-        .params     = "auto|[[<domain>:]<bus>:]<slot> nic|storage|host [[vlan=n][,macaddr=addr][,model=type]] [file=file][,if=type][,bus=nr]... [host=02:00.0[,name=string][,dma=none]",
+        .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 = pci_device_hot_add,
     },
diff --git a/hw/device-assignment.c b/hw/device-assignment.c
index d8c565c..0bbf9d9 100644
--- a/hw/device-assignment.c
+++ b/hw/device-assignment.c
@@ -1561,69 +1561,6 @@ static void assign_register_devices(void)
 
 device_init(assign_register_devices)
 
-
-/*
- * Syntax to assign device:
- *
- * -pcidevice host=bus:dev.func[,dma=none][,name=Foo]
- *
- * Example:
- * -pcidevice host=00:13.0,dma=pvdma
- *
- * dma can currently only be 'none' to disable iommu support.
- */
-QemuOpts *add_assigned_device(const char *arg)
-{
-    QemuOpts *opts = NULL;
-    char host[64], id[64], dma[8];
-    int r;
-
-    r = get_param_value(host, sizeof(host), "host", arg);
-    if (!r)
-         goto bad;
-    r = get_param_value(id, sizeof(id), "id", arg);
-    if (!r)
-        r = get_param_value(id, sizeof(id), "name", arg);
-    if (!r)
-        r = get_param_value(id, sizeof(id), "host", arg);
-
-    opts = qemu_opts_create(qemu_find_opts("device"), id, 0);
-    if (!opts)
-        goto bad;
-    qemu_opt_set(opts, "driver", "pci-assign");
-    qemu_opt_set(opts, "host", host);
-
-#ifdef KVM_CAP_IOMMU
-    r = get_param_value(dma, sizeof(dma), "dma", arg);
-    if (r && !strncmp(dma, "none", 4))
-        qemu_opt_set(opts, "iommu", "0");
-#endif
-    qemu_opts_print(opts, NULL);
-    return opts;
-
-bad:
-    fprintf(stderr, "pcidevice argument parse error; "
-            "please check the help text for usage\n");
-    if (opts)
-        qemu_opts_del(opts);
-    return NULL;
-}
-
-void add_assigned_devices(PCIBus *bus, const char **devices, int n_devices)
-{
-    QemuOpts *opts;
-    int i;
-
-    for (i = 0; i < n_devices; i++) {
-        opts = add_assigned_device(devices[i]);
-        if (opts == NULL) {
-            fprintf(stderr, "Could not add assigned device %s\n", devices[i]);
-            exit(1);
-        }
-        /* generic code will call qdev_device_add() for the device */
-    }
-}
-
 /*
  * Scan the assigned devices for the devices that have an option ROM, and then
  * load the corresponding ROM data to RAM. If an error occurs while loading an
diff --git a/hw/device-assignment.h b/hw/device-assignment.h
index 56b7076..c94a730 100644
--- a/hw/device-assignment.h
+++ b/hw/device-assignment.h
@@ -114,13 +114,6 @@ typedef struct AssignedDevice {
     QLIST_ENTRY(AssignedDevice) next;
 } AssignedDevice;
 
-QemuOpts *add_assigned_device(const char *arg);
-void add_assigned_devices(PCIBus *bus, const char **devices, int n_devices);
 void assigned_dev_update_irqs(void);
 
-#define MAX_DEV_ASSIGN_CMDLINE 8
-
-extern const char *assigned_devices[MAX_DEV_ASSIGN_CMDLINE];
-extern int assigned_devices_index;
-
 #endif              /* __DEVICE_ASSIGNMENT_H__ */
diff --git a/hw/ipf.c b/hw/ipf.c
index 21cff72..10c21eb 100644
--- a/hw/ipf.c
+++ b/hw/ipf.c
@@ -635,12 +635,6 @@ static void ipf_init1(ram_addr_t ram_size,
 	    unit_id++;
 	}
     }
-
-#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
-    if (kvm_enabled())
-	add_assigned_devices(pci_bus, assigned_devices, assigned_devices_index);
-#endif /* CONFIG_KVM_DEVICE_ASSIGNMENT */
-
 }
 
 static void ipf_init_pci(ram_addr_t ram_size,
diff --git a/hw/pc.c b/hw/pc.c
index b624873..3bf3862 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1105,10 +1105,4 @@ void pc_pci_device_init(PCIBus *pci_bus)
 
         extboot_init(info->bdrv);
     }
-
-#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
-    if (kvm_enabled()) {
-        add_assigned_devices(pci_bus, assigned_devices, assigned_devices_index);
-    }
-#endif /* CONFIG_KVM_DEVICE_ASSIGNMENT */
 }
diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c
index b370b9b..a2d4bb2 100644
--- a/hw/pci-hotplug.c
+++ b/hw/pci-hotplug.c
@@ -230,24 +230,6 @@ static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon,
     return dev;
 }
 
-#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
-static PCIDevice *qemu_pci_hot_assign_device(Monitor *mon,
-                                             const char *devaddr,
-                                             const char *opts_str)
-{
-    QemuOpts *opts;
-    DeviceState *dev;
-
-    opts = add_assigned_device(opts_str);
-    if (opts == NULL) {
-        monitor_printf(mon, "Error adding device; check syntax\n");
-        return NULL;
-    }
-    dev = qdev_device_add(opts);
-    return DO_UPCAST(PCIDevice, qdev, dev);
-}
-#endif /* CONFIG_KVM_DEVICE_ASSIGNMENT */
-
 void pci_device_hot_add(Monitor *mon, const QDict *qdict)
 {
     PCIDevice *dev = NULL;
@@ -271,10 +253,6 @@ void pci_device_hot_add(Monitor *mon, const QDict *qdict)
         dev = qemu_pci_hot_add_nic(mon, pci_addr, opts);
     } else if (strcmp(type, "storage") == 0) {
         dev = qemu_pci_hot_add_storage(mon, pci_addr, opts);
-#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
-    } else if (strcmp(type, "host") == 0) {
-        dev = qemu_pci_hot_assign_device(mon, pci_addr, opts);
-#endif /* CONFIG_KVM_DEVICE_ASSIGNMENT */
     } else {
         monitor_printf(mon, "invalid type: %s\n", type);
     }
diff --git a/qemu-options.hx b/qemu-options.hx
index 1c9a1e5..699b653 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -2278,11 +2278,6 @@ DEF("no-kvm-pit-reinjection", 0, QEMU_OPTION_no_kvm_pit_reinjection,
     "-no-kvm-pit-reinjection\n"
     "                disable KVM kernel mode PIT interrupt reinjection\n",
     QEMU_ARCH_I386)
-DEF("pcidevice", HAS_ARG, QEMU_OPTION_pcidevice,
-    "-pcidevice host=[seg:]bus:dev.func[,dma=none][,name=string]\n"
-    "                expose a PCI device to the guest OS\n"
-    "                dma=none: don't perform any dma translations (default is to use an iommu)\n"
-    "                'string' is used in log output\n", QEMU_ARCH_I386)
 DEF("enable-nesting", 0, QEMU_OPTION_enable_nesting,
     "-enable-nesting enable support for running a VM inside the VM (AMD only)\n", QEMU_ARCH_I386)
 DEF("nvram", HAS_ARG, QEMU_OPTION_nvram,
diff --git a/vl.c b/vl.c
index 42617c2..b5da216 100644
--- a/vl.c
+++ b/vl.c
@@ -204,8 +204,6 @@ int win2k_install_hack = 0;
 int rtc_td_hack = 0;
 int usb_enabled = 0;
 int singlestep = 0;
-const char *assigned_devices[MAX_DEV_ASSIGN_CMDLINE];
-int assigned_devices_index;
 int smp_cpus = 1;
 int max_cpus = 0;
 int smp_cores = 1;
@@ -1885,8 +1883,6 @@ int main(int argc, char **argv, char **envp)
         node_cpumask[i] = 0;
     }
 
-    assigned_devices_index = 0;
-
     nb_numa_nodes = 0;
     nb_nics = 0;
 
@@ -2502,16 +2498,6 @@ int main(int argc, char **argv, char **envp)
 		break;
 	    }
 #endif
-#if defined(TARGET_I386) || defined(TARGET_X86_64) || defined(TARGET_IA64) || defined(__linux__)
-            case QEMU_OPTION_pcidevice:
-		if (assigned_devices_index >= MAX_DEV_ASSIGN_CMDLINE) {
-                    fprintf(stderr, "Too many assigned devices\n");
-                    exit(1);
-		}
-		assigned_devices[assigned_devices_index] = optarg;
-		assigned_devices_index++;
-                break;
-#endif
             case QEMU_OPTION_usb:
                 usb_enabled = 1;
                 break;
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux