Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3451149pxb; Mon, 4 Apr 2022 17:23:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyN2mtyXGa3yn+n51FhDJwK351YYnxH9HfoWsQB5c90EoJxIH8MTQWOPKEjFu55tEhvFQ1M X-Received: by 2002:a17:90b:3b8c:b0:1c6:eb72:24b4 with SMTP id pc12-20020a17090b3b8c00b001c6eb7224b4mr904801pjb.171.1649118225226; Mon, 04 Apr 2022 17:23:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649118225; cv=none; d=google.com; s=arc-20160816; b=QqfVGtc0iVWHJIsw4K+z7/6GqvI4PTuuDbR/BF6NNwTgPlfPu0+adVmmWX/uWQ9Shi P9NJ4UKMP98d8NmZkfuue1ExZV8PtEk6pIKLiqDcq+EBJfpfj6vBfJ+spaHf6ZRoliGV wdhxJ0yAEOAnO3xBW713kwrqWC1EClhlkzUqpdmsDBXm/oVtlNkcz52Eaknwvux4qjg4 JoswEWujQpXfcmGZ2PCpUM88VdHQky8eWy2lGXxYDhujlbZxGaZj6RdVWRtZJshqDDkv d5yvNClZ7UdcTsYzT84NNGqHr7DYiR0kDOV8wKz0ppNho9zuI2DdPXOLvnviL/fqjSd+ sz4g== 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=ULvPL8b3pzB0ss2NaG6PwbzWGLl8O/3NmlbwBUKzbBM=; b=hxj7z/N2xC5TC62qT0sh0TUJme5LpNg6yhobEOJd8vKSko4IBuIUvV0gj1D/XceCpf YCTKd4+D6PhDbOpVCZqcZQ27/lP2I6lkrHVJ47n60HJqT7vr5+u1HdnM83w8S1cKV7A5 jJd0A0p2x8XYywFLrxN5SGTeXAQxivZfo6yRPKRe7Ihl1mpD0c9mPlHHndJe+jaQrmMe DYOC9jsIarwzVVt0NLwAUtywrEhuCMl/Mwqva3ovEZUJThYXPatHDYDFLhOpHZomaxeT qlzj0CaVqTw/1t+EDx1mlFQmWhFf8xFNO+ojlnCe7Y3Rgk1SRZBpATOAnnKIl7E3Q9vk J7Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=iIc5o9xz; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id h2-20020a170902f54200b00153f163b3d3si12211206plf.26.2022.04.04.17.23.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 17:23:45 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=iIc5o9xz; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 03DE67C79C; Mon, 4 Apr 2022 16:48:14 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347365AbiDDVzb (ORCPT + 99 others); Mon, 4 Apr 2022 17:55:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379261AbiDDQvu (ORCPT ); Mon, 4 Apr 2022 12:51:50 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B921C2F02A; Mon, 4 Apr 2022 09:49:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649090993; x=1680626993; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZWPEU1oj4JJoBauvs1J6o7QQGEbanEWmmGNZBVN//bw=; b=iIc5o9xzEfwnqkNSF9NglwHnwdYEjMj2Ykyaf0Q0ot2XsHRjtM273Oyj qwgqo1eu22tMOxb6SC1p1zNxy/fRK8I/23MNpUbqQ+GB9O7lC/uzEdXBx yDKZ/A1coWTIXtAMm0e9iNfDl1PG3Qwi6E48z71ENPRvN/B+upO42q/AD PoKce3QkoGGzrWZG9BackwaHZAXFTVy0cUj3k5r7JSHZijb1rqDdcRgq7 iSPPTrWotyiKynrkL2HOkfkBJRp+Y+lLyx21J6ogoWoe5WikISpKagBlY JHO5XfllJmqA43+/kfuhb/SMZ9TNrox5dPNS7Hy9B0pDaRZFDE2q71K0+ g==; X-IronPort-AV: E=McAfee;i="6200,9189,10307"; a="259390778" X-IronPort-AV: E=Sophos;i="5.90,234,1643702400"; d="scan'208";a="259390778" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Apr 2022 09:49:51 -0700 X-IronPort-AV: E=Sophos;i="5.90,234,1643702400"; d="scan'208";a="523105168" Received: from rchatre-ws.ostc.intel.com ([10.54.69.144]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Apr 2022 09:49:50 -0700 From: Reinette Chatre To: dave.hansen@linux.intel.com, jarkko@kernel.org, tglx@linutronix.de, bp@alien8.de, luto@kernel.org, mingo@redhat.com, linux-sgx@vger.kernel.org, x86@kernel.org Cc: seanjc@google.com, kai.huang@intel.com, cathy.zhang@intel.com, cedric.xing@intel.com, haitao.huang@intel.com, mark.shanahan@intel.com, hpa@zytor.com, linux-kernel@vger.kernel.org Subject: [PATCH V3 07/30] x86/sgx: Rename sgx_encl_ewb_cpumask() as sgx_encl_cpumask() Date: Mon, 4 Apr 2022 09:49:15 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 sgx_encl_ewb_cpumask() is no longer unique to the reclaimer where it is used during the EWB ENCLS leaf function when EPC pages are written out to main memory and sgx_encl_ewb_cpumask() is used to learn which CPUs might have executed the enclave to ensure that TLBs are cleared. Upcoming SGX2 enabling will use sgx_encl_ewb_cpumask() during the EMODPR and EMODT ENCLS leaf functions that make changes to enclave pages. The function is needed for the same reason it is used now: to learn which CPUs might have executed the enclave to ensure that TLBs no longer point to the changed pages. Rename sgx_encl_ewb_cpumask() to sgx_encl_cpumask() to reflect the broader usage. Signed-off-by: Reinette Chatre --- No changes since V2 Changes since V1: - New patch split from original "x86/sgx: Use more generic name for enclave cpumask function" (Jarkko). arch/x86/kernel/cpu/sgx/encl.c | 6 +++--- arch/x86/kernel/cpu/sgx/encl.h | 2 +- arch/x86/kernel/cpu/sgx/main.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/x86/kernel/cpu/sgx/encl.c b/arch/x86/kernel/cpu/sgx/encl.c index c6525eba74e8..8de9bebc4d81 100644 --- a/arch/x86/kernel/cpu/sgx/encl.c +++ b/arch/x86/kernel/cpu/sgx/encl.c @@ -614,7 +614,7 @@ int sgx_encl_mm_add(struct sgx_encl *encl, struct mm_struct *mm) } /** - * sgx_encl_ewb_cpumask() - Query which CPUs might be accessing the enclave + * sgx_encl_cpumask() - Query which CPUs might be accessing the enclave * @encl: the enclave * * Some SGX functions require that no cached linear-to-physical address @@ -639,7 +639,7 @@ int sgx_encl_mm_add(struct sgx_encl *encl, struct mm_struct *mm) * The following flow is used to support SGX functions that require that * no cached linear-to-physical address mappings are present: * 1) Execute ENCLS[ETRACK] to initiate hardware tracking. - * 2) Use this function (sgx_encl_ewb_cpumask()) to query which CPUs might be + * 2) Use this function (sgx_encl_cpumask()) to query which CPUs might be * accessing the enclave. * 3) Send IPI to identified CPUs, kicking them out of the enclave and * thus flushing all locally cached linear-to-physical address mappings. @@ -656,7 +656,7 @@ int sgx_encl_mm_add(struct sgx_encl *encl, struct mm_struct *mm) * * Return: cpumask of CPUs that might be accessing @encl */ -const cpumask_t *sgx_encl_ewb_cpumask(struct sgx_encl *encl) +const cpumask_t *sgx_encl_cpumask(struct sgx_encl *encl) { cpumask_t *cpumask = &encl->cpumask; struct sgx_encl_mm *encl_mm; diff --git a/arch/x86/kernel/cpu/sgx/encl.h b/arch/x86/kernel/cpu/sgx/encl.h index d2acb4debde5..e59c2cbf71e2 100644 --- a/arch/x86/kernel/cpu/sgx/encl.h +++ b/arch/x86/kernel/cpu/sgx/encl.h @@ -105,7 +105,7 @@ int sgx_encl_may_map(struct sgx_encl *encl, unsigned long start, void sgx_encl_release(struct kref *ref); int sgx_encl_mm_add(struct sgx_encl *encl, struct mm_struct *mm); -const cpumask_t *sgx_encl_ewb_cpumask(struct sgx_encl *encl); +const cpumask_t *sgx_encl_cpumask(struct sgx_encl *encl); int sgx_encl_get_backing(struct sgx_encl *encl, unsigned long page_index, struct sgx_backing *backing); void sgx_encl_put_backing(struct sgx_backing *backing, bool do_write); diff --git a/arch/x86/kernel/cpu/sgx/main.c b/arch/x86/kernel/cpu/sgx/main.c index 2de85f459492..fa33922879bf 100644 --- a/arch/x86/kernel/cpu/sgx/main.c +++ b/arch/x86/kernel/cpu/sgx/main.c @@ -249,7 +249,7 @@ static void sgx_encl_ewb(struct sgx_epc_page *epc_page, * miss cpus that entered the enclave between * generating the mask and incrementing epoch. */ - on_each_cpu_mask(sgx_encl_ewb_cpumask(encl), + on_each_cpu_mask(sgx_encl_cpumask(encl), sgx_ipi_cb, NULL, 1); ret = __sgx_encl_ewb(epc_page, va_slot, backing); } -- 2.25.1