Page MenuHomeFreeBSD

arm64 pmap: introduce PHYS_TO_PTE macro
ClosedPublic

Authored by zachary.leaf_arm.com on Apr 26 2023, 12:25 PM.
Tags
None
Referenced Files
F102861660: D39828.diff
Mon, Nov 18, 3:15 AM
Unknown Object (File)
Mon, Oct 28, 2:38 PM
Unknown Object (File)
Oct 18 2024, 7:48 AM
Unknown Object (File)
Oct 3 2024, 8:44 AM
Unknown Object (File)
Sep 30 2024, 8:15 PM
Unknown Object (File)
Sep 30 2024, 1:16 PM
Unknown Object (File)
Sep 30 2024, 10:20 AM
Unknown Object (File)
Sep 30 2024, 10:19 AM
Subscribers

Details

Summary

Introduce macro for PHYS_TO_PTE, setting the groundwork for future
support of various Arm VMSA extensions.

For extensions such as 52-bit VA/PA (FEAT_LPA2), the representation of
an address between a PTE and PA are not equivalent. This macro will
allow converting between the different representations.

Currently PHYS_TO_PTE is a NOP. Replace all instances where we go from
PA to PTE with new PHYS_TO_PTE macro.

Sponsored by: Arm Ltd

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 51313
Build 48204: arc lint + arc unit

Event Timeline

I was initially confused by the macro name and no description. The purpose is to convert a physical address into the output address field of a PTE, not into PTE. At least a comment would be useful, if not a different name.

In D39828#906959, @kib wrote:

I was initially confused by the macro name and no description. The purpose is to convert a physical address into the output address field of a PTE, not into PTE. At least a comment would be useful, if not a different name.

Right. This is really only the first step in creating a PTE, we still need to set all the required attribute bits etc.

It's just about changing the representation back to the input address/pte format. e.g. for FEAT_LPA2, bits 51:50 of an OA are represented by bits 9:8 of the PTE so that will need switching around.

The only alternative I can think of is PA_TO_IA(...) but not sure that's any clearer and we lose the symmetry with PTE_TO_PA; have added a comment as suggested and updated commit message.

At least for now this step is mostly about documenting places where this change of representations will need to happen.

In D39828#906959, @kib wrote:

I was initially confused by the macro name and no description. The purpose is to convert a physical address into the output address field of a PTE, not into PTE. At least a comment would be useful, if not a different name.

Would PA_TO_PTE_OE be better?

sys/arm64/arm64/pmap.c
2001
In D39828#906959, @kib wrote:

I was initially confused by the macro name and no description. The purpose is to convert a physical address into the output address field of a PTE, not into PTE. At least a comment would be useful, if not a different name.

Would PA_TO_PTE_OE be better?

What does OE mean? O is perhaps output.

In D39828#907117, @kib wrote:

What does OE mean? O is perhaps output.

Should be OA for Output address, the field name in the documentation.

In D39828#907117, @kib wrote:

What does OE mean? O is perhaps output.

Should be OA for Output address, the field name in the documentation.

I'm not sure it's immediately clear that the OA in PA_TO_PTE_OA refers to the PTE field name.

I find that slightly confusing since the PA *is* the OA. We're going from OA -> IA not the other way around.

zachary.leaf_arm.com retitled this revision from arm64 pmap: introduce PA_TO_PTE macro to arm64 pmap: introduce PHYS_TO_PTE macro.May 2 2023, 3:10 PM
zachary.leaf_arm.com edited the summary of this revision. (Show Details)
zachary.leaf_arm.com marked an inline comment as done.
  • rename PA_TO_PTE -> PHYS_TO_PTE for symmetry with reverse operation PTE_TO_PHYS
  • pmap_kenter: remove unnecessary & ~L3_OFFSET

Any further issues with this change? I'd like to push with D39827.

This revision is now accepted and ready to land.May 22 2023, 1:49 PM
This revision was automatically updated to reflect the committed changes.