Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1680053pxb; Wed, 9 Feb 2022 02:01:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJxdZ+TrIGvvf3jZ5Mg0hNj6D1KcvZvAJA1QbkE9mwpLosUc1v+mtGMlwReeBf5jcpC9X6SK X-Received: by 2002:a17:90a:ea0f:: with SMTP id w15mr2509175pjy.181.1644400909241; Wed, 09 Feb 2022 02:01:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644400909; cv=none; d=google.com; s=arc-20160816; b=Xe9uICvqQ6/53bP2L1EyPxO5YjwvW/4tirJ0BcGHCe1xf6kRSBe5KqzXjv/65Y7EPU ZE12tQ+i1w7NKmyeo83JSAbU8RrWWZMrH0mVqc3OELI8SryDyXaoA1AF2/wSLsVy1DUB jtHtAVNKhC3so6NBKpN0djWifzKd6F3hLrNNUpY13ZLuQZkmLpCmoKBHe+JtjTypxIbn RgS3lwRKxAJim0wnhZAdwpUtOaeEqC25QpeFQueMBYuzBUgLbkTyEfdoM9s4BbMz6oAz cwidpoZ/n8syT6+D+dxRN2jcBk8oPDxbOilLBw/bzw5FcduyVYO7DHgvj25ZeEjLd4oS 6UFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=fnKCWzfsLhUDes5N7fVeWtaOdNBeSAeIUUkTDIlO6Oo=; b=uXAB1n9A/YAc2uxoI9MZgVEuE4VtRTRhvmCvmx0zGLVgDxO/Rc2qHdyltJUretatbX NK/kd0u54G+AAOzw6TTx3DXQQISQTRHOrLA82z/LSOojTJDxQQ30WAGoeFqooMM+MD3f /SmjS6Y+JUFtQOv8d5ppQN0l1+BDGT3AP9RryvlmJwEIXbpsTY72wKjy1Gg6ynyqZMto ot2zkk3cjTC+H5ypwRJ7ldColBYSkgGw6RNdFVrY+6jH/UtsIoQ5AOvj5SvKJ0OPDggk LZq8mCQBk86L/UeJIWBJJVksiYiDzrD6FFYxQ9REy7P9IPswkoN7eQDGXwNIES5V9Kaj Fryg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Zhj7KkI3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h70si15169260pgc.670.2022.02.09.02.01.35; Wed, 09 Feb 2022 02:01:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Zhj7KkI3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1356990AbiBDE4f (ORCPT + 99 others); Thu, 3 Feb 2022 23:56:35 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:42790 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356982AbiBDE4d (ORCPT ); Thu, 3 Feb 2022 23:56:33 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 22E7EB82D13; Fri, 4 Feb 2022 04:56:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F08D9C004E1; Fri, 4 Feb 2022 04:56:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643950590; bh=2EmWtJLe29ETngENO8GwR9Ivq4C7OKoWb/fS1NF8720=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Zhj7KkI36PEB+9i0tF8Izc2xDXCgDa7iK/YTF4bNHhsEL1pw6cIJhWtM7we1pwHwL B1lGjQg6RNPg01qKSjfY7yLJMTBCHV+pkHwE7AANySlq9BmMdUbF87pzkFuQrv7v4v NMJdWdnkwwUe+v0Z+zXLn4Y5sdWOHcVeo1ITLX/PFLOuGzt0upQmkcf3KbPIaAEPHY 5RWdbC7r27/uDQHn6igTp59syjQHajS7LX70OifyGnowdjibgAMWZ5Z3wxu/Yr8thH FjY4lUshIvv4NM5aYiV0s+ivUrMYwe7kOS08LwQRMO/htC1stju/J+rpFVTnzP623L Il9zUO6AF48nw== Date: Fri, 4 Feb 2022 06:56:18 +0200 From: Mike Rapoport To: Martin Fernandez 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 Subject: Re: [PATCH v6 6/6] drivers/node: Show in sysfs node's crypto capabilities Message-ID: References: <20220203164328.203629-1-martin.fernandez@eclypsium.com> <20220203164328.203629-7-martin.fernandez@eclypsium.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220203164328.203629-7-martin.fernandez@eclypsium.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 03, 2022 at 01:43:28PM -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..0d1fd86c9faf > --- /dev/null > +++ b/Documentation/ABI/testing/sysfs-devices-node > @@ -0,0 +1,10 @@ > +What: /sys/devices/system/node/nodeX/crypto_capable > +Date: February 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 It didn't jump at me at previous postings, but other architectures won't necessary have EFI_MEMORY_CPU_CRYPTO marking crypto-capable memory. 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 architectures with value corresponds to EFI_MEMORY_CPU_CRYPTO. > + system memory is capable of being protected with the > + CPU’s memory cryptographic capabilities. It is 0 > + otherwise. > \ No newline at end of file > diff --git a/drivers/base/node.c b/drivers/base/node.c > index 87acc47e8951..dabaed997ecd 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 = 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[] = { > &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.