mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: hypervisor: Add a new interface to setup GICR for vcpus
For MSHV arm64 guest, there is an in-hypervisor GICv2M emulation and for that to work, it needs to be enlightened with the base address of GIC redistributor exposed to guest via FDT. Signed-off-by: Jinank Jain <jinankjain@microsoft.com>
This commit is contained in:
@@ -147,6 +147,10 @@ pub enum Error {
|
||||
#[error("Error finalising vCPU: {0}")]
|
||||
VcpuArmFinalize(#[source] hypervisor::HypervisorCpuError),
|
||||
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
#[error("Error initialising GICR base address: {0}")]
|
||||
VcpuSetGicrBaseAddr(#[source] hypervisor::HypervisorCpuError),
|
||||
|
||||
#[error("Failed to join on vCPU threads: {0:?}")]
|
||||
ThreadCleanup(std::boxed::Box<dyn std::any::Any + std::marker::Send>),
|
||||
|
||||
@@ -463,6 +467,23 @@ impl Vcpu {
|
||||
.set_sev_control_register(vmsa_pfn)
|
||||
.map_err(Error::SetSevControlRegister)
|
||||
}
|
||||
|
||||
///
|
||||
/// Sets the vCPU's GIC redistributor base address.
|
||||
///
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
pub fn set_gic_redistributor_addr(
|
||||
&self,
|
||||
base_redist_addr: u64,
|
||||
redist_size: u64,
|
||||
) -> Result<()> {
|
||||
let gicr_base = base_redist_addr + (arch::layout::GIC_V3_REDIST_SIZE * self.id as u64);
|
||||
assert!(gicr_base + arch::layout::GIC_V3_REDIST_SIZE <= base_redist_addr + redist_size);
|
||||
self.vcpu
|
||||
.set_gic_redistributor_addr(gicr_base)
|
||||
.map_err(Error::VcpuSetGicrBaseAddr)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Pausable for Vcpu {}
|
||||
|
||||
Reference in New Issue
Block a user