Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
google
GitHub Repository: google/crosvm
Path: blob/main/hypervisor/tests/kvm/aarch64.rs
5394 views
1
// Copyright 2022 The ChromiumOS Authors
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
// Copyright 2022 The ChromiumOS Authors
6
// Use of this source code is governed by a BSD-style license that can be
7
// found in the LICENSE file.
8
use hypervisor::kvm::*;
9
use hypervisor::*;
10
use vm_memory::GuestAddress;
11
use vm_memory::GuestMemory;
12
13
#[test]
14
fn set_gsi_routing() {
15
let kvm = Kvm::new().unwrap();
16
let gm = GuestMemory::new(&[(GuestAddress(0), 0x10000)]).unwrap();
17
let vm = KvmVm::new(&kvm, gm, Default::default()).unwrap();
18
vm.create_irq_chip().unwrap();
19
vm.set_gsi_routing(&[]).unwrap();
20
vm.set_gsi_routing(&[IrqRoute {
21
gsi: 1,
22
source: IrqSource::Irqchip {
23
chip: IrqSourceChip::Gic,
24
pin: 3,
25
},
26
}])
27
.unwrap();
28
vm.set_gsi_routing(&[IrqRoute {
29
gsi: 1,
30
source: IrqSource::Msi {
31
address: 0xf000000,
32
data: 0xa0,
33
pci_address: Default::default(),
34
},
35
}])
36
.unwrap();
37
vm.set_gsi_routing(&[
38
IrqRoute {
39
gsi: 1,
40
source: IrqSource::Irqchip {
41
chip: IrqSourceChip::Gic,
42
pin: 3,
43
},
44
},
45
IrqRoute {
46
gsi: 2,
47
source: IrqSource::Msi {
48
address: 0xf000000,
49
data: 0xa0,
50
pci_address: Default::default(),
51
},
52
},
53
])
54
.unwrap();
55
}
56
57