From e0a0e2a53206681db2ff227ef522512eabe106bf Mon Sep 17 00:00:00 2001 From: 4lDO2 <4lDO2@protonmail.com> Date: Sat, 15 Jul 2023 01:14:27 +0200 Subject: [PATCH] Remove physmap in pcid. --- pcid/Cargo.toml | 2 ++ pcid/src/pcie/mod.rs | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pcid/Cargo.toml b/pcid/Cargo.toml index 20276cb043..1226f32d9d 100644 --- a/pcid/Cargo.toml +++ b/pcid/Cargo.toml @@ -27,3 +27,5 @@ smallvec = "1" structopt = { version = "0.3", default-features = false, features = [ "paw" ] } thiserror = "1" toml = "0.5" + +common = { path = "../common" } diff --git a/pcid/src/pcie/mod.rs b/pcid/src/pcie/mod.rs index 7c73d84767..995f4b7482 100644 --- a/pcid/src/pcie/mod.rs +++ b/pcid/src/pcie/mod.rs @@ -3,7 +3,6 @@ use std::collections::BTreeMap; use std::sync::{Arc, Mutex}; use syscall::PAGE_SIZE; -use syscall::flag::PhysmapFlags; use smallvec::SmallVec; @@ -173,7 +172,14 @@ impl Pcie { }; let mut maps_lock = self.maps.lock().unwrap(); let virt_pointer = maps_lock.entry((bus, dev, func)).or_insert_with(|| { - syscall::physmap(base_address_phys as usize + Self::addr_offset_in_bytes(starting_bus, bus, dev, func, 0), PAGE_SIZE, PhysmapFlags::PHYSMAP_NO_CACHE | PhysmapFlags::PHYSMAP_WRITE).unwrap_or_else(|error| panic!("failed to physmap pcie configuration space for {:2x}:{:2x}.{:2x}: {:?}", bus, dev, func, error)) as *mut u32 + common::physmap( + base_address_phys as usize + Self::addr_offset_in_bytes(starting_bus, bus, dev, func, 0), + PAGE_SIZE, + common::Prot { read: true, write: true }, + common::MemoryType::Uncacheable, + ).unwrap_or_else(|error| { + panic!("failed to physmap pcie configuration space for {:2x}:{:2x}.{:2x}: {:?}", bus, dev, func, error) + }) as *mut u32 }); f(Some(&mut *virt_pointer.offset((offset as usize / mem::size_of::()) as isize))) }