e293be
centosplus patch  [bug#15639]
e293be
e293be
commit 9d5f38ba6c82359b7cec31fb27fb78ecc02f3946
e293be
Author: Tom Lendacky <thomas.lendacky@amd.com>
e293be
Date:   Fri Dec 15 10:20:12 2017 -0600
e293be
e293be
    x86/mm: Unbreak modules that use the DMA API
e293be
    
e293be
    Commit d8aa7eea78a1 ("x86/mm: Add Secure Encrypted Virtualization (SEV)
e293be
    support") changed sme_active() from an inline function that referenced
e293be
    sme_me_mask to a non-inlined function in order to make the sev_enabled
e293be
    variable a static variable.  This function was marked EXPORT_SYMBOL_GPL
e293be
    because at the time the patch was submitted, sme_me_mask was marked
e293be
    EXPORT_SYMBOL_GPL.
e293be
    
e293be
    Commit 87df26175e67 ("x86/mm: Unbreak modules that rely on external
e293be
    PAGE_KERNEL availability") changed sme_me_mask variable from
e293be
    EXPORT_SYMBOL_GPL to EXPORT_SYMBOL, allowing external modules the ability
e293be
    to build with CONFIG_AMD_MEM_ENCRYPT=y.  Now, however, with sev_active()
e293be
    no longer an inline function and marked as EXPORT_SYMBOL_GPL, external
e293be
    modules that use the DMA API are once again broken in 4.15. Since the DMA
e293be
    API is meant to be used by external modules, this needs to be changed.
e293be
    
e293be
    Change the sme_active() and sev_active() functions from EXPORT_SYMBOL_GPL
e293be
    to EXPORT_SYMBOL.
e293be
    
e293be
    Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
e293be
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
e293be
    Cc: Borislav Petkov <bp@alien8.de>
e293be
    Cc: Brijesh Singh <brijesh.singh@amd.com>
e293be
    Link: https://lkml.kernel.org/r/20171215162011.14125.7113.stgit@tlendack-t1.amdoffice.net
e293be
e293be
    Applied-by: Akemi Yagi <toracat@centos.org>
e293be
e293be
--- a/arch/x86/mm/mem_encrypt.c
e293be
+++ b/arch/x86/mm/mem_encrypt.c
e293be
@@ -402,13 +402,13 @@ bool sme_active(void)
e293be
 {
e293be
	return sme_me_mask && !sev_enabled;
e293be
 }
e293be
-EXPORT_SYMBOL_GPL(sme_active);
e293be
+EXPORT_SYMBOL(sme_active);
e293be
 
e293be
 bool sev_active(void)
e293be
 {
e293be
	return sme_me_mask && sev_enabled;
e293be
 }
e293be
-EXPORT_SYMBOL_GPL(sev_active);
e293be
+EXPORT_SYMBOL(sev_active);
e293be
 
e293be
 static struct dma_map_ops sev_dma_ops = {
e293be
	.alloc                  = sev_alloc,