hypervisor: Tune Vaia trait to work with fdt setup

Previous `Vaia` implementation uses types as it is, thus the property
string generated for fdt setup requires additional type conversion.
Change the types used in the methods of `Vaia` trait to provide a
concise fdt setup process.

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
This commit is contained in:
Ruoqing He
2024-11-29 16:35:09 +08:00
committed by Rob Bradford
parent 30cf1eed5e
commit 9006013c60
2 changed files with 25 additions and 26 deletions

View File

@@ -26,11 +26,9 @@ pub type Result<T> = result::Result<T, Error>;
#[derive(Debug)]
pub struct VaiaConfig {
pub vcpu_count: u64,
pub vcpu_count: u32,
pub aplic_addr: u64,
pub aplic_size: u64,
pub imsic_addr: u64,
pub imsic_size: u64,
pub nr_irqs: u32,
}
@@ -40,16 +38,16 @@ pub trait Vaia: Send + Sync {
fn aplic_compatibility(&self) -> &str;
/// Returns an array with APLIC device properties
fn aplic_properties(&self) -> [u64; 4];
fn aplic_properties(&self) -> [u32; 4];
/// Returns the compatibility property of IMSIC
fn imsic_compatibility(&self) -> &str;
/// Returns an array with IMSIC device properties
fn imsic_properties(&self) -> [u64; 4];
fn imsic_properties(&self) -> [u32; 4];
/// Returns the number of vCPUs this AIA handles
fn vcpu_count(&self) -> u64;
fn vcpu_count(&self) -> u32;
/// Returns whether the AIA device is MSI compatible or not
fn msi_compatible(&self) -> bool;