Skip to content

Physical memory range ownership for safe memory API#824

Open
sangho2 wants to merge 5 commits intosanghle/lvbs/vmap_copyfrom
sanghle/lvbs/physlock_v2
Open

Physical memory range ownership for safe memory API#824
sangho2 wants to merge 5 commits intosanghle/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 to the physical addresses.
  3. Every read/write access is associated with "copy" to/from Rust-owned buffers.

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 from 99e8320 to 1a140e8 Compare May 1, 2026 23:43
@sangho2 sangho2 force-pushed the sanghle/lvbs/physlock_v2 branch 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
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 2, 2026

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

🤖 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:493
  type PhysMutPtr no longer derives Clone, in /home/runner/work/litebox/litebox/litebox_common_linux/src/physical_pointers.rs:112

--- 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/05b733aa7b9de70ca2c36efbfb050b8dd3d07456/litebox_common_linux/src/vmap.rs:95

--- 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:15
  trait associated type litebox_common_linux::physical_pointers::PhysMapProvider::MapInfo in file /home/runner/work/litebox/litebox/litebox_common_linux/src/physical_pointers.rs:39

@sangho2 sangho2 marked this pull request as ready for review May 5, 2026 22:54
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