openpvrsgx-devgroup / linux_openpvrsgx

This project is about shaping existing GPL Linux kernel drivers for the PVR/SGX5 architecture so that they can become accepted into drivers/gpu/drm. It is NOT about reverse engineering or user-space components (firmware and libs), just the kernel device drivers. There is also be some glue code for the processor of the SoC (OMAP, Sunxi, jz4780).
Other
47 stars 21 forks source link

Missing directories #16

Closed MightyM17 closed 2 weeks ago

MightyM17 commented 1 month ago

On 6.12.0-rc4 branch, build fails with

make[1]: Entering directory '/mnt/linux/.output'
  GEN     Makefile
  CALL    ../scripts/checksyscalls.sh
  MAKE    drivers/gpu/drm/pvrsgx: omap4430/60
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/omap/sysconfig.o
cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/: No such file or directory [-Wmissing-include-dirs]
cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/include4: No such file or directory [-Wmissing-include-dirs]
cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/include: No such file or directory [-Wmissing-include-dirs]
cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/include/env/linux: No such file or directory [-Wmissing-include-dirs]
cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/include: No such file or directory [-Wmissing-include-dirs]
cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/bridged: No such file or directory [-Wmissing-include-dirs]
cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/bridged/sgx: No such file or directory [-Wmissing-include-dirs]
cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/devices/sgx: No such file or directory [-Wmissing-include-dirs]
cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux: No such file or directory [-Wmissing-include-dirs]
cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/hwdefs: No such file or directory [-Wmissing-include-dirs]
cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/include: No such file or directory [-Wmissing-include-dirs]
cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/3rdparty/bufferclass_example: No such file or directory [-Wmissing-include-dirs]
cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/omap: No such file or directory [-Wmissing-include-dirs]
cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/3rdparty/linux_drm: No such file or directory [-Wmissing-include-dirs]
../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/omap/sysconfig.c:44:10: fatal error: services_headers.h: No such file or directory
   44 | #include "services_headers.h"
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[8]: *** [../scripts/Makefile.build:229: drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/omap/sysconfig.o] Error 1
make[7]: *** [../drivers/gpu/drm/pvrsgx/Makefile:69: drivers/gpu/drm/pvrsgx/pvr] Error 2
make[6]: *** [../scripts/Makefile.build:478: drivers/gpu/drm/pvrsgx] Error 2
make[5]: *** [../scripts/Makefile.build:478: drivers/gpu/drm] Error 2
make[4]: *** [../scripts/Makefile.build:478: drivers/gpu] Error 2
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [../scripts/Makefile.build:478: drivers] Error 2
make[2]: *** [/mnt/linux/Makefile:1936: .] Error 2
make[1]: *** [/mnt/linux/Makefile:224: __sub-make] Error 2
make[1]: Leaving directory '/mnt/linux/.output'
make: *** [Makefile:224: __sub-make] Error 2
goldelico commented 1 month ago

Hi,

Am 25.10.2024 um 13:20 schrieb Mighty @.***>:

On 6.12.0-rc4 branch, build fails with make[1]: Entering directory '/mnt/linux/.output' GEN Makefile CALL ../scripts/checksyscalls.sh MAKE drivers/gpu/drm/pvrsgx: omap4430/60 CC [M] drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/omap/sysconfig.o cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/: No such file or directory [-Wmissing-include-dirs] cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/include4: No such file or directory [-Wmissing-include-dirs] cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/include: No such file or directory [-Wmissing-include-dirs] cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/include/env/linux: No such file or directory [-Wmissing-include-dirs] cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/include: No such file or directory [-Wmissing-include-dirs] cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/bridged: No such file or directory [-Wmissing-include-dirs] cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/bridged/sgx: No such file or directory [-Wmissing-include-dirs] cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/devices/sgx: No such file or directory [-Wmissing-include-dirs] cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux: No such file or directory [-Wmissing-include-dirs] cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/hwdefs: No such file or directory [-Wmissing-include-dirs] cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/include: No such file or directory [-Wmissing-include-dirs] cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/3rdparty/bufferclass_example: No such file or directory [-Wmissing-include-dirs] cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/omap: No such file or directory [-Wmissing-include-dirs] cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/3rdparty/linux_drm: No such file or directory [-Wmissing-include-dirs] ../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/omap/sysconfig.c:44:10: fatal error: services_headers.h: No such file or directory 44 | #include "services_headers.h" | ^~~~~~~~ compilation terminated. make[8]: [../scripts/Makefile.build:229: drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/omap/sysconfig.o] Error 1 make[7]: [../drivers/gpu/drm/pvrsgx/Makefile:69: drivers/gpu/drm/pvrsgx/pvr] Error 2 make[6]: [../scripts/Makefile.build:478: drivers/gpu/drm/pvrsgx] Error 2 make[5]: [../scripts/Makefile.build:478: drivers/gpu/drm] Error 2 make[4]: [../scripts/Makefile.build:478: drivers/gpu] Error 2 make[4]: Waiting for unfinished jobs.... make[3]: [../scripts/Makefile.build:478: drivers] Error 2 make[2]: [/mnt/linux/Makefile:1936: .] Error 2 make[1]: [/mnt/linux/Makefile:224: __sub-make] Error 2 make[1]: Leaving directory '/mnt/linux/.output' make: [Makefile:224: __sub-make] Error 2

Thanks for the report. I'll check asap.

BR, Nikolaus

MightyM17 commented 1 month ago

6.8-rc4 seems to build fine

goldelico commented 1 month ago

Hi, I have now checked and it works for me with the Letux kernel (and defconfig). So I tried with omap2plus_defconfig (and 32 bit ARM).

There I had to add CONFIG_PREEMPT_VOLUNTARY=y.

Am 25.10.2024 um 13:20 schrieb Mighty @.***>:

On 6.12.0-rc4 branch, build fails with make[1]: Entering directory '/mnt/linux/.output' GEN Makefile CALL ../scripts/checksyscalls.sh MAKE drivers/gpu/drm/pvrsgx: omap4430/60 CC [M] drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/omap/sysconfig.o cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/: No such file or directory [-Wmissing-include-dirs]

This is strange why you see ../.. as prefix of drivers. Did you "cd" into the kernel root tree when running make?

cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/include4: No such file or directory [-Wmissing-include-dirs] cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/include: No such file or directory [-Wmissing-include-dirs] cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/include/env/linux: No such file or directory [-Wmissing-include-dirs] cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/include: No such file or directory [-Wmissing-include-dirs] cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/bridged: No such file or directory [-Wmissing-include-dirs] cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/bridged/sgx: No such file or directory [-Wmissing-include-dirs] cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/devices/sgx: No such file or directory [-Wmissing-include-dirs] cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux: No such file or directory [-Wmissing-include-dirs] cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/hwdefs: No such file or directory [-Wmissing-include-dirs] cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/include: No such file or directory [-Wmissing-include-dirs] cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/3rdparty/bufferclass_example: No such file or directory [-Wmissing-include-dirs] cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/omap: No such file or directory [-Wmissing-include-dirs] cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/3rdparty/linux_drm: No such file or directory [-Wmissing-include-dirs] ../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/omap/sysconfig.c:44:10: fatal error: services_headers.h: No such file or directory 44 | #include "services_headers.h" | ^~~~~~~~

It appears to be an effect of the cc1 search paths and build environment.

Can you check that drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/include/services_headers.h (without ../..) exists?

Maybe, some shell script plus magic which tries to locate the build root in a subdirectory is doing not the same thing as for me.

We should also verify that we try to build the same branch:

https://github.com/openpvrsgx-devgroup/linux_openpvrsgx/tree/pvrsrvkm-6.12-rc4

compilation terminated. make[8]: [../scripts/Makefile.build:229: drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/omap/sysconfig.o] Error 1 make[7]: [../drivers/gpu/drm/pvrsgx/Makefile:69: drivers/gpu/drm/pvrsgx/pvr] Error 2 make[6]: [../scripts/Makefile.build:478: drivers/gpu/drm/pvrsgx] Error 2 make[5]: [../scripts/Makefile.build:478: drivers/gpu/drm] Error 2 make[4]: [../scripts/Makefile.build:478: drivers/gpu] Error 2 make[4]: Waiting for unfinished jobs.... make[3]: [../scripts/Makefile.build:478: drivers] Error 2 make[2]: [/mnt/linux/Makefile:1936: .] Error 2 make[1]: [/mnt/linux/Makefile:224: __sub-make] Error 2 make[1]: Leaving directory '/mnt/linux/.output' make: [Makefile:224: __sub-make] Error 2

Best, Nikolaus

MightyM17 commented 1 month ago

Hi, I have now checked and it works for me with the Letux kernel (and defconfig). So I tried with omap2plus_defconfig (and 32 bit ARM). There I had to add CONFIG_PREEMPT_VOLUNTARY=y.

Hm, this isnt set on my config, which is indeed based on omap2plus https://gitlab.com/pvrports/pvrports/-/blob/v23.12/community/linux-openpvrsgx/config-openpvrsgx.armv7?ref_type=heads#L107 I'll give it a go tomorrow! How does it break without CONFIG_PREEMPT_VOLUNTARY for you?

This is strange why you see ../.. as prefix of drivers. Did you "cd" into the kernel root tree when running make?

Ah yes, I'm using pmOS's envkernel for this (https://wiki.postmarketos.org/wiki/envkernel) since the normal cross compiler breaks the build with ld: fs/nfs_common/nfsacl.o: relocations in generic ELF (EM: 40) for me, thats another issue not here :P So envkernel just uses an alpine chroot to build the kernel, that leads it to use /mnt/linux to be the source directory.

It appears to be an effect of the cc1 search paths and build environment. Can you check that drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/include/services_headers.h (without ../..) exists? Maybe, some shell script plus magic which tries to locate the build root in a subdirectory is doing not the same thing as for me.

drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/include/services_headers.h does infact exist. I assume you mean inside the kernel source which would be /mnt/linux here

We should also verify that we try to build the same branch: https://github.com/openpvrsgx-devgroup/linux_openpvrsgx/tree/pvrsrvkm-6.12-rc4 Yep correct branch indeed.

I do think CONFIG_PREEMPT_VOLUNTARY may be the solution though

Best Regards

MightyM17 commented 1 month ago

Hey, quick update did a build on 6.12.0-rc4 with CONFIG_PREEMPT_VOLUNTARY=y and it worked! Really bizarre

goldelico commented 1 month ago

Great!!! I am currently hunting some compile bugs in the ddk 1.14 code.

Am 26.10.2024 um 18:56 schrieb Mighty @.***>:

Hey, quick update did a build on 6.12.0-rc4 with CONFIG_PREEMPT_VOLUNTARY=y and it worked! Really bizarre

— Reply to this email directly, view it on GitHub https://github.com/openpvrsgx-devgroup/linux_openpvrsgx/issues/16#issuecomment-2439654744, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHOUPJJV4XH2UVRBBCYRVLZ5PCUXAVCNFSM6AAAAABQTB4S2CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMZZGY2TINZUGQ. You are receiving this because you commented.

MightyM17 commented 1 month ago

Hey, sorry seems like I had built 6.8 again by my mistake, even with CONFIG_PREEMPT_VOLUNTARY, 6.12.0-rc4 fails with the same error

MightyM17 commented 1 month ago

https://github.com/openpvrsgx-devgroup/linux_openpvrsgx/commit/64ba2f0e2eba0db140ef51db31577a368f802b2a#diff-a494205b8219139c0f662331e8252a23dbe70ecba7a17863b25dc4791372a860R508 Also why are we going back to 1.14 ddk now?

goldelico commented 1 month ago

Hi,

Am 27.10.2024 um 11:10 schrieb Mighty @.***>:

Hey, sorry seems like I had built 6.8 again by my mistake, even with CONFIG_PREEMPT_VOLUNTARY, 6.12.0-rc4 fails with the same error

Ok, I see.

Well, then it likely has something to do with how your source tree is set up and how make is called.

I just git checkout pvrsrvkm and then in the root do "make omap2plus_defconfig".

Best, Nikolaus

goldelico commented 1 month ago

Hi,

Am 27.10.2024 um 11:17 schrieb Mighty @.***>:

64ba2f0#diff-a494205b8219139c0f662331e8252a23dbe70ecba7a17863b25dc4791372a860R508 https://github.com/openpvrsgx-devgroup/linux_openpvrsgx/commit/64ba2f0e2eba0db140ef51db31577a368f802b2a#diff-a494205b8219139c0f662331e8252a23dbe70ecba7a17863b25dc4791372a860R508 Also why are we going back to 1.14 ddk now?

Well, it was always in this way in the omap2plus_defconfig, e.g.:

https://github.com/openpvrsgx-devgroup/linux_openpvrsgx/blob/letux-pvrsrvkm-6.0-rc7/arch/arm/configs/omap2plus_defconfig#L529 https://github.com/openpvrsgx-devgroup/linux_openpvrsgx/blob/pvrsrvkm-6.11-rc2/arch/arm/configs/omap2plus_defconfig#L508

It is just a feature of GitHub to hide the original date (18 Feb 2020) and show only the date of the last rebaseto v6.12-rc4 (21 Oct 2024) as "committed last week".

The reason for this "default" is that the DDK1.14 and DDK1.17 support different subsets of the OMAP family so it is not possible do it right for everyone.

Best, Nikolaus

MightyM17 commented 1 month ago

Well, then it likely has something to do with how your source tree is set up and how make is called.

That is even more troubling considering how 6.8 just works

I just git checkout pvrsrvkm and then in the root do "make omap2plus_defconfig".

So as you said, I tried doing the omap2plus_defconfig but it fails with the same error - https://paste.debian.net/1333629/

BR

goldelico commented 1 month ago

Hi,

Am 27.10.2024 um 19:56 schrieb Mighty @.***>:

Well, then it likely has something to do with how your source tree is set up and how make is called. That is even more troubling considering how 6.8 just works

Well, there may be upstream changes to the Kernel build system in between. Or we have modified the drivers/gpu/drm/pvrsgx.

Could you try to build the 6.10 tree and depending on its outcome 6.9 and 6.11? Sort of a manual bisect? Then we know at which release this has changed.

I just git checkout pvrsrvkm and then in the root do "make omap2plus_defconfig". So as you said, I tried doing the omap2plus_defconfig but it fails with the same error - https://paste.debian.net/1333629/

I have looked through it and this line

CALL ../scripts/checksyscalls.sh

is something I have never seen in my builds.

And

make: Entering directory '/mnt/linux' make[1]: Entering directory '/mnt/linux/.output' 

means that the build process changes to some subdirectory ".output" in between. This may be the reason for ../scripts being found and ../../drivers/gpu/drm/pvrsgx/ not found. (and I have no idea what pmbootsrap and envkernel.sh are doing).

Of course we have some implicit assumptions in the pvrsgx Makefiles about directories and associated -I. And this pmbootstrap envkernel.sh may break these.

Is it possible to run make outside of pmbootstrap without this "Entering directory"?

BR, Nikolaus

MightyM17 commented 1 month ago

Well, there may be upstream changes to the Kernel build system in between. Or we have modified the drivers/gpu/drm/pvrsgx. Could you try to build the 6.10 tree and depending on its outcome 6.9 and 6.11? Sort of a manual bisect? Then we know at which release this has changed.

Yep this seems to be the best method, I'll try and figure out what branch it breaks on and then the commits can be checked?

I have looked through it and this line CALL ../scripts/checksyscalls.sh is something I have never seen in my builds.

It most likely is https://github.com/torvalds/linux/blob/master/scripts/checksyscalls.sh

And make: Entering directory '/mnt/linux' make[1]: Entering directory '/mnt/linux/.output' means that the build process changes to some subdirectory ".output" in between. This may be the reason for ../scripts being found and ../../drivers/gpu/drm/pvrsgx/ not found. (and I have no idea what pmbootsrap and envkernel.sh are doing). Of course we have some implicit assumptions in the pvrsgx Makefiles about directories and associated -I. And this pmbootstrap envkernel.sh may break these. Is it possible to run make outside of pmbootstrap without this "Entering directory"?

That just happens when an outdir is used right, like with -O=.output? I gave it a try with ubuntu 24.04 cc, but that gave me ld errors as mentioned above

BR

goldelico commented 1 month ago

Am 27.10.2024 um 21:04 schrieb Mighty @.***>:

Well, there may be upstream changes to the Kernel build system in between. Or we have modified the drivers/gpu/drm/pvrsgx. Could you try to build the 6.10 tree and depending on its outcome 6.9 and 6.11? Sort of a manual bisect? Then we know at which release this has changed.

Yep this seems to be the best method, I'll try and figure out what branch it breaks on and then the commits can be checked?

I have looked through it and this line CALL ../scripts/checksyscalls.sh is something I have never seen in my builds.

It most likely is https://github.com/torvalds/linux/blob/master/scripts/checksyscalls.sh

Sure. But on my builds never with ../ prefix.

And make: Entering directory '/mnt/linux' make[1]: Entering directory '/mnt/linux/.output' means that the build process changes to some subdirectory ".output" in between. This may be the reason for ../scripts being found and ../../drivers/gpu/drm/pvrsgx/ not found. (and I have no idea what pmbootsrap and envkernel.sh are doing). Of course we have some implicit assumptions in the pvrsgx Makefiles about directories and associated -I. And this pmbootstrap envkernel.sh may break these. Is it possible to run make outside of pmbootstrap without this "Entering directory"?

That just happens when an outdir is used right, like with -O=.output? I gave it a try with ubuntu 24.04 cc, but that gave me ld errors as mentioned above

Ok, this is a good hint. If you look at our Makefile:

https://github.com/openpvrsgx-devgroup/linux_openpvrsgx/blob/fd5f1bbea38779cd39a1a3b3d1443bb5bd9db5b4/drivers/gpu/drm/pvrsgx/Makefile#L15

It uses $(out) and $(srctree) which may be related to the -O flag.

So it might be that the Makefile isn't handling you situation well enough.

In fact the Makefile is a big hack to build multiple kernel modules from a single tree which is not easy to achieve with Kbuild. But I have no idea how to change it and test for you...

goldelico commented 1 month ago

Am 27.10.2024 um 21:19 schrieb H. Nikolaus Schaller @.***>:

Am 27.10.2024 um 21:04 schrieb Mighty @.***>:

Well, there may be upstream changes to the Kernel build system in between. Or we have modified the drivers/gpu/drm/pvrsgx. Could you try to build the 6.10 tree and depending on its outcome 6.9 and 6.11? Sort of a manual bisect? Then we know at which release this has changed. Yep this seems to be the best method, I'll try and figure out what branch it breaks on and then the commits can be checked? I have looked through it and this line CALL ../scripts/checksyscalls.sh is something I have never seen in my builds. It most likely is https://github.com/torvalds/linux/blob/master/scripts/checksyscalls.sh

Sure. But on my builds never with ../ prefix.

And make: Entering directory '/mnt/linux' make[1]: Entering directory '/mnt/linux/.output' means that the build process changes to some subdirectory ".output" in between. This may be the reason for ../scripts being found and ../../drivers/gpu/drm/pvrsgx/ not found. (and I have no idea what pmbootsrap and envkernel.sh are doing). Of course we have some implicit assumptions in the pvrsgx Makefiles about directories and associated -I. And this pmbootstrap envkernel.sh may break these. Is it possible to run make outside of pmbootstrap without this "Entering directory"? That just happens when an outdir is used right, like with -O=.output? I gave it a try with ubuntu 24.04 cc, but that gave me ld errors as mentioned above

Ok, this is a good hint. If you look at our Makefile:

https://github.com/openpvrsgx-devgroup/linux_openpvrsgx/blob/fd5f1bbea38779cd39a1a3b3d1443bb5bd9db5b4/drivers/gpu/drm/pvrsgx/Makefile#L15

It uses $(out) and $(srctree) which may be related to the -O flag.

Indeed this makes the "Entering directory" visible:

make V=2 CONFIG_DEBUG_SECTION_MISMATCH=y letux_defconfig O=.output make[1]: Entering directory '/Volumes/CaseSensitive/master/.output'


The source tree is not clean, please run 'make mrproper' in /Volumes/CaseSensitive/master


/Volumes/CaseSensitive/master/Makefile:631: recipe for target 'outputmakefile' failed make[2]: *** [outputmakefile] Error 1 /Volumes/CaseSensitive/master/Makefile:224: recipe for target '__sub-make' failed

So it might be that the Makefile isn't handling you situation well enough.

In fact the Makefile is a big hack to build multiple kernel modules from a single tree which is not easy to achieve with Kbuild. But I have no idea how to change it and test for you...

goldelico commented 4 weeks ago

Am 27.10.2024 um 21:35 schrieb H. Nikolaus Schaller @.***>:

So it might be that the Makefile isn't handling you situation well enough.

In fact the Makefile is a big hack to build multiple kernel modules from a single tree which is not easy to achieve with Kbuild. But I have no idea how to change it and test for you...

A new idea:

it is not the master Makefile (drivers/gpu/drm/pvrsgx/Makefile) but the one inside the DDK version tree:

drivers/gpu/drm/pvrsgx/1.14.3699939/eurasia_km/Makefile

or

drivers/gpu/drm/pvrsgx/1.14.3699939/eurasia_km/Makefile

There we find:

ccflags-y += \ ... -I$(srctree)/$(src)/services4/srvkm/include \ ...

which should enable the compiler to find

drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/include/services_headers.h

But it doesn't. Rather your compiler complains:

cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/include: No such file or directory [-Wmissing-include-dirs]

This could mean that the $(srctree) prefix is ../.. if make O=.output is done. And is either absolute or ./ if there is no O=.output.

And $(src) should be drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km. But I don't know and it might be different

Could you simply try to remove the $(srctree)/ prefix and check what happens? Or alternatively remove $(src)/? Or replace $(srctree)/$(src)/ by drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/?

If this works and compiles sysconfig.c (likely will still emit a lot of cc1 warnings), we have a hint what we need to better understand and fix.

BR and thanks, Nikolaus

MightyM17 commented 4 weeks ago

Hey sorry for the late replies, but I followed as you said and it seems that may be the solution

$srctree is [..]
$src is [../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km]

So it seems these vars are badly defined in our makefile, I will check that they are in 6.8 and probably will try to fix it, since then a lot of makefiles would be affected due to some wrong definition :( Hardcoding the path also works like you mentioned above (the last option) but then some other makefile needs to be fixed xD

$srctree is [..]
$src is [../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km]
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/omap/sysconfig.o
cc1: warning: include/linux: No such file or directory [-Wmissing-include-dirs]
cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/3rdparty/linux_drm: No such file or directory [-Wmissing-include-dirs]
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/omap/sysutils_linux.o
cc1: warning: include/linux: No such file or directory [-Wmissing-include-dirs]
cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/3rdparty/linux_drm: No such file or directory [-Wmissing-include-dirs]
  CC      drivers/usb/phy/of.o
  CC      drivers/net/phy/stubs.o
../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/omap/sysutils_linux.c:157:10: warning: no previous prototype for 'SysGetSGXTimingInformation' [-Wmissing-prototypes]
  157 | IMG_VOID SysGetSGXTimingInformation(SGX_TIMING_INFORMATION *psTimingInfo)
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/../../pvr-drv.o
cc1: warning: include/linux: No such file or directory [-Wmissing-include-dirs]
cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/3rdparty/linux_drm: No such file or directory [-Wmissing-include-dirs]
  CC      drivers/input/input-compat.o
  CC      drivers/usb/host/pci-quirks.o
  AR      drivers/mtd/nand/onenand/built-in.a
  CC      drivers/mtd/nand/raw/nand_base.o
  CC [M]  drivers/usb/common/common.o
  CC [M]  drivers/usb/phy/phy-generic.o
  AR      drivers/scsi/built-in.a
  CC      drivers/rtc/lib.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/bridged/bridged_pvr_bridge.o
cc1: warning: include/linux: No such file or directory [-Wmissing-include-dirs]
cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/3rdparty/linux_drm: No such file or directory [-Wmissing-include-dirs]
../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/bridged/bridged_pvr_bridge.c:46:10: fatal error: stddef.h: No such file or directory
   46 | #include <stddef.h>
      |          ^~~~~~~~~~
compilation terminated.
goldelico commented 4 weeks ago

Ok, we are on the right track!

Am 29.10.2024 um 15:35 schrieb Mighty @.***>:

Hey sorry for the late replies, but I followed as you said and it seems that may be the solution

$srctree is [..] $src is [../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km] So it seems these vars are badly defined in our makefile, I will check that they are in 6.8 and probably will try to fix it, since then a lot of makefiles would be affected due to some wrong definition :( Hardcoding the path also works like you mentioned above (the last option) but then some other makefile needs to be fixed xD

$srctree is [..] $src is [../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km] CC [M] drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/omap/sysconfig.o cc1: warning: include/linux: No such file or directory [-Wmissing-include-dirs] cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/3rdparty/linux_drm: No such file or directory [-Wmissing-include-dirs] CC [M] drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/omap/sysutils_linux.o cc1: warning: include/linux: No such file or directory [-Wmissing-include-dirs] cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/3rdparty/linux_drm: No such file or directory [-Wmissing-include-dirs] CC drivers/usb/phy/of.o CC drivers/net/phy/stubs.o ../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/omap/sysutils_linux.c:157:10: warning: no previous prototype for 'SysGetSGXTimingInformation' [-Wmissing-prototypes] 157 | IMG_VOID SysGetSGXTimingInformation(SGX_TIMING_INFORMATION *psTimingInfo) | ^~~~~~ CC [M] drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/../../pvr-drv.o cc1: warning: include/linux: No such file or directory [-Wmissing-include-dirs] cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/3rdparty/linux_drm: No such file or directory [-Wmissing-include-dirs] CC drivers/input/input-compat.o CC drivers/usb/host/pci-quirks.o AR drivers/mtd/nand/onenand/built-in.a CC drivers/mtd/nand/raw/nand_base.o CC [M] drivers/usb/common/common.o CC [M] drivers/usb/phy/phy-generic.o AR drivers/scsi/built-in.a CC drivers/rtc/lib.o CC [M] drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/bridged/bridged_pvr_bridge.o cc1: warning: include/linux: No such file or directory [-Wmissing-include-dirs] cc1: warning: ../../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/3rdparty/linux_drm: No such file or directory [-Wmissing-include-dirs] ../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/bridged/bridged_pvr_bridge.c:46:10: fatal error: stddef.h: No such file or directory 46 | #include | ^~~~~~ compilation terminated. — Reply to this email directly, view it on GitHub https://github.com/openpvrsgx-devgroup/linux_openpvrsgx/issues/16#issuecomment-2444452369, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHOUPMFAVTAGMDWNVXSP6DZ56MJRAVCNFSM6AAAAABQTB4S2CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINBUGQ2TEMZWHE. You are receiving this because you commented.

MightyM17 commented 4 weeks ago

So on 6.8 it is $srctree is [..] $src is [drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km]

and on 6.12 it becomes $srctree is [..] $src is [../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km]

MightyM17 commented 4 weeks ago

Just adding src := drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km to the makefile and it seems to work just fine now, no clue how and where src is defined though

goldelico commented 4 weeks ago

Am 29.10.2024 um 16:03 schrieb Mighty @.***>:

Just adding src := drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km to the makefile and it seems to work just fine now, no clue how and where src is defined though

So you can now compile it completely? That would be fine.

I am currently grepping through the source code to understand. And it will be interesting what has changed between 6.8 and 6.12.

MightyM17 commented 4 weeks ago

Yes it builds successfully using that hack!

goldelico commented 4 weeks ago

Am 29.10.2024 um 16:00 schrieb Mighty @.***>:

So on 6.8 it is $srctree is [..] $src is [drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km] and on 6.12 it becomes $srctree is [..] $src is [../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km]

Well, then this must be a change in the Linux build system. Which changes the definition of $(src).

After some grepping and git blaming I found:

it is defined in scripts/Makefile.build (original code by Linus from before 2005).

It was changed in v6.10-rc1 by a patch from April 2024: b1992c3772e69a ("kbuild: use $(src) instead of $(srctree)/$(src) for source directory")

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=b1992c3772e69a

This patch comments:

Consequently, $(srctree)/$(src) in upstream Makefiles need to be replaced with $(src).

So we have the reason and a solution...

find drivers/gpu/drm/pvrsgx -name Makefile -exec sed -i.bak 's|$(srctree)/$(src)|$(src)|' {} \;

I will add a patch to our tree.

BR, Nikolaus

MightyM17 commented 4 weeks ago

That is quite amazing! Thanks a lot for the efforts, they are very much appreciated!

Best Regards

MightyM17 commented 4 weeks ago
diff --git a/drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/Makefile b/drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/Makefile
index 84ce3723d..5476444b4 100644
--- a/drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/Makefile
+++ b/drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/Makefile
@@ -43,24 +43,24 @@ ccflags-y += \
        -I$(srctree)/include \
        -I$(srctree)/arch/arm/mach-omap2 \
        -I$(srctree)/drivers/video/fbdev/omap2 \
-       -I$(srctree)/$(src)/ \
-       -I$(srctree)/$(src)/include4 \
-       -I$(srctree)/$(src)/services4/include \
-       -I$(srctree)/$(src)/services4/include/env/linux \
-       -I$(srctree)/$(src)/services4/system/include \
-       -I$(srctree)/$(src)/services4/srvkm/bridged \
-       -I$(srctree)/$(src)/services4/srvkm/bridged/sgx \
-       -I$(srctree)/$(src)/services4/srvkm/devices/sgx \
-       -I$(srctree)/$(src)/services4/srvkm/env/linux \
-       -I$(srctree)/$(src)/services4/srvkm/hwdefs \
-       -I$(srctree)/$(src)/services4/srvkm/include \
-       -I$(srctree)/$(src)/services4/3rdparty/bufferclass_example \
+       -I$(src)/ \
+       -I$(src)/include4 \
+       -I$(src)/services4/include \
+       -I$(src)/services4/include/env/linux \
+       -I$(src)/services4/system/include \
+       -I$(src)/services4/srvkm/bridged \
+       -I$(src)/services4/srvkm/bridged/sgx \
+       -I$(src)/services4/srvkm/devices/sgx \
+       -I$(src)/services4/srvkm/env/linux \
+       -I$(src)/services4/srvkm/hwdefs \
+       -I$(src)/services4/srvkm/include \
+       -I$(src)/services4/3rdparty/bufferclass_example \
        -I$(srctree)/include/linux

 # choose SoC integration variant to choose the right source subtree

 ccflags-y += \
-       -I$(srctree)/$(src)/services4/system/$(SOC_FAMILY)
+       -I$(src)/services4/system/$(SOC_FAMILY)

 ifeq ($(SOC_FAMILY),omap)
 $(TARGET) += \
@@ -232,7 +232,7 @@ endif
 # $(TARGET) += services4/3rdparty/linux_drm/pvr_drm_stubs.o

 ccflags-y += -I$(srctree)/include/drm \
-       -I$(srctree)/$(src)/services4/3rdparty/linux_drm
+       -I$(src)/services4/3rdparty/linux_drm

 ccflags-y += -DSUPPORT_HW_RECOVERY
 ccflags-y += -DPVR_LINUX_USING_WORKQUEUES

This should be the patch that is working, it leads to a few warnings in build as well

 make -j8
*** pmbootstrap envkernel.sh active for /home/mighty/6.12! ***
make: Entering directory '/mnt/linux'
make[1]: Entering directory '/mnt/linux/.output'
  GEN     Makefile
  CALL    ../scripts/checksyscalls.sh
  MAKE    drivers/gpu/drm/pvrsgx: omap4430/60
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/omap/sysconfig.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/omap/sysutils_linux.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/../../pvr-drv.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/bridged/bridged_pvr_bridge.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/bridged/bridged_support.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/bridged/sgx/bridged_sgx_bridge.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/buffer_manager.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/devicemem.o
../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/omap/sysutils_linux.c:157:10: warning: no previous prototype for 'SysGetSGXTimingInformation' [-Wmissing-prototypes]
  157 | IMG_VOID SysGetSGXTimingInformation(SGX_TIMING_INFORMATION *psTimingInfo)
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/handle.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/hash.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/lists.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/mem.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/mem_debug.o
../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/devicemem.c: In function 'PVRSRVMapDmaBufKM':
../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/devicemem.c:1949:29: warning: variable 'psDeviceNode' set but not used [-Wunused-but-set-variable]
 1949 |         PVRSRV_DEVICE_NODE *psDeviceNode;
      |                             ^~~~~~~~~~~~
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/metrics.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/osfunc_common.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/pdump_common.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/perproc.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/power.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/pvrsrv.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/queue.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/ra.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/resman.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/refcount.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/devices/sgx/mmu.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/devices/sgx/pb.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/devices/sgx/sgxinit.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/devices/sgx/sgxkick.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/devices/sgx/sgxpower.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/devices/sgx/sgxreset.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/devices/sgx/sgxutils.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/devices/sgx/sgxtransfer.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/dmabuf.o
../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/devices/sgx/sgxinit.c: In function 'SGXGetMiscInfoKM':
../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/devices/sgx/sgxinit.c:2984:26: warning: variable 'pui32MiscInfoFlags' set but not used [-Wunused-but-set-variable]
 2984 |         IMG_UINT32      *pui32MiscInfoFlags;
      |                          ^~~~~~~~~~~~~~~~~~
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/event.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/mm.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/mmap.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/module.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/mutex.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/mutils.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/osfunc.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/osperproc.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/pdump.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/proc.o
../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/module.c: In function 'PVRSRVRelease':
../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/module.c:855:13: warning: variable 'err' set but not used [-Wunused-but-set-variable]
  855 |         int err = 0;
      |             ^~~
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/pvr_bridge_k.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/pvr_debug.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/pvr_linux_fence.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/deviceclass.o
  LD [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/pvrsrvkm_omap4_sgx540_120.o
  MAKE    drivers/gpu/drm/pvrsgx: omap4470
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/omap/sysconfig.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/omap/sysutils_linux.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/../../pvr-drv.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/bridged/bridged_pvr_bridge.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/bridged/bridged_support.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/bridged/sgx/bridged_sgx_bridge.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/buffer_manager.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/devicemem.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/handle.o
../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/devicemem.c: In function 'PVRSRVMapDmaBufKM':
../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/devicemem.c:1949:29: warning: variable 'psDeviceNode' set but not used [-Wunused-but-set-variable]
 1949 |         PVRSRV_DEVICE_NODE *psDeviceNode;
      |                             ^~~~~~~~~~~~
../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/omap/sysutils_linux.c:157:10: warning: no previous prototype for 'SysGetSGXTimingInformation' [-Wmissing-prototypes]
  157 | IMG_VOID SysGetSGXTimingInformation(SGX_TIMING_INFORMATION *psTimingInfo)
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/hash.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/lists.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/mem.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/mem_debug.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/metrics.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/osfunc_common.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/pdump_common.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/perproc.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/power.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/pvrsrv.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/queue.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/ra.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/resman.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/refcount.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/devices/sgx/mmu.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/devices/sgx/pb.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/devices/sgx/sgxinit.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/devices/sgx/sgxkick.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/devices/sgx/sgxpower.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/devices/sgx/sgxreset.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/devices/sgx/sgxutils.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/devices/sgx/sgxtransfer.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/dmabuf.o
../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/devices/sgx/sgxinit.c: In function 'SGXInitialise':
../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/devices/sgx/sgxinit.c:540:41: warning: variable 'bFirstTime' set but not used [-Wunused-but-set-variable]
  540 |         static IMG_BOOL                 bFirstTime = IMG_TRUE;
      |                                         ^~~~~~~~~~
../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/devices/sgx/sgxinit.c: In function 'SGXGetMiscInfoKM':
../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/devices/sgx/sgxinit.c:2984:26: warning: variable 'pui32MiscInfoFlags' set but not used [-Wunused-but-set-variable]
 2984 |         IMG_UINT32      *pui32MiscInfoFlags;
      |                          ^~~~~~~~~~~~~~~~~~
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/event.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/mm.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/mmap.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/module.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/mutex.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/mutils.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/osfunc.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/osperproc.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/pdump.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/proc.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/pvr_bridge_k.o
../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/module.c: In function 'PVRSRVRelease':
../drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/module.c:855:13: warning: variable 'err' set but not used [-Wunused-but-set-variable]
  855 |         int err = 0;
      |             ^~~
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/pvr_debug.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/pvr_linux_fence.o
  CC [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/common/deviceclass.o
  LD [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/pvrsrvkm_omap4_sgx544_112.o
  MODPOST Module.symvers
  Kernel: arch/arm/boot/Image is ready
  Kernel: arch/arm/boot/zImage is ready
  LD [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/pvrsrvkm_omap4_sgx540_120.ko
  LD [M]  drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/pvrsrvkm_omap4_sgx544_112.ko
make[1]: Leaving directory '/mnt/linux/.output'
make: Leaving directory '/mnt/linux'

But using this we have the kernel booting and working, I'll test kmscube and other things to verify and then send a mr as well. The previous method mentioned by me casued a broken kernel https://lore.kernel.org/linux-omap/20241030084919.102592-1-bavishimithil@gmail.com/

goldelico commented 4 weeks ago

Indeed that is what already has been added to the Letux repos (but not yet pushed). So there is no need for a MR. Yes, the warnings are known. Most come from just embracing code info #if for different kernel versions but not all variable definitions. So there are (un)initialized variables which are not used. Only SysGetSGXTimingInformation() should have some declaration.

MightyM17 commented 3 weeks ago

Could you please merge them? The gpu is failing for me,

[   26.444244] input: fbkeyboard as /devices/virtual/input/input3
[   26.806579] ------------[ cut here ]------------
[   26.807769] WARNING: CPU: 1 PID: 1849 at drivers/gpu/drm/drm_file.c:312 drm_open_helper+0x140/0x14c
[   26.809051] Modules linked in: nft_reject_inet nf_reject_ipv6 nft_reject nft_ct nf_conntrack nf_defrag_ipv4 nf_defrag_ipv6 nf_tables nfnetlink ipv6 pvrsrvkm_omap4_sgx540_120 emif omap4_keypad omap_aes_driver omap_sham brcmfmac_wcc matrix_keymap omap_mailbox ohci_platform ohci_hcd ehci_omap brcmfmac brcmutil cfg80211 hci_uart btbcm omap_hdq bluetooth omap_des wire crypto_engine cn hwmon libdes omap_crypto ecdh_generic ecc mousedev pwm_twl_led joydev gpio_ir_tx rc_core cpufreq_dt gpio_keys usb_f_ncm u_ether libcomposite
[   26.817382] CPU: 1 UID: 0 PID: 1849 Comm: pvrsrvinit Tainted: G        W          6.12.0-rc4 #2
[   26.819305] Tainted: [W]=WARN
[   26.821105] Hardware name: Generic OMAP4 (Flattened Device Tree)
[   26.822967] Call trace:
[   26.822998]  unwind_backtrace from show_stack+0x10/0x14
[   26.826782]  show_stack from dump_stack_lvl+0x60/0x84
[   26.828704]  dump_stack_lvl from __warn+0x80/0x154
[   26.830596]  __warn from warn_slowpath_fmt+0x1ac/0x1b4
[   26.832458]  warn_slowpath_fmt from drm_open_helper+0x140/0x14c
[   26.834320]  drm_open_helper from drm_open+0x8c/0x130
[   26.836151]  drm_open from drm_stub_open+0xa0/0xd0
[   26.837982]  drm_stub_open from chrdev_open+0xac/0x1f0
[   26.839752]  chrdev_open from do_dentry_open+0x140/0x4c0
[   26.841400]  do_dentry_open from vfs_open+0x24/0xe8
[   26.842987]  vfs_open from path_openat+0x65c/0x1124
[   26.844451]  path_openat from do_filp_open+0x7c/0x118
[   26.845794]  do_filp_open from do_sys_openat2+0xa0/0xd4
[   26.847076]  do_sys_openat2 from sys_open+0x98/0xbc
[   26.848266]  sys_open from ret_fast_syscall+0x0/0x54
[   26.849456] Exception stack(0xf01f5fa8 to 0xf01f5ff0)
[   26.850616] 5fa0:                   00000000 00000000 bed76a60 000a0002 00000000 00000000
[   26.851837] 5fc0: 00000000 00000000 00000000 00000005 b6eb6028 b6eb601c b6eb603c 0045f280
[   26.853088] 5fe0: bed76a00 bed769f0 b6f478a7 b6f471e4
[   26.854339] ---[ end trace 0000000000000000 ]---
[   28.881744] ieee80211 phy0: brcmf_p2p_create_p2pdev: timeout occurred
[   28.886138] ieee80211 phy0: brcmf_cfg80211_add_iface: add iface p2p-dev-wlan0 type 10 failed: err=-5
[   33.048034] zram: Added device: zram0
kmscube
PVR:(Error): OpenServices: PVRDRMOpenRender failed [0, ]
PVR:(Error): PVRSRVConnect: Unable to open connection. [0, ]
PVR:(Error): Couldn't connect to services [0, ]
PVR:(Error): PVRDRIEGLGlobalDataInit: PVR Services initialisation failed [0, ]
PVR:(Error): PVRDRICreateScreenImpl: Couldn't create EGL global data [0, ]
PVR:(Error): OpenServices: PVRDRMOpenRender failed [0, ]
PVR:(Error): PVRSRVConnect: Unable to open connection. [0, ]
PVR:(Error): Couldn't connect to services [0, ]
PVR:(Error): PVRDRIEGLGlobalDataInit: PVR Services initialisation failed [0, ]
PVR:(Error): PVRDRICreateScreenImpl: Couldn't create EGL global data [0, ]
goldelico commented 3 weeks ago

Am 30.10.2024 um 16:38 schrieb Mighty @.***>:

Could you please merge them?

I have pushed a patched version just some minutes ago. The gpu is failing for me,

[ 26.444244] input: fbkeyboard as /devices/virtual/input/input3 [ 26.806579] ------------[ cut here ]------------ [ 26.807769] WARNING: CPU: 1 PID: 1849 at drivers/gpu/drm/drm_file.c:312 drm_open_helper+0x140/0x14c [ 26.809051] Modules linked in: nft_reject_inet nf_reject_ipv6 nft_reject nft_ct nf_conntrack nf_defrag_ipv4 nf_defrag_ipv6 nf_tables nfnetlink ipv6 pvrsrvkm_omap4_sgx540_120 emif omap4_keypad omap_aes_driver omap_sham brcmfmac_wcc matrix_keymap omap_mailbox ohci_platform ohci_hcd ehci_omap brcmfmac brcmutil cfg80211 hci_uart btbcm omap_hdq bluetooth omap_des wire crypto_engine cn hwmon libdes omap_crypto ecdh_generic ecc mousedev pwm_twl_led joydev gpio_ir_tx rc_core cpufreq_dt gpio_keys usb_f_ncm u_ether libcomposite [ 26.817382] CPU: 1 UID: 0 PID: 1849 Comm: pvrsrvinit Tainted: G W 6.12.0-rc4 #2 [ 26.819305] Tainted: [W]=WARN [ 26.821105] Hardware name: Generic OMAP4 (Flattened Device Tree) [ 26.822967] Call trace: [ 26.822998] unwind_backtrace from show_stack+0x10/0x14 [ 26.826782] show_stack from dump_stack_lvl+0x60/0x84 [ 26.828704] dump_stack_lvl from warn+0x80/0x154 [ 26.830596] warn from warn_slowpath_fmt+0x1ac/0x1b4 [ 26.832458] warn_slowpath_fmt from drm_open_helper+0x140/0x14c [ 26.834320] drm_open_helper from drm_open+0x8c/0x130 [ 26.836151] drm_open from drm_stub_open+0xa0/0xd0 [ 26.837982] drm_stub_open from chrdev_open+0xac/0x1f0 [ 26.839752] chrdev_open from do_dentry_open+0x140/0x4c0 [ 26.841400] do_dentry_open from vfs_open+0x24/0xe8 [ 26.842987] vfs_open from path_openat+0x65c/0x1124 [ 26.844451] path_openat from do_filp_open+0x7c/0x118 [ 26.845794] do_filp_open from do_sys_openat2+0xa0/0xd4 [ 26.847076] do_sys_openat2 from sys_open+0x98/0xbc [ 26.848266] sys_open from ret_fast_syscall+0x0/0x54 [ 26.849456] Exception stack(0xf01f5fa8 to 0xf01f5ff0) [ 26.850616] 5fa0: 00000000 00000000 bed76a60 000a0002 00000000 00000000 [ 26.851837] 5fc0: 00000000 00000000 00000000 00000005 b6eb6028 b6eb601c b6eb603c 0045f280 [ 26.853088] 5fe0: bed76a00 bed769f0 b6f478a7 b6f471e4 [ 26.854339] ---[ end trace 0000000000000000 ]--- [ 28.881744] ieee80211 phy0: brcmf_p2p_create_p2pdev: timeout occurred [ 28.886138] ieee80211 phy0: brcmf_cfg80211_add_iface: add iface p2p-dev-wlan0 type 10 failed: err=-5 [ 33.048034] zram: Added device: zram0 kmscube PVR:(Error): OpenServices: PVRDRMOpenRender failed [0, ] PVR:(Error): PVRSRVConnect: Unable to open connection. [0, ] PVR:(Error): Couldn't connect to services [0, ] PVR:(Error): PVRDRIEGLGlobalDataInit: PVR Services initialisation failed [0, ] PVR:(Error): PVRDRICreateScreenImpl: Couldn't create EGL global data [0, ] PVR:(Error): OpenServices: PVRDRMOpenRender failed [0, ] PVR:(Error): PVRSRVConnect: Unable to open connection. [0, ] PVR:(Error): Couldn't connect to services [0, ] PVR:(Error): PVRDRIEGLGlobalDataInit: PVR Services initialisation failed [0, ] PVR:(Error): PVRDRICreateScreenImpl: Couldn't create EGL global data [0, ] This looks like a different issue.

The strange thing is that the stack trace in itself is not linked to any pvrsgx code. The fail is outside. But it is within the pvrsrvinit code in some do_sys_openat2() syscall. Still it may be induced/related to the openpvrsgx code. Maybe, can you strace yor pvrsrvinit and find out which file triggers the kernel warning? kmscube and other applications need pvrsrvinit to succeed first. Did it work with 6.8 kernel? We have fixed some parts of memory management but there may be bugs.

MightyM17 commented 3 weeks ago

Not really sure what is breaking here, but the kernel just fails to work with 6.12, everything works flawlessly on 6.8 but I get no logs and the device gets stuck on framebuffer (mostly the kernel has panicked, I only see half a strace) and there is no way to access any logs

goldelico commented 3 weeks ago

Can you maybe disable / temporarily remove the pvrsrvkm kernel module to check if you can boot without?

MightyM17 commented 3 weeks ago

So finally managed to get it booting and working, here is some logs that'd interest you dmesg

[   19.823730] gpio-vibrator vibrator: supply vcc not found, using dummy regulator
[   19.844360] input: gpio-vibrator as /devices/platform/vibrator/input/input2
[   19.907257] pvrsrvkm 56000000.gpu: Enabling quirks 00000001
[   19.934631] vmalloc_node_range for size 33558528 failed: Address range restricted to 0xf6000000 - 0xff800000
[   19.934661] PVR_K:(Error): SysLocateDevices: Failed to map SGX registers
[   19.934692] PVR_K:(Error): SysInitialise: Failed to locate devices
[   20.449401] NET: Registered PF_INET6 protocol family
sudo pvrsrvinit
PVR:(Error): OpenServices: PVRDRMOpenRender failed [0, ]
PVR:(Error): PVRSRVInitSrvConnect: PVRSRVConnect failed [0, ]
PVR:(Error): SrvInit: PVRSRVInitSrvConnect failed (4) [0, ]
failed to initialize server
kmscube
PVR:(Error): OpenServices: PVRDRMOpenRender failed [0, ]
PVR:(Error): PVRSRVConnect: Unable to open connection. [0, ]
PVR:(Error): Couldn't connect to services [0, ]
PVR:(Error): PVRDRIEGLGlobalDataInit: PVR Services initialisation failed [0, ]
PVR:(Error): PVRDRICreateScreenImpl: Couldn't create EGL global data [0, ]
PVR:(Error): OpenServices: PVRDRMOpenRender failed [0, ]
PVR:(Error): PVRSRVConnect: Unable to open connection. [0, ]
PVR:(Error): Couldn't connect to services [0, ]
PVR:(Error): PVRDRIEGLGlobalDataInit: PVR Services initialisation failed [0, ]
PVR:(Error): PVRDRICreateScreenImpl: Couldn't create EGL global data [0, ]
Using display 0xb60c9030 with EGL version 1.4

https://paste.debian.net/1334351/

MightyM17 commented 3 weeks ago

I suppose https://github.com/openpvrsgx-devgroup/linux_openpvrsgx/commit/6425bce0d19e70f17da8eea7ec811d002d5b6db4#diff-4033cce15705ec9d3bce6ef544bd849d523a59a2df568e75c1569b0b04fcee4dR530 is a start? But you know better

goldelico commented 3 weeks ago

I have now installed Bullseye and the DDK 1.17 user space and get a similar missing initialization situation:

@.:~# pvrsrvctl --no-module --start PVR:(Error): OpenServices: PVRDRMOpenRender failed [0, ] PVR:(Error): PVRSRVInitSrvConnect: PVRSRVConnect failed [0, ] PVR:(Error): SrvInit: PVRSRVInitSrvConnect failed (4) [0, ] pvrsrvctl: SrvInit failed (already initialized?) (err=PVRSRV_ERROR_INIT_FAILURE) @.:~#

But I have no vmalloc_node_range or issue to map SGX registers. Only

[ 25.038787] pvrsrvkm 50000000.gpu: Enabling quirks 00000000

Well, vibrator is different platform :)

[ 18.290771] input: twl4030:vibrator as @.***:audio/twl4030-vibra/input/input4

Some system infos:

@.:~# uname -a Linux letux 6.12.0-rc5-letux+ #88 SMP PREEMPT Sat Nov 2 21:15:55 CET 2024 armv7l GNU/Linux @.:~# cat /proc/pvr/version Version SGX_DDK sgxddk @. (release) omap_sgx System Version String: None @.:~# lsmod | fgrep pvrsrv pvrsrvkm_omap3630_sgx530_125 299008 0 drm 385024 8 pvrsrvkm_omap3630_sgx530_125,panel_tpo_td028ttec1,display_connector,drm_display_helper,omapdrm,simple_bridge,drm_kms_helper @.***:~#

Am 02.11.2024 um 20:51 schrieb Mighty @.***>:

So finally managed to get it booting and working, here is some logs that'd interest you dmesg

[ 19.823730] gpio-vibrator vibrator: supply vcc not found, using dummy regulator [ 19.844360] input: gpio-vibrator as /devices/platform/vibrator/input/input2 [ 19.907257] pvrsrvkm 56000000.gpu: Enabling quirks 00000001 [ 19.934631] vmalloc_node_range for size 33558528 failed: Address range restricted to 0xf6000000 - 0xff800000 [ 19.934661] PVR_K:(Error): SysLocateDevices: Failed to map SGX registers [ 19.934692] PVR_K:(Error): SysInitialise: Failed to locate devices [ 20.449401] NET: Registered PF_INET6 protocol family sudo pvrsrvinit PVR:(Error): OpenServices: PVRDRMOpenRender failed [0, ] PVR:(Error): PVRSRVInitSrvConnect: PVRSRVConnect failed [0, ] PVR:(Error): SrvInit: PVRSRVInitSrvConnect failed (4) [0, ] failed to initialize server kmscube PVR:(Error): OpenServices: PVRDRMOpenRender failed [0, ] PVR:(Error): PVRSRVConnect: Unable to open connection. [0, ] PVR:(Error): Couldn't connect to services [0, ] PVR:(Error): PVRDRIEGLGlobalDataInit: PVR Services initialisation failed [0, ] PVR:(Error): PVRDRICreateScreenImpl: Couldn't create EGL global data [0, ] PVR:(Error): OpenServices: PVRDRMOpenRender failed [0, ] PVR:(Error): PVRSRVConnect: Unable to open connection. [0, ] PVR:(Error): Couldn't connect to services [0, ] PVR:(Error): PVRDRIEGLGlobalDataInit: PVR Services initialisation failed [0, ] PVR:(Error): PVRDRICreateScreenImpl: Couldn't create EGL global data [0, ] Using display 0xb60c9030 with EGL version 1.4 https://paste.debian.net/1334351/

— Reply to this email directly, view it on GitHub https://github.com/openpvrsgx-devgroup/linux_openpvrsgx/issues/16#issuecomment-2453110016, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHOUPNUAQ7FXY6WPDOHA2DZ6UUNZAVCNFSM6AAAAABQTB4S2CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJTGEYTAMBRGY. You are receiving this because you commented.

MightyM17 commented 3 weeks ago

Yeah the vibrator is just something that came along in the logs, but i think the main issue is [ 19.934631] vmalloc_node_range for size 33558528 failed: Address range restricted to 0xf6000000 - 0xff800000

The one you have put on Bullseye and DDK 1.17 seem to be different.

Any clue where that vmalloc_node_range function is called, I assume it might be in the binaries? (like pvrsrvinit)

MightyM17 commented 3 weeks ago

I am also using https://github.com/maemo-leste/sgx-ddk-um/tree/maemo/beowulf-devel/ as the source

MightyM17 commented 3 weeks ago

https://git.ti.com/cgit/graphics/omap5-sgx-ddk-um-linux/commit/?h=1.17.4948957/mesa/glibc-2.35&id=84a396a4fb379f10931421e489ac8a199d6a9f2c also should we include this?

MightyM17 commented 3 weeks ago

https://pastebin.com/CaSZnSGD My config

goldelico commented 3 weeks ago

Am 03.11.2024 um 06:18 schrieb Mighty @.***>:

Yeah the vibrator is just something that came along in the logs, but i think the main issue is [ 19.934631] vmalloc_node_range for size 33558528 failed: Address range restricted to 0xf6000000 - 0xff800000

The one you have put on Bullseye and DDK 1.17 seem to be different.

Any clue where that vmalloc_node_range function is called, I assume it might be in the binaries? (like pvrsrvinit)

— Reply to this email directly, view it on GitHub https://github.com/openpvrsgx-devgroup/linux_openpvrsgx/issues/16#issuecomment-2453301195, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHOUPJ2MJ4BCG4EDM627VDZ6WWY5AVCNFSM6AAAAABQTB4S2CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJTGMYDCMJZGU. You are receiving this because you commented.

My Bullseye packagefor omap3 is cloned from https://git.ti.com/cgit/graphics/omap5-sgx-ddk-um-linux/log/?h=ti-img-sgx/zeus/1.17.4948957 which may not be the latest one...

For vmalloc_node_range caller you could blacklist the pvrsrvkm in some /etc/modprobe/test.conf, then boot. And then run modprobe to load the pvrsrvkm.so http://pvrsrvkm.so/. If the message appears then, it is called by our driver.

goldelico commented 3 weeks ago

Am 03.11.2024 um 06:23 schrieb Mighty @.***>:

https://git.ti.com/cgit/graphics/omap5-sgx-ddk-um-linux/commit/?h=1.17.4948957/mesa/glibc-2.35&id=84a396a4fb379f10931421e489ac8a199d6a9f2c also should we include this?

— Reply to this email directly, view it on GitHub https://github.com/openpvrsgx-devgroup/linux_openpvrsgx/issues/16#issuecomment-2453302168, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHOUPNS5Y37B4OATIUBKVTZ6WXM5AVCNFSM6AAAAABQTB4S2CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJTGMYDEMJWHA. You are receiving this because you commented.

That are the user space libraries which are beyond the scope of this project.

But yes, they should be considered rather than your beowulf or my zeus branch.

goldelico commented 3 weeks ago

Am 02.11.2024 um 20:58 schrieb Mighty @.***>:

I suppose 6425bce#diff-4033cce15705ec9d3bce6ef544bd849d523a59a2df568e75c1569b0b04fcee4dR530 https://github.com/openpvrsgx-devgroup/linux_openpvrsgx/commit/6425bce0d19e70f17da8eea7ec811d002d5b6db4#diff-4033cce15705ec9d3bce6ef544bd849d523a59a2df568e75c1569b0b04fcee4dR530 is a start? But you know better

— Reply to this email directly, view it on GitHub https://github.com/openpvrsgx-devgroup/linux_openpvrsgx/issues/16#issuecomment-2453111494, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHOUPJGIZCMICB2WVTBOF3Z6UVHFAVCNFSM6AAAAABQTB4S2CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJTGEYTCNBZGQ. You are receiving this because you commented.

At least I could test 6.8, 6.10, 6.11 and they all report:

@.:~# uname -a Linux letux 6.11.5-letux+ #91 SMP PREEMPT Sun Nov 3 10:48:22 CET 2024 armv7l GNU/Linux @.:~# cat /proc/pvr/version Version SGX_DDK sgxddk @. (release) omap_sgx System Version String: None @.:~# pvrsrvctl --no-module --start [ 714.911254] PVR_K: UM DDK-(4948957) and KM DDK-(4948957) match. [ OK ] @.:~# cat /proc/pvr/version
Version SGX_DDK sgxddk
@. (release) omap_sgx System Version String: SGX revision = 125 @.***:~#

So at least we now know for sure that the transision from 6.11 to 6.12 has damaged something.

MightyM17 commented 3 weeks ago

For vmalloc_node_range caller you could blacklist the pvrsrvkm in some /etc/modprobe/test.conf, then boot. And then run modprobe to load the pvrsrvkm.so http://pvrsrvkm.so/. If the message appears then, it is called by our driver.

Yes indeed that is the case, if i modprobe -r to stop it and start it again, this error appears again. So that is a lead we can track down. Also the error you've faced seems to be different than what I am facing, I will try building 6.11 and below to verify as well.

That are the user space libraries which are beyond the scope of this project.

But yes, they should be considered rather than your beowulf or my zeus branch.

Since they have such a recent update I wondered it may help you as the branch says for glibc, im on musl and the older blobs were working fine so I guess its the kernel having some changes

MightyM17 commented 3 weeks ago

Yes, I can indeed confirm that 6.8, 6.10, 6.11 all work without issues, it is the transition to 6.12 that is breaking things :(

goldelico commented 3 weeks ago

I suppose 6425bce#diff-4033cce15705ec9d3bce6ef544bd849d523a59a2df568e75c1569b0b04fcee4dR530 is a start? But you know better

Well, this is was a patch for 6.11 and there it still works. And it removes an already dead #if 0 and adds a modification for 6.11 (and later).

Indeed this could have changed again for 6.12 since we use a deprecated call (no longer officially exported but by our "revert":

https://git.goldelico.com/?p=letux-kernel.git;a=blobdiff;f=mm/vmalloc.c;h=60f4e33265afc0a11d84664416ede6ea531eec13;hp=f41b54ecdf132c7fb55d6819e7fe7aa726f6c4fe;hb=5bc47f1159665af40c7c96efb229df7c996349e7;hpb=ed96388bb577868d03dda1ae17f7456bb4bcee34 <https://git.goldelico.com/?p=letux-kernel.git;a=blobdiff;f=mm/vmalloc.c;h=60f4e33265afc0a11d84664416ede6ea531eec13;hp=f41b54ecdf132c7fb55d6819e7fe7aa726f6c4fe;hb=5bc47f1159665af40c7c96efb229df7c996349e7;hpb=ed96388bb577868d03dda1ae17f7456bb4bcee34>

And, there are some changes to this upstream file:

git log --oneline v6.11..v6.12-rc1 mm/vmalloc.c

So this may be a reason for your vmalloc issue, even if the main change seems to replace (va->va_end - va->va_start) by va_size(va) and introduce vrealloc_noprof() which we do not use.

There is only one new comment referring to __vmalloc_node_range_noprof():

https://elixir.bootlin.com/linux/v6.12-rc6/source/mm/vmalloc.c#L3643

For my failed overall initialization, I have also checked the diffs between 6.11 and 6.12 and only found this:

https://git.goldelico.com/?p=letux-kernel.git;a=blobdiff;f=drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/osfunc.c;h=0da9de7c46969fbd9183bc3ddb3c6aa0df6c4ff2;hp=d86ece9894f28b5aafe1e2242d9656c3781a3c6e;hb=1f267ee25fe451742654ceecdd67bed948a13317;hpb=6425bce0d19e70f17da8eea7ec811d002d5b6db4 <https://git.goldelico.com/?p=letux-kernel.git;a=blobdiff;f=drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/osfunc.c;h=0da9de7c46969fbd9183bc3ddb3c6aa0df6c4ff2;hp=d86ece9894f28b5aafe1e2242d9656c3781a3c6e;hb=1f267ee25fe451742654ceecdd67bed948a13317;hpb=6425bce0d19e70f17da8eea7ec811d002d5b6db4>

But it is not even called...

Next, I have compared "strace pvrsrvctl --no-module --start" on 6.11 and 6.12 and the main difference seems to be:

6.12: openat(AT_FDCWD, "/dev/dri/renderD129", O_RDWR|O_LARGEFILE|O_CLOEXEC) = 3 ioctl(3, DRM_IOCTL_VERSION, 0x4d32e8) = 0 ioctl(3, DRM_IOCTL_VERSION, 0x4d32e8) = 0 fstat64(3, {st_mode=S_IFCHR|0660, st_rdev=makedev(0xe2, 0x81), ...}) = 0 fstat64(3, {st_mode=S_IFCHR|0660, st_rdev=makedev(0xe2, 0x81), ...}) = 0 close(3) = 0

6.11: openat(AT_FDCWD, "/dev/dri/renderD128", O_RDWR|O_LARGEFILE|O_CLOEXEC) = 3 ioctl(3, DRM_IOCTL_VERSION, 0x4a32e8) = 0 ioctl(3, DRM_IOCTL_VERSION, 0x4a32e8) = 0 ioctl(3, DRM_IOCTL_I810_FLUSH or DRM_IOCTL_MGA_SWAP or DRM_IOCTL_R128_CCE_RESET or DRM_IOCTL_RADEON_CP_RESET, 0) = -1 EACCES (Permission denied) fcntl64(3, F_SETFD, FD_CLOEXEC) = 0 ioctl(3, _IOC(_IOC_WRITE, 0x64, 0x40, 0x1c), 0xbe84d88c) = 0 getpid() = 3352 ioctl(3, _IOC(_IOC_WRITE, 0x64, 0x40, 0x1c), 0xbe84d8d4) = 0 ioctl(3, _IOC(_IOC_WRITE, 0x64, 0x40, 0x1c), 0xbe84d8d4) = 0 ioctl(3, _IOC(_IOC_WRITE, 0x64, 0x40, 0x1c), 0xbe84d81c) = 0 ioctl(3, _IOC(_IOC_WRITE, 0x64, 0x40, 0x1c), 0xbe84d82c) = 0 ioctl(3, _IOC(_IOC_WRITE, 0x64, 0x40, 0x1c), 0xbe84d534) = 0 openat(AT_FDCWD, "/etc/powervr.ini", O_RDONLY) = 4

Which means that the /dev/dri isn't fully recognised as the pvrsgx for firmware download. So the second

ioctl(3, DRM_IOCTL_VERSION, 0x4d32e8)   = 0

appears to fail and the third isn't even tried. This makes some /dev/dri* search loop continue until no pvrsgx is found.

All this may boil down to something changed in DRM ioctl processing outside of our code.

In summary we have two different issues with 6.12: a) your vmalloc issue b) my (and potentially your) pvrsrvctl init issue

goldelico commented 3 weeks ago

[ 19.934631] vmalloc_node_range for size 33558528 failed: Address range restricted to 0xf6000000 - 0xff800000

So let's focus on this first.

I now have added:

diff --git a/drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/mm.c b/drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/mm.c index 496b04e00cbdf..9eef9fab990f1 100644 --- a/drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/mm.c +++ b/drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/mm.c @@ -525,8 +525,12 @@ static void *__old_vmalloc_node(unsigned long size, unsigned long align, gfp_mask, prot, 0, node, caller);

else

/ we need to add EXPORT_SYMBOL(__vmalloc_node_range_noprof); to vmalloc.c /

This leads to no errors but:

@.:~# dmesg|fgrep vmalloc [ 27.496368] old_vmalloc_node: size=8192 align=1 start=f0000000 end=ff800000 mask=3266 prot=591 node=-1 caller=bf421ea8 [ 27.513458] old_vmalloc_node: ret=f01ef000 [ 27.528320] old_vmalloc_node: size=4096 align=1 start=f0000000 end=ff800000 mask=3266 prot=583 node=-1 caller=bf41f8f0 [ 27.614379] old_vmalloc_node: ret=f01f2000 [ 27.653503] old_vmalloc_node: size=12288 align=1 start=f0000000 end=ff800000 mask=3266 prot=583 node=-1 caller=bf41f8f0 [ 27.709259] old_vmalloc_node: ret=f01ff000 @.:~#

So on my system it looks good. Note, this is during boot, and before running pvrsrvctl.

Please can you modify your code like above and boot and check for vmalloc messages?

This should confirm that the size is 33558528 (0x02001000). Then we can analyse where this comes from...

goldelico commented 3 weeks ago

@.:~# dmesg|fgrep vmalloc [ 27.496368] old_vmalloc_node: size=8192 align=1 start=f0000000 end=ff800000 mask=3266 prot=591 node=-1 caller=bf421ea8 [ 27.513458] old_vmalloc_node: ret=f01ef000 [ 27.528320] old_vmalloc_node: size=4096 align=1 start=f0000000 end=ff800000 mask=3266 prot=583 node=-1 caller=bf41f8f0 [ 27.614379] old_vmalloc_node: ret=f01f2000 [ 27.653503] old_vmalloc_node: size=12288 align=1 start=f0000000 end=ff800000 mask=3266 prot=583 node=-1 caller=bf41f8f0 [ 27.709259] old_vmalloc_node: ret=f01ff000 @.:~#

After some more tests I found that on 6.12 I get three calls to __old_vmalloc_node while on 6.11 there are four.

It turns out that I get a WARNING instead of the fourth call.

[ 46.903564] WARNING: CPU: 0 PID: 3202 at drivers/gpu/drm/drm_file.c:312 drm_open_helper+0x7c/0x148 [drm]

this is from

https://elixir.bootlin.com/linux/v6.12-rc6/source/drivers/gpu/drm/drm_file.c#L312

Commit 641bb4394f405c moved/added a new FOP_UNSIGNED_OFFSET which must now be set in drm_gem_object for drm_open_helper() to succeed.

Most likely the pvrsgx driver isn't aware of this, does not set FOP_UNSIGNED_OFFSET and therefore the test issues a WARN and aborts instead of doing a fourth __old_vmalloc_node.

Key will be to find this in drivers/gpu/drm/pvrsgx/1.17.4948957/ (and potentially in other DDK releases).

MightyM17 commented 3 weeks ago

That is quite the research, Im glad you were able to get more leads in finding it! :D

Key will be to find this in drivers/gpu/drm/pvrsgx/1.17.4948957/ (and potentially in other DDK releases).

Looking at the commit previously mentioned, I'd assume adding it https://github.com/openpvrsgx-devgroup/linux_openpvrsgx/blob/pvrsrvkm-6.12-rc5/drivers/gpu/drm/pvrsgx/pvr-drv.c will be the method to fix it. We might not need to add it to all DDK releases individually?

Please can you modify your code like above and boot and check for vmalloc messages?

Yes I will along with the FMODE_UNSIGNED_OFFSET commit, and lets see how it goes from there. I'd assume I will hit the same error as the one you have been facing (pvrsrvctl init issue)

MightyM17 commented 3 weeks ago
diff --git a/drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/pvr_drm.c b/drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/pvr_drm.c
index f479f89a3..de232f55f 100644
--- a/drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/pvr_drm.c
+++ b/drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/pvr_drm.c
@@ -539,6 +539,7 @@ static const struct file_operations sPVRFileOps =
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0))
        .fasync = drm_fasync,
 #endif
+       .fop_flags = FOP_UNSIGNED_OFFSET,
 };
 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) */

diff --git a/drivers/gpu/drm/pvrsgx/pvr-drv.c b/drivers/gpu/drm/pvrsgx/pvr-drv.c
index e56938d08..b13a6c75b 100644
--- a/drivers/gpu/drm/pvrsgx/pvr-drv.c
+++ b/drivers/gpu/drm/pvrsgx/pvr-drv.c
@@ -192,6 +192,7 @@ static const struct file_operations pvr_fops = {
        .poll = drm_poll,
        .read = drm_read,
        .llseek = noop_llseek,
+       .fop_flags = FOP_UNSIGNED_OFFSET,
 };

 static struct drm_driver pvr_drm_driver = {

This has made the driver work! Not sure if I need it in the ddk files as well, will do a build without that and give it a go.

Here are more logs that may interest you - dmesg - https://pastebin.com/rAEBSajj pvrsrvctl -

 samsung-espresso7:~$ pvrsrvctl --no-module --start
Segmentation fault

kmscube -

samsung-espresso7:~$ kmscube
Using display 0xb635c0a0 with EGL version 1.4
===================================
EGL information:
  version: "1.4"
  vendor: "Mesa Project (Amber)"
  client extensions: "EGL_EXT_device_base EGL_EXT_device_enumeration EGL_EXT_device_query EGL_EXT_platform_base EGL_KHR_client_get_all_proc_addresses EGL_EXT_client_extensions EGL_KHR_debug EGL_EXT_platform_device EGL_EXT_platform_wayland EGL_KHR_platform_wayland EGL_EXT_platform_x11 EGL_KHR_platform_x11 EGL_MESA_platform_xcb EGL_MESA_platform_gbm EGL_KHR_platform_gbm EGL_MESA_platform_surfaceless"
  display extensions: "EGL_EXT_buffer_age EGL_EXT_create_context_robustness EGL_EXT_image_dma_buf_import EGL_EXT_image_dma_buf_import_modifiers EGL_KHR_config_attribs EGL_KHR_create_context EGL_KHR_fence_sync EGL_KHR_get_all_proc_addresses EGL_KHR_gl_renderbuffer_image EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_image EGL_KHR_image_base EGL_KHR_image_pixmap EGL_KHR_no_config_context EGL_KHR_reusable_sync EGL_KHR_surfaceless_context EGL_EXT_pixel_format_float EGL_KHR_wait_sync EGL_MESA_configless_context EGL_MESA_drm_image EGL_MESA_image_dma_buf_export EGL_WL_bind_wayland_display "
===================================
OpenGL ES 2.x information:
  version: "OpenGL ES 2.0 build 1.17@4948957"
  shading language version: "OpenGL ES GLSL ES 1.00 build 1.17@4948957"
  vendor: "Imagination Technologies"
  renderer: "PowerVR SGX 540"
  extensions: "GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth24 GL_OES_depth_texture GL_OES_egl_sync GL_OES_element_index_uint GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_fbo_render_mipmap GL_OES_fragment_precision_high GL_OES_get_program_binary GL_OES_mapbuffer GL_OES_packed_depth_stencil GL_OES_required_internalformat GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_surfaceless_context GL_OES_texture_float GL_OES_texture_half_float GL_OES_vertex_array_object GL_OES_vertex_half_float GL_EXT_blend_minmax GL_EXT_discard_framebuffer GL_EXT_multi_draw_arrays GL_EXT_multisampled_render_to_texture GL_EXT_shader_texture_lod GL_EXT_texture_format_BGRA8888 GL_EXT_texture_rg GL_IMG_multisampled_render_to_texture GL_IMG_program_binary GL_IMG_read_format GL_IMG_shader_binary GL_IMG_texture_compression_pvrtc GL_IMG_texture_format_BGRA8888 GL_IMG_texture_npot GL_IMG_uniform_buffer_object GL_KHR_debug GL_EXT_texture_storage"
===================================
Rendered 121 frames in 2.016036 sec (60.018775 fps)
MightyM17 commented 3 weeks ago
diff --git a/drivers/gpu/drm/pvrsgx/pvr-drv.c b/drivers/gpu/drm/pvrsgx/pvr-drv.c
index e56938d08..b13a6c75b 100644
--- a/drivers/gpu/drm/pvrsgx/pvr-drv.c
+++ b/drivers/gpu/drm/pvrsgx/pvr-drv.c
@@ -192,6 +192,7 @@ static const struct file_operations pvr_fops = {
        .poll = drm_poll,
        .read = drm_read,
        .llseek = noop_llseek,
+       .fop_flags = FOP_UNSIGNED_OFFSET,
 };

 static struct drm_driver pvr_drm_driver = {

This is enough to get the GPU working again for me! Phew, we dont need to modify all DDK files

goldelico commented 3 weeks ago

Am 05.11.2024 um 07:13 schrieb Mighty @.***>:

diff --git a/drivers/gpu/drm/pvrsgx/pvr-drv.c b/drivers/gpu/drm/pvrsgx/pvr-drv.c index e56938d08..b13a6c75b 100644 --- a/drivers/gpu/drm/pvrsgx/pvr-drv.c +++ b/drivers/gpu/drm/pvrsgx/pvr-drv.c @@ -192,6 +192,7 @@ static const struct file_operations pvr_fops = { .poll = drm_poll, .read = drm_read, .llseek = noop_llseek,

  • .fop_flags = FOP_UNSIGNED_OFFSET, };

    static struct drm_driver pvr_drm_driver = { This is enough to get the GPU working again for me! Phew, we dont need to modify all DDK files

Great! I had expected something like this simple..

I'll test on my setup asap.

We may need some version condition since FOP_UNSIGNED_OFFSET doesn't exist for ages, but that is fine-tuning.

goldelico commented 3 weeks ago

Word for me as well.

FOP_UNSIGNED_OFFSET is indeed a completely new feature of v6.12. But we need no version-condition since this pvr-drv is always for the current linux master.

So I have added a patch to my local version and will push soon.

Thanks for report, support and help to fix this.