[Openpvrsgx-devgroup] Building the 1.7.862890 branch for x86

H. Nikolaus Schaller hns at goldelico.com
Sun Sep 1 22:45:02 CEST 2024


Hi, welcome back!

> Am 31.08.2024 um 12:48 schrieb Julius Schwartzenberg <julius.vrijheid at freedom.nl>:
> 
> On 02.06.24 22:30, H. Nikolaus Schaller wrote:
>> No problem... SGX is out there for almost 20 years now (SGX520/530 released Jul 2005 according to Wikipedia) so that a few months don't make a significant difference :)
>> And I won't have too much spare time either. Just refreshing the branches every week to follow upstream (changes).
> 
> I continued with my build fixes on the original branch where I dropped the Intel parts in place. I guess some changes are still incomplete. Now I'm stuck on things related to DRM memory management. It seems this requires more knowledge and understanding around how TTM works.
> 
> Here is the current output:
>  CC [M]  drivers/gpu/drm/pvrsgx/1.7.862890/drv/psb_drv.o
> drivers/gpu/drm/pvrsgx/1.7.862890/drv/psb_drv.c: In function ‘psb_do_init’:
> drivers/gpu/drm/pvrsgx/1.7.862890/drv/psb_drv.c:599:14: error: implicit declaration of function ‘ttm_bo_init_mm’; did you mean ‘ttm_bo_wait’? [-Werror=implicit-function-declaration]
>  599 |         if (!ttm_bo_init_mm(bdev, TTM_PL_TT,
>      |              ^~~~~~~~~~~~~~
>      |              ttm_bo_wait
> In file included from drivers/gpu/drm/pvrsgx/1.7.862890/drv/psb_drv.c:30:

... snip

It appears that this function ttm_bo_init_mm() was last available in v5.9 and removed in v5.10.

	https://elixir.bootlin.com/linux/v5.9.16/A/ident/ttm_bo_init_mm
	https://elixir.bootlin.com/linux/v5.10-rc1/A/ident/ttm_bo_init_mm

A usual trick I am applying in such situations is to look for another driver that
used this function and try to understand how they replaced it.

Let's try this:

	https://elixir.bootlin.com/linux/v5.9.16/source/drivers/gpu/drm/radeon/radeon_ttm.c#L788

This function radeon_ttm_init() still exists in

	https://elixir.bootlin.com/linux/v6.11-rc5/source/drivers/gpu/drm/radeon/radeon_ttm.c#L679

So we learn that ttm_bo_init_mm() was replaced by a new function radeon_ttm_init_vram().
This simply wraps

	return ttm_range_man_init(&rdev->mman.bdev, TTM_PL_VRAM,
				 false, rdev->mc.real_vram_size >> PAGE_SHIFT);

Therefore, a call to ttm_range_man_init() with SoC specific parameters is likely
a replacement for ttm_bo_init_mm() [needs some verification].

You could also locate the patch that introduced radeon_ttm_init_vram() by

	git blame v5.10-rc1 drivers/gpu/drm/radeon/radeon_ttm.c | fgrep radeon_ttm_init_vram

It's commit message and content may help to locate other potentially required changes.

> Maybe at some point I can study the topics of DRM and TTM myself as well, but this is quite far from what I've ever done before.

Well, I would assume this is also far from what approx. 8 Billion people minus 20 have ever done before. Me included :)
So it is indeed an adventure with unclear outcome...

BR,
Nikolaus

PS: I think I have finally fixed the gmail issue of the mailing list so please try.



More information about the openpvrsgx-devgroup mailing list