Xorg Segmentation fault on Hisilicon D05 board (arm64)

Bug #1691991 reported by Zhanglei Mao
20
This bug affects 1 person
Affects Status Importance Assigned to Milestone
xorg (Ubuntu)
Invalid
Undecided
Daniel Axtens

Bug Description

ubuntu@ubuntu:~$ sudo /usr/lib/xorg/Xorg
[sudo] password for ubuntu:

X.Org X Server 1.18.4
Release Date: 2016-07-19
X Protocol Version 11, Revision 0
Build Operating System: Linux 4.4.0-45-generic aarch64 Ubuntu
Current Operating System: Linux ubuntu 4.10.0-20.22-generic #22+pearl.2-Ubuntu SMP Thu Apr 27 20:23:08 UTC 2017 aarch64
Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.10.0-20.22-generic root=UUID=eee681c5-04ce-4cd0-a004-cae6717961ce ro debug earlycon=pl011,mmio,0x602B0000 console=tty0
Build Date: 02 November 2016 10:05:28PM
xorg-server 2:1.18.4-0ubuntu0.2 (For technical support please see http://www.ubuntu.com/support)
Current version of pixman: 0.33.6
 Before reporting problems, check http://wiki.x.org
 to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
 (++) from command line, (!!) notice, (II) informational,
 (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Fri May 19 18:10:13 2017
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
pci id for fd 10: 19e5:1711, driver (null)
EGL_MESA_drm_image required.
(EE)
(EE) Backtrace:
(EE) 0: /usr/lib/xorg/Xorg (xorg_backtrace+0x58) [0xaaaad7f1cc48]
(EE)
(EE) Segmentation fault at address 0xa0
(EE)
Fatal server error:
(EE) Caught signal 11 (Segmentation fault). Server aborting
(EE)
(EE)
Please consult the The X.Org Foundation support
  at http://wiki.x.org
 for help.
(EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
(EE)
(EE) Server terminated with error (1). Closing log file.
Aborted (core dumped)
ubuntu@ubuntu:~$

Tags: patch
Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :
Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :
Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :
Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :
Download full text (11.3 KiB)

backtrace by apport-retrace

crash buntu:/var/crash# apport-retrace --stdout /var/crash/_usr_lib_xorg_Xorg.0.c
gpgv: Signature made Tue 01 Nov 2016 04:15:19 PM CST using RSA key ID A88984DC
gpgv: Can't check signature: public key not found
dpkg-source: warning: failed to verify signature on ./xorg-server_1.18.4-0ubuntu0.2.dsc
dpkg-source: info: extracting xorg-server in xorg-server-1.18.4
dpkg-source: info: unpacking xorg-server_1.18.4.orig.tar.gz
dpkg-source: info: applying xorg-server_1.18.4-0ubuntu0.2.diff.gz
dpkg-source: info: upstream files that have been modified:
 xorg-server-1.18.4/.dir-locals.el
 xorg-server-1.18.4/ChangeLog
 xorg-server-1.18.4/config/dbus-api
 xorg-server-1.18.4/damageext/damageext.h
 xorg-server-1.18.4/doc/c-extensions
 xorg-server-1.18.4/dri3/dri3int.h
 xorg-server-1.18.4/fix-miregion
 xorg-server-1.18.4/fix-miregion-private
 xorg-server-1.18.4/fix-patch-whitespace
 xorg-server-1.18.4/fix-region
 xorg-server-1.18.4/hw/kdrive/Xkdrive.man
 xorg-server-1.18.4/hw/kdrive/fbdev/Xfbdev.man
 xorg-server-1.18.4/hw/xfree86/os-support/shared/platform_noop.c
 xorg-server-1.18.4/hw/xquartz/GL/glcontextmodes.c
 xorg-server-1.18.4/hw/xquartz/GL/glcontextmodes.h
 xorg-server-1.18.4/hw/xwin/winclipboard/internal.h
 xorg-server-1.18.4/xkb/XKM_file_format.txt
W: Can't drop privileges for downloading as file 'xorg-server_1.18.4-0ubuntu0.2.dsc' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)
--- stack trace ---
#0 0x0000ffff9220b528 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
        _sys_result = 0
        pd = 0xffff91fa7000
        pid = 7478
        selftid = 7478
#1 0x0000ffff9220c9e0 in __GI_abort () at abort.c:89
        save_stage = 2
        act = {__sigaction_handler = {sa_handler = 0xa6530de400000000, sa_sigaction = 0xa6530de400000000}, sa_mask = {__val = {2676586395008836901, 2676586395008836901, 2594, 6730122966621824347, 32, 2910292295676945778, 18446744073709486080, 0, 18446744073709551360, 0, 4616194021471027200, 1024, 4616194021471028224, 0, 4616194021471028225, 4616194021471028225}}, sa_flags = -1054354032, sa_restorer = 0xaaaac122fa28 <System>}
        sigs = {__val = {32, 0 <repeats 15 times>}}
#2 0x0000aaaac122fa28 in OsAbort () at ../../os/utils.c:1408
No locals.
#3 0x0000aaaac1116364 in ddxGiveUp (error=error@entry=EXIT_ERR_ABORT) at ../../../../hw/xfree86/common/xf86Init.c:1102
        i = <optimized out>
#4 0x0000aaaac111643c in AbortDDX (error=error@entry=EXIT_ERR_ABORT) at ../../../../hw/xfree86/common/xf86Init.c:1146
        i = <optimized out>
#5 0x0000aaaac12358e0 in AbortServer () at ../../os/log.c:874
No locals.
#6 0x0000aaaac1236624 in FatalError (f=f@entry=0xaaaac1266988 "Caught signal %d (%s). Server aborting\n") at ../../os/log.c:1015
        args = {__stack = 0xffffd085b680, __gr_top = 0xffffd085b680, __vr_top = 0xffffd085b640, __gr_offs = -56, __vr_offs = -128}
        args2 = {__stack = 0xffffd085b680, __gr_top = 0xffffd085b680, __vr_top = 0xffffd085b640, __gr_offs = -56, __vr_offs = -128}
        beenhere = 1
#7 0x0000aaaac122d294 in OsSigHandler (signo=11, sip=0xffffd085b6a0, unused=<optimized out>) at ../../os/osinit.c:150
  ...

Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :
Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :

Pual Liu analyse for this bug, he provide a temporarily fix but it seems not works (no output in monitor)
-------------------------------------------
Hi all,

I look deep into the problem and I'm not sure if it is the kernel issue or Xorg issue.
We might need to spend more time on this issue to tracing into the Xorg code.
The problem happens to the modesetting driver in Xorg. So if you remove /usr/lib/xorg/modules/drivers/modesetting_drv.so it will use the fbdev driver and the X will start.

When modesetting is there, we got a SIGSEGV. And it happens to a line that shouldn't have any problem.

void
RRSetChanged(ScreenPtr pScreen)
{
   /* set changed bits on the master screen only */
   ScreenPtr master;
   rrScrPriv(pScreen);
   rrScrPrivPtr mastersp;

   if (pScreen->isGPU) {
       master = pScreen->current_master;
       if (!master)
           return;
       mastersp = rrGetScrPriv(master);
   }
   else {
       master = pScreen;
       mastersp = pScrPriv;
   }

   mastersp->changed = TRUE; // <---- CRASH here
}

So we need to figure out why mastersp disappeared.
There might be some race conditions here.
--------------------------------------------------------------------

Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :

This final goal is "Ubuntu 16.04 support x-Window by modesetting (modesetting_drv.so) driver"

Notes: From xserver source code,it only use modeset. For the display card hardware it is a display controller without GPU,the call paths is xserver->modesetting_drv(userspace)->libdrm(userspace)->drm(kernel).

Revision history for this message
Daniel Axtens (daxtens) wrote :

Hi,

What happens if you remove the fb driver - uninstall the xserver-xorg-video-fbdev package?

Also, I'm not sure what (if any) changes have been made in the kernel version you're running - the 'pearl' version - but are you able to try against a mainline kernel?

Regards,
Daniel

Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :
Download full text (7.1 KiB)

The below is testing after remove of "xserver-xorg-video-fbdev package"

ubuntu@ubuntu:/usr/lib/xorg/modules/drivers$ sudo /usr/lib/xorg/Xorg

X.Org X Server 1.18.4
Release Date: 2016-07-19
X Protocol Version 11, Revision 0
Build Operating System: Linux 4.4.0-45-generic aarch64 Ubuntu
Current Operating System: Linux ubuntu 4.10.0-20.22-generic #22+pearl.2-Ubuntu SMP Thu Apr 27 20:23:08 UTC 2017 aarch64
Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.10.0-20.22-generic root=UUID=eee681c5-04ce-4cd0-a004-cae6717961ce ro debug earlycon=pl011,mmio,0x602B0000 console=tty0
Build Date: 02 November 2016 10:05:28PM
xorg-server 2:1.18.4-0ubuntu0.2 (For technical support please see http://www.ubuntu.com/support)
Current version of pixman: 0.33.6
 Before reporting problems, check http://wiki.x.org
 to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
 (++) from command line, (!!) notice, (II) informational,
 (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Tue May 30 17:45:40 2017
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
(EE)
Fatal server error:
(EE) no screens found(EE)
(EE)
Please consult the The X.Org Foundation support
  at http://wiki.x.org
 for help.
(EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
(EE)
(EE) Server terminated with error (1). Closing log file.
ubuntu@ubuntu:/usr/lib/xorg/modules/drivers$

ubuntu@ubuntu:/usr/lib/xorg/modules/drivers$ less /var/log/Xorg.0.log
[1029553.709]
X.Org X Server 1.18.4
Release Date: 2016-07-19
[1029553.709] X Protocol Version 11, Revision 0
[1029553.709] Build Operating System: Linux 4.4.0-45-generic aarch64 Ubuntu
[1029553.709] Current Operating System: Linux ubuntu 4.10.0-20.22-generic #22+pearl.2-Ubuntu SMP Thu Apr 27 20:23:08 UTC 2017 aarch64
[1029553.709] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.10.0-20.22-generic root=UUID=eee681c5-04ce-4cd0-a004-cae6717961ce ro debug earlycon=pl011,mmio,0x602B0000 console=tty0
[1029553.709] Build Date: 02 November 2016 10:05:28PM
[1029553.709] xorg-server 2:1.18.4-0ubuntu0.2 (For technical support please see http://www.ubuntu.com/support)
[1029553.709] Current version of pixman: 0.33.6
[1029553.709] Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
[1029553.709] Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[1029553.709] (==) Log file: "/var/log/Xorg.0.log", Time: Tue May 30 17:45:40 2017
[1029553.709] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[1029553.710] (==) No Layout section. Using the first Screen section.
[1029553.710] (==) No screen section available. Using defaults.
[1029553.710] (**) |-->Screen "Default Screen Section" (0)
[1029553.710] (**) | |-->Monitor "<default monitor>"
[1029553.710] (==) No monitor specified for screen "Default Screen Section".
        Using a default monitor configuration.
[1029553.710] (==) Automatically...

Read more...

Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :

For the mainline kernel (general kernel from Ubuntu 16.04.02 AM64) was not tested in case we are not supported for Hisilicon D05 board.

We also do some basic fbdev and modesetting testing on this kerenl by pass Xserver, it seems works well and so we tend to think this is caused by Xorg or driver of Xorg.

Revision history for this message
Daniel Axtens (daxtens) wrote :

Hi,

This is what I have figured out so far.

For some reason the initial probing done by the modesetting driver fails. This is part of the platform device probing stage. This failure means the device is not claimed by the modesetting driver as a 'regular' screen. Instead it is claimed by the fbdev driver. The modesetting driver then claims the platform device as a 'GPU' device. It shouldn't do that: the GPU device init is what causes the crash.

What I am still trying to figure out is why the initial probing fails. This is difficult to figure out from the core dump, so I have attached a patch for xorg-server that should help. With this patch I should be able to figure out what part of the probe doesn't go as expected.

Please let me know if you have any trouble applying the patch.

Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote : Re: [Bug 1691991] Re: Xorg Segmentation fault on Hisilicon D05 board (arm64)
Download full text (3.7 KiB)

hi Daniel,

Thank you very much for you mail and I am very glad you are debugging this
reported bug.

 Can you please provide me a bit more guide or guide link which I can apply
this patch and compile out the newly testing Xorg? Sorry I am not so
familiar with our building/compile tools.

thanks,
Mao

On Wed, May 31, 2017 at 3:07 PM, Daniel Axtens <email address hidden>
wrote:

> Hi,
>
> This is what I have figured out so far.
>
> For some reason the initial probing done by the modesetting driver
> fails. This is part of the platform device probing stage. This failure
> means the device is not claimed by the modesetting driver as a 'regular'
> screen. Instead it is claimed by the fbdev driver. The modesetting
> driver then claims the platform device as a 'GPU' device. It shouldn't
> do that: the GPU device init is what causes the crash.
>
> What I am still trying to figure out is why the initial probing fails.
> This is difficult to figure out from the core dump, so I have attached a
> patch for xorg-server that should help. With this patch I should be able
> to figure out what part of the probe doesn't go as expected.
>
> Please let me know if you have any trouble applying the patch.
>
> ** Patch added: "patch to enable extra debugging"
> https://bugs.launchpad.net/ubuntu/+source/xorg/+bug/
> 1691991/+attachment/4886582/+files/debug.patch
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1691991
>
> Title:
> Xorg Segmentation fault on Hisilicon D05 board (arm64)
>
> Status in xorg package in Ubuntu:
> New
>
> Bug description:
> ubuntu@ubuntu:~$ sudo /usr/lib/xorg/Xorg
> [sudo] password for ubuntu:
>
> X.Org X Server 1.18.4
> Release Date: 2016-07-19
> X Protocol Version 11, Revision 0
> Build Operating System: Linux 4.4.0-45-generic aarch64 Ubuntu
> Current Operating System: Linux ubuntu 4.10.0-20.22-generic
> #22+pearl.2-Ubuntu SMP Thu Apr 27 20:23:08 UTC 2017 aarch64
> Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.10.0-20.22-generic
> root=UUID=eee681c5-04ce-4cd0-a004-cae6717961ce ro debug
> earlycon=pl011,mmio,0x602B0000 console=tty0
> Build Date: 02 November 2016 10:05:28PM
> xorg-server 2:1.18.4-0ubuntu0.2 (For technical support please see
> http://www.ubuntu.com/support)
> Current version of pixman: 0.33.6
> Before reporting problems, check http://wiki.x.org
> to make sure that you have the latest version.
> Markers: (--) probed, (**) from config file, (==) default setting,
> (++) from command line, (!!) notice, (II) informational,
> (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
> (==) Log file: "/var/log/Xorg.0.log", Time: Fri May 19 18:10:13 2017
> (==) Using system config directory "/usr/share/X11/xorg.conf.d"
> pci id for fd 10: 19e5:1711, driver (null)
> EGL_MESA_drm_image required.
> (EE)
> (EE) Backtrace:
> (EE) 0: /usr/lib/xorg/Xorg (xorg_backtrace+0x58) [0xaaaad7f1cc48]
> (EE)
> (EE) Segmentation fault at address 0xa0
> (EE)
> Fatal server error:
> (EE) Caught signal 11 (Segmentation fault). Server aborting
> (EE)
> (EE)
> Plea...

Read more...

Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :
Download full text (4.4 KiB)

hi Daniel,

If tt is more easy and save time for you. I can share my ssh remote access
to you for D05 testing environment, so you can directly patching and
testing over it.

thanks,
Mao

On Wed, May 31, 2017 at 3:32 PM, Zhanglei Mao <email address hidden>
wrote:

> hi Daniel,
>
> Thank you very much for you mail and I am very glad you are debugging this
> reported bug.
>
> Can you please provide me a bit more guide or guide link which I can
> apply this patch and compile out the newly testing Xorg? Sorry I am not
> so familiar with our building/compile tools.
>
> thanks,
> Mao
>
>
>
>
>
>
>
> On Wed, May 31, 2017 at 3:07 PM, Daniel Axtens <
> <email address hidden>> wrote:
>
>> Hi,
>>
>> This is what I have figured out so far.
>>
>> For some reason the initial probing done by the modesetting driver
>> fails. This is part of the platform device probing stage. This failure
>> means the device is not claimed by the modesetting driver as a 'regular'
>> screen. Instead it is claimed by the fbdev driver. The modesetting
>> driver then claims the platform device as a 'GPU' device. It shouldn't
>> do that: the GPU device init is what causes the crash.
>>
>> What I am still trying to figure out is why the initial probing fails.
>> This is difficult to figure out from the core dump, so I have attached a
>> patch for xorg-server that should help. With this patch I should be able
>> to figure out what part of the probe doesn't go as expected.
>>
>> Please let me know if you have any trouble applying the patch.
>>
>> ** Patch added: "patch to enable extra debugging"
>> https://bugs.launchpad.net/ubuntu/+source/xorg/+bug/1691991
>> /+attachment/4886582/+files/debug.patch
>>
>> --
>> You received this bug notification because you are subscribed to the bug
>> report.
>> https://bugs.launchpad.net/bugs/1691991
>>
>> Title:
>> Xorg Segmentation fault on Hisilicon D05 board (arm64)
>>
>> Status in xorg package in Ubuntu:
>> New
>>
>> Bug description:
>> ubuntu@ubuntu:~$ sudo /usr/lib/xorg/Xorg
>> [sudo] password for ubuntu:
>>
>> X.Org X Server 1.18.4
>> Release Date: 2016-07-19
>> X Protocol Version 11, Revision 0
>> Build Operating System: Linux 4.4.0-45-generic aarch64 Ubuntu
>> Current Operating System: Linux ubuntu 4.10.0-20.22-generic
>> #22+pearl.2-Ubuntu SMP Thu Apr 27 20:23:08 UTC 2017 aarch64
>> Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.10.0-20.22-generic
>> root=UUID=eee681c5-04ce-4cd0-a004-cae6717961ce ro debug
>> earlycon=pl011,mmio,0x602B0000 console=tty0
>> Build Date: 02 November 2016 10:05:28PM
>> xorg-server 2:1.18.4-0ubuntu0.2 (For technical support please see
>> http://www.ubuntu.com/support)
>> Current version of pixman: 0.33.6
>> Before reporting problems, check http://wiki.x.org
>> to make sure that you have the latest version.
>> Markers: (--) probed, (**) from config file, (==) default setting,
>> (++) from command line, (!!) notice, (II) informational,
>> (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
>> (==) Log file: "/var/log/Xorg.0.log", Time: Fri May 19 18:10:13 2017
>> (==) Using system config directory "/usr/share/X11/xorg.conf...

Read more...

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "patch to enable extra debugging" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Daniel Axtens (daxtens) wrote :

Hi Mao,

Yes, remote access would be the fastest way to debug this.

You can contact me by email - <email address hidden>.

Regards,
Daniel

Revision history for this message
Daniel Axtens (daxtens) wrote :

OK, I have made some progress on this:

The busid reported by libdrm on the arm64 system is "0007:a1:00.0"
The busid reported by libdrm on a amd64 system is "pci:0000:00:02.0"

The "pci:" prefix is missing on arm64. I think this leads to the segfault on arm64 as X tests for the prefix.

This little C program below extracts the information and demonstrates the difference.

I will follow up why this is happening.

Regards,
Daniel

#include <xf86drm.h>
#include <unistd.h>
#include "stdio.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int main() {
 char *path="/dev/dri/card0";
 drmSetVersion sv;
 char *buf;
 int fd;
 int err = 0;

 fd = open(path, O_RDWR, O_CLOEXEC);

 sv.drm_di_major = 1;
 sv.drm_di_minor = 4;
 sv.drm_dd_major = -1; /* Don't care */
 sv.drm_dd_minor = -1; /* Don't care */

 err = drmSetInterfaceVersion(fd, &sv);

 buf = drmGetBusid(fd);
 printf("busid: '%s'\n", buf);
 drmFreeBusid(buf);
 close(fd);
 return (err == 0);
}

Revision history for this message
Daniel Axtens (daxtens) wrote :

Ok, so I think part of the problem is that the kernel hibmc driver needs to use a set_busid function from the drm core. I've simulated this change in the debugger, and it seems to at least prevent the crash. (It doesn't seem to be enough for the server to work, still working on that.)

Here's a patch - we can discuss the best way to build and install it.

Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :
Download full text (3.4 KiB)

Daniel,

It is really good. For patch driver and new kernel buiding, I cc Dann on
the mail too, he is our engineer for this enablement project with
Hisilicon. This is pearl kernel was build by him too.

Dann,

Can you patch and build out a new kernel for us or help Daniel to build a
new testing kernel.

For the new kernel install, I should be able to set it up.

thanks,
Mao

On Thu, Jun 1, 2017 at 7:56 PM, Daniel Axtens <email address hidden>
wrote:

> Ok, so I think part of the problem is that the kernel hibmc driver needs
> to use a set_busid function from the drm core. I've simulated this
> change in the debugger, and it seems to at least prevent the crash. (It
> doesn't seem to be enough for the server to work, still working on
> that.)
>
> Here's a patch - we can discuss the best way to build and install it.
>
> ** Patch added: "0001-Use-standard-busid-function-from-drm-core.patch"
> https://bugs.launchpad.net/ubuntu/+source/xorg/+bug/
> 1691991/+attachment/4887275/+files/0001-Use-standard-busid-
> function-from-drm-core.patch
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1691991
>
> Title:
> Xorg Segmentation fault on Hisilicon D05 board (arm64)
>
> Status in xorg package in Ubuntu:
> New
>
> Bug description:
> ubuntu@ubuntu:~$ sudo /usr/lib/xorg/Xorg
> [sudo] password for ubuntu:
>
> X.Org X Server 1.18.4
> Release Date: 2016-07-19
> X Protocol Version 11, Revision 0
> Build Operating System: Linux 4.4.0-45-generic aarch64 Ubuntu
> Current Operating System: Linux ubuntu 4.10.0-20.22-generic
> #22+pearl.2-Ubuntu SMP Thu Apr 27 20:23:08 UTC 2017 aarch64
> Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.10.0-20.22-generic
> root=UUID=eee681c5-04ce-4cd0-a004-cae6717961ce ro debug
> earlycon=pl011,mmio,0x602B0000 console=tty0
> Build Date: 02 November 2016 10:05:28PM
> xorg-server 2:1.18.4-0ubuntu0.2 (For technical support please see
> http://www.ubuntu.com/support)
> Current version of pixman: 0.33.6
> Before reporting problems, check http://wiki.x.org
> to make sure that you have the latest version.
> Markers: (--) probed, (**) from config file, (==) default setting,
> (++) from command line, (!!) notice, (II) informational,
> (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
> (==) Log file: "/var/log/Xorg.0.log", Time: Fri May 19 18:10:13 2017
> (==) Using system config directory "/usr/share/X11/xorg.conf.d"
> pci id for fd 10: 19e5:1711, driver (null)
> EGL_MESA_drm_image required.
> (EE)
> (EE) Backtrace:
> (EE) 0: /usr/lib/xorg/Xorg (xorg_backtrace+0x58) [0xaaaad7f1cc48]
> (EE)
> (EE) Segmentation fault at address 0xa0
> (EE)
> Fatal server error:
> (EE) Caught signal 11 (Segmentation fault). Server aborting
> (EE)
> (EE)
> Please consult the The X.Org Foundation support
> at http://wiki.x.org
> for help.
> (EE) Please also check the log file at "/var/log/Xorg.0.log" for
> additional information.
> (EE)
> (EE) Server terminated with error (1). Closing log file.
> Aborted (core dumped)
> ubuntu@ubuntu:~$
>
> To manage notif...

Read more...

Revision history for this message
dann frazier (dannf) wrote :

On Thu, Jun 1, 2017 at 7:27 AM, Zhanglei Mao <email address hidden> wrote:
> Daniel,
>
> It is really good. For patch driver and new kernel buiding, I cc Dann on the
> mail too, he is our engineer for this enablement project with Hisilicon.
> This is pearl kernel was build by him too.
>
> Dann,
>
> Can you patch and build out a new kernel for us or help Daniel to build a
> new testing kernel.

The latest zesty kernel works fine on the HiSilicon board, I'd suggest
patching that for your testing.

  -dann

Revision history for this message
Daniel Axtens (daxtens) wrote :

Hi,

On further investigation it turns out that one large difference between my x86 system and the arm64 system is they way the vga arbiter is operating in the kernel. This means that the vga card isn't labelled as the "boot vga" card, which affects how it's picked up by X.

On the HiSilicon board, I'm seeing:

[ 0.815343] pci 0007:a1:00.0: vgaarb: VGA device added: decodes=io+mem,owns=none,locks=none
[ 0.815355] pci 0007:a1:00.0: vgaarb: bridge control possible
[ 0.815360] vgaarb: loaded

On an x86 vm I'm seeing:

[ 0.390696] vgaarb: setting as boot device: PCI:0000:00:02.0
[ 0.391245] vgaarb: device added: PCI:0000:00:02.0,decodes=io+mem,owns=io+mem,locks=none
[ 0.393421] vgaarb: loaded
[ 0.393811] vgaarb: bridge control possible 0000:00:02.0

(The difference in the format is due to different kernel versions)

Looking at the kernel source, it looks like the owns= section is getting blanked because of the bridge that the VGA card is sitting behind.

From drivers/gpu/vga/vgaarb.c:

        /* Mark that we "own" resources based on our enables, we will
         * clear that below if the bridge isn't forwarding
         */
        pci_read_config_word(pdev, PCI_COMMAND, &cmd);
        if (cmd & PCI_COMMAND_IO)
                vgadev->owns |= VGA_RSRC_LEGACY_IO;
        if (cmd & PCI_COMMAND_MEMORY)
                vgadev->owns |= VGA_RSRC_LEGACY_MEM;

        /* Check if VGA cycles can get down to us */
        bus = pdev->bus;
        while (bus) {
                bridge = bus->self;
                if (bridge) {
                        u16 l;

                        pci_read_config_word(bridge, PCI_BRIDGE_CONTROL, &l);
                        if (!(l & PCI_BRIDGE_CTL_VGA)) {
                                vgadev->owns = 0;
                                break;
                        }
                }
                bus = bus->parent;
        }

        /* Deal with VGA default device. Use first enabled one
         * by default if arch doesn't have it's own hook
         */
        if (vga_default == NULL &&
            ((vgadev->owns & VGA_RSRC_LEGACY_MASK) == VGA_RSRC_LEGACY_MASK)) {
                vgaarb_info(&pdev->dev, "setting as boot VGA device\n");
                vga_set_default_device(pdev);

Perhaps X should be be picking up the card through PCI probing on arm64 rather than platform probing which seems to rely a bit on boot VGA devices. I will check this. But first I just wanted to check the PCI topology: is the card behind any unusual bridges or switches?

I can write some kernel code next week to find out specifically why this isn't being picked up, but I thought I'd check for HW quirks first.

Revision history for this message
Daniel Axtens (daxtens) wrote :

Dann: thanks, will do that.

Regards,
Daniel

Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :

Dannie,

For new kernel building, please note that is not a our general/stand zesty, I though Dann use a another kernel source tree or use may patches specified for D05 board. I am not familiar with it and please contact with Dann too.

thanks,
Mao

Revision history for this message
Daniel Axtens (daxtens) wrote :

Hi,

I can get xorg working if I do these 2 things:

1) Edit memory with gdb to add "pci:" to bus id. This is what the kernel patch should do. I will test the patch soon, I am just waiting for the kernel to build.

2) Install this /etc/X11/xorg.conf:

Section "ServerFlags"
        Option "AutoAddGPU" "off"
EndSection

Section "Device"
        Identifier "dja"
        Driver "modesetting"
        BusID "pci:0007:161:0:0"
EndSection

This does 2 things:
 - AutoAddGPU prevents the card from falsely being marked as GPU. I am not yet fully sure why that is required.

 - The Device section then specifies the busid and driver specifically. This forces the driver to be loaded correctly.

This Xorg configuration should not be required in the long term. There are obviously still some bugs to be fixed. But, I wanted to let you know that progress was being made and give you good news.

Attached is a screenshot of Xeyes over KVM.

Regards,
Daniel

Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :
Download full text (3.7 KiB)

hi Daniel,

Fantastic! I is a really good news for me.

thanks,
Mao

On Mon, Jun 5, 2017 at 12:46 PM, Daniel Axtens <email address hidden>
wrote:

> Hi,
>
> I can get xorg working if I do these 2 things:
>
> 1) Edit memory with gdb to add "pci:" to bus id. This is what the kernel
> patch should do. I will test the patch soon, I am just waiting for the
> kernel to build.
>
> 2) Install this /etc/X11/xorg.conf:
>
> Section "ServerFlags"
> Option "AutoAddGPU" "off"
> EndSection
>
> Section "Device"
> Identifier "dja"
> Driver "modesetting"
> BusID "pci:0007:161:0:0"
> EndSection
>
>
> This does 2 things:
> - AutoAddGPU prevents the card from falsely being marked as GPU. I am not
> yet fully sure why that is required.
>
> - The Device section then specifies the busid and driver specifically.
> This forces the driver to be loaded correctly.
>
> This Xorg configuration should not be required in the long term. There
> are obviously still some bugs to be fixed. But, I wanted to let you know
> that progress was being made and give you good news.
>
> Attached is a screenshot of Xeyes over KVM.
>
> Regards,
> Daniel
>
> ** Attachment added: "xeyes.png"
> https://bugs.launchpad.net/ubuntu/+source/xorg/+bug/
> 1691991/+attachment/4889182/+files/xeyes.png
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1691991
>
> Title:
> Xorg Segmentation fault on Hisilicon D05 board (arm64)
>
> Status in xorg package in Ubuntu:
> New
>
> Bug description:
> ubuntu@ubuntu:~$ sudo /usr/lib/xorg/Xorg
> [sudo] password for ubuntu:
>
> X.Org X Server 1.18.4
> Release Date: 2016-07-19
> X Protocol Version 11, Revision 0
> Build Operating System: Linux 4.4.0-45-generic aarch64 Ubuntu
> Current Operating System: Linux ubuntu 4.10.0-20.22-generic
> #22+pearl.2-Ubuntu SMP Thu Apr 27 20:23:08 UTC 2017 aarch64
> Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.10.0-20.22-generic
> root=UUID=eee681c5-04ce-4cd0-a004-cae6717961ce ro debug
> earlycon=pl011,mmio,0x602B0000 console=tty0
> Build Date: 02 November 2016 10:05:28PM
> xorg-server 2:1.18.4-0ubuntu0.2 (For technical support please see
> http://www.ubuntu.com/support)
> Current version of pixman: 0.33.6
> Before reporting problems, check http://wiki.x.org
> to make sure that you have the latest version.
> Markers: (--) probed, (**) from config file, (==) default setting,
> (++) from command line, (!!) notice, (II) informational,
> (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
> (==) Log file: "/var/log/Xorg.0.log", Time: Fri May 19 18:10:13 2017
> (==) Using system config directory "/usr/share/X11/xorg.conf.d"
> pci id for fd 10: 19e5:1711, driver (null)
> EGL_MESA_drm_image required.
> (EE)
> (EE) Backtrace:
> (EE) 0: /usr/lib/xorg/Xorg (xorg_backtrace+0x58) [0xaaaad7f1cc48]
> (EE)
> (EE) Segmentation fault at address 0xa0
> (EE)
> Fatal server error:
> (EE) Caught signal 11 (Segmentation fault). Server aborting
> (EE)
> (EE)
> Please consult the The X.Org Foundation support
> at http://wiki.x.o...

Read more...

Daniel Axtens (daxtens)
Changed in xorg (Ubuntu):
assignee: nobody → Daniel Axtens (daxtens)
Revision history for this message
Daniel Axtens (daxtens) wrote :

Hi Mao,

I have looked at the PCI setup a bit more closely: the VGA card is behind a PCI bridge which does not advertise the PCI_BRIDGE_CTL_VGA capability, so it is not being picked up by the kernel as the default/boot card.

Is there anything special about the bridge or the hardware in this regard?

Regards,
Daniel

Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :

hi Daniel,

I am not knowing it but I will check Huawei and vendor of VGA card for it.

thanks,
Mao

On Tue, Jun 6, 2017 at 3:14 PM, Daniel Axtens <email address hidden>
wrote:

> Hi Mao,
>
> I have looked at the PCI setup a bit more closely: the VGA card is
> behind a PCI bridge which does not advertise the PCI_BRIDGE_CTL_VGA
> capability, so it is not being picked up by the kernel as the
> default/boot card.
>
> Is there anything special about the bridge or the hardware in this
> regard?
>
> Regards,
> Daniel
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1691991
>
> Title:
> Xorg Segmentation fault on Hisilicon D05 board (arm64)
>
> Status in xorg package in Ubuntu:
> New
>
> Bug description:
> ubuntu@ubuntu:~$ sudo /usr/lib/xorg/Xorg
> [sudo] password for ubuntu:
>
> X.Org X Server 1.18.4
> Release Date: 2016-07-19
> X Protocol Version 11, Revision 0
> Build Operating System: Linux 4.4.0-45-generic aarch64 Ubuntu
> Current Operating System: Linux ubuntu 4.10.0-20.22-generic
> #22+pearl.2-Ubuntu SMP Thu Apr 27 20:23:08 UTC 2017 aarch64
> Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.10.0-20.22-generic
> root=UUID=eee681c5-04ce-4cd0-a004-cae6717961ce ro debug
> earlycon=pl011,mmio,0x602B0000 console=tty0
> Build Date: 02 November 2016 10:05:28PM
> xorg-server 2:1.18.4-0ubuntu0.2 (For technical support please see
> http://www.ubuntu.com/support)
> Current version of pixman: 0.33.6
> Before reporting problems, check http://wiki.x.org
> to make sure that you have the latest version.
> Markers: (--) probed, (**) from config file, (==) default setting,
> (++) from command line, (!!) notice, (II) informational,
> (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
> (==) Log file: "/var/log/Xorg.0.log", Time: Fri May 19 18:10:13 2017
> (==) Using system config directory "/usr/share/X11/xorg.conf.d"
> pci id for fd 10: 19e5:1711, driver (null)
> EGL_MESA_drm_image required.
> (EE)
> (EE) Backtrace:
> (EE) 0: /usr/lib/xorg/Xorg (xorg_backtrace+0x58) [0xaaaad7f1cc48]
> (EE)
> (EE) Segmentation fault at address 0xa0
> (EE)
> Fatal server error:
> (EE) Caught signal 11 (Segmentation fault). Server aborting
> (EE)
> (EE)
> Please consult the The X.Org Foundation support
> at http://wiki.x.org
> for help.
> (EE) Please also check the log file at "/var/log/Xorg.0.log" for
> additional information.
> (EE)
> (EE) Server terminated with error (1). Closing log file.
> Aborted (core dumped)
> ubuntu@ubuntu:~$
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/ubuntu/+source/xorg/+bug/1691991/+subscriptions
>

--
Zhanglei Mao
Solutions Architect, Sales and Business Development
Canonical Group Ltd.
<email address hidden>
+86-13625010929 (m)
+852-6700 6026 (m)
www.ubuntu.com
www.canonical.com

Revision history for this message
Daniel Axtens (daxtens) wrote :

Hi Dann,

I have tried to boot the HiSilicon board with a zesty kernel (and with a patched zesty kernel) and it boots, gets to the following, and then hangs without displaying a prompt:

[ 9.900239] async_tx: api initialized (async)
[ 9.991929] Btrfs loaded, crc32c=crc32c-arm64-hw
[ 55.474203] hidraw: raw HID events driver (C) Jiri Kosina
[ 55.483000] usbcore: registered new interface driver usbhid
[ 55.488571] usbhid: USB HID core driver
[ME] Fault detect start!
[ME] Fault detect start!

Is there anything different between the pearl kernels and the zesty kernel that would make the prompt show up and/or avoid the hang?

Regards,
Daniel

Revision history for this message
Daniel Axtens (daxtens) wrote :

Hi Dann,

Ignore that, I didn't realise I needed the -extra package.

Regards,
Daniel

Revision history for this message
Daniel Axtens (daxtens) wrote :

Hi Mao,

I have successfully verified that with the patched kernel and the Xorg config, X starts fine.

Do you need assistance getting that patch upstream, or is that something HiSilicon/the HWE team can do?

Regards,
Daniel

Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :

hi Daniel,

It is nice. I thought to upstream is the responsibility of HiSilicon/HWE
team. But If you can make it upstream, it will be out of all expecting and
very nice too.

thanks,
Mao

On Wed, Jun 7, 2017 at 12:40 PM, Daniel Axtens <email address hidden>
wrote:

> Hi Mao,
>
> I have successfully verified that with the patched kernel and the Xorg
> config, X starts fine.
>
> Do you need assistance getting that patch upstream, or is that something
> HiSilicon/the HWE team can do?
>
> Regards,
> Daniel
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1691991
>
> Title:
> Xorg Segmentation fault on Hisilicon D05 board (arm64)
>
> Status in xorg package in Ubuntu:
> New
>
> Bug description:
> ubuntu@ubuntu:~$ sudo /usr/lib/xorg/Xorg
> [sudo] password for ubuntu:
>
> X.Org X Server 1.18.4
> Release Date: 2016-07-19
> X Protocol Version 11, Revision 0
> Build Operating System: Linux 4.4.0-45-generic aarch64 Ubuntu
> Current Operating System: Linux ubuntu 4.10.0-20.22-generic
> #22+pearl.2-Ubuntu SMP Thu Apr 27 20:23:08 UTC 2017 aarch64
> Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.10.0-20.22-generic
> root=UUID=eee681c5-04ce-4cd0-a004-cae6717961ce ro debug
> earlycon=pl011,mmio,0x602B0000 console=tty0
> Build Date: 02 November 2016 10:05:28PM
> xorg-server 2:1.18.4-0ubuntu0.2 (For technical support please see
> http://www.ubuntu.com/support)
> Current version of pixman: 0.33.6
> Before reporting problems, check http://wiki.x.org
> to make sure that you have the latest version.
> Markers: (--) probed, (**) from config file, (==) default setting,
> (++) from command line, (!!) notice, (II) informational,
> (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
> (==) Log file: "/var/log/Xorg.0.log", Time: Fri May 19 18:10:13 2017
> (==) Using system config directory "/usr/share/X11/xorg.conf.d"
> pci id for fd 10: 19e5:1711, driver (null)
> EGL_MESA_drm_image required.
> (EE)
> (EE) Backtrace:
> (EE) 0: /usr/lib/xorg/Xorg (xorg_backtrace+0x58) [0xaaaad7f1cc48]
> (EE)
> (EE) Segmentation fault at address 0xa0
> (EE)
> Fatal server error:
> (EE) Caught signal 11 (Segmentation fault). Server aborting
> (EE)
> (EE)
> Please consult the The X.Org Foundation support
> at http://wiki.x.org
> for help.
> (EE) Please also check the log file at "/var/log/Xorg.0.log" for
> additional information.
> (EE)
> (EE) Server terminated with error (1). Closing log file.
> Aborted (core dumped)
> ubuntu@ubuntu:~$
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/ubuntu/+source/xorg/+bug/1691991/+subscriptions
>

--
Zhanglei Mao
Solutions Architect, Sales and Business Development
Canonical Group Ltd.
<email address hidden>
+86-13625010929 (m)
+852-6700 6026 (m)
www.ubuntu.com
www.canonical.com

Revision history for this message
Daniel Axtens (daxtens) wrote :

Hi Mao,

I have installed a version of the kernel which ignores the capabilities of the PCI bridge when determining whether a device can be the boot device. With this patched kernel, X starts without needing a config file.

This confirms:
 - that the vga card is not marked as boot device because of the the PCI bridge that the VGA card sits behind.
 - not being marked as boot vga is what is causing X not to pick it up the card.

This is a debug patch only, and not a patch we will be able to get upstream, so I think we will need to discuss with the HiSilicon people why their hardware is behaving this way.

Regards,
Daniel

Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :
Download full text (3.3 KiB)

hi Daniel,

Agree with you that is something they need to fix. I have sent mail to
HiSilicon and their VGA card vendors and they replied some for confirming
and understand questions or our requests. I will push them again.

thanks,
Mao

On Thu, Jun 8, 2017 at 8:41 AM, Daniel Axtens <email address hidden>
wrote:

> Hi Mao,
>
> I have installed a version of the kernel which ignores the capabilities
> of the PCI bridge when determining whether a device can be the boot
> device. With this patched kernel, X starts without needing a config
> file.
>
> This confirms:
> - that the vga card is not marked as boot device because of the the PCI
> bridge that the VGA card sits behind.
> - not being marked as boot vga is what is causing X not to pick it up the
> card.
>
> This is a debug patch only, and not a patch we will be able to get
> upstream, so I think we will need to discuss with the HiSilicon people
> why their hardware is behaving this way.
>
> Regards,
> Daniel
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1691991
>
> Title:
> Xorg Segmentation fault on Hisilicon D05 board (arm64)
>
> Status in xorg package in Ubuntu:
> New
>
> Bug description:
> ubuntu@ubuntu:~$ sudo /usr/lib/xorg/Xorg
> [sudo] password for ubuntu:
>
> X.Org X Server 1.18.4
> Release Date: 2016-07-19
> X Protocol Version 11, Revision 0
> Build Operating System: Linux 4.4.0-45-generic aarch64 Ubuntu
> Current Operating System: Linux ubuntu 4.10.0-20.22-generic
> #22+pearl.2-Ubuntu SMP Thu Apr 27 20:23:08 UTC 2017 aarch64
> Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.10.0-20.22-generic
> root=UUID=eee681c5-04ce-4cd0-a004-cae6717961ce ro debug
> earlycon=pl011,mmio,0x602B0000 console=tty0
> Build Date: 02 November 2016 10:05:28PM
> xorg-server 2:1.18.4-0ubuntu0.2 (For technical support please see
> http://www.ubuntu.com/support)
> Current version of pixman: 0.33.6
> Before reporting problems, check http://wiki.x.org
> to make sure that you have the latest version.
> Markers: (--) probed, (**) from config file, (==) default setting,
> (++) from command line, (!!) notice, (II) informational,
> (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
> (==) Log file: "/var/log/Xorg.0.log", Time: Fri May 19 18:10:13 2017
> (==) Using system config directory "/usr/share/X11/xorg.conf.d"
> pci id for fd 10: 19e5:1711, driver (null)
> EGL_MESA_drm_image required.
> (EE)
> (EE) Backtrace:
> (EE) 0: /usr/lib/xorg/Xorg (xorg_backtrace+0x58) [0xaaaad7f1cc48]
> (EE)
> (EE) Segmentation fault at address 0xa0
> (EE)
> Fatal server error:
> (EE) Caught signal 11 (Segmentation fault). Server aborting
> (EE)
> (EE)
> Please consult the The X.Org Foundation support
> at http://wiki.x.org
> for help.
> (EE) Please also check the log file at "/var/log/Xorg.0.log" for
> additional information.
> (EE)
> (EE) Server terminated with error (1). Closing log file.
> Aborted (core dumped)
> ubuntu@ubuntu:~$
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/ubuntu/+source/...

Read more...

Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :
Download full text (5.2 KiB)

hi Danniel,

This forwarded mail are from Huawei guy which to say "PCI_BRIDGE_CTL_VGA"
are only used on X86 but not for AMR64. The English line was my translated
for Chines text.

thanks,
Mao

---------- Forwarded message ----------
From: wanghuiqiang <email address hidden>
Date: 2017-06-09 13:38 GMT+08:00
Subject: 答复: 答复: 答复: vga card question for D05
To: Zourongrong <email address hidden>, Zhanglei Mao <
<email address hidden>>, "Liuxinliang (Matthew Liu)" <
<email address hidden>>
Cc: "Xiongfanggou (James)" <email address hidden>, caesar qiu 裘赛海 <
<email address hidden>>, allan wang 王友朋 <email address hidden>,
"<email address hidden>" <email address hidden>,
"Xiazhongjun (Summer)" <email address hidden>, "kongxinwei (A)" <
<email address hidden>>, Land Lu <email address hidden>

不清楚你们这个问题是基于什么平台提出的。

在ARM里没有用这个PCI_BRIDGE_CTL_VGA。这是x86的架构设计里用来分配IO和memory地址空间的。而ARM世界是没有IO
空间的概念的,至于memory空间,也是x86里为了支持legacy VGA而一直沿用的技术。具体信息可以看以下的内容。

Translating:

I don't know which platform was this request based on.

In the ARM, PCI_BRIDGE_CTL_VGA was not used. This is a x86 architecture
design using as IO and Memory address space assign or allocation. In the
ARM word, there are no any IO space concepts, for memory address space, it
was used space technology legacy VGA supports on X86. More details can be
found from below:

Thanks!

 --------------------------------------------------------

On Thu, Jun 8, 2017 at 9:40 AM, Zhanglei Mao <email address hidden>
wrote:

> hi Daniel,
>
> Agree with you that is something they need to fix. I have sent mail to
> HiSilicon and their VGA card vendors and they replied some for confirming
> and understand questions or our requests. I will push them again.
>
> thanks,
> Mao
>
> On Thu, Jun 8, 2017 at 8:41 AM, Daniel Axtens <<email address hidden>
> > wrote:
>
>> Hi Mao,
>>
>> I have installed a version of the kernel which ignores the capabilities
>> of the PCI bridge when determining whether a device can be the boot
>> device. With this patched kernel, X starts without needing a config
>> file.
>>
>> This confirms:
>> - that the vga card is not marked as boot device because of the the PCI
>> bridge that the VGA card sits behind.
>> - not being marked as boot vga is what is causing X not to pick it up
>> the card.
>>
>> This is a debug patch only, and not a patch we will be able to get
>> upstream, so I think we will need to discuss with the HiSilicon people
>> why their hardware is behaving this way.
>>
>> Regards,
>> Daniel
>>
>> --
>> You received this bug notification because you are subscribed to the bug
>> report.
>> https://bugs.launchpad.net/bugs/1691991
>>
>> Title:
>> Xorg Segmentation fault on Hisilicon D05 board (arm64)
>>
>> Status in xorg package in Ubuntu:
>> New
>>
>> Bug description:
>> ubuntu@ubuntu:~$ sudo /usr/lib/xorg/Xorg
>> [sudo] password for ubuntu:
>>
>> X.Org X Server 1.18.4
>> Release Date: 2016-07-19
>> X Protocol Version 11, Revision 0
>> Build Operating System: Linux 4.4.0-45-generic aarch64 Ubuntu
>> Current Operating System: Linux ubuntu 4.10.0-20.22-generic
>> #22+pearl.2-Ubuntu SMP Thu Apr 27 20:...

Read more...

Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :

hi Danniel,

This forwarded mail are from Huawei guy which to say "PCI_BRIDGE_CTL_VGA" are only used on X86 but not for AMR64. The English line was my translated for Chines text.

thanks,
Mao

---------- Forwarded message ----------
From: wanghuiqiang <email address hidden>
Date: 2017-06-09 13:38 GMT+08:00
Subject: 答复: 答复: 答复: vga card question for D05
To: Zourongrong <email address hidden>, Zhanglei Mao <email address hidden>, "Liuxinliang (Matthew Liu)" <email address hidden>
Cc: "Xiongfanggou (James)" <email address hidden>, caesar qiu 裘赛海 <email address hidden>, allan wang 王友朋 <email address hidden>, "<email address hidden>" <email address hidden>, "Xiazhongjun (Summer)" <email address hidden>, "kongxinwei (A)" <email address hidden>, Land Lu <email address hidden>

不清楚你们这个问题是基于什么平台提出的。
在ARM里没有用这个PCI_BRIDGE_CTL_VGA。这是x86的架构设计里用来分配IO和memory地址空间的。而ARM世界是没有IO空间的概念的,至于memory空间,也是x86里为了支持legacy VGA而一直沿用的技术。具体信息可以看以下的内容。

Translating:
I don't know which platform was this request based on.
In the ARM, PCI_BRIDGE_CTL_VGA was not used. This is a x86 architecture design using as IO and Memory address space assign or allocation. In the ARM word, there are no any IO space concepts, for memory address space, it was used space technology legacy VGA supports on X86. More details can be found from below:

Thanks!

Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :

This 4.5.1 seems form "PCI-to-PCI Bridge Architecture Specification", the full document can be download from below link: https://cds.cern.ch/record/551427/files/cer-2308933.pdf

Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :

This is mail thread we haved discussed about ARM to compliance for PCI standard as other platform for x86, powerpc, ia64 etc. They key point form Huawei guys are below:

"这部分ARM应该不能遵循,因为VGA EN开辟的空间是给legacy的系统使用的,1M以下的空间划分是x86向前兼容性的做法,只有在CSM支持传统的系统才还这样做,在新的方案里能不用就不用,开辟IO空间对ARM来说更不合适,因为ARM在定义之初就没有IO这种资源类型。"

Translate: ARM would compliance this part of PCI stand (IO space, memory address space), because VGA EN reserved spaces for only for legacy system. The low space for 1M is to compatible X86, it only used from CSM. In new implement, it need to avoid at best, to use IO space is also not suitable for ARM because ARM didn't have any IO resource in its' initial definitions.

thanks,
Mao

Revision history for this message
Daniel Axtens (daxtens) wrote :

Hi Mao,

OK, that sounds reasonable. I will follow up on this.

Regards,
Daniel

Revision history for this message
Daniel Axtens (daxtens) wrote :

Hi Mao,

I have done more work on the HiSilicon board. I have talked with the SEG team and our conclusion is that the hardware is not compliant with the specification, but that it is appropriate to include a workaround in software.

I have developed a patch that adds a workaround or 'quirk' to the kernel specifically for the hisilicon graphics card and the hisilicon PCI bridge. It tests for the card and the bridge on the development board. I think it might be acceptable for upstream. With this, X autoconfiguration works.

Please could you ask the HiSilicon people if there are other boards or parts with different PCI IDs that should be included in this fixup?

Regards,
Daniel

Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :
Download full text (3.6 KiB)

hi Daniel,

It is very nice for your to provide a patch for it. For other PCI IDs, I
will check with Huawei team and back to you at next week.

By the way, what is status of first bug ( The busid reported by libdrm on
the arm64 system is "0007:a1:00.0"), has it been accept by upstram? Do you
have bug id for it? Actually, I think we can take both those 2 bugs back to
Huawei or Pearl team in case it is bugs from Kernel.

thanks,
Mao

On Fri, Jun 16, 2017 at 11:46 AM, Daniel Axtens <<email address hidden>
> wrote:

> Hi Mao,
>
> I have done more work on the HiSilicon board. I have talked with the SEG
> team and our conclusion is that the hardware is not compliant with the
> specification, but that it is appropriate to include a workaround in
> software.
>
> I have developed a patch that adds a workaround or 'quirk' to the kernel
> specifically for the hisilicon graphics card and the hisilicon PCI
> bridge. It tests for the card and the bridge on the development board. I
> think it might be acceptable for upstream. With this, X
> autoconfiguration works.
>
> Please could you ask the HiSilicon people if there are other boards or
> parts with different PCI IDs that should be included in this fixup?
>
> Regards,
> Daniel
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1691991
>
> Title:
> Xorg Segmentation fault on Hisilicon D05 board (arm64)
>
> Status in xorg package in Ubuntu:
> New
>
> Bug description:
> ubuntu@ubuntu:~$ sudo /usr/lib/xorg/Xorg
> [sudo] password for ubuntu:
>
> X.Org X Server 1.18.4
> Release Date: 2016-07-19
> X Protocol Version 11, Revision 0
> Build Operating System: Linux 4.4.0-45-generic aarch64 Ubuntu
> Current Operating System: Linux ubuntu 4.10.0-20.22-generic
> #22+pearl.2-Ubuntu SMP Thu Apr 27 20:23:08 UTC 2017 aarch64
> Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.10.0-20.22-generic
> root=UUID=eee681c5-04ce-4cd0-a004-cae6717961ce ro debug
> earlycon=pl011,mmio,0x602B0000 console=tty0
> Build Date: 02 November 2016 10:05:28PM
> xorg-server 2:1.18.4-0ubuntu0.2 (For technical support please see
> http://www.ubuntu.com/support)
> Current version of pixman: 0.33.6
> Before reporting problems, check http://wiki.x.org
> to make sure that you have the latest version.
> Markers: (--) probed, (**) from config file, (==) default setting,
> (++) from command line, (!!) notice, (II) informational,
> (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
> (==) Log file: "/var/log/Xorg.0.log", Time: Fri May 19 18:10:13 2017
> (==) Using system config directory "/usr/share/X11/xorg.conf.d"
> pci id for fd 10: 19e5:1711, driver (null)
> EGL_MESA_drm_image required.
> (EE)
> (EE) Backtrace:
> (EE) 0: /usr/lib/xorg/Xorg (xorg_backtrace+0x58) [0xaaaad7f1cc48]
> (EE)
> (EE) Segmentation fault at address 0xa0
> (EE)
> Fatal server error:
> (EE) Caught signal 11 (Segmentation fault). Server aborting
> (EE)
> (EE)
> Please consult the The X.Org Foundation support
> at http://wiki.x.org
> for help.
> (EE) Please also check the log file at "/var/l...

Read more...

Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :

Translate from Huawei's reply mail: The sever board have only this VGA PCI devices:
   19e5 Huawei Technologies Co., Ltd.
       1711 Hi1710 [iBMC Intelligent Management system chip w/VGA support]

Please check if this math to our D05 testing environment.

Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :
Download full text (4.3 KiB)

hi Danneil,

Those are translate from Huawei's reply mail:

The sever board have only this VGA PCI devices:
   19e5 Huawei Technologies Co., Ltd.
       1711 Hi1710 [iBMC Intelligent Management system chip w/VGA support]

Please check if this math to our D05 testing environment.

thanks,
Mao

On Fri, Jun 16, 2017 at 4:21 PM, Zhanglei Mao <email address hidden>
wrote:

> hi Daniel,
>
> It is very nice for your to provide a patch for it. For other PCI IDs, I
> will check with Huawei team and back to you at next week.
>
> By the way, what is status of first bug ( The busid reported by libdrm on
> the arm64 system is "0007:a1:00.0"), has it been accept by upstram? Do you
> have bug id for it? Actually, I think we can take both those 2 bugs back to
> Huawei or Pearl team in case it is bugs from Kernel.
>
> thanks,
> Mao
>
> On Fri, Jun 16, 2017 at 11:46 AM, Daniel Axtens <
> <email address hidden>> wrote:
>
>> Hi Mao,
>>
>> I have done more work on the HiSilicon board. I have talked with the SEG
>> team and our conclusion is that the hardware is not compliant with the
>> specification, but that it is appropriate to include a workaround in
>> software.
>>
>> I have developed a patch that adds a workaround or 'quirk' to the kernel
>> specifically for the hisilicon graphics card and the hisilicon PCI
>> bridge. It tests for the card and the bridge on the development board. I
>> think it might be acceptable for upstream. With this, X
>> autoconfiguration works.
>>
>> Please could you ask the HiSilicon people if there are other boards or
>> parts with different PCI IDs that should be included in this fixup?
>>
>> Regards,
>> Daniel
>>
>> --
>> You received this bug notification because you are subscribed to the bug
>> report.
>> https://bugs.launchpad.net/bugs/1691991
>>
>> Title:
>> Xorg Segmentation fault on Hisilicon D05 board (arm64)
>>
>> Status in xorg package in Ubuntu:
>> New
>>
>> Bug description:
>> ubuntu@ubuntu:~$ sudo /usr/lib/xorg/Xorg
>> [sudo] password for ubuntu:
>>
>> X.Org X Server 1.18.4
>> Release Date: 2016-07-19
>> X Protocol Version 11, Revision 0
>> Build Operating System: Linux 4.4.0-45-generic aarch64 Ubuntu
>> Current Operating System: Linux ubuntu 4.10.0-20.22-generic
>> #22+pearl.2-Ubuntu SMP Thu Apr 27 20:23:08 UTC 2017 aarch64
>> Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.10.0-20.22-generic
>> root=UUID=eee681c5-04ce-4cd0-a004-cae6717961ce ro debug
>> earlycon=pl011,mmio,0x602B0000 console=tty0
>> Build Date: 02 November 2016 10:05:28PM
>> xorg-server 2:1.18.4-0ubuntu0.2 (For technical support please see
>> http://www.ubuntu.com/support)
>> Current version of pixman: 0.33.6
>> Before reporting problems, check http://wiki.x.org
>> to make sure that you have the latest version.
>> Markers: (--) probed, (**) from config file, (==) default setting,
>> (++) from command line, (!!) notice, (II) informational,
>> (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
>> (==) Log file: "/var/log/Xorg.0.log", Time: Fri May 19 18:10:13 2017
>> (==) Using system config directory "/usr/share/X11/xorg.conf.d"
>> pci id for fd 10: 19e5:1711, driv...

Read more...

Revision history for this message
Daniel Axtens (daxtens) wrote :

Hi Mao,

Thanks for that.

You are right, this should be split into two kernel issues.

I have opened:

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1698700 - "pci:" prefix in bus ID
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1698706 - Quirk for vga card and bridge

I have subscribed you to these bugs. They include some updates to the upstreaming process and I will keep them updated.

If it's alright with you I will close this bug as we've established it's not a bug in X.

Regards,
Daniel

Revision history for this message
Zhanglei Mao (zhanglei-mao) wrote :

Yes, you can close this bug now. Thank you very much for your good works and to fix this problems.

Daniel Axtens (daxtens)
Changed in xorg (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.