diff mbox

[intel-sgx-kernel-dev,2/2] intel_sgx: require X86_64

Message ID 20170802134254.4682-3-jarkko.sakkinen@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jarkko Sakkinen Aug. 2, 2017, 1:42 p.m. UTC
Update the driver require 64-bit compilation for two reasons:

- We cannot sanely enable PAT for IO range in 32-bit because PAT
  helpers are not exported.
- The first version of in-kernel launch enclave is 64-bit only.

There is long term path to do 32-bit support by extending existing
io-mapping framework to support WB (at the moment it supports WC
only) that can be used post upstreaming.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
---
 drivers/platform/x86/intel_sgx/Kconfig          | 2 +-
 drivers/platform/x86/intel_sgx/sgx_page_cache.c | 7 -------
 2 files changed, 1 insertion(+), 8 deletions(-)

Comments

Jarkko Sakkinen Aug. 2, 2017, 1:58 p.m. UTC | #1
On Wed, Aug 02, 2017 at 04:42:54PM +0300, Jarkko Sakkinen wrote:
> Update the driver require 64-bit compilation for two reasons:
> 
> - We cannot sanely enable PAT for IO range in 32-bit because PAT
>   helpers are not exported.
> - The first version of in-kernel launch enclave is 64-bit only.
> 
> There is long term path to do 32-bit support by extending existing
> io-mapping framework to support WB (at the moment it supports WC
> only) that can be used post upstreaming.
> 
> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> ---
>  drivers/platform/x86/intel_sgx/Kconfig          | 2 +-
>  drivers/platform/x86/intel_sgx/sgx_page_cache.c | 7 -------
>  2 files changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/drivers/platform/x86/intel_sgx/Kconfig b/drivers/platform/x86/intel_sgx/Kconfig
> index 96417280bbf7..c13f8efd26bc 100644
> --- a/drivers/platform/x86/intel_sgx/Kconfig
> +++ b/drivers/platform/x86/intel_sgx/Kconfig
> @@ -5,7 +5,7 @@
>  config INTEL_SGX
>  	tristate "Intel(R) SGX Driver"
>  	default n
> -	depends on X86
> +	depends on CPU_SUP_INTEL && X86_64
>  	select MMU_NOTIFIER
>  	---help---
>  	Intel(R) SGX is a set of CPU instructions that can be used by
> diff --git a/drivers/platform/x86/intel_sgx/sgx_page_cache.c b/drivers/platform/x86/intel_sgx/sgx_page_cache.c
> index 09fe3244fcee..124a37e28555 100644
> --- a/drivers/platform/x86/intel_sgx/sgx_page_cache.c
> +++ b/drivers/platform/x86/intel_sgx/sgx_page_cache.c
> @@ -554,9 +554,6 @@ EXPORT_SYMBOL(sgx_free_page);
>  
>  void *sgx_get_page(struct sgx_epc_page *entry)
>  {
> -#ifdef CONFIG_X86_32
> -	return kmap_atomic_pfn(PFN_DOWN(entry->pa));
> -#else
>  	unsigned long offset;
>  	int i;
>  
> @@ -571,15 +568,11 @@ void *sgx_get_page(struct sgx_epc_page *entry)
>  	}
>  
>  	return NULL;
> -#endif
>  }
>  EXPORT_SYMBOL(sgx_get_page);
>  
>  void sgx_put_page(void *epc_page_vaddr)
>  {
> -#ifdef CONFIG_X86_32
>  	kunmap_atomic(epc_page_vaddr);
> -#else
> -#endif
>  }
>  EXPORT_SYMBOL(sgx_put_page);

Oops, what am I doing in sgx_put_page :( Sorry about that.

Maybe it is better only change the Kconfig and leave rest as it is. Then
it is less of a stretch to do 32-bit version later on.

/Jarkko
diff mbox

Patch

diff --git a/drivers/platform/x86/intel_sgx/Kconfig b/drivers/platform/x86/intel_sgx/Kconfig
index 96417280bbf7..c13f8efd26bc 100644
--- a/drivers/platform/x86/intel_sgx/Kconfig
+++ b/drivers/platform/x86/intel_sgx/Kconfig
@@ -5,7 +5,7 @@ 
 config INTEL_SGX
 	tristate "Intel(R) SGX Driver"
 	default n
-	depends on X86
+	depends on CPU_SUP_INTEL && X86_64
 	select MMU_NOTIFIER
 	---help---
 	Intel(R) SGX is a set of CPU instructions that can be used by
diff --git a/drivers/platform/x86/intel_sgx/sgx_page_cache.c b/drivers/platform/x86/intel_sgx/sgx_page_cache.c
index 09fe3244fcee..124a37e28555 100644
--- a/drivers/platform/x86/intel_sgx/sgx_page_cache.c
+++ b/drivers/platform/x86/intel_sgx/sgx_page_cache.c
@@ -554,9 +554,6 @@  EXPORT_SYMBOL(sgx_free_page);
 
 void *sgx_get_page(struct sgx_epc_page *entry)
 {
-#ifdef CONFIG_X86_32
-	return kmap_atomic_pfn(PFN_DOWN(entry->pa));
-#else
 	unsigned long offset;
 	int i;
 
@@ -571,15 +568,11 @@  void *sgx_get_page(struct sgx_epc_page *entry)
 	}
 
 	return NULL;
-#endif
 }
 EXPORT_SYMBOL(sgx_get_page);
 
 void sgx_put_page(void *epc_page_vaddr)
 {
-#ifdef CONFIG_X86_32
 	kunmap_atomic(epc_page_vaddr);
-#else
-#endif
 }
 EXPORT_SYMBOL(sgx_put_page);