mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-28 20:02:17 +00:00
![Kuppuswamy Sathyanarayanan](/assets/img/avatar_default.png)
TDX guest driver exposes IOCTL interfaces to service TDX guest user-specific requests. Currently, it is only used to allow the user to get the TDREPORT to support TDX attestation. Details about the TDX attestation process are documented in Documentation/x86/tdx.rst, and the IOCTL details are documented in Documentation/virt/coco/tdx-guest.rst. Operations like getting TDREPORT involves sending a blob of data as input and getting another blob of data as output. It was considered to use a sysfs interface for this, but it doesn't fit well into the standard sysfs model for configuring values. It would be possible to do read/write on files, but it would need multiple file descriptors, which would be somewhat messy. IOCTLs seem to be the best fitting and simplest model for this use case. The AMD sev-guest driver also uses the IOCTL interface to support attestation. [Bagas Sanjaya: Ack is for documentation portion] Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Reviewed-by: Bagas Sanjaya <bagasdotme@gmail.com> Reviewed-by: Tony Luck <tony.luck@intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Acked-by: Kai Huang <kai.huang@intel.com> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Acked-by: Wander Lairson Costa <wander@redhat.com> Link: https://lore.kernel.org/all/20221116223820.819090-3-sathyanarayanan.kuppuswamy%40linux.intel.com
42 lines
1.3 KiB
C
42 lines
1.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
|
/*
|
|
* Userspace interface for TDX guest driver
|
|
*
|
|
* Copyright (C) 2022 Intel Corporation
|
|
*/
|
|
|
|
#ifndef _UAPI_LINUX_TDX_GUEST_H_
|
|
#define _UAPI_LINUX_TDX_GUEST_H_
|
|
|
|
#include <linux/ioctl.h>
|
|
#include <linux/types.h>
|
|
|
|
/* Length of the REPORTDATA used in TDG.MR.REPORT TDCALL */
|
|
#define TDX_REPORTDATA_LEN 64
|
|
|
|
/* Length of TDREPORT used in TDG.MR.REPORT TDCALL */
|
|
#define TDX_REPORT_LEN 1024
|
|
|
|
/**
|
|
* struct tdx_report_req - Request struct for TDX_CMD_GET_REPORT0 IOCTL.
|
|
*
|
|
* @reportdata: User buffer with REPORTDATA to be included into TDREPORT.
|
|
* Typically it can be some nonce provided by attestation
|
|
* service, so the generated TDREPORT can be uniquely verified.
|
|
* @tdreport: User buffer to store TDREPORT output from TDCALL[TDG.MR.REPORT].
|
|
*/
|
|
struct tdx_report_req {
|
|
__u8 reportdata[TDX_REPORTDATA_LEN];
|
|
__u8 tdreport[TDX_REPORT_LEN];
|
|
};
|
|
|
|
/*
|
|
* TDX_CMD_GET_REPORT0 - Get TDREPORT0 (a.k.a. TDREPORT subtype 0) using
|
|
* TDCALL[TDG.MR.REPORT]
|
|
*
|
|
* Return 0 on success, -EIO on TDCALL execution failure, and
|
|
* standard errno on other general error cases.
|
|
*/
|
|
#define TDX_CMD_GET_REPORT0 _IOWR('T', 1, struct tdx_report_req)
|
|
|
|
#endif /* _UAPI_LINUX_TDX_GUEST_H_ */
|