[Openpvrsgx-devgroup] Reverse engineering SGX 540 userspace driver

H. Nikolaus Schaller hns at goldelico.com
Thu Nov 11 08:50:23 CET 2021

Hi Lukas,

> Am 10.11.2021 um 02:51 schrieb Lucas Fryzek <lucas.fryzek at hazeco.xyz>:
> (Re-sending as I forgot to reply-all to the whole mailing list)
> Thanks for the quick response Nikolaus!
>> a) OpenPVRSGX tries to include a DDK 1.14 or DDK 1.17 kernel driver - there is one version compatible to the jz4780
>>   It explicitly excludes reverse engineering and focusses on kernel driver (which always was open source)
>>   Home page: https://github.com/openpvrsgx-devgroup/linux_openpvrsgx
>>   Mailing list: https://lists.goldelico.com/pipermail/openpvrsgx-devgroup
>>   https://github.com/openpvrsgx-devgroup/linux_openpvrsgx/wiki/DDK-versions
> Given that groups goal is to focus on the already open source kernel driver, do you know if anyone in this group would have been involved in any reverse engineering efforts?
>> b) LetuxOS works on making the CI20 basics useable (currently we try to upstream the HDMI driver)
>>   The status is that we can compile the kernel driver in different DDK releases but have no matching
>>   user-space code to test anything.
>>   I thought about using the mipsel version of qemu-arm-static to run the arm pvrsrvctl tool to
>>   at least download firmware but did not find time to really try it.
> Does the this updated kernel mode driver work with the latest userspace DDK from imgtec (1.14.3759903)?

It *could* work but was never tested. We have the matching DDK release version in the tree. Just choose CONFIG_PVRSGX_1_14_3759903=y
It may be that the branch is missing some fixes that have been applied to the versions CONFIG_PVRSGX_1_14_3699939 and CONFIG_PVRSGX_1_17_4948957 which are more or less well running on OMAP3/4/5.

Do you have the user space for 1.14.3759903? I am not sure but it may be stored in the factory flash image.

> I'm trying to get a setup right now where I can compile a kernel mode driver and make modifications to get a better idea on how the GPU is being controlled. If I can use a more modern kernel and linux userland that would be very nice.

Just get the letux tree: https://github.com/goldelico/letux-kernel/tree/letux-5.15

It includes everything incl. HDMI driver for the CI20 (use letux_defconfig) and compiles the SGX driver that is configured. But the default is CONFIG_PVRSGX_1_17_4948957=y so there may be surprises when switching to CONFIG_PVRSGX_1_14_3759903 we can discuss how to fix.

>> c) there is a n900 originated project to improve user-space code
>>   and if I understand correctly they have build a compatible user-space
>>   https://lists.goldelico.com/pipermail/openpvrsgx-devgroup/2021-October/000472.html
>>   https://github.com/freemangordon/mesa/tree/mesa-pvr-ti
> Thanks for that mailing list link! I'll try reaching out Ivaylo on that mailing list and see what exactly the nature of their work is. If I understand their email correctly it seems like they already managed to get a RE ES2 driver working.
>> d) next, there was an FSF supported project with a collection of information but the original server has been lost
>>   https://www.phoronix.com/scan.php?page=news_item&px=MTE0MDc
>>   http://powervr.gnu.org.ve - Unfortunately the wayback machine has only archived 302 errors
>>   Maybe there exists some other archive.
>>   Back then there was material about partially RE instruction set etc.
> I took a look at wayback machine and I found a version of the project properly recorded, and I found the following links.
> https://web.archive.org/web/20130225101912/http://powervr.gnu.org.ve/doku.php?id=opcodes
> https://web.archive.org/web/20151004182955/http://powervr.gnu.org.ve/doku.php?id=instructionencoding
> http://lkcl.net/powervr/sgx/

Ah Luke has had materials. I forgot about.


More information about the openpvrsgx-devgroup mailing list