* [PATCH v2 1/4] x86/sgx: Move struct sgx_vepc definition to sgx.h
@ 2022-05-19 3:11 Zhiquan Li
2022-05-19 21:30 ` Jarkko Sakkinen
0 siblings, 1 reply; 2+ messages in thread
From: Zhiquan Li @ 2022-05-19 3:11 UTC (permalink / raw)
To: linux-sgx, tony.luck
Cc: jarkko, dave.hansen, seanjc, kai.huang, fan.du, zhiquan1.li
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>
---
Changes since V1:
- Add documentation suggested by Jarkko.
---
arch/x86/kernel/cpu/sgx/sgx.h | 13 +++++++++++++
arch/x86/kernel/cpu/sgx/virt.c | 5 -----
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kernel/cpu/sgx/sgx.h b/arch/x86/kernel/cpu/sgx/sgx.h
index 0f17def9fe6f..ad3b455ed0da 100644
--- a/arch/x86/kernel/cpu/sgx/sgx.h
+++ b/arch/x86/kernel/cpu/sgx/sgx.h
@@ -101,4 +101,17 @@ static inline int __init sgx_vepc_init(void)
void sgx_update_lepubkeyhash(u64 *lepubkeyhash);
+/**
+ * struct sgx_vepc - SGX virtual EPC structure
+ * @page_array: the xarray of virtual EPC pages allocated to guest
+ * @lock: the mutex lock to protect a virtual EPC instance
+ *
+ * When hypervisor opens /dev/sgx_vepc a virtual EPC instance. The
+ * virtual EPC pages allocated to guest will be added to its page_array.
+ */
+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.
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2 1/4] x86/sgx: Move struct sgx_vepc definition to sgx.h
2022-05-19 3:11 [PATCH v2 1/4] x86/sgx: Move struct sgx_vepc definition to sgx.h Zhiquan Li
@ 2022-05-19 21:30 ` Jarkko Sakkinen
0 siblings, 0 replies; 2+ messages in thread
From: Jarkko Sakkinen @ 2022-05-19 21:30 UTC (permalink / raw)
To: Zhiquan Li; +Cc: linux-sgx, tony.luck, dave.hansen, seanjc, kai.huang, fan.du
On Thu, May 19, 2022 at 11:11:17AM +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>
> ---
> Changes since V1:
> - Add documentation suggested by Jarkko.
> ---
> arch/x86/kernel/cpu/sgx/sgx.h | 13 +++++++++++++
> arch/x86/kernel/cpu/sgx/virt.c | 5 -----
> 2 files changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/sgx/sgx.h b/arch/x86/kernel/cpu/sgx/sgx.h
> index 0f17def9fe6f..ad3b455ed0da 100644
> --- a/arch/x86/kernel/cpu/sgx/sgx.h
> +++ b/arch/x86/kernel/cpu/sgx/sgx.h
> @@ -101,4 +101,17 @@ static inline int __init sgx_vepc_init(void)
>
> void sgx_update_lepubkeyhash(u64 *lepubkeyhash);
>
> +/**
> + * struct sgx_vepc - SGX virtual EPC structure
> + * @page_array: the xarray of virtual EPC pages allocated to guest
> + * @lock: the mutex lock to protect a virtual EPC instance
> + *
> + * When hypervisor opens /dev/sgx_vepc a virtual EPC instance. The
> + * virtual EPC pages allocated to guest will be added to its page_array.
I would just write "page array".
> + */
> +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.
> --
> 2.25.1
>
BR, Jarkko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-05-19 21:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-19 3:11 [PATCH v2 1/4] x86/sgx: Move struct sgx_vepc definition to sgx.h Zhiquan Li
2022-05-19 21:30 ` Jarkko Sakkinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox