writing custom driver for VGA emulation ?

Yusuf Altıparmak yusufalti1997 at gmail.com
Tue Feb 18 15:00:54 UTC 2020


*Hello Mr. Alex, Mr. Cönig and Mr. Bridgman, *

*Mr. Cönig, we have talked about MMIO problem before. You helped me a lot
about that and now driver is not giving any error about MMIO. That problem
was about bus configuration of my embedded system. It does not proceed more
than 4GB besides 0x0 adress is aligned for I/O and MMIO is allowed between
0xE0000000 and 0xffffffff. Fortunately, I now am able to claim 256 MB and
other 4 BARs adress between this range. I can attach lspci -v output. *

*Mr. Bridgman, I am using U-boot as bootloader and the system is 64 bit
PowerPc e5500 core. This means big endian kernel. *

*Right now, the driver 'amdgpu' is having error when *
*it tries to load smc firmware. I ve been trying to solve this problem for
months but I haven't solve it yet. *

*Other firmwares seems loading without any error. I was suspecting that
endianness is causing this problem but if it was shouldn't other firmwares
get fail before smc firmware gets loaded? *

*I tried all of the firmwares in repository but result remained same. *

*Full dmesg:*
[    5.426009] [drm] amdgpu kernel modesetting enabled.

[    5.430109] [drm] initializing kernel modesetting (POLARIS12
0x1002:0x6987 0x1787:0x2389 0x80).
[    5.437591] [drm] register mmio base: 0x20200000

[    5.440899] [drm] register mmio size: 262144

[    5.443888] [drm] add ip block number 0 <vi_common>

[    5.447465] [drm] add ip block number 1 <gmc_v8_0>

[    5.450953] [drm] add ip block number 2 <tonga_ih>

[    5.454442] [drm] add ip block number 3 <powerplay>

[    5.458018] [drm] add ip block number 4 <dm>

[    5.460979] [drm] add ip block number 5 <gfx_v8_0>

[    5.464466] [drm] add ip block number 6 <sdma_v3_0>

[    5.468042] [drm] add ip block number 7 <uvd_v6_0>

[    5.471531] [drm] add ip block number 8 <vce_v3_0>

[    5.475047] [drm] UVD is enabled in VM mode

[    5.477928] [drm] UVD ENC is enabled in VM mode

[    5.481154] [drm] VCE enabled in VM mode

[    5.712355] ATOM BIOS: 113-ER16BFC-001

[    5.714830] [drm] GPU posting now...

[    5.833704] [drm] vm size is 64 GB, 2 levels, block size is 10-bit,
fragment size is 9-bit
[    5.840950] amdgpu 0001:01:00.0: BAR 2: releasing [mem
0x220000000-0x2201fffff 64bit pref]
[    5.847930] amdgpu 0001:01:00.0: BAR 0: releasing [mem
0x210000000-0x21fffffff 64bit pref]
[    5.855688] [drm:.amdgpu_device_resize_fb_bar [amdgpu]] *ERROR* Problem
resizing BAR0 (-2).
[    5.855706] amdgpu 0001:01:00.0: BAR 0: assigned [mem
0x230000000-0x23fffffff 64bit pref]
[    5.869663] amdgpu 0001:01:00.0: BAR 2: assigned [mem
0x240000000-0x2401fffff 64bit pref]
[    5.876582] amdgpu 0001:01:00.0: VRAM: 4096M 0x000000F400000000 -
0x000000F4FFFFFFFF (4096M used)
[    5.884160] amdgpu 0001:01:00.0: GART: 256M 0x0000000000000000 -
0x000000000FFFFFFF
[    5.890519] [drm] Detected VRAM RAM=4096M, BAR=256M

[    5.894093] [drm] RAM width 128bits GDDR5

[    5.896941] [TTM] Zone  kernel: Available graphics memory: 4062380 kiB

[    5.902177] [TTM] Zone   dma32: Available graphics memory: 2097152 kiB

[    5.907402] [TTM] Initializing pool allocator

[    5.910464] [TTM] Initializing DMA pool allocator

[    5.919973] [drm] amdgpu: 4096M of VRAM memory ready

[    5.923659] [drm] amdgpu: 4096M of GTT memory ready.

[    5.927358] [drm] GART: num cpu pages 65536, num gpu pages 65536

[    5.932957] [drm] PCIE GART of 256M enabled (table at
0x000000F400000000).
[    5.939122] [drm] Chained IB support enabled!

[    5.948873] [drm] Found UVD firmware Version: 1.79 Family ID: 16

[    5.953647] [drm] UVD ENC is disabled

[    5.975818] [drm] Found VCE firmware Version: 52.4 Binary ID: 3

[    6.404774] amdgpu: [powerplay] Failed to send Message.

[    6.835902] amdgpu: [powerplay] SMU Firmware start failed!

[    6.840086] amdgpu: [powerplay] Failed to load SMU ucode.

[    6.844184] amdgpu: [powerplay] smc start failed

*[    6.847498] amdgpu: [powerplay] powerplay hw init failed *

*[    6.852281] [drm:.amdgpu_device_init [amdgpu]] *ERROR* hw_init of IP
block <powerplay> failed -22*
*[    6.859883] amdgpu 0001:01:00.0: amdgpu_device_ip_init failed *

*                                             [    6.864330] amdgpu
0001:01:00.0: Fatal error during GPU init  *
*                                         [    6.868689] [drm] amdgpu:
finishing device. *




*[    7.339427] pcieport 0001:00:00.0: AER: Corrected error received:
0001:00:00.0                                            [    7.345374]
pcieport 0001:00:00.0: PCIe Bus Error: severity=Corrected, type=Data Link
Layer, (Transmitter ID)            [    7.353993] pcieport 0001:00:00.0:
device [1957:0824] error status/mask=00001000/00002000
         [    7.361047] pcieport 0001:00:00.0:    [12] Timeout    *

[    7.706137] amdgpu: [powerplay]

                last message was failed ret is 0

[    8.127667] amdgpu: [powerplay]

                failed to send message 261 ret is 0

[    8.966331] amdgpu: [powerplay]

                last message was failed ret is 0

[    9.320290] pcieport 0001:00:00.0: AER: Corrected error received:
0001:00:00.0
[    9.326226] pcieport 0001:00:00.0: PCIe Bus Error: severity=Corrected,
type=Data Link Layer, (Transmitter ID)
[    9.334845] pcieport 0001:00:00.0:   device [1957:0824] error
status/mask=00001000/00002000
[    9.341899] pcieport 0001:00:00.0:    [12] Timeout

[    9.387975] amdgpu: [powerplay]

                failed to send message 261 ret is 0

[   10.226636] amdgpu: [powerplay]

                last message was failed ret is 0

[   10.648275] amdgpu: [powerplay]

                failed to send message 261 ret is 0

[   11.486932] amdgpu: [powerplay]

                last message was failed ret is 0

[   11.908570] amdgpu: [powerplay]

                failed to send message 261 ret is 0

[   12.747228] amdgpu: [powerplay]

                last message was failed ret is 0

[   13.168866] amdgpu: [powerplay]

                failed to send message 261 ret is 0

[   14.007523] amdgpu: [powerplay]

                last message was failed ret is 0

[   14.429161] amdgpu: [powerplay]

                failed to send message 261 ret is 0

[   15.267816] amdgpu: [powerplay]

                last message was failed ret is 0

[   15.689456] amdgpu: [powerplay]

                failed to send message 261 ret is 0

[   16.528114] amdgpu: [powerplay]

                last message was failed ret is 0

[   16.949756] amdgpu: [powerplay]

                failed to send message 261 ret is 0

[   17.788411] amdgpu: [powerplay]

                last message was failed ret is 0

[   18.210051] amdgpu: [powerplay]

                failed to send message 261 ret is 0

[   19.048710] amdgpu: [powerplay]

                last message was failed ret is 0

[   19.470347] amdgpu: [powerplay]

                failed to send message 261 ret is 0

[   19.786774] [TTM] Finalizing pool allocator

[   19.789696] [TTM] Finalizing DMA pool allocator

[   19.793004] [TTM] Zone  kernel: Used memory at exit: 0 kiB

[   19.797209] [TTM] Zone   dma32: Used memory at exit: 0 kiB

[   19.801410] [drm] amdgpu: ttm finalized

*                           [   19.804496] amdgpu: probe of 0001:01:00.0
failed with error -22 *


18 Şub 2020 Sal 17:43 tarihinde Bridgman, John <John.Bridgman at amd.com> şunu
yazdı:

> [AMD Official Use Only - Internal Distribution Only]
>
> >And we already checked, 256MB is unfortunately the minimum you can resize
> the VRAM BAR on the E9171 to.
>
> Ahh, OK... I didn't realize we had already looked into that. I guess that
> approach isn't going to work.
>
> Yusef, guessing you are using a 32-bit CPU ? Is it possible to talk to
> whoever does SBIOS for your platform to see if you could maybe reduce
> address space allocated to RAM and bump up the MMIO space ?
>
> ------------------------------
> *From:* Christian König <ckoenig.leichtzumerken at gmail.com>
> *Sent:* February 18, 2020 9:19 AM
> *To:* Bridgman, John <John.Bridgman at amd.com>; Alex Deucher <
> alexdeucher at gmail.com>; Yusuf Altıparmak <yusufalti1997 at gmail.com>
> *Cc:* amd-gfx list <amd-gfx at lists.freedesktop.org>
> *Subject:* Re: writing custom driver for VGA emulation ?
>
> The problem Yusuf runs into is that his platform has multiple PCIe root
> hubs, but only 512MB of MMIO address space. That is not enough to fit all
> the BARs of an E9171 into.
>
> But without the BARs neither the VGA emulation nor amdgpu not anything
> else will work correctly.
>
> And we already checked, 256MB is unfortunately the minimum you can resize
> the VRAM BAR on the E9171 to.
>
> What could maybe work is to trick the upstream bridge of the VGA device
> into not routing all the addresses to the BARs and actually use only a
> smaller portion of visible VRAM. But that would be highly experimental and
> requires a rather big hack into the PCI(e) subsystem in the Linux kernel.
>
> Regards,
> Christian.
>
> Am 18.02.20 um 15:08 schrieb Bridgman, John:
>
> [AMD Official Use Only - Internal Distribution Only]
>
> Does the VBIOS come up with something like a splash screen, ie is VBIOS
> able to initialize and drive the card ?
>
> If so then another option might be to use a VESA driver rather than VGA.
>
>
> ------------------------------
> *From:* amd-gfx <amd-gfx-bounces at lists.freedesktop.org>
> <amd-gfx-bounces at lists.freedesktop.org> on behalf of Alex Deucher
> <alexdeucher at gmail.com> <alexdeucher at gmail.com>
> *Sent:* February 18, 2020 8:50 AM
> *To:* Yusuf Altıparmak <yusufalti1997 at gmail.com> <yusufalti1997 at gmail.com>
> *Cc:* amd-gfx list <amd-gfx at lists.freedesktop.org>
> <amd-gfx at lists.freedesktop.org>
> *Subject:* Re: writing custom driver for VGA emulation ?
>
> On Tue, Feb 18, 2020 at 2:56 AM Yusuf Altıparmak
> <yusufalti1997 at gmail.com> <yusufalti1997 at gmail.com> wrote:
> >
> > Hello AMD team;
> >
> > I have E 9171 GPU and want to use it on a embedded system which has
> limited MMIO space on PCIe bus (MAX 512 MB).
> >
> > I received feedbacks that I can only use VGA emulation with this memory
> space. I was unable to get 'amdgpu' driver working with Xorg due to I had
> many errors(firmwares are not loading) in each step and tired of solving
> them one by one.
> >
> > I want to write a simple custom driver for this GPU with kernel version
> 4.19.
> > Is it possible to print some colors on screen with a custom driver over
> PCIe communication ? or writing some words on screen as VGA ?
> >
> > If answer is yes, then which code pieces (on amdgpu driver folder) or
> reference documentation should I use? I have Register Reference Guide.pdf.
> >
> > I will be appreciated for your guidance.
>
> That is not going to do what you want on your platform.  The VGA
> emulation requires that you set up the card first to enable it, which
> in turn requires MMIO access and thus you are back to square one.
>
> Alex
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
>
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Cjohn.bridgman%40amd.com%7Ce7bf224775ad487d240708d7b47992f4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637176306561328560&sdata=QbfaIN%2F6LvgUihz5O0x41TwvdGYy7QTS5IVJq3RXYlA%3D&reserved=0
> <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7CJohn.Bridgman%40amd.com%7Ccda5469b6f5f4ae43e6d08d7b47d899a%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637176323587003958&sdata=6eKo51jnHbE1QWkDB%2BN%2FFLMLB40HA2wVN3mU1l%2FeFhk%3D&reserved=0>
>
> _______________________________________________
> amd-gfx mailing listamd-gfx at lists.freedesktop.orghttps://lists.freedesktop.org/mailman/listinfo/amd-gfx <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7CJohn.Bridgman%40amd.com%7Ccda5469b6f5f4ae43e6d08d7b47d899a%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637176323587003958&sdata=6eKo51jnHbE1QWkDB%2BN%2FFLMLB40HA2wVN3mU1l%2FeFhk%3D&reserved=0>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20200218/dc794d64/attachment-0001.htm>


More information about the amd-gfx mailing list