Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp165117imw; Mon, 4 Jul 2022 07:04:45 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tW7+oj5UV94Etxf0rZV3+KWA0YWr716Z5oN2QhAnbMJKseyZCULLX3qm4eQMXs3w2cQs47 X-Received: by 2002:a17:906:29d:b0:6f0:18d8:7be0 with SMTP id 29-20020a170906029d00b006f018d87be0mr27412713ejf.561.1656943485421; Mon, 04 Jul 2022 07:04:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656943485; cv=none; d=google.com; s=arc-20160816; b=nPswNc23I+CZqDENjVqBagPXvlw/MmTdww8uJ5LV7mim4mMzs3X6nBI/g/i/wfdryY hMu5aE42ESNbTF/hJ3wSP0dD6FJKYFmumtwSGABlSk+y35tVreKqzf+lazq9y6qA5Agn Ucjn726U2gPqsRfRt0dTQmn3d7tLIJjtPtO1UsUBpx2/AjRiQUv4fv+bddBKAj3i2htM YnEGXr8S5AjzO/18Z9PuiKB0t1S2LlHrOl8FWP0YDVMPaA8iXagh/yoYTGennp7xfJ49 /iahlMqJSJXLZoEGri/hXBMtdzPq847HnKrLmlaVAboKE0GxEbHovJiqIeFeNQX1vKsH j0gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=k/5GR/KX7teTknQriuvUZb8IVKxvs7e03/RMVm9+BQI=; b=KXXtF/HPlSOpJOoQHVpP9pUnJ0vxvRlaCh0JrWPoJLkAeSu4eDmb3Q/dzuS0kzD2Yt vO5lSSiXaEGAUb2pJfu9PTyz6bSVsiOwe1wxqOBGDXZH8IwsjjXp8QvpdokngxL/HkuU zEd8ZWf8ij9qS1gaiGrOCgyj2FNm3FHLkpG7DKWG/TJBjk7ly/By9ao7bVO0RuFLYRjz X8ZwdJ03DyrGvZe28BDjqpM+8LRHNk4gU6veKonon7o26AbR5PkbViZVXAge9+V/Yvi7 Kk8cHT1cXIjIuohVKznVV1InvJSwYxZIoUv517CVVb0Xn7DvCHDnjz/ykt9vhdJPz0go MI9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@eclypsium.com header.s=google header.b=GLaHhFyS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=eclypsium.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fb19-20020a1709073a1300b007101a8a5b89si8439669ejc.943.2022.07.04.07.04.18; Mon, 04 Jul 2022 07:04:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@eclypsium.com header.s=google header.b=GLaHhFyS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=eclypsium.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234673AbiGDN7L (ORCPT + 99 others); Mon, 4 Jul 2022 09:59:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234526AbiGDN7E (ORCPT ); Mon, 4 Jul 2022 09:59:04 -0400 Received: from mail-vs1-xe2a.google.com (mail-vs1-xe2a.google.com [IPv6:2607:f8b0:4864:20::e2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 399A0DEE8 for ; Mon, 4 Jul 2022 06:59:01 -0700 (PDT) Received: by mail-vs1-xe2a.google.com with SMTP id j6so9137801vsi.0 for ; Mon, 04 Jul 2022 06:59:01 -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=k/5GR/KX7teTknQriuvUZb8IVKxvs7e03/RMVm9+BQI=; b=GLaHhFySQ9gOLZrKKeJvwwMHsWCWM3q5PzByQA9CXY12npsM3Osv/S1W71q725TU13 H5NgkCeE2bqltfg5cRYAP4bll17byyhwEuYP2oQvTfgEY8qwK7/IU098iZXMhug19osr ZVHqSxQ9/UM+9k0N0DjOiIDLRQUJrp4S0oIyi3G8Ex4p6qAXsybjVeMBv4Dbh9566/GV A83eDRvuXPThAtIIG2X0ViUECgwh1c0F7AZNRLFNCik5k/6jdzoHzuKZiGlJ6RaoZy2B YaEZhCfWYPzaUbYiNoV+pDcaYkqv3AlFGu8AyC1alTFvHvP1W/TLvNOxjNOHCeYvPNML BAOw== 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=k/5GR/KX7teTknQriuvUZb8IVKxvs7e03/RMVm9+BQI=; b=CSGtjfN5PhrhrGDy5Ao6s4/EXFx0uV9J5Vs+rbFmlGezAdgX1UKT+CJ0D9If3uHje6 gjoZUySYk2l1dt1bCIIgddpnaQmIo/LK/lwRkcRt5pZHiZL3WMXMWZH5XVOtMgc7Ql5D T04vf4DVpZCpQcPECYIYvFNnA7rzCigTwgP9XsHR61FnRM6+/byCI1LnWoxa/diKflWZ aAVGWRlQbVBIA6klZqllqqiIf2kxITeVXkgE/DD6qGQkLFn8EPIGvk4p/betQDtnyW/n UmJn0n93A36o/ZVApkf6xdpCIfF2/0njdt8AyrsDOfESakJcrKH/zShxbd2siuNVqij0 vSUw== X-Gm-Message-State: AJIora/KY8Cv81rAPhrSoNBC/KEKL4gnyfWwMVEh8bmQGEYMAjpJ/mK1 mQ4Y63hk/+Hroh30iPZY1vPMSzhFIaHTUDtvEnPYwam8ajeip/jkLRu779XKaXiFWmIIriaJNY5 uKmNMsvGbxfZlN/aPQ266v1CWiLUxZuhKNf/W106XIwf14qBa9XAUgG4C6wGLUz2TAgGJXkjhZO yp8W1UGIv+jhl8w22OWRU= X-Received: by 2002:a67:ac0d:0:b0:356:a09d:b063 with SMTP id v13-20020a67ac0d000000b00356a09db063mr6746100vse.69.1656943140208; Mon, 04 Jul 2022 06:59:00 -0700 (PDT) Received: from localhost ([181.97.174.128]) by smtp.gmail.com with ESMTPSA id p2-20020ab01ec2000000b003828ebf6b49sm722929uak.4.2022.07.04.06.58.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 04 Jul 2022 06:58:59 -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, kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.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 v9 2/9] mm/mmzone: Tag pg_data_t with crypto capabilities Date: Mon, 4 Jul 2022 10:58:26 -0300 Message-Id: <20220704135833.1496303-3-martin.fernandez@eclypsium.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220704135833.1496303-1-martin.fernandez@eclypsium.com> References: <20220704135833.1496303-1-martin.fernandez@eclypsium.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 aab70355d64f..6fd4785f1d05 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -883,6 +883,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 e008a3df0485..147437329ac7 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7729,6 +7729,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, -- 2.30.2