Merge "iommu/arm-smmu-v3: Skip iommu_pci_bus probe for smmuv2"

This commit is contained in:
qctecmdr 2023-11-15 09:27:43 -08:00 committed by Gerrit - the friendly Code Review server
commit 34ee5c32bc
2 changed files with 30 additions and 0 deletions

View file

@ -34,6 +34,7 @@
#include <linux/qcom_scm.h>
#include <linux/amba/bus.h>
#include <linux/qcom-iommu-util.h>
#include <trace/hooks/iommu.h>
#include "../../dma-iommu.h"
#define MSI_IOVA_BASE 0x8000000
@ -814,6 +815,14 @@ static struct iommu_ops virt_arm_smmu_ops = {
}
};
static void virt_arm_smmu_iommu_pcie_device_probe(void *data, struct iommu_device *iommu,
struct bus_type *bus, bool *skip)
{
if (iommu != (struct iommu_device *)data)
return;
*skip = strcmp(bus->name, "pci");
}
static int virt_arm_smmu_device_probe(struct platform_device *pdev)
{
int ret;
@ -838,6 +847,10 @@ static int virt_arm_smmu_device_probe(struct platform_device *pdev)
"virt-smmuv3");
if (ret)
return ret;
register_trace_android_vh_bus_iommu_probe(virt_arm_smmu_iommu_pcie_device_probe,
(void *)&smmu->iommu);
ret = iommu_device_register(&smmu->iommu, &virt_arm_smmu_ops, dev);
if (ret) {
dev_err(dev, "Failed to register iommu\n");

View file

@ -42,6 +42,7 @@
#include <soc/qcom/secure_buffer.h>
#include <linux/irq.h>
#include <linux/wait.h>
#include <trace/hooks/iommu.h>
#include <linux/fsl/mc.h>
@ -3499,6 +3500,17 @@ static void arm_smmu_rmr_install_bypass_smr(struct arm_smmu_device *smmu)
iort_put_rmr_sids(dev_fwnode(smmu->dev), &rmr_list);
}
/* skip pcie iommu bus probe if smmuv2 and smmuv3 both enabled. */
#if IS_ENABLED(CONFIG_ARM_PARAVIRT_SMMU_V3)
static void arm_smmu_iommu_pcie_device_probe(void *data, struct iommu_device *iommu,
struct bus_type *bus, bool *skip)
{
if (iommu != (struct iommu_device *)data)
return;
*skip = !strcmp(bus->name, "pci");
}
#endif
static int arm_smmu_device_probe(struct platform_device *pdev)
{
struct resource *res;
@ -3633,6 +3645,11 @@ static int arm_smmu_device_probe(struct platform_device *pdev)
goto out_power_off;
}
#if IS_ENABLED(CONFIG_ARM_PARAVIRT_SMMU_V3)
if (of_find_compatible_node(NULL, NULL, "arm,virt-smmu-v3"))
register_trace_android_vh_bus_iommu_probe(arm_smmu_iommu_pcie_device_probe,
(void *)&smmu->iommu);
#endif
err = iommu_device_register(&smmu->iommu, &arm_smmu_ops.iommu_ops, dev);
if (err) {
dev_err(dev, "Failed to register iommu\n");