Skip to content

Commit 71ded61

Browse files
committed
configfs-tsm: Namespace TSM report symbols
In preparation for new + common TSM (TEE Security Manager) infrastructure, namespace the TSM report symbols in tsm.h with an _REPORT suffix to differentiate them from other incoming tsm work. Cc: Yilun Xu <yilun.xu@intel.com> Cc: Samuel Ortiz <sameo@rivosinc.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Steven Price <steven.price@arm.com> Reviewed-by: Alexey Kardashevskiy <aik@amd.com> Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com> Reviewed-by: Kai Huang <kai.huang@intel.com> Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> Reviewed-by: Steven Price <steven.price@arm.com> Link: https://patch.msgid.link/174107246021.1288555.7203769833791489618.stgit@dwillia2-xfh.jf.intel.com Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 8ffd015 commit 71ded61

File tree

7 files changed

+42
-42
lines changed

7 files changed

+42
-42
lines changed

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24559,7 +24559,7 @@ 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
24562+
F: Documentation/ABI/testing/configfs-tsm-report
2456324563
F: drivers/virt/coco/tsm.c
2456424564
F: include/linux/tsm.h
2456524565

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/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
}

drivers/virt/coco/tsm.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
} provider;
1919
static DECLARE_RWSEM(tsm_rwsem);
@@ -98,7 +98,7 @@ static ssize_t tsm_report_privlevel_store(struct config_item *cfg,
9898
* SEV-SNP GHCB) and a minimum of a TSM selected floor value no less
9999
* than 0.
100100
*/
101-
if (provider.ops->privlevel_floor > val || val > TSM_PRIVLEVEL_MAX)
101+
if (provider.ops->privlevel_floor > val || val > TSM_REPORT_PRIVLEVEL_MAX)
102102
return -EINVAL;
103103

104104
guard(rwsem_write)(&tsm_rwsem);
@@ -202,7 +202,7 @@ static ssize_t tsm_report_inblob_write(struct config_item *cfg,
202202
memcpy(report->desc.inblob, buf, count);
203203
return count;
204204
}
205-
CONFIGFS_BIN_ATTR_WO(tsm_report_, inblob, NULL, TSM_INBLOB_MAX);
205+
CONFIGFS_BIN_ATTR_WO(tsm_report_, inblob, NULL, TSM_REPORT_INBLOB_MAX);
206206

207207
static ssize_t tsm_report_generation_show(struct config_item *cfg, char *buf)
208208
{
@@ -272,7 +272,7 @@ static ssize_t tsm_report_read(struct tsm_report *report, void *buf,
272272
size_t count, enum tsm_data_select select)
273273
{
274274
struct tsm_report_state *state = to_state(report);
275-
const struct tsm_ops *ops;
275+
const struct tsm_report_ops *ops;
276276
ssize_t rc;
277277

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

315315
return tsm_report_read(report, buf, count, TSM_REPORT);
316316
}
317-
CONFIGFS_BIN_ATTR_RO(tsm_report_, outblob, NULL, TSM_OUTBLOB_MAX);
317+
CONFIGFS_BIN_ATTR_RO(tsm_report_, outblob, NULL, TSM_REPORT_OUTBLOB_MAX);
318318

319319
static ssize_t tsm_report_auxblob_read(struct config_item *cfg, void *buf,
320320
size_t count)
@@ -323,7 +323,7 @@ static ssize_t tsm_report_auxblob_read(struct config_item *cfg, void *buf,
323323

324324
return tsm_report_read(report, buf, count, TSM_CERTS);
325325
}
326-
CONFIGFS_BIN_ATTR_RO(tsm_report_, auxblob, NULL, TSM_OUTBLOB_MAX);
326+
CONFIGFS_BIN_ATTR_RO(tsm_report_, auxblob, NULL, TSM_REPORT_OUTBLOB_MAX);
327327

328328
static ssize_t tsm_report_manifestblob_read(struct config_item *cfg, void *buf,
329329
size_t count)
@@ -332,7 +332,7 @@ static ssize_t tsm_report_manifestblob_read(struct config_item *cfg, void *buf,
332332

333333
return tsm_report_read(report, buf, count, TSM_MANIFEST);
334334
}
335-
CONFIGFS_BIN_ATTR_RO(tsm_report_, manifestblob, NULL, TSM_OUTBLOB_MAX);
335+
CONFIGFS_BIN_ATTR_RO(tsm_report_, manifestblob, NULL, TSM_REPORT_OUTBLOB_MAX);
336336

337337
static struct configfs_attribute *tsm_report_attrs[] = {
338338
[TSM_REPORT_GENERATION] = &tsm_report_attr_generation,
@@ -448,9 +448,9 @@ static struct configfs_subsystem tsm_configfs = {
448448
.su_mutex = __MUTEX_INITIALIZER(tsm_configfs.su_mutex),
449449
};
450450

451-
int tsm_register(const struct tsm_ops *ops, void *priv)
451+
int tsm_report_register(const struct tsm_report_ops *ops, void *priv)
452452
{
453-
const struct tsm_ops *conflict;
453+
const struct tsm_report_ops *conflict;
454454

455455
guard(rwsem_write)(&tsm_rwsem);
456456
conflict = provider.ops;
@@ -463,9 +463,9 @@ int tsm_register(const struct tsm_ops *ops, void *priv)
463463
provider.data = priv;
464464
return 0;
465465
}
466-
EXPORT_SYMBOL_GPL(tsm_register);
466+
EXPORT_SYMBOL_GPL(tsm_report_register);
467467

468-
int tsm_unregister(const struct tsm_ops *ops)
468+
int tsm_report_unregister(const struct tsm_report_ops *ops)
469469
{
470470
guard(rwsem_write)(&tsm_rwsem);
471471
if (ops != provider.ops)
@@ -474,11 +474,11 @@ int tsm_unregister(const struct tsm_ops *ops)
474474
provider.data = NULL;
475475
return 0;
476476
}
477-
EXPORT_SYMBOL_GPL(tsm_unregister);
477+
EXPORT_SYMBOL_GPL(tsm_report_unregister);
478478

479479
static struct config_group *tsm_report_group;
480480

481-
static int __init tsm_init(void)
481+
static int __init tsm_report_init(void)
482482
{
483483
struct config_group *root = &tsm_configfs.su_group;
484484
struct config_group *tsm;
@@ -499,14 +499,14 @@ static int __init tsm_init(void)
499499

500500
return 0;
501501
}
502-
module_init(tsm_init);
502+
module_init(tsm_report_init);
503503

504-
static void __exit tsm_exit(void)
504+
static void __exit tsm_report_exit(void)
505505
{
506506
configfs_unregister_default_group(tsm_report_group);
507507
configfs_unregister_subsystem(&tsm_configfs);
508508
}
509-
module_exit(tsm_exit);
509+
module_exit(tsm_report_exit);
510510

511511
MODULE_LICENSE("GPL");
512512
MODULE_DESCRIPTION("Provide Trusted Security Module attestation reports via configfs");

include/linux/tsm.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,28 @@
66
#include <linux/types.h>
77
#include <linux/uuid.h>
88

9-
#define TSM_INBLOB_MAX 64
10-
#define TSM_OUTBLOB_MAX SZ_32K
9+
#define TSM_REPORT_INBLOB_MAX 64
10+
#define TSM_REPORT_OUTBLOB_MAX SZ_32K
1111

1212
/*
1313
* Privilege level is a nested permission concept to allow confidential
1414
* guests to partition address space, 4-levels are supported.
1515
*/
16-
#define TSM_PRIVLEVEL_MAX 3
16+
#define TSM_REPORT_PRIVLEVEL_MAX 3
1717

1818
/**
19-
* struct tsm_desc - option descriptor for generating tsm report blobs
19+
* struct tsm_report_desc - option descriptor for generating tsm report blobs
2020
* @privlevel: optional privilege level to associate with @outblob
2121
* @inblob_len: sizeof @inblob
2222
* @inblob: arbitrary input data
2323
* @service_provider: optional name of where to obtain the tsm report blob
2424
* @service_guid: optional service-provider service guid to attest
2525
* @service_manifest_version: optional service-provider service manifest version requested
2626
*/
27-
struct tsm_desc {
27+
struct tsm_report_desc {
2828
unsigned int privlevel;
2929
size_t inblob_len;
30-
u8 inblob[TSM_INBLOB_MAX];
30+
u8 inblob[TSM_REPORT_INBLOB_MAX];
3131
char *service_provider;
3232
guid_t service_guid;
3333
unsigned int service_manifest_version;
@@ -44,7 +44,7 @@ struct tsm_desc {
4444
* @manifestblob: (optional) manifest data associated with the report
4545
*/
4646
struct tsm_report {
47-
struct tsm_desc desc;
47+
struct tsm_report_desc desc;
4848
size_t outblob_len;
4949
u8 *outblob;
5050
size_t auxblob_len;
@@ -88,7 +88,7 @@ enum tsm_bin_attr_index {
8888
};
8989

9090
/**
91-
* struct tsm_ops - attributes and operations for tsm instances
91+
* struct tsm_report_ops - attributes and operations for tsm_report instances
9292
* @name: tsm id reflected in /sys/kernel/config/tsm/report/$report/provider
9393
* @privlevel_floor: convey base privlevel for nested scenarios
9494
* @report_new: Populate @report with the report blob and auxblob
@@ -99,14 +99,14 @@ enum tsm_bin_attr_index {
9999
* Implementation specific ops, only one is expected to be registered at
100100
* a time i.e. only one of "sev-guest", "tdx-guest", etc.
101101
*/
102-
struct tsm_ops {
102+
struct tsm_report_ops {
103103
const char *name;
104104
unsigned int privlevel_floor;
105105
int (*report_new)(struct tsm_report *report, void *data);
106106
bool (*report_attr_visible)(int n);
107107
bool (*report_bin_attr_visible)(int n);
108108
};
109109

110-
int tsm_register(const struct tsm_ops *ops, void *priv);
111-
int tsm_unregister(const struct tsm_ops *ops);
110+
int tsm_report_register(const struct tsm_report_ops *ops, void *priv);
111+
int tsm_report_unregister(const struct tsm_report_ops *ops);
112112
#endif /* __TSM_H */

0 commit comments

Comments
 (0)