[Openpvrsgx-devgroup] [PATCH 1/2] drm: pvrsgx: pvr-drv: Fix OCP handling with ioremap and reg access

H. Nikolaus Schaller hns at goldelico.com
Sat Oct 23 13:09:27 CEST 2021

Hi Tony,

> Am 23.10.2021 um 12:12 schrieb Tony Lindgren <tony at atomide.com>:
> The OCP registers need to be configured for SGX on some omap variants
> to route the SGX interrupt. However, this must not be done on omap34xx
> as the OCP registers are not readable and reads will hang the system.
> We currently have pvr-drv hang on omap3430 devices like n900 because of
> trying read the OCP registers.
> We need to a combination of suitable ifdefs for each SoC for the OCP
> regs, but that's not a nice solution. Let's just start getting rid of
> the OCP related ifdefs and configure the OCP directly in the pvr-drv as
> needed. We just need to reconfigure the OCP registers in the runtime PM
> functions for now.
> Note that this still leaves SysClearInterrupts() doing a write to ack the
> OCP interrupt. However looks like the write won't do anything on omap34xx
> so we can leave it for now and remove it later when adding support for
> interrupt handling to pvr-drv.
> Also sgx_jz4780 also configures OCP regs, but I suspect that code never
> was enabled and was copied from earlier TI specific code. If sgx_jz4780
> really uses the OCP regs, it needs at least the ocp_base configured.
> Let's also add pvr_sgx_readl() and pvr_sgx_writel() while at it to make
> it easy to rewrite further features and make it clear that the OCP
> register area is SoC specific and separate from the SGX registers.
> Reported-by: Ivaylo Dimitrov <ivo.g.dimitrov.75 at gmail.com>
> Signed-off-by: Tony Lindgren <tony at atomide.com>

looks good to me. Unfortunately I can't test the 1.17 setup any more.

It looks as if the 1.17 user space code needs a libc version which
only became available in Debian Bullseye but some other requirement
needs something older that is no longer available in 11.1. So my SD
card for the Pyra got broken after an apt-get upgrade. And I would have
to look for backports or compiling older versions from source.

jz4780 was never tested. As you assume, it is just code available from
the TI DDK tree - in the hope that we can make it run some day on the
jz4780. This was also blocked by not having a working HDMI output on
the CI20 creator board. But now we have something which is close to
find acceptance upstream (but slowly).

What we are lacking anyways is proper user-space code for MIPS. There
is something for some 1.14 DDK (different patch level from omap3) but
not for 1.17.

Long ago I had started to set up qemu-system-arm on the jz4780
so that we can at least run pvrsrvctl --start from the TI UM code
and see if the driver finds, downloads firmware and initializes
something but that idea was never completed.

> ---
> .../services4/system/omap/sysconfig.c         | 66 ------------------
> .../services4/system/omap/syslocal.h          |  8 ---
> .../services4/system/omap/sysutils_linux.c    |  4 --
> .../services4/system/sgx_jz4780/sysconfig.c   | 42 ------------
> .../services4/system/sgx_jz4780/syslocal.h    |  8 ---
> .../services4/system/sgx_jz4780/sysutils.c    |  4 --
> drivers/gpu/drm/pvrsgx/pvr-drv.c              | 68 +++++++++++++++++--
> drivers/gpu/drm/pvrsgx/pvr-drv.h              | 29 ++++++++

I have splitted this into two commits since I run separate branches
for the generic part and the DDK specific variants. That makes it
easier to add new DDK source tree variants when we find them
(I think our code-archaeology didn't find anything new in the past
two years but we didn't do many excavations :)

> 8 files changed, 91 insertions(+), 138 deletions(-)
> diff --git a/drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/omap/sysconfig.c b/drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/omap/sysconfig.c
> --- a/drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/omap/sysconfig.c
> +++ b/drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/system/omap/sysconfig.c
> @@ -79,31 +79,14 @@ IMG_UINT32 PVRSRV_BridgeDispatchKM(IMG_UINT32	Ioctl,
> 								   IMG_UINT32	*pdwBytesTransferred);
> #if defined(SGX_OCP_REGS_ENABLED)
> -
> static IMG_CPU_VIRTADDR gpvOCPRegsLinAddr;
> -
> -static PVRSRV_ERROR EnableSGXClocksWrap(SYS_DATA *psSysData)
> -{
> -	PVRSRV_ERROR eError = EnableSGXClocks(psSysData);


BR and thanks,

More information about the openpvrsgx-devgroup mailing list