Unverified Commit e6aeded9 authored by zyno42's avatar zyno42
Browse files

Update `libtapasco` dependencies

Remove the `volatile` crate in favor of the
`std::ptr::{read,write}_volatile` functions.

Also add `Cargo.lock` for `libtapasco_tests`.
parent ffc11eef
This diff is collapsed.
......@@ -11,15 +11,15 @@ lto = "fat"
[dependencies]
tapasco = { path = "../../../libtapasco" }
env_logger = "0.7.1"
clap = "2.33.0"
log = "0.4.8"
snafu = "0.6.6"
indicatif = "0.14.0"
average = "0.10.4"
env_logger = "0.9.0"
clap = "2.33.3"
log = "0.4.14"
snafu = "0.6.10"
indicatif = "0.16.2"
average = "0.13.1"
uom = "0.31.1"
rayon = "1.3.0"
rayon = "1.5.1"
num_cpus = "1.13.0"
crossbeam = "0.7.3"
rand = "0.7.3"
itertools = "0.9.0"
crossbeam = "0.8.1"
rand = "0.8.4"
itertools = "0.10.1"
......@@ -19,23 +19,22 @@ default = []
tapasco-debug = []
[dependencies]
log = "0.4.8"
chrono = "0.4.11"
nix = "0.17.0"
log = "0.4.14"
chrono = "0.4.19"
nix = "0.22.1"
memmap = "0.7.0"
getset = "0.1.0"
snafu = "0.6.6"
prost = "0.6.1"
env_logger = "0.7.1"
getset = "0.1.1"
snafu = "0.6.10"
prost = "0.8.0"
env_logger = "0.9.0"
lockfree = "0.5.1"
crossbeam = "0.7.3"
volatile = "0.2.6"
bytes = "0.5.4"
libc = "0.2.70"
config = "0.10.1"
serde = "1.0.115"
crossbeam = "0.8.1"
bytes = "1.1.0"
libc = "0.2.102"
config = "0.11.0"
serde = "1.0.130"
vfio-bindings = "0.2.0"
[build-dependencies]
prost-build = "0.6.1"
cbindgen = "0.14.2"
prost-build = "0.8.0"
cbindgen = "0.20.0"
......@@ -45,7 +45,7 @@ use std::sync::Arc;
use std::sync::Mutex;
use std::sync::MutexGuard;
use std::thread;
use volatile::Volatile;
use std::ptr::write_volatile;
impl<T> From<std::sync::PoisonError<T>> for Error {
fn from(_error: std::sync::PoisonError<T>) -> Self {
......@@ -198,29 +198,25 @@ impl UserSpaceDMA {
let mut offset = (self.engine_offset as usize) as isize;
unsafe {
let ptr = dma_engine_memory.as_ptr().offset(offset);
let volatile_ptr = ptr as *mut Volatile<u64>;
(*volatile_ptr).write(addr_host);
write_volatile(ptr as *mut u64, addr_host);
};
offset = (self.engine_offset as usize + 0x08) as isize;
unsafe {
let ptr = dma_engine_memory.as_ptr().offset(offset);
let volatile_ptr = ptr as *mut Volatile<u64>;
(*volatile_ptr).write(addr_device);
write_volatile(ptr as *mut u64, addr_device);
};
offset = (self.engine_offset as usize + 0x10) as isize;
unsafe {
let ptr = dma_engine_memory.as_ptr().offset(offset);
let volatile_ptr = ptr as *mut Volatile<u64>;
(*volatile_ptr).write(size);
write_volatile(ptr as *mut u64, size);
};
offset = (self.engine_offset as usize + 0x20) as isize;
unsafe {
let ptr = dma_engine_memory.as_ptr().offset(offset);
let volatile_ptr = ptr as *mut Volatile<u64>;
(*volatile_ptr).write(if from_device { 0x1000_1000 } else { 0x1000_0001 });
write_volatile(ptr as *mut u64, if from_device { 0x1000_1000 } else { 0x1000_0001 });
};
}
......
......@@ -92,18 +92,10 @@ impl Interrupt {
return Ok(u64::from_ne_bytes(buf));
}
Err(e) => {
let e_no = e.as_errno();
match e_no {
Some(e_no_matched) => {
if e_no_matched == nix::errno::Errno::EAGAIN {
std::thread::yield_now();
} else {
r.context(ErrorEventFDRead)?;
}
}
None => {
r.context(ErrorEventFDRead)?;
}
if e == nix::errno::Errno::EAGAIN {
std::thread::yield_now();
} else {
r.context(ErrorEventFDRead)?;
}
}
}
......@@ -125,18 +117,10 @@ impl Interrupt {
return Ok(u64::from_ne_bytes(buf));
}
Err(e) => {
let e_no = e.as_errno();
match e_no {
Some(e_no_matched) => {
if e_no_matched == nix::errno::Errno::EAGAIN {
return Ok(0);
}
r.context(ErrorEventFDRead)?;
}
None => {
r.context(ErrorEventFDRead)?;
}
if e == nix::errno::Errno::EAGAIN {
return Ok(0);
} else {
r.context(ErrorEventFDRead)?;
}
}
}
......
......@@ -33,7 +33,6 @@ extern crate bytes;
extern crate crossbeam;
extern crate env_logger;
extern crate lockfree;
extern crate volatile;
pub mod allocator;
pub mod debug;
......
......@@ -28,7 +28,7 @@ use memmap::MmapMut;
use snafu::ResultExt;
use std::fs::File;
use std::sync::Arc;
use volatile::Volatile;
use std::ptr::write_volatile;
#[derive(Debug, Snafu)]
pub enum Error {
......@@ -148,8 +148,7 @@ impl PE {
let offset = self.offset as isize;
unsafe {
let ptr = self.memory.as_ptr().offset(offset);
let volatile_ptr = ptr as *mut Volatile<u32>;
(*volatile_ptr).write(1);
write_volatile(ptr as *mut u32, 1);
}
self.active = true;
Ok(())
......@@ -185,8 +184,7 @@ impl PE {
let offset = (self.offset as usize + 0x0c) as isize;
let r = unsafe {
let ptr = self.memory.as_ptr().offset(offset);
let volatile_ptr = ptr as *mut Volatile<u32>;
(*volatile_ptr).read()
ptr.read_volatile()
};
let s = (r & 1) == 1;
trace!("Reading interrupt status from 0x{:x} -> {}", offset, s);
......@@ -198,8 +196,7 @@ impl PE {
trace!("Resetting interrupts: 0x{:x} -> {}", offset, v);
unsafe {
let ptr = self.memory.as_ptr().offset(offset);
let volatile_ptr = ptr as *mut Volatile<u32>;
(*volatile_ptr).write(if v { 1 } else { 0 });
write_volatile(ptr as *mut u32, if v { 1 } else { 0 });
}
Ok(())
}
......@@ -208,15 +205,13 @@ impl PE {
let mut offset = (self.offset as usize + 0x04) as isize;
let g = unsafe {
let ptr = self.memory.as_ptr().offset(offset);
let volatile_ptr = ptr as *mut Volatile<u32>;
(*volatile_ptr).read()
ptr.read_volatile()
} & 1
== 1;
offset = (self.offset as usize + 0x08) as isize;
let l = unsafe {
let ptr = self.memory.as_ptr().offset(offset);
let volatile_ptr = ptr as *mut Volatile<u32>;
(*volatile_ptr).read()
ptr.read_volatile()
} & 1
== 1;
trace!("Interrupt status is {}, {}", g, l);
......@@ -229,15 +224,13 @@ impl PE {
trace!("Enabling interrupts: 0x{:x} -> 1", offset);
unsafe {
let ptr = self.memory.as_ptr().offset(offset);
let volatile_ptr = ptr as *mut Volatile<u32>;
(*volatile_ptr).write(1);
write_volatile(ptr as *mut u32, 1);
}
offset = (self.offset as usize + 0x08) as isize;
trace!("Enabling global interrupts: 0x{:x} -> 1", offset);
unsafe {
let ptr = self.memory.as_ptr().offset(offset);
let volatile_ptr = ptr as *mut Volatile<u32>;
(*volatile_ptr).write(1);
write_volatile(ptr as *mut u32, 1);
}
Ok(())
}
......@@ -248,8 +241,8 @@ impl PE {
unsafe {
let ptr = self.memory.as_ptr().offset(offset);
match arg {
PEParameter::Single32(x) => (*(ptr as *mut Volatile<u32>)).write(x),
PEParameter::Single64(x) => (*(ptr as *mut Volatile<u64>)).write(x),
PEParameter::Single32(x) => write_volatile(ptr as *mut u32, x),
PEParameter::Single64(x) => write_volatile(ptr as *mut u64, x),
_ => return Err(Error::UnsupportedParameter { param: arg }),
};
}
......@@ -262,10 +255,10 @@ impl PE {
let ptr = self.memory.as_ptr().offset(offset);
match bytes {
4 => Ok(PEParameter::Single32(
(*(ptr as *const Volatile<u32>)).read(),
ptr.cast::<u32>().read_volatile()
)),
8 => Ok(PEParameter::Single64(
(*(ptr as *const Volatile<u64>)).read(),
ptr.cast::<u64>().read_volatile()
)),
_ => Err(Error::UnsupportedRegisterSize { param: bytes }),
}
......@@ -284,7 +277,7 @@ impl PE {
let offset = (self.offset as usize + 0x10) as isize;
let r = unsafe {
let ptr = self.memory.as_ptr().offset(offset);
(*(ptr as *const Volatile<u64>)).read()
ptr.cast::<u64>().read_volatile()
};
trace!("Reading return value: {}", r);
r
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment