Page MenuHomeFreeBSD

arm64/memcpy.S: Make memcpy more compatible with device memory
Needs ReviewPublic

Authored by dan.kotowski_a9development.com on Mar 14 2023, 7:30 PM.
Tags
None
Referenced Files
Unknown Object (File)
May 17 2024, 6:11 AM
Unknown Object (File)
May 17 2024, 6:11 AM
Unknown Object (File)
May 15 2024, 9:18 AM
Unknown Object (File)
May 14 2024, 1:35 PM
Unknown Object (File)
May 14 2024, 10:25 AM
Unknown Object (File)
Dec 11 2023, 12:11 AM
Unknown Object (File)
Dec 2 2023, 6:51 PM
Unknown Object (File)
Nov 7 2023, 6:37 AM
Subscribers

Details

Reviewers
manu
Summary

For normal non-cacheable memory ACE supports 4x128 bit r/w WRAP
transfers or 1x128 bit r/w INCR transfers. By re-ordering the
stp's in memcpy / memmove we can accomodate this better without
impacting the existing code.

This fixes an issue seen on multiple Cortex-A72 SOCs when writing
directly to a PCIe memmapped frame-buffer, which resulted in
corruption.

Originally by Jon Nettleton <jon@solid-run.com>

https://gist.github.com/jnettlet/80f8d09d01c0dc0ffc0122f36ed78de6

https://gist.github.com/jnettlet/f6f8b49bb7c731255c46f541f875f436

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

What is calling memcpy on the device memory? The kernel should be using bus_space to write to a device.

At least in Linux, the drm drivers create a fb0 device and things like mesa may talk directly to that via memcpy.

If it's for mesa this change is unlikely to help as this is a kernel only memcpy while, as far as I know, mesa is userspace only so will use one of the memcpy implementations from the Arm Optimized Routines in contrib/arm-optimized-routines/string/aarch64/mempy*

Added the same reorderings to sys/arm64/arm64/memcpy.S

Can you send the Arm Optimized Routine change upstream [1]. I'd prefer to not maintain a local patch that is likely to get clobbered when new releases are imported.

[1] https://github.com/ARM-software/optimized-routines