From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2B90C433EF for ; Tue, 26 Apr 2022 13:01:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 34EC06B0074; Tue, 26 Apr 2022 09:01:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2D6F36B0075; Tue, 26 Apr 2022 09:01:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1526B6B0078; Tue, 26 Apr 2022 09:01:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id F362B6B0074 for ; Tue, 26 Apr 2022 09:01:41 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id B988C20747 for ; Tue, 26 Apr 2022 13:01:41 +0000 (UTC) X-FDA: 79399042002.16.324BCED Received: from mail-yw1-f170.google.com (mail-yw1-f170.google.com [209.85.128.170]) by imf03.hostedemail.com (Postfix) with ESMTP id BFE4820043 for ; Tue, 26 Apr 2022 13:01:37 +0000 (UTC) Received: by mail-yw1-f170.google.com with SMTP id 00721157ae682-2f16645872fso180965887b3.4 for ; Tue, 26 Apr 2022 06:01:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eclypsium.com; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=7U8qS0+N2U3Q5otz/HZN1++iKg/iT5uNuTdkb8n5jkc=; b=TLmJGydE2KBBsr5CCQaiOtLAlF5muH8VV+zjfD59n+L3Zv3Ojm/dSA9BvQGTNdMcNG +gE/78zsC4oozu52jkqdgMV/Y7eYREFBsJJ20IePiWRPpyDC4kgZzmV6HyTMxy8BswWi /wrYmzfpOlFHP6zCETpaxqlzaxHJiD0EuE4A6KV/f92muFwO1zBe+INc8wwEx+t524jW 5ayOtvzCGgFL6lJQSFwhXoA82F2J3acL9RA55Ip5z6GtqmIeQy9G1MoX5r2LoCwoz/BY RgA2FUrQNa4A6Beq6LfORF/DSSGmcDhynZsjDFZUvGXArsKWWfRV3OcBIDpIISmzHlWh dCAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=7U8qS0+N2U3Q5otz/HZN1++iKg/iT5uNuTdkb8n5jkc=; b=F9cuHZ2nTxKIi1jjfPh621vUSSrZmZMVm6dvKWj+1jUU23RJyCX4a0R6XgeUUEFH8w 4cHaXRo+eEy+9diXx32a+bQu+rNaAc1ogpXXWn6aiJejR5gv/tShPA99t+HKEp/VxnFx BeRuGZSrgo3O7P8weRpiTVvDQoYwjLGeeuGEIJWFRTFxoI6QcVpQbLmaqKLo6V7oTf85 yjqyui40UxR9cYSedj9cyOg2b6x7mchBlq9+jKmcT89O6ZoFmm+uM3e/kJRrAdhtGUXW 01mxUKXThA/jzGzUhuk4+UVBir9U/1STVhk+MmVBE6svknz0H1fIIduszVxGu2bo8hjS tR8Q== X-Gm-Message-State: AOAM531fCAockPiGcsH4qnjqsZpN7MayWXBpbYbF6xEC9TeCwbxfYsmF D45O3BnyRKxIMwImPaHz1gVkykCUL8tsul1EtrIpAIhmUmg= X-Google-Smtp-Source: ABdhPJxrixuEuLJzGGb3wWOmo8aOeK7hJWm6Gw2wZBOhgN5jn0XSBRugRdDxqxN2+b86OfWWA5UEk9IAFBtEcwScaH4= X-Received: by 2002:a0d:d953:0:b0:2f7:d5ce:f204 with SMTP id b80-20020a0dd953000000b002f7d5cef204mr12146537ywe.502.1650978100274; Tue, 26 Apr 2022 06:01:40 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a81:10a:0:0:0:0:0 with HTTP; Tue, 26 Apr 2022 06:01:39 -0700 (PDT) In-Reply-To: References: <20220425171526.44925-1-martin.fernandez@eclypsium.com> <20220425171526.44925-9-martin.fernandez@eclypsium.com> From: Martin Fernandez Date: Tue, 26 Apr 2022 10:01:39 -0300 Message-ID: Subject: Re: [PATCH v7 8/8] drivers/node: Show in sysfs node's crypto capabilities To: Mike Rapoport Cc: linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, ardb@kernel.org, dvhart@infradead.org, andy@infradead.org, gregkh@linuxfoundation.org, rafael@kernel.org, akpm@linux-foundation.org, daniel.gutson@eclypsium.com, hughsient@gmail.com, alex.bazhaniuk@eclypsium.com, alison.schofield@intel.com, keescook@chromium.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: BFE4820043 X-Stat-Signature: nu6jgj7i9jgi9yf4xbat7djs5zrhw1ir Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=eclypsium.com header.s=google header.b=TLmJGydE; dmarc=pass (policy=quarantine) header.from=eclypsium.com; spf=pass (imf03.hostedemail.com: domain of martin.fernandez@eclypsium.com designates 209.85.128.170 as permitted sender) smtp.mailfrom=martin.fernandez@eclypsium.com X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1650978097-397573 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 4/26/22, Mike Rapoport wrote: > On Mon, Apr 25, 2022 at 02:15:26PM -0300, Martin Fernandez wrote: >> Show in each node in sysfs if its memory is able to do be encrypted by >> the CPU, ie. if all its memory is marked with EFI_MEMORY_CPU_CRYPTO in >> the EFI memory map. >> >> Signed-off-by: Martin Fernandez >> --- >> Documentation/ABI/testing/sysfs-devices-node | 10 ++++++++++ >> drivers/base/node.c | 10 ++++++++++ >> 2 files changed, 20 insertions(+) >> create mode 100644 Documentation/ABI/testing/sysfs-devices-node >> >> diff --git a/Documentation/ABI/testing/sysfs-devices-node >> b/Documentation/ABI/testing/sysfs-devices-node >> new file mode 100644 >> index 000000000000..5fd5dc7fc2eb >> --- /dev/null >> +++ b/Documentation/ABI/testing/sysfs-devices-node >> @@ -0,0 +1,10 @@ >> +What: /sys/devices/system/node/nodeX/crypto_capable >> +Date: April 2022 >> +Contact: Martin Fernandez >> +Users: fwupd (https://fwupd.org) >> +Description: >> + This value is 1 if all system memory in this node is >> + marked with EFI_MEMORY_CPU_CRYPTO, indicating that the >> + system memory is capable of being protected with the >> + CPU=E2=80=99s memory cryptographic capabilities. It is 0 >> + otherwise. > > I understand that currently this feature is only for x86, but if non-EFI > architectures will start using MEMBLOCK_CRYPTO_CAPABLE, the sysfs attribu= te > for will be relevant form them as well. > > How about > This value is 1 if all system memory in this node is capable of > being protected with the CPU's memory cryptographic capabilities. > It is 0 otherwise. > On EFI systems the node will be marked with EFI_MEMORY_CPU_CRYPTO. > Good point. I'll change it. >> \ No newline at end of file >> diff --git a/drivers/base/node.c b/drivers/base/node.c >> index ec8bb24a5a22..1df15ea03c27 100644 >> --- a/drivers/base/node.c >> +++ b/drivers/base/node.c >> @@ -560,11 +560,21 @@ static ssize_t node_read_distance(struct device >> *dev, >> } >> static DEVICE_ATTR(distance, 0444, node_read_distance, NULL); >> >> +static ssize_t crypto_capable_show(struct device *dev, >> + struct device_attribute *attr, char *buf) >> +{ >> + struct pglist_data *pgdat =3D NODE_DATA(dev->id); >> + >> + return sysfs_emit(buf, "%d\n", pgdat->crypto_capable); >> +} >> +static DEVICE_ATTR_RO(crypto_capable); >> + >> static struct attribute *node_dev_attrs[] =3D { >> &dev_attr_meminfo.attr, >> &dev_attr_numastat.attr, >> &dev_attr_distance.attr, >> &dev_attr_vmstat.attr, >> + &dev_attr_crypto_capable.attr, >> NULL >> }; >> >> -- >> 2.30.2 >> > > -- > Sincerely yours, > Mike. >