Page MenuHomeFreeBSD

dpaa2: Simplify addresses translation with PHYS_TO_DMAP
ClosedPublic

Authored by dsl on May 3 2023, 10:25 AM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 22 2024, 8:38 AM
Unknown Object (File)
Feb 22 2024, 8:38 AM
Unknown Object (File)
Feb 22 2024, 8:38 AM
Unknown Object (File)
Feb 21 2024, 12:24 PM
Unknown Object (File)
Feb 16 2024, 2:47 PM
Unknown Object (File)
Jan 11 2024, 1:16 AM
Unknown Object (File)
Dec 26 2023, 5:41 PM
Unknown Object (File)
Dec 20 2023, 6:27 AM

Details

Summary

All frames will have their struct dpaa2_fa annotations populated
to find correct buffers based on the physical addresses stored in
the frames descriptors. It helps to avoid carrying different indexes
in the MSBs of the physical addresses and removes an artifical limit
to the number of Rx/Tx buffers/descriptors.

freebsd-arm discussion: https://lists.freebsd.org/archives/freebsd-arm/2023-April/002478.html

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

dsl requested review of this revision.May 3 2023, 10:25 AM

I've removed a [DMAP_MIN_PHYSADDR,DMAP_MAX_PHYSADDR] range limit for DMA tags as @mhorne explained. Initially, I thought that it's a requirement to calculate KVA by PHYS_TO_DMAP properly.

All the changes I pointed out seem of more cosmetic nature. I'll leave it up to you if you want to do them.

sys/dev/dpaa2/dpaa2_ni.c
3356

Do we need a runtime check in all cases for this or could this be a KASSERT as well so it'll not be done in non-debug code?

3472

KASSERT like above?

3510

And again here.

sys/dev/dpaa2/dpaa2_swp.h
337

You could add a CTASSERT if this needs to be enforced hard.

This revision is now accepted and ready to land.May 5 2023, 10:08 AM

And if @mhorne is okay as well, feel free to commit.
Approved by: bz (mentor)

sys/dev/dpaa2/dpaa2_ni.c
3356

It can be converted to KASSERT, but I haven't heard from Matt about https://github.com/mcusim/freebsd-src/issues/8 for sometime already. Let me keep this check for now and we'll return to it in future reviews as I'm re-working Rx/Tx routines at the moment.

3472

Answered above

I've added CTASSERT checks to all of the types which sizes are fixed or shouldn't exceed limits enforced by DPAA2 firmware.

This revision now requires review to proceed.May 8 2023, 11:28 AM

Makes sense to me, but obviously I do not understand the driver at large. The usage of PHYS_TO_DMAP() is valid.

sys/dev/dpaa2/dpaa2_ni.c
2031–2036

So, this was an artificial (software) limit so that you could use the high bits for encoding indices?

3351–3352
sys/dev/dpaa2/dpaa2_swp.h
229–256

This is a strange use of an enum rather than #define.

This revision is now accepted and ready to land.May 8 2023, 1:24 PM
sys/dev/dpaa2/dpaa2_ni.c
2031–2036

Not actually. According to the LX2160A DPAA2 Low-Level Hardware Reference Manual, buffer address in the frame descriptor is 49-bit long, but bits 49-63 can be used as a software token to assist in the physical to virtual address translation which isn't needed anymore.

Great. I am doing a rebuild now.

sys/dev/dpaa2/dpaa2_ni.c
3356

ACK.

I've replaced anonymous enum with macro definitions for sizes.

This revision now requires review to proceed.May 9 2023, 10:32 AM
This revision was not accepted when it landed; it landed in state Needs Review.May 11 2023, 3:46 PM
This revision was automatically updated to reflect the committed changes.