diff options
author | Jason Gunthorpe | 2023-05-16 21:35:27 -0300 |
---|---|---|
committer | Joerg Roedel | 2023-06-01 11:47:47 +0200 |
commit | 7977a08e113268edd2f69432596b3a2a56f27298 (patch) | |
tree | add54964ee168bd528568af49bd2a046bd944f4b /drivers/iommu | |
parent | 5f6489723df9a292328a8defc02227d660eea1b9 (diff) |
iommu/fsl: Move ENODEV to fsl_pamu_probe_device()
The expectation is for the probe op to return ENODEV if the iommu is not
able to support the device. Move the check for fsl,liodn to
fsl_pamu_probe_device() simplify fsl_pamu_device_group()
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Tested-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/2-v2-ce71068deeec+4cf6-fsl_rm_groups_jgg@nvidia.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu')
-rw-r--r-- | drivers/iommu/fsl_pamu_domain.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domain.c index cd0c60b40215..d0683daa900f 100644 --- a/drivers/iommu/fsl_pamu_domain.c +++ b/drivers/iommu/fsl_pamu_domain.c @@ -427,23 +427,28 @@ static struct iommu_group *get_pci_device_group(struct pci_dev *pdev) static struct iommu_group *fsl_pamu_device_group(struct device *dev) { - struct iommu_group *group = ERR_PTR(-ENODEV); - int len; - /* * For platform devices we allocate a separate group for * each of the devices. */ - if (dev_is_pci(dev)) - group = get_pci_device_group(to_pci_dev(dev)); - else if (of_get_property(dev->of_node, "fsl,liodn", &len)) + if (!dev_is_pci(dev)) return generic_device_group(dev); - return group; + return get_pci_device_group(to_pci_dev(dev)); } static struct iommu_device *fsl_pamu_probe_device(struct device *dev) { + int len; + + /* + * uboot must fill the fsl,liodn for platform devices to be supported by + * the iommu. + */ + if (!dev_is_pci(dev) && + !of_get_property(dev->of_node, "fsl,liodn", &len)) + return ERR_PTR(-ENODEV); + return &pamu_iommu; } |