All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH libdrm 0/2] xf86drm: add OF_ fallback mechanism
@ 2018-10-18 20:07 Christian Gmeiner
  2018-10-18 20:07 ` [PATCH libdrm 1/2] xf86drm: fallback to DRIVER uevent entry when OF_FULLNAME fails Christian Gmeiner
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Christian Gmeiner @ 2018-10-18 20:07 UTC (permalink / raw)
  To: dri-devel; +Cc: emil.l.velikov, lukas

Since kernel 4.17 (drm/etnaviv: remove the need for a gpu-subsystem DT
node) the etnaviv DRM driver doesn't have an associated DT node
anymore. This is technically correct, as the etnaviv device is a
virtual device driving multiple hardware devices.

Before 4.17 the userspace had access to the following information:
# cat /sys/dev/char/226:128/device/uevent
DRIVER=etnaviv
OF_NAME=gpu-subsystem
OF_FULLNAME=/gpu-subsystem
OF_COMPATIBLE_0=fsl,imx-gpu-subsystem
OF_COMPATIBLE_N=1
MODALIAS=of:Ngpu-subsystemT<NULL>Cfsl,imx-gpu-subsystem
DRIVER=imx-drm
OF_NAME=display-subsystem
OF_FULLNAME=/display-subsystem
OF_COMPATIBLE_0=fsl,imx-display-subsystem
OF_COMPATIBLE_N=1

Afer 4.17:
# cat /sys/dev/char/226:128/device/uevent
DRIVER=etnaviv
MODALIAS=platform:etnaviv

As a consequence we need to add fallback mechanism to handle this
change. This series fixes kmscube and friends when using mesa's
loader_open_render_node(..).

Christian Gmeiner (2):
  xf86drm: fallback to DRIVER uevent entry when OF_FULLNAME fails
  xf86drm: handle non existing OF_COMPATIBLE_N uevent entry

 xf86drm.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

-- 
2.17.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH libdrm 1/2] xf86drm: fallback to DRIVER uevent entry when OF_FULLNAME fails
  2018-10-18 20:07 [PATCH libdrm 0/2] xf86drm: add OF_ fallback mechanism Christian Gmeiner
@ 2018-10-18 20:07 ` Christian Gmeiner
  2018-10-25 13:34   ` Emil Velikov
  2018-10-18 20:07 ` [PATCH libdrm 2/2] xf86drm: handle non existing OF_COMPATIBLE_N uevent entry Christian Gmeiner
  2018-10-23 17:28 ` [PATCH libdrm 0/2] xf86drm: add OF_ fallback mechanism Emil Velikov
  2 siblings, 1 reply; 7+ messages in thread
From: Christian Gmeiner @ 2018-10-18 20:07 UTC (permalink / raw)
  To: dri-devel; +Cc: emil.l.velikov, lukas

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
---
 xf86drm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xf86drm.c b/xf86drm.c
index 10df682b..4ee1337b 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -3516,6 +3516,8 @@ static int drmParsePlatformBusInfo(int maj, int min, drmPlatformBusInfoPtr info)
     snprintf(path, sizeof(path), "/sys/dev/char/%d:%d/device", maj, min);
 
     name = sysfs_uevent_get(path, "OF_FULLNAME");
+    if (!name)
+        name = sysfs_uevent_get(path, "DRIVER");
     if (!name)
         return -ENOENT;
 
-- 
2.17.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH libdrm 2/2] xf86drm: handle non existing OF_COMPATIBLE_N uevent entry
  2018-10-18 20:07 [PATCH libdrm 0/2] xf86drm: add OF_ fallback mechanism Christian Gmeiner
  2018-10-18 20:07 ` [PATCH libdrm 1/2] xf86drm: fallback to DRIVER uevent entry when OF_FULLNAME fails Christian Gmeiner
@ 2018-10-18 20:07 ` Christian Gmeiner
  2018-10-23 17:28 ` [PATCH libdrm 0/2] xf86drm: add OF_ fallback mechanism Emil Velikov
  2 siblings, 0 replies; 7+ messages in thread
From: Christian Gmeiner @ 2018-10-18 20:07 UTC (permalink / raw)
  To: dri-devel; +Cc: emil.l.velikov, lukas

Default the count value to 0.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
---
 xf86drm.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/xf86drm.c b/xf86drm.c
index 4ee1337b..a9152f0c 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -3537,17 +3537,16 @@ static int drmParsePlatformDeviceInfo(int maj, int min,
 {
 #ifdef __linux__
     char path[PATH_MAX + 1], *value;
-    unsigned int count, i;
+    unsigned int count = 0, i;
     int err;
 
     snprintf(path, sizeof(path), "/sys/dev/char/%d:%d/device", maj, min);
 
     value = sysfs_uevent_get(path, "OF_COMPATIBLE_N");
-    if (!value)
-        return -ENOENT;
-
-    sscanf(value, "%u", &count);
-    free(value);
+    if (value) {
+        sscanf(value, "%u", &count);
+        free(value);
+    }
 
     info->compatible = calloc(count + 1, sizeof(*info->compatible));
     if (!info->compatible)
-- 
2.17.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH libdrm 0/2] xf86drm: add OF_ fallback mechanism
  2018-10-18 20:07 [PATCH libdrm 0/2] xf86drm: add OF_ fallback mechanism Christian Gmeiner
  2018-10-18 20:07 ` [PATCH libdrm 1/2] xf86drm: fallback to DRIVER uevent entry when OF_FULLNAME fails Christian Gmeiner
  2018-10-18 20:07 ` [PATCH libdrm 2/2] xf86drm: handle non existing OF_COMPATIBLE_N uevent entry Christian Gmeiner
@ 2018-10-23 17:28 ` Emil Velikov
  2018-10-29 11:32   ` Lucas Stach
  2 siblings, 1 reply; 7+ messages in thread
From: Emil Velikov @ 2018-10-23 17:28 UTC (permalink / raw)
  To: Christian Gmeiner, Rob Herring; +Cc: Lukas F. Hartmann, ML dri-devel

On Thu, 18 Oct 2018 at 21:07, Christian Gmeiner
<christian.gmeiner@gmail.com> wrote:
>
> Since kernel 4.17 (drm/etnaviv: remove the need for a gpu-subsystem DT
> node) the etnaviv DRM driver doesn't have an associated DT node
> anymore. This is technically correct, as the etnaviv device is a
> virtual device driving multiple hardware devices.
>
> Before 4.17 the userspace had access to the following information:
> # cat /sys/dev/char/226:128/device/uevent
> DRIVER=etnaviv
> OF_NAME=gpu-subsystem
> OF_FULLNAME=/gpu-subsystem
> OF_COMPATIBLE_0=fsl,imx-gpu-subsystem
> OF_COMPATIBLE_N=1
> MODALIAS=of:Ngpu-subsystemT<NULL>Cfsl,imx-gpu-subsystem
> DRIVER=imx-drm
> OF_NAME=display-subsystem
> OF_FULLNAME=/display-subsystem
> OF_COMPATIBLE_0=fsl,imx-display-subsystem
> OF_COMPATIBLE_N=1
>
> Afer 4.17:
> # cat /sys/dev/char/226:128/device/uevent
> DRIVER=etnaviv
> MODALIAS=platform:etnaviv
>
Mostly relaying what I mentioned previously [1], yet forgot to CC RobH.

- Are the OF entries in uevent part of the ABI or not? Can we have that
documented anywhere?

There are very few mentions in the official kernel doc - Documentation/ABI/
Obviously it doesn't mention anything OF_* but it neither does DRIVER
or MODALIAS. Yet if we change those $world will break ;-)

- How can we distinguish in the (perhaps hypothetical) case when
there's two or more etnaviv devices?

Thanks
Emil

[1] https://lists.freedesktop.org/archives/mesa-dev/2018-September/205660.html
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH libdrm 1/2] xf86drm: fallback to DRIVER uevent entry when OF_FULLNAME fails
  2018-10-18 20:07 ` [PATCH libdrm 1/2] xf86drm: fallback to DRIVER uevent entry when OF_FULLNAME fails Christian Gmeiner
@ 2018-10-25 13:34   ` Emil Velikov
  2018-10-25 16:07     ` Christian Gmeiner
  0 siblings, 1 reply; 7+ messages in thread
From: Emil Velikov @ 2018-10-25 13:34 UTC (permalink / raw)
  To: Christian Gmeiner; +Cc: Lukas F. Hartmann, ML dri-devel

On Thu, 18 Oct 2018 at 21:07, Christian Gmeiner
<christian.gmeiner@gmail.com> wrote:
>
> Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
> ---
>  xf86drm.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/xf86drm.c b/xf86drm.c
> index 10df682b..4ee1337b 100644
> --- a/xf86drm.c
> +++ b/xf86drm.c
> @@ -3516,6 +3516,8 @@ static int drmParsePlatformBusInfo(int maj, int min, drmPlatformBusInfoPtr info)
>      snprintf(path, sizeof(path), "/sys/dev/char/%d:%d/device", maj, min);
>
>      name = sysfs_uevent_get(path, "OF_FULLNAME");
> +    if (!name)
> +        name = sysfs_uevent_get(path, "DRIVER");

This workaround will work for etnaviv, but not for all platform devices.
Personally, I'd recommend reverting the Mesa patch for now... I'm
checking with some kernel-savvy people how we can resolve thing
properly.

-Emil
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH libdrm 1/2] xf86drm: fallback to DRIVER uevent entry when OF_FULLNAME fails
  2018-10-25 13:34   ` Emil Velikov
@ 2018-10-25 16:07     ` Christian Gmeiner
  0 siblings, 0 replies; 7+ messages in thread
From: Christian Gmeiner @ 2018-10-25 16:07 UTC (permalink / raw)
  To: Emil Velikov; +Cc: lukas, DRI mailing list

Am Do., 25. Okt. 2018 um 15:35 Uhr schrieb Emil Velikov
<emil.l.velikov@gmail.com>:
>
> On Thu, 18 Oct 2018 at 21:07, Christian Gmeiner
> <christian.gmeiner@gmail.com> wrote:
> >
> > Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
> > ---
> >  xf86drm.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/xf86drm.c b/xf86drm.c
> > index 10df682b..4ee1337b 100644
> > --- a/xf86drm.c
> > +++ b/xf86drm.c
> > @@ -3516,6 +3516,8 @@ static int drmParsePlatformBusInfo(int maj, int min, drmPlatformBusInfoPtr info)
> >      snprintf(path, sizeof(path), "/sys/dev/char/%d:%d/device", maj, min);
> >
> >      name = sysfs_uevent_get(path, "OF_FULLNAME");
> > +    if (!name)
> > +        name = sysfs_uevent_get(path, "DRIVER");
>
> This workaround will work for etnaviv, but not for all platform devices.
> Personally, I'd recommend reverting the Mesa patch for now... I'm
> checking with some kernel-savvy people how we can resolve thing
> properly.

I am fine with that - will prepare a revert patch.

-- 
greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH libdrm 0/2] xf86drm: add OF_ fallback mechanism
  2018-10-23 17:28 ` [PATCH libdrm 0/2] xf86drm: add OF_ fallback mechanism Emil Velikov
@ 2018-10-29 11:32   ` Lucas Stach
  0 siblings, 0 replies; 7+ messages in thread
From: Lucas Stach @ 2018-10-29 11:32 UTC (permalink / raw)
  To: Emil Velikov, Christian Gmeiner, Rob Herring
  Cc: Lukas F. Hartmann, ML dri-devel

Am Dienstag, den 23.10.2018, 18:28 +0100 schrieb Emil Velikov:
> On Thu, 18 Oct 2018 at 21:07, Christian Gmeiner
> > <christian.gmeiner@gmail.com> wrote:
> > 
> > Since kernel 4.17 (drm/etnaviv: remove the need for a gpu-subsystem DT
> > node) the etnaviv DRM driver doesn't have an associated DT node
> > anymore. This is technically correct, as the etnaviv device is a
> > virtual device driving multiple hardware devices.
> > 
> > Before 4.17 the userspace had access to the following information:
> > # cat /sys/dev/char/226:128/device/uevent
> > DRIVER=etnaviv
> > OF_NAME=gpu-subsystem
> > OF_FULLNAME=/gpu-subsystem
> > OF_COMPATIBLE_0=fsl,imx-gpu-subsystem
> > OF_COMPATIBLE_N=1
> > MODALIAS=of:Ngpu-subsystemT<NULL>Cfsl,imx-gpu-subsystem
> > DRIVER=imx-drm
> > OF_NAME=display-subsystem
> > OF_FULLNAME=/display-subsystem
> > OF_COMPATIBLE_0=fsl,imx-display-subsystem
> > OF_COMPATIBLE_N=1
> > 
> > Afer 4.17:
> > # cat /sys/dev/char/226:128/device/uevent
> > DRIVER=etnaviv
> > MODALIAS=platform:etnaviv
> > 
> 
> Mostly relaying what I mentioned previously [1], yet forgot to CC RobH.
> 
> - Are the OF entries in uevent part of the ABI or not? Can we have that
> documented anywhere?
> 
> There are very few mentions in the official kernel doc - Documentation/ABI/
> Obviously it doesn't mention anything OF_* but it neither does DRIVER
> or MODALIAS. Yet if we change those $world will break ;-)

The OF node has never been part of the etnaviv UABI, simply due to the
fact that it's still possible to instantiate the etnaviv driver from a
platform file, instead of a devicetree node.

> 
> - How can we distinguish in the (perhaps hypothetical) case when
> there's two or more etnaviv devices?

Why not simply use the DRM minor? All you need is an arbitrary handle
to grab the right instance.

Regards,
Lucas
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-10-29 11:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-18 20:07 [PATCH libdrm 0/2] xf86drm: add OF_ fallback mechanism Christian Gmeiner
2018-10-18 20:07 ` [PATCH libdrm 1/2] xf86drm: fallback to DRIVER uevent entry when OF_FULLNAME fails Christian Gmeiner
2018-10-25 13:34   ` Emil Velikov
2018-10-25 16:07     ` Christian Gmeiner
2018-10-18 20:07 ` [PATCH libdrm 2/2] xf86drm: handle non existing OF_COMPATIBLE_N uevent entry Christian Gmeiner
2018-10-23 17:28 ` [PATCH libdrm 0/2] xf86drm: add OF_ fallback mechanism Emil Velikov
2018-10-29 11:32   ` Lucas Stach

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.