Mali-450 support by lima

Doing the same for 5.5 :slight_smile:

Small hack that saved my time: compile lima as module, and after rebuild just copy new module and reload - so no new image/reboot isnā€™t needed. :wink:

UPD: Tested both 5.5 and 4.16-lima and both have error in same place: mmu gpmmu dte write test fail Canā€™t find previous sources, to check if everithing was commited.

1 Like

Recompiling whole kernel & boot takes typically ~3-4min

It is saver to use fresh boot if some inits leave something in memory. But maybe some added printk it is save to use module recompilation - I donā€™t know for sure.

Hmm. in 5.5 recompilation & boot take over 5minā€¦

Yep I switched to your 5.5, it compiled for night job fine. I like to use it instead 4.16 because sata broblem. It is currently:

[    5.416680] lima 13040000.gpu: IRQ pmu not found
[    5.421350] lima: ip-id: 1 ppmmu: 25 
[    5.425067] lima: mmu_read: 0 
[    5.428127] lima 13040000.gpu: mmu gpmmu dte write test fail
[    5.473276] lima: probe of 13040000.gpu failed with error -5

So dte write test fail beacause it write CAFEBABE to gpmmu and reads back 0

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka12788.html

Changed CAFEBABE values and think there is nobody home. So maybe pmu irq need to be find or gpmmu irq/address is wrong??

Maybe lower 12bits canā€™t be written (so should stay 0)ā€¦it will be interesting what is readā€¦Ohā€¦i see you have checked that (full value?). So write (or read or both) failes. So i guess something wrong in memory mapping or device not fully init (power)

imho Pmu is not neededā€¦mst0 (mali400) and mst1 (mali450) are both falseā€¦see my posting above

after searching in menuconfigā€¦maybe we need one+ of these?

IOMMU_DMA [=n]
MTK_IOMMU [=n]
IOMMU_IO_PGTABLE_LPAE [=n] 
IRQ_MSI_IOMMU [=n]

Maybe this clear something about irq nums & names

[    5.417016] lima: i:0   
[    5.417039] lima 13040000.gpu: IRQ pmu not found
[    5.424199] lima: irq_name: pmu, irqnum: -6
[    5.424202] lima: i:1   
[    5.428487] lima: irq_name: gpmmu, irqnum: 215
[    5.431021] lima: i:2   
[    5.435498] lima: irq_name: ppmmu0, irqnum: 217
[    5.438030] lima: i:3   
[    5.442572] lima: irq_name: ppmmu1, irqnum: 219
[    5.445120] lima: i:4   
[    5.449665] lima: irq_name: ppmmu2, irqnum: 221
[    5.452196] lima: i:5   
[    5.456750] lima: irq_name: ppmmu3, irqnum: 223
[    5.459282] lima: i:6   
[    5.463819] lima 13040000.gpu: IRQ ppmmu4 not found
[    5.471237] lima: irq_name: ppmmu4, irqnum: -6
[    5.471239] lima: i:7   
[    5.475710] lima 13040000.gpu: IRQ ppmmu5 not found
[    5.483114] lima: irq_name: ppmmu5, irqnum: -6
[    5.483117] lima: i:8   
[    5.487581] lima 13040000.gpu: IRQ ppmmu6 not found
[    5.494994] lima: irq_name: ppmmu6, irqnum: -6
[    5.494996] lima: i:9   
[    5.499445] lima 13040000.gpu: IRQ ppmmu7 not found
[    5.506860] lima: irq_name: ppmmu7, irqnum: -6
[    5.506862] lima: i:10   
[    5.511320] lima: irq_name: gp, irqnum: 214
[    5.513937] lima: i:11   
[    5.518143] lima: irq_name: pp0, irqnum: 216
[    5.520761] lima: i:12   
[    5.525056] lima: irq_name: pp1, irqnum: 218
[    5.527675] lima: i:13   
[    5.531956] lima: irq_name: pp2, irqnum: 220
[    5.534584] lima: i:14   
[    5.538867] lima: irq_name: pp3, irqnum: 222
[    5.541484] lima: i:15   
[    5.545773] lima 13040000.gpu: IRQ pp4 not found
[    5.553003] lima: irq_name: pp4, irqnum: -6
[    5.553005] lima: i:16   
[    5.557203] lima 13040000.gpu: IRQ pp5 not found
[    5.564446] lima: irq_name: pp5, irqnum: -6
[    5.564448] lima: i:17   
[    5.568636] lima 13040000.gpu: IRQ pp6 not found
[    5.575874] lima: irq_name: pp6, irqnum: -6
[    5.575877] lima: i:18   
[    5.580064] lima 13040000.gpu: IRQ pp7 not found
[    5.587304] lima: irq_name: pp7, irqnum: -6
[    5.587307] lima: i:19   
[    5.591489] lima: i:20   
[    5.594105] lima: i:21   
[    5.596732] lima: i:22   
[    5.599349] lima: i:23   
[    5.601966] lima: i:24   
[    5.604610] lima: irq_name: pp, irqnum: 224
[    5.607228] lima: i:25   
[    5.611415] lima 13040000.gpu: IRQ pmu not found
[    5.618668] lima: ip-id: 1 ppmmu: 25 
[    5.622329] lima: mmu_read: 0 
[    5.625396] lima 13040000.gpu: mmu gpmmu dte write test fail

And little sorted:

irq_name: pmu, irqnum: -6
irq_name: ppmmu4, irqnum: -6
irq_name: ppmmu5, irqnum: -6
irq_name: ppmmu6, irqnum: -6
irq_name: ppmmu7, irqnum: -6
irq_name: pp4, irqnum: -6
irq_name: pp5, irqnum: -6
irq_name: pp6, irqnum: -6
irq_name: pp7, irqnum: -6

irq_name: gp, irqnum: 214
irq_name: gpmmu, irqnum: 215
irq_name: pp0, irqnum: 216
irq_name: ppmmu0, irqnum: 217
irq_name: pp1, irqnum: 218
irq_name: ppmmu1, irqnum: 219
irq_name: pp2, irqnum: 220
irq_name: ppmmu2, irqnum: 221
irq_name: pp3, irqnum: 222
irq_name: ppmmu3, irqnum: 223
irq_name: pp, irqnum: 224

So 11 irq is found and 9 pcs is missing. Missing names are clear but correct numbers are what?? They need to add in .dtsi. There are maybe (correct??) data for 4 cores but rest 4 are missing. Mali450 have 8 cores.

Maybe probe_irq_on() and probe_irq_off() pair is usableā€¦? Or maybe need to ask from Mediatek all 20 irq number. In Mediatek should be people who knows how they wired their silicon. Who is correct people @Ryder.Lee or some else??

Tested and added also:

IOMMU_IO_PGTABLE_LPAE
IOMMU_IO_PGTABLE_LPAE_SELFTEST
IOMMU_IO_PGTABLE_ARMV7S
IOMMU_IO_PGTABLE_ARMV7S_SELFTEST

But it dosnā€™t affect 11 irq found and 9 missingā€¦

take a look at the definitions iā€™ve posted aboveā€¦you donā€™t need all interrupts, i guess the problem (for write test failed) is the underlaying memory (-mapping).

Maybe, but if only 1/2 of GPU is used it may have some performance issues. I think there is 8 GPU subunits which are controlled by memory addresses & irq lines. They have some shared memory (128kb or something) administered by gpmmu (which is handled by address & irq).

GPMMU should handle gpu memory which is quite small. dte is memory sub split to 1024 pages. Write to gpmmu dte may give pointer which end is 0x000. So CAFEBABE test may be valid. If it is valid then I think whole gpmmu is missed so address/irq is wrong. So back to .dtsi and need to ask from Mediatek correct numbers?

Edit: find this:

**Mali** 4xx GPUs have two kinds of processors GP and PP. GP is for OpenGL vertex shader 
processing and PP is for fragment shader processing. Each processor has its own MMU so prcessors 
work in virtual **address** space. - There's only one GP but multiple PP (max 4 for **mali** 400 and 8 
for **mali** **450** )

also: Documentation/devicetree/bindings/gpu/arm,mali-midgard.yaml

Suggest some power domain definitions and including that from previous documents mali units need powered before use. So unpowered unit broblem may also existā€¦

And slurps nam:

After 1200+ pages, nothing about GPU /internal irqs.

Tryed some irqprobe during write+read, nothing. Maybe base address wrong or gpmmu dosnā€™t generate irqs when write/readā€¦?

[    5.766521] lima 13040000.gpu: IRQ pmu not found
[    5.773776] lima: ip-id: 1 ppmmu: 25 
[    5.932548] lima: irqprobe: 0 
[    6.092575] lima: mmu_read: 0 irqprb: 0 
[    6.096508] lima 13040000.gpu: mmu gpmmu dte write test fail

Found some other mali450 chips address & irq values:

A53: (pentacore)
The developers can follow the ARM and Khronos official reference documents for programming details.
mali address start 0xD00C0000, end 0xD00FFFFF AXI master interface

p98:
irq     name
201     mali_irq_ppmmu2
200     mali_irq_pp2
199     mali_irq_ppmmu1
198     mali_irq_pp1
197     mali_irq_ppmmu0
196     mali_irq_pp0
195     mali_irq_pmu
194     mali_irq_pp
193     mali_irq_gpmmu
192     mali_irq_gp


Alwinner H5 (hexacore)
128 GPU_GP      GPU_GP interrupt
129 GPU_GPMMU   GPU_GPMMU interrupt
130 GPU_PMU     GPU_PMU interrupt
131 GPU_PP      GPU_PP interrupt
132 GPU_PP0     GPU_PP0 interrupt
133 GPU_PPMMU0  GPU_PPMMU0 interrupt
134 GPU_PP1     GPU_PP1 interrupt
135 GPU_PPMMU1  GPU_PPMMU1 interrupt
136 GPU_PP2     GPU_PP2 interrupt
137 GPU_PPMMU2  GPU_PPMMU2 interrupt
138 GPU_PP3     GPU_PP3 interrupt
139 GPU_PPMMU3  GPU_PPMMU3 interrupt

Maybe helps or not

Find also that LIMA_MMU_DTE_ADDR is zero, maybe wrong:

[    5.825474] lima 13040000.gpu: IRQ pmu not found
[    5.832727] lima: ip-id: 1 ppmmu: 25 
[    5.991023] lima: dte_address: 0 irqprobe: 0 
[    6.151047] lima: mmu_read: 0 irqprb: 0 
[    6.154982] lima 13040000.gpu: mmu gpmmu dte write test fail

I donā€™t think soā€¦i guess address is offset inside mali memory (maybe regmap?)

Ftw???

debugprint
irq_name: gp,           irqnum: 214
irq_name: gpmmu,        irqnum: 215
irq_name: pp0,          irqnum: 216
irq_name: ppmmu0        irqnum: 217
irq_name: pp1           irqnum: 218
irq_name: ppmmu1        irqnum: 219
irq_name: pp2           irqnum: 220
irq_name: ppmmu2        irqnum: 221
irq_name: pp3           irqnum: 222
irq_name: ppmmu3        irqnum: 223
irq_name: pp            irqnum: 224

.dtsi
170     "mfg_irq_gp_b"          "gp",
171     "mfg_irq_gpmmu_b"       "gpmmu",
172     "mfg_irq_pp0_b"         "pp0",
173     "mfg_irq_ppmmu0_b"      "ppmmu0",
174     "mfg_irq_pp1_b"         "pp1",
175     "mfg_irq_ppmmu1_b"      "ppmmu1",
176     "mfg_irq_pp2_b"         "pp2",
177     "mfg_irq_ppmmu2_b"      "ppmmu2",
178     "mfg_irq_pp3_b"         "pp3",
179     "mfg_irq_ppmmu3_b"      "ppmmu3",
180     "mfg_irq_pp_b"          "pp";

Tested to edit .dtsi and zero effect to irq_nums.

173 and 177 is used by external irq controller. (based to document irq lines are posible to move another num)

/proc/interrupts
173:  mt-eint       11240000.mmc cd
177:  mt-eint       mt6397-pmic

So is Mediatek supplied irqs right or is sharing ok?

Tryed to shift irqs by -44. But still 13040000.gpu: mmu gpmmu dte write test fail.

Could yoy please point what patch is missing? Didnā€™t found it.

Probably you should see these interrupts in your /proc/interrupts.

https://lwn.net/Articles/755084/

I suppose itā€™s address of virtual memory. My thought, @Ryder.Lee, @frank-w @LeXa2(as I know you support wifi code so you can be familiar with device drivers etc), and all others who may know: correct me if I wrong. So in my view lima driver communicates with itā€™s mmus thought its IRQ (GIC_SPI 171 in case of gpmmu) and so in case of Frankā€™s Irq renaming it was not found (by name) and initialization was skipped?

Also it uses mmus so should it use iommu? I remember larb3 in older versions. If so can dte write test fail be the result of iommu (driver, or dts) promlem?

Question about pmu, probably to @Ryder.Lee :

  1. Does lima driver tries to use arm-cpuā€™s pmu(which dts record was added relatively recent) or is it some mali internal ip like GP, PP, etc? Is it critical for device initialization?

  2. In a lot of other SoCs malis interrupts levels defined as HIGH, and in mt7623.dtsi itā€™s LOW. Why? :slight_smile:

I had tried renaming and then initialization was aborted because gpmmu (that was declared as needed) was no more found by its nameā€¦so i guess my old/current names are right. But i have no idea where the rootcause for write test isā€¦

IRQs nums are ok, i didnā€™t looked into /proc/interrupts in 4.16-lima, but in 4.4-BSP kernel with armā€™s mali kernel driver all irq numbers matches lima driver.4.4-interrupts.txt (9.1 ŠšŠ‘)

4.4 defines a additional regulator iā€™ve not seen in newer kernels (but maybe replaced by power domain)

I was unclear. I worked in your 4.16-lima and 4.16-hdmi-wlan. In defaultconfig is missing config_g3dsys and .dtsi missing Ryder suggested lines.

Yep, i mentioned about it Looks[quote=ā€œeros, post:79, topic:5442ā€] .dtsi missing Ryder suggested lines [/quote]

That is the question. Does my latest lima branch misses Ryder suggested lines? If so what lines

Do you mean 4.4.70 bpi official kernel or what (link please if not). In 4.16 or 5.5-merged no such irqs in proc/interupts.

I thinked in proc/interupts first line is irq number but if it is 7.th then there is no conflict in 5.5-merged.

Have you idea why platform_get_irq_byname(pdev, name) returns irq numbers diffrent than .dtsi says (in 5.5-merged).

No there (in 5.5-merged) is 11 irqā€™s and names lima use. But platform_get_irq_byname() gives diffrent irq numbers vs mt7623.dtsi says. Any idea? (and forcing (platform_get_irq_byname()-44) in lima driver dosnā€™t work either.)

There is ofcourse question should there be 20 irqs because 11 uses only 1/2 of PPā€™s total up to eight.