MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / tdx_command

Function tdx_command

hypervisor/src/kvm/mod.rs:1411–1445  ·  view source on GitHub ↗
(
    fd: &RawFd,
    command: TdxCommand,
    flags: u32,
    data: *const libc::c_void,
)

Source from the content-addressed store, hash-verified

1409
1410#[cfg(feature = "tdx")]
1411fn tdx_command(
1412 fd: &RawFd,
1413 command: TdxCommand,
1414 flags: u32,
1415 data: *const libc::c_void,
1416) -> std::result::Result<(), std::io::Error> {
1417 #[repr(C)]
1418 struct TdxIoctlCmd {
1419 command: TdxCommand,
1420 flags: u32,
1421 data: u64,
1422 error: u64,
1423 unused: u64,
1424 }
1425 let cmd = TdxIoctlCmd {
1426 command,
1427 flags,
1428 data: data as _,
1429 error: 0,
1430 unused: 0,
1431 };
1432 // SAFETY: FFI call. All input parameters are valid.
1433 let ret = unsafe {
1434 ioctl_with_val(
1435 fd,
1436 KVM_MEMORY_ENCRYPT_OP(),
1437 &raw const cmd as std::os::raw::c_ulong,
1438 )
1439 };
1440
1441 if ret < 0 {
1442 return Err(std::io::Error::last_os_error());
1443 }
1444 Ok(())
1445}
1446
1447/// Wrapper over KVM system ioctls.
1448pub struct KvmHypervisor {

Callers 4

tdx_initMethod · 0.85
tdx_finalizeMethod · 0.85
tdx_capabilitiesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected