Skip to content

Physical memory range ownership for safe memory API#824

Open
sangho2 wants to merge 14 commits into
sanghle/lvbs/vmap_copyfrom
sanghle/lvbs/physlock_v2
Open

Physical memory range ownership for safe memory API#824
sangho2 wants to merge 14 commits 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 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 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
@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:553
  type PhysMutPtr no longer derives Clone, in /home/runner/work/litebox/litebox/litebox_common_linux/src/physical_pointers.rs:143

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

--- failure trait_added_supertrait: non-sealed trait added new supertraits ---

Description:
A non-sealed trait added one or more supertraits, which breaks downstream implementations of the trait
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#generic-bounds-tighten
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.47.0/src/lints/trait_added_supertrait.ron

Failed in:
  trait litebox_common_linux::physical_pointers::PhysMapProvider gained Clone in file /home/runner/work/litebox/litebox/litebox_common_linux/src/physical_pointers.rs:39

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

--- failure trait_method_receiver_added: trait method receiver added ---

Description:
A trait method in an unsealed trait added a receiver, breaking downstream implementations.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#trait-item-signature
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.47.0/src/lints/trait_method_receiver_added.ron

Failed in:
  litebox_common_linux::physical_pointers::PhysMapProvider::validate_unowned now takes &Self, in /home/runner/work/litebox/litebox/litebox_common_linux/src/physical_pointers.rs:42
  litebox_common_linux::physical_pointers::PhysMapProvider::vmap now takes &Self, in /home/runner/work/litebox/litebox/litebox_common_linux/src/physical_pointers.rs:49
  litebox_common_linux::physical_pointers::PhysMapProvider::vunmap now takes &Self, in /home/runner/work/litebox/litebox/litebox_common_linux/src/physical_pointers.rs:60

@sangho2 sangho2 force-pushed the sanghle/lvbs/vmap_copy branch from 24fcce1 to 3dc8650 Compare May 21, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

must-not-merge:blocked-on-other-changes Other changes/PRs to be handled first. Label not needed for non-main changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant