amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: add print for iommu translation mode
@ 2023-03-17 19:47 Graham Sider
  2023-03-17 19:57 ` Hamza Mahfooz
  0 siblings, 1 reply; 8+ messages in thread
From: Graham Sider @ 2023-03-17 19:47 UTC (permalink / raw)
  To: amd-gfx; +Cc: Felix.Kuehling, Graham Sider

Add log to display whether RAM is direct vs DMA mapped.

Signed-off-by: Graham Sider <Graham.Sider@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 8bba5e6872a1..8797a9523244 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -3528,8 +3528,12 @@ static void amdgpu_device_check_iommu_direct_map(struct amdgpu_device *adev)
 	struct iommu_domain *domain;
 
 	domain = iommu_get_domain_for_dev(adev->dev);
-	if (!domain || domain->type == IOMMU_DOMAIN_IDENTITY)
+	if (!domain || domain->type == IOMMU_DOMAIN_IDENTITY) {
+		pr_info("RAM is direct mapped to GPU (not traslated by IOMMU)\n");
 		adev->ram_is_direct_mapped = true;
+	} else {
+		pr_info("RAM is DMA mapped to GPU (translated by IOMMU)\n");
+	}
 }
 
 static const struct attribute *amdgpu_dev_attributes[] = {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] drm/amdgpu: add print for iommu translation mode
  2023-03-17 19:47 [PATCH] drm/amdgpu: add print for iommu translation mode Graham Sider
@ 2023-03-17 19:57 ` Hamza Mahfooz
  2023-03-17 19:58   ` Russell, Kent
  0 siblings, 1 reply; 8+ messages in thread
From: Hamza Mahfooz @ 2023-03-17 19:57 UTC (permalink / raw)
  To: Graham Sider, amd-gfx; +Cc: Felix.Kuehling


On 3/17/23 15:47, Graham Sider wrote:
> Add log to display whether RAM is direct vs DMA mapped.
> 
> Signed-off-by: Graham Sider <Graham.Sider@amd.com>

If this information is only useful for debugging purposes, please use
drm_dbg() instead of pr_info().

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 8bba5e6872a1..8797a9523244 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -3528,8 +3528,12 @@ static void amdgpu_device_check_iommu_direct_map(struct amdgpu_device *adev)
>   	struct iommu_domain *domain;
>   
>   	domain = iommu_get_domain_for_dev(adev->dev);
> -	if (!domain || domain->type == IOMMU_DOMAIN_IDENTITY)
> +	if (!domain || domain->type == IOMMU_DOMAIN_IDENTITY) {
> +		pr_info("RAM is direct mapped to GPU (not traslated by IOMMU)\n");
>   		adev->ram_is_direct_mapped = true;
> +	} else {
> +		pr_info("RAM is DMA mapped to GPU (translated by IOMMU)\n");
> +	}
>   }
>   
>   static const struct attribute *amdgpu_dev_attributes[] = {

-- 
Hamza


^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH] drm/amdgpu: add print for iommu translation mode
  2023-03-17 19:57 ` Hamza Mahfooz
@ 2023-03-17 19:58   ` Russell, Kent
  2023-03-17 20:04     ` Sider, Graham
  0 siblings, 1 reply; 8+ messages in thread
From: Russell, Kent @ 2023-03-17 19:58 UTC (permalink / raw)
  To: Mahfooz, Hamza, Sider, Graham, amd-gfx; +Cc: Kuehling, Felix

[AMD Official Use Only - General]



> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Hamza
> Mahfooz
> Sent: Friday, March 17, 2023 3:58 PM
> To: Sider, Graham <Graham.Sider@amd.com>; amd-gfx@lists.freedesktop.org
> Cc: Kuehling, Felix <Felix.Kuehling@amd.com>
> Subject: Re: [PATCH] drm/amdgpu: add print for iommu translation mode
> 
> 
> On 3/17/23 15:47, Graham Sider wrote:
> > Add log to display whether RAM is direct vs DMA mapped.
> >
> > Signed-off-by: Graham Sider <Graham.Sider@amd.com>
> 
> If this information is only useful for debugging purposes, please use
> drm_dbg() instead of pr_info().
> 
> > ---
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +++++-
> >   1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> > index 8bba5e6872a1..8797a9523244 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> > @@ -3528,8 +3528,12 @@ static void
> amdgpu_device_check_iommu_direct_map(struct amdgpu_device *adev)
> >   	struct iommu_domain *domain;
> >
> >   	domain = iommu_get_domain_for_dev(adev->dev);
> > -	if (!domain || domain->type == IOMMU_DOMAIN_IDENTITY)
> > +	if (!domain || domain->type == IOMMU_DOMAIN_IDENTITY) {
> > +		pr_info("RAM is direct mapped to GPU (not traslated by
traslated -> translated

 Kent
> IOMMU)\n");
> >   		adev->ram_is_direct_mapped = true;
> > +	} else {
> > +		pr_info("RAM is DMA mapped to GPU (translated by
> IOMMU)\n");
> > +	}
> >   }
> >
> >   static const struct attribute *amdgpu_dev_attributes[] = {
> 
> --
> Hamza

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH] drm/amdgpu: add print for iommu translation mode
  2023-03-17 19:58   ` Russell, Kent
@ 2023-03-17 20:04     ` Sider, Graham
  2023-03-17 21:16       ` Felix Kuehling
  2023-03-21 18:52       ` Christian König
  0 siblings, 2 replies; 8+ messages in thread
From: Sider, Graham @ 2023-03-17 20:04 UTC (permalink / raw)
  To: Russell, Kent, Mahfooz, Hamza, amd-gfx; +Cc: Kuehling, Felix

[AMD Official Use Only - General]



> -----Original Message-----
> From: Russell, Kent <Kent.Russell@amd.com>
> Sent: Friday, March 17, 2023 3:58 PM
> To: Mahfooz, Hamza <Hamza.Mahfooz@amd.com>; Sider, Graham
> <Graham.Sider@amd.com>; amd-gfx@lists.freedesktop.org
> Cc: Kuehling, Felix <Felix.Kuehling@amd.com>
> Subject: RE: [PATCH] drm/amdgpu: add print for iommu translation mode
> 
> [AMD Official Use Only - General]
> 
> 
> 
> > -----Original Message-----
> > From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of
> > Hamza Mahfooz
> > Sent: Friday, March 17, 2023 3:58 PM
> > To: Sider, Graham <Graham.Sider@amd.com>;
> > amd-gfx@lists.freedesktop.org
> > Cc: Kuehling, Felix <Felix.Kuehling@amd.com>
> > Subject: Re: [PATCH] drm/amdgpu: add print for iommu translation mode
> >
> >
> > On 3/17/23 15:47, Graham Sider wrote:
> > > Add log to display whether RAM is direct vs DMA mapped.
> > >
> > > Signed-off-by: Graham Sider <Graham.Sider@amd.com>
> >
> > If this information is only useful for debugging purposes, please use
> > drm_dbg() instead of pr_info().

It's useful for more than just debug I would say. Just a quick way to grep whether IOMMU is off/pt vs device isolation mode.

Graham

> >
> > > ---
> > >   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +++++-
> > >   1 file changed, 5 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> > > index 8bba5e6872a1..8797a9523244 100644
> > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> > > @@ -3528,8 +3528,12 @@ static void
> > amdgpu_device_check_iommu_direct_map(struct amdgpu_device *adev)
> > >   	struct iommu_domain *domain;
> > >
> > >   	domain = iommu_get_domain_for_dev(adev->dev);
> > > -	if (!domain || domain->type == IOMMU_DOMAIN_IDENTITY)
> > > +	if (!domain || domain->type == IOMMU_DOMAIN_IDENTITY) {
> > > +		pr_info("RAM is direct mapped to GPU (not traslated by
> traslated -> translated
> 

Thanks, my keyboard keeps skipping the on the 'n' key lately :( time for a clean.

Graham

>  Kent
> > IOMMU)\n");
> > >   		adev->ram_is_direct_mapped = true;
> > > +	} else {
> > > +		pr_info("RAM is DMA mapped to GPU (translated by
> > IOMMU)\n");
> > > +	}
> > >   }
> > >
> > >   static const struct attribute *amdgpu_dev_attributes[] = {
> >
> > --
> > Hamza

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] drm/amdgpu: add print for iommu translation mode
  2023-03-17 20:04     ` Sider, Graham
@ 2023-03-17 21:16       ` Felix Kuehling
  2023-03-20 13:36         ` Sider, Graham
  2023-03-21 18:52       ` Christian König
  1 sibling, 1 reply; 8+ messages in thread
From: Felix Kuehling @ 2023-03-17 21:16 UTC (permalink / raw)
  To: Sider, Graham, Russell, Kent, Mahfooz, Hamza, amd-gfx

On 2023-03-17 16:04, Sider, Graham wrote:
> [AMD Official Use Only - General]
>
>
>
>> -----Original Message-----
>> From: Russell, Kent <Kent.Russell@amd.com>
>> Sent: Friday, March 17, 2023 3:58 PM
>> To: Mahfooz, Hamza <Hamza.Mahfooz@amd.com>; Sider, Graham
>> <Graham.Sider@amd.com>; amd-gfx@lists.freedesktop.org
>> Cc: Kuehling, Felix <Felix.Kuehling@amd.com>
>> Subject: RE: [PATCH] drm/amdgpu: add print for iommu translation mode
>>
>> [AMD Official Use Only - General]
>>
>>
>>
>>> -----Original Message-----
>>> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of
>>> Hamza Mahfooz
>>> Sent: Friday, March 17, 2023 3:58 PM
>>> To: Sider, Graham <Graham.Sider@amd.com>;
>>> amd-gfx@lists.freedesktop.org
>>> Cc: Kuehling, Felix <Felix.Kuehling@amd.com>
>>> Subject: Re: [PATCH] drm/amdgpu: add print for iommu translation mode
>>>
>>>
>>> On 3/17/23 15:47, Graham Sider wrote:
>>>> Add log to display whether RAM is direct vs DMA mapped.
>>>>
>>>> Signed-off-by: Graham Sider <Graham.Sider@amd.com>
>>> If this information is only useful for debugging purposes, please use
>>> drm_dbg() instead of pr_info().
> It's useful for more than just debug I would say. Just a quick way to grep whether IOMMU is off/pt vs device isolation mode.

I agree. The kernel log otherwise tells you the default IOMMU domain, 
but it may not match the domain actually used for the GPU. Without this 
message there is no easy way to tell from a kernel log. This will help 
with triaging issues from logs provided by external and internal users.


>
> Graham
>
>>>> ---
>>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +++++-
>>>>    1 file changed, 5 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>>> index 8bba5e6872a1..8797a9523244 100644
>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>>> @@ -3528,8 +3528,12 @@ static void
>>> amdgpu_device_check_iommu_direct_map(struct amdgpu_device *adev)
>>>>    	struct iommu_domain *domain;
>>>>
>>>>    	domain = iommu_get_domain_for_dev(adev->dev);
>>>> -	if (!domain || domain->type == IOMMU_DOMAIN_IDENTITY)
>>>> +	if (!domain || domain->type == IOMMU_DOMAIN_IDENTITY) {
>>>> +		pr_info("RAM is direct mapped to GPU (not traslated by

Use dev_info. That way you can tell which GPU the message applies to in 
a multi-GPU system.

Regards,
   Felix


>> traslated -> translated
>>
> Thanks, my keyboard keeps skipping the on the 'n' key lately :( time for a clean.
>
> Graham
>
>>   Kent
>>> IOMMU)\n");
>>>>    		adev->ram_is_direct_mapped = true;
>>>> +	} else {
>>>> +		pr_info("RAM is DMA mapped to GPU (translated by
>>> IOMMU)\n");
>>>> +	}
>>>>    }
>>>>
>>>>    static const struct attribute *amdgpu_dev_attributes[] = {
>>> --
>>> Hamza

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH] drm/amdgpu: add print for iommu translation mode
  2023-03-17 21:16       ` Felix Kuehling
@ 2023-03-20 13:36         ` Sider, Graham
  0 siblings, 0 replies; 8+ messages in thread
From: Sider, Graham @ 2023-03-20 13:36 UTC (permalink / raw)
  To: Kuehling, Felix, Russell, Kent, Mahfooz, Hamza, amd-gfx

[Public]

> -----Original Message-----
> From: Kuehling, Felix <Felix.Kuehling@amd.com>
> Sent: Friday, March 17, 2023 5:16 PM
> To: Sider, Graham <Graham.Sider@amd.com>; Russell, Kent
> <Kent.Russell@amd.com>; Mahfooz, Hamza <Hamza.Mahfooz@amd.com>;
> amd-gfx@lists.freedesktop.org
> Subject: Re: [PATCH] drm/amdgpu: add print for iommu translation mode
> 
> On 2023-03-17 16:04, Sider, Graham wrote:
> > [AMD Official Use Only - General]
> >
> >
> >
> >> -----Original Message-----
> >> From: Russell, Kent <Kent.Russell@amd.com>
> >> Sent: Friday, March 17, 2023 3:58 PM
> >> To: Mahfooz, Hamza <Hamza.Mahfooz@amd.com>; Sider, Graham
> >> <Graham.Sider@amd.com>; amd-gfx@lists.freedesktop.org
> >> Cc: Kuehling, Felix <Felix.Kuehling@amd.com>
> >> Subject: RE: [PATCH] drm/amdgpu: add print for iommu translation mode
> >>
> >> [AMD Official Use Only - General]
> >>
> >>
> >>
> >>> -----Original Message-----
> >>> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of
> >>> Hamza Mahfooz
> >>> Sent: Friday, March 17, 2023 3:58 PM
> >>> To: Sider, Graham <Graham.Sider@amd.com>;
> >>> amd-gfx@lists.freedesktop.org
> >>> Cc: Kuehling, Felix <Felix.Kuehling@amd.com>
> >>> Subject: Re: [PATCH] drm/amdgpu: add print for iommu translation
> >>> mode
> >>>
> >>>
> >>> On 3/17/23 15:47, Graham Sider wrote:
> >>>> Add log to display whether RAM is direct vs DMA mapped.
> >>>>
> >>>> Signed-off-by: Graham Sider <Graham.Sider@amd.com>
> >>> If this information is only useful for debugging purposes, please
> >>> use
> >>> drm_dbg() instead of pr_info().
> > It's useful for more than just debug I would say. Just a quick way to grep
> whether IOMMU is off/pt vs device isolation mode.
> 
> I agree. The kernel log otherwise tells you the default IOMMU domain, but it
> may not match the domain actually used for the GPU. Without this message
> there is no easy way to tell from a kernel log. This will help with triaging issues
> from logs provided by external and internal users.
> 
> 
> >
> > Graham
> >
> >>>> ---
> >>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +++++-
> >>>>    1 file changed, 5 insertions(+), 1 deletion(-)
> >>>>
> >>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> >>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> >>>> index 8bba5e6872a1..8797a9523244 100644
> >>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> >>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> >>>> @@ -3528,8 +3528,12 @@ static void
> >>> amdgpu_device_check_iommu_direct_map(struct amdgpu_device
> *adev)
> >>>>    	struct iommu_domain *domain;
> >>>>
> >>>>    	domain = iommu_get_domain_for_dev(adev->dev);
> >>>> -	if (!domain || domain->type == IOMMU_DOMAIN_IDENTITY)
> >>>> +	if (!domain || domain->type == IOMMU_DOMAIN_IDENTITY) {
> >>>> +		pr_info("RAM is direct mapped to GPU (not traslated by
> 
> Use dev_info. That way you can tell which GPU the message applies to in a
> multi-GPU system.
> 

Good point - will do that. Thanks!

Graham

> Regards,
>    Felix
> 
> 
> >> traslated -> translated
> >>
> > Thanks, my keyboard keeps skipping the on the 'n' key lately :( time for a
> clean.
> >
> > Graham
> >
> >>   Kent
> >>> IOMMU)\n");
> >>>>    		adev->ram_is_direct_mapped = true;
> >>>> +	} else {
> >>>> +		pr_info("RAM is DMA mapped to GPU (translated by
> >>> IOMMU)\n");
> >>>> +	}
> >>>>    }
> >>>>
> >>>>    static const struct attribute *amdgpu_dev_attributes[] = {
> >>> --
> >>> Hamza

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] drm/amdgpu: add print for iommu translation mode
  2023-03-17 20:04     ` Sider, Graham
  2023-03-17 21:16       ` Felix Kuehling
@ 2023-03-21 18:52       ` Christian König
  2023-03-21 19:45         ` Sider, Graham
  1 sibling, 1 reply; 8+ messages in thread
From: Christian König @ 2023-03-21 18:52 UTC (permalink / raw)
  To: Sider, Graham, Russell, Kent, Mahfooz, Hamza, amd-gfx; +Cc: Kuehling, Felix

Am 17.03.23 um 21:04 schrieb Sider, Graham:
> [AMD Official Use Only - General]
>
>
>
>> -----Original Message-----
>> From: Russell, Kent <Kent.Russell@amd.com>
>> Sent: Friday, March 17, 2023 3:58 PM
>> To: Mahfooz, Hamza <Hamza.Mahfooz@amd.com>; Sider, Graham
>> <Graham.Sider@amd.com>; amd-gfx@lists.freedesktop.org
>> Cc: Kuehling, Felix <Felix.Kuehling@amd.com>
>> Subject: RE: [PATCH] drm/amdgpu: add print for iommu translation mode
>>
>> [AMD Official Use Only - General]
>>
>>
>>
>>> -----Original Message-----
>>> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of
>>> Hamza Mahfooz
>>> Sent: Friday, March 17, 2023 3:58 PM
>>> To: Sider, Graham <Graham.Sider@amd.com>;
>>> amd-gfx@lists.freedesktop.org
>>> Cc: Kuehling, Felix <Felix.Kuehling@amd.com>
>>> Subject: Re: [PATCH] drm/amdgpu: add print for iommu translation mode
>>>
>>>
>>> On 3/17/23 15:47, Graham Sider wrote:
>>>> Add log to display whether RAM is direct vs DMA mapped.
>>>>
>>>> Signed-off-by: Graham Sider <Graham.Sider@amd.com>
>>> If this information is only useful for debugging purposes, please use
>>> drm_dbg() instead of pr_info().
> It's useful for more than just debug I would say. Just a quick way to grep whether IOMMU is off/pt vs device isolation mode.

Mhm, shouldn't the IOMMU code note that as well?

Christian.

>
> Graham
>
>>>> ---
>>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +++++-
>>>>    1 file changed, 5 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>>> index 8bba5e6872a1..8797a9523244 100644
>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>>> @@ -3528,8 +3528,12 @@ static void
>>> amdgpu_device_check_iommu_direct_map(struct amdgpu_device *adev)
>>>>    	struct iommu_domain *domain;
>>>>
>>>>    	domain = iommu_get_domain_for_dev(adev->dev);
>>>> -	if (!domain || domain->type == IOMMU_DOMAIN_IDENTITY)
>>>> +	if (!domain || domain->type == IOMMU_DOMAIN_IDENTITY) {
>>>> +		pr_info("RAM is direct mapped to GPU (not traslated by
>> traslated -> translated
>>
> Thanks, my keyboard keeps skipping the on the 'n' key lately :( time for a clean.
>
> Graham
>
>>   Kent
>>> IOMMU)\n");
>>>>    		adev->ram_is_direct_mapped = true;
>>>> +	} else {
>>>> +		pr_info("RAM is DMA mapped to GPU (translated by
>>> IOMMU)\n");
>>>> +	}
>>>>    }
>>>>
>>>>    static const struct attribute *amdgpu_dev_attributes[] = {
>>> --
>>> Hamza


^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH] drm/amdgpu: add print for iommu translation mode
  2023-03-21 18:52       ` Christian König
@ 2023-03-21 19:45         ` Sider, Graham
  0 siblings, 0 replies; 8+ messages in thread
From: Sider, Graham @ 2023-03-21 19:45 UTC (permalink / raw)
  To: Christian König, Russell, Kent, Mahfooz, Hamza, amd-gfx
  Cc: Kuehling, Felix

[Public]

> -----Original Message-----
> From: Christian König <ckoenig.leichtzumerken@gmail.com>
> Sent: Tuesday, March 21, 2023 2:53 PM
> To: Sider, Graham <Graham.Sider@amd.com>; Russell, Kent
> <Kent.Russell@amd.com>; Mahfooz, Hamza <Hamza.Mahfooz@amd.com>;
> amd-gfx@lists.freedesktop.org
> Cc: Kuehling, Felix <Felix.Kuehling@amd.com>
> Subject: Re: [PATCH] drm/amdgpu: add print for iommu translation mode
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> Am 17.03.23 um 21:04 schrieb Sider, Graham:
> > [AMD Official Use Only - General]
> >
> >
> >
> >> -----Original Message-----
> >> From: Russell, Kent <Kent.Russell@amd.com>
> >> Sent: Friday, March 17, 2023 3:58 PM
> >> To: Mahfooz, Hamza <Hamza.Mahfooz@amd.com>; Sider, Graham
> >> <Graham.Sider@amd.com>; amd-gfx@lists.freedesktop.org
> >> Cc: Kuehling, Felix <Felix.Kuehling@amd.com>
> >> Subject: RE: [PATCH] drm/amdgpu: add print for iommu translation mode
> >>
> >> [AMD Official Use Only - General]
> >>
> >>
> >>
> >>> -----Original Message-----
> >>> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of
> >>> Hamza Mahfooz
> >>> Sent: Friday, March 17, 2023 3:58 PM
> >>> To: Sider, Graham <Graham.Sider@amd.com>;
> >>> amd-gfx@lists.freedesktop.org
> >>> Cc: Kuehling, Felix <Felix.Kuehling@amd.com>
> >>> Subject: Re: [PATCH] drm/amdgpu: add print for iommu translation
> >>> mode
> >>>
> >>>
> >>> On 3/17/23 15:47, Graham Sider wrote:
> >>>> Add log to display whether RAM is direct vs DMA mapped.
> >>>>
> >>>> Signed-off-by: Graham Sider <Graham.Sider@amd.com>
> >>> If this information is only useful for debugging purposes, please
> >>> use
> >>> drm_dbg() instead of pr_info().
> > It's useful for more than just debug I would say. Just a quick way to grep
> whether IOMMU is off/pt vs device isolation mode.
> 
> Mhm, shouldn't the IOMMU code note that as well?
>

As of right now, not exactly. Copy-pasting Felix's comment here:

The kernel log [currently] tells you the default IOMMU domain, but it may not match the domain actually used for the GPU. Without this message there is no easy way to tell from a kernel log. This will help with triaging issues from logs provided by external and internal users.

Graham

> 
> Christian.
> 
> >
> > Graham
> >
> >>>> ---
> >>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +++++-
> >>>>    1 file changed, 5 insertions(+), 1 deletion(-)
> >>>>
> >>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> >>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> >>>> index 8bba5e6872a1..8797a9523244 100644
> >>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> >>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> >>>> @@ -3528,8 +3528,12 @@ static void
> >>> amdgpu_device_check_iommu_direct_map(struct amdgpu_device
> *adev)
> >>>>            struct iommu_domain *domain;
> >>>>
> >>>>            domain = iommu_get_domain_for_dev(adev->dev);
> >>>> -  if (!domain || domain->type == IOMMU_DOMAIN_IDENTITY)
> >>>> +  if (!domain || domain->type == IOMMU_DOMAIN_IDENTITY) {
> >>>> +          pr_info("RAM is direct mapped to GPU (not traslated by
> >> traslated -> translated
> >>
> > Thanks, my keyboard keeps skipping the on the 'n' key lately :( time for a
> clean.
> >
> > Graham
> >
> >>   Kent
> >>> IOMMU)\n");
> >>>>                    adev->ram_is_direct_mapped = true;
> >>>> +  } else {
> >>>> +          pr_info("RAM is DMA mapped to GPU (translated by
> >>> IOMMU)\n");
> >>>> +  }
> >>>>    }
> >>>>
> >>>>    static const struct attribute *amdgpu_dev_attributes[] = {
> >>> --
> >>> Hamza

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-03-21 19:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-17 19:47 [PATCH] drm/amdgpu: add print for iommu translation mode Graham Sider
2023-03-17 19:57 ` Hamza Mahfooz
2023-03-17 19:58   ` Russell, Kent
2023-03-17 20:04     ` Sider, Graham
2023-03-17 21:16       ` Felix Kuehling
2023-03-20 13:36         ` Sider, Graham
2023-03-21 18:52       ` Christian König
2023-03-21 19:45         ` Sider, Graham

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).