From patchwork Thu Dec 16 19:22:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Fernandez X-Patchwork-Id: 12682399 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 4CC4FC433F5 for ; Thu, 16 Dec 2021 19:24:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4F6676B0078; Thu, 16 Dec 2021 14:23:24 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4A53E6B007B; Thu, 16 Dec 2021 14:23:24 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 346676B007D; Thu, 16 Dec 2021 14:23:24 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0078.hostedemail.com [216.40.44.78]) by kanga.kvack.org (Postfix) with ESMTP id 270E36B0078 for ; Thu, 16 Dec 2021 14:23:24 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id D254485302 for ; Thu, 16 Dec 2021 19:23:13 +0000 (UTC) X-FDA: 78924630666.18.D50648E Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) by imf21.hostedemail.com (Postfix) with ESMTP id 3EBBD1C001C for ; Thu, 16 Dec 2021 19:23:09 +0000 (UTC) Received: by mail-qt1-f179.google.com with SMTP id a1so238835qtx.11 for ; Thu, 16 Dec 2021 11:23:12 -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=gKWKpH+nxPg8FTF0yqETilAi8Ksx0wnwAAicnObD4Pkvy2oaxvFb4IqcJOs++fPSvy ESACwjxDnKF4klXUQa9pot4ULKZ7qfFaJrdnmCe4wHAcvlJSo2o/LiaK3foHmgsmxSwc Pp4WrVOEAqlW511Hmu7PS9WsE/mCjk21L9MkZI74o068gHiy0zThEMzCWgPdVPEqRBwl mbtj4eSoqMrnTPQ+d2AJU9+DiRuzojq4qZ4AS5TwKWcmHW/35MN943q5OiDcEa1Yva9l kE6ljMxbqRNRo1v2c4Eh+890xn2/iS7B3aCZeBuW0uv1l5xBjNUjocHIZ/4jDM0FuJua 9LZQ== 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=sXM2uX7trKJrhFQr4jkn3cJAdgbngq54mRn7wXuv4GXtS9a6CDOhdQzLzFr+RF6KuM 4LwON5VSQBK3mIpKw6nhktx9gT8S31aLLkwwq2W4aXLj+prCeXg2LTqIrniSnyOFPEZX fj7QnUMWyG8XDOs/s36rNfmpUvmbq/ncgxedb6Rg2vJGc9LfAqDf56849OvG1dcWR10u /I8NzI/HnxDMExxn+3cv2ITqNtBj6DK6hUtJC7Ik1+ReFFjRfsLr4j/dY+RTUJnd2byG 0u2w9fhw8JMPhe9rALAaA/Wex3Vz7T6dgCVFLI1jU3cfyx+jkAr3X3yo2T+0O6l66M4G 39mA== X-Gm-Message-State: AOAM5322lR2s9IEglr5IdYrucwL9t26LzaTfOvQ7GJQbNw8X0TinqMUk pskB08m0CzUilISUzcQcPqVf4bLds69LDg== X-Google-Smtp-Source: ABdhPJx/lt3729LoAXghiXnOSrEZVnKnhl8bkBsoYgbu9DkA3M5pwTUuUT8dD+zKtEwH4Y5GZeCRAA== X-Received: by 2002:ac8:5855:: with SMTP id h21mr18050821qth.8.1639682592147; Thu, 16 Dec 2021 11:23:12 -0800 (PST) Received: from localhost (7-153-16-190.fibertel.com.ar. [190.16.153.7]) by smtp.gmail.com with ESMTPSA id j16sm4962737qtx.92.2021.12.16.11.23.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Dec 2021 11:23:11 -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 v4 2/5] mm/mmzone: Tag pg_data_t with crypto capabilities Date: Thu, 16 Dec 2021 16:22:19 -0300 Message-Id: <20211216192222.127908-3-martin.fernandez@eclypsium.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211216192222.127908-1-martin.fernandez@eclypsium.com> References: <20211216192222.127908-1-martin.fernandez@eclypsium.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 3EBBD1C001C X-Stat-Signature: bo1y57m4zi4hr3ecx1rzcr1cwb6fkqap Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=eclypsium.com header.s=google header.b=gKWKpH+n; spf=pass (imf21.hostedemail.com: domain of martin.fernandez@eclypsium.com designates 209.85.160.179 as permitted sender) smtp.mailfrom=martin.fernandez@eclypsium.com; dmarc=pass (policy=quarantine) header.from=eclypsium.com X-HE-Tag: 1639682589-20514 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,