LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Dmitry Osipenko <digetx@gmail.com>
To: Robin Murphy <robin.murphy@arm.com>,
Joerg Roedel <joro@8bytes.org>,
Thierry Reding <thierry.reding@gmail.com>,
Jonathan Hunter <jonathanh@nvidia.com>
Cc: linux-tegra@vger.kernel.org, iommu@lists.linux-foundation.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 6/9] iommu/tegra: gart: Ignore devices without IOMMU phandle in DT
Date: Fri, 11 May 2018 18:34:49 +0300 [thread overview]
Message-ID: <000ce2c8-2b20-3fb5-8942-b9e60ba34422@gmail.com> (raw)
In-Reply-To: <a3293da9-b750-6c5c-6f84-53b1aafc5e53@arm.com>
Hi Robin,
On 11.05.2018 14:34, Robin Murphy wrote:
> Hi Dmitry,
>
> On 08/05/18 19:16, Dmitry Osipenko wrote:
>> GART can't handle all devices, ignore devices that aren't related to GART.
>> Device tree must explicitly assign GART IOMMU to the devices.
>>
>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
>> ---
>> drivers/iommu/tegra-gart.c | 33 ++++++++++++++++++++++++++++++++-
>> 1 file changed, 32 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/iommu/tegra-gart.c b/drivers/iommu/tegra-gart.c
>> index 39305224c48d..5b2d27620350 100644
>> --- a/drivers/iommu/tegra-gart.c
>> +++ b/drivers/iommu/tegra-gart.c
>> @@ -366,6 +366,26 @@ static void gart_iommu_remove_device(struct device *dev)
>> iommu_device_unlink(&gart_handle->iommu, dev);
>> }
>> +static int gart_iommu_check_device(struct gart_device *gart,
>> + struct device *dev);
>> +
>> +struct iommu_group *gart_iommu_device_group(struct device *dev)
>> +{
>> + int err;
>> +
>> + err = gart_iommu_check_device(gart_handle, dev);
>> + if (err)
>> + return ERR_PTR(err);
>> +
>> + return generic_device_group(dev);
>> +}
>> +
>> +static int gart_iommu_of_xlate(struct device *dev,
>> + struct of_phandle_args *args)
>> +{
>> + return 0;
>> +}
>> +
>> static const struct iommu_ops gart_iommu_ops = {
>> .capable = gart_iommu_capable,
>> .domain_alloc = gart_iommu_domain_alloc,
>> @@ -374,14 +394,24 @@ static const struct iommu_ops gart_iommu_ops = {
>> .detach_dev = gart_iommu_detach_dev,
>> .add_device = gart_iommu_add_device,
>> .remove_device = gart_iommu_remove_device,
>> - .device_group = generic_device_group,
>> + .device_group = gart_iommu_device_group,
>> .map = gart_iommu_map,
>> .map_sg = default_iommu_map_sg,
>> .unmap = gart_iommu_unmap,
>> .iova_to_phys = gart_iommu_iova_to_phys,
>> .pgsize_bitmap = GART_IOMMU_PGSIZES,
>> + .of_xlate = gart_iommu_of_xlate,
>> };
>> +static int gart_iommu_check_device(struct gart_device *gart,
>> + struct device *dev)
>> +{
>> + if (!dev->iommu_fwspec || dev->iommu_fwspec->ops != &gart_iommu_ops)
>> + return -ENODEV;
>
> Conceptually, it would be better to verify this in .add_device *before* calling
> iommu_group_get_for_dev(). That would also align with what other drivers do, and
> let you save introducing the .device_group callback until the real
> implementation in the later patch.
Indeed, thank you for the suggestion.
next prev parent reply other threads:[~2018-05-11 20:09 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-08 18:16 [PATCH v1 0/9] Tegra GART driver clean up and optimization Dmitry Osipenko
2018-05-08 18:16 ` [PATCH v1 1/9] memory: tegra: Provide facility for integration with the GART driver Dmitry Osipenko
2018-05-08 18:16 ` [PATCH v1 2/9] iommu/tegra: gart: Provide access to Memory Controller driver Dmitry Osipenko
2018-05-08 18:16 ` [PATCH v1 3/9] iommu/tegra: gart: Remove code related to module unloading Dmitry Osipenko
2018-05-08 18:16 ` [PATCH v1 4/9] iommu/tegra: gart: Remove pr_fmt and clean up includes Dmitry Osipenko
2018-05-08 18:16 ` [PATCH v1 5/9] iommu/tegra: gart: Clean up driver probe failure unwinding Dmitry Osipenko
2018-05-08 18:16 ` [PATCH v1 6/9] iommu/tegra: gart: Ignore devices without IOMMU phandle in DT Dmitry Osipenko
2018-05-11 11:34 ` Robin Murphy
2018-05-11 15:34 ` Dmitry Osipenko [this message]
2018-05-08 18:16 ` [PATCH v1 7/9] iommu/tegra: gart: Provide single domain and group for all devices Dmitry Osipenko
2018-05-11 11:12 ` Dmitry Osipenko
2018-05-11 12:32 ` Robin Murphy
2018-05-11 20:05 ` Dmitry Osipenko
2018-05-14 18:18 ` Robin Murphy
2018-05-16 13:43 ` Dmitry Osipenko
2018-05-08 18:16 ` [PATCH v1 8/9] iommu: Introduce iotlb_sync_map callback Dmitry Osipenko
2018-05-11 13:02 ` Robin Murphy
2018-05-11 19:58 ` Dmitry Osipenko
2018-05-08 18:17 ` [PATCH v1 9/9] iommu/tegra: gart: Optimize mapping / unmapping performance Dmitry Osipenko
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=000ce2c8-2b20-3fb5-8942-b9e60ba34422@gmail.com \
--to=digetx@gmail.com \
--cc=iommu@lists.linux-foundation.org \
--cc=jonathanh@nvidia.com \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=thierry.reding@gmail.com \
--subject='Re: [PATCH v1 6/9] iommu/tegra: gart: Ignore devices without IOMMU phandle in DT' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).