Page MenuHomeFreeBSD

Use DEVICE memory instead of UNCACHEABLE on aarch64 in LinuxKPI ioremap
ClosedPublic

Authored by hselasky on Jun 28 2019, 12:31 AM.

Details

Summary

This fixes system hangs on reading device registers in LinuxKPI drivers on aarch64.

VM_MEMATTR_DEVICE is also defined on RISC-V and 32-bit ARM, so I used ifdef VM_MEMATTR_DEVICE to make sure anyone trying to port LinuxKPI stuff to these architectures doesn't hit the same problem.

Test Plan

Tested on: Marvell MACCHIATObin (Armada8k) + mlx4en, amdgpu

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

hselasky added inline comments.Jun 28 2019, 8:48 AM
sys/compat/linuxkpi/common/include/linux/io.h
368 ↗(On Diff #59141)

Can you use /**/ comment here instead of // ?

What about the other ioremap() functions?

hm, just looked at linux — regular, _nocache and _wt are all PROT_DEVICE_nGnRE. Let's change them all then.

hselasky accepted this revision.Jun 28 2019, 1:56 PM

Spell lkpi -> LinuxKPI in the commit message.

Looks OK.

This revision is now accepted and ready to land.Jun 28 2019, 1:56 PM
greg_unrelenting.technology edited the test plan for this revision. (Show Details)

Please stay tuned!

Pong :-) I'll have a look at the patch again.

hselasky commandeered this revision.Aug 28 2019, 8:14 AM
hselasky edited reviewers, added: greg_unrelenting.technology; removed: hselasky.
This revision now requires review to proceed.Aug 28 2019, 8:14 AM
hselasky updated this revision to Diff 61392.Aug 28 2019, 8:15 AM

Can you test this patch?

hselasky accepted this revision.Aug 28 2019, 8:16 AM
This revision is now accepted and ready to land.Aug 28 2019, 8:16 AM

panic: vm_fault_hold: fault on nofault entry, addr: 0xffff00006e1ff000 in gfx_v8_0_kiq_resume

so no, looks like wc/wb are not meant to be device memory

Can you update my patch and test an again? Thank you!

Can you update my patch and test an again? Thank you!

https://reviews.freebsd.org/differential/diff/61437/ is what I edited it to. Looks like I'm not allowed to update this revision after you took it.

Just select commander revision in the action menu.

hselasky updated this revision to Diff 61437.Aug 29 2019, 7:13 AM
This revision now requires review to proceed.Aug 29 2019, 7:13 AM
hselasky accepted this revision.Aug 29 2019, 7:13 AM
This revision is now accepted and ready to land.Aug 29 2019, 7:13 AM

I'll try to get the patch in on Monday. I'm currently busy. Thank you for the patience.