Skip to content

Commit 00141e2

Browse files
committed
Merge branch 'tsm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/linux
2 parents 4bf4bd7 + f4738f5 commit 00141e2

File tree

18 files changed

+1055
-37
lines changed

18 files changed

+1055
-37
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
What: /sys/kernel/config/tsm/report/$name/inblob
2+
Date: September, 2023
3+
KernelVersion: v6.7
4+
Contact: linux-coco@lists.linux.dev
5+
Description:
6+
(WO) Up to 64 bytes of user specified binary data. For replay
7+
protection this should include a nonce, but the kernel does not
8+
place any restrictions on the content.
9+
10+
What: /sys/kernel/config/tsm/report/$name/outblob
11+
Date: September, 2023
12+
KernelVersion: v6.7
13+
Contact: linux-coco@lists.linux.dev
14+
Description:
15+
(RO) Binary attestation report generated from @inblob and other
16+
options The format of the report is implementation specific
17+
where the implementation is conveyed via the @provider
18+
attribute.
19+
20+
What: /sys/kernel/config/tsm/report/$name/auxblob
21+
Date: October, 2023
22+
KernelVersion: v6.7
23+
Contact: linux-coco@lists.linux.dev
24+
Description:
25+
(RO) Optional supplemental data that a TSM may emit, visibility
26+
of this attribute depends on TSM, and may be empty if no
27+
auxiliary data is available.
28+
29+
When @provider is "sev_guest" this file contains the
30+
"cert_table" from SEV-ES Guest-Hypervisor Communication Block
31+
Standardization v2.03 Section 4.1.8.1 MSG_REPORT_REQ.
32+
https://www.amd.com/content/dam/amd/en/documents/epyc-technical-docs/specifications/56421.pdf
33+
34+
What: /sys/kernel/config/tsm/report/$name/provider
35+
Date: September, 2023
36+
KernelVersion: v6.7
37+
Contact: linux-coco@lists.linux.dev
38+
Description:
39+
(RO) A name for the format-specification of @outblob like
40+
"sev_guest" [1] or "tdx_guest" [2] in the near term, or a
41+
common standard format in the future.
42+
43+
[1]: SEV Secure Nested Paging Firmware ABI Specification
44+
Revision 1.55 Table 22
45+
https://www.amd.com/content/dam/amd/en/documents/epyc-technical-docs/specifications/56860.pdf
46+
47+
[2]: Intel® Trust Domain Extensions Data Center Attestation
48+
Primitives : Quote Generation Library and Quote Verification
49+
Library Revision 0.8 Appendix 4,5
50+
https://download.01.org/intel-sgx/latest/dcap-latest/linux/docs/Intel_TDX_DCAP_Quoting_Library_API.pdf
51+
52+
What: /sys/kernel/config/tsm/report/$name/generation
53+
Date: September, 2023
54+
KernelVersion: v6.7
55+
Contact: linux-coco@lists.linux.dev
56+
Description:
57+
(RO) The value in this attribute increments each time @inblob or
58+
any option is written. Userspace can detect conflicts by
59+
checking generation before writing to any attribute and making
60+
sure the number of writes matches expectations after reading
61+
@outblob, or it can prevent conflicts by creating a report
62+
instance per requesting context.
63+
64+
What: /sys/kernel/config/tsm/report/$name/privlevel
65+
Date: September, 2023
66+
KernelVersion: v6.7
67+
Contact: linux-coco@lists.linux.dev
68+
Description:
69+
(WO) Attribute is visible if a TSM implementation provider
70+
supports the concept of attestation reports for TVMs running at
71+
different privilege levels, like SEV-SNP "VMPL", specify the
72+
privilege level via this attribute. The minimum acceptable
73+
value is conveyed via @privlevel_floor and the maximum
74+
acceptable value is TSM_PRIVLEVEL_MAX (3).
75+
76+
What: /sys/kernel/config/tsm/report/$name/privlevel_floor
77+
Date: September, 2023
78+
KernelVersion: v6.7
79+
Contact: linux-coco@lists.linux.dev
80+
Description:
81+
(RO) Indicates the minimum permissible value that can be written
82+
to @privlevel.

MAINTAINERS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22102,6 +22102,14 @@ W: https://github.com/srcres258/linux-doc
2210222102
T: git git://github.com/srcres258/linux-doc.git doc-zh-tw
2210322103
F: Documentation/translations/zh_TW/
2210422104

22105+
TRUSTED SECURITY MODULE (TSM) ATTESTATION REPORTS
22106+
M: Dan Williams <dan.j.williams@intel.com>
22107+
L: linux-coco@lists.linux.dev
22108+
S: Maintained
22109+
F: Documentation/ABI/testing/configfs-tsm
22110+
F: drivers/virt/coco/tsm.c
22111+
F: include/linux/tsm.h
22112+
2210522113
TTY LAYER AND SERIAL DRIVERS
2210622114
M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2210722115
M: Jiri Slaby <jirislaby@kernel.org>

arch/x86/coco/tdx/tdx.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,27 @@ int tdx_mcall_get_report0(u8 *reportdata, u8 *tdreport)
106106
}
107107
EXPORT_SYMBOL_GPL(tdx_mcall_get_report0);
108108

109+
/**
110+
* tdx_hcall_get_quote() - Wrapper to request TD Quote using GetQuote
111+
* hypercall.
112+
* @buf: Address of the directly mapped shared kernel buffer which
113+
* contains TDREPORT. The same buffer will be used by VMM to
114+
* store the generated TD Quote output.
115+
* @size: size of the tdquote buffer (4KB-aligned).
116+
*
117+
* Refer to section titled "TDG.VP.VMCALL<GetQuote>" in the TDX GHCI
118+
* v1.0 specification for more information on GetQuote hypercall.
119+
* It is used in the TDX guest driver module to get the TD Quote.
120+
*
121+
* Return 0 on success or error code on failure.
122+
*/
123+
u64 tdx_hcall_get_quote(u8 *buf, size_t size)
124+
{
125+
/* Since buf is a shared memory, set the shared (decrypted) bits */
126+
return _tdx_hypercall(TDVMCALL_GET_QUOTE, cc_mkdec(virt_to_phys(buf)), size, 0, 0);
127+
}
128+
EXPORT_SYMBOL_GPL(tdx_hcall_get_quote);
129+
109130
static void __noreturn tdx_panic(const char *msg)
110131
{
111132
struct tdx_module_args args = {

arch/x86/include/asm/shared/tdx.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
/* TDX hypercall Leaf IDs */
2525
#define TDVMCALL_MAP_GPA 0x10001
26+
#define TDVMCALL_GET_QUOTE 0x10002
2627
#define TDVMCALL_REPORT_FATAL_ERROR 0x10003
2728

2829
#define TDVMCALL_STATUS_RETRY 1

arch/x86/include/asm/tdx.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ bool tdx_early_handle_ve(struct pt_regs *regs);
5656

5757
int tdx_mcall_get_report0(u8 *reportdata, u8 *tdreport);
5858

59+
u64 tdx_hcall_get_quote(u8 *buf, size_t size);
60+
5961
#else
6062

6163
static inline void tdx_early_init(void) { };

drivers/virt/Kconfig

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ source "drivers/virt/nitro_enclaves/Kconfig"
4848

4949
source "drivers/virt/acrn/Kconfig"
5050

51-
source "drivers/virt/coco/efi_secret/Kconfig"
52-
53-
source "drivers/virt/coco/sev-guest/Kconfig"
54-
55-
source "drivers/virt/coco/tdx-guest/Kconfig"
51+
source "drivers/virt/coco/Kconfig"
5652

5753
endif

drivers/virt/Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,4 @@ obj-y += vboxguest/
99

1010
obj-$(CONFIG_NITRO_ENCLAVES) += nitro_enclaves/
1111
obj-$(CONFIG_ACRN_HSM) += acrn/
12-
obj-$(CONFIG_EFI_SECRET) += coco/efi_secret/
13-
obj-$(CONFIG_SEV_GUEST) += coco/sev-guest/
14-
obj-$(CONFIG_INTEL_TDX_GUEST) += coco/tdx-guest/
12+
obj-y += coco/

drivers/virt/coco/Kconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
#
3+
# Confidential computing related collateral
4+
#
5+
6+
config TSM_REPORTS
7+
select CONFIGFS_FS
8+
tristate
9+
10+
source "drivers/virt/coco/efi_secret/Kconfig"
11+
12+
source "drivers/virt/coco/sev-guest/Kconfig"
13+
14+
source "drivers/virt/coco/tdx-guest/Kconfig"

drivers/virt/coco/Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
#
3+
# Confidential computing related collateral
4+
#
5+
obj-$(CONFIG_TSM_REPORTS) += tsm.o
6+
obj-$(CONFIG_EFI_SECRET) += efi_secret/
7+
obj-$(CONFIG_SEV_GUEST) += sev-guest/
8+
obj-$(CONFIG_INTEL_TDX_GUEST) += tdx-guest/

drivers/virt/coco/sev-guest/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ config SEV_GUEST
55
select CRYPTO
66
select CRYPTO_AEAD2
77
select CRYPTO_GCM
8+
select TSM_REPORTS
89
help
910
SEV-SNP firmware provides the guest a mechanism to communicate with
1011
the PSP without risk from a malicious hypervisor who wishes to read,

0 commit comments

Comments
 (0)