mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
devices: Extend the Bus trait to carry the device range base
With the range base for the IO/MMIO vm exit address, a device with multiple ranges has all the needed information for resolving which of its range the exit is coming from Fixes: #87 Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
@@ -198,7 +198,7 @@ impl PciConfigIo {
|
||||
}
|
||||
|
||||
impl BusDevice for PciConfigIo {
|
||||
fn read(&mut self, offset: u64, data: &mut [u8]) {
|
||||
fn read(&mut self, _base: u64, offset: u64, data: &mut [u8]) {
|
||||
// `offset` is relative to 0xcf8
|
||||
let value = match offset {
|
||||
0...3 => self.config_address,
|
||||
@@ -220,7 +220,7 @@ impl BusDevice for PciConfigIo {
|
||||
}
|
||||
}
|
||||
|
||||
fn write(&mut self, offset: u64, data: &[u8]) {
|
||||
fn write(&mut self, _base: u64, offset: u64, data: &[u8]) {
|
||||
// `offset` is relative to 0xcf8
|
||||
match offset {
|
||||
o @ 0...3 => self.set_config_address(o, data),
|
||||
@@ -255,7 +255,7 @@ impl PciConfigMmio {
|
||||
}
|
||||
|
||||
impl BusDevice for PciConfigMmio {
|
||||
fn read(&mut self, offset: u64, data: &mut [u8]) {
|
||||
fn read(&mut self, _base: u64, offset: u64, data: &mut [u8]) {
|
||||
// Only allow reads to the register boundary.
|
||||
let start = offset as usize % 4;
|
||||
let end = start + data.len();
|
||||
@@ -272,7 +272,7 @@ impl BusDevice for PciConfigMmio {
|
||||
}
|
||||
}
|
||||
|
||||
fn write(&mut self, offset: u64, data: &[u8]) {
|
||||
fn write(&mut self, _base: u64, offset: u64, data: &[u8]) {
|
||||
if offset > u64::from(u32::max_value()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user