mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-03-20 07:58:55 +00:00
pci: Add new DeviceRelocation trait
This new trait will allow the VMM to implement the mechanism following a BAR modification regarding its location in the guest address space. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
5cc1e73e52
commit
3e37f59933
@ -91,3 +91,18 @@ pub trait PciDevice: BusDevice {
|
||||
/// * `data` - The data to write.
|
||||
fn write_bar(&mut self, _base: u64, _offset: u64, _data: &[u8]) {}
|
||||
}
|
||||
|
||||
/// This trait defines a set of functions which can be triggered whenever a
|
||||
/// PCI device is modified in any way.
|
||||
pub trait DeviceRelocation: Send + Sync {
|
||||
/// The BAR needs to be moved to a different location in the guest address
|
||||
/// space. This follows a decision from the software running in the guest.
|
||||
fn move_bar(
|
||||
&self,
|
||||
old_base: u64,
|
||||
new_base: u64,
|
||||
len: u64,
|
||||
pci_dev: &mut dyn PciDevice,
|
||||
region_type: PciBarRegionType,
|
||||
);
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ pub use self::configuration::{
|
||||
PciNetworkControllerSubclass, PciProgrammingInterface, PciSerialBusSubClass, PciSubclass,
|
||||
};
|
||||
pub use self::device::{
|
||||
Error as PciDeviceError, InterruptDelivery, InterruptParameters, PciDevice,
|
||||
DeviceRelocation, Error as PciDeviceError, InterruptDelivery, InterruptParameters, PciDevice,
|
||||
};
|
||||
pub use self::msi::MsiCap;
|
||||
pub use self::msix::{MsixCap, MsixConfig, MsixTableEntry, MSIX_TABLE_ENTRY_SIZE};
|
||||
|
Loading…
x
Reference in New Issue
Block a user