diff mbox series

[RFC,v2,04/11] ARM: dts: omap4: Add device tree entry for SGX GPU

Message ID 20240108183302.255055-5-afd@ti.com (mailing list archive)
State Superseded
Headers show
Series Device tree support for Imagination Series5 GPU | expand

Commit Message

Andrew Davis Jan. 8, 2024, 6:32 p.m. UTC
Add SGX GPU device entry to base OMAP4 dtsi file.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 arch/arm/boot/dts/ti/omap/omap4.dtsi | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Javier Martinez Canillas Jan. 9, 2024, 8:17 a.m. UTC | #1
Andrew Davis <afd@ti.com> writes:

> Add SGX GPU device entry to base OMAP4 dtsi file.
>
> Signed-off-by: Andrew Davis <afd@ti.com>
> ---

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
H. Nikolaus Schaller Jan. 12, 2024, 5:33 p.m. UTC | #2
Hi,
I just comment on this example, but it applies almost the same for all other .dtsi changes.

> Am 08.01.2024 um 19:32 schrieb Andrew Davis <afd@ti.com>:
> 
> Add SGX GPU device entry to base OMAP4 dtsi file.
> 
> Signed-off-by: Andrew Davis <afd@ti.com>
> ---
> arch/arm/boot/dts/ti/omap/omap4.dtsi | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/ti/omap/omap4.dtsi b/arch/arm/boot/dts/ti/omap/omap4.dtsi
> index 2bbff9032be3e..559b2bfe4ca7c 100644
> --- a/arch/arm/boot/dts/ti/omap/omap4.dtsi
> +++ b/arch/arm/boot/dts/ti/omap/omap4.dtsi
> @@ -501,10 +501,11 @@ sgx_module: target-module@56000000 {
> #size-cells = <1>;
> ranges = <0 0x56000000 0x2000000>;
> 
> - /*
> - * Closed source PowerVR driver, no child device
> - * binding or driver in mainline
> - */
> + gpu@0 {

I wonder why we don't add a "gpu:" label here.

Almost all other subsystem nodes have one (e.g. emif:, aes:, dss:, dsi:, hdmi:, etc.),
obviously for convenience when using a .dtsi file.

It would allow a board-specific DTS to easily add status = "disabled" to avoid driver
probing or disabling the GPU (e.g. if there is no display).

> + compatible = "ti,omap4430-gpu", "img,powervr-sgx540";

It still appears to me that the "img,powervr-sgx540" (or similar) entry is redundant
information.

I have experimentally updated our openpvrsgx driver and we do not have any use for
this information (at least in the kernel driver):

https://github.com/goldelico/letux-kernel/commit/f2f7cb3b858ef255f52f2b82a8bb34c047337afe

It shows how easy it is to derive the sgx version and revision number if we ever
need it inside the driver.

So if you want to keep a reference to powervr, it would suffice to have

> + compatible = "ti,omap4430-gpu", "img,powervr-sgx";

Otherwise your device tree entries compile fine and seem to work (at least in
a cursory test on PandaBoard ES).

> + reg = <0x0 0x2000000>; /* 32MB */
> + interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;
> + };
> };

BR and thanks,
Nikolaus
Maxime Ripard Jan. 15, 2024, 8:25 a.m. UTC | #3
Hi,

On Fri, Jan 12, 2024 at 06:33:58PM +0100, H. Nikolaus Schaller wrote:
> > Am 08.01.2024 um 19:32 schrieb Andrew Davis <afd@ti.com>:
> > 
> > Add SGX GPU device entry to base OMAP4 dtsi file.
> > 
> > Signed-off-by: Andrew Davis <afd@ti.com>
> > ---
> > arch/arm/boot/dts/ti/omap/omap4.dtsi | 9 +++++----
> > 1 file changed, 5 insertions(+), 4 deletions(-)
> > 
> > diff --git a/arch/arm/boot/dts/ti/omap/omap4.dtsi b/arch/arm/boot/dts/ti/omap/omap4.dtsi
> > index 2bbff9032be3e..559b2bfe4ca7c 100644
> > --- a/arch/arm/boot/dts/ti/omap/omap4.dtsi
> > +++ b/arch/arm/boot/dts/ti/omap/omap4.dtsi
> > @@ -501,10 +501,11 @@ sgx_module: target-module@56000000 {
> > #size-cells = <1>;
> > ranges = <0 0x56000000 0x2000000>;
> > 
> > - /*
> > - * Closed source PowerVR driver, no child device
> > - * binding or driver in mainline
> > - */
> > + gpu@0 {
> 
> I wonder why we don't add a "gpu:" label here.
> 
> Almost all other subsystem nodes have one (e.g. emif:, aes:, dss:, dsi:, hdmi:, etc.),
> obviously for convenience when using a .dtsi file.
> 
> It would allow a board-specific DTS to easily add status = "disabled" to avoid driver
> probing or disabling the GPU (e.g. if there is no display).

There's no reason to disable it in the DT: the hardware block would
still be there and it's rendering to memory so it still could be useful.

If there's no display on the board and you really don't want the GPU
driver, then you can disable the driver or block the module loading, but
it should be a distro / package / user decision, not a DT / kernel one
still.

Maxime
H. Nikolaus Schaller Jan. 15, 2024, 8:55 a.m. UTC | #4
Hi,

> Am 15.01.2024 um 09:25 schrieb Maxime Ripard <mripard@kernel.org>:
> 
> Hi,
> 
> On Fri, Jan 12, 2024 at 06:33:58PM +0100, H. Nikolaus Schaller wrote:
>>> Am 08.01.2024 um 19:32 schrieb Andrew Davis <afd@ti.com>:
>>> 
>>> Add SGX GPU device entry to base OMAP4 dtsi file.
>>> 
>>> Signed-off-by: Andrew Davis <afd@ti.com>
>>> ---
>>> arch/arm/boot/dts/ti/omap/omap4.dtsi | 9 +++++----
>>> 1 file changed, 5 insertions(+), 4 deletions(-)
>>> 
>>> diff --git a/arch/arm/boot/dts/ti/omap/omap4.dtsi b/arch/arm/boot/dts/ti/omap/omap4.dtsi
>>> index 2bbff9032be3e..559b2bfe4ca7c 100644
>>> --- a/arch/arm/boot/dts/ti/omap/omap4.dtsi
>>> +++ b/arch/arm/boot/dts/ti/omap/omap4.dtsi
>>> @@ -501,10 +501,11 @@ sgx_module: target-module@56000000 {
>>> #size-cells = <1>;
>>> ranges = <0 0x56000000 0x2000000>;
>>> 
>>> - /*
>>> - * Closed source PowerVR driver, no child device
>>> - * binding or driver in mainline
>>> - */
>>> + gpu@0 {
>> 
>> I wonder why we don't add a "gpu:" label here.
>> 
>> Almost all other subsystem nodes have one (e.g. emif:, aes:, dss:, dsi:, hdmi:, etc.),
>> obviously for convenience when using a .dtsi file.
>> 
>> It would allow a board-specific DTS to easily add status = "disabled" to avoid driver
>> probing or disabling the GPU (e.g. if there is no display).
> 
> There's no reason to disable it in the DT: the hardware block would
> still be there and it's rendering to memory so it still could be useful.

Well, if you know that the board does not have a dm3730 but a dm3725 without
GPU it is better to disable the GPU completely instead of loading the driver
and make it detect by some internal bits that it has no GPU on the SoC.

> If there's no display on the board and you really don't want the GPU
> driver, then you can disable the driver or block the module loading, but
> it should be a distro / package / user decision, not a DT / kernel one
> still.

The same holds for aes: dss: dsi: hdmi: etc. If they are not used by some
board file, they don't change a single bit of the DTB [1] which IMHO would
be of reasonable concern to question additional labels.

BR and thanks,
Nikolaus

[1] https://devicetree-specification.readthedocs.io/en/stable/source-language.html
"Labels are only used in the devicetree source format and are not encoded into the
DTB binary."
Andreas Kemnade Jan. 15, 2024, 9:50 a.m. UTC | #5
Hi, 

On Mon, 15 Jan 2024 09:55:00 +0100
"H. Nikolaus Schaller" <hns@goldelico.com> wrote:

> > There's no reason to disable it in the DT: the hardware block would
> > still be there and it's rendering to memory so it still could be useful.  
> 
> Well, if you know that the board does not have a dm3730 but a dm3725 without
> GPU it is better to disable the GPU completely instead of loading the driver
> and make it detect by some internal bits that it has no GPU on the SoC.
> 
That is at least some valid reason.

> > If there's no display on the board and you really don't want the GPU
> > driver, then you can disable the driver or block the module loading, but
> > it should be a distro / package / user decision, not a DT / kernel one
> > still.  
> 
> The same holds for aes: dss: dsi: hdmi: etc. If they are not used by some
> board file, they don't change a single bit of the DTB [1] which IMHO would
> be of reasonable concern to question additional labels.

There is some difference here, some hardware can just not be used without
wired external pins, the gpu can be used even if no display is connected
either to accelerate some remote access or you could use the gpu for something
completely else...
Maybe mining bitcoins if temperate gets too low to warm you pocket ;-)

But as these labels do not harm, I have no strong opinion against it.

Regards,
Andreas
Maxime Ripard Jan. 15, 2024, 2:45 p.m. UTC | #6
On Mon, Jan 15, 2024 at 09:55:00AM +0100, H. Nikolaus Schaller wrote:
> Hi,
> 
> > Am 15.01.2024 um 09:25 schrieb Maxime Ripard <mripard@kernel.org>:
> > 
> > Hi,
> > 
> > On Fri, Jan 12, 2024 at 06:33:58PM +0100, H. Nikolaus Schaller wrote:
> >>> Am 08.01.2024 um 19:32 schrieb Andrew Davis <afd@ti.com>:
> >>> 
> >>> Add SGX GPU device entry to base OMAP4 dtsi file.
> >>> 
> >>> Signed-off-by: Andrew Davis <afd@ti.com>
> >>> ---
> >>> arch/arm/boot/dts/ti/omap/omap4.dtsi | 9 +++++----
> >>> 1 file changed, 5 insertions(+), 4 deletions(-)
> >>> 
> >>> diff --git a/arch/arm/boot/dts/ti/omap/omap4.dtsi b/arch/arm/boot/dts/ti/omap/omap4.dtsi
> >>> index 2bbff9032be3e..559b2bfe4ca7c 100644
> >>> --- a/arch/arm/boot/dts/ti/omap/omap4.dtsi
> >>> +++ b/arch/arm/boot/dts/ti/omap/omap4.dtsi
> >>> @@ -501,10 +501,11 @@ sgx_module: target-module@56000000 {
> >>> #size-cells = <1>;
> >>> ranges = <0 0x56000000 0x2000000>;
> >>> 
> >>> - /*
> >>> - * Closed source PowerVR driver, no child device
> >>> - * binding or driver in mainline
> >>> - */
> >>> + gpu@0 {
> >> 
> >> I wonder why we don't add a "gpu:" label here.
> >> 
> >> Almost all other subsystem nodes have one (e.g. emif:, aes:, dss:, dsi:, hdmi:, etc.),
> >> obviously for convenience when using a .dtsi file.
> >> 
> >> It would allow a board-specific DTS to easily add status = "disabled" to avoid driver
> >> probing or disabling the GPU (e.g. if there is no display).
> > 
> > There's no reason to disable it in the DT: the hardware block would
> > still be there and it's rendering to memory so it still could be useful.
> 
> Well, if you know that the board does not have a dm3730 but a dm3725 without
> GPU it is better to disable the GPU completely instead of loading the driver
> and make it detect by some internal bits that it has no GPU on the SoC.

It shouldn't even be in the DTSI if it's not in the SoC.

> > If there's no display on the board and you really don't want the GPU
> > driver, then you can disable the driver or block the module loading, but
> > it should be a distro / package / user decision, not a DT / kernel one
> > still.
> 
> The same holds for aes: dss: dsi: hdmi: etc. If they are not used by some
> board file, they don't change a single bit of the DTB [1] which IMHO would
> be of reasonable concern to question additional labels.

Not really, no. If there's no HDMI connector, the HDMI controller is
useless. A GPU without a display can still be useful, depending on the
workload.

Maxime
diff mbox series

Patch

diff --git a/arch/arm/boot/dts/ti/omap/omap4.dtsi b/arch/arm/boot/dts/ti/omap/omap4.dtsi
index 2bbff9032be3e..559b2bfe4ca7c 100644
--- a/arch/arm/boot/dts/ti/omap/omap4.dtsi
+++ b/arch/arm/boot/dts/ti/omap/omap4.dtsi
@@ -501,10 +501,11 @@  sgx_module: target-module@56000000 {
 			#size-cells = <1>;
 			ranges = <0 0x56000000 0x2000000>;
 
-			/*
-			 * Closed source PowerVR driver, no child device
-			 * binding or driver in mainline
-			 */
+			gpu@0 {
+				compatible = "ti,omap4430-gpu", "img,powervr-sgx540";
+				reg = <0x0 0x2000000>; /* 32MB */
+				interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;
+			};
 		};
 
 		/*