From patchwork Fri Dec 3 19:21:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Fernandez X-Patchwork-Id: 12655713 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 A7F7EC433EF for ; Fri, 3 Dec 2021 19:24:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 941376B007E; Fri, 3 Dec 2021 14:23:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8EF876B0080; Fri, 3 Dec 2021 14:23:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7B8A96B0081; Fri, 3 Dec 2021 14:23:14 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0238.hostedemail.com [216.40.44.238]) by kanga.kvack.org (Postfix) with ESMTP id 6F10C6B007E for ; Fri, 3 Dec 2021 14:23:14 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 374598BEF9 for ; Fri, 3 Dec 2021 19:23:04 +0000 (UTC) X-FDA: 78877455888.27.0BE6A82 Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.169]) by imf21.hostedemail.com (Postfix) with ESMTP id 75BF0D0369DF for ; Fri, 3 Dec 2021 19:23:03 +0000 (UTC) Received: by mail-qk1-f169.google.com with SMTP id m186so4522644qkb.4 for ; Fri, 03 Dec 2021 11:23:03 -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=fAQwT03q8c+l0eyOEhJV/8Xp6eHvuAVKGl9g48A9iCY=; b=clFzSf9e3VT0Aifw8+wLenzhgUYBx9WPOIolV7/p5j9CmQALr33loOrBWvrnbgX5kw gYQAroelKHXjXVPxXLwVjXSpY8Xb70qAMvtSKow0C+C6fV08Uhon15VCTdXILVf2vZ4D NVwx6dK93jK25ZHTJ05OOAsvJOz7CJxY8Fs8A6xxjK1nESWJv+Ut7kjjVks1NigrRwK1 0s5yqUteIX8yqLWbfye0UTqaoyUsnMxKH65lBEDC0MoPPTlweWvW8vVZhN6UYrAU9+LN oH9rrGT20g5jswEzfFky+6I8sXvGhTtJ6N7KNSURQl/uv+ItgdGPQPCmWAM8h7otPH+6 jESA== 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=fAQwT03q8c+l0eyOEhJV/8Xp6eHvuAVKGl9g48A9iCY=; b=DfSv1vg/4XkxAaluEqhO3l3uSd6ytNGoAWV34bZcOlCIEOIHX/jYoQML2dihhJdxix jhNZf6B8QjvMszF2r32joF2v0itnCrrzdfewyXZO7vh+tR6ofq+IJZn4fD3dlxUinrpw 7OoxEj/1LnY7lIksm8vG2rpQpiYLfTIhRLBYdM5DXQVlVHueYlA+8Ja28AswXvUCyiry OF63hm1+UCD7WnSIj7bxfCv+38bpXS9tXlbG4QtvMmuJMB8qaKKmdRTXA2jJzD0JxZSl 35wrs/lpKKCqCZHFI+ZqXofH98DhWPghqEFdtjS9Obw++gLWOX3AXbd72mLOTX7FI1Cp nQtA== X-Gm-Message-State: AOAM532BX8vD01XlxqeCZJ5Cfy8xNJ0TdV3WD2Q9TkoErvaw2Da8m992 C2Z54mbXnNouyzuaNe5wIV+g5A== X-Google-Smtp-Source: ABdhPJySs0z8IxWpEZ5hyhMpFmb4t34bvvvcqFTLmUzenxDHobzGf8Am899FFne1ypwydPqvXoOcjg== X-Received: by 2002:a05:620a:2808:: with SMTP id f8mr19389014qkp.214.1638559382126; Fri, 03 Dec 2021 11:23:02 -0800 (PST) Received: from localhost (7-153-16-190.fibertel.com.ar. [190.16.153.7]) by smtp.gmail.com with ESMTPSA id d11sm2729269qtj.4.2021.12.03.11.22.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 03 Dec 2021 11:23:01 -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 2/5] mm/mmzone: Tag pg_data_t with crypto capabilities Date: Fri, 3 Dec 2021 16:21:45 -0300 Message-Id: <20211203192148.585399-3-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-Rspamd-Queue-Id: 75BF0D0369DF Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=eclypsium.com header.s=google header.b=clFzSf9e; spf=pass (imf21.hostedemail.com: domain of martin.fernandez@eclypsium.com designates 209.85.222.169 as permitted sender) smtp.mailfrom=martin.fernandez@eclypsium.com; dmarc=pass (policy=quarantine) header.from=eclypsium.com X-Rspamd-Server: rspam04 X-Stat-Signature: k7cre5imhymkyh6mt4yaxb4p9fjeagkw X-HE-Tag: 1638559383-865853 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 58e744b78c2c..1e4f76a19c62 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -870,6 +870,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 c5952749ad40..8bcbd6fa0089 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7592,6 +7592,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,