tdx-guest.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. /*
  3. * Userspace interface for TDX guest driver
  4. *
  5. * Copyright (C) 2022 Intel Corporation
  6. */
  7. #ifndef _LINUX_TDX_GUEST_H_
  8. #define _LINUX_TDX_GUEST_H_
  9. #include <linux/ioctl.h>
  10. #include <linux/types.h>
  11. /* Length of the REPORTDATA used in TDG.MR.REPORT TDCALL */
  12. #define TDX_REPORTDATA_LEN 64
  13. /* Length of TDREPORT used in TDG.MR.REPORT TDCALL */
  14. #define TDX_REPORT_LEN 1024
  15. /**
  16. * struct tdx_report_req - Request struct for TDX_CMD_GET_REPORT0 IOCTL.
  17. *
  18. * @reportdata: User buffer with REPORTDATA to be included into TDREPORT.
  19. * Typically it can be some nonce provided by attestation
  20. * service, so the generated TDREPORT can be uniquely verified.
  21. * @tdreport: User buffer to store TDREPORT output from TDCALL[TDG.MR.REPORT].
  22. */
  23. struct tdx_report_req {
  24. __u8 reportdata[TDX_REPORTDATA_LEN];
  25. __u8 tdreport[TDX_REPORT_LEN];
  26. };
  27. /*
  28. * TDX_CMD_GET_REPORT0 - Get TDREPORT0 (a.k.a. TDREPORT subtype 0) using
  29. * TDCALL[TDG.MR.REPORT]
  30. *
  31. * Return 0 on success, -EIO on TDCALL execution failure, and
  32. * standard errno on other general error cases.
  33. */
  34. #define TDX_CMD_GET_REPORT0 _IOWR('T', 1, struct tdx_report_req)
  35. #endif /* _LINUX_TDX_GUEST_H_ */