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)
Fri, Nov 22, 2:29 PM
Unknown Object (File)
Oct 9 2024, 6:48 PM
Unknown Object (File)
Oct 6 2024, 10:51 AM
Unknown Object (File)
Oct 3 2024, 4:17 PM
Unknown Object (File)
Oct 1 2024, 3:41 PM
Unknown Object (File)
Oct 1 2024, 2:24 PM
Unknown Object (File)
Sep 29 2024, 2:17 PM
Unknown Object (File)
Sep 27 2024, 5:38 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