arch: Fix wrong trial of creating GICv3-ITS for non-PCI use cases

Currently for AArch64, the GICv3-ITS is tried to be created first
when PCI is not needed, which is unnecessary. This commit fixes
the problem.

Signed-off-by: Henry Wang <Henry.Wang@arm.com>
This commit is contained in:
Henry Wang 2020-09-05 21:26:45 +08:00 committed by Rob Bradford
parent 3ea4a0797d
commit 7c40a78b66

View File

@ -196,14 +196,13 @@ pub mod kvm {
its_required: bool,
) -> Result<Box<dyn GICDevice>> {
if its_required {
debug!("GICv3-ITS is required, creating a GICv3-ITS here.");
KvmGICv3ITS::new(vm, vcpu_count)
} else {
KvmGICv3ITS::new(vm, vcpu_count).or_else(|_| {
debug!("Failed to create GICv3-ITS, will try GICv3 instead.");
KvmGICv3::new(vm, vcpu_count).or_else(|_| {
debug!("Failed to create GICv3, will try GICv2 instead.");
KvmGICv2::new(vm, vcpu_count)
})
debug!("GICv3-ITS is not required, will try GICv3 instead.");
KvmGICv3::new(vm, vcpu_count).or_else(|_| {
debug!("Failed to create GICv3, will try GICv2 instead.");
KvmGICv2::new(vm, vcpu_count)
})
}
}