[Letux-kernel] sgx on pyra with newer kernels
H. Nikolaus Schaller
hns at goldelico.com
Sat Jul 31 09:10:15 CEST 2021
Hi,
thanks for finding the "good" and "bad" points, so that I could restrict
to look in between.
Finally I could invest some time for this task and was able to exactly imitate your
bug report (had to install a Stretch image first; Jessie or Bullseye doesn't like my
DDK 1.14 setup and 1.17 requires libc6 >= 2.29 which is only available in Bullseye
but also libffi.so.6 which is no longer available on Bullseye - what a pity that we can
not build our own user-space packages).
There is already a partial fix in the tree, but with a functional change which
remained unnoticed.
The solution is a real hack since the driver wants to do something kernel developers
have decided that a driver should not (or no longer) do. I have no idea why the sgx
driver needs it done the way it is done and what it is good for, but simply ignoring
this difference ends up in the timeout.
The hack is to expose some lower level kernel API (which is normally hidden) to
driver modules and provide the old API which has been changed.
A real solution would be to rewrite bigger portions of the sgx driver to only use
modern and available API but I have not yet an idea how to do that. Would need
a lot of more time to find out...
So let's stick with my hackish solution until we run into problems with it. I can
now load the firmware without timeout reports on letux-5.10.y or letux-5.14-rc3
root at letux:~# cat /proc/pvr/version
Version SGX_DDK sgxddk MAIN at 3699939 (release) omap_sgx
System Version String: None
root at letux:~# pvrsrvctl --start --no-module
[ 34.843991] PVR_K: UM DDK-(3699939) and KM DDK-(3699939) match. [ OK ]
root at letux:~# cat /proc/pvr/version
Version SGX_DDK sgxddk MAIN at 3699939 (release) omap_sgx
System Version String: SGX revision = 116
root at letux:~# uname -a
Linux letux 5.10.54-letux-lpae+ #6422 SMP PREEMPT Fri Jul 30 16:29:28 CEST 2021 armv7l GNU/Linux
root at letux:~#
or
root at letux:~# uname -a
Linux letux 5.14.0-rc3-letux-lpae+ #6423 SMP PREEMPT Fri Jul 30 17:28:43 CEST 2021 armv7l GNU/Linux
root at letux:~# cat /proc/pvr/version
Version SGX_DDK sgxddk MAIN at 3699939 (release) omap_sgx
System Version String: None
root at letux:~# pvrsrvctl --start --no-module
[ 411.958986] PVR_K: UM DDK-(3699939) and KM DDK-(3699939) match. [ OK ]
root at letux:~# cat /proc/pvr/version
Version SGX_DDK sgxddk MAIN at 3699939 (release) omap_sgx
System Version String: SGX revision = 116
root at letux:~#
My suggestion would be to think about moving PyraOS to letux-5.10.y because it
is a long-term-supported kernel (v5.12 is already EOL like v5.6).
The fix will become part of the next update cycle beginning of next week.
BR,
Nikolaus
> Am 02.06.2021 um 02:09 schrieb aTc <atc at k-n-p.org>:
>
> letux-5.7.y (5.7.19) still has a working pvr driver too, only thing there was that it was configured to build the wrong version that didn't match the userspace version.
>
>
> with 5.8.0-rc1 the pvr driver doesn't compile anymore, this seems to be the same as the one in 5.7.
>
>
> drivers/gpu/drm/pvrsgx/1.14.3699939/eurasia_km/services4/srvkm/env/linux/mm.c: In function '_VMallocWrapper':
> drivers/gpu/drm/pvrsgx/1.14.3699939/eurasia_km/services4/srvkm/env/linux/mm.c:512:13: error: too many arguments to function '__vmalloc'
> pvRet = __vmalloc(uiBytes, gfp_mask, PGProtFlags);
> ^~~~~~~~~
> In file included from drivers/gpu/drm/pvrsgx/1.14.3699939/eurasia_km/services4/srvkm/env/linux/mm.c:59:
> ./include/linux/vmalloc.h:112:14: note: declared here
> extern void *__vmalloc(unsigned long size, gfp_t gfp_mask);
>
>
> ( copying 5.7 pvr driver over 5.8.y gives the same error)
>
> It is then "fixed" in 5.8.0-rc3, where it compiles again, but doesn't work anymore, with the same "[ 16.012345] PVR_K: (Error) : PollForValueKM: Timeout. Expected 0x1 but found 0x0 (mask 0x1)." error as below.
>
>
>
>
>
>
> On 5/18/21 10:45 PM, aTc wrote:
>> I dug around in the pvr stuff a bit, I noticed that the newer kernels compile driver version 1.17.4948957 , and the old kernels with working sgx were all 1.14.3699939.
>> Unfortunately just changing the module version to compile didn't work., neither did using the 1.17 userspace with the 1.17 module.
>> using 1.17 module with 1.17 userspace just gives a "PVRSRVDetectPlaform: Unknown platform: OMAP5432"
>> using 1.14 module with 1.14 userspace does this :
>> all on kernel 5.12.4-letux-lpae
>> [ 87.993806] PVR_K: UM DDK-(3699939) and KM DDK-(3699939) match. [ OK ]
>> [ 89.009935] PVR_K:(Error): PollForValueKM: Timeout. Expected 0x1 but found 0x0 (mask 0x1).
>> [ 89.018938] PVR_K:(Error): SGXInitialise: Wait for uKernel initialisation failed
>> [ 89.027371] PVR_K: SGX debug (SGX_DDK sgxddk MAIN at 3699939)
>> [ 89.033566] PVR_K: Host Ctl flags= 0000000c
>> [ 89.038083] PVR_K: SGX Host control:
>> [ 89.042386] PVR_K: (HC-0) 0x00000000 0x00000000 0x00000000 0x00000000
>> [ 89.049283] PVR_K: (HC-10) 0x00000000 0x0000000A 0x0004A666 0x00000003
>> [ 89.056761] PVR_K: (HC-20) 0x00000000 0x00000000 0x00000000 0x00000000
>> [ 89.064114] PVR_K: (HC-30) 0x00000000 0xF3586810 0x00000000 0x00000000
>> [ 89.071459] PVR_K: (HC-40) 0x00000000 0x00000000 0x00000000 0x00000000
>> [ 89.078610] PVR_K: (HC-50) 0x00000000 0x00000000 0x00000000 0x00000000
>> [ 89.086068] PVR_K: (HC-60) 0x00000000 0x00000000 0x00000000 0x00000000
>> [ 89.093381] PVR_K: (HC-70) 0x00000000 0x00000000 0x00000000 0x00000000
>> [ 89.100357] PVR_K: (HC-80) 0x00000000 0x00000000 0x00000000 0x00000001
>> [ 89.107732] PVR_K: SGX TA/3D control:
>> [ 89.111923] PVR_K: (T3C-0) 0xF4003000 0xF40031A0 0xF4002000 0x00000000
>> [ 89.118977] PVR_K: (T3C-10) 0x00000000 0x00000002 0x00000000 0x00000000
>> [ 89.126492] PVR_K: (T3C-20) 0x00000000 0x00000000 0x00000000 0x00000000
>> [ 89.133908] PVR_K: (T3C-30) 0x00000000 0x00000000 0x00000000 0x00000000
>> [ 89.141394] PVR_K: (T3C-40) 0x00000000 0x00000000 0x00000000 0x00000000
>> [ 89.148465] PVR_K: (T3C-50) 0x00000000 0x00000000 0x00000000 0x00000000
>> [ 89.156071] PVR_K: (T3C-60) 0x00000000 0x00000000 0x00000000 0x00000000
>> [ 89.163499] PVR_K: (T3C-70) 0x00000000 0x00000000 0x00000000 0x00000000
>> [ 89.170621] PVR_K: (T3C-80) 0x00000000 0x00000000 0x00000000 0x00000000
>> [ 89.178433] PVR_K: (T3C-90) 0x00000000 0x00000000 0x00000000 0x00000000
>> [ 89.185834] PVR_K: (T3C-A0) 0x00000000 0x00000000 0x00000000 0x00000000
>> [ 89.193244] PVR_K: (T3C-B0) 0x00000000 0xF4000000 0x8F5ED000 0x00000000
>> [ 89.200528] PVR_K: (T3C-C0) 0x00000000 0x00000000 0x00000000 0x00000000
>> [ 89.207874] PVR_K: (T3C-D0) 0x00000000 0x00000000 0x00000000 0x00000000
>> [ 89.215170] PVR_K: (T3C-E0) 0x00000000 0x00000000 0x00000000 0x00000000
>> [ 89.222775] PVR_K: (T3C-F0) 0x00000000 0x00000000 0x00000000 0x00000000
>> [ 89.230038] PVR_K: (T3C-100) 0x00000000 0x00000000 0x00000000 0x00000000
>> [ 89.237603] PVR_K: (T3C-110) 0x00000000 0x00000000 0x00000000 0x00000000
>> [ 89.245132] PVR_K: (T3C-120) 0x00000000 0x00000000 0x00000000 0x00000000
>> [ 89.252633] PVR_K: (T3C-130) 0xF2016010 0xF2016014 0xF2016034 0xF2016030
>> [ 89.259793] PVR_K: (T3C-140) 0xF4004000 0xF400F820 0xF4002020 0x00000000
>> [ 89.267392] PVR_K: (T3C-150) 0x00000000 0x00000000 0x00000000 0x00000000
>> [ 89.274936] PVR_K: (T3C-160) 0x00000000 0x00000000 0x00000000 0x00000000
>> [ 89.282687] PVR_K: (T3C-170) 0x00000000 0x00000000 0x00000000 0x00000000
>> [ 89.289914] PVR_K: (T3C-180) 0x00000000 0x00000000 0x00000000 0x00000000
>> [ 89.297604] PVR_K: (T3C-190) 0x00000000 0x00000000 0x00000000 0x00000000
>> [ 89.305051] PVR_K: SGX Kernel CCB WO:0x0 RO:0x0
>> [ 89.309827] PVR_K: Active syncs
>> [ 89.313504] PVR_K:(Error): SGXPostPowerState: SGXInitialise failed
>> [ 89.320023] PVR_K:(Error): PVRSRVSetDevicePowerStateKM : Transition to 0 FAILED 0x18
>> [ 89.328763] PVR_K:(Error): SGXScheduleCCBCommandKM failed to power up device - ui32CallerID:-1 eError:24
>> [ 89.338925] PVR_K:(Error): SGXGetMiscInfoUkernel: SGXScheduleCCBCommandKM failed.
>> [ 89.347317] PVR_K: (FAIL) SGXInit: Unable to validate hardware core revision
>> [ 89.355098] PVR_K:(Error): PVRSRVFinaliseSystem: Failed PVRSRVDevInitCompatCheck call (device index: 0)
>> [ 89.365654] PVR_K:(Error): BridgedDispatchKM: Initialisation failed. Driver unusable.
>> PVR:(Error): PVRSRVInitSrvDisconnect: KM returned 24 [0, ]
>> PVR:(Error): PVRSRVBridgeCall: Failed to access device. Function ID:3223086862 (strerror returns no value.). [0, ]
>> PVR:(Error): SrvInit: PVRSRVInitSrvDisconnect failed (24). See srvkm log for details. [0, ]
>> ./pvrsrvctl: SrvInit failed (already initialized?) (err=PVRSRV_ERROR_RETRY)
>> _______________________________________________
>> Kernel mailing list
>> Kernel at pyra-handheld.com
>> http://pyra-handheld.com/cgi-bin/mailman/listinfo/kernel
>
> _______________________________________________
> Kernel mailing list
> Kernel at pyra-handheld.com
> http://pyra-handheld.com/cgi-bin/mailman/listinfo/kernel
More information about the Letux-kernel
mailing list