From patchwork Fri Apr 29 20:17:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Fernandez X-Patchwork-Id: 12832715 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 1BA0FC433F5 for ; Fri, 29 Apr 2022 20:17:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A55236B0073; Fri, 29 Apr 2022 16:17:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A04876B0074; Fri, 29 Apr 2022 16:17:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 87F016B0075; Fri, 29 Apr 2022 16:17:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 7A0506B0073 for ; Fri, 29 Apr 2022 16:17:52 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 54CC120A7E for ; Fri, 29 Apr 2022 20:17:52 +0000 (UTC) X-FDA: 79411027584.26.26A6865 Received: from mail-oa1-f52.google.com (mail-oa1-f52.google.com [209.85.160.52]) by imf29.hostedemail.com (Postfix) with ESMTP id 63A7512003F for ; Fri, 29 Apr 2022 20:17:48 +0000 (UTC) Received: by mail-oa1-f52.google.com with SMTP id 586e51a60fabf-d6e29fb3d7so9197865fac.7 for ; Fri, 29 Apr 2022 13:17:51 -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=cuoU1kSVf8VEBS5kxyG+ti9eeLYydPT4J1CXt5LwLhU=; b=Ca5CpkEdAGoDq4Rv1TW6+hSfJvX+bFxVgDxtp2Me/AhtkYKBKy7HDq9kO20qbFkCU/ oD5DMChdyFmU3n3DgPNgqCCNm7kr+52q5L9Hs/atSrY+4iP2qvhY/q2YA44Z2lv4tRjd v+qrNTH6cIBZ9Su9FBIIHdnb4f7y2STK1hcq14DBBiSA+1dXsvH5vR9SgVQv5TpKV515 6JTZ+l5RXQFB1Sq+ZHqkQs2djzOBE2pbg+fG2kXx5gpAKt3GP7C7mx5AJDZr8JYHBth7 TYSaK6qQeMoDiSKDnXRZLJRvuIFFmoFjKEfYjUbHtaeI2RjnrZIYZSMrNqd1ZoT95Xiv ckjw== 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=cuoU1kSVf8VEBS5kxyG+ti9eeLYydPT4J1CXt5LwLhU=; b=XClBbXJTRm26JIefBnrbOP/L3U/wqkLCdfptCmGnP2yDsxMz3fmRj/YGXht30NdTRy I5Lz6qcQf1ra7tv/4YYdyDSs2unotnV0B8NE6Lkm02TyDnEkf4+gycXbukL5EbVgEKP8 9nDMmEQWiQ2FOtUSmaAFU86l77N4tup71xwIwomkszMhKhW+pZo4tWy8cdhNNlNlmU1/ att3NtSor5MKtfNoRJ3BtbnvrTDkq8r/v2UEHnprwqexM+jqQDeQV30kHb/Agdnr6Bca rB0vbYfORhWTRyV03QH4E5eu6g9P0V/aZuTDg8fiaeEAE0LgsIgILeFmWdaGDLbiF0C8 CoIQ== X-Gm-Message-State: AOAM533m7Eb2KAM41dJN4Su6VS8NcGpg4s+Rh85Fam5TGY1ab292GRWb roOgTlC8ZqcTqH1FQLZAqcd3eA== X-Google-Smtp-Source: ABdhPJxIe/y2ZbNmKFx3Owc3D12ozpXuX/TsxcZP+iWHDA2M91qfr82Tlpg84wHwV/O7VsilCNZp4w== X-Received: by 2002:a05:6870:14d5:b0:ec:ab0e:d106 with SMTP id l21-20020a05687014d500b000ecab0ed106mr469524oab.65.1651263471218; Fri, 29 Apr 2022 13:17:51 -0700 (PDT) Received: from localhost ([181.97.174.128]) by smtp.gmail.com with ESMTPSA id w12-20020a4ad02c000000b0035eb4e5a6aesm1130791oor.4.2022.04.29.13.17.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 29 Apr 2022 13:17:50 -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 2/8] mm/mmzone: Tag pg_data_t with crypto capabilities Date: Fri, 29 Apr 2022 17:17:11 -0300 Message-Id: <20220429201717.1946178-3-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 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 63A7512003F X-Stat-Signature: hk57trsh77g4hs7iyasmdkoa5cb97bbz Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=eclypsium.com header.s=google header.b=Ca5CpkEd; dmarc=pass (policy=quarantine) header.from=eclypsium.com; spf=pass (imf29.hostedemail.com: domain of martin.fernandez@eclypsium.com designates 209.85.160.52 as permitted sender) smtp.mailfrom=martin.fernandez@eclypsium.com X-Rspam-User: X-HE-Tag: 1651263468-704907 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 to 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 46ffab808f03..89054af9e599 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -886,6 +886,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 0e42038382c1..a244151045b4 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7699,6 +7699,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); if (start_pfn != end_pfn) { pr_info("Initmem setup node %d [mem %#018Lx-%#018Lx]\n", nid,