crosvm/hypervisor/tests/kvm/aarch64.rs
Dennis Kempin 3375878f14 Move hypervisor::kvm tests to integration tests
These tests require kvm to pass and are not suitable for a unit
test.

In order to move the test, KvmVm::create_vcpu had to be renamed
to prevent conflicts with the trait function VcpuX86_64::create_vcpu,
implemented for the same type.

The aarch64 variant does not actually run in CI since the tests
do not pass in the emulated aarch64 environment. So the
DO_NOT_RUN_AARCH64 flag remains.

BUG=b:244623454
TEST=presubmit

Change-Id: I79bba3926a38d19350e2fd3c7bfa4662499223e5
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3999799
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-11-03 23:19:11 +00:00

53 lines
1.4 KiB
Rust

// Copyright 2022 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Copyright 2022 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use hypervisor::kvm::*;
use hypervisor::*;
use vm_memory::GuestAddress;
use vm_memory::GuestMemory;
#[test]
fn set_gsi_routing() {
let kvm = Kvm::new().unwrap();
let gm = GuestMemory::new(&[(GuestAddress(0), 0x10000)]).unwrap();
let vm = KvmVm::new(&kvm, gm, Default::default()).unwrap();
vm.create_irq_chip().unwrap();
vm.set_gsi_routing(&[]).unwrap();
vm.set_gsi_routing(&[IrqRoute {
gsi: 1,
source: IrqSource::Irqchip {
chip: IrqSourceChip::Gic,
pin: 3,
},
}])
.unwrap();
vm.set_gsi_routing(&[IrqRoute {
gsi: 1,
source: IrqSource::Msi {
address: 0xf000000,
data: 0xa0,
},
}])
.unwrap();
vm.set_gsi_routing(&[
IrqRoute {
gsi: 1,
source: IrqSource::Irqchip {
chip: IrqSourceChip::Gic,
pin: 3,
},
},
IrqRoute {
gsi: 2,
source: IrqSource::Msi {
address: 0xf000000,
data: 0xa0,
},
},
])
.unwrap();
}