-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable MAX_VCPUS and SPLIT_IRQCHIP caps and create VCPU
Signed-off-by: Jake Correnti <[email protected]>
- Loading branch information
1 parent
aac74ef
commit d384f68
Showing
1 changed file
with
13 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,26 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use kvm_ioctls::Kvm; | ||
use kvm_bindings::{kvm_enable_cap, KVM_CAP_MAX_VCPUS, KVM_CAP_SPLIT_IRQCHIP}; | ||
|
||
use tdx::launch::TdxVm; | ||
|
||
#[test] | ||
fn launch() { | ||
let kvm_fd = Kvm::new().unwrap(); | ||
let tdx_vm = TdxVm::new(&kvm_fd).unwrap(); | ||
|
||
let mut cap: kvm_enable_cap = Default::default(); | ||
cap.cap = KVM_CAP_MAX_VCPUS; | ||
cap.args[0] = 100; | ||
tdx_vm.fd.enable_cap(&cap).unwrap(); | ||
|
||
cap.cap = KVM_CAP_SPLIT_IRQCHIP; | ||
cap.args[0] = 24; | ||
tdx_vm.fd.enable_cap(&cap).unwrap(); | ||
|
||
let caps = tdx_vm.get_capabilities().unwrap(); | ||
let _ = tdx_vm.init_vm(&kvm_fd, &caps).unwrap(); | ||
|
||
let _vcpufd = tdx_vm.fd.create_vcpu(0).unwrap(); | ||
} |