From patchwork Wed Nov 24 20:34:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Fernandez X-Patchwork-Id: 12637763 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 F044EC433EF for ; Wed, 24 Nov 2021 20:36:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 06E046B007B; Wed, 24 Nov 2021 15:36:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F392A6B007D; Wed, 24 Nov 2021 15:36:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D8CA16B007E; Wed, 24 Nov 2021 15:36:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0223.hostedemail.com [216.40.44.223]) by kanga.kvack.org (Postfix) with ESMTP id C802B6B007B for ; Wed, 24 Nov 2021 15:36:02 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 8801882D81 for ; Wed, 24 Nov 2021 20:35:52 +0000 (UTC) X-FDA: 78844980186.21.99239CA Received: from mail-ua1-f41.google.com (mail-ua1-f41.google.com [209.85.222.41]) by imf07.hostedemail.com (Postfix) with ESMTP id D7E7B10002D8 for ; Wed, 24 Nov 2021 20:35:48 +0000 (UTC) Received: by mail-ua1-f41.google.com with SMTP id l24so7798971uak.2 for ; Wed, 24 Nov 2021 12:35:51 -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=kKeQO5HIM6y0ycfWZfjEXt5cWodQspmVc0qLUoNycjw=; b=Cfr3vRCO2qArtB2zY1WwM4EzEzL0sTk9uNXAVtwdYprZbC1fHLFE1949XZ5h3knzR1 3gV1+bojf02rCANR3bR81MWu48gca6FIIuY/geCf9sTHgQpoK1i+JzmA/vQQcYGExkjC 1mCYw2rIQTUAmhtzD6NPGmIq2ij6ApLZUjcLPO/f8pK21guuKLwunwJ3bJLuVWJXUM2/ 7UN4tVR3zfc5npfEMmqKo040g+a2XChbbAGs8NA7MubO8qY+30I4K1bWbzV3PY1EAYEN mtNRlyvLk1Sq9p277fBJwfJYbw5CX2WUXHtlHT7vRvSJrMFL+r3Sy/smrxbV/ZXAv16A VNww== 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=kKeQO5HIM6y0ycfWZfjEXt5cWodQspmVc0qLUoNycjw=; b=eRtDEvliI69lifba0t6fccA6Yk0NLeVarE3SLDrB/IB8ZIfggamJzi/gV6/cIYV+sL Z2DiZl+tV51Z3btRtwVwEvs/PEQNLtfnBngKsoumJBeG9shpIQWxBCodWXlsuGbqH/31 HrD9B9YeECEmyagbtdLkFVTgNoYxdCkrAXrdAOL4ahdP+lNZnqPha9ifS9nr/8ezt5Wt VjxhbSz25ah378RKS/dXt+je+0IvaRDFfu7KjM0GpZwUOMBKO9+eBjntBOMoWfj5XiZ1 7EDIWFrILv2q8GSNx4NlFHd8wF87XuZeyojOQckgboGG38+uz2EBVruILQT1vVbi333H M90w== X-Gm-Message-State: AOAM532ftz2kYn4crNoHh4uAICMOaLPk9WLC9D/LheKTWIJ9Ddv+Zzwj EVD9JdDNH3T0wOQBW6T8PjoWrQ== X-Google-Smtp-Source: ABdhPJy27G14bvEgPOr12Bgpg6q24+2aiosznoukbinhwt9NvM1t/b3YMAF/NwheI6DeiRVcv9hO4A== X-Received: by 2002:a67:d31c:: with SMTP id a28mr29229200vsj.20.1637786151401; Wed, 24 Nov 2021 12:35:51 -0800 (PST) Received: from localhost (7-153-16-190.fibertel.com.ar. [190.16.153.7]) by smtp.gmail.com with ESMTPSA id g187sm668093vsc.10.2021.11.24.12.35.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 24 Nov 2021 12:35:51 -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 2/5] mm/mmzone: Tag pg_data_t with crypto capabilities Date: Wed, 24 Nov 2021 17:34:56 -0300 Message-Id: <20211124203459.4578-3-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-Rspamd-Queue-Id: D7E7B10002D8 X-Stat-Signature: 1p3qsu78oczi6sk7jn65t4mdzjfbnha4 Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=eclypsium.com header.s=google header.b=Cfr3vRCO; dmarc=pass (policy=quarantine) header.from=eclypsium.com; spf=pass (imf07.hostedemail.com: domain of martin.fernandez@eclypsium.com designates 209.85.222.41 as permitted sender) smtp.mailfrom=martin.fernandez@eclypsium.com X-Rspamd-Server: rspam02 X-HE-Tag: 1637786148-660107 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: Add a new member in the pg_data_t struct tell whether the node corresponding to that pg_data_t is able to do hardware memory encryption. This will be read from sysfs. Signed-off-by: Martin Fernandez --- include/linux/mmzone.h | 3 +++ mm/page_alloc.c | 1 + 2 files changed, 4 insertions(+) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 6a1d79d84675..e437d7ebd8cc 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -855,6 +855,9 @@ typedef struct pglist_data { struct task_struct *kcompactd; bool proactive_compact_trigger; #endif + + bool crypto_capable; + /* * This is a per-node reserve of pages that are not available * to userspace allocations. diff --git a/mm/page_alloc.c b/mm/page_alloc.c index b37435c274cf..a19d95bb5c0f 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7575,6 +7575,7 @@ static void __init free_area_init_node(int nid) pgdat->node_id = nid; pgdat->node_start_pfn = start_pfn; pgdat->per_cpu_nodestats = NULL; + pgdat->crypto_capable = memblock_node_is_crypto_capable(nid); pr_info("Initmem setup node %d [mem %#018Lx-%#018Lx]\n", nid, (u64)start_pfn << PAGE_SHIFT,