diff mbox series

[08/25] x86/sgx: Make SGX IPI callback available internally

Message ID d4c030fd6bc8d5a618204abaea4b97489f137cc9.1638381245.git.reinette.chatre@intel.com (mailing list archive)
State New, archived
Headers show
Series x86/sgx and selftests/sgx: Support SGX2 | expand

Commit Message

Reinette Chatre Dec. 1, 2021, 7:23 p.m. UTC
The ETRACK instruction followed by an IPI to all CPUs within an enclave
is a common pattern with more frequent use in support of SGX2.

Make the (empty) IPI callback function available internally in
preparation for more usages.

Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
---
 arch/x86/kernel/cpu/sgx/main.c | 2 +-
 arch/x86/kernel/cpu/sgx/sgx.h  | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

Comments

Jarkko Sakkinen Dec. 4, 2021, 11 p.m. UTC | #1
On Wed, Dec 01, 2021 at 11:23:06AM -0800, Reinette Chatre wrote:
> The ETRACK instruction followed by an IPI to all CPUs within an enclave
> is a common pattern with more frequent use in support of SGX2.
> 
> Make the (empty) IPI callback function available internally in
> preparation for more usages.

Please, just describe the usages that this is needed for so that
there is zero guesswork required.

/Jarkko
Reinette Chatre Dec. 6, 2021, 9:36 p.m. UTC | #2
Hi Jarkko,

On 12/4/2021 3:00 PM, Jarkko Sakkinen wrote:
> On Wed, Dec 01, 2021 at 11:23:06AM -0800, Reinette Chatre wrote:
>> The ETRACK instruction followed by an IPI to all CPUs within an enclave
>> is a common pattern with more frequent use in support of SGX2.
>>
>> Make the (empty) IPI callback function available internally in
>> preparation for more usages.
> 
> Please, just describe the usages that this is needed for so that
> there is zero guesswork required.

The reader is not required to guess. The first paragraph states that 
SGX2 also uses the ETRACK flow that relies on this function. What if I 
replace "for more usages" by "for usage by SGX2"?

Reinette
Jarkko Sakkinen Dec. 11, 2021, 7:53 a.m. UTC | #3
On Mon, 2021-12-06 at 13:36 -0800, Reinette Chatre wrote:
> Hi Jarkko,
> 
> On 12/4/2021 3:00 PM, Jarkko Sakkinen wrote:
> > On Wed, Dec 01, 2021 at 11:23:06AM -0800, Reinette Chatre wrote:
> > > The ETRACK instruction followed by an IPI to all CPUs within an enclave
> > > is a common pattern with more frequent use in support of SGX2.
> > > 
> > > Make the (empty) IPI callback function available internally in
> > > preparation for more usages.
> > 
> > Please, just describe the usages that this is needed for so that
> > there is zero guesswork required.
> 
> The reader is not required to guess. The first paragraph states that 
> SGX2 also uses the ETRACK flow that relies on this function. What if I 
> replace "for more usages" by "for usage by SGX2"?

I think that'd be good enough.

/Jarkko
diff mbox series

Patch

diff --git a/arch/x86/kernel/cpu/sgx/main.c b/arch/x86/kernel/cpu/sgx/main.c
index 9b96f4e0a17a..887648ce6084 100644
--- a/arch/x86/kernel/cpu/sgx/main.c
+++ b/arch/x86/kernel/cpu/sgx/main.c
@@ -170,7 +170,7 @@  static int __sgx_encl_ewb(struct sgx_epc_page *epc_page, void *va_slot,
 	return ret;
 }
 
-static void sgx_ipi_cb(void *info)
+void sgx_ipi_cb(void *info)
 {
 }
 
diff --git a/arch/x86/kernel/cpu/sgx/sgx.h b/arch/x86/kernel/cpu/sgx/sgx.h
index 9ec3136c7800..ca89d625aa74 100644
--- a/arch/x86/kernel/cpu/sgx/sgx.h
+++ b/arch/x86/kernel/cpu/sgx/sgx.h
@@ -89,6 +89,8 @@  void sgx_mark_page_reclaimable(struct sgx_epc_page *page);
 int sgx_unmark_page_reclaimable(struct sgx_epc_page *page);
 struct sgx_epc_page *sgx_alloc_epc_page(void *owner, bool reclaim);
 
+void sgx_ipi_cb(void *info);
+
 #ifdef CONFIG_X86_SGX_KVM
 int __init sgx_vepc_init(void);
 #else