xio3130_downstream: Add ACS (Access Control Services) capability
PATCH 1/1 xio3130_downstream: Add ACS (Access Control Services) capability
When vfio-pci devices are attached to the downstream, pcie acs capability may be needed, Consistent with physical machine.
It has been tested in our environment, and pcie acs capability is required in some scenarios.
Claim ACS support in the downstream 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.
--- hw/pci-bridge/xio3130_downstream.c | 7 +++++++ 1 file changed, 7 insertions(+)
hw/pci-bridge/xio3130_downstream.c +7 -0
@@ -40,6 +40,8 @@#define XIO3130_SSVID_SSID 0#define XIO3130_EXP_OFFSET 0x90#define XIO3130_AER_OFFSET 0x100 +#define XIO3130_ACS_OFFSET \ + (XIO3130_AER_OFFSET + PCI_ERR_SIZEOF)static void xio3130_downstream_write_config (PCIDevice *d,uint32_t address,uint32_t val,int len)
@@ -111,6 +113,10 @@ static void xio3130_downstream_realize(PCIDevice *d, Error **errp) goto err; } +if (!s->disable_acs) { +pcie_acs_init (d,XIO3130_ACS_OFFSET ); + } +return ; err:
@@ -137,6 +143,7 @@ static void xio3130_downstream_exitfn(PCIDevice *d)static Property xio3130_downstream_props[] = {DEFINE_PROP_BIT (COMPAT_PROP_PCP , PCIDevice, cap_present,QEMU_PCIE_SLTCAP_PCP_BITNR , true), +DEFINE_PROP_BOOL ("x-disable-acs" , PCIESlot, disable_acs, true),DEFINE_PROP_END_OF_LIST () };
Signature · 1 line
2.24.3 (Apple Git-128)
ping
Quoted 54 lines · wlfightup
When vfio-pci devices are attached to the downstream, pcie acs capability may be needed, Consistent with physical machine.
It has been tested in our environment, and pcie acs capability is required in some scenarios.
Claim ACS support in the downstream 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.Signed-off-by wlfightup <[email protected]>--- hw/pci-bridge/xio3130_downstream.c | 7 +++++++ 1 file changed, 7 insertions(+)hw/pci-bridge/xio3130_downstream.c +7
-1@@ -40,6 +40,8 @@#define XIO3130_SSVID_SSID 0#define XIO3130_EXP_OFFSET 0x90#define XIO3130_AER_OFFSET 0x100 +#define XIO3130_ACS_OFFSET \ + (XIO3130_AER_OFFSET + PCI_ERR_SIZEOF)static void xio3130_downstream_write_config (PCIDevice *d,uint32_t address,uint32_t val,int len)@@ -111,6 +113,10 @@ static void xio3130_downstream_realize(PCIDevice *d, Error **errp) goto err; } +if (!s->disable_acs) { +pcie_acs_init (d,XIO3130_ACS_OFFSET ); + } +return ; err:@@ -137,6 +143,7 @@ static void xio3130_downstream_exitfn(PCIDevice *d)static Property xio3130_downstream_props[] = {DEFINE_PROP_BIT (COMPAT_PROP_PCP , PCIDevice, cap_present,QEMU_PCIE_SLTCAP_PCP_BITNR , true), +DEFINE_PROP_BOOL ("x-disable-acs" , PCIESlot, disable_acs, true),DEFINE_PROP_END_OF_LIST () }; --2.24.3 (Apple Git-128)
Hi Paul,
Quoted 6 lines · wlfightup
When vfio-pci devices are attached to the downstream, pcie acs capability may be needed, Consistent with physical machine.
It has been tested in our environment, and pcie acs capability is required in some scenarios.
Quoted 8 lines
Claim ACS support in the downstream 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.Signed-off-by wlfightup <[email protected]>
Please use your real name, "Paul Schlacter <[email protected]>" See https://www.qemu.org/docs/master/devel/submitting-a-patch.html
Cc'ing VFIO maintainers.
Regards,
Phil.
Quoted 36 lines
--- hw/pci-bridge/xio3130_downstream.c | 7 +++++++ 1 file changed, 7 insertions(+)hw/pci-bridge/xio3130_downstream.c +7
-0@@ -40,6 +40,8 @@#define XIO3130_SSVID_SSID 0#define XIO3130_EXP_OFFSET 0x90#define XIO3130_AER_OFFSET 0x100 +#define XIO3130_ACS_OFFSET \ + (XIO3130_AER_OFFSET + PCI_ERR_SIZEOF)static void xio3130_downstream_write_config (PCIDevice *d,uint32_t address,uint32_t val,int len)@@ -111,6 +113,10 @@ static void xio3130_downstream_realize(PCIDevice *d, Error **errp) goto err; } +if (!s->disable_acs) { +pcie_acs_init (d,XIO3130_ACS_OFFSET ); + } +return ; err:@@ -137,6 +143,7 @@ static void xio3130_downstream_exitfn(PCIDevice *d)static Property xio3130_downstream_props[] = {DEFINE_PROP_BIT (COMPAT_PROP_PCP , PCIDevice, cap_present,QEMU_PCIE_SLTCAP_PCP_BITNR , true), +DEFINE_PROP_BOOL ("x-disable-acs" , PCIESlot, disable_acs, true),DEFINE_PROP_END_OF_LIST () };
Quoted 6 lines · wlfightup
When vfio-pci devices are attached to the downstream, pcie acs capability may be needed, Consistent with physical machine.
It has been tested in our environment, and pcie acs capability is required in some scenarios.
Quoted 8 lines
Claim ACS support in the downstream 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.Signed-off-by wlfightup <[email protected]>
Hmm ok but this is an unstable property and nothing sets it. If your product starts using it, it will break when qemu changes the property in some way.
Do we want to maybe set this by default?
If not I am guessing at least a stable property is needed.
Quoted 38 lines
--- hw/pci-bridge/xio3130_downstream.c | 7 +++++++ 1 file changed, 7 insertions(+)hw/pci-bridge/xio3130_downstream.c +7
-0@@ -40,6 +40,8 @@#define XIO3130_SSVID_SSID 0#define XIO3130_EXP_OFFSET 0x90#define XIO3130_AER_OFFSET 0x100 +#define XIO3130_ACS_OFFSET \ + (XIO3130_AER_OFFSET + PCI_ERR_SIZEOF)static void xio3130_downstream_write_config (PCIDevice *d,uint32_t address,uint32_t val,int len)@@ -111,6 +113,10 @@ static void xio3130_downstream_realize(PCIDevice *d, Error **errp) goto err; } +if (!s->disable_acs) { +pcie_acs_init (d,XIO3130_ACS_OFFSET ); + } +return ; err:@@ -137,6 +143,7 @@ static void xio3130_downstream_exitfn(PCIDevice *d)static Property xio3130_downstream_props[] = {DEFINE_PROP_BIT (COMPAT_PROP_PCP , PCIDevice, cap_present,QEMU_PCIE_SLTCAP_PCP_BITNR , true), +DEFINE_PROP_BOOL ("x-disable-acs" , PCIESlot, disable_acs, true),DEFINE_PROP_END_OF_LIST () };Signature · 1 line
2.24.3 (Apple Git-128)