Skip to content

Physical memory range ownership for safe memory API#824

Open
sangho2 wants to merge 1 commit into
sanghle/lvbs/vmap_copyfrom
sanghle/lvbs/physlock_v2
Open

Physical memory range ownership for safe memory API#824
sangho2 wants to merge 1 commit into
sanghle/lvbs/vmap_copyfrom
sanghle/lvbs/physlock_v2

Conversation

@sangho2
Copy link
Copy Markdown
Contributor

@sangho2 sangho2 commented May 1, 2026

This PR adds support for physical memory range ownership, which is the last piece to make the VTL0/normal-world physical memory access API "safe". Now, our API is safe in the DMA/shared-memory sense:

  1. A physical address range can have up to one owner (i.e., no shared mapping).
  2. There is no Rust reference/slice to the physical addresses.
  3. Every read/write access is associated with "copy" to/from Rust-owned buffers.
  4. Memory copy from/to the physical addresses is based on asm (i.e., no Rust function which is undefined).

External agents (VTL0, hypervisor, peripherals, ...) can still access those physical addresses but this is out of LiteBox/Rust's control. We do have the protect method to prevent VTL0's access to them if needed.

@sangho2 sangho2 added the must-not-merge:prototype An experimental/proof-of-concept PR that must not be merged. label May 1, 2026
@sangho2 sangho2 changed the title Physical memory range ownership for safe memory read/write API Physical memory range ownership for safe memory API May 1, 2026
@sangho2 sangho2 force-pushed the sanghle/lvbs/physlock_v2 branch 2 times, most recently from 420bea6 to d0c665c Compare May 2, 2026 03:32
@sangho2 sangho2 removed the must-not-merge:prototype An experimental/proof-of-concept PR that must not be merged. label May 2, 2026
@sangho2 sangho2 marked this pull request as ready for review May 5, 2026 22:54
@sangho2 sangho2 force-pushed the sanghle/lvbs/vmap_copy branch from 8b9b1f7 to 3a833f2 Compare May 15, 2026 16:40
@sangho2 sangho2 force-pushed the sanghle/lvbs/physlock_v2 branch from 41e36c2 to a6c1102 Compare May 15, 2026 16:51
@sangho2 sangho2 added the must-not-merge:blocked-on-other-changes Other changes/PRs to be handled first. Label not needed for non-main changes. label May 15, 2026
@sangho2 sangho2 force-pushed the sanghle/lvbs/physlock_v2 branch from 2473ace to 27bb1dd Compare May 15, 2026 20:24
@sangho2 sangho2 force-pushed the sanghle/lvbs/vmap_copy branch from 24fcce1 to 3dc8650 Compare May 21, 2026 20:28
@sangho2 sangho2 force-pushed the sanghle/lvbs/vmap_copy branch from 24e1d87 to 9b0f0f0 Compare May 29, 2026 02:48
@sangho2 sangho2 force-pushed the sanghle/lvbs/physlock_v2 branch from 6dbe423 to f6d2dc0 Compare May 29, 2026 04:26
@sangho2 sangho2 removed the must-not-merge:blocked-on-other-changes Other changes/PRs to be handled first. Label not needed for non-main changes. label May 29, 2026
@github-actions
Copy link
Copy Markdown

ℹ️ Note: This semver check was run against the sanghle/lvbs/vmap_copy branch, not main or ulitebox.

🤖 SemverChecks 🤖 ⚠️ Potential breaking API changes detected ⚠️

Click for details
--- failure derive_trait_impl_removed: built-in derived trait no longer implemented ---

Description:
A public type has stopped deriving one or more traits. This can break downstream code that depends on those types implementing those traits.
        ref: https://doc.rust-lang.org/reference/attributes/derive.html#derive
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.47.0/src/lints/derive_trait_impl_removed.ron

Failed in:
  type PhysConstPtr no longer derives Clone, in /home/runner/work/litebox/litebox/litebox_common_linux/src/physical_pointers.rs:474
  type PhysMutPtr no longer derives Clone, in /home/runner/work/litebox/litebox/litebox_common_linux/src/physical_pointers.rs:91

--- failure struct_missing: pub struct removed or renamed ---

Description:
A publicly-visible struct cannot be imported by its prior path. A `pub use` may have been removed, or the struct itself may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.47.0/src/lints/struct_missing.ron

Failed in:
  struct litebox_common_linux::vmap::PhysPageMapInfo, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-sanghle_lvbs_vmap_copy/acd6ae561116135b6915cf113a535d2c2e02cfc9/litebox_common_linux/src/vmap.rs:111

--- failure trait_associated_type_added: non-sealed public trait added associated type without default value ---

Description:
A non-sealed trait has gained an associated type without a default value, which breaks downstream implementations of the trait
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#trait-new-item-no-default
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.47.0/src/lints/trait_associated_type_added.ron

Failed in:
  trait associated type litebox_common_linux::vmap::VmapManager::MapInfo in file /home/runner/work/litebox/litebox/litebox_common_linux/src/vmap.rs:19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant