From patchwork Wed Nov 24 20:34:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Fernandez X-Patchwork-Id: 12637759 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 3E854C433F5 for ; Wed, 24 Nov 2021 20:35:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 947E96B0075; Wed, 24 Nov 2021 15:35:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8F7C86B0078; Wed, 24 Nov 2021 15:35:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7C17C6B007B; Wed, 24 Nov 2021 15:35:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0110.hostedemail.com [216.40.44.110]) by kanga.kvack.org (Postfix) with ESMTP id 6D97C6B0075 for ; Wed, 24 Nov 2021 15:35:36 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 2D6E518441CD9 for ; Wed, 24 Nov 2021 20:35:26 +0000 (UTC) X-FDA: 78844979052.25.75FF254 Received: from mail-ua1-f50.google.com (mail-ua1-f50.google.com [209.85.222.50]) by imf06.hostedemail.com (Postfix) with ESMTP id 95651801AB14 for ; Wed, 24 Nov 2021 20:35:24 +0000 (UTC) Received: by mail-ua1-f50.google.com with SMTP id p2so7686640uad.11 for ; Wed, 24 Nov 2021 12:35:25 -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:mime-version :content-transfer-encoding; bh=WWVyA9rAT+6UqFks6dTFD+XM7gB7oWrs5iYRikzxmOM=; b=WbV062ADcaZlzsRT9vd/XbsLpKxMq4laIhRub0+tanSWZYatiUAH62How4J6UgXjFg rPtzDYLvTqq9GK/SduFeKNyWsuzktleUUfnRTJjODk1n+yvHggF7Qj4leP5WZdUUeaom 9+jA155t5D0njV65l023h2ejKQv9MMI/S811FJfMvdw9yp4pMFSIynSNxXLGI8byI1i3 q7ANTDB+xo6j48lg3HW+/jcaIMntmdob9wRbyudnmEuukieMDHGUN6M773xj4RnpapEw 7QydoqlalZXaszL67EqBE7Aklucyr89rxb1ppnhx9no+8u+FShiGO6C6fiIGfK+v6XtG laRw== 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:mime-version :content-transfer-encoding; bh=WWVyA9rAT+6UqFks6dTFD+XM7gB7oWrs5iYRikzxmOM=; b=LAJrmiD9uI2PMOOiDBLhqqQ3yAGp1QLLqr330qTguOCpWrQMopMfg9gAe8707LivwF pHYnNNF71nhk3Kc7Xk72wzRmh8dgdR+PWI3LWtjrW0VjJ3Smd8sPpUIiTS4aWau3HDN4 6iCJ5hVfC/CZlQ8Nl7hwIg+FsQBRb5Xx8xt1Mk3z7Hcj541Z3x1xhuVBpJopjOqiCnMk wZ7caGlgFDCMMB1Z5kjp4RETB6JCnnDOVLWQFWmT34CKBiN9oCQ+1FcxK8w/f+4MBeY3 qZ41c8kPv5OI9oeP9bDb1lIZ0eAGvymHPG0MYjmIeuwjCbdU+hiqEPkjkofbGcPrYzsy CYCQ== X-Gm-Message-State: AOAM5332XlgQsI6aQAnx4OIvU/wZLnliNy8WA6WzE6HkReFCCWQQZ0Je jMPU5ZO+nIfScAV4g7ptuqtCBQ== X-Google-Smtp-Source: ABdhPJwzWzaQ9o75w/vYtE+DN8W9P9ajLA82XkQlYDx1uUehhPbBdyYs/x96QMBMEwaH/tHbyOvQ1g== X-Received: by 2002:a05:6102:497:: with SMTP id n23mr27360382vsa.36.1637786125024; Wed, 24 Nov 2021 12:35:25 -0800 (PST) Received: from localhost (7-153-16-190.fibertel.com.ar. [190.16.153.7]) by smtp.gmail.com with ESMTPSA id y22sm501975vkn.42.2021.11.24.12.35.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 24 Nov 2021 12:35:24 -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 0/5] x86: Show in sysfs if a memory node is able to do encryption Date: Wed, 24 Nov 2021 17:34:54 -0300 Message-Id: <20211124203459.4578-1-martin.fernandez@eclypsium.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Stat-Signature: w1bg5m4uu3oicmsw8ffyeijcar1xqdep X-Rspamd-Queue-Id: 95651801AB14 X-Rspamd-Server: rspam07 Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=eclypsium.com header.s=google header.b=WbV062AD; spf=pass (imf06.hostedemail.com: domain of martin.fernandez@eclypsium.com designates 209.85.222.50 as permitted sender) smtp.mailfrom=martin.fernandez@eclypsium.com; dmarc=pass (policy=quarantine) header.from=eclypsium.com X-HE-Tag: 1637786124-31031 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 for each node if every memory descriptor in that node has the EFI_MEMORY_CPU_CRYPTO attribute. fwupd project plans to use it as part of a check to see if the users have properly configured memory hardware encryption capabilities. It's planned to make it part of a specification that can be passed to people purchasing hardware. It's called Host Security ID: https://fwupd.github.io/libfwupdplugin/hsi.html This also can be useful in the future if NUMA decides to prioritize nodes that are able to do encryption. Changes since v1: Modify __e820__range_update to update the crypto capabilities of a range; now this function will change the crypto capability of a range if it's called with the same old_type and new_type. Rework efi_mark_e820_regions_as_crypto_capable based on this. Update do_add_efi_memmap to mark the regions as it creates them. Change the type of crypto_capable in e820_entry from bool to u8. Fix e820__update_table changes. Remove memblock_add_crypto_capable. Now you have to add the region and mark it then. Better place for crypto_capable in pglist_data. Martin Fernandez (5): mm/memblock: Tag memblocks with crypto capabilities mm/mmzone: Tag pg_data_t with crypto capabilities x86/e820: Tag e820_entry with crypto capabilities x86/efi: Tag e820_entries as crypto capable from EFI memmap drivers/node: Show in sysfs node's crypto capabilities Documentation/ABI/testing/sysfs-devices-node | 10 ++++ arch/x86/include/asm/e820/api.h | 1 + arch/x86/include/asm/e820/types.h | 1 + arch/x86/kernel/e820.c | 58 ++++++++++++++++---- arch/x86/platform/efi/efi.c | 25 +++++++++ drivers/base/node.c | 10 ++++ include/linux/memblock.h | 5 ++ include/linux/mmzone.h | 3 + mm/memblock.c | 49 +++++++++++++++++ mm/page_alloc.c | 1 + 10 files changed, 152 insertions(+), 11 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-devices-node