From patchwork Wed Nov 24 20:34:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Martin Fernandez X-Patchwork-Id: 12637781 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 D36D4C433EF for ; Wed, 24 Nov 2021 20:39:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2DF206B0081; Wed, 24 Nov 2021 15:36:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 266E96B0082; Wed, 24 Nov 2021 15:36:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0BAC96B0083; Wed, 24 Nov 2021 15:36:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0063.hostedemail.com [216.40.44.63]) by kanga.kvack.org (Postfix) with ESMTP id ED4C06B0081 for ; Wed, 24 Nov 2021 15:36:38 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id B527086E7F for ; Wed, 24 Nov 2021 20:36:28 +0000 (UTC) X-FDA: 78844981656.16.AB38BFF Received: from mail-ua1-f45.google.com (mail-ua1-f45.google.com [209.85.222.45]) by imf12.hostedemail.com (Postfix) with ESMTP id 60C0C10003D7 for ; Wed, 24 Nov 2021 20:36:28 +0000 (UTC) Received: by mail-ua1-f45.google.com with SMTP id j14so7695071uan.10 for ; Wed, 24 Nov 2021 12:36:28 -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=a0bmQaOoWIKx1kavxDMlDEybQyi0u9rYz3ceRUr9+6k=; b=GXpulxUj/NTga06qjAE3HAjBWugm4oEzvW5KpfiAJvK6BjAZFCdV0CgjcB63DmEMHE E+dopXfEybcehbx/aOprHRE+ktamblL+WWYge6sP3tdkSKbK8Do14ykXWh5Ra+OURbwW KMGSRf0D8RIbTUOeEUjIoDMnt5YaOfEC6aXa2XwnWaLgujtezW0W4ltSpQ9OP1Rpzm2j LeT3Y7HCpscglgNU60UIZisIp5NqmxxLaJDBDNe/B0g85VFCCqN5238L4jhygqH5VZEh 6QEOyMGoCLfB39NSPrMeFGEevI07bksUFAORTDZ+fO5iBhHuCP+/dB+329koc2bR35C2 k+ug== 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=a0bmQaOoWIKx1kavxDMlDEybQyi0u9rYz3ceRUr9+6k=; b=lBEC/YmFwxYI1/Wj5Gje0sI8CLtVtQQPfZlQo/FOcScacoxD1ghqNGCNYzOev+l4Fc AfTKaPCdhopupirFjxyRB7JTbgG5DgUvKU1+pvt3KPedUo2W4wuRZE6JE7BdEzToiFdP 7oUd30NsR1kHj2ffcLxsTOhaai4Zkf40TZkwP1Zn9fq9oByZxnO6OwYZrKHWV0FuLmFe 73kp5UQEqhWUkfLsnehYVhhU65Kr548x4X42lIdaTwImPAhFfXiqkI/9Y/X+eBXTMHNv csymymxW372649nOOJUVD9bMVvXe0gGcL7OM5gN0eQte30NnaUWtCywthkwOgz9ogpC9 sn2g== X-Gm-Message-State: AOAM532X/QlrUtpFlqkFWMXsDPqDDR7bsvfmcYrjr5JDbG6inXlO+Q1M Uu/m3s0OBzjKD1MLAo9tfu8l7A== X-Google-Smtp-Source: ABdhPJwnwownuw1qWugehWIJfRfCAs5vic5yWR6x7sRWk1I0s28pWe14YmN8T1VHJJPqK28xF5g/7w== X-Received: by 2002:a9f:3e43:: with SMTP id c3mr15227660uaj.29.1637786187676; Wed, 24 Nov 2021 12:36:27 -0800 (PST) Received: from localhost (7-153-16-190.fibertel.com.ar. [190.16.153.7]) by smtp.gmail.com with ESMTPSA id q20sm616962uae.17.2021.11.24.12.36.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 24 Nov 2021 12:36:27 -0800 (PST) From: Martin Fernandez To: 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, x86@kernel.org, hpa@zytor.com, dave.hansen@linux.intel.com, luto@kernel.org, peterz@infradead.org, ardb@kernel.org, dvhart@infradead.org, andy@infradead.org, gregkh@linuxfoundation.org, rafael@kernel.org, daniel.gutson@eclypsium.com, hughsient@gmail.com, alison.schofield@intel.com, Martin Fernandez Subject: [PATCH v2 5/5] drivers/node: Show in sysfs node's crypto capabilities Date: Wed, 24 Nov 2021 17:34:59 -0300 Message-Id: <20211124203459.4578-6-martin.fernandez@eclypsium.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211124203459.4578-1-martin.fernandez@eclypsium.com> References: <20211124203459.4578-1-martin.fernandez@eclypsium.com> MIME-Version: 1.0 X-Stat-Signature: ncn8fz6enzrmysegcrud8cb3iuspru59 X-Rspamd-Queue-Id: 60C0C10003D7 X-Rspamd-Server: rspam07 Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=eclypsium.com header.s=google header.b=GXpulxUj; spf=pass (imf12.hostedemail.com: domain of martin.fernandez@eclypsium.com designates 209.85.222.45 as permitted sender) smtp.mailfrom=martin.fernandez@eclypsium.com; dmarc=pass (policy=quarantine) header.from=eclypsium.com X-HE-Tag: 1637786188-276430 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 --- 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..ab46fdd3f6a8 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-devices-node @@ -0,0 +1,10 @@ +What: /sys/devices/system/node/nodeX/crypto_capable +Date: October 2021 +Contact: Martin Fernandez +Users: fwupd +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’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 c56d34f8158f..4e6ef86f4523 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 };