mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
hypervisor: Configure VGIC for MSHV guests
As part of this configuration, two things are being done: 1. Setting up the base address of GIC Distributor 2. Setting up the base address of GIC Interrupt Translator Signed-off-by: Jinank Jain <jinankjain@microsoft.com>
This commit is contained in:
@@ -43,6 +43,8 @@ use std::os::unix::io::AsRawFd;
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
use std::sync::Mutex;
|
||||
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
use aarch64::gic::MshvGicV2M;
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
pub use aarch64::VcpuMshvState;
|
||||
#[cfg(feature = "sev_snp")]
|
||||
@@ -2204,8 +2206,32 @@ impl vm::Vm for MshvVm {
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
fn create_vgic(&self, _config: VgicConfig) -> vm::Result<Arc<Mutex<dyn Vgic>>> {
|
||||
unimplemented!()
|
||||
fn create_vgic(&self, config: VgicConfig) -> vm::Result<Arc<Mutex<dyn Vgic>>> {
|
||||
let gic_device = MshvGicV2M::new(self, config)
|
||||
.map_err(|e| vm::HypervisorVmError::CreateVgic(anyhow!("Vgic error {:?}", e)))?;
|
||||
|
||||
// Register GICD address with the hypervisor
|
||||
self.fd
|
||||
.set_partition_property(
|
||||
hv_partition_property_code_HV_PARTITION_PROPERTY_GICD_BASE_ADDRESS,
|
||||
gic_device.dist_addr,
|
||||
)
|
||||
.map_err(|e| {
|
||||
vm::HypervisorVmError::CreateVgic(anyhow!("Failed to set GICD address: {}", e))
|
||||
})?;
|
||||
|
||||
// Register GITS address with the hypervisor
|
||||
self.fd
|
||||
.set_partition_property(
|
||||
// spellchecker:disable-line
|
||||
hv_partition_property_code_HV_PARTITION_PROPERTY_GITS_TRANSLATER_BASE_ADDRESS,
|
||||
gic_device.gits_addr,
|
||||
)
|
||||
.map_err(|e| {
|
||||
vm::HypervisorVmError::CreateVgic(anyhow!("Failed to set GITS address: {}", e))
|
||||
})?;
|
||||
|
||||
Ok(Arc::new(Mutex::new(gic_device)))
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
|
||||
Reference in New Issue
Block a user