Skip to content

Commit e76ce09

Browse files
Merge branch 'main' into main
2 parents 3449081 + 48d93d6 commit e76ce09

File tree

12 files changed

+179
-297
lines changed

12 files changed

+179
-297
lines changed

.buildkite/custom-tests.json

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,3 @@
11
{
2-
"tests": [
3-
{
4-
"test_name": "build-fam-gnu",
5-
"command": "cargo build --release --features=fam-wrappers",
6-
"platform": [
7-
"x86_64",
8-
"aarch64",
9-
"riscv64"
10-
]
11-
},
12-
{
13-
"test_name": "build-fam-musl",
14-
"command": "cargo build --release --features=fam-wrappers --target {target_platform}-unknown-linux-musl",
15-
"platform": [
16-
"x86_64",
17-
"aarch64"
18-
]
19-
},
20-
{
21-
"test_name": "build-serde-gnu",
22-
"command": "cargo build --release --features=serde",
23-
"platform": [
24-
"x86_64",
25-
"aarch64",
26-
"riscv64"
27-
]
28-
},
29-
{
30-
"test_name": "build-serde-musl",
31-
"command": "cargo build --release --features=serde --target {target_platform}-unknown-linux-musl",
32-
"platform": [
33-
"x86_64",
34-
"aarch64"
35-
]
36-
}
37-
]
2+
"tests": []
383
}

kvm-bindings/src/arm64/fam_wrappers.rs

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

44
use vmm_sys_util::fam::{FamStruct, FamStructWrapper};
5+
use vmm_sys_util::generate_fam_struct_impl;
56

67
use super::bindings::*;
78

kvm-bindings/src/lib.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,6 @@
99
#![deny(clippy::undocumented_unsafe_blocks)]
1010
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
1111

12-
#[cfg(feature = "fam-wrappers")]
13-
#[macro_use]
14-
extern crate vmm_sys_util;
15-
16-
#[cfg(feature = "serde")]
17-
extern crate serde;
18-
19-
#[cfg(feature = "serde")]
20-
extern crate zerocopy;
21-
22-
extern crate core;
23-
2412
#[cfg(feature = "serde")]
2513
#[macro_use]
2614
mod serialize;

kvm-bindings/src/riscv64/fam_wrappers.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// SPDX-License-Identifier: Apache-2.0
44

55
use vmm_sys_util::fam::{FamStruct, FamStructWrapper};
6+
use vmm_sys_util::generate_fam_struct_impl;
67

78
use super::bindings::*;
89

kvm-bindings/src/x86_64/fam_wrappers.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
33

4-
use vmm_sys_util::fam::{FamStruct, FamStructWrapper};
5-
64
use super::bindings::*;
5+
use vmm_sys_util::fam::{FamStruct, FamStructWrapper};
6+
use vmm_sys_util::generate_fam_struct_impl;
77

88
/// Maximum number of CPUID entries that can be returned by a call to KVM ioctls.
99
///
@@ -192,7 +192,7 @@ unsafe impl FamStruct for kvm_xsave2 {
192192
/// cannot happen in the [`FamStruct::len`] trait method. To work around this, we define a wrapper
193193
/// struct that caches the length of a previous `KVM_CHECK_EXTENSION(KVM_CAP_XSAVE2)` call,
194194
/// and implement [`FamStruct`] for this wrapper. Then in kvm-ioctls, we can expose a function
195-
/// that first queries `KVM_CAP_XSAVE2`, then invokes [`KVM_GET_XSAVE2`] to retrieves the
195+
/// that first queries `KVM_CAP_XSAVE2`, then invokes `KVM_GET_XSAVE2` to retrieves the
196196
/// `kvm_xsave` structure, and finally combine them into the [`kvm_xsave2`] helper structure to be
197197
/// managed as a `FamStruct`.
198198
pub type Xsave = FamStructWrapper<kvm_xsave2>;

kvm-bindings/src/x86_64/serialize.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use super::bindings::{
99
kvm_nested_state__bindgen_ty_1, kvm_pit_channel_state, kvm_pit_state2, kvm_regs, kvm_segment,
1010
kvm_sregs, kvm_vcpu_events, kvm_xcr, kvm_xcrs, kvm_xsave,
1111
};
12+
#[cfg(feature = "fam-wrappers")]
1213
use super::fam_wrappers::kvm_xsave2;
1314
use super::nested::{KvmNestedStateBuffer, kvm_nested_state__data};
1415
use serde::{Deserialize, Deserializer, Serialize, Serializer};
@@ -33,13 +34,15 @@ serde_impls!(
3334
kvm_msrs,
3435
kvm_cpuid2,
3536
kvm_xsave,
36-
kvm_xsave2,
3737
kvm_irqchip,
3838
kvm_irq_routing,
3939
kvm_irq_routing_entry,
4040
KvmNestedStateBuffer
4141
);
4242

43+
#[cfg(feature = "fam-wrappers")]
44+
serde_impls!(kvm_xsave2);
45+
4346
// SAFETY: zerocopy's derives explicitly disallow deriving for unions where
4447
// the fields have different sizes, due to the smaller fields having padding.
4548
// Miri however does not complain about these implementations (e.g. about
@@ -200,6 +203,7 @@ mod tests {
200203
is_serde::<kvm_vcpu_events>();
201204
is_serde::<kvm_debugregs>();
202205
is_serde::<kvm_xsave>();
206+
#[cfg(feature = "fam-wrappers")]
203207
is_serde::<kvm_xsave2>();
204208
is_serde::<kvm_xcr>();
205209
is_serde::<kvm_xcrs>();
@@ -235,6 +239,7 @@ mod tests {
235239
is_serde_json::<kvm_vcpu_events>();
236240
is_serde_json::<kvm_debugregs>();
237241
is_serde_json::<kvm_xsave>();
242+
#[cfg(feature = "fam-wrappers")]
238243
is_serde_json::<kvm_xsave2>();
239244
is_serde_json::<kvm_xcr>();
240245
is_serde_json::<kvm_xcrs>();

kvm-ioctls/src/ioctls/device.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,12 @@ impl DeviceFd {
4545
///
4646
/// Configuring a VFIO device using `set_device_attr`. Note that VFIO
4747
/// devices are not yet available on RISC-V The patch for QEMU:
48-
/// https://lore.kernel.org/all/[email protected]/
48+
/// <https://lore.kernel.org/all/[email protected]/>
4949
/// and patch for linux kernel
50-
/// https://github.com/ventanamicro/linux/tree/dev-upstream are both not
50+
/// <https://github.com/ventanamicro/linux/tree/dev-upstream> are both not
5151
/// upstreamed. Disabling VFIO device test for RISC-V at the time being.
5252
///
5353
/// ```rust
54-
/// # extern crate kvm_ioctls;
55-
/// # extern crate kvm_bindings;
5654
/// # use kvm_ioctls::Kvm;
5755
/// let kvm = Kvm::new().unwrap();
5856
/// let vm = kvm.create_vm().unwrap();
@@ -124,8 +122,6 @@ impl DeviceFd {
124122
/// Getting the number of IRQs for a GICv2 device on an aarch64 platform
125123
///
126124
/// ```rust
127-
/// # extern crate kvm_ioctls;
128-
/// # extern crate kvm_bindings;
129125
/// # use kvm_ioctls::Kvm;
130126
/// let kvm = Kvm::new().unwrap();
131127
/// let vm = kvm.create_vm().unwrap();

0 commit comments

Comments
 (0)