Skip to contentSkip to conversation

x86/sgx: Misc code cleanups

PATCH Applied Sean Christopherson 2 participants 5 messages Aug 23, 2019 – Aug 26, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover x86/sgx: Misc code cleanups

Fix a few minor issues flagged by checkpatch. No functional change intended.

Sean Christopherson (3):
x86/sgx: Tweak Kconfig help section according to checkpatch x86/sgx: Add missing SPDX license to encls.c x86/sgx: Fix whitespace damage in sgx_encl_page_alloc()

 arch/x86/Kconfig                |  2 +-
 arch/x86/kernel/cpu/sgx/encls.c |  3 +++
 arch/x86/kernel/cpu/sgx/ioctl.c | 23 +++++++++++------------
 3 files changed, 15 insertions(+), 13 deletions(-)
Signature · 1 line
2.22.0
#1 lore raw

PATCH 1/3 x86/sgx: Tweak Kconfig help section according to checkpatch

Replace ---help--- with help as suggested by checkpatch.

---
 arch/x86/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/Kconfig +1 -1
index eac03f448b59..2a8988aaa074 100644
@@ -1939,7 +1939,7 @@ config INTEL_SGX
 	depends on X86_64 && CPU_SUP_INTEL
 	select SRCU
 	select MMU_NOTIFIER
-	---help---
+	help
 	  Intel(R) SGX is a set of CPU instructions that can be used by
 	  applications to set aside private regions of code and data, referred
 	  to as enclaves. An enclave's private memory can only be accessed by
Signature · 1 line
2.22.0
#2 lore raw

PATCH 2/3 x86/sgx: Add missing SPDX license to encls.c

In reply to Sean Christopherson

Tag encls.c has being GPL2.0 or BSD-3 to match the other SGX source files.

---
 arch/x86/kernel/cpu/sgx/encls.c | 3 +++
 1 file changed, 3 insertions(+)
arch/x86/kernel/cpu/sgx/encls.c +3 -0
index 5045f1365e07..1b492c15a2b8 100644
@@ -1,3 +1,6 @@
+// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
+// Copyright(c) 2016-19 Intel Corporation.
+
 #include <asm/cpufeature.h>
 #include <asm/traps.h>
 #include "encls.h"
Signature · 1 line
2.22.0
#3 lore raw

PATCH 3/3 x86/sgx: Fix whitespace damage in sgx_encl_page_alloc()

In reply to Sean Christopherson

Fix a variety of recently introduced whitespace damage. No functional change intended.

---
 arch/x86/kernel/cpu/sgx/ioctl.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)
arch/x86/kernel/cpu/sgx/ioctl.c +11 -12
index ead9fb2d9b69..3ce7849f067b 100644
@@ -133,7 +133,7 @@ static struct sgx_encl_page *sgx_encl_page_alloc(struct sgx_encl *encl,
 						 u64 secinfo_flags)
 {
 	struct sgx_encl_page *encl_page;
-       unsigned long prot;
+	unsigned long prot;
 
 	encl_page = kzalloc(sizeof(*encl_page), GFP_KERNEL);
 	if (!encl_page)
@@ -145,18 +145,17 @@ static struct sgx_encl_page *sgx_encl_page_alloc(struct sgx_encl *encl,
 	if (secinfo_flags & SGX_SECINFO_TCS)
 		encl_page->desc |= SGX_ENCL_PAGE_TCS;
 
+	prot = _calc_vm_trans(secinfo_flags, SGX_SECINFO_R, PROT_READ)  |
+	       _calc_vm_trans(secinfo_flags, SGX_SECINFO_W, PROT_WRITE) |
+	       _calc_vm_trans(secinfo_flags, SGX_SECINFO_X, PROT_EXEC);
 
-       prot = _calc_vm_trans(secinfo_flags, SGX_SECINFO_R, PROT_READ)  |
-	      _calc_vm_trans(secinfo_flags, SGX_SECINFO_W, PROT_WRITE) |
-	      _calc_vm_trans(secinfo_flags, SGX_SECINFO_X, PROT_EXEC);
-
-       /*
-	* TCS pages must always RW set for CPU access while the SECINFO
-	* permissions are *always* zero - the CPU ignores the user provided
-	* values and silently overwrites them with zero permissions.
-	*/
-       if ((secinfo_flags & SGX_SECINFO_PAGE_TYPE_MASK) == SGX_SECINFO_TCS)
-	       prot |= PROT_READ | PROT_WRITE;
+	/*
+	 * TCS pages must always RW set for CPU access while the SECINFO
+	 * permissions are *always* zero - the CPU ignores the user provided
+	 * values and silently overwrites them with zero permissions.
+	 */
+	if ((secinfo_flags & SGX_SECINFO_PAGE_TYPE_MASK) == SGX_SECINFO_TCS)
+		prot |= PROT_READ | PROT_WRITE;
 
 	/* Calculate maximum of the VM flags for the page. */
 	encl_page->vm_max_prot_bits = calc_vm_prot_bits(prot, 0);
Signature · 1 line
2.22.0
#4 lore raw
In reply to Sean Christopherson
Quoted 8 lines · Sean Christopherson

Fix a few minor issues flagged by checkpatch. No functional change intended.

Sean Christopherson (3):
x86/sgx: Tweak Kconfig help section according to checkpatch x86/sgx: Add missing SPDX license to encls.c x86/sgx: Fix whitespace damage in sgx_encl_page_alloc()

Quoted 8 lines
 arch/x86/Kconfig                |  2 +-
 arch/x86/kernel/cpu/sgx/encls.c |  3 +++
 arch/x86/kernel/cpu/sgx/ioctl.c | 23 +++++++++++------------
 3 files changed, 15 insertions(+), 13 deletions(-)
Signature · 1 line
2.22.0

I merged this and my kdoc update. Thank you.

/Jarkko