From patchwork Fri Dec 3 19:21:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Fernandez X-Patchwork-Id: 12655719 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 A8D8EC433EF for ; Fri, 3 Dec 2021 19:25:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B8B9F6B0082; Fri, 3 Dec 2021 14:23:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B39BD6B0083; Fri, 3 Dec 2021 14:23:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9DB9D6B0085; Fri, 3 Dec 2021 14:23:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0129.hostedemail.com [216.40.44.129]) by kanga.kvack.org (Postfix) with ESMTP id 8DD376B0082 for ; Fri, 3 Dec 2021 14:23:35 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 5470C7D3C8 for ; Fri, 3 Dec 2021 19:23:25 +0000 (UTC) X-FDA: 78877456770.21.EFE5F52 Received: from mail-qt1-f169.google.com (mail-qt1-f169.google.com [209.85.160.169]) by imf11.hostedemail.com (Postfix) with ESMTP id C3A6EF0000AF for ; Fri, 3 Dec 2021 19:23:24 +0000 (UTC) Received: by mail-qt1-f169.google.com with SMTP id 8so4379068qtx.5 for ; Fri, 03 Dec 2021 11:23:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eclypsium.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1/NfeKYIAhkUIAZJtgd6awxwNqUewAop8qMlhPdQIiw=; b=F+bvJUItKNdS/eTxqRFsYTDexgXI/WlDljElOv5rZ1FqdzNd6az6Wp/czLZQdFLjOD lHvZsZgt6E9hU7LI+B65d2ZU+suiM3hcuriSpE6E0LWvX8I0KAqfUtq/36ZvRlMgeIdK 3HfXFp5U+I6bslWX14LrDiOGVY7iEOjiF9LGHcOZib7XLql84nyPoykoceLbod734csg qd8vcajozXjJ+y83I7VW8TYvAzqBnrbf/+9VM93/n0R5Ds7xq1TTKlnKYm0bmwtUS7aj LOGUV6d0skEhoIPsXCilztMkKXECKdNDMqcLyrI/RJxormDDNBCcpxBVZXQqzCK3vEGH qUow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1/NfeKYIAhkUIAZJtgd6awxwNqUewAop8qMlhPdQIiw=; b=7IWyDMcVs2Zj1oCcG9MRoOx2tB5ziYmK0hzWxzutN6NAVf32jaFKLsicN2v9EGWpgg ldE0C0gqqqlRaBChPBcuI0cCyvBaBQ8FaG0SVNo885z/Lv/Qn2W09YUPO2Go/PSn6rlj W4I3D1as8Qat0D/Jo72SfjUGnO7eXiaUJQWLLX7etSQ3dfBZfPdcvXo1bJ1Ga8sD0sx6 V9wT1hRyVDzwU1XbNqlIOiv8Q7LwX7GK2cOSKemuclKHD4i/bB6vu4/4eBu/s14av0b2 qp2POPCIPzf3joafrG4Vc+q4UexodlIts0PB8bNdBDHEUtdtLeatnUqa9ktrlnH7kuDY TKtA== X-Gm-Message-State: AOAM533SkMzhHAr4aYhMwf/6YwaPBGJACc9MpleO3XGag5JMw/6lVGRo rA6q/f29LpZ5sGIc8OMWZyXi9A== X-Google-Smtp-Source: ABdhPJwnDlYpqgkf/Sf5zgNg//Uz5Zqh1xUeIEbLhDHGR1sxM6ZGnX3ghbkytQe24N4WA113II3Buw== X-Received: by 2002:a05:622a:1a04:: with SMTP id f4mr23050973qtb.476.1638559404100; Fri, 03 Dec 2021 11:23:24 -0800 (PST) Received: from localhost (7-153-16-190.fibertel.com.ar. [190.16.153.7]) by smtp.gmail.com with ESMTPSA id w10sm3099663qtk.90.2021.12.03.11.23.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 03 Dec 2021 11:23:23 -0800 (PST) From: Martin Fernandez To: linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-mm@kvack.org Cc: 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, rppt@kernel.org, akpm@linux-foundation.org, daniel.gutson@eclypsium.com, hughsient@gmail.com, alex.bazhaniuk@eclypsium.com, alison.schofield@intel.com, Martin Fernandez Subject: [PATCH v3 5/5] drivers/node: Show in sysfs node's crypto capabilities Date: Fri, 3 Dec 2021 16:21:48 -0300 Message-Id: <20211203192148.585399-6-martin.fernandez@eclypsium.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211203192148.585399-1-martin.fernandez@eclypsium.com> References: <20211203192148.585399-1-martin.fernandez@eclypsium.com> MIME-Version: 1.0 X-Stat-Signature: ckonmms6i4pc5jt5r1njyx94anbuooob Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=eclypsium.com header.s=google header.b=F+bvJUIt; spf=pass (imf11.hostedemail.com: domain of martin.fernandez@eclypsium.com designates 209.85.160.169 as permitted sender) smtp.mailfrom=martin.fernandez@eclypsium.com; dmarc=pass (policy=quarantine) header.from=eclypsium.com X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: C3A6EF0000AF X-HE-Tag: 1638559404-44639 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: 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 --- drivers/base/node.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/base/node.c b/drivers/base/node.c index b5a4ba18f9f9..67b0e2fa93b1 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 };