Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp6561978rwl; Wed, 22 Mar 2023 12:11:42 -0700 (PDT) X-Google-Smtp-Source: AK7set9cxrQsgF422alJeiqMnd4wyvMFaFS9LD7gk6/ZvQLQSIXsguU6dC/BZNN8NptlZ39/INlW X-Received: by 2002:a17:902:e5c6:b0:1a1:98a9:406f with SMTP id u6-20020a170902e5c600b001a198a9406fmr4307708plf.67.1679512302184; Wed, 22 Mar 2023 12:11:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679512302; cv=none; d=google.com; s=arc-20160816; b=anUYu0Jftj2mmpeo2FTWXG5NfUfkuFs+6zfUXZ5xIIzXxUw/Ls0960qWVb2GwL+DVf rhcjw9O6W9/A4VTjATq1Bv+yqnYU4IMbxe3CJCCbdoz55ZaF7kVi0s2eOCgTMY274X2U gKno+yhopyUZscA/PkysNGU/Na7vXBJshijPO9wKaWfXY/ighDzxStSiwIWOKCSbhwM5 +TjQ1nVpfSt8Heff+jNeI0OpctveUXz6+ZNUEqsJ4CsT+iICqX74/mgiNHiFHamQdzbC 2G0Go6TqNzvVM7sioOxuKpjTOvkd8Be6IodJZlhLcKW6ichiPTLZRvDlMSl7xQTvF3Lm TZIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=4WwpSsoa757+B783VvEHoO1Q7JSeNzEgYMuZGIY0Lrw=; b=vqwqDj+DBffRmIdjG0TlDC+1abegHiMb5EnRXKA+ovAmfZ/fAm3NlGN6sfGvVB2r5x BPy1K1zhc/WMPo/+ZH6SDte6EER2Q64BxdRnhli4q/p47EfoMu5J2T8MSMH1Sn4mIxYt jmDu9089+b40yjaUjZJC4KfmKMFDlNER5eenZ6MvW14GtM21qCSw3ORb+avvEEXTLgBd g0xsXO48XvTUhu1POm5RMpcrrskdZa/6HN9yjCi9E3t0k5+iqibNw7mh9ag8S6ERDcuT sUqO2c+K8PayWhHcv/3oUCPLP6bieow5j6AESvfMQZ6LolKttx7KzrHRL6MX6XKj60TS aB8Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bj2-20020a170902850200b0019e6763b213si15525399plb.99.2023.03.22.12.11.30; Wed, 22 Mar 2023 12:11:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229620AbjCVTGT convert rfc822-to-8bit (ORCPT + 99 others); Wed, 22 Mar 2023 15:06:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229459AbjCVTGS (ORCPT ); Wed, 22 Mar 2023 15:06:18 -0400 Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8AB2298DF; Wed, 22 Mar 2023 12:06:15 -0700 (PDT) Received: by mail-ed1-f52.google.com with SMTP id cn12so31478393edb.4; Wed, 22 Mar 2023 12:06:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679511974; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qX50foVihAGCHl7BTrP17dM7Mv2MYDDeekD5jmyzN/U=; b=BYQwuZbeX3hwMWu5GDR1K+eltVO86Mk1rfyoJkUc6TZ0k9G9y3yrG32V5NG1IpxWVR muUhIAewcVtWRjb19FhptjafHPiMKVIOJm4mKF+0QFTeFgy7994SccmRd66Zl0zBjTrM x9xB8zQt8JajrYzO6FN+gGUcDfyzsuCMKqpyTe1QjPVkgDwXAGH3krED6Nnoi2JBSvQO dNjxutrk6m85OKOlEigeUddBXtpyfpBoLk3921zgMnoMQDNcT4uAo9POoheo3liTzxX/ 0Vol4ruAT5rmTc6ozfTnWs8glnP9tvu7sX0s3H0Z4PyTsK610UUDLwvRbliJnUOan5gH 6xow== X-Gm-Message-State: AO0yUKWlhJGzbm1ZKoCdIy/HWLzoczIUIEb4k2yFL6OMKErcIcl2Qvvw z75BpB51MoK8YqyZDS0q06q6i8g3tN4VnzQxevk= X-Received: by 2002:a50:f683:0:b0:4fb:c8e3:1ae2 with SMTP id d3-20020a50f683000000b004fbc8e31ae2mr4165962edn.3.1679511974157; Wed, 22 Mar 2023 12:06:14 -0700 (PDT) MIME-Version: 1.0 References: <20230320212019.2479101-1-sathyanarayanan.kuppuswamy@linux.intel.com> <86fc67ba-9a6f-950a-cf30-5e80ba8efeb6@linux.intel.com> In-Reply-To: <86fc67ba-9a6f-950a-cf30-5e80ba8efeb6@linux.intel.com> From: "Rafael J. Wysocki" Date: Wed, 22 Mar 2023 20:06:03 +0100 Message-ID: Subject: Re: [PATCH v2] ACPI: sysfs: Enable ACPI sysfs support for CCEL records To: Sathyanarayanan Kuppuswamy Cc: "Rafael J. Wysocki" , Rafael J Wysocki , Len Brown , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=0.5 required=5.0 tests=FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 22, 2023 at 8:00 PM Sathyanarayanan Kuppuswamy wrote: > > Hi Rafael, > > On 3/22/23 11:31 AM, Rafael J. Wysocki wrote: > > On Mon, Mar 20, 2023 at 10:21 PM Kuppuswamy Sathyanarayanan > > wrote: > >> > >> The Confidential Computing Event Log (CCEL) table provides the address > >> and length of the CCEL records area in UEFI reserved memory. > > > > The rest of this paragraph can be omitted. > > > >> To access > >> these records, userspace can use /dev/mem to retrieve them. But > >> '/dev/mem' is not enabled on many systems for security reasons. > >> > >> So to allow user space access these event log records without the > >> /dev/mem interface, add support to access it via sysfs interface. 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, > >> and add support for /sys/firmware/acpi/tables/data/CCEL to enable > >> read-only access to the CCEL recorids area. > >> > >> More details about the CCEL table can be found in ACPI specification > >> r6.5, sec titled "CC Event Log ACPI Table". > > > > Please provide a proper section number here and a Link: tag pointing > > to the relevant section of the spec (which is > > https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html#cc-event-log-acpi-table > > I think). > > > >> Original-patch-by: Haibo Xu > > > > If the original patch has been signed-off by that developer, you can > > use a Co-developed-by: along with the original S-o-b tag here. > > > >> [Original patch is for TDEL table, modified it for CCEL support] > >> Signed-off-by: Kuppuswamy Sathyanarayanan > >> --- > >> > > How about the following version? Looks good to me, thanks! > ACPI: sysfs: Enable ACPI sysfs support for CCEL records > > 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 > Signed-off-by: Haibo Xu > Signed-off-by: Kuppuswamy Sathyanarayanan > > > > >> 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) > >> -- > >> 2.34.1 > >> > > -- > Sathyanarayanan Kuppuswamy > Linux Kernel Developer