All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Dmitry Osipenko <dmitry.osipenko@collabora.com>,
	thierry.reding@gmail.com
Cc: jonathanh@nvidia.com, dri-devel@lists.freedesktop.org,
	linux-tegra@vger.kernel.org, iommu@lists.linux-foundation.org
Subject: Re: [PATCH v2] drm/tegra: Stop using iommu_present()
Date: Wed, 4 May 2022 12:52:03 +0100	[thread overview]
Message-ID: <63c021c4-57de-38fe-e48f-a308088d235b@arm.com> (raw)
In-Reply-To: <add31812-50d5-6cb0-3908-143c523abd37@collabora.com>

On 2022-05-04 01:52, Dmitry Osipenko wrote:
> On 4/11/22 16:46, Robin Murphy wrote:
>> @@ -1092,6 +1092,19 @@ static bool host1x_drm_wants_iommu(struct host1x_device *dev)
>>   	struct host1x *host1x = dev_get_drvdata(dev->dev.parent);
>>   	struct iommu_domain *domain;
>>   
>> +	/* For starters, this is moot if no IOMMU is available */
>> +	if (!device_iommu_mapped(&dev->dev))
>> +		return false;
> 
> Unfortunately this returns false on T30 with enabled IOMMU because we
> don't use IOMMU for Host1x on T30 [1] to optimize performance. We can't
> change it until we will update drivers to support Host1x-dedicated buffers.

Huh, so is dev->dev here not the DRM device? If it is, and 
device_iommu_mapped() returns false, then the later iommu_attach_group() 
call is going to fail anyway, so there's not much point allocating a 
domain. If it's not, then what the heck is host1x_drm_wants_iommu() 
actually testing for?

In the not-too-distant future we'll need to pass an appropriate IOMMU 
client device to iommu_domain_alloc() as well, so the sooner we can get 
this code straight the better.

Thanks,
Robin.

> 
> [1]
> https://elixir.bootlin.com/linux/latest/source/drivers/gpu/host1x/dev.c#L258
> 

WARNING: multiple messages have this Message-ID (diff)
From: Robin Murphy <robin.murphy@arm.com>
To: Dmitry Osipenko <dmitry.osipenko@collabora.com>,
	thierry.reding@gmail.com
Cc: linux-tegra@vger.kernel.org, iommu@lists.linux-foundation.org,
	dri-devel@lists.freedesktop.org, jonathanh@nvidia.com
Subject: Re: [PATCH v2] drm/tegra: Stop using iommu_present()
Date: Wed, 4 May 2022 12:52:03 +0100	[thread overview]
Message-ID: <63c021c4-57de-38fe-e48f-a308088d235b@arm.com> (raw)
In-Reply-To: <add31812-50d5-6cb0-3908-143c523abd37@collabora.com>

On 2022-05-04 01:52, Dmitry Osipenko wrote:
> On 4/11/22 16:46, Robin Murphy wrote:
>> @@ -1092,6 +1092,19 @@ static bool host1x_drm_wants_iommu(struct host1x_device *dev)
>>   	struct host1x *host1x = dev_get_drvdata(dev->dev.parent);
>>   	struct iommu_domain *domain;
>>   
>> +	/* For starters, this is moot if no IOMMU is available */
>> +	if (!device_iommu_mapped(&dev->dev))
>> +		return false;
> 
> Unfortunately this returns false on T30 with enabled IOMMU because we
> don't use IOMMU for Host1x on T30 [1] to optimize performance. We can't
> change it until we will update drivers to support Host1x-dedicated buffers.

Huh, so is dev->dev here not the DRM device? If it is, and 
device_iommu_mapped() returns false, then the later iommu_attach_group() 
call is going to fail anyway, so there's not much point allocating a 
domain. If it's not, then what the heck is host1x_drm_wants_iommu() 
actually testing for?

In the not-too-distant future we'll need to pass an appropriate IOMMU 
client device to iommu_domain_alloc() as well, so the sooner we can get 
this code straight the better.

Thanks,
Robin.

> 
> [1]
> https://elixir.bootlin.com/linux/latest/source/drivers/gpu/host1x/dev.c#L258
> 
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

WARNING: multiple messages have this Message-ID (diff)
From: Robin Murphy <robin.murphy@arm.com>
To: Dmitry Osipenko <dmitry.osipenko@collabora.com>,
	thierry.reding@gmail.com
Cc: linux-tegra@vger.kernel.org, iommu@lists.linux-foundation.org,
	dri-devel@lists.freedesktop.org, jonathanh@nvidia.com
Subject: Re: [PATCH v2] drm/tegra: Stop using iommu_present()
Date: Wed, 4 May 2022 12:52:03 +0100	[thread overview]
Message-ID: <63c021c4-57de-38fe-e48f-a308088d235b@arm.com> (raw)
In-Reply-To: <add31812-50d5-6cb0-3908-143c523abd37@collabora.com>

On 2022-05-04 01:52, Dmitry Osipenko wrote:
> On 4/11/22 16:46, Robin Murphy wrote:
>> @@ -1092,6 +1092,19 @@ static bool host1x_drm_wants_iommu(struct host1x_device *dev)
>>   	struct host1x *host1x = dev_get_drvdata(dev->dev.parent);
>>   	struct iommu_domain *domain;
>>   
>> +	/* For starters, this is moot if no IOMMU is available */
>> +	if (!device_iommu_mapped(&dev->dev))
>> +		return false;
> 
> Unfortunately this returns false on T30 with enabled IOMMU because we
> don't use IOMMU for Host1x on T30 [1] to optimize performance. We can't
> change it until we will update drivers to support Host1x-dedicated buffers.

Huh, so is dev->dev here not the DRM device? If it is, and 
device_iommu_mapped() returns false, then the later iommu_attach_group() 
call is going to fail anyway, so there's not much point allocating a 
domain. If it's not, then what the heck is host1x_drm_wants_iommu() 
actually testing for?

In the not-too-distant future we'll need to pass an appropriate IOMMU 
client device to iommu_domain_alloc() as well, so the sooner we can get 
this code straight the better.

Thanks,
Robin.

> 
> [1]
> https://elixir.bootlin.com/linux/latest/source/drivers/gpu/host1x/dev.c#L258
> 

  reply	other threads:[~2022-05-04 11:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-11 13:46 [PATCH v2] drm/tegra: Stop using iommu_present() Robin Murphy
2022-04-11 13:46 ` Robin Murphy
2022-04-11 13:46 ` Robin Murphy
2022-04-13 22:34 ` Dmitry Osipenko
2022-04-13 22:34   ` Dmitry Osipenko
2022-04-13 22:34   ` Dmitry Osipenko
2022-05-04  0:52 ` Dmitry Osipenko
2022-05-04  0:52   ` Dmitry Osipenko
2022-05-04  0:52   ` Dmitry Osipenko
2022-05-04 11:52   ` Robin Murphy [this message]
2022-05-04 11:52     ` Robin Murphy
2022-05-04 11:52     ` Robin Murphy
2022-05-11 11:08     ` Dmitry Osipenko
2022-05-11 11:08       ` Dmitry Osipenko
2022-05-11 11:08       ` 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=63c021c4-57de-38fe-e48f-a308088d235b@arm.com \
    --to=robin.murphy@arm.com \
    --cc=dmitry.osipenko@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jonathanh@nvidia.com \
    --cc=linux-tegra@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.