diff mbox series

[v3] ACPI: sysfs: Enable ACPI sysfs support for CCEL records

Message ID 20230322191313.22804-1-sathyanarayanan.kuppuswamy@linux.intel.com
State Accepted
Commit 4f855dcead6c5be0a48a2779eeecb170ec144534
Headers show
Series [v3] ACPI: sysfs: Enable ACPI sysfs support for CCEL records | expand

Commit Message

Kuppuswamy Sathyanarayanan March 22, 2023, 7:13 p.m. UTC
The Confidential Computing Event Log (CCEL) table provides the address
and length of the CCEL records area in UEFI reserved memory.

To allow user space access to these records, expose a sysfs interface
similar to the BERT table.

More details about the CCEL table can be found in the ACPI specification
r6.5 [1], sec 5.2.34.

Link: https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html#cc-event-log-acpi-table # [1]
Co-developed-by: Haibo Xu <haibo1.xu@intel.com>
Signed-off-by: Haibo Xu <haibo1.xu@intel.com>
Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
---

Changes since v2:
 * Fixed the commit log as per review suggestion.

Changes since v1:
 * Removed unnecessary parenthesis as per Rafael's suggestion.

 drivers/acpi/sysfs.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Comments

Rafael J. Wysocki March 27, 2023, 6:45 p.m. UTC | #1
On Wed, Mar 22, 2023 at 8:13 PM Kuppuswamy Sathyanarayanan
<sathyanarayanan.kuppuswamy@linux.intel.com> wrote:
>
> The Confidential Computing Event Log (CCEL) table provides the address
> and length of the CCEL records area in UEFI reserved memory.
>
> To allow user space access to these records, expose a sysfs interface
> similar to the BERT table.
>
> More details about the CCEL table can be found in the ACPI specification
> r6.5 [1], sec 5.2.34.
>
> Link: https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html#cc-event-log-acpi-table # [1]
> Co-developed-by: Haibo Xu <haibo1.xu@intel.com>
> Signed-off-by: Haibo Xu <haibo1.xu@intel.com>
> Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
> ---
>
> Changes since v2:
>  * Fixed the commit log as per review suggestion.
>
> Changes since v1:
>  * Removed unnecessary parenthesis as per Rafael's suggestion.
>
>  drivers/acpi/sysfs.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
>
> diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
> index 7f4ff56c9d42..687524b50085 100644
> --- a/drivers/acpi/sysfs.c
> +++ b/drivers/acpi/sysfs.c
> @@ -458,11 +458,28 @@ static int acpi_bert_data_init(void *th, struct acpi_data_attr *data_attr)
>         return sysfs_create_bin_file(tables_data_kobj, &data_attr->attr);
>  }
>
> +static int acpi_ccel_data_init(void *th, struct acpi_data_attr *data_attr)
> +{
> +       struct acpi_table_ccel *ccel = th;
> +
> +       if (ccel->header.length < sizeof(struct acpi_table_ccel) ||
> +           !ccel->log_area_start_address || !ccel->log_area_minimum_length) {
> +               kfree(data_attr);
> +               return -EINVAL;
> +       }
> +       data_attr->addr = ccel->log_area_start_address;
> +       data_attr->attr.size = ccel->log_area_minimum_length;
> +       data_attr->attr.attr.name = "CCEL";
> +
> +       return sysfs_create_bin_file(tables_data_kobj, &data_attr->attr);
> +}
> +
>  static struct acpi_data_obj {
>         char *name;
>         int (*fn)(void *, struct acpi_data_attr *);
>  } acpi_data_objs[] = {
>         { ACPI_SIG_BERT, acpi_bert_data_init },
> +       { ACPI_SIG_CCEL, acpi_ccel_data_init },
>  };
>
>  #define NUM_ACPI_DATA_OBJS ARRAY_SIZE(acpi_data_objs)
> --

Applied as 6.4 material, thanks!
diff mbox series

Patch

diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index 7f4ff56c9d42..687524b50085 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -458,11 +458,28 @@  static int acpi_bert_data_init(void *th, struct acpi_data_attr *data_attr)
 	return sysfs_create_bin_file(tables_data_kobj, &data_attr->attr);
 }
 
+static int acpi_ccel_data_init(void *th, struct acpi_data_attr *data_attr)
+{
+	struct acpi_table_ccel *ccel = th;
+
+	if (ccel->header.length < sizeof(struct acpi_table_ccel) ||
+	    !ccel->log_area_start_address || !ccel->log_area_minimum_length) {
+		kfree(data_attr);
+		return -EINVAL;
+	}
+	data_attr->addr = ccel->log_area_start_address;
+	data_attr->attr.size = ccel->log_area_minimum_length;
+	data_attr->attr.attr.name = "CCEL";
+
+	return sysfs_create_bin_file(tables_data_kobj, &data_attr->attr);
+}
+
 static struct acpi_data_obj {
 	char *name;
 	int (*fn)(void *, struct acpi_data_attr *);
 } acpi_data_objs[] = {
 	{ ACPI_SIG_BERT, acpi_bert_data_init },
+	{ ACPI_SIG_CCEL, acpi_ccel_data_init },
 };
 
 #define NUM_ACPI_DATA_OBJS ARRAY_SIZE(acpi_data_objs)