dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 1/6] drm/ttm: cleanup and optimize ttm_bo_mem_compat
       [not found] ` <1490792146-2218-2-git-send-email-deathsimple@vodafone.de>
@ 2017-03-30  6:38   ` Michel Dänzer
       [not found]     ` <0aeb9046-86c6-f14f-490e-cbf74079e107-otUistvHUpPR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Michel Dänzer @ 2017-03-30  6:38 UTC (permalink / raw)
  To: Christian König; +Cc: dri-devel, amd-gfx

On 29/03/17 09:55 PM, Christian König wrote:
> From: Christian König <christian.koenig@amd.com>
> 
> No need to implement the same logic twice. Also check if the busy placements
> are identical to the already scanned placements before checking them.
> 
> Signed-off-by: Christian König <christian.koenig@amd.com>

[...]

> @@ -1077,6 +1065,23 @@ bool ttm_bo_mem_compat(struct ttm_placement *placement,
>  		    (*new_flags & mem->placement & TTM_PL_MASK_MEM))
>  			return true;
>  	}
> +	return false;
> +}
> +
> +bool ttm_bo_mem_compat(struct ttm_placement *placement,
> +		       struct ttm_mem_reg *mem,
> +		       uint32_t *new_flags)
> +{
> +	if (ttm_bo_places_compat(placement->placement, placement->num_placement,
> +				 mem, new_flags))
> +		return true;
> +
> +	if ((placement->busy_placement != placement->placement ||
> +	     placement->num_busy_placement != placement->num_placement) &&

	     placement->num_busy_placement > placement->num_placement) &&

?


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 3/6] drm/ttm: add TTM_PL_FLAG_CONTIGUOUS
       [not found]   ` <1490792146-2218-4-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
@ 2017-03-30  6:39     ` Michel Dänzer
  0 siblings, 0 replies; 12+ messages in thread
From: Michel Dänzer @ 2017-03-30  6:39 UTC (permalink / raw)
  To: Christian König
  Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	maraeo-Re5JQEeQqe8AvxtiuMwx3w,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On 29/03/17 09:55 PM, Christian König wrote:
> From: Christian König <christian.koenig@amd.com>
> 
> This allows drivers to specify if they need a contiguous allocation or not.
> 
> Signed-off-by: Christian König <christian.koenig@amd.com>

[...]

> diff --git a/include/drm/ttm/ttm_placement.h b/include/drm/ttm/ttm_placement.h
> index 932be0c..40f947f 100644
> --- a/include/drm/ttm/ttm_placement.h
> +++ b/include/drm/ttm/ttm_placement.h
> @@ -63,6 +63,7 @@
>  #define TTM_PL_FLAG_CACHED      (1 << 16)
>  #define TTM_PL_FLAG_UNCACHED    (1 << 17)
>  #define TTM_PL_FLAG_WC          (1 << 18)
> +#define TTM_PL_FLAG_CONTIGUOUS	(1 << 19)

The value on this line doesn't line up, because it uses a tab instead of
spaces.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH 4/6] drm/amdgpu: drop alpha support
       [not found] ` <1490792146-2218-5-git-send-email-deathsimple@vodafone.de>
@ 2017-03-30  6:39   ` Michel Dänzer
  2017-03-30 13:09     ` Alex Deucher
  0 siblings, 1 reply; 12+ messages in thread
From: Michel Dänzer @ 2017-03-30  6:39 UTC (permalink / raw)
  To: Christian König; +Cc: dri-devel, amd-gfx

On 29/03/17 09:55 PM, Christian König wrote:
> From: Christian König <christian.koenig@amd.com>
> 
> We will probably never see this combination.
> 
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 25 -------------------------
>  1 file changed, 25 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 7bf5ba7..524abca 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -538,31 +538,6 @@ static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_
>  			return -EINVAL;
>  		mem->bus.base = adev->mc.aper_base;
>  		mem->bus.is_iomem = true;
> -#ifdef __alpha__
> -		/*
> -		 * Alpha: use bus.addr to hold the ioremap() return,
> -		 * so we can modify bus.base below.
> -		 */
> -		if (mem->placement & TTM_PL_FLAG_WC)
> -			mem->bus.addr =
> -				ioremap_wc(mem->bus.base + mem->bus.offset,
> -					   mem->bus.size);
> -		else
> -			mem->bus.addr =
> -				ioremap_nocache(mem->bus.base + mem->bus.offset,
> -						mem->bus.size);
> -		if (!mem->bus.addr)
> -			return -ENOMEM;
> -
> -		/*
> -		 * Alpha: Use just the bus offset plus
> -		 * the hose/domain memory base for bus.base.
> -		 * It then can be used to build PTEs for VRAM
> -		 * access, as done in ttm_bo_vm_fault().
> -		 */
> -		mem->bus.base = (mem->bus.base & 0x0ffffffffUL) +
> -			adev->ddev->hose->dense_mem_base;
> -#endif
>  		break;
>  	default:
>  		return -EINVAL;
> 

Maybe leave an #error line, or make AMDGPU depend on !ALPHA in Kconfig,
to prevent somebody from trying this driver on an Alpha machine, and it
mysteriously failing due to the lack of this?

Either way,

Acked-by: Michel Dänzer <michel.daenzer@amd.com>


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 2/6] drm/ttm: add io_mem_pfn callback
       [not found] ` <1490792146-2218-3-git-send-email-deathsimple@vodafone.de>
@ 2017-03-30  6:39   ` Michel Dänzer
  0 siblings, 0 replies; 12+ messages in thread
From: Michel Dänzer @ 2017-03-30  6:39 UTC (permalink / raw)
  To: Christian König; +Cc: dri-devel, amd-gfx

On 29/03/17 09:55 PM, Christian König wrote:
> From: Christian König <christian.koenig@amd.com>
> 
> This allows the driver to handle io_mem mappings on their own.
> 
> Signed-off-by: Christian König <christian.koenig@amd.com>

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: CPU mapping of split VRAM buffers
       [not found] <1490792146-2218-1-git-send-email-deathsimple@vodafone.de>
                   ` (3 preceding siblings ...)
       [not found] ` <1490792146-2218-3-git-send-email-deathsimple@vodafone.de>
@ 2017-03-30  6:42 ` Michel Dänzer
  4 siblings, 0 replies; 12+ messages in thread
From: Michel Dänzer @ 2017-03-30  6:42 UTC (permalink / raw)
  To: Christian König; +Cc: dri-devel, amd-gfx

On 29/03/17 09:55 PM, Christian König wrote:
> Hi guys,
> 
> this set implements CPU mapping of split VRAM buffers and could
> help with some performance issues regarding this.
> 
> Please review and/or comment,

Patches 5 & 6 look mostly good to me, but I don't fully understand all
changes in there, so I only feel comfortable giving

Acked-by: Michel Dänzer <michel.daenzer@amd.com>

for them.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 1/6] drm/ttm: cleanup and optimize ttm_bo_mem_compat
       [not found]     ` <0aeb9046-86c6-f14f-490e-cbf74079e107-otUistvHUpPR7s880joybQ@public.gmane.org>
@ 2017-03-30  8:41       ` Christian König
  0 siblings, 0 replies; 12+ messages in thread
From: Christian König @ 2017-03-30  8:41 UTC (permalink / raw)
  To: Michel Dänzer
  Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	maraeo-Re5JQEeQqe8AvxtiuMwx3w,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Am 30.03.2017 um 08:38 schrieb Michel Dänzer:
> On 29/03/17 09:55 PM, Christian König wrote:
>> From: Christian König <christian.koenig@amd.com>
>>
>> No need to implement the same logic twice. Also check if the busy placements
>> are identical to the already scanned placements before checking them.
>>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
> [...]
>
>> @@ -1077,6 +1065,23 @@ bool ttm_bo_mem_compat(struct ttm_placement *placement,
>>   		    (*new_flags & mem->placement & TTM_PL_MASK_MEM))
>>   			return true;
>>   	}
>> +	return false;
>> +}
>> +
>> +bool ttm_bo_mem_compat(struct ttm_placement *placement,
>> +		       struct ttm_mem_reg *mem,
>> +		       uint32_t *new_flags)
>> +{
>> +	if (ttm_bo_places_compat(placement->placement, placement->num_placement,
>> +				 mem, new_flags))
>> +		return true;
>> +
>> +	if ((placement->busy_placement != placement->placement ||
>> +	     placement->num_busy_placement != placement->num_placement) &&
> 	     placement->num_busy_placement > placement->num_placement) &&
>
> ?

Good idea.

Christian.

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH 4/6] drm/amdgpu: drop alpha support
  2017-03-30  6:39   ` [PATCH 4/6] drm/amdgpu: drop alpha support Michel Dänzer
@ 2017-03-30 13:09     ` Alex Deucher
  2017-03-30 13:22       ` Christian König
  2017-03-31  1:07       ` Michel Dänzer
  0 siblings, 2 replies; 12+ messages in thread
From: Alex Deucher @ 2017-03-30 13:09 UTC (permalink / raw)
  To: Michel Dänzer; +Cc: amd-gfx list, Maling list - DRI developers

On Thu, Mar 30, 2017 at 2:39 AM, Michel Dänzer <michel@daenzer.net> wrote:
> On 29/03/17 09:55 PM, Christian König wrote:
>> From: Christian König <christian.koenig@amd.com>
>>
>> We will probably never see this combination.
>>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
>> ---
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 25 -------------------------
>>  1 file changed, 25 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> index 7bf5ba7..524abca 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> @@ -538,31 +538,6 @@ static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_
>>                       return -EINVAL;
>>               mem->bus.base = adev->mc.aper_base;
>>               mem->bus.is_iomem = true;
>> -#ifdef __alpha__
>> -             /*
>> -              * Alpha: use bus.addr to hold the ioremap() return,
>> -              * so we can modify bus.base below.
>> -              */
>> -             if (mem->placement & TTM_PL_FLAG_WC)
>> -                     mem->bus.addr =
>> -                             ioremap_wc(mem->bus.base + mem->bus.offset,
>> -                                        mem->bus.size);
>> -             else
>> -                     mem->bus.addr =
>> -                             ioremap_nocache(mem->bus.base + mem->bus.offset,
>> -                                             mem->bus.size);
>> -             if (!mem->bus.addr)
>> -                     return -ENOMEM;
>> -
>> -             /*
>> -              * Alpha: Use just the bus offset plus
>> -              * the hose/domain memory base for bus.base.
>> -              * It then can be used to build PTEs for VRAM
>> -              * access, as done in ttm_bo_vm_fault().
>> -              */
>> -             mem->bus.base = (mem->bus.base & 0x0ffffffffUL) +
>> -                     adev->ddev->hose->dense_mem_base;
>> -#endif
>>               break;
>>       default:
>>               return -EINVAL;
>>
>
> Maybe leave an #error line, or make AMDGPU depend on !ALPHA in Kconfig,
> to prevent somebody from trying this driver on an Alpha machine, and it
> mysteriously failing due to the lack of this?
>
> Either way,
>
> Acked-by: Michel Dänzer <michel.daenzer@amd.com>

Does this code even work on alpha (or compile for that matter)?  I
think this was blindly copied over from radeon UMS to radeon KMS to
amdgpu.

Alex

>
>
> --
> Earthling Michel Dänzer               |               http://www.amd.com
> Libre software enthusiast             |             Mesa and X developer
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 4/6] drm/amdgpu: drop alpha support
  2017-03-30 13:09     ` Alex Deucher
@ 2017-03-30 13:22       ` Christian König
  2017-03-31  1:07       ` Michel Dänzer
  1 sibling, 0 replies; 12+ messages in thread
From: Christian König @ 2017-03-30 13:22 UTC (permalink / raw)
  To: Alex Deucher, Michel Dänzer
  Cc: amd-gfx list, Maling list - DRI developers

Am 30.03.2017 um 15:09 schrieb Alex Deucher:
> On Thu, Mar 30, 2017 at 2:39 AM, Michel Dänzer <michel@daenzer.net> wrote:
>> On 29/03/17 09:55 PM, Christian König wrote:
>>> From: Christian König <christian.koenig@amd.com>
>>>
>>> We will probably never see this combination.
>>>
>>> Signed-off-by: Christian König <christian.koenig@amd.com>
>>> ---
>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 25 -------------------------
>>>   1 file changed, 25 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>> index 7bf5ba7..524abca 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>> @@ -538,31 +538,6 @@ static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_
>>>                        return -EINVAL;
>>>                mem->bus.base = adev->mc.aper_base;
>>>                mem->bus.is_iomem = true;
>>> -#ifdef __alpha__
>>> -             /*
>>> -              * Alpha: use bus.addr to hold the ioremap() return,
>>> -              * so we can modify bus.base below.
>>> -              */
>>> -             if (mem->placement & TTM_PL_FLAG_WC)
>>> -                     mem->bus.addr =
>>> -                             ioremap_wc(mem->bus.base + mem->bus.offset,
>>> -                                        mem->bus.size);
>>> -             else
>>> -                     mem->bus.addr =
>>> -                             ioremap_nocache(mem->bus.base + mem->bus.offset,
>>> -                                             mem->bus.size);
>>> -             if (!mem->bus.addr)
>>> -                     return -ENOMEM;
>>> -
>>> -             /*
>>> -              * Alpha: Use just the bus offset plus
>>> -              * the hose/domain memory base for bus.base.
>>> -              * It then can be used to build PTEs for VRAM
>>> -              * access, as done in ttm_bo_vm_fault().
>>> -              */
>>> -             mem->bus.base = (mem->bus.base & 0x0ffffffffUL) +
>>> -                     adev->ddev->hose->dense_mem_base;
>>> -#endif
>>>                break;
>>>        default:
>>>                return -EINVAL;
>>>
>> Maybe leave an #error line, or make AMDGPU depend on !ALPHA in Kconfig,
>> to prevent somebody from trying this driver on an Alpha machine, and it
>> mysteriously failing due to the lack of this?
>>
>> Either way,
>>
>> Acked-by: Michel Dänzer <michel.daenzer@amd.com>
> Does this code even work on alpha (or compile for that matter)?  I
> think this was blindly copied over from radeon UMS to radeon KMS to
> amdgpu.

Yeah, I was questioning that myself as well.

I'm fine adding a !ALPHA to the Kconfig, but I'm quite sure that 
architecture is just dead.

Christian.

>
> Alex
>
>>
>> --
>> Earthling Michel Dänzer               |               http://www.amd.com
>> Libre software enthusiast             |             Mesa and X developer
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 4/6] drm/amdgpu: drop alpha support
  2017-03-30 13:09     ` Alex Deucher
  2017-03-30 13:22       ` Christian König
@ 2017-03-31  1:07       ` Michel Dänzer
  2017-03-31  7:09         ` Christian König
  1 sibling, 1 reply; 12+ messages in thread
From: Michel Dänzer @ 2017-03-31  1:07 UTC (permalink / raw)
  To: Alex Deucher; +Cc: Maling list - DRI developers, amd-gfx list

On 30/03/17 10:09 PM, Alex Deucher wrote:
> On Thu, Mar 30, 2017 at 2:39 AM, Michel Dänzer <michel@daenzer.net> wrote:
>> On 29/03/17 09:55 PM, Christian König wrote:
>>> From: Christian König <christian.koenig@amd.com>
>>>
>>> We will probably never see this combination.
>>>
>>> Signed-off-by: Christian König <christian.koenig@amd.com>
>>> ---
>>>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 25 -------------------------
>>>  1 file changed, 25 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>> index 7bf5ba7..524abca 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>> @@ -538,31 +538,6 @@ static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_
>>>                       return -EINVAL;
>>>               mem->bus.base = adev->mc.aper_base;
>>>               mem->bus.is_iomem = true;
>>> -#ifdef __alpha__
>>> -             /*
>>> -              * Alpha: use bus.addr to hold the ioremap() return,
>>> -              * so we can modify bus.base below.
>>> -              */
>>> -             if (mem->placement & TTM_PL_FLAG_WC)
>>> -                     mem->bus.addr =
>>> -                             ioremap_wc(mem->bus.base + mem->bus.offset,
>>> -                                        mem->bus.size);
>>> -             else
>>> -                     mem->bus.addr =
>>> -                             ioremap_nocache(mem->bus.base + mem->bus.offset,
>>> -                                             mem->bus.size);
>>> -             if (!mem->bus.addr)
>>> -                     return -ENOMEM;
>>> -
>>> -             /*
>>> -              * Alpha: Use just the bus offset plus
>>> -              * the hose/domain memory base for bus.base.
>>> -              * It then can be used to build PTEs for VRAM
>>> -              * access, as done in ttm_bo_vm_fault().
>>> -              */
>>> -             mem->bus.base = (mem->bus.base & 0x0ffffffffUL) +
>>> -                     adev->ddev->hose->dense_mem_base;
>>> -#endif
>>>               break;
>>>       default:
>>>               return -EINVAL;
>>>
>>
>> Maybe leave an #error line, or make AMDGPU depend on !ALPHA in Kconfig,
>> to prevent somebody from trying this driver on an Alpha machine, and it
>> mysteriously failing due to the lack of this?
>>
>> Either way,
>>
>> Acked-by: Michel Dänzer <michel.daenzer@amd.com>
> 
> Does this code even work on alpha (or compile for that matter)?

If it doesn't compile, that makes it obvious to somebody who tries
compiling it on Alpha that there's something wrong. Whereas if we just
remove it, the driver might build but probably won't work.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 4/6] drm/amdgpu: drop alpha support
  2017-03-31  1:07       ` Michel Dänzer
@ 2017-03-31  7:09         ` Christian König
  2017-03-31  7:19           ` Michel Dänzer
  0 siblings, 1 reply; 12+ messages in thread
From: Christian König @ 2017-03-31  7:09 UTC (permalink / raw)
  To: Michel Dänzer, Alex Deucher
  Cc: Maling list - DRI developers, amd-gfx list

Am 31.03.2017 um 03:07 schrieb Michel Dänzer:
> On 30/03/17 10:09 PM, Alex Deucher wrote:
>> On Thu, Mar 30, 2017 at 2:39 AM, Michel Dänzer <michel@daenzer.net> wrote:
>>> On 29/03/17 09:55 PM, Christian König wrote:
>>>> From: Christian König <christian.koenig@amd.com>
>>>>
>>>> We will probably never see this combination.
>>>>
>>>> Signed-off-by: Christian König <christian.koenig@amd.com>
>>>> ---
>>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 25 -------------------------
>>>>   1 file changed, 25 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>>> index 7bf5ba7..524abca 100644
>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>>> @@ -538,31 +538,6 @@ static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_
>>>>                        return -EINVAL;
>>>>                mem->bus.base = adev->mc.aper_base;
>>>>                mem->bus.is_iomem = true;
>>>> -#ifdef __alpha__
>>>> -             /*
>>>> -              * Alpha: use bus.addr to hold the ioremap() return,
>>>> -              * so we can modify bus.base below.
>>>> -              */
>>>> -             if (mem->placement & TTM_PL_FLAG_WC)
>>>> -                     mem->bus.addr =
>>>> -                             ioremap_wc(mem->bus.base + mem->bus.offset,
>>>> -                                        mem->bus.size);
>>>> -             else
>>>> -                     mem->bus.addr =
>>>> -                             ioremap_nocache(mem->bus.base + mem->bus.offset,
>>>> -                                             mem->bus.size);
>>>> -             if (!mem->bus.addr)
>>>> -                     return -ENOMEM;
>>>> -
>>>> -             /*
>>>> -              * Alpha: Use just the bus offset plus
>>>> -              * the hose/domain memory base for bus.base.
>>>> -              * It then can be used to build PTEs for VRAM
>>>> -              * access, as done in ttm_bo_vm_fault().
>>>> -              */
>>>> -             mem->bus.base = (mem->bus.base & 0x0ffffffffUL) +
>>>> -                     adev->ddev->hose->dense_mem_base;
>>>> -#endif
>>>>                break;
>>>>        default:
>>>>                return -EINVAL;
>>>>
>>> Maybe leave an #error line, or make AMDGPU depend on !ALPHA in Kconfig,
>>> to prevent somebody from trying this driver on an Alpha machine, and it
>>> mysteriously failing due to the lack of this?
>>>
>>> Either way,
>>>
>>> Acked-by: Michel Dänzer <michel.daenzer@amd.com>
>> Does this code even work on alpha (or compile for that matter)?
> If it doesn't compile, that makes it obvious to somebody who tries
> compiling it on Alpha that there's something wrong. Whereas if we just
> remove it, the driver might build but probably won't work.

According to Wikipedia the last Alpha was build in 2004, the first GCN 1 
hardware we support shipped in 2014.

That's a decade between those and I have strong doubts that any Alpha 
board has physically PCIe compatible slots.

Anyway, I will just add a !ALPHA to Kconfig.

Christian.


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 4/6] drm/amdgpu: drop alpha support
  2017-03-31  7:09         ` Christian König
@ 2017-03-31  7:19           ` Michel Dänzer
  0 siblings, 0 replies; 12+ messages in thread
From: Michel Dänzer @ 2017-03-31  7:19 UTC (permalink / raw)
  To: Christian König, Alex Deucher
  Cc: amd-gfx list, Maling list - DRI developers

On 31/03/17 04:09 PM, Christian König wrote:
> Am 31.03.2017 um 03:07 schrieb Michel Dänzer:
>> On 30/03/17 10:09 PM, Alex Deucher wrote:
>>> On Thu, Mar 30, 2017 at 2:39 AM, Michel Dänzer <michel@daenzer.net>
>>> wrote:
>>>> On 29/03/17 09:55 PM, Christian König wrote:
>>>>> From: Christian König <christian.koenig@amd.com>
>>>>>
>>>>> We will probably never see this combination.
>>>>>
>>>>> Signed-off-by: Christian König <christian.koenig@amd.com>
>>>>> ---
>>>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 25
>>>>> -------------------------
>>>>>   1 file changed, 25 deletions(-)
>>>>>
>>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>>>> index 7bf5ba7..524abca 100644
>>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>>>> @@ -538,31 +538,6 @@ static int amdgpu_ttm_io_mem_reserve(struct
>>>>> ttm_bo_device *bdev, struct ttm_mem_
>>>>>                        return -EINVAL;
>>>>>                mem->bus.base = adev->mc.aper_base;
>>>>>                mem->bus.is_iomem = true;
>>>>> -#ifdef __alpha__
>>>>> -             /*
>>>>> -              * Alpha: use bus.addr to hold the ioremap() return,
>>>>> -              * so we can modify bus.base below.
>>>>> -              */
>>>>> -             if (mem->placement & TTM_PL_FLAG_WC)
>>>>> -                     mem->bus.addr =
>>>>> -                             ioremap_wc(mem->bus.base +
>>>>> mem->bus.offset,
>>>>> -                                        mem->bus.size);
>>>>> -             else
>>>>> -                     mem->bus.addr =
>>>>> -                             ioremap_nocache(mem->bus.base +
>>>>> mem->bus.offset,
>>>>> -                                             mem->bus.size);
>>>>> -             if (!mem->bus.addr)
>>>>> -                     return -ENOMEM;
>>>>> -
>>>>> -             /*
>>>>> -              * Alpha: Use just the bus offset plus
>>>>> -              * the hose/domain memory base for bus.base.
>>>>> -              * It then can be used to build PTEs for VRAM
>>>>> -              * access, as done in ttm_bo_vm_fault().
>>>>> -              */
>>>>> -             mem->bus.base = (mem->bus.base & 0x0ffffffffUL) +
>>>>> -                     adev->ddev->hose->dense_mem_base;
>>>>> -#endif
>>>>>                break;
>>>>>        default:
>>>>>                return -EINVAL;
>>>>>
>>>> Maybe leave an #error line, or make AMDGPU depend on !ALPHA in Kconfig,
>>>> to prevent somebody from trying this driver on an Alpha machine, and it
>>>> mysteriously failing due to the lack of this?
>>>>
>>>> Either way,
>>>>
>>>> Acked-by: Michel Dänzer <michel.daenzer@amd.com>
>>> Does this code even work on alpha (or compile for that matter)?
>> If it doesn't compile, that makes it obvious to somebody who tries
>> compiling it on Alpha that there's something wrong. Whereas if we just
>> remove it, the driver might build but probably won't work.
> 
> According to Wikipedia the last Alpha was build in 2004, the first GCN 1
> hardware we support shipped in 2014.
> 
> That's a decade between those and I have strong doubts that any Alpha
> board has physically PCIe compatible slots.

That's a good point about PCIe.

 git grep -i PCIe arch/alpha

in the kernel tree doesn't turn up anything.


> Anyway, I will just add a !ALPHA to Kconfig.

You've convinced me it's not necessary. The patch is

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>

as is.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH 1/6] drm/ttm: cleanup and optimize ttm_bo_mem_compat
@ 2017-03-29 17:43 Christian König
  0 siblings, 0 replies; 12+ messages in thread
From: Christian König @ 2017-03-29 17:43 UTC (permalink / raw)
  To: dri-devel

From: Christian König <christian.koenig@amd.com>

No need to implement the same logic twice. Also check if the busy placements
are identical to the already scanned placements before checking them.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/ttm/ttm_bo.c | 45 ++++++++++++++++++++++++--------------------
 1 file changed, 25 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 989b98b..96b1450 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1046,29 +1046,17 @@ static int ttm_bo_move_buffer(struct ttm_buffer_object *bo,
 	return ret;
 }
 
-bool ttm_bo_mem_compat(struct ttm_placement *placement,
-		       struct ttm_mem_reg *mem,
-		       uint32_t *new_flags)
+static bool ttm_bo_places_compat(const struct ttm_place *places,
+				 unsigned num_placement,
+				 struct ttm_mem_reg *mem,
+				 uint32_t *new_flags)
 {
-	int i;
+	unsigned i;
 
-	for (i = 0; i < placement->num_placement; i++) {
-		const struct ttm_place *heap = &placement->placement[i];
-		if (mem->mm_node &&
-		    (mem->start < heap->fpfn ||
-		     (heap->lpfn != 0 && (mem->start + mem->num_pages) > heap->lpfn)))
-			continue;
+	for (i = 0; i < num_placement; i++) {
+		const struct ttm_place *heap = &places[i];
 
-		*new_flags = heap->flags;
-		if ((*new_flags & mem->placement & TTM_PL_MASK_CACHING) &&
-		    (*new_flags & mem->placement & TTM_PL_MASK_MEM))
-			return true;
-	}
-
-	for (i = 0; i < placement->num_busy_placement; i++) {
-		const struct ttm_place *heap = &placement->busy_placement[i];
-		if (mem->mm_node &&
-		    (mem->start < heap->fpfn ||
+		if (mem->mm_node && (mem->start < heap->fpfn ||
 		     (heap->lpfn != 0 && (mem->start + mem->num_pages) > heap->lpfn)))
 			continue;
 
@@ -1077,6 +1065,23 @@ bool ttm_bo_mem_compat(struct ttm_placement *placement,
 		    (*new_flags & mem->placement & TTM_PL_MASK_MEM))
 			return true;
 	}
+	return false;
+}
+
+bool ttm_bo_mem_compat(struct ttm_placement *placement,
+		       struct ttm_mem_reg *mem,
+		       uint32_t *new_flags)
+{
+	if (ttm_bo_places_compat(placement->placement, placement->num_placement,
+				 mem, new_flags))
+		return true;
+
+	if ((placement->busy_placement != placement->placement ||
+	     placement->num_busy_placement != placement->num_placement) &&
+	    ttm_bo_places_compat(placement->busy_placement,
+				 placement->num_busy_placement,
+				 mem, new_flags))
+		return true;
 
 	return false;
 }
-- 
2.5.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2017-03-31  7:19 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1490792146-2218-1-git-send-email-deathsimple@vodafone.de>
     [not found] ` <1490792146-2218-2-git-send-email-deathsimple@vodafone.de>
2017-03-30  6:38   ` [PATCH 1/6] drm/ttm: cleanup and optimize ttm_bo_mem_compat Michel Dänzer
     [not found]     ` <0aeb9046-86c6-f14f-490e-cbf74079e107-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-03-30  8:41       ` Christian König
     [not found] ` <1490792146-2218-4-git-send-email-deathsimple@vodafone.de>
     [not found]   ` <1490792146-2218-4-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-03-30  6:39     ` [PATCH 3/6] drm/ttm: add TTM_PL_FLAG_CONTIGUOUS Michel Dänzer
     [not found] ` <1490792146-2218-5-git-send-email-deathsimple@vodafone.de>
2017-03-30  6:39   ` [PATCH 4/6] drm/amdgpu: drop alpha support Michel Dänzer
2017-03-30 13:09     ` Alex Deucher
2017-03-30 13:22       ` Christian König
2017-03-31  1:07       ` Michel Dänzer
2017-03-31  7:09         ` Christian König
2017-03-31  7:19           ` Michel Dänzer
     [not found] ` <1490792146-2218-3-git-send-email-deathsimple@vodafone.de>
2017-03-30  6:39   ` [PATCH 2/6] drm/ttm: add io_mem_pfn callback Michel Dänzer
2017-03-30  6:42 ` CPU mapping of split VRAM buffers Michel Dänzer
2017-03-29 17:43 [PATCH 1/6] drm/ttm: cleanup and optimize ttm_bo_mem_compat Christian König

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