Skip to content

Commit a0372b3

Browse files
committed
Merge branch 'for-6.16/tsm' into tsm-next
Pick up the drivers/virt/coco/guest/ split in preparation for TSM host drivers.
2 parents fba4cea + 7515f45 commit a0372b3

File tree

11 files changed

+56
-48
lines changed

11 files changed

+56
-48
lines changed

MAINTAINERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24559,8 +24559,8 @@ TRUSTED SECURITY MODULE (TSM) ATTESTATION REPORTS
2455924559
M: Dan Williams <dan.j.williams@intel.com>
2456024560
L: linux-coco@lists.linux.dev
2456124561
S: Maintained
24562-
F: Documentation/ABI/testing/configfs-tsm
24563-
F: drivers/virt/coco/tsm.c
24562+
F: Documentation/ABI/testing/configfs-tsm-report
24563+
F: drivers/virt/coco/guest/
2456424564
F: include/linux/tsm.h
2456524565

2456624566
TRUSTED SERVICES TEE DRIVER

drivers/virt/coco/Kconfig

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
# Confidential computing related collateral
44
#
55

6-
config TSM_REPORTS
7-
select CONFIGFS_FS
8-
tristate
9-
106
source "drivers/virt/coco/efi_secret/Kconfig"
117

128
source "drivers/virt/coco/pkvm-guest/Kconfig"
@@ -16,3 +12,5 @@ source "drivers/virt/coco/sev-guest/Kconfig"
1612
source "drivers/virt/coco/tdx-guest/Kconfig"
1713

1814
source "drivers/virt/coco/arm-cca-guest/Kconfig"
15+
16+
source "drivers/virt/coco/guest/Kconfig"

drivers/virt/coco/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
#
33
# Confidential computing related collateral
44
#
5-
obj-$(CONFIG_TSM_REPORTS) += tsm.o
65
obj-$(CONFIG_EFI_SECRET) += efi_secret/
76
obj-$(CONFIG_ARM_PKVM_GUEST) += pkvm-guest/
87
obj-$(CONFIG_SEV_GUEST) += sev-guest/
98
obj-$(CONFIG_INTEL_TDX_GUEST) += tdx-guest/
109
obj-$(CONFIG_ARM_CCA_GUEST) += arm-cca-guest/
10+
obj-$(CONFIG_TSM_REPORTS) += guest/

drivers/virt/coco/arm-cca-guest/arm-cca-guest.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ static int arm_cca_report_new(struct tsm_report *report, void *data)
9696
struct arm_cca_token_info info;
9797
void *buf;
9898
u8 *token __free(kvfree) = NULL;
99-
struct tsm_desc *desc = &report->desc;
99+
struct tsm_report_desc *desc = &report->desc;
100100

101101
if (desc->inblob_len < 32 || desc->inblob_len > 64)
102102
return -EINVAL;
@@ -181,7 +181,7 @@ static int arm_cca_report_new(struct tsm_report *report, void *data)
181181
return ret;
182182
}
183183

184-
static const struct tsm_ops arm_cca_tsm_ops = {
184+
static const struct tsm_report_ops arm_cca_tsm_ops = {
185185
.name = KBUILD_MODNAME,
186186
.report_new = arm_cca_report_new,
187187
};
@@ -202,7 +202,7 @@ static int __init arm_cca_guest_init(void)
202202
if (!is_realm_world())
203203
return -ENODEV;
204204

205-
ret = tsm_register(&arm_cca_tsm_ops, NULL);
205+
ret = tsm_report_register(&arm_cca_tsm_ops, NULL);
206206
if (ret < 0)
207207
pr_err("Error %d registering with TSM\n", ret);
208208

@@ -216,7 +216,7 @@ module_init(arm_cca_guest_init);
216216
*/
217217
static void __exit arm_cca_guest_exit(void)
218218
{
219-
tsm_unregister(&arm_cca_tsm_ops);
219+
tsm_report_unregister(&arm_cca_tsm_ops);
220220
}
221221
module_exit(arm_cca_guest_exit);
222222

drivers/virt/coco/guest/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
#
3+
# Confidential computing shared guest collateral
4+
#
5+
config TSM_REPORTS
6+
select CONFIGFS_FS
7+
tristate

drivers/virt/coco/guest/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
obj-$(CONFIG_TSM_REPORTS) += tsm_report.o
3+
tsm_report-y := report.o

drivers/virt/coco/tsm.c renamed to drivers/virt/coco/guest/report.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <linux/configfs.h>
1414

1515
static struct tsm_provider {
16-
const struct tsm_ops *ops;
16+
const struct tsm_report_ops *ops;
1717
void *data;
1818
atomic_t count;
1919
} provider;
@@ -103,7 +103,7 @@ static ssize_t tsm_report_privlevel_store(struct config_item *cfg,
103103
* SEV-SNP GHCB) and a minimum of a TSM selected floor value no less
104104
* than 0.
105105
*/
106-
if (provider.ops->privlevel_floor > val || val > TSM_PRIVLEVEL_MAX)
106+
if (provider.ops->privlevel_floor > val || val > TSM_REPORT_PRIVLEVEL_MAX)
107107
return -EINVAL;
108108

109109
rc = try_advance_write_generation(report);
@@ -210,7 +210,7 @@ static ssize_t tsm_report_inblob_write(struct config_item *cfg,
210210
memcpy(report->desc.inblob, buf, count);
211211
return count;
212212
}
213-
CONFIGFS_BIN_ATTR_WO(tsm_report_, inblob, NULL, TSM_INBLOB_MAX);
213+
CONFIGFS_BIN_ATTR_WO(tsm_report_, inblob, NULL, TSM_REPORT_INBLOB_MAX);
214214

215215
static ssize_t tsm_report_generation_show(struct config_item *cfg, char *buf)
216216
{
@@ -283,7 +283,7 @@ static ssize_t tsm_report_read(struct tsm_report *report, void *buf,
283283
size_t count, enum tsm_data_select select)
284284
{
285285
struct tsm_report_state *state = to_state(report);
286-
const struct tsm_ops *ops;
286+
const struct tsm_report_ops *ops;
287287
ssize_t rc;
288288

289289
/* try to read from the existing report if present and valid... */
@@ -325,7 +325,7 @@ static ssize_t tsm_report_outblob_read(struct config_item *cfg, void *buf,
325325

326326
return tsm_report_read(report, buf, count, TSM_REPORT);
327327
}
328-
CONFIGFS_BIN_ATTR_RO(tsm_report_, outblob, NULL, TSM_OUTBLOB_MAX);
328+
CONFIGFS_BIN_ATTR_RO(tsm_report_, outblob, NULL, TSM_REPORT_OUTBLOB_MAX);
329329

330330
static ssize_t tsm_report_auxblob_read(struct config_item *cfg, void *buf,
331331
size_t count)
@@ -334,7 +334,7 @@ static ssize_t tsm_report_auxblob_read(struct config_item *cfg, void *buf,
334334

335335
return tsm_report_read(report, buf, count, TSM_CERTS);
336336
}
337-
CONFIGFS_BIN_ATTR_RO(tsm_report_, auxblob, NULL, TSM_OUTBLOB_MAX);
337+
CONFIGFS_BIN_ATTR_RO(tsm_report_, auxblob, NULL, TSM_REPORT_OUTBLOB_MAX);
338338

339339
static ssize_t tsm_report_manifestblob_read(struct config_item *cfg, void *buf,
340340
size_t count)
@@ -343,7 +343,7 @@ static ssize_t tsm_report_manifestblob_read(struct config_item *cfg, void *buf,
343343

344344
return tsm_report_read(report, buf, count, TSM_MANIFEST);
345345
}
346-
CONFIGFS_BIN_ATTR_RO(tsm_report_, manifestblob, NULL, TSM_OUTBLOB_MAX);
346+
CONFIGFS_BIN_ATTR_RO(tsm_report_, manifestblob, NULL, TSM_REPORT_OUTBLOB_MAX);
347347

348348
static struct configfs_attribute *tsm_report_attrs[] = {
349349
[TSM_REPORT_GENERATION] = &tsm_report_attr_generation,
@@ -467,9 +467,9 @@ static struct configfs_subsystem tsm_configfs = {
467467
.su_mutex = __MUTEX_INITIALIZER(tsm_configfs.su_mutex),
468468
};
469469

470-
int tsm_register(const struct tsm_ops *ops, void *priv)
470+
int tsm_report_register(const struct tsm_report_ops *ops, void *priv)
471471
{
472-
const struct tsm_ops *conflict;
472+
const struct tsm_report_ops *conflict;
473473

474474
guard(rwsem_write)(&tsm_rwsem);
475475
conflict = provider.ops;
@@ -487,9 +487,9 @@ int tsm_register(const struct tsm_ops *ops, void *priv)
487487
provider.data = priv;
488488
return 0;
489489
}
490-
EXPORT_SYMBOL_GPL(tsm_register);
490+
EXPORT_SYMBOL_GPL(tsm_report_register);
491491

492-
int tsm_unregister(const struct tsm_ops *ops)
492+
int tsm_report_unregister(const struct tsm_report_ops *ops)
493493
{
494494
guard(rwsem_write)(&tsm_rwsem);
495495
if (ops != provider.ops)
@@ -501,11 +501,11 @@ int tsm_unregister(const struct tsm_ops *ops)
501501
provider.data = NULL;
502502
return 0;
503503
}
504-
EXPORT_SYMBOL_GPL(tsm_unregister);
504+
EXPORT_SYMBOL_GPL(tsm_report_unregister);
505505

506506
static struct config_group *tsm_report_group;
507507

508-
static int __init tsm_init(void)
508+
static int __init tsm_report_init(void)
509509
{
510510
struct config_group *root = &tsm_configfs.su_group;
511511
struct config_group *tsm;
@@ -526,14 +526,14 @@ static int __init tsm_init(void)
526526

527527
return 0;
528528
}
529-
module_init(tsm_init);
529+
module_init(tsm_report_init);
530530

531-
static void __exit tsm_exit(void)
531+
static void __exit tsm_report_exit(void)
532532
{
533533
configfs_unregister_default_group(tsm_report_group);
534534
configfs_unregister_subsystem(&tsm_configfs);
535535
}
536-
module_exit(tsm_exit);
536+
module_exit(tsm_report_exit);
537537

538538
MODULE_LICENSE("GPL");
539539
MODULE_DESCRIPTION("Provide Trusted Security Module attestation reports via configfs");

drivers/virt/coco/sev-guest/sev-guest.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ struct snp_msg_cert_entry {
346346
static int sev_svsm_report_new(struct tsm_report *report, void *data)
347347
{
348348
unsigned int rep_len, man_len, certs_len;
349-
struct tsm_desc *desc = &report->desc;
349+
struct tsm_report_desc *desc = &report->desc;
350350
struct svsm_attest_call ac = {};
351351
unsigned int retry_count;
352352
void *rep, *man, *certs;
@@ -481,7 +481,7 @@ static int sev_svsm_report_new(struct tsm_report *report, void *data)
481481
static int sev_report_new(struct tsm_report *report, void *data)
482482
{
483483
struct snp_msg_cert_entry *cert_table;
484-
struct tsm_desc *desc = &report->desc;
484+
struct tsm_report_desc *desc = &report->desc;
485485
struct snp_guest_dev *snp_dev = data;
486486
struct snp_msg_report_resp_hdr hdr;
487487
const u32 report_size = SZ_4K;
@@ -610,7 +610,7 @@ static bool sev_report_bin_attr_visible(int n)
610610
return false;
611611
}
612612

613-
static struct tsm_ops sev_tsm_ops = {
613+
static struct tsm_report_ops sev_tsm_report_ops = {
614614
.name = KBUILD_MODNAME,
615615
.report_new = sev_report_new,
616616
.report_attr_visible = sev_report_attr_visible,
@@ -619,7 +619,7 @@ static struct tsm_ops sev_tsm_ops = {
619619

620620
static void unregister_sev_tsm(void *data)
621621
{
622-
tsm_unregister(&sev_tsm_ops);
622+
tsm_report_unregister(&sev_tsm_report_ops);
623623
}
624624

625625
static int __init sev_guest_probe(struct platform_device *pdev)
@@ -656,9 +656,9 @@ static int __init sev_guest_probe(struct platform_device *pdev)
656656
misc->fops = &snp_guest_fops;
657657

658658
/* Set the privlevel_floor attribute based on the vmpck_id */
659-
sev_tsm_ops.privlevel_floor = mdesc->vmpck_id;
659+
sev_tsm_report_ops.privlevel_floor = mdesc->vmpck_id;
660660

661-
ret = tsm_register(&sev_tsm_ops, snp_dev);
661+
ret = tsm_report_register(&sev_tsm_report_ops, snp_dev);
662662
if (ret)
663663
goto e_msg_init;
664664

drivers/virt/coco/tdx-guest/tdx-guest.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ static int tdx_report_new(struct tsm_report *report, void *data)
161161
{
162162
u8 *buf, *reportdata = NULL, *tdreport = NULL;
163163
struct tdx_quote_buf *quote_buf = quote_data;
164-
struct tsm_desc *desc = &report->desc;
164+
struct tsm_report_desc *desc = &report->desc;
165165
int ret;
166166
u64 err;
167167

@@ -297,7 +297,7 @@ static const struct x86_cpu_id tdx_guest_ids[] = {
297297
};
298298
MODULE_DEVICE_TABLE(x86cpu, tdx_guest_ids);
299299

300-
static const struct tsm_ops tdx_tsm_ops = {
300+
static const struct tsm_report_ops tdx_tsm_ops = {
301301
.name = KBUILD_MODNAME,
302302
.report_new = tdx_report_new,
303303
.report_attr_visible = tdx_report_attr_visible,
@@ -322,7 +322,7 @@ static int __init tdx_guest_init(void)
322322
goto free_misc;
323323
}
324324

325-
ret = tsm_register(&tdx_tsm_ops, NULL);
325+
ret = tsm_report_register(&tdx_tsm_ops, NULL);
326326
if (ret)
327327
goto free_quote;
328328

@@ -339,7 +339,7 @@ module_init(tdx_guest_init);
339339

340340
static void __exit tdx_guest_exit(void)
341341
{
342-
tsm_unregister(&tdx_tsm_ops);
342+
tsm_report_unregister(&tdx_tsm_ops);
343343
free_quote_buf(quote_data);
344344
misc_deregister(&tdx_misc_dev);
345345
}

0 commit comments

Comments
 (0)