Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6257949iob; Tue, 10 May 2022 14:10:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJza/P1fooZMnScS3r59GuTLXM1N7zqE79tU/lcToTkUzRSmOWwpsXgR7gqKPShttYkd0EGU X-Received: by 2002:a17:906:414f:b0:6f3:e324:4aae with SMTP id l15-20020a170906414f00b006f3e3244aaemr22470263ejk.727.1652217013097; Tue, 10 May 2022 14:10:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652217013; cv=none; d=google.com; s=arc-20160816; b=X/FWj4EWx5hGCanFa8iaFy+AGCWbuDXALSaJgzbGICVyAiGS5yT1J9yCM0bW8/2MuG yMxPEBmzqkNca2W190VLocHSQwy/ChzpQijfGAw7Ml1xfUNwaRO1R56O56ZDJZ3dae3U rtvhKycxM19S29uIRH6GAuipjJ5mTkuDdUOZxnTA+uEuP1nZAahN2thHLcbC4RQy1xBs RheqcfjK7Ew+e99VOV3H6rQ1JG09Ly49q84Yyy4Qwsd/KwcUrijeWmE7TA0CX4Kn0nJR 7jeqN9zi83OKpBCxi4RSesXjPZ2pY74MpomiE6y+KCYsg2vuZeHmZWnfiSzfl99qt7eq TKIA== 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=7oqDnjS+gUfEnVxbEzsKpLTBldZ4K4zieXyCg4D7gsw=; b=aYZ+RE+KZwD8FJPRPhPsIJLx6VhwrHVkN08hUgI1Kx13QE4DJat5PFipbAPWOxZiCm P4trnY/9dL516Ey7JeKGbJfDNLXfzawq/FuSwkP+kN2vUkyk75bLQGYUxOIdny8SaaU/ ATVHEbK9tpYLZzz67IhjdqmbyZ10ITjtP6XX49Vtd+/0AZtmfSOzBAl1wpHBdbodzrxn 7gbdq7ZeWNELLPLIQ+FkvxyMU4K0oL/fLdFkAPpVU+I6eWpFg31B8tWMOZXUuVGDB7qa gkYhBvTx0xSr3LkECch+zBW8kkb63pkqLjKCGOzvwYpLd9I2HhkTGJ21QlN90KjCZhHc 0DlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OegjjtfG; 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=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nc7-20020a1709071c0700b006f3a3d0956fsi412574ejc.473.2022.05.10.14.09.46; Tue, 10 May 2022 14:10:13 -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=@intel.com header.s=Intel header.b=OegjjtfG; 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=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348699AbiEJSNv (ORCPT + 99 others); Tue, 10 May 2022 14:13:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348524AbiEJSNU (ORCPT ); Tue, 10 May 2022 14:13:20 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 106A71D323; Tue, 10 May 2022 11:09:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652206162; x=1683742162; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JahZs61zLhB3ZUGo+ZxUJ028Y8xGFsYNKDsCW43HM5U=; b=OegjjtfGn+uJOB/wgcYsKfAnSouGPer8BN9nC7IJrpzvifT0YNVZveoL KZOhompSMdn0KRM0zYK+a8Gp9L/sMBka2N/y/mSvp+BpmAoFcOqWWv8eP nNSQ5+6zPspdkIqQz85Ayqi/kAyMXvl71gnGtzJogSgYcYwicpksAQUtU RdJIHjrs4t9dY9VHuH2WcBds0BVmFyxCyKHvOAIXZg7ZtF8WVD+PFMqRC KmlulAhosaYQDeTkOAf5S8hOKZakZXZbCAC/EITzg5Pt87mUmFdIW/Pt3 MwVoVSIKfKlLwA/2Uz1Wg78ytZqBK6WfRRXHeroKn6F5c1lmVTeBnV0d6 w==; X-IronPort-AV: E=McAfee;i="6400,9594,10343"; a="330057511" X-IronPort-AV: E=Sophos;i="5.91,214,1647327600"; d="scan'208";a="330057511" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2022 11:09:16 -0700 X-IronPort-AV: E=Sophos;i="5.91,214,1647327600"; d="scan'208";a="541908762" Received: from rchatre-ws.ostc.intel.com ([10.54.69.144]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2022 11:09:16 -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, shuah@kernel.org, linux-kselftest@vger.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, vijay.dhanraj@intel.com, hpa@zytor.com, linux-kernel@vger.kernel.org Subject: [PATCH V5 07/31] x86/sgx: Rename sgx_encl_ewb_cpumask() as sgx_encl_cpumask() Date: Tue, 10 May 2022 11:08:43 -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=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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. Reviewed-by: Jarkko Sakkinen Signed-off-by: Reinette Chatre --- No changes since V4. Changes since V3: - Add Jarkko's Reviewed-by tag. 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 04d8212ce400..1bbd76d91554 100644 --- a/arch/x86/kernel/cpu/sgx/encl.c +++ b/arch/x86/kernel/cpu/sgx/encl.c @@ -710,7 +710,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 @@ -735,7 +735,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. @@ -752,7 +752,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 c6afa58ea3e6..ef8cf106904b 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); diff --git a/arch/x86/kernel/cpu/sgx/main.c b/arch/x86/kernel/cpu/sgx/main.c index d1af5828635d..736ca652caab 100644 --- a/arch/x86/kernel/cpu/sgx/main.c +++ b/arch/x86/kernel/cpu/sgx/main.c @@ -251,7 +251,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