From a5fd001dcb620d88cda24afcc5c89e79ef293da5 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Mon, 30 Mar 2026 19:25:51 +0200 Subject: [PATCH] Use PageFlags::write_combining instead of custom flag --- rmm/src/arch/riscv64/mod.rs | 1 - rmm/src/arch/x86_shared.rs | 2 -- src/scheme/memory.rs | 17 +++++++---------- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/rmm/src/arch/riscv64/mod.rs b/rmm/src/arch/riscv64/mod.rs index 647c364372..bcb65af052 100644 --- a/rmm/src/arch/riscv64/mod.rs +++ b/rmm/src/arch/riscv64/mod.rs @@ -8,6 +8,5 @@ bitflags::bitflags! { pub struct EntryFlags: usize { const NO_CACHE = 1 << 4; const DEV_MEM = 0; - const WRITE_COMBINING = 0; } } diff --git a/rmm/src/arch/x86_shared.rs b/rmm/src/arch/x86_shared.rs index 66e760657f..b05c4f3339 100644 --- a/rmm/src/arch/x86_shared.rs +++ b/rmm/src/arch/x86_shared.rs @@ -1,8 +1,6 @@ bitflags::bitflags! { pub struct EntryFlags: usize { const NO_CACHE = 1 << 4; - const HUGE_PAGE = 1 << 7; - const GLOBAL = 1 << 8; const DEV_MEM = 0; } } diff --git a/src/scheme/memory.rs b/src/scheme/memory.rs index c5634117e3..4415aa95d1 100644 --- a/src/scheme/memory.rs +++ b/src/scheme/memory.rs @@ -149,23 +149,20 @@ impl MemoryScheme { // Default MemoryType::Writeback => (), - #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] // TODO: AARCH64 - MemoryType::WriteCombining => { - page_flags = page_flags.custom_flag(EntryFlags::HUGE_PAGE.bits(), true) - } + MemoryType::WriteCombining => page_flags = page_flags.write_combining(true), MemoryType::Uncacheable => { page_flags = page_flags.custom_flag(EntryFlags::NO_CACHE.bits(), true) } - // MemoryType::DeviceMemory doesn't exist on x86 && x86_64, which instead support - // uncacheable, write-combining, write-through, write-protect, and write-back. - #[cfg(target_arch = "aarch64")] MemoryType::DeviceMemory => { - page_flags = page_flags.custom_flag(EntryFlags::DEV_MEM.bits(), true) + // MemoryType::DeviceMemory doesn't exist on x86 && x86_64, which instead support + // uncacheable, write-combining, write-through, write-protect, and write-back. + #[cfg(target_arch = "aarch64")] + { + page_flags = page_flags.custom_flag(EntryFlags::DEV_MEM.bits(), true); + } } - - _ => (), } Grant::physmap(