diff mbox series

[1/4] x86/sgx: Move struct sgx_vepc definition to sgx.h

Message ID 20220510031725.3181361-1-zhiquan1.li@intel.com (mailing list archive)
State New, archived
Headers show
Series x86/sgx: fine grained SGX MCA behavior | expand

Commit Message

Zhiquan Li May 10, 2022, 3:17 a.m. UTC
Move struct sgx_vepc definition to sgx.h so that it can be used outside
of virt.c.

Signed-off-by: Zhiquan Li <zhiquan1.li@intel.com>
---
 arch/x86/kernel/cpu/sgx/sgx.h  | 5 +++++
 arch/x86/kernel/cpu/sgx/virt.c | 5 -----
 2 files changed, 5 insertions(+), 5 deletions(-)

Comments

Jarkko Sakkinen May 11, 2022, 10:31 a.m. UTC | #1
On Tue, May 10, 2022 at 11:17:25AM +0800, Zhiquan Li wrote:
> Move struct sgx_vepc definition to sgx.h so that it can be used outside
> of virt.c.
> 
> Signed-off-by: Zhiquan Li <zhiquan1.li@intel.com>
> ---
>  arch/x86/kernel/cpu/sgx/sgx.h  | 5 +++++
>  arch/x86/kernel/cpu/sgx/virt.c | 5 -----
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/sgx/sgx.h b/arch/x86/kernel/cpu/sgx/sgx.h
> index 0f17def9fe6f..83ff8c3e81cf 100644
> --- a/arch/x86/kernel/cpu/sgx/sgx.h
> +++ b/arch/x86/kernel/cpu/sgx/sgx.h
> @@ -101,4 +101,9 @@ static inline int __init sgx_vepc_init(void)
>  
>  void sgx_update_lepubkeyhash(u64 *lepubkeyhash);
>  
> +struct sgx_vepc {
> +	struct xarray page_array;
> +	struct mutex lock;
> +};

Would not BTW hurt to add some documentation for this struct, while at it.
Nothing wrong with the code change itself but what about adding a brief
explanation what it is?

> +
>  #endif /* _X86_SGX_H */
> diff --git a/arch/x86/kernel/cpu/sgx/virt.c b/arch/x86/kernel/cpu/sgx/virt.c
> index 6a77a14eee38..c9c8638b5dc4 100644
> --- a/arch/x86/kernel/cpu/sgx/virt.c
> +++ b/arch/x86/kernel/cpu/sgx/virt.c
> @@ -18,11 +18,6 @@
>  #include "encls.h"
>  #include "sgx.h"
>  
> -struct sgx_vepc {
> -	struct xarray page_array;
> -	struct mutex lock;
> -};
> -
>  /*
>   * Temporary SECS pages that cannot be EREMOVE'd due to having child in other
>   * virtual EPC instances, and the lock to protect it.
> -- 
> 2.25.1
>
Zhiquan Li May 12, 2022, 12:10 p.m. UTC | #2
On 2022/5/11 18:31, Jarkko Sakkinen wrote:
> On Tue, May 10, 2022 at 11:17:25AM +0800, Zhiquan Li wrote:
>> Move struct sgx_vepc definition to sgx.h so that it can be used outside
>> of virt.c.
>>
>> Signed-off-by: Zhiquan Li <zhiquan1.li@intel.com>
>> ---
>>  arch/x86/kernel/cpu/sgx/sgx.h  | 5 +++++
>>  arch/x86/kernel/cpu/sgx/virt.c | 5 -----
>>  2 files changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/arch/x86/kernel/cpu/sgx/sgx.h b/arch/x86/kernel/cpu/sgx/sgx.h
>> index 0f17def9fe6f..83ff8c3e81cf 100644
>> --- a/arch/x86/kernel/cpu/sgx/sgx.h
>> +++ b/arch/x86/kernel/cpu/sgx/sgx.h
>> @@ -101,4 +101,9 @@ static inline int __init sgx_vepc_init(void)
>>  
>>  void sgx_update_lepubkeyhash(u64 *lepubkeyhash);
>>  
>> +struct sgx_vepc {
>> +	struct xarray page_array;
>> +	struct mutex lock;
>> +};
> 
> Would not BTW hurt to add some documentation for this struct, while at it.
> Nothing wrong with the code change itself but what about adding a brief
> explanation what it is?

No problem, I will add some documentation in v2 patch.

Best Regards,
Zhiquan

> 
>> +
>>  #endif /* _X86_SGX_H */
>> diff --git a/arch/x86/kernel/cpu/sgx/virt.c b/arch/x86/kernel/cpu/sgx/virt.c
>> index 6a77a14eee38..c9c8638b5dc4 100644
>> --- a/arch/x86/kernel/cpu/sgx/virt.c
>> +++ b/arch/x86/kernel/cpu/sgx/virt.c
>> @@ -18,11 +18,6 @@
>>  #include "encls.h"
>>  #include "sgx.h"
>>  
>> -struct sgx_vepc {
>> -	struct xarray page_array;
>> -	struct mutex lock;
>> -};
>> -
>>  /*
>>   * Temporary SECS pages that cannot be EREMOVE'd due to having child in other
>>   * virtual EPC instances, and the lock to protect it.
>> -- 
>> 2.25.1
>>
diff mbox series

Patch

diff --git a/arch/x86/kernel/cpu/sgx/sgx.h b/arch/x86/kernel/cpu/sgx/sgx.h
index 0f17def9fe6f..83ff8c3e81cf 100644
--- a/arch/x86/kernel/cpu/sgx/sgx.h
+++ b/arch/x86/kernel/cpu/sgx/sgx.h
@@ -101,4 +101,9 @@  static inline int __init sgx_vepc_init(void)
 
 void sgx_update_lepubkeyhash(u64 *lepubkeyhash);
 
+struct sgx_vepc {
+	struct xarray page_array;
+	struct mutex lock;
+};
+
 #endif /* _X86_SGX_H */
diff --git a/arch/x86/kernel/cpu/sgx/virt.c b/arch/x86/kernel/cpu/sgx/virt.c
index 6a77a14eee38..c9c8638b5dc4 100644
--- a/arch/x86/kernel/cpu/sgx/virt.c
+++ b/arch/x86/kernel/cpu/sgx/virt.c
@@ -18,11 +18,6 @@ 
 #include "encls.h"
 #include "sgx.h"
 
-struct sgx_vepc {
-	struct xarray page_array;
-	struct mutex lock;
-};
-
 /*
  * Temporary SECS pages that cannot be EREMOVE'd due to having child in other
  * virtual EPC instances, and the lock to protect it.