Skip to content

Commit 3b7f9c1

Browse files
authored
Refactor tdx_guest_device and sev_guest_device (#1642)
Move all of the no_std bits in tdx_guest_device and sev_guest_device to x86defs, leaving the *guest_device crates solely for Linux ioctls. This removes the need for a `std` feature for tdx_guest_device -- notably, openhcl_boot can now use these TDX bits without needing special no_std handling.
1 parent 44c248e commit 3b7f9c1

File tree

21 files changed

+656
-695
lines changed

21 files changed

+656
-695
lines changed

Cargo.lock

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4799,8 +4799,7 @@ dependencies = [
47994799
"open_enum",
48004800
"serde",
48014801
"serde_json",
4802-
"sev_guest_device",
4803-
"tdx_guest_device",
4802+
"x86defs",
48044803
"zerocopy 0.8.24",
48054804
]
48064805

@@ -4824,7 +4823,6 @@ dependencies = [
48244823
"sha2",
48254824
"sidecar_defs",
48264825
"tdcall",
4827-
"tdx_guest_device",
48284826
"underhill_confidentiality",
48294827
"x86defs",
48304828
"zerocopy 0.8.24",
@@ -6384,10 +6382,10 @@ dependencies = [
63846382
name = "sev_guest_device"
63856383
version = "0.0.0"
63866384
dependencies = [
6387-
"bitfield-struct 0.10.1",
63886385
"nix 0.27.1",
63896386
"static_assertions",
63906387
"thiserror 2.0.12",
6388+
"x86defs",
63916389
"zerocopy 0.8.24",
63926390
]
63936391

@@ -6792,7 +6790,6 @@ version = "0.0.0"
67926790
dependencies = [
67936791
"hvdef",
67946792
"memory_range",
6795-
"tdx_guest_device",
67966793
"thiserror 2.0.12",
67976794
"tracing",
67986795
"x86defs",
@@ -6802,10 +6799,9 @@ dependencies = [
68026799
name = "tdx_guest_device"
68036800
version = "0.0.0"
68046801
dependencies = [
6805-
"bitfield-struct 0.10.1",
68066802
"nix 0.27.1",
6807-
"static_assertions",
68086803
"thiserror 2.0.12",
6804+
"x86defs",
68096805
"zerocopy 0.8.24",
68106806
]
68116807

@@ -6817,6 +6813,7 @@ dependencies = [
68176813
"static_assertions",
68186814
"tdx_guest_device",
68196815
"thiserror 2.0.12",
6816+
"x86defs",
68206817
"zerocopy 0.8.24",
68216818
]
68226819

@@ -9766,6 +9763,7 @@ dependencies = [
97669763
"arbitrary",
97679764
"bitfield-struct 0.10.1",
97689765
"open_enum",
9766+
"static_assertions",
97699767
"zerocopy 0.8.24",
97709768
]
97719769

openhcl/openhcl_attestation_protocol/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ rust-version.workspace = true
1010
open_enum.workspace = true
1111
guid.workspace = true
1212
mesh.workspace = true
13-
sev_guest_device.workspace = true
14-
tdx_guest_device = { workspace = true, features = ["std"] }
13+
x86defs.workspace = true
1514

1615
base64.workspace = true
1716
base64-serde.workspace = true

openhcl/openhcl_attestation_protocol/src/igvm_attest/get.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ const ATTESTATION_SIGNATURE: u32 = 0x414c4348; // 'HCLA'
1818
const ATTESTATION_REPORT_SIZE_MAX: usize = SNP_VM_REPORT_SIZE;
1919

2020
pub const VBS_VM_REPORT_SIZE: usize = 0x230;
21-
pub const SNP_VM_REPORT_SIZE: usize = sev_guest_device::protocol::SNP_REPORT_SIZE;
22-
pub const TDX_VM_REPORT_SIZE: usize = tdx_guest_device::protocol::TDX_REPORT_SIZE;
21+
pub const SNP_VM_REPORT_SIZE: usize = x86defs::snp::SNP_REPORT_SIZE;
22+
pub const TDX_VM_REPORT_SIZE: usize = x86defs::tdx::TDX_REPORT_SIZE;
2323
/// No TEE attestation report for TVM
2424
pub const TVM_REPORT_SIZE: usize = 0;
2525

openhcl/openhcl_boot/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ zerocopy.workspace = true
3030
[target.'cfg(target_arch = "x86_64")'.dependencies]
3131
safe_intrinsics.workspace = true
3232
tdcall.workspace = true
33-
tdx_guest_device.workspace = true
3433
x86defs.workspace = true
3534

3635
[build-dependencies]

openhcl/openhcl_boot/src/arch/x86_64/tdx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ use tdcall::TdcallOutput;
2020
use tdcall::tdcall_hypercall;
2121
use tdcall::tdcall_map_gpa;
2222
use tdcall::tdcall_wrmsr;
23-
use tdx_guest_device::protocol::TdReport;
2423
use x86defs::X64_LARGE_PAGE_SIZE;
2524
use x86defs::tdx::RESET_VECTOR_PAGE;
2625
use x86defs::tdx::TdCallResult;
26+
use x86defs::tdx::TdReport;
2727
use x86defs::tdx::TdVmCallR10Result;
2828

2929
/// Writes a synthehtic register to tell the hypervisor the OS ID for the boot shim.

openhcl/openhcl_boot/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ fn get_hw_debug_bit(isolation: IsolationType) -> bool {
632632
match isolation {
633633
#[cfg(target_arch = "x86_64")]
634634
IsolationType::Tdx => {
635-
use tdx_guest_device::protocol::TdReport;
635+
use x86defs::tdx::TdReport;
636636

637637
use crate::arch::tdx::get_tdreport;
638638

support/sev_guest_device/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ edition.workspace = true
77
rust-version.workspace = true
88

99
[dependencies]
10-
bitfield-struct.workspace = true
1110
static_assertions.workspace = true
1211
zerocopy.workspace = true
1312
[target.'cfg(target_os = "linux")'.dependencies]
1413
nix = { workspace = true, features = ["ioctl"] }
1514
thiserror.workspace = true
15+
x86defs.workspace = true
1616

1717
[lints]
1818
workspace = true

support/sev_guest_device/src/ioctl.rs

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

0 commit comments

Comments
 (0)