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.

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2017-10-20 10:17:50 +02:00
parent b33afc4156
commit ab37bfc7d6
9 changed files with 6 additions and 1931 deletions

View File

@ -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

View File

@ -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

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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(dev, "%s\n", "Failed to disable pci-sysfs rom file");
}
fclose(fp);

View File

@ -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 */

View File

@ -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 },

View File

@ -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},