From patchwork Tue Apr 4 07:29:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kai Huang X-Patchwork-Id: 9660907 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 788A360353 for ; Tue, 4 Apr 2017 07:30:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61D7328285 for ; Tue, 4 Apr 2017 07:30:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 56D2D2849D; Tue, 4 Apr 2017 07:30:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 25AF528285 for ; Tue, 4 Apr 2017 07:30:02 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 262F721939313; Tue, 4 Apr 2017 00:30:02 -0700 (PDT) X-Original-To: intel-sgx-kernel-dev@lists.01.org Delivered-To: intel-sgx-kernel-dev@lists.01.org Received: from mail-pg0-x242.google.com (mail-pg0-x242.google.com [IPv6:2607:f8b0:400e:c05::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 98E3520D77834 for ; Tue, 4 Apr 2017 00:30:01 -0700 (PDT) Received: by mail-pg0-x242.google.com with SMTP id 81so35402377pgh.3 for ; Tue, 04 Apr 2017 00:30:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=gM/zoswGp+CDT0AL9SuCJW3qwljuv1zr+LRnNeYCEOc=; b=RYsUrj9E+Z0STDz8FOuTvaI6VlPTc43I8lKrzOfn76+c+jLpSWVXnwiXFSj9uQRTZC qpOUbNHBL7F5vPeRQPzbOV7MeXwxBZGT665xIvKAEU2Te5pVSqfveqtn4N5ml8L+bMBy y8dIf0jwVpN8dPont5+ZtbE8rYBVS48jN+FVKzCbGiyx4g26FPGvLSH0BYO/RcpM4oKk GA1rXxi6Q4uoDbaoepZF0nRYtPk6pDsMSKT9vInBXz2LFeL7/asAfQqqHRwOpnG5B/KC HiieDRnHXmjXTJV+9FHlysE3+DV45eSU0KiQ5934DPjUjLccdreihzdKJPQ8xQPfmsZa 25yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=gM/zoswGp+CDT0AL9SuCJW3qwljuv1zr+LRnNeYCEOc=; b=CPF+dPGctcDMuFLYjeoy/5suevdrkjF1Av7dYXLx+5mFnhK6AU2DhifrhMRkZhG/N6 L9JCfVv428rkiRpYirLokzcRKQjNTxx235kmz/59FdBzYc61ZrYqaeQChxrOJd8Tzb9x /CZv8Cm5CJYwlBEgZk+oigKLB25lqn0nsx0ZzOTq0XXhkJujcAm92+tM1N85QRosrJaY mI+OVbMe08c0MMu6exvXeD6gJfM9EB3vfWTpEWTHSMxiQgHD4euOMKmHaMOK44MsyqI2 UASkwQ1EJq2Kgv7k1evGQWgFtsx4BhI02o7gmonZrH1nsSk6oa9b1rCIhMx7GVhT2Ckx JRAQ== X-Gm-Message-State: AFeK/H3ABqC23nc38UyA8552eCGYFzGLJU1ME9svBoCAOca912EoCLiMAUXPd8sbHEpW8w== X-Received: by 10.99.175.7 with SMTP id w7mr22032425pge.170.1491291001354; Tue, 04 Apr 2017 00:30:01 -0700 (PDT) Received: from localhost.localdomain (118-92-235-112.dsl.dyn.ihug.co.nz. [118.92.235.112]) by smtp.gmail.com with ESMTPSA id y7sm29724831pfk.93.2017.04.04.00.29.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Apr 2017 00:30:00 -0700 (PDT) From: Kai Huang X-Google-Original-From: Kai Huang To: intel-sgx-kernel-dev@lists.01.org, jarkko.sakkinen@linux.intel.com Date: Tue, 4 Apr 2017 19:29:37 +1200 Message-Id: <20170404072938.4800-7-kai.huang@linux.intel.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170404072938.4800-1-kai.huang@linux.intel.com> References: <20170404072938.4800-1-kai.huang@linux.intel.com> Subject: [intel-sgx-kernel-dev] [PATCH 6/7] intel_sgx: rename free_list to list for 'struct sgx_epc_page' X-BeenThere: intel-sgx-kernel-dev@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Project: Intel® Software Guard Extensions for Linux*: https://01.org/intel-software-guard-extensions" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-sgx-kernel-dev-bounces@lists.01.org Sender: "intel-sgx-kernel-dev" X-Virus-Scanned: ClamAV using ClamSMTP Which is more generic. Sometimes KVM needs to add EPC page to a temporary list. Signed-off-by: Kai Huang --- arch/x86/include/asm/sgx.h | 2 +- drivers/platform/x86/intel_sgx_page_cache.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/x86/include/asm/sgx.h b/arch/x86/include/asm/sgx.h index 063ff8f..4ad580f 100644 --- a/arch/x86/include/asm/sgx.h +++ b/arch/x86/include/asm/sgx.h @@ -364,7 +364,7 @@ static inline int __emodt(struct sgx_secinfo *secinfo, void *epc) } struct sgx_epc_page { - struct list_head free_list; + struct list_head list; }; struct sgx_epc_page *sgx_epc_pfn_to_page(unsigned long pfn); diff --git a/drivers/platform/x86/intel_sgx_page_cache.c b/drivers/platform/x86/intel_sgx_page_cache.c index 71569e7..11be52e 100644 --- a/drivers/platform/x86/intel_sgx_page_cache.c +++ b/drivers/platform/x86/intel_sgx_page_cache.c @@ -448,7 +448,7 @@ static int sgx_epc_bank_init(struct sgx_epc_bank *bank) struct sgx_epc_page *entry = bank->epgtbl + i; spin_lock(&sgx_free_list_lock); - list_add_tail(&entry->free_list, &sgx_free_list); + list_add_tail(&entry->list, &sgx_free_list); sgx_nr_total_epc_pages++; sgx_nr_free_pages++; spin_unlock(&sgx_free_list_lock); @@ -521,8 +521,8 @@ void sgx_page_cache_teardown(struct sgx_epc_bank *banks, int nr_banks) */ spin_lock(&sgx_free_list_lock); list_for_each_safe(parser, temp, &sgx_free_list) { - entry = list_entry(parser, struct sgx_epc_page, free_list); - list_del(&entry->free_list); + entry = list_entry(parser, struct sgx_epc_page, list); + list_del(&entry->list); } spin_unlock(&sgx_free_list_lock); @@ -538,8 +538,8 @@ static struct sgx_epc_page *sgx_alloc_page_fast(void) if (!list_empty(&sgx_free_list)) { entry = list_first_entry(&sgx_free_list, struct sgx_epc_page, - free_list); - list_del(&entry->free_list); + list); + list_del(&entry->list); sgx_nr_free_pages--; } @@ -614,7 +614,7 @@ int sgx_free_page(struct sgx_epc_page *entry, unsigned int flags) } spin_lock(&sgx_free_list_lock); - list_add(&entry->free_list, &sgx_free_list); + list_add(&entry->list, &sgx_free_list); sgx_nr_free_pages++; spin_unlock(&sgx_free_list_lock);