[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 25/26] gen_pcie_root_port: Add ACS (Access Control Se
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 25/26] gen_pcie_root_port: Add ACS (Access Control Services) capability |
Date: |
Tue, 12 Mar 2019 22:55:41 -0400 |
From: Knut Omang <address@hidden>
Claim ACS support in the generic PCIe root port to allow
passthrough of individual functions of a device to different
guests (in a nested virt.setting) with VFIO.
Without this patch, all functions of a device, such as all VFs of
an SR/IOV device, will end up in the same IOMMU group.
A similar situation occurs on Windows with Hyper-V.
In the single function device case, it also has a small cosmetic
benefit in that the root port itself is not grouped with
the device. VFIO handles that situation in that binding rules
only apply to endpoints, so it does not limit passthrough in
those cases.
Signed-off-by: Knut Omang <address@hidden>
Reviewed-by: Marcel Apfelbaum <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
Reviewed-by: Alex Williamson <address@hidden>
---
include/hw/pci/pcie_port.h | 1 +
hw/pci-bridge/gen_pcie_root_port.c | 4 ++++
hw/pci-bridge/pcie_root_port.c | 4 ++++
3 files changed, 9 insertions(+)
diff --git a/include/hw/pci/pcie_port.h b/include/hw/pci/pcie_port.h
index df242a0caf..09586f4641 100644
--- a/include/hw/pci/pcie_port.h
+++ b/include/hw/pci/pcie_port.h
@@ -78,6 +78,7 @@ typedef struct PCIERootPortClass {
int exp_offset;
int aer_offset;
int ssvid_offset;
+ int acs_offset; /* If nonzero, optional ACS capability offset */
int ssid;
} PCIERootPortClass;
diff --git a/hw/pci-bridge/gen_pcie_root_port.c
b/hw/pci-bridge/gen_pcie_root_port.c
index 9766edb445..26bda73eae 100644
--- a/hw/pci-bridge/gen_pcie_root_port.c
+++ b/hw/pci-bridge/gen_pcie_root_port.c
@@ -20,6 +20,9 @@
OBJECT_CHECK(GenPCIERootPort, (obj), TYPE_GEN_PCIE_ROOT_PORT)
#define GEN_PCIE_ROOT_PORT_AER_OFFSET 0x100
+#define GEN_PCIE_ROOT_PORT_ACS_OFFSET \
+ (GEN_PCIE_ROOT_PORT_AER_OFFSET + PCI_ERR_SIZEOF)
+
#define GEN_PCIE_ROOT_PORT_MSIX_NR_VECTOR 1
typedef struct GenPCIERootPort {
@@ -149,6 +152,7 @@ static void gen_rp_dev_class_init(ObjectClass *klass, void
*data)
rpc->interrupts_init = gen_rp_interrupts_init;
rpc->interrupts_uninit = gen_rp_interrupts_uninit;
rpc->aer_offset = GEN_PCIE_ROOT_PORT_AER_OFFSET;
+ rpc->acs_offset = GEN_PCIE_ROOT_PORT_ACS_OFFSET;
}
static const TypeInfo gen_rp_dev_info = {
diff --git a/hw/pci-bridge/pcie_root_port.c b/hw/pci-bridge/pcie_root_port.c
index 34ad76743c..e94d918b6d 100644
--- a/hw/pci-bridge/pcie_root_port.c
+++ b/hw/pci-bridge/pcie_root_port.c
@@ -47,6 +47,7 @@ static void rp_reset(DeviceState *qdev)
pcie_cap_deverr_reset(d);
pcie_cap_slot_reset(d);
pcie_cap_arifwd_reset(d);
+ pcie_acs_reset(d);
pcie_aer_root_reset(d);
pci_bridge_reset(qdev);
pci_bridge_disable_base_limit(d);
@@ -106,6 +107,9 @@ static void rp_realize(PCIDevice *d, Error **errp)
pcie_aer_root_init(d);
rp_aer_vector_update(d);
+ if (rpc->acs_offset) {
+ pcie_acs_init(d, rpc->acs_offset);
+ }
return;
err:
--
MST
- [Qemu-devel] [PULL 00/26] pci, pc, virtio: features, fixes, cleanups, Michael S. Tsirkin, 2019/03/12
- [Qemu-devel] [PULL 23/26] vhost-user-blk: Add support to get/set inflight buffer, Michael S. Tsirkin, 2019/03/12
- [Qemu-devel] [PULL 26/26] i386, acpi: check acpi_memory_hotplug capacity in pre_plug, Michael S. Tsirkin, 2019/03/12
- [Qemu-devel] [PULL 25/26] gen_pcie_root_port: Add ACS (Access Control Services) capability,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 24/26] pcie: Add a simple PCIe ACS (Access Control Services) helper function, Michael S. Tsirkin, 2019/03/12
- [Qemu-devel] [PULL 21/26] libvhost-user: Introduce vu_queue_map_desc(), Michael S. Tsirkin, 2019/03/12
- [Qemu-devel] [PULL 22/26] libvhost-user: Support tracking inflight I/O in shared memory, Michael S. Tsirkin, 2019/03/12
- [Qemu-devel] [PULL 19/26] vhost-user: Support transferring inflight buffer between qemu and backend, Michael S. Tsirkin, 2019/03/12
- [Qemu-devel] [PULL 20/26] libvhost-user: Remove unnecessary FD flag check for event file descriptors, Michael S. Tsirkin, 2019/03/12
- [Qemu-devel] [PULL 17/26] nvdimm: use *function* directly instead of allocating it again, Michael S. Tsirkin, 2019/03/12
- [Qemu-devel] [PULL 18/26] nvdimm: use NVDIMM_ACPI_IO_LEN for the proper IO size, Michael S. Tsirkin, 2019/03/12
- [Qemu-devel] [PULL 16/26] nvdimm: fix typo in nvdimm_build_nvdimm_devices argument, Michael S. Tsirkin, 2019/03/12