mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-21 19:02:30 +00:00
vm-virtio: Remove virtio-pci dependency from VirtioDevice
This patch cleans up the VirtioDevice trait. Since some function are PCI specific and since they are not even used, it makes sense to remove them from the trait definition. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
e2b38cc050
commit
e0fda0611c
@ -7,7 +7,6 @@
|
||||
// SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause
|
||||
|
||||
use super::*;
|
||||
use pci::{PciBarConfiguration, PciCapability};
|
||||
use std::sync::Arc;
|
||||
use vm_memory::{GuestAddress, GuestMemoryMmap, GuestUsize};
|
||||
use vmm_sys_util::eventfd::EventFd;
|
||||
@ -80,16 +79,6 @@ pub trait VirtioDevice: Send {
|
||||
None
|
||||
}
|
||||
|
||||
/// Returns any additional BAR configuration required by the device.
|
||||
fn get_device_bars(&self) -> Vec<PciBarConfiguration> {
|
||||
Vec::new()
|
||||
}
|
||||
|
||||
/// Returns any additional capabilities required by the device.
|
||||
fn get_device_caps(&self) -> Vec<Box<dyn PciCapability>> {
|
||||
Vec::new()
|
||||
}
|
||||
|
||||
/// Returns the list of shared memory regions required by the device.
|
||||
fn get_shm_regions(&self) -> Option<VirtioSharedMemoryList> {
|
||||
None
|
||||
|
@ -559,22 +559,6 @@ impl PciDevice for VirtioPciDevice {
|
||||
// Once the BARs are allocated, the capabilities can be added to the PCI configuration.
|
||||
self.add_pci_capabilities(virtio_pci_bar)?;
|
||||
|
||||
// Allocate the device specific BARs.
|
||||
for config in self.device.get_device_bars() {
|
||||
let device_bar_addr = allocator
|
||||
.allocate_mmio_addresses(None, config.get_size(), None)
|
||||
.ok_or_else(|| PciDeviceError::IoAllocationFailed(config.get_size()))?;
|
||||
config.set_address(device_bar_addr.raw_value());
|
||||
let _device_bar = self.configuration.add_pci_bar(&config).map_err(|e| {
|
||||
PciDeviceError::IoRegistrationFailed(device_bar_addr.raw_value(), e)
|
||||
})?;
|
||||
ranges.push((
|
||||
device_bar_addr,
|
||||
config.get_size(),
|
||||
PciBarRegionType::Memory64BitRegion,
|
||||
));
|
||||
}
|
||||
|
||||
Ok(ranges)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user