From: Manish Honap <[email protected]>
The SMMUv3 primary-bus check only accepted pxb-pcie as a valid extra
root complex, so a CXL device behind a pxb-cxl could not reach the
IOMMU: attaching an arm-smmuv3 to a pxb-cxl bus failed at realize with
"SMMU should be attached to a default PCIe root complex (pcie.0) or a
pxb-pcie based root complex".
A pxb-cxl uses the same PCIe-compatible bus as a pxb-pcie, so accept it
too. A CXL Type-2 device passed through with vfio-pci sits behind a
pxb-cxl and needs SMMU translation for its DMA and ATS just like a
pxb-pcie device.
Signed-off-by: Manish Honap <[email protected]>
---
hw/arm/smmu-common.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
index 8e40ba603d..42fb098ab2 100644
--- a/hw/arm/smmu-common.c
+++ b/hw/arm/smmu-common.c
@@ -963,19 +963,20 @@ static void smmu_base_realize(DeviceState *dev, Error **errp)
s->iommu_ops = &smmu_ops;
}
/*
- * We only allow default PCIe Root Complex(pcie.0) or pxb-pcie based extra
- * root complexes to be associated with SMMU.
+ * We only allow the default PCIe root complex (pcie.0) or pxb-pcie /
+ * pxb-cxl based extra root complexes to be associated with SMMU.
*/
if (pci_bus_is_express(pci_bus) && pci_bus_is_root(pci_bus) &&
object_dynamic_cast(OBJECT(pci_bus)->parent, TYPE_PCI_HOST_BRIDGE)) {
/*
- * This condition matches either the default pcie.0, pxb-pcie, or
- * pxb-cxl. For both pxb-pcie and pxb-cxl, parent_dev will be set.
- * Currently, we don't allow pxb-cxl as it requires further
- * verification. Therefore, make sure this is indeed pxb-pcie.
+ * pcie.0 has no parent_dev; pxb-pcie and pxb-cxl do. Accept both bus
+ * types explicitly so other root complexes are still rejected. A
+ * pxb-cxl uses the same PCIe-compatible bus, so a CXL device behind it
+ * needs the SMMU just like a pxb-pcie one.
*/
if (pci_bus->parent_dev) {
- if (!object_dynamic_cast(OBJECT(pci_bus), TYPE_PXB_PCIE_BUS)) {
+ if (!object_dynamic_cast(OBJECT(pci_bus), TYPE_PXB_PCIE_BUS) &&
+ !object_dynamic_cast(OBJECT(pci_bus), TYPE_PXB_CXL_BUS)) {
goto out_err;
}
}
@@ -990,8 +991,8 @@ static void smmu_base_realize(DeviceState *dev, Error **errp)
return;
}
out_err:
- error_setg(errp, "SMMU should be attached to a default PCIe root complex"
- "(pcie.0) or a pxb-pcie based root complex");
+ error_setg(errp, "SMMU should be attached to a default PCIe root complex "
+ "(pcie.0), a pxb-pcie, or a pxb-cxl based root complex");
}
/*
--
2.25.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.