From: Jason Gunthorpe <jgg@nvidia.com>
To: Christophe Leroy <christophe.leroy@csgroup.eu>,
iommu@lists.linux.dev, Joerg Roedel <joro@8bytes.org>,
linuxppc-dev@lists.ozlabs.org,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
Robin Murphy <robin.murphy@arm.com>,
Will Deacon <will@kernel.org>
Cc: Li Yang <leoyang.li@nxp.com>
Subject: [PATCH v2 2/3] iommu/fsl: Move ENODEV to fsl_pamu_probe_device()
Date: Tue, 16 May 2023 21:35:27 -0300 [thread overview]
Message-ID: <2-v2-ce71068deeec+4cf6-fsl_rm_groups_jgg@nvidia.com> (raw)
In-Reply-To: <0-v2-ce71068deeec+4cf6-fsl_rm_groups_jgg@nvidia.com>
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>
---
drivers/iommu/fsl_pamu_domain.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domain.c
index cd0c60b402154f..d0683daa900fa5 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;
}
--
2.40.1
next prev parent reply other threads:[~2023-05-17 0:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-17 0:35 [PATCH v2 0/3] Remove iommu_group_remove_device() from fsl Jason Gunthorpe
2023-05-17 0:35 ` [PATCH v2 1/3] iommu/fsl: Always allocate a group for non-pci devices Jason Gunthorpe
2023-05-17 0:35 ` Jason Gunthorpe [this message]
2023-05-17 0:35 ` [PATCH v2 3/3] iommu/fsl: Use driver_managed_dma to allow VFIO to work Jason Gunthorpe
2023-05-23 6:26 ` [PATCH v2 0/3] Remove iommu_group_remove_device() from fsl Joerg Roedel
2023-05-29 0:46 ` Jason Gunthorpe
2023-05-30 12:03 ` Michael Ellerman
2023-05-30 13:43 ` Jason Gunthorpe
2023-05-31 7:04 ` Michael Ellerman
2023-06-01 9:48 ` Joerg Roedel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2-v2-ce71068deeec+4cf6-fsl_rm_groups_jgg@nvidia.com \
--to=jgg@nvidia.com \
--cc=christophe.leroy@csgroup.eu \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=leoyang.li@nxp.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=robin.murphy@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox