diff mbox series

[for_v31,3/6] x86/sgx: Rename sgx_free_page() to sgx_free_epc_page()

Message ID 20200529175407.2109-4-sean.j.christopherson@intel.com (mailing list archive)
State New, archived
Headers show
Series x86/sgx: Misc fixes for v31 | expand

Commit Message

Sean Christopherson May 29, 2020, 5:54 p.m. UTC
Add "epc" into the free page helper to match sgx_alloc_epc_page().

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
 arch/x86/kernel/cpu/sgx/encl.c  | 10 +++++-----
 arch/x86/kernel/cpu/sgx/ioctl.c |  6 +++---
 arch/x86/kernel/cpu/sgx/main.c  | 12 ++++++------
 arch/x86/kernel/cpu/sgx/sgx.h   |  2 +-
 4 files changed, 15 insertions(+), 15 deletions(-)

Comments

Jarkko Sakkinen June 1, 2020, 12:50 a.m. UTC | #1
On Fri, May 29, 2020 at 10:54:04AM -0700, Sean Christopherson wrote:
> Add "epc" into the free page helper to match sgx_alloc_epc_page().
> 
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>

Would be better if you find something like this you just send patch
against the commit that introduces the symbol. That way the patch would
have at least some utilitary use.

/Jarkko
diff mbox series

Patch

diff --git a/arch/x86/kernel/cpu/sgx/encl.c b/arch/x86/kernel/cpu/sgx/encl.c
index c52c937b8d67b..e9d72f05a1f12 100644
--- a/arch/x86/kernel/cpu/sgx/encl.c
+++ b/arch/x86/kernel/cpu/sgx/encl.c
@@ -73,7 +73,7 @@  static struct sgx_epc_page *sgx_encl_eldu(struct sgx_encl_page *encl_page,
 
 	ret = __sgx_encl_eldu(encl_page, epc_page, secs_page);
 	if (ret) {
-		sgx_free_page(epc_page);
+		sgx_free_epc_page(epc_page);
 		return ERR_PTR(ret);
 	}
 
@@ -482,7 +482,7 @@  void sgx_encl_destroy(struct sgx_encl *encl)
 			if (sgx_unmark_page_reclaimable(entry->epc_page))
 				continue;
 
-			sgx_free_page(entry->epc_page);
+			sgx_free_epc_page(entry->epc_page);
 			encl->secs_child_cnt--;
 			entry->epc_page = NULL;
 		}
@@ -493,7 +493,7 @@  void sgx_encl_destroy(struct sgx_encl *encl)
 	}
 
 	if (!encl->secs_child_cnt && encl->secs.epc_page) {
-		sgx_free_page(encl->secs.epc_page);
+		sgx_free_epc_page(encl->secs.epc_page);
 		encl->secs.epc_page = NULL;
 	}
 
@@ -506,7 +506,7 @@  void sgx_encl_destroy(struct sgx_encl *encl)
 		va_page = list_first_entry(&encl->va_pages, struct sgx_va_page,
 					   list);
 		list_del(&va_page->list);
-		sgx_free_page(va_page->epc_page);
+		sgx_free_epc_page(va_page->epc_page);
 		kfree(va_page);
 	}
 }
@@ -706,7 +706,7 @@  struct sgx_epc_page *sgx_grab_va_page(void)
 	ret = __epa(sgx_get_epc_addr(epc_page));
 	if (ret) {
 		WARN_ONCE(1, "EPA returned %d (0x%x)", ret, ret);
-		sgx_free_page(epc_page);
+		sgx_free_epc_page(epc_page);
 		return ERR_PTR(-EFAULT);
 	}
 
diff --git a/arch/x86/kernel/cpu/sgx/ioctl.c b/arch/x86/kernel/cpu/sgx/ioctl.c
index 2019ee1dc0b3e..f7232a5343262 100644
--- a/arch/x86/kernel/cpu/sgx/ioctl.c
+++ b/arch/x86/kernel/cpu/sgx/ioctl.c
@@ -50,7 +50,7 @@  static void sgx_encl_shrink(struct sgx_encl *encl, struct sgx_va_page *va_page)
 	encl->page_cnt--;
 
 	if (va_page) {
-		sgx_free_page(va_page->epc_page);
+		sgx_free_epc_page(va_page->epc_page);
 		list_del(&va_page->list);
 		kfree(va_page);
 	}
@@ -223,7 +223,7 @@  static int sgx_encl_create(struct sgx_encl *encl, struct sgx_secs *secs)
 	return 0;
 
 err_out:
-	sgx_free_page(encl->secs.epc_page);
+	sgx_free_epc_page(encl->secs.epc_page);
 	encl->secs.epc_page = NULL;
 
 err_out_backing:
@@ -449,7 +449,7 @@  static int sgx_encl_add_page(struct sgx_encl *encl, unsigned long src,
 	up_read(&current->mm->mmap_sem);
 
 err_out_free:
-	sgx_free_page(epc_page);
+	sgx_free_epc_page(epc_page);
 	kfree(encl_page);
 
 	/*
diff --git a/arch/x86/kernel/cpu/sgx/main.c b/arch/x86/kernel/cpu/sgx/main.c
index ef7061bfa2a07..855b14237e7c4 100644
--- a/arch/x86/kernel/cpu/sgx/main.c
+++ b/arch/x86/kernel/cpu/sgx/main.c
@@ -376,7 +376,7 @@  static void sgx_reclaimer_write(struct sgx_epc_page *epc_page,
 
 	if (!encl->secs_child_cnt) {
 		if (atomic_read(&encl->flags) & SGX_ENCL_DEAD) {
-			sgx_free_page(encl->secs.epc_page);
+			sgx_free_epc_page(encl->secs.epc_page);
 			encl->secs.epc_page = NULL;
 		} else if (atomic_read(&encl->flags) & SGX_ENCL_INITIALIZED) {
 			ret = sgx_encl_get_backing(encl, PFN_DOWN(encl->size),
@@ -386,7 +386,7 @@  static void sgx_reclaimer_write(struct sgx_epc_page *epc_page,
 
 			sgx_encl_ewb(encl->secs.epc_page, &secs_backing);
 
-			sgx_free_page(encl->secs.epc_page);
+			sgx_free_epc_page(encl->secs.epc_page);
 			encl->secs.epc_page = NULL;
 
 			sgx_encl_put_backing(&secs_backing, true);
@@ -508,7 +508,7 @@  static struct sgx_epc_page *__sgx_alloc_epc_page_from_section(struct sgx_epc_sec
  * __sgx_alloc_epc_page() - Grab a free EPC page
  *
  * Iterate through EPC sections and borrow a free EPC page to the caller. When a
- * page is no longer needed it must be released with sgx_free_page().
+ * page is no longer needed it must be released with sgx_free_epc_page().
  *
  * Return:
  *   an EPC page,
@@ -539,7 +539,7 @@  struct sgx_epc_page *__sgx_alloc_epc_page(void)
  * @reclaim:	reclaim pages if necessary
  *
  * Iterate through EPC sections and borrow a free EPC page to the caller. When a
- * page is no longer needed it must be released with sgx_free_page(). If
+ * page is no longer needed it must be released with sgx_free_epc_page(). If
  * @reclaim is set to true, directly reclaim pages when we are out of pages. No
  * mm's can be locked when @reclaim is set to true.
  *
@@ -585,12 +585,12 @@  struct sgx_epc_page *sgx_alloc_epc_page(void *owner, bool reclaim)
 }
 
 /**
- * sgx_free_page() - Free an EPC page
+ * sgx_free_epc_page() - Free an EPC page
  * @page:	an EPC page
  *
  * Call EREMOVE for an EPC page and insert it back to the list of free pages.
  */
-void sgx_free_page(struct sgx_epc_page *page)
+void sgx_free_epc_page(struct sgx_epc_page *page)
 {
 	struct sgx_epc_section *section = sgx_get_epc_section(page);
 	int ret;
diff --git a/arch/x86/kernel/cpu/sgx/sgx.h b/arch/x86/kernel/cpu/sgx/sgx.h
index 5b9dbcef981b0..2983c1a3d725d 100644
--- a/arch/x86/kernel/cpu/sgx/sgx.h
+++ b/arch/x86/kernel/cpu/sgx/sgx.h
@@ -62,6 +62,6 @@  static inline void *sgx_get_epc_addr(struct sgx_epc_page *page)
 
 struct sgx_epc_page *__sgx_alloc_epc_page(void);
 struct sgx_epc_page *sgx_alloc_epc_page(void *owner, bool reclaim);
-void sgx_free_page(struct sgx_epc_page *page);
+void sgx_free_epc_page(struct sgx_epc_page *page);
 
 #endif /* _X86_SGX_H */