Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp166904iob; Mon, 2 May 2022 16:06:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4MlYR9PNStMydvFv+s7A0CrGUWUPZEjCSG9vIYEUClJHxe75C1boISihpRGrXGoGP6aaO X-Received: by 2002:a17:902:ed82:b0:158:fef8:b501 with SMTP id e2-20020a170902ed8200b00158fef8b501mr13491519plj.47.1651532799337; Mon, 02 May 2022 16:06:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651532799; cv=none; d=google.com; s=arc-20160816; b=Zdc3HyM7/xg5u/lEOgJIWm3aGrCafuhYIfpIdZcd3XlThNE4PWCcyWix11y88UsHqz wTJWHg7RkVkhtphEdoOpLKNfolDCIKPkryIa0STSpuLsNZ+r1rY0yOquvgiGhg/ZDTaD L9GnuLG1acl3CYDo21ckZYlzlM79SCJ0jrHR+5tdmyUE8hj9vKAAZQDtgvRgKzQlmxAN /MsCY6JTTsq6w4pS2b4ihAvO04kS/3z5g2FP/FOUkZdpMlY7vmTvTCTnnTe6dzb/NohY XH7p662286kQAmLcNQRIvhS+KJH4/y7PEt81wfmmNT2e2hcbigVZ0gzg5wqQZRCOD3bP VHPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=OkG/F7+kBMNIWCowVtEazmyHhBwO2DxtbJbfhKP712A=; b=bk3XqXnp4oBH4glGj1Ow3ry/5fwQdtp7JcRPto9re/mcWp9gcbcCWG16z/zn3zSS+3 Vwbylx9mHM8c0R2rgYFMHFPf294ZyjUbtX5SYMNE9tCjNYNr4kZ9TQ2wvvp/P6MT7ana ynIcAU84N3S5DXb49KOHBSS+0/hehvpLx5e4PTLJTr8nW9KEc7qGJhMerC0IVuqjDlwM lbRbunhqsQuFkue3IJU6FpnpnCj8G/oSDg3OZLtu6ljRt2culp9KSf23NIjvJrdLC0wH DPFFF8iBt+rawIzy4jDpqbcP2PlDc/+GhLbfE0yratQa6nXIKxBne3vfM8ea+Nrug9so fklA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@eclypsium.com header.s=google header.b=CFVomb+9; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=eclypsium.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id s4-20020a170902ea0400b001568126be52si8997618plg.605.2022.05.02.16.06.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 16:06:39 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@eclypsium.com header.s=google header.b=CFVomb+9; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=eclypsium.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 70EEA2AE0F; Mon, 2 May 2022 16:06:25 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380679AbiD2UWD (ORCPT + 99 others); Fri, 29 Apr 2022 16:22:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380676AbiD2UV5 (ORCPT ); Fri, 29 Apr 2022 16:21:57 -0400 Received: from mail-ot1-x32f.google.com (mail-ot1-x32f.google.com [IPv6:2607:f8b0:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DB46D5E99 for ; Fri, 29 Apr 2022 13:18:38 -0700 (PDT) Received: by mail-ot1-x32f.google.com with SMTP id r14-20020a9d750e000000b00605446d683eso5840413otk.10 for ; Fri, 29 Apr 2022 13:18:38 -0700 (PDT) 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=OkG/F7+kBMNIWCowVtEazmyHhBwO2DxtbJbfhKP712A=; b=CFVomb+9tyTJtBjEhdpiH1zhwooGhEZao10gTFdxqakjE50a70JiLTBnTH7LkExN+V oc+UNf8vfz0q7LVdjvbwtCy8BnniQSsjA83H+fwEwh99U6UXRuClAcfUpV3bpAAc9umN hs0O4wqgUFbbSCgB/tJAtF1o+ndijINfhWVCNdR3bBValgZ8Z1AMvT3jzPCO56a+EUVj eQw67Azpa5Iv4+Ywhr9kjCjFBO3QXN4+XwHcJopDuXewZTbZD9+wbmGww65HIywNbytB K9o9k/DmPxRb4TRXsls4NQStEslTiFL+j1mwuEZbxJ6bjwWQEk+zv+NX6GgbMX2SInsf YuNQ== 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=OkG/F7+kBMNIWCowVtEazmyHhBwO2DxtbJbfhKP712A=; b=2Oy/nlKVjX53D+Ci1JbOlzRDRJm6HZJhBha9Cy3QlMxrSm87zde/vibYlkpzlKDtpP 2iGKgD7ycj5DbksuxvV/egwqryWjKmLRR0M+ebUq/+LxU3OoPtXJOSejCc2w9n7I/DsU NHTjBVToX4tMfznwtFWqhgwArhdu4zRdpUMLFk5xhrI30WN/zxGNwYG0XTZJVXCiezUe CFCk5iw2hVyOkPturXguB4Em4vnhn+guHaWm+qKMKjArNglomdD7JRth26ZJAhkQQVae uU3VHvh6kFWKLGn11ZW49b5V1cGEoTapa3kELSLfjDmt/LN/ORFlh8+9sOuO+82Embe/ IiUg== X-Gm-Message-State: AOAM530EkgduK0D87sW7IiTLRU4Q5dDDVBAjb57wwcwZnAk010eurPW7 AO4CtwwXgbXU/QE5H0SPTv7ESBqk4+cRBlsWzy9zLzpGerv5GShGFGoSjdyWHzndYjdyD9FAFBf 2sGujZN3lfPJta4vRQUrYRKSTMjutn+/kPNI9iafkbuwlieKPRWLx+UFqdH2U1a4H/9njY3naHo v+90VIfqmAuRz/AIEIyg4= X-Received: by 2002:a9d:37cb:0:b0:5cc:7a51:c984 with SMTP id x69-20020a9d37cb000000b005cc7a51c984mr409643otb.98.1651263517007; Fri, 29 Apr 2022 13:18:37 -0700 (PDT) Received: from localhost ([181.97.174.128]) by smtp.gmail.com with ESMTPSA id t13-20020a05683014cd00b0060603221245sm79060otq.21.2022.04.29.13.18.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 29 Apr 2022 13:18:36 -0700 (PDT) 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, keescook@chromium.org, Martin Fernandez Subject: [PATCH v8 8/8] drivers/node: Show in sysfs node's crypto capabilities Date: Fri, 29 Apr 2022 17:17:17 -0300 Message-Id: <20220429201717.1946178-9-martin.fernandez@eclypsium.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220429201717.1946178-1-martin.fernandez@eclypsium.com> References: <20220429201717.1946178-1-martin.fernandez@eclypsium.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 Show in each node in sysfs if its memory is able to do be encrypted by the CPU; on EFI systems: 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..0e95420bd7c5 --- /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 + 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. \ 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 = 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