Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp729775pxb; Tue, 5 Apr 2022 20:42:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxLJDtPsJD7KFsbqV9cD9E3T8kqG+PkB8U9uGO8rF4MIKYhlxm9fdNFiKNnbsnKvCnRfqG X-Received: by 2002:a63:2b84:0:b0:398:2527:df55 with SMTP id r126-20020a632b84000000b003982527df55mr5474426pgr.281.1649216526994; Tue, 05 Apr 2022 20:42:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649216526; cv=none; d=google.com; s=arc-20160816; b=j/ywoVlh2vfDpTStpXVr0WCfDiwzBJbtjLz20lrnGZlMvULUEI2UsbuF5UjRJQF/dR tW8IX39xO/nk5iIzIF6xbQDA7Foa61Jd777CbVgBeZIbL5ZNBXa8iUiyjzmDZdL8Avn6 V/2WjvUhDOnm/Qf4xXqNrR/P8Vw6kc0HnDLiFK5XaJjTpOp7y1TG/eeLokxQZXAO9+gD ugb7HGScHhKJ3ELOC3A40fPSxhKHJB0aT1/3XQR4ENeT0po/k3YNBg+2YppeXIc5sXNP MJmiC0hIC0mChlqfu72frhSVvE5yc+Tsm0AKPlrkmgNNnQqQ4LPi0E6IeQZFuDncMDLQ 4qzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=zq7m4AMqv4G4by6jEhAdaLm42RVm1t1JTRSqfZQhXuQ=; b=pvszvdYuLUv6muL7sAkuF+uj+9IiMueYIcVe7Px0XER3skSjPRdpMv0C/hsQURd/+k zQKzMo4Z66oLaB2/4qqlVC/WiMjyWOAIEMrDo/0diibbkez3P2gj6D0RBOb7NtEu6sou a2+NpwbsQK3rGYEb7Y2owB29dfaBa8aWN0IFpTZbCFczKTGIp1YJOdoUuMi55YsLtmVl oG8mqNLS7cgyQEiec4EkYt+6LT/OG71kb4LQhwnPQdTePG5TcZ5qs8ELB2HJq8bvi5Lu aRTQomE8491aXj6QwG/ebE3Y/3kiWAvBpHQrilOoLy6jywCXPQbO1zWuvK4RQ4wbdpKH YihA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Yfhh8gAK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id j14-20020a170903024e00b00153b2d16507si16361553plh.271.2022.04.05.20.42.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 20:42:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Yfhh8gAK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 93FE724BD78; Tue, 5 Apr 2022 20:08:31 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231240AbiDEGzy (ORCPT + 99 others); Tue, 5 Apr 2022 02:55:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231299AbiDEGzq (ORCPT ); Tue, 5 Apr 2022 02:55:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8366C91546; Mon, 4 Apr 2022 23:53:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 202F56158E; Tue, 5 Apr 2022 06:53:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 308E7C340F3; Tue, 5 Apr 2022 06:53:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649141598; bh=R2Aj79mJA5Nt9aiKfrYCcBadm1RYNQmwTSLFqRL6scE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Yfhh8gAKT4UR2pN8DFqGYNtbz8FWzVMAFnTJeXx7GPDu1Tu5UE3B24GlWpKxo4w8V Dte7UL9HtTWWFbxKqZ1XknH16xXSFMsnP7bNifBki8x5fagwk0kmAB/HrL+axGkdBd E6ZG6PFcSPZJzHGQRQLL+2tlPhCauYUcx34TWyhBdCwwLXVPv2yZm/uKHjlYCkLtar mVDCgD9RPsAKSNTWNdTS1zRKkfCoAnGjvLtmi6bYG71UkBz6+PwjSm+LRNEetUFkqU Bwa/gjS33CYiOzZ6cvKxxVEw9Z0myu8TB3vo4CB0wQ+KXMgAn4yPOsix4lx3VtCQwH KPF79lTBBcGFQ== Date: Tue, 5 Apr 2022 09:54:29 +0300 From: Jarkko Sakkinen To: Reinette Chatre Cc: dave.hansen@linux.intel.com, tglx@linutronix.de, bp@alien8.de, luto@kernel.org, mingo@redhat.com, linux-sgx@vger.kernel.org, x86@kernel.org, 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: Re: [PATCH V3 04/30] x86/sgx: Add wrapper for SGX2 EAUG function Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,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 On Mon, Apr 04, 2022 at 09:49:12AM -0700, Reinette Chatre wrote: > Add a wrapper for the EAUG ENCLS leaf function used to > add a page to an initialized enclave. > > EAUG: > 1) Stores all properties of the new enclave page in the SGX > hardware's Enclave Page Cache Map (EPCM). > 2) Sets the PENDING bit in the EPCM entry of the enclave page. > This bit is cleared by the enclave by invoking ENCLU leaf > function EACCEPT or EACCEPTCOPY. > > Access from within the enclave to the new enclave page is not > possible until the PENDING bit is cleared. > > Signed-off-by: Reinette Chatre > --- > No changes since V2 > > Changes since V1: > - Split original patch ("x86/sgx: Add wrappers for SGX2 functions") > in three to introduce the SGX2 functions separately (Jarkko). > - Rewrite commit message to include how the EPCM within the hardware > is changed by the SGX2 function as well as any calling > conditions (Jarkko). > > arch/x86/kernel/cpu/sgx/encls.h | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/arch/x86/kernel/cpu/sgx/encls.h b/arch/x86/kernel/cpu/sgx/encls.h > index 7a1ecf704ec1..99004b02e2ed 100644 > --- a/arch/x86/kernel/cpu/sgx/encls.h > +++ b/arch/x86/kernel/cpu/sgx/encls.h > @@ -227,4 +227,10 @@ static inline int __emodt(struct sgx_secinfo *secinfo, void *addr) > return __encls_ret_2(EMODT, secinfo, addr); > } > > +/* Zero a page of EPC memory and add it to an initialized enclave. */ > +static inline int __eaug(struct sgx_pageinfo *pginfo, void *addr) > +{ > + return __encls_2(EAUG, pginfo, addr); > +} > + > #endif /* _X86_ENCLS_H */ > -- > 2.25.1 > Reviewed-by: Jarkko Sakkinen BR, Jarkko