Skip to contentSkip to conversation

pci-assign: Remove

PATCH In review Paolo Bonzini 3 participants 3 messages Oct 20, 2017 – Oct 25, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pci-assign: Remove

Legacy PCI device assignment has been removed from Linux in 4.12, and had been deprecated 2 years ago there. We can remove it from QEMU as well.

The ROM loading code was shared with Xen PCI passthrough, so move it to hw/xen.

Cc Stefano Stabellini <[email protected]>
Cc Anthony Perard <[email protected]>

---
Xen parts only compile-tested.

 docs/qdev-device-use.txt                           |   12 +-
 hw/i386/Makefile.objs                              |    1 -
 hw/i386/kvm/Makefile.objs                          |    2 +-
 hw/i386/kvm/pci-assign.c                           | 1883 --------------------
 hw/xen/Makefile.objs                               |    1 +
 .../xen_pt_load_rom.c}                             |    4 +-
 include/hw/pci/pci-assign.h                        |   27 -
 qdev-monitor.c                                     |    1 -
 scripts/device-crash-test                          |    2 -
 9 files changed, 6 insertions(+), 1927 deletions(-)
 delete mode 100644 hw/i386/kvm/pci-assign.c
 rename hw/{i386/pci-assign-load-rom.c => xen/xen_pt_load_rom.c} (96%)
 delete mode 100644 include/hw/pci/pci-assign.h
docs/qdev-device-use.txt +2 -10
index 1f297b5e9c..8f188d1d0b 100644
@@ -366,17 +366,9 @@ bus=PCI-BUS,addr=DEVFN to control the PCI device address, as usual.
 === Host Device Assignment ===
 
 QEMU supports assigning host PCI devices (qemu-kvm only at this time)
-and host USB devices.
+and host USB devices.  PCI devices can only be assigned with -device:
 
-The old way to assign a host PCI device is
-
-    -pcidevice host=ADDR,dma=none,id=ID
-
-The new way is
-
-    -device pci-assign,host=ADDR,iommu=IOMMU,id=ID
-
-The old dma=none becomes iommu=off with -device.
+    -device vfio-pci,host=ADDR,id=ID
 
 The old way to assign a host USB device is
 
hw/i386/Makefile.objs +0 -1
index 909ead6a77..2e5e1299ad 100644
@@ -8,4 +8,3 @@ obj-$(CONFIG_XEN) += ../xenpv/ xen/
 
 obj-y += kvmvapic.o
 obj-y += acpi-build.o
-obj-y += pci-assign-load-rom.o
hw/i386/kvm/Makefile.objs +1 -1
index d8bce209bf..4224ed900e 100644
@@ -1 +1 @@
-obj-y += clock.o apic.o i8259.o ioapic.o i8254.o pci-assign.o
+obj-y += clock.o apic.o i8259.o ioapic.o i8254.o
hw/xen/Makefile.objs +1 -0
index 64a70bc6cb..9ea5c73423 100644
@@ -3,3 +3,4 @@ common-obj-$(CONFIG_XEN) += xen_backend.o xen_devconfig.o xen_pvdev.o xen-common
 
 obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen-host-pci-device.o
 obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt.o xen_pt_config_init.o xen_pt_graphics.o xen_pt_msi.o
+obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt_load_rom.o
hw/xen/xen_pt_load_rom.c renamed from hw/i386/pci-assign-load-rom.c +2 -2
similarity index 96%
rename from hw/i386/pci-assign-load-rom.c
rename to hw/xen/xen_pt_load_rom.c
index 43429b66be..2bc3b6c092 100644
@@ -12,7 +12,7 @@
 #include "qemu/range.h"
 #include "sysemu/sysemu.h"
 #include "hw/pci/pci.h"
-#include "hw/pci/pci-assign.h"
+#include "xen_pt.h"
 
 /*
  * Scan the assigned devices for the devices that have an option ROM, and then
@@ -80,7 +80,7 @@ close_rom:
     fseek(fp, 0, SEEK_SET);
     val = 0;
     if (!fwrite(&val, 1, 1, fp)) {
-        DEBUG("%s\n", "Failed to disable pci-sysfs rom file");
+        XEN_PT_WARN("%s\n", "Failed to disable pci-sysfs rom file");
     }
     fclose(fp);
 
include/hw/pci/pci-assign.h deleted +0 -27
deleted file mode 100644
index 55f42c56fa..0000000000
@@ -1,27 +0,0 @@
-/*
- * This work is licensed under the terms of the GNU GPL, version 2.  See
- * the COPYING file in the top-level directory.
- *
- * Just split from hw/i386/kvm/pci-assign.c.
- */
-#ifndef PCI_ASSIGN_H
-#define PCI_ASSIGN_H
-
-#include "hw/pci/pci.h"
-
-//#define DEVICE_ASSIGNMENT_DEBUG
-
-#ifdef DEVICE_ASSIGNMENT_DEBUG
-#define DEBUG(fmt, ...)                                       \
-    do {                                                      \
-        fprintf(stderr, "%s: " fmt, __func__ , __VA_ARGS__);  \
-    } while (0)
-#else
-#define DEBUG(fmt, ...)
-#endif
-
-void *pci_assign_dev_load_option_rom(PCIDevice *dev, struct Object *owner,
-                                     int *size, unsigned int domain,
-                                     unsigned int bus, unsigned int slot,
-                                     unsigned int function);
-#endif /* PCI_ASSIGN_H */
qdev-monitor.c +0 -1
index 8fd6df93d2..b4abb4b5ea 100644
@@ -46,7 +46,6 @@ typedef struct QDevAlias
 static const QDevAlias qdev_alias_table[] = {
     { "e1000", "e1000-82540em" },
     { "ich9-ahci", "ahci" },
-    { "kvm-pci-assign", "pci-assign" },
     { "lsi53c895a", "lsi" },
     { "virtio-9p-ccw", "virtio-9p", QEMU_ARCH_S390X },
     { "virtio-9p-pci", "virtio-9p", QEMU_ARCH_ALL & ~QEMU_ARCH_S390X },
scripts/device-crash-test +0 -2
index 043b24a4aa..c11fd81c52 100755
@@ -102,7 +102,6 @@ ERROR_WHITELIST = [
     {'device':'ivshmem', 'expected':True},                 # You must specify either 'shm' or 'chardev'
     {'device':'ivshmem-doorbell', 'expected':True},        # You must specify a 'chardev'
     {'device':'ivshmem-plain', 'expected':True},           # You must specify a 'memdev'
-    {'device':'kvm-pci-assign', 'expected':True},          # no host device specified
     {'device':'loader', 'expected':True},                  # please include valid arguments
     {'device':'nand', 'expected':True},                    # Unsupported NAND block size 0x1
     {'device':'nvdimm', 'expected':True},                  # 'memdev' property is not set
@@ -165,7 +164,6 @@ ERROR_WHITELIST = [
 
     # KVM-specific devices shouldn't be tried without accel=kvm:
     {'accel':'(?!kvm).*', 'device':'kvmclock', 'expected':True},
-    {'accel':'(?!kvm).*', 'device':'kvm-pci-assign', 'expected':True},
 
     # xen-specific machines and devices:
     {'accel':'(?!xen).*', 'machine':'xen.*', 'expected':True},
hw/i386/kvm/pci-assign.c deleted +0 -1883

1,883 lines not on this page · raw message

Signature · 7 lines
2.14.2


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v1 1/1
#1 lore raw
Quoted 45 lines · Paolo Bonzini

Legacy PCI device assignment has been removed from Linux in 4.12, and had been deprecated 2 years ago there. We can remove it from QEMU as well.

The ROM loading code was shared with Xen PCI passthrough, so move it to hw/xen.

Cc Stefano Stabellini <[email protected]>
Cc Anthony Perard <[email protected]>

---
Xen parts only compile-tested.

 docs/qdev-device-use.txt                           |   12 +-
 hw/i386/Makefile.objs                              |    1 -
 hw/i386/kvm/Makefile.objs                          |    2 +-
 hw/i386/kvm/pci-assign.c                           | 1883 --------------------
 hw/xen/Makefile.objs                               |    1 +
 .../xen_pt_load_rom.c}                             |    4 +-
 include/hw/pci/pci-assign.h                        |   27 -
 qdev-monitor.c                                     |    1 -
 scripts/device-crash-test                          |    2 -
 9 files changed, 6 insertions(+), 1927 deletions(-)
 delete mode 100644 hw/i386/kvm/pci-assign.c
 rename hw/{i386/pci-assign-load-rom.c => xen/xen_pt_load_rom.c} (96%)
 delete mode 100644 include/hw/pci/pci-assign.h
hw/xen/xen_pt_load_rom.c renamed from hw/i386/pci-assign-load-rom.c +1 -1
similarity index 96%
rename from hw/i386/pci-assign-load-rom.c
rename to hw/xen/xen_pt_load_rom.c
index 43429b66be..2bc3b6c092 100644
@@ -12,7 +12,7 @@
 #include "qemu/range.h"
 #include "sysemu/sysemu.h"
 #include "hw/pci/pci.h"
-#include "hw/pci/pci-assign.h"
+#include "xen_pt.h"
 
 /*
  * Scan the assigned devices for the devices that have an option ROM, and then

hw/xen/xen_pt_load_rom.c close_rom: · line 83

Quoted 5 lines
hw/xen/xen_pt_load_rom.c renamed from hw/i386/pci-assign-load-rom.c +1 -1
@@ -80,7 +80,7 @@ close_rom:
     fseek(fp, 0, SEEK_SET);
     val = 0;
     if (!fwrite(&val, 1, 1, fp)) {
-        DEBUG("%s\n", "Failed to disable pci-sysfs rom file");
+        XEN_PT_WARN("%s\n", "Failed to disable pci-sysfs rom file");

XEN_PT_WARN takes an extra argument, it should read:
XEN_PT_WARN(dev, "%s\n", "Failed to disable pci-sysfs rom file");

With that fixed:

Signature · 6 lines
Anthony PERARD

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#2 lore raw
Quoted 15 lines · Paolo Bonzini
Quoted 14 lines

Legacy PCI device assignment has been removed from Linux in 4.12, and had been deprecated 2 years ago there. We can remove it from QEMU as well.

The ROM loading code was shared with Xen PCI passthrough, so move it to hw/xen.

Cc Stefano Stabellini <[email protected]>
Cc Anthony Perard <[email protected]>

---
Xen parts only compile-tested.

Quoted 4 lines
Quoted 4 lines
 docs/qdev-device-use.txt                           |   12 +-
 hw/i386/Makefile.objs                              |    1 -
 hw/i386/kvm/Makefile.objs                          |    2 +-
 hw/i386/kvm/pci-assign.c                           | 1883 --------------------

nice cleanup <3

Quoted 36 lines
Quoted 27 lines
 hw/xen/Makefile.objs                               |    1 +
 .../xen_pt_load_rom.c}                             |    4 +-
 include/hw/pci/pci-assign.h                        |   27 -
 qdev-monitor.c                                     |    1 -
 scripts/device-crash-test                          |    2 -
 9 files changed, 6 insertions(+), 1927 deletions(-)
 delete mode 100644 hw/i386/kvm/pci-assign.c
 rename hw/{i386/pci-assign-load-rom.c => xen/xen_pt_load_rom.c} (96%)
 delete mode 100644 include/hw/pci/pci-assign.h
hw/xen/xen_pt_load_rom.c renamed from hw/i386/pci-assign-load-rom.c +1 -1
similarity index 96%
rename from hw/i386/pci-assign-load-rom.c
rename to hw/xen/xen_pt_load_rom.c
index 43429b66be..2bc3b6c092 100644
@@ -12,7 +12,7 @@
 #include "qemu/range.h"
 #include "sysemu/sysemu.h"
 #include "hw/pci/pci.h"
-#include "hw/pci/pci-assign.h"
+#include "xen_pt.h"
 
 /*
  * Scan the assigned devices for the devices that have an option ROM, and then

hw/xen/xen_pt_load_rom.c close_rom: · line 83

Quoted 5 lines
hw/xen/xen_pt_load_rom.c renamed from hw/i386/pci-assign-load-rom.c +1 -1
@@ -80,7 +80,7 @@ close_rom:
     fseek(fp, 0, SEEK_SET);
     val = 0;
     if (!fwrite(&val, 1, 1, fp)) {
-        DEBUG("%s\n", "Failed to disable pci-sysfs rom file");
+        XEN_PT_WARN("%s\n", "Failed to disable pci-sysfs rom file");

XEN_PT_WARN takes an extra argument, it should read:
XEN_PT_WARN(dev, "%s\n", "Failed to disable pci-sysfs rom file");

Quoted 2 lines

With that fixed:

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel