Conversation
royzah
force-pushed
the
arm64-va-to-pa
branch
from
September 19, 2026 12:52
3f74621 to
02e7819
Compare
xiaoxiang781216
previously approved these changes
Sep 19, 2026
up_addrenv_va_to_pa() is declared in include/nuttx/arch.h but implemented only by armv7-a, so no arm64 port can map a virtual address to a physical one. A driver whose device addresses memory physically has nothing to call. The translation is asked of the MMU with AT S1E1R rather than walked in software, so it answers for whatever is actually mapped: any granule size, block or page, at any level, and it cannot drift from the tables in use. PAR_EL1 is one register per CPU, so nothing may run between the translation and reading the result. Interrupts are banked with it, so masking them locally is sufficient and SMP needs nothing further. Returns zero for an address that is not mapped for a privileged read, which is what the declaration in arch.h specifies. Note this differs from the armv7-a implementation, which returns the virtual address unchanged. Signed-off-by: Royyan Zahir <royzah@gmail.com>
royzah
force-pushed
the
arm64-va-to-pa
branch
from
September 19, 2026 18:21
02e7819 to
fc50a34
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
up_addrenv_va_to_pa()is declared in https://github.com/apache/nuttx/blob/master/include/nuttx/arch.h but implemented only by armv7-a, so no arm64 port can map a virtual address to a physical one. A driver whose device addresses memory physically has nothing to call.Asked of the MMU with
AT S1E1Rrather than walked in software, so it answers for whatever is actually mapped: any granule, block or page, at any level, and it cannot drift from the tables in use.Two points for review:
PAR_EL1is one register per CPU, so nothing may run between the translation and reading it. Interrupts are banked with it, so masking locally is enough and SMP needs nothing further.up_addrenv_pa_to_va()is untouched: there is no reverse ofAT.Impact
arm64 with
CONFIG_ARCH_HAVE_MMU. New file, no existing behaviour changes.Testing
Draft: not yet on hardware. Built for
imx93-evk:nsh:arm64_physpgaddr.ocompiles with no diagnostics, andtools/nxstyleis clean. The disassembly is 12 branchless instructions, with interrupts masked across only the five that touchPAR_EL1. Linking needs a bare-metal aarch64 toolchain, which this machine does not have.Owed before ready: a runtime log on an i.MX93 translating a known mapping.