Help needed with getting GC300 working on the JH7100 RISC-V SoC

dramforever dramforever at live.com
Sun Jul 24 09:47:24 UTC 2022


Hi all,

I've recently 'found' what appears to be an undocumented Vivante GC300
GPU on the StarFive JH7100 [1], a RISC-V SoC that's used in the
VisionFive [2] development board.

However I was unable to get the etnaviv driver to work on it. This is
the device tree node I ended up using, with reg from the datasheet, and
interrupts/clocks just guessed and probably incorrect. I used
clk_ignore_unused intending to figure out clock handling later.

gpu2d: gpu at 10100000 {
    compatible = "vivante,gc";
    reg = <0x0 0x10100000 0x0 0x40000>;
    interrupts = <20>;
    clocks = <&clkgen JH7100_CLK_GC300_AHB>;
    clock-names = "core";
};

I used the vendor 5.18 kernel[3], which does not seem to have changed
anything in the etnaviv drivers. The GPU seems to be recognized:

[   25.453905] etnaviv-gpu 10100000.gpu: coherent device 0 dev->dma_coherent 0
[   25.597244] etnaviv etnaviv: coherent device 0 dev->dma_coherent 0
[   25.797495] etnaviv etnaviv: bound 10100000.gpu (ops gpu_ops [etnaviv])
[   25.801571] etnaviv-gpu 10100000.gpu: model: GC300, revision: 4635
[   25.813754] [drm] Initialized etnaviv 1.3.0 20151214 for etnaviv on minor 0

However running 'etnaviv_2d_test /dev/dri/renderD128' from libdrm
2.4.112 hangs with a kernel BUG_ON in the page fault handler (see bottom
of message for backtrace). At this point I've run out of ideas to try as
I'm not really familiar with DRM or other Linux internals. It seems to
fail on a VM_BUG_ON in gfp_zone checking for GFP_ZONE_BAD flags, but I
don't really have a clue as to what that means in this context.

Do you have any suggestions on how I can investigate into this?

By the way, here's some extra things that might be of interest. Firstly,
the existence of this GPU on JH7100 isn't advertised anywhere AFAIK, so
the hardware might just be completely broken. Secondly, on the JH7100
DMA isn't coherent by default and requires arch_dma_prep_coherent etc [4].

Thanks in advance for any help and guidance.

Regards,
dram

[1]: https://rvspace.org/en/Product/JH7100/Technical_Documents/JH7100_Datasheet
[2]: https://rvspace.org/en/Product/VisionFive/Technical_Documents/VisionFive_Single_Board_Computer_Quick_Start_Guide
[3]: https://github.com/starfive-tech/linux/tree/visionfive-5.18.y
[4]: https://github.com/starfive-tech/linux/commit/525ecfb08c62004d34dfe1fde99f4503a08842d8

Kernel VM_BUG_ON backtrace:

[   85.678258] ------------[ cut here ]------------
[   85.678283] kernel BUG at include/linux/gfp.h:500!
[   85.683090] Kernel BUG [#1]
[   85.685878] Modules linked in: af_packet xhci_plat_hcd snd_soc_spdif_tx snd_soc_starfive_pwmdac snd_soc_starfive_i2svad snd_soc_simple_card xhci_hcd snd_soc_spdif_rx brcmfmac snd_soc_simple_card_utils snd_soc_starfive_pwmdac_transmitter snd_soc_dmic tda9950 snd_soc_core gpio_tps65086 tps65086_regulator tda998x cec tps65086 starfive_drm rc_core mfd_core at24 regmap_i2c snd_compress ac97_bus drm_cma_helper brcmutil snd_pcm_dmaengine snd_pcm drm_kms_helper ip6_tables cfg80211 xt_conntrack nf_conntrack starfive_wdt watchdog spidev starfive_vic_rng cdns3 cdns_usb_common roles usbcore snd_timer pwm_sifive_ptc nf_defrag_ipv6 i2c_designware_platform rng_core fb_sys_fops nf_defrag_ipv4 sfctemp i2c_designware_core syscopyarea sysfillrect sysimgblt ip6t_rpfilter ipt_rpfilter xt_pkttype xt_LOG snd nf_log_syslog xt_tcpudp nft_compat etnaviv motorcomm rfkill 8021q dwmac_generic usb_common gpu_sched reset_starfive_jh7100_audio soundcore clk_starfive_jh7100_audio stmmac_platform nf_tables pwrseq_simple
[   85.686242]  ofpart cmdlinepart spi_nor leds_gpio led_class uio_pdrv_genirq libcrc32c nfnetlink sch_fq_codel uio atkbd libps2 serio vivaldi_fmap loop tun tap macvlan bridge stp llc mtdblock mtd_blkdevs mtd drm spi_cadence_quadspi(O) fuse backlight i2c_core pstore configfs ip_tables x_tables autofs4 ext4 crc32c_generic crc16 mbcache jbd2 mmc_block dm_mod dax ledtrig_heartbeat spi_dw_mmio spi_dw dw_mmc_pltfm dw_mmc mmc_core dw_axi_dmac_platform virt_dma
[   85.813286] CPU: 1 PID: 990 Comm: etnaviv_2d_test Tainted: G           O      5.18.5 #1-NixOS
[   85.821787] Hardware name: StarFive VisionFive V1 (DT)
[   85.826910] epc : prepare_alloc_pages.constprop.0+0x172/0x18c
[   85.832659]  ra : __alloc_pages+0x7e/0x1b6
[   85.836751] epc : ffffffff801e32d0 ra : ffffffff801e8f30 sp : ffffffc80498b840
[   85.843954]  gp : ffffffff817df8e8 tp : ffffffd8807b8000 t0 : ffffffff8000a960
[   85.851156]  t1 : 0000000000000000 t2 : ffffffff80c002a0 s0 : ffffffc80498b890
[   85.858357]  s1 : 0000000000106cc6 a0 : 0000000000000250 a1 : 0000000000000000
[   85.865559]  a2 : 0000000000000000 a3 : 0000000000000000 a4 : ffffffc80498b898
[   85.872761]  a5 : ffffffc80498b894 a6 : ffffffc80498b890 a7 : 000000000000000c
[   85.879963]  s2 : 0000000000000001 s3 : 0000000000106cc6 s4 : 0000000000000000
[   85.887164]  s5 : 0000000000000000 s6 : 0000000000000000 s7 : 0000000000000000
[   85.894364]  s8 : ffffffc80498b978 s9 : ffffffff8184b910 s10: 0000000000106cc6
[   85.901566]  s11: ffffffd890b6e968 t3 : 0000000000000020 t4 : ffffffef8485aad0
[   85.908767]  t5 : 000000000000000c t6 : 0000000000000020
[   85.914061] status: 0000000200000120 badaddr: 0000000000000250 cause: 0000000000000003
[   85.921957] [<ffffffff801e8f30>] __alloc_pages+0x7e/0x1b6
[   85.927346] [<ffffffff802060f8>] alloc_pages_vma+0xa6/0x2e6
[   85.932920] [<ffffffff801a5132>] shmem_alloc_page+0x3c/0x62
[   85.938494] [<ffffffff801a55ea>] shmem_alloc_and_acct_page+0xe6/0x1a4
[   85.944919] [<ffffffff801a8506>] shmem_getpage_gfp+0x280/0x7d8
[   85.950742] [<ffffffff801a8a9c>] shmem_read_mapping_page_gfp+0x3e/0x66
[   85.957259] [<ffffffff02bd98d0>] drm_gem_get_pages+0xc0/0x1f8 [drm]
[   85.986692] [<ffffffff03933678>] etnaviv_gem_shmem_get_pages+0x2c/0x82 [etnaviv]
[   85.998222] [<ffffffff03933a20>] etnaviv_gem_get_pages+0x46/0xca [etnaviv]
[   86.006478] [<ffffffff03933b3c>] etnaviv_gem_fault+0x44/0xc4 [etnaviv]
[   86.014315] [<ffffffff801c4814>] __do_fault+0x3a/0x13a
[   86.019460] [<ffffffff801c94d4>] __handle_mm_fault+0x784/0xf68
[   86.025282] [<ffffffff801c9d74>] handle_mm_fault+0xbc/0x1ba
[   86.030842] [<ffffffff8000aabc>] do_page_fault+0x15c/0x3fe
[   86.036319] [<ffffffff800037f2>] ret_from_exception+0x0/0xc
[   86.042168] ---[ end trace 0000000000000000 ]---



More information about the etnaviv mailing list