Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp472313rwi; Tue, 18 Oct 2022 21:24:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM54oF9wg2wjwEznltHMn2IiZq2iw9kOdi1X2NjG9YysiOAciaBx/vu5xgT0tk+qPeowvpwB X-Received: by 2002:a17:907:763b:b0:78d:ed3d:5a8 with SMTP id jy27-20020a170907763b00b0078ded3d05a8mr5060857ejc.132.1666153460129; Tue, 18 Oct 2022 21:24:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666153460; cv=none; d=google.com; s=arc-20160816; b=AIkwzByg7NyJSZ+lutLoTLXed2jS02pTJhuJ+ZpFDAcDkQWg492D0WFu43nnHxLrf5 gdRNo45Hc76+Qg4bQetW8qgVAcJh0gjuJGFXExSWaW3NE96N0thzxNEw0JV244F/jgbQ dkKIIxyu/N547nDvLnR/lMRBhZBCY7KL3XjrKA9Ya5tw4cmUJiFnFVCXhWqvuaeQI2fU NxZLZOZuzjEJZPGgTeLn5vSQ4Ad6qYOEyo1gaqGbyRilmn5i8+WU5UQpRN3vOrriu12Q hvCmwV6GT47+se3zu8/4Faiy+VuZxJmyiwkwGfAv64YZ/CZ68UR/RuoLr88Kf7UBF1vM MoZg== 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; bh=kHHJyDT2hgQmZR5mRQG4tLDHVs0Z/pdo4jfpgZD/puE=; b=kevS8+heqPVlFdIOe/Dy1d1h5CCNuurGovrm5PsIvlP49teJkeKnvSWy5Cg7beHkbt iK6R8zOjAh5h5n8c+AuAnz0mwTRG6hYmZE4kn67rfEiolX8wPHkcVhL8rKLiEIrWyrdf xfCXGBrHDnc1TULcq4dR/CR+Wfy2hNY0BYzFGa7eQyh1Pm6YcaDvEqyyK/iDooU+4RCE //U6oQU63FX8V+SyBcNVbA4tciht7SFyFS9cG7gSGIv+DY/NSbStTlVpexIV5ES/cBRK litj3U2K2IRz6VVUK/b2S4qoycCBFNwLSp5rDnjIErPOKnbwip3xTYQcL4Ky4ErjcVle 1r0g== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l18-20020a1709067d5200b0078aefaf3910si12461144ejp.362.2022.10.18.21.23.54; Tue, 18 Oct 2022 21:24:20 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229928AbiJSDaQ (ORCPT + 99 others); Tue, 18 Oct 2022 23:30:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229926AbiJSDaH (ORCPT ); Tue, 18 Oct 2022 23:30:07 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7174D50F94; Tue, 18 Oct 2022 20:30:06 -0700 (PDT) Received: from dggpemm500024.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Msbny0JjPzHv4h; Wed, 19 Oct 2022 11:29:58 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggpemm500024.china.huawei.com (7.185.36.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 19 Oct 2022 11:29:57 +0800 Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 19 Oct 2022 11:29:56 +0800 From: Kefeng Wang To: , Andrew Morton CC: Dinh Nguyen , Jarkko Sakkinen , Dave Hansen , , , , Kefeng Wang Subject: [PATCH 2/5] x86/sgx: use VM_ACCESS_FLAGS Date: Wed, 19 Oct 2022 11:49:42 +0800 Message-ID: <20221019034945.93081-3-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221019034945.93081-1-wangkefeng.wang@huawei.com> References: <20221019034945.93081-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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 Simplify VM_READ|VM_WRITE|VM_EXEC with VM_ACCESS_FLAGS. Cc: Jarkko Sakkinen Cc: Dave Hansen Signed-off-by: Kefeng Wang --- arch/x86/kernel/cpu/sgx/encl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/sgx/encl.c b/arch/x86/kernel/cpu/sgx/encl.c index 1ec20807de1e..6225c525372d 100644 --- a/arch/x86/kernel/cpu/sgx/encl.c +++ b/arch/x86/kernel/cpu/sgx/encl.c @@ -268,7 +268,7 @@ static struct sgx_encl_page *sgx_encl_load_page_in_vma(struct sgx_encl *encl, unsigned long addr, unsigned long vm_flags) { - unsigned long vm_prot_bits = vm_flags & (VM_READ | VM_WRITE | VM_EXEC); + unsigned long vm_prot_bits = vm_flags & VM_ACCESS_FLAGS; struct sgx_encl_page *entry; entry = xa_load(&encl->page_array, PFN_DOWN(addr)); @@ -502,7 +502,7 @@ static void sgx_vma_open(struct vm_area_struct *vma) int sgx_encl_may_map(struct sgx_encl *encl, unsigned long start, unsigned long end, unsigned long vm_flags) { - unsigned long vm_prot_bits = vm_flags & (VM_READ | VM_WRITE | VM_EXEC); + unsigned long vm_prot_bits = vm_flags & VM_ACCESS_FLAGS; struct sgx_encl_page *page; unsigned long count = 0; int ret = 0; -- 2.35.3