Re: [PATCH v4 5/6] x86/sgx: Hook sgx_memory_failure() into mainline code

From: Jarkko Sakkinen
Date: Tue Sep 07 2021 - 10:07:22 EST


On Mon, 2021-09-06 at 18:51 +0000, Luck, Tony wrote:
> On Fri, 2021-09-03 at 09:12 +0300, Jarkko Sakkinen wrote:
> > On Fri, 2021-08-27 at 12:55 -0700, Tony Luck wrote:
> > > +#ifdef CONFIG_X86_SGX
> > > +int sgx_memory_failure(unsigned long pfn, int flags);
> > > +bool sgx_is_epc_page(u64 paddr);
> > > +#else
> > > +static inline int sgx_memory_failure(unsigned long pfn, int flags)
> > > +{
> > > + return -ENXIO;
> > > +}
> > > +
> > > +static inline bool sgx_is_epc_page(u64 paddr)
> > > +{
> > > + return false;
> > > +}
> > > +#endif
> >
> > These decl's should be in arch/x86/include/asm/sgx.h, and as part of
> > patch that contains the implementations.
>
> But I need to use these functions in arch independent code. Specifically in
> mm/memory-failure.c and drivers/acpi/apei/einj.c
>
> If I just #include <asm/sgx.h> in those files I'll break the build for other
> architectures.

What does specifically break the build?

/Jarkko