mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
virtio-devices: iommu: Support AArch64
The MSI IOVA address on X86 and AArch64 is different. This commit refactored the code to receive the MSI IOVA address and size from device_manager, which provides the actual IOVA space data for both architectures. Signed-off-by: Michael Zhao <michael.zhao@arm.com>
This commit is contained in:
committed by
Sebastien Boeuf
parent
b30ddc0837
commit
b3fa56544c
@@ -1135,6 +1135,20 @@ impl DeviceManager {
|
||||
self.device_id_cnt = state.device_id_cnt;
|
||||
}
|
||||
|
||||
fn get_msi_iova_space(&mut self) -> (u64, u64) {
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
{
|
||||
let vcpus = self.config.lock().unwrap().cpus.boot_vcpus;
|
||||
let msi_start = arch::layout::GIC_V3_DIST_START
|
||||
- arch::layout::GIC_V3_REDIST_SIZE * (vcpus as u64)
|
||||
- arch::layout::GIC_V3_ITS_SIZE;
|
||||
let msi_end = msi_start + arch::layout::GIC_V3_ITS_SIZE - 1;
|
||||
(msi_start, msi_end)
|
||||
}
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
(0xfee0_0000, 0xfeef_ffff)
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
/// Gets the information of the devices registered up to some point in time.
|
||||
pub fn get_device_info(&self) -> &HashMap<(DeviceType, String), MmioDeviceInfo> {
|
||||
@@ -1161,6 +1175,7 @@ impl DeviceManager {
|
||||
self.exit_evt
|
||||
.try_clone()
|
||||
.map_err(DeviceManagerError::EventFd)?,
|
||||
self.get_msi_iova_space(),
|
||||
)
|
||||
.map_err(DeviceManagerError::CreateVirtioIommu)?;
|
||||
let device = Arc::new(Mutex::new(device));
|
||||
|
||||
Reference in New Issue
Block a user