[iommu][arm_smmu] Port shared stage-1 modules

Port the shared stage-1 VMSAv8-64 modules in
//zircon/kernel/dev/iommu/arm_smmu/common/ to Rust so they can be shared
across both SMMUv2 and SMMUv3 and compiled in both the unified Zircon
kernel crate (cfg(is_kernel)) and host unit tests (cfg(not(is_kernel))):

- common/env.rs: zero-cost SmmuEnv seam abstracting PMM page
  allocation/reclamation, physmap conversions, CPU data-cache cleaning,
  and PinnedVmObject physical range lookups. It also has the single
  observation point for stores into memory the SMMU hardware reads,
  SmmuEnv::observe_hw_visible_write, which reports a store to the host
  test hardware model and is a no-op in the kernel.
- common/constants.rs: shared IOMMU permission flags, page geometry
  constants, and operating mode enumerations.
- common/smmu_mode.rs: kernel.arm-smmu-mode parser and validator. It
  reads each <base_addr> token as the C++ parser's strtoul(.., 0) did,
  including that function's quirks, so that an existing command line
  selects the same mode.
- common/vmsav8_64.rs: VMSAv8-64 stage-1 page table descriptor helpers,
  permission lookup table, and the two functions through which every
  translation table store goes, write_pte and zero_table_page.
- common/page_cache.rs: intrusive LIFO translation table page cache.
  Trimmed pages are returned to the PMM in one batch, as in C++.
- common/translation_table.rs: 4-level translation table walk,
  allocation, cache-cleaning, and empty-table reclamation cursor.
- common/device_aspace.rs: stage-1 device address space managing the
  translation table hierarchy and RegionAllocator IOVA space.

Places where the Rust deliberately differs from the C++ are marked
with a "Temporary porting note:" comment.

Bug: 565848139
Test: fx build --host //zircon/kernel/dev/iommu/arm_smmu/tests:arm_smmu_tests
Test: arm_smmu_tests_binary
Change-Id: I9da77963238c6f8498c8204758c8dca8516badec
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1912407
Reviewed-by: Abdulla Kamar <abdulla@google.com>
Fuchsia-Auto-Submit: Dustin Green <dustingreen@google.com>
Reviewed-by: Adrian Danis <adanis@google.com>
Commit-Queue: Dustin Green <dustingreen@google.com>
18 files changed
tree: f070be94d6fab656c3b78a18c9e9682a1c79fcd3
  1. .agents/
  2. .helix/
  3. .mise/
  4. boards/
  5. build/
  6. bundles/
  7. docs/
  8. examples/
  9. manifests/
  10. products/
  11. scripts/
  12. sdk/
  13. src/
  14. third_party/
  15. tools/
  16. zircon/
  17. .clang-format
  18. .clang-tidy
  19. .cursorignore
  20. .dtsfmtrc.toml
  21. .editorconfig
  22. .fx-root
  23. .geminiignore
  24. .git-blame-ignore-revs
  25. .gitattributes
  26. .gitignore
  27. .gitmodules
  28. .gn
  29. .ignore
  30. .watchmanconfig
  31. AGENTS.md
  32. analysis_options.yaml
  33. AUTHORS
  34. BUILD.gn
  35. CODE_OF_CONDUCT.md
  36. CONTRIBUTING.md
  37. fuchsia.code-workspace
  38. LICENSE
  39. OWNERS
  40. PATENTS
  41. pyproject.toml
  42. pyrightconfig.json
  43. README.md
  44. rustfmt.toml
  45. shac.star
  46. shac.textproto
  47. TESTING.json5
README.md

Fuchsia

What is Fuchsia?

Fuchsia is an open source, general purpose operating system supporting modern 64-bit Intel and ARM processors.

We expect everyone interacting with our project to respect our code of conduct.

Read more about Fuchsia's principles.

How can I build and run Fuchsia?

See Getting Started.

Where can I learn more about Fuchsia?

See fuchsia.dev.