[PATCH] drm/[amdgpu|radeon]: fix memset on io mem

Christian König christian.koenig at amd.com
Fri Dec 18 10:41:47 UTC 2020


Am 18.12.20 um 09:52 schrieb Chen Li:
> On Fri, 18 Dec 2020 16:10:12 +0800,
> Christian König wrote:
>> Am 18.12.20 um 04:51 schrieb Chen Li:
>>> [SNIP]
>>>>>> If your ARM base board can't do that for some then you can't use the hardware
>>>>>> with that board.
>>>>> Good to know, thanks! BTW, have you ever seen or heard boards like mine which cannot mmap device memory correctly from userspace correctly?
>>>> Unfortunately yes. We haven't been able to figure out what exactly goes wrong in
>>>> those cases.
>>> Ok. one more question: only e8860 or all radeon cards have this issue?
>> This applies to all hardware with dedicated memory which needs to be mapped to
>> userspace.
>>
>> That includes all graphics hardware from AMD as well as NVidia and probably a
>> whole bunch of other PCIe devices.
> Can mmio on these devices work fine in kernel space?

The kernel drivers know that this is MMIO and can use special 
instructions/functions like 
writel()/writeq()/memcpy_fromio()/memcpy_toio() etc...

> I cannot see the difference here except user space should use uncacheable mmap to map virtual memory to device space(though I don't know how to use uncacheable mmap), while kernel use uncache ioremap.

The problem with mmap() of MMIO into the userspace is that this can 
easily crash the whole system.

When an application uses memset()/memcpy() on the mapped region and the 
system spontaneous reboots than that's a rather big hardware problem.

Regards,
Christian.


More information about the dri-devel mailing list