mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-05 04:15:20 +00:00
vmm: Fix build errors with "pci" feature on AArch64
Signed-off-by: Michael Zhao <michael.zhao@arm.com>
This commit is contained in:
parent
9ec4aa4019
commit
17057a0dd9
@ -110,16 +110,19 @@ impl PciBus {
|
|||||||
pub fn register_mapping(
|
pub fn register_mapping(
|
||||||
&self,
|
&self,
|
||||||
dev: Arc<Mutex<dyn BusDevice>>,
|
dev: Arc<Mutex<dyn BusDevice>>,
|
||||||
io_bus: &devices::Bus,
|
#[cfg(target_arch = "x86_64")] io_bus: &devices::Bus,
|
||||||
mmio_bus: &devices::Bus,
|
mmio_bus: &devices::Bus,
|
||||||
bars: Vec<(GuestAddress, GuestUsize, PciBarRegionType)>,
|
bars: Vec<(GuestAddress, GuestUsize, PciBarRegionType)>,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
for (address, size, type_) in bars {
|
for (address, size, type_) in bars {
|
||||||
match type_ {
|
match type_ {
|
||||||
PciBarRegionType::IORegion => {
|
PciBarRegionType::IORegion => {
|
||||||
|
#[cfg(target_arch = "x86_64")]
|
||||||
io_bus
|
io_bus
|
||||||
.insert(dev.clone(), address.raw_value(), size)
|
.insert(dev.clone(), address.raw_value(), size)
|
||||||
.map_err(PciRootError::PioInsert)?;
|
.map_err(PciRootError::PioInsert)?;
|
||||||
|
#[cfg(target_arch = "aarch64")]
|
||||||
|
error!("I/O region is not supported");
|
||||||
}
|
}
|
||||||
PciBarRegionType::Memory32BitRegion | PciBarRegionType::Memory64BitRegion => {
|
PciBarRegionType::Memory32BitRegion | PciBarRegionType::Memory64BitRegion => {
|
||||||
mmio_bus
|
mmio_bus
|
||||||
|
@ -762,7 +762,7 @@ impl PciDevice for VfioPciDevice {
|
|||||||
.ok_or_else(|| PciDeviceError::IoAllocationFailed(region_size))?;
|
.ok_or_else(|| PciDeviceError::IoAllocationFailed(region_size))?;
|
||||||
}
|
}
|
||||||
#[cfg(target_arch = "aarch64")]
|
#[cfg(target_arch = "aarch64")]
|
||||||
unimplemented!();
|
unimplemented!()
|
||||||
} else {
|
} else {
|
||||||
if is_64bit_bar {
|
if is_64bit_bar {
|
||||||
// 64 bits Memory BAR
|
// 64 bits Memory BAR
|
||||||
@ -875,7 +875,7 @@ impl PciDevice for VfioPciDevice {
|
|||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
allocator.free_io_addresses(region.start, region.length);
|
allocator.free_io_addresses(region.start, region.length);
|
||||||
#[cfg(target_arch = "aarch64")]
|
#[cfg(target_arch = "aarch64")]
|
||||||
unimplemented!();
|
error!("I/O region is not supported");
|
||||||
}
|
}
|
||||||
PciBarRegionType::Memory32BitRegion => {
|
PciBarRegionType::Memory32BitRegion => {
|
||||||
allocator.free_mmio_hole_addresses(region.start, region.length);
|
allocator.free_mmio_hole_addresses(region.start, region.length);
|
||||||
|
@ -87,7 +87,7 @@ use vm_migration::{
|
|||||||
use vm_virtio::{VirtioDeviceType, VirtioIommuRemapping};
|
use vm_virtio::{VirtioDeviceType, VirtioIommuRemapping};
|
||||||
use vmm_sys_util::eventfd::EventFd;
|
use vmm_sys_util::eventfd::EventFd;
|
||||||
|
|
||||||
#[cfg(feature = "mmio_support")]
|
#[cfg(any(feature = "mmio_support", target_arch = "aarch64"))]
|
||||||
const MMIO_LEN: u64 = 0x1000;
|
const MMIO_LEN: u64 = 0x1000;
|
||||||
|
|
||||||
#[cfg(feature = "pci_support")]
|
#[cfg(feature = "pci_support")]
|
||||||
@ -454,6 +454,8 @@ impl DeviceRelocation for AddressManager {
|
|||||||
) -> std::result::Result<(), std::io::Error> {
|
) -> std::result::Result<(), std::io::Error> {
|
||||||
match region_type {
|
match region_type {
|
||||||
PciBarRegionType::IORegion => {
|
PciBarRegionType::IORegion => {
|
||||||
|
#[cfg(target_arch = "x86_64")]
|
||||||
|
{
|
||||||
// Update system allocator
|
// Update system allocator
|
||||||
self.allocator
|
self.allocator
|
||||||
.lock()
|
.lock()
|
||||||
@ -463,7 +465,11 @@ impl DeviceRelocation for AddressManager {
|
|||||||
self.allocator
|
self.allocator
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.allocate_io_addresses(Some(GuestAddress(new_base)), len as GuestUsize, None)
|
.allocate_io_addresses(
|
||||||
|
Some(GuestAddress(new_base)),
|
||||||
|
len as GuestUsize,
|
||||||
|
None,
|
||||||
|
)
|
||||||
.ok_or_else(|| {
|
.ok_or_else(|| {
|
||||||
io::Error::new(io::ErrorKind::Other, "failed allocating new IO range")
|
io::Error::new(io::ErrorKind::Other, "failed allocating new IO range")
|
||||||
})?;
|
})?;
|
||||||
@ -473,6 +479,9 @@ impl DeviceRelocation for AddressManager {
|
|||||||
.update_range(old_base, len, new_base, len)
|
.update_range(old_base, len, new_base, len)
|
||||||
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))?;
|
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))?;
|
||||||
}
|
}
|
||||||
|
#[cfg(target_arch = "aarch64")]
|
||||||
|
error!("I/O region is not supported");
|
||||||
|
}
|
||||||
PciBarRegionType::Memory32BitRegion | PciBarRegionType::Memory64BitRegion => {
|
PciBarRegionType::Memory32BitRegion | PciBarRegionType::Memory64BitRegion => {
|
||||||
// Update system allocator
|
// Update system allocator
|
||||||
if region_type == PciBarRegionType::Memory32BitRegion {
|
if region_type == PciBarRegionType::Memory32BitRegion {
|
||||||
@ -2457,6 +2466,7 @@ impl DeviceManager {
|
|||||||
|
|
||||||
pci.register_mapping(
|
pci.register_mapping(
|
||||||
vfio_pci_device,
|
vfio_pci_device,
|
||||||
|
#[cfg(target_arch = "x86_64")]
|
||||||
self.address_manager.io_bus.as_ref(),
|
self.address_manager.io_bus.as_ref(),
|
||||||
self.address_manager.mmio_bus.as_ref(),
|
self.address_manager.mmio_bus.as_ref(),
|
||||||
bars,
|
bars,
|
||||||
|
Loading…
Reference in New Issue
Block a user