mripard / sunxi-mali

GNU General Public License v2.0
100 stars 54 forks source link

Getting error trying to install built kernel module for Fedora 28 on Pine64 A64 #52

Closed HeatfanJohn closed 5 years ago

HeatfanJohn commented 5 years ago

I'm following the build instructions for the kernel module and the ./build.sh -r r8p1 -b completed without error. However, when I go to install the kernel module using the command ./build.sh -r r8p1 -i I receive the following error:

Makefile:68: *** No KDIR found for platform .  Stop.

This is what I've done:

git clone https://github.com/mripard/sunxi-mali.git
cd sunxi-mali
export KDIR=/lib/modules/`uname -r`/build
export CROSS_COMPILE=
export ARCH=arm64
./build.sh -r r8p1 -b

Looking at the Makefile I can see that I need to specify MALI_PLATFORM and TARGET_PLATFORM. I not sure what to set for them. I initially didn't have anything set. I most recently tried:

export MALI_PLATFORM=arm64
export TARGET_PLATFORM=sunxi-mali400
sergey-suloev commented 5 years ago

@HeatfanJohn Here is how I build mali r6p2. As soon as it is a out-of-tree module you need to specify your kernel source tree.

build_mali_kmod()
{
        cd $MALI_DRV_SRC

        echo "Building Mali kernel module..."

        export CROSS_COMPILE="${CROSS_COMPILE}"
        export KDIR="${KERNEL_SOURCE_DIR}"
        export INSTALL_MOD_PATH="${TAGET_LINUX_ROOT}"

        ./build.sh -r $MALI_DRV_VER -j $NUM_CPU_CORES -b
        ./build.sh -r $MALI_DRV_VER -i

        echo "Build finished."
}
giuliobenetti commented 5 years ago

@HeatfanJohn like @sergey-suloev pointed above you need to export KDIR pointing to your kernel sources. It needs this to build sunxi-mali, because it is a kernel module.

Best regards.

HeatfanJohn commented 5 years ago

Ugh! I feel so stupid!

I was running the ./build.sh command using sudo therefore the build script didn't inherit my environment and the KDIR environment variable. I need to add the -E option to sudo to inherit my environment!

The following appears to have worked for me and placed mali.ko into the extra directory of /lib/modules/:

sudo -E ./build.sh -r r8p1 -i

Another question, what's the difference between the three different versions of the driver? Which one should I use? The latest (r8p1)?

giuliobenetti commented 5 years ago

Latest should be the better. But pay attention at which mali-blob you're going to use as EGL library. Their versions have to match.

HeatfanJohn commented 5 years ago

@giuliobenetti Is this patch the same patch to get the Mali node into the DTB for the A64 chip (sun50i-a64.dtsi)?

giuliobenetti commented 5 years ago

@HeatfanJohn that patch is ok. Of course you have to apply it by hand on sun50i-a64.dtsi as you've described. If it works let me know that I submit it on linux-arm mailing list to be upstreamed on mainline. Thanks.

giuliobenetti commented 5 years ago

Ah, by the way, can you try testing with frequency@576Mhz instead of 384? On lichee 3.4 kernel mali driver code they set Mali frequency at 576Mhz for:

if defined(CONFIG_ARCH_SUN8IW7P1) that is H3.

Then checking A64 Datasheet I see PLL_GPU can be 192Mhz~600Mhz, so the suspect is that it can work @576Mhz with no problem.

Thank you

hor63 commented 5 years ago

The latest is usually the best. Please note that the R8 Blob is only available in the framebuffer version. For use with X11 or Wayland you have to compile the R6 driver because only R6 Blob are available.

Kai


From: John P Masseria. notifications@github.com Sent: Tuesday, September 25, 2018 3:09 PM To: mripard/sunxi-mali Cc: Subscribed Subject: Re: [mripard/sunxi-mali] Getting error trying to install built kernel module for Fedora 28 on Pine64 A64 (#52)

Ugh! I feel so stupid!

I was running the ./build.sh command using sudo therefore the build script didn't inherit my environment and the KDIR environment variable. I need to add the -E option to sudo to inherit my environment!

The following appears to have worked for me and placed mali.ko into the extra directory of /lib/modules/: sudo -E ./build.sh -r r8p1 -i

Another question, what's the difference between the three different versions of the driver? Which one should I use? The latest (r8p1)?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/mripard/sunxi-mali/issues/52#issuecomment-424381035, or mute the threadhttps://github.com/notifications/unsubscribe-auth/APbi3f_7otgLjAvUD2XsXDt08UB5wZQoks5uekczgaJpZM4W3khm.

HeatfanJohn commented 5 years ago

@hor63 Hi Kay, thank you for the information. I see now that the driver versions are from ARM - Open Source Mali Utgard GPU Kernel Drivers.

Can I find out more about each of the available releases by looking at the driver source code provided by ARM? Or do you need the Mali DDK to fully understand the driver?

HeatfanJohn commented 5 years ago

Success!

[   15.365477] mali: loading out-of-tree module taints kernel.
[   15.379046] dwmac-sun8i 1c30000.ethernet: PTP uses main clock
[   15.401384] mali: module verification failed: signature and/or required key missing - tainting kernel
[   15.408513] dwmac-sun8i 1c30000.ethernet: Current syscon value is not the default 6 (expect 0)
[   15.419358] dwmac-sun8i 1c30000.ethernet: No HW DMA feature register supported
[   15.426635] dwmac-sun8i 1c30000.ethernet: RX Checksum Offload Engine supported
[   15.433935] dwmac-sun8i 1c30000.ethernet: COE Type 2
[   15.438958] dwmac-sun8i 1c30000.ethernet: TX Checksum insertion supported
[   15.445766] dwmac-sun8i 1c30000.ethernet: Normal descriptors
[   15.451516] dwmac-sun8i 1c30000.ethernet: Chain mode enabled
[   15.457501] libphy: stmmac: probed
[   15.466252] Allwinner sunXi mali glue initialized
[   15.471982] Mali:
[   15.471992] Found Mali GPU Mali-400 MP r1p1
[   15.483772] Mali:
[   15.483782] 2+0 PP cores initialized
[   15.492971] Mali:
[   15.492985] Mali device driver loaded

However, I had a lot of trouble trying to get a dtb that worked. I followed these steps to checkout the Fedora kernel from the Fedora git repository:

$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/fedora.git
$ git checkout -b my_branch kernel-4.18.9-200.fc28

But writing this now shows me that I neglected to checkout the branch that corresponded to my Kernel version. This must explain why my first attempts to insert the gpu into the DTB for my Pine64 A+ board caused by Ethernet port to no longer work. There must be some change to the DTB from 4.18.9-200.fc28 to 4.19-rc4 which is the latest branch in the Fedora GIT repo.

Here's the patch for sun50i-a64.dtsi adding the GPU node:

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
index 5202b76e9684..8afb3dff2fef 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
@@ -693,5 +693,31 @@
                        reg = <0x01c20ca0 0x20>;
                        interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>;
                };
+
+               mali: gpu@1c40000 {
+                       compatible = "allwinner,sun50i-h5-mali", "arm,mali-400";
+                       reg = <0x01c40000 0x10000>;
+                       interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-names = "gp",
+                                         "gpmmu",
+                                         "pp0",
+                                         "ppmmu0",
+                                         "pp1",
+                                         "ppmmu1",
+                                         "pmu";
+                       clocks = <&ccu CLK_BUS_GPU>, <&ccu CLK_GPU>;
+                       clock-names = "bus", "core";
+                       resets = <&ccu RST_BUS_GPU>;
+
+                       assigned-clocks = <&ccu CLK_GPU>;
+                       assigned-clock-rates = <576000000>;
+               };
+
        };
 };

I initially tried to say compatible = "allwinner,sun50i-a64-mali", "arm,mali-400", but the literal sub50i-a64-mali isn't defined so I got lazy and specified sun50i-h5-mail which is already defined.

I guess before submitting this upstream we should define the A64 Mali literal.

Question: What is the unit-address for in the DTB? When my Ethernet stopped working I thought it was because the value specified for the gpu namely 0x01C40000 appeared to overlap the unit-address for Ethernet.

sergey-suloev commented 5 years ago

@HeatfanJohn here is my dts for mali

      mali: gpu@1c40000 {
                   compatible = "allwinner,sun50i-a64-mali",
                                "allwinner,sun7i-a20-mali", "arm,mali-400";
                   reg = <0x01c40000 0x10000>;
                   interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>,
                                <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>,
                                <GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH>,
                                <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>,
                                <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>,
                                <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>,
                                <GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>;
                   interrupt-names = "gp",
                                     "gpmmu",
                                     "pp0",
                                     "ppmmu0",
                                     "pp1",
                                     "ppmmu1",
                                     "pmu";
                   clocks = <&ccu CLK_BUS_GPU>, <&ccu CLK_GPU>;
                   clock-names = "bus", "core";
                   resets = <&ccu RST_BUS_GPU>;

                   assigned-clocks = <&ccu CLK_GPU>;
                   assigned-clock-rates = <384000000>;
           };
HeatfanJohn commented 5 years ago

FYI @sergey-suloev, @giuliobenetti asked me to try 576MHz for the clock. I need to try to run a test now.

sergey-suloev commented 5 years ago

@HeatfanJohn sure, but look at the compatible as your issue was related to it.

giuliobenetti commented 5 years ago

@HeatfanJohn I point you the patch I've submitted for H3 as an example: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c235edcb34651023c9eb1c5c4a7cdcaf7250d02c

Then you have to submit it to ML, check this out: https://kernelnewbies.org/FirstKernelPatch Under "Submit a patch"

HeatfanJohn commented 5 years ago

Thank you for all your assistance so far. My goal is to get desktop running under Fedora 28 on a Pine A64+ SBC. I have successfully built and loaded the Mali r8p1 Kernel Module:

[   15.433268] Allwinner sunXi mali glue initialized
[   15.439773] Mali:
[   15.439783] Found Mali GPU Mali-400 MP r1p1
[   15.466114] Mali:
[   15.466139] 2+0 PP cores initialized
[   15.488204] Mali:
[   15.488214] Mali device driver loaded

Should I worry that it says r1p1?

I have also copied the r8p1 Mali OpenGL ES userspace libraries:

sudo cp -a mali-blobs/r8p1/arm64/fbdev/lib* /usr/lib64

I copied them to /usr/lib64 because this is a 64-bit ARM platform. Initially copying them to /usr/lib had no effect. This copy overwrote some links that were already present in lib64 directory.

I was getting some SELINUX AVC denied errors that I addresses using audit2allow.

However, gdm keeps erroring on me saying:

Oct 05 15:25:06 mypine64 systemd[1]: Started Session c87 of user gdm.
Oct 05 15:25:06 mypine64 gdm-launch-environment][11771]: pam_unix(gdm-launch-environment:session): session opened for user gdm by (uid=0)
Oct 05 15:25:06 mypine64 audit[11771]: USER_START pid=11771 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='op=PAM:session_open grantors=pam_keyinit,pam_keyinit,pam_limits,pam_systemd,pam_unix,pam_umask acct="gdm" exe="/usr/libexec/gdm-session-worker" hostna>
Oct 05 15:25:06 mypine64 systemd[10990]: selinux: avc:  denied  { status } for auid=n/a uid=42 gid=42 cmdline="/usr/libexec/gdm-wayland-session gnome-session --autostart /usr/share/gdm/greeter/autostart" scontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=unconfined_u:unconfined_r:unconfine>
Oct 05 15:25:06 mypine64 systemd[10990]: selinux: avc:  denied  { reload } for auid=n/a uid=42 gid=42 cmdline="/usr/libexec/gnome-session-binary --autostart /usr/share/gdm/greeter/autostart" scontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.>
Oct 05 15:25:06 mypine64 systemd[10990]: selinux: avc:  denied  { reload } for auid=n/a uid=42 gid=42 cmdline="/usr/libexec/gnome-session-binary --autostart /usr/share/gdm/greeter/autostart" scontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.>
Oct 05 15:25:06 mypine64 systemd[10990]: selinux: avc:  denied  { reload } for auid=n/a uid=42 gid=42 cmdline="/usr/libexec/gnome-session-binary --autostart /usr/share/gdm/greeter/autostart" scontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.>
Oct 05 15:25:06 mypine64 systemd[10990]: selinux: avc:  denied  { reload } for auid=n/a uid=42 gid=42 cmdline="/usr/libexec/gnome-session-binary --autostart /usr/share/gdm/greeter/autostart" scontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.>
Oct 05 15:25:06 mypine64 systemd[10990]: selinux: avc:  denied  { reload } for auid=n/a uid=42 gid=42 cmdline="/usr/libexec/gnome-session-binary --autostart /usr/share/gdm/greeter/autostart" scontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.>
Oct 05 15:25:06 mypine64 gnome-session[11778]: _IceTransmkdir: Owner of /tmp/.ICE-unix should be set to root
Oct 05 15:25:07 mypine64 systemd[10990]: selinux: avc:  denied  { reload } for auid=n/a uid=42 gid=42 cmdline="/usr/libexec/gnome-session-binary --autostart /usr/share/gdm/greeter/autostart" scontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.>
Oct 05 15:25:07 mypine64 gnome-shell[11786]: Failed to create backend: Could not find a primary drm kms device
Oct 05 15:25:07 mypine64 gnome-session[11778]: gnome-session-binary[11778]: WARNING: App 'org.gnome.Shell.desktop' exited with code 1
Oct 05 15:25:07 mypine64 gnome-session-binary[11778]: WARNING: App 'org.gnome.Shell.desktop' exited with code 1
Oct 05 15:25:07 mypine64 gnome-session-binary[11778]: Unrecoverable failure in required component org.gnome.Shell.desktop
Oct 05 15:25:07 mypine64 gdm-launch-environment][11771]: pam_unix(gdm-launch-environment:session): session closed for user gdm
Oct 05 15:25:07 mypine64 audit[11771]: USER_END pid=11771 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='op=PAM:session_close grantors=pam_keyinit,pam_keyinit,pam_limits,pam_systemd,pam_unix,pam_umask acct="gdm" exe="/usr/libexec/gdm-session-worker" hostnam>
Oct 05 15:25:07 mypine64 audit[11771]: CRED_DISP pid=11771 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_permit acct="gdm" exe="/usr/libexec/gdm-session-worker" hostname=mypine64 addr=? terminal=/dev/tty1 res=success'
Oct 05 15:25:07 mypine64 gdm[11767]: GdmDisplay: display lasted 1.225508 seconds
Oct 05 15:25:07 mypine64 systemd-logind[457]: Removed session c87.
Oct 05 15:25:07 mypine64 gdm[11767]: Child process -11775 was already dead.
Oct 05 15:25:07 mypine64 gdm[11767]: Child process 11771 was already dead.
Oct 05 15:25:07 mypine64 gdm[11767]: Unable to kill session worker process

I haven't been able to figure out how to eliminate these remaining AVC DENIED SELINUX errors. I turned off SELINUX enforcement and gdm still wouldn't initialize.

Do I need to turn off drm and/or kms? I've seen a posting on that for an NVIDIA GPU, but I don't know the equivalent setting for Mali. Again, sorry for the newbie questions.

Oct 05 15:25:07 mypine64 gnome-shell[11786]: Failed to create backend: Could not find a primary drm kms device

Here's the log with setenforce 0:

Oct 06 11:31:54 mypine64 audit[13787]: USER_AUTH pid=13787 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='op=PAM:authentication grantors=pam_permit acct="gdm" exe="/usr/libexec/gdm-session-worker" hostname=mypine64 addr=? terminal=/dev/tty1 res=success'
Oct 06 11:31:54 mypine64 audit[13787]: USER_ACCT pid=13787 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='op=PAM:accounting grantors=pam_permit acct="gdm" exe="/usr/libexec/gdm-session-worker" hostname=mypine64 addr=? terminal=/dev/tty1 res=success'
Oct 06 11:31:54 mypine64 audit[13787]: CRED_ACQ pid=13787 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_permit acct="gdm" exe="/usr/libexec/gdm-session-worker" hostname=mypine64 addr=? terminal=/dev/tty1 res=success'
Oct 06 11:31:54 mypine64 systemd-logind[457]: New session c97 of user gdm.
Oct 06 11:31:54 mypine64 systemd[1]: Started Session c97 of user gdm.
Oct 06 11:31:54 mypine64 gdm-launch-environment][13787]: pam_unix(gdm-launch-environment:session): session opened for user gdm by (uid=0)
Oct 06 11:31:54 mypine64 audit[13787]: USER_START pid=13787 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='op=PAM:session_open grantors=pam_keyinit,pam_keyinit,pam_limits,pam_systemd,pam_unix,pam_umask acct="gdm" exe="/usr/libexec/gdm-session-worker" hostna>
Oct 06 11:31:54 mypine64 /usr/libexec/gdm-x-session[13790]: Unable to run X server
Oct 06 11:31:54 mypine64 gdm-launch-environment][13787]: pam_unix(gdm-launch-environment:session): session closed for user gdm
Oct 06 11:31:54 mypine64 audit[13787]: USER_END pid=13787 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='op=PAM:session_close grantors=pam_keyinit,pam_keyinit,pam_limits,pam_systemd,pam_unix,pam_umask acct="gdm" exe="/usr/libexec/gdm-session-worker" hostnam>
Oct 06 11:31:54 mypine64 audit[13787]: CRED_DISP pid=13787 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_permit acct="gdm" exe="/usr/libexec/gdm-session-worker" hostname=mypine64 addr=? terminal=/dev/tty1 res=success'
Oct 06 11:31:54 mypine64 systemd-logind[457]: Removed session c97.
Oct 06 11:31:54 mypine64 gdm[13733]: Child process -13790 was already dead.
Oct 06 11:31:54 mypine64 gdm[13733]: Child process 13787 was already dead.
Oct 06 11:31:54 mypine64 gdm[13733]: Unable to kill session worker process
Oct 06 11:31:54 mypine64 audit[13793]: USER_AUTH pid=13793 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='op=PAM:authentication grantors=pam_permit acct="gdm" exe="/usr/libexec/gdm-session-worker" hostname=mypine64 addr=? terminal=/dev/tty1 res=success'
Oct 06 11:31:54 mypine64 audit[13793]: USER_ACCT pid=13793 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='op=PAM:accounting grantors=pam_permit acct="gdm" exe="/usr/libexec/gdm-session-worker" hostname=mypine64 addr=? terminal=/dev/tty1 res=success'
Oct 06 11:31:54 mypine64 audit[13793]: CRED_ACQ pid=13793 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_permit acct="gdm" exe="/usr/libexec/gdm-session-worker" hostname=mypine64 addr=? terminal=/dev/tty1 res=success'
Oct 06 11:31:55 mypine64 systemd-logind[457]: New session c98 of user gdm.
Oct 06 11:31:55 mypine64 systemd[1]: Started Session c98 of user gdm.
Oct 06 11:31:55 mypine64 gdm-launch-environment][13793]: pam_unix(gdm-launch-environment:session): session opened for user gdm by (uid=0)
Oct 06 11:31:55 mypine64 audit[13793]: USER_START pid=13793 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='op=PAM:session_open grantors=pam_keyinit,pam_keyinit,pam_limits,pam_systemd,pam_unix,pam_umask acct="gdm" exe="/usr/libexec/gdm-session-worker" hostna>
Oct 06 11:31:55 mypine64 gnome-session[13799]: _IceTransmkdir: Owner of /tmp/.ICE-unix should be set to root
Oct 06 11:31:55 mypine64 gnome-shell[13807]: Failed to create backend: Could not find a primary drm kms device
Oct 06 11:31:56 mypine64 gnome-session[13799]: gnome-session-binary[13799]: WARNING: App 'org.gnome.Shell.desktop' exited with code 1
Oct 06 11:31:56 mypine64 gnome-session-binary[13799]: WARNING: App 'org.gnome.Shell.desktop' exited with code 1
Oct 06 11:31:56 mypine64 gnome-session-binary[13799]: Unrecoverable failure in required component org.gnome.Shell.desktop
Oct 06 11:31:56 mypine64 gdm-launch-environment][13793]: pam_unix(gdm-launch-environment:session): session closed for user gdm
Oct 06 11:31:56 mypine64 audit[13793]: USER_END pid=13793 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='op=PAM:session_close grantors=pam_keyinit,pam_keyinit,pam_limits,pam_systemd,pam_unix,pam_umask acct="gdm" exe="/usr/libexec/gdm-session-worker" hostnam>
Oct 06 11:31:56 mypine64 audit[13793]: CRED_DISP pid=13793 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_permit acct="gdm" exe="/usr/libexec/gdm-session-worker" hostname=mypine64 addr=? terminal=/dev/tty1 res=success'
Oct 06 11:31:56 mypine64 gdm[13733]: GdmDisplay: display lasted 1.191342 seconds
mripard commented 5 years ago

You shouldn't use the fbdev variant but the Wayland's if you want to use GBM.

Le lun. 8 oct. 2018 à 18:03, John P Masseria. notifications@github.com a écrit :

Thank you for all your assistance so far. My goal is to get desktop running under Fedora 28 on a Pine A64+ SBC. I have successfully built and loaded the Mali r8p1 Kernel Module:

[ 15.433268] Allwinner sunXi mali glue initialized [ 15.439773] Mali: [ 15.439783] Found Mali GPU Mali-400 MP r1p1 [ 15.466114] Mali: [ 15.466139] 2+0 PP cores initialized [ 15.488204] Mali: [ 15.488214] Mali device driver loaded

Should I worry that it says r1p1?

I have also copied the r8p1 Mali OpenGL ES userspace libraries:

sudo cp -a mali-blobs/r8p1/arm64/fbdev/lib* /usr/lib64

I copied them to /usr/lib64 because this is a 64-bit ARM platform. Initially copying them to /usr/lib had no effect. This copy overwrote some links that were already present in lib64 directory.

I was getting some SELINUX AVC denied errors that I addresses using audit2allow.

However, gdm keeps erroring on me saying:

Oct 05 15:25:06 mypine64 systemd[1]: Started Session c87 of user gdm. Oct 05 15:25:06 mypine64 gdm-launch-environment][11771]: pam_unix(gdm-launch-environment:session): session opened for user gdm by (uid=0) Oct 05 15:25:06 mypine64 audit[11771]: USER_START pid=11771 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='op=PAM:session_open grantors=pam_keyinit,pam_keyinit,pam_limits,pam_systemd,pam_unix,pam_umask acct="gdm" exe="/usr/libexec/gdm-session-worker" hostna> Oct 05 15:25:06 mypine64 systemd[10990]: selinux: avc: denied { status } for auid=n/a uid=42 gid=42 cmdline="/usr/libexec/gdm-wayland-session gnome-session --autostart /usr/share/gdm/greeter/autostart" scontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=unconfined_u:unconfined_r:unconfine> Oct 05 15:25:06 mypine64 systemd[10990]: selinux: avc: denied { reload } for auid=n/a uid=42 gid=42 cmdline="/usr/libexec/gnome-session-binary --autostart /usr/share/gdm/greeter/autostart" scontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.> Oct 05 15:25:06 mypine64 systemd[10990]: selinux: avc: denied { reload } for auid=n/a uid=42 gid=42 cmdline="/usr/libexec/gnome-session-binary --autostart /usr/share/gdm/greeter/autostart" scontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.> Oct 05 15:25:06 mypine64 systemd[10990]: selinux: avc: denied { reload } for auid=n/a uid=42 gid=42 cmdline="/usr/libexec/gnome-session-binary --autostart /usr/share/gdm/greeter/autostart" scontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.> Oct 05 15:25:06 mypine64 systemd[10990]: selinux: avc: denied { reload } for auid=n/a uid=42 gid=42 cmdline="/usr/libexec/gnome-session-binary --autostart /usr/share/gdm/greeter/autostart" scontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.> Oct 05 15:25:06 mypine64 systemd[10990]: selinux: avc: denied { reload } for auid=n/a uid=42 gid=42 cmdline="/usr/libexec/gnome-session-binary --autostart /usr/share/gdm/greeter/autostart" scontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.> Oct 05 15:25:06 mypine64 gnome-session[11778]: _IceTransmkdir: Owner of /tmp/.ICE-unix should be set to root Oct 05 15:25:07 mypine64 systemd[10990]: selinux: avc: denied { reload } for auid=n/a uid=42 gid=42 cmdline="/usr/libexec/gnome-session-binary --autostart /usr/share/gdm/greeter/autostart" scontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.> Oct 05 15:25:07 mypine64 gnome-shell[11786]: Failed to create backend: Could not find a primary drm kms device Oct 05 15:25:07 mypine64 gnome-session[11778]: gnome-session-binary[11778]: WARNING: App 'org.gnome.Shell.desktop' exited with code 1 Oct 05 15:25:07 mypine64 gnome-session-binary[11778]: WARNING: App 'org.gnome.Shell.desktop' exited with code 1 Oct 05 15:25:07 mypine64 gnome-session-binary[11778]: Unrecoverable failure in required component org.gnome.Shell.desktop Oct 05 15:25:07 mypine64 gdm-launch-environment][11771]: pam_unix(gdm-launch-environment:session): session closed for user gdm Oct 05 15:25:07 mypine64 audit[11771]: USER_END pid=11771 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='op=PAM:session_close grantors=pam_keyinit,pam_keyinit,pam_limits,pam_systemd,pam_unix,pam_umask acct="gdm" exe="/usr/libexec/gdm-session-worker" hostnam> Oct 05 15:25:07 mypine64 audit[11771]: CRED_DISP pid=11771 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_permit acct="gdm" exe="/usr/libexec/gdm-session-worker" hostname=mypine64 addr=? terminal=/dev/tty1 res=success' Oct 05 15:25:07 mypine64 gdm[11767]: GdmDisplay: display lasted 1.225508 seconds Oct 05 15:25:07 mypine64 systemd-logind[457]: Removed session c87. Oct 05 15:25:07 mypine64 gdm[11767]: Child process -11775 was already dead. Oct 05 15:25:07 mypine64 gdm[11767]: Child process 11771 was already dead. Oct 05 15:25:07 mypine64 gdm[11767]: Unable to kill session worker process

I haven't been able to figure out how to eliminate these remaining AVC DENIED SELINUX errors. I turned off SELINUX enforcement and gdm still wouldn't initialize.

Do I need to turn off drm and/or kms? I've seen a posting on that for an NVIDIA GPU, but I don't know the equivalent setting for Mali. Again, sorry for the newbie questions.

Oct 05 15:25:07 mypine64 gnome-shell[11786]: Failed to create backend: Could not find a primary drm kms device

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/mripard/sunxi-mali/issues/52#issuecomment-427890336, or mute the thread https://github.com/notifications/unsubscribe-auth/AAWenwldp4zaI00xO9I_s0ZSkBkCNwpCks5ui3dqgaJpZM4W3khm .

HeatfanJohn commented 5 years ago

@mripard Thank you ... I'll switch to r6p2 which has wayland support.

I'm also reading: https://events.static.linuxfound.org/sites/events/files/slides/brezillon-drm-kms.pdf

To learn more about all of this terminology.

HeatfanJohn commented 5 years ago

@mripard I have switched to using the r6p2 kernel module and copied the wayland r6p2 libs into /usr/lib64/, but I'm still getting Failed to create backend: Could not find a primary drm kms device.

I don't see how to tell gdm / gnome in Fedora 28 to use the wayland libs directly. Has anyone done this?

mripard commented 5 years ago

Do you have the KMS driver running?

HeatfanJohn commented 5 years ago

Do you have the KMS driver running?

@mripard Thank you, can you point me to instructions on how to do that?

Whoops, do you mean that I need a functional DRM driver?

In order to build the kernel module, you'll need a functional DRM driver. 

Then is this what I need to do, from #45 (/dev/dri/card0 not created):

$ sudo modprobe sun4i-drm
$ sudo modprobe sun4i-frontend
$ sudo modprobe sun4i-backend

However, that issue said that he didn't need to get /dev/dri/card0 created, he just need to use /dev/mali directly.

HeatfanJohn commented 5 years ago

Hi @mripard Should I be trying to load sunxi-mali/r8p1/src/egl/x11/drm_module/mali_drm/ ??

If yes, I get the following when I try to make it:

make ARCH=arm64 -C /lib/modules/4.18.9-200.fc28.aarch64/build M=/home/johnma/sunxi-mali/r8p1/src/egl/x11/drm_module/mali_drm modules
make[1]: Entering directory '/usr/src/kernels/4.18.9-200.fc28.aarch64'
  CC [M]  /home/johnma/sunxi-mali/r8p1/src/egl/x11/drm_module/mali_drm/mali/mali_drv.o
/home/johnma/sunxi-mali/r8p1/src/egl/x11/drm_module/mali_drm/mali/mali_drv.c:13:10: fatal error: drmP.h: No such file or directory
 #include "drmP.h"
          ^~~~~~~~
compilation terminated.
make[2]: *** [scripts/Makefile.build:318: /home/johnma/sunxi-mali/r8p1/src/egl/x11/drm_module/mali_drm/mali/mali_drv.o] Error 1
make[1]: *** [Makefile:1508: _module_/home/johnma/sunxi-mali/r8p1/src/egl/x11/drm_module/mali_drm] Error 2
make[1]: Leaving directory '/usr/src/kernels/4.18.9-200.fc28.aarch64'
make: *** [Makefile:69: all] Error 2

Sorry for being a pest, but I really lost with all of this new terminology ... DRM / KMS.

Am I correct that for the sun4i-drm driver to work I need to add the HDMI and backend items to my DTB for my A64 device?

HeatfanJohn commented 5 years ago

Chating with people on #Linux-sunxi I now understand that support for HDMI on the A64 chip is planned for Linux Kernel 4.20 which should now be actively being worked on since 4.19 just got released.

Hopefully I'll be able to get a fairly stable release to test out soon ...

HeatfanJohn commented 5 years ago

To update this with my most recent results, I've been successfully getting display output on the HDMI output port of my PineA64+ device, getting GDM to start and also been able to run remote windows using the "X" windowing system using this patched 4.19 kernel from @anarsoul and this kernel config.

The steps to reproduce this are basically to clone @anarsoul's repository, checkout branch sunxi64-4.19, copy @anasoul's config to .config, perform make oldconfig, make -j5 Image, make modules, sudo make modules_install, sudo make install, make dtbs, make dtbs_install, copy the dtb for the Pine64+ board to the /boot directory, reboot and select this new kernel in GRUB.