Skip to content

Commit feff673

Browse files
xiaobo55xKuppuswamy Sathyanarayanan
authored andcommitted
ACPI/sysfs: Enable ACPI sysfs support for TDEL
Currently, all ACPI tables can be accessed via entries under '/sys/firmware/acpi/tables/'. The TDEL(Trust Domain Event Log)[1] table simply provide the address and length of the TDEL records area in UEFI reserved memory. To access these records, userspace can use /dev/mem to retrieve them. But '/dev/mem' is not enabled on many systems for security reasons. The ACPI driver has provided read only access to BERT records area via '/sys/firmware/acpi/tables/data/BERT' in sysfs. So follow the same way, this patch create a new file /sys/firmware/acpi/tables/data/TDEL to enable read-only access to the TDEL records area. [1] https://software.intel.com/content/dam/develop/external/us/en/ documents/intel-tdx-guest-hypervisor-communication-interface- 1.0-344426-002.pdf Signed-off-by: Haibo Xu <[email protected]>
1 parent a4241ab commit feff673

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

drivers/acpi/sysfs.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,11 +446,28 @@ static int acpi_bert_data_init(void *th, struct acpi_data_attr *data_attr)
446446
return sysfs_create_bin_file(tables_data_kobj, &data_attr->attr);
447447
}
448448

449+
static int acpi_tdel_data_init(void *th, struct acpi_data_attr *data_attr)
450+
{
451+
struct acpi_table_tdel *tdel = th;
452+
453+
if (tdel->header.length < sizeof(struct acpi_table_tdel) ||
454+
!(tdel->log_area_address) || !(tdel->log_area_length)) {
455+
kfree(data_attr);
456+
return -EINVAL;
457+
}
458+
data_attr->addr = tdel->log_area_address;
459+
data_attr->attr.size = tdel->log_area_length;
460+
data_attr->attr.attr.name = "TDEL";
461+
462+
return sysfs_create_bin_file(tables_data_kobj, &data_attr->attr);
463+
}
464+
449465
static struct acpi_data_obj {
450466
char *name;
451467
int (*fn)(void *, struct acpi_data_attr *);
452468
} acpi_data_objs[] = {
453469
{ ACPI_SIG_BERT, acpi_bert_data_init },
470+
{ ACPI_SIG_TDEL, acpi_tdel_data_init },
454471
};
455472

456473
#define NUM_ACPI_DATA_OBJS ARRAY_SIZE(acpi_data_objs)

include/acpi/actbl3.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#define ACPI_SIG_WSMT "WSMT" /* Windows SMM Security Mitigations Table */
4343
#define ACPI_SIG_XENV "XENV" /* Xen Environment table */
4444
#define ACPI_SIG_XXXX "XXXX" /* Intermediate AML header for ASL/ASL+ converter */
45+
#define ACPI_SIG_TDEL "TDEL" /* Intel Trust Domain Event Log table */
4546

4647
/*
4748
* All tables must be byte-packed to match the ACPI specification, since
@@ -469,6 +470,22 @@ struct acpi_tpm2_arm_smc {
469470

470471
#define ACPI_TPM2_IDLE_SUPPORT (1)
471472

473+
/*******************************************************************************
474+
*
475+
* TDEL - Trust Domain Event Log Table
476+
*
477+
* Conforms to Intel TDX GHCI Specification
478+
* Version 1, Sep 2021
479+
*
480+
******************************************************************************/
481+
482+
struct acpi_table_tdel {
483+
struct acpi_table_header header; /* Common ACPI table header */
484+
u32 reserved;
485+
u64 log_area_length; /* Log area minimum length */
486+
u64 log_area_address; /* Log area start address */
487+
};
488+
472489
/*******************************************************************************
473490
*
474491
* UEFI - UEFI Boot optimization Table

0 commit comments

Comments
 (0)