Skip to content

Commit 2fb16e9

Browse files
andreeaflorescualexandruag
authored andcommitted
replace kvm_gen with kvm_wrapper
From kvm_wrapper we use the default feature which is generating bindings from linux kernel version 4.20. We can always use the latest version because the KVM interface is backwards compatible. Signed-off-by: Andreea Florescu <[email protected]>
1 parent 34bc630 commit 2fb16e9

21 files changed

+26
-4307
lines changed

Cargo.lock

Lines changed: 6 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cpuid/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ version = "0.1.0"
44
authors = ["Amazon firecracker team <[email protected]>"]
55

66
[dependencies]
7+
kvm_wrapper = ">=0.1.0"
8+
79
kvm = { path = "../kvm" }
8-
kvm_gen = { path = "../kvm_gen" }

cpuid/src/c3_template.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// SPDX-License-Identifier: Apache-2.0
33

44
use cpu_leaf::*;
5-
use kvm_gen::kvm_cpuid_entry2;
5+
use kvm_wrapper::kvm_cpuid_entry2;
66

77
/// Sets up the cpuid entries for a given VCPU following a C3 template.
88
pub fn set_cpuid_entries(entries: &mut [kvm_cpuid_entry2]) {

cpuid/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//! Utility for configuring the CPUID (CPU identification) for the guest microVM.
1010
1111
extern crate kvm;
12-
extern crate kvm_gen;
12+
extern crate kvm_wrapper;
1313

1414
use std::result;
1515

@@ -288,7 +288,7 @@ fn get_brand_string() -> PartialError<BrandString, brand_string::Error> {
288288
mod tests {
289289
use super::*;
290290
use kvm::{Kvm, MAX_KVM_CPUID_ENTRIES};
291-
use kvm_gen::kvm_cpuid_entry2;
291+
use kvm_wrapper::kvm_cpuid_entry2;
292292

293293
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
294294
#[test]

cpuid/src/t2_template.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// SPDX-License-Identifier: Apache-2.0
33

44
use cpu_leaf::*;
5-
use kvm_gen::kvm_cpuid_entry2;
5+
use kvm_wrapper::kvm_cpuid_entry2;
66

77
/// Sets up the cpuid entries for a given VCPU following a T2 template.
88
pub fn set_cpuid_entries(entries: &mut [kvm_cpuid_entry2]) {

kvm/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ version = "0.1.0"
44
authors = ["The Chromium OS Authors"]
55

66
[dependencies]
7+
kvm_wrapper = ">=0.1.0"
78
libc = ">=0.2.39"
89

9-
kvm_gen = { path = "../kvm_gen" }
1010
memory_model = { path = "../memory_model" }
1111
sys_util = { path = "../sys_util" }
1212

kvm/src/cap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Use of this source code is governed by a BSD-style license that can be
66
// found in the THIRD-PARTY file.
77

8-
use kvm_gen::*;
8+
use kvm_wrapper::*;
99

1010
/// A capability the kernel's KVM interface can possibly expose.
1111
#[derive(Clone, Copy, Debug)]

kvm/src/ioctl_defs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
33

4-
use kvm_gen::*;
4+
use kvm_wrapper::*;
55

66
// Declares necessary ioctls specific to their platform.
77

kvm/src/lib.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
1212
extern crate libc;
1313

14-
extern crate kvm_gen;
14+
extern crate kvm_wrapper;
1515
extern crate memory_model;
1616
#[macro_use]
1717
extern crate sys_util;
@@ -25,7 +25,7 @@ use std::os::unix::io::{AsRawFd, FromRawFd, RawFd};
2525

2626
use libc::{open, EINVAL, ENOSPC, O_RDWR};
2727

28-
use kvm_gen::*;
28+
use kvm_wrapper::*;
2929
use memory_model::MemoryMapping;
3030
use sys_util::{errno_result, Error, EventFd, Result};
3131
use sys_util::{
@@ -34,7 +34,7 @@ use sys_util::{
3434

3535
pub use cap::*;
3636
use ioctl_defs::*;
37-
pub use kvm_gen::KVM_API_VERSION;
37+
pub use kvm_wrapper::KVM_API_VERSION;
3838

3939
/// Taken from Linux Kernel v4.14.13 (arch/x86/include/asm/kvm_host.h)
4040
pub const MAX_KVM_CPUID_ENTRIES: usize = 80;
@@ -1449,7 +1449,9 @@ mod tests {
14491449
.unwrap_err(),
14501450
badf_error
14511451
);
1452-
assert_eq!(faulty_vcpu_fd.get_lapic().unwrap_err(), badf_error);
1452+
// kvm_lapic_state does not implement debug by default so we cannot
1453+
// use unwrap_err here.
1454+
assert!(faulty_vcpu_fd.get_lapic().is_err());
14531455
assert_eq!(
14541456
faulty_vcpu_fd
14551457
.set_lapic(&unsafe { std::mem::zeroed() })

kvm_gen/Cargo.toml

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)