[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] x86/acpi: separate AMD-Vi and VT-d specific functions



commit 41dbbfb5966f2517916333d1885ee68018161f48
Author:     Xenia Ragiadakou <burzalodowa@xxxxxxxxx>
AuthorDate: Fri Jan 20 09:22:42 2023 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Jan 20 09:22:42 2023 +0100

    x86/acpi: separate AMD-Vi and VT-d specific functions
    
    The functions acpi_dmar_init() and acpi_dmar_zap/reinstate() are
    VT-d specific while the function acpi_ivrs_init() is AMD-Vi specific.
    To eliminate dead code, they need to be guarded under CONFIG_INTEL_IOMMU
    and CONFIG_AMD_IOMMU, respectively.
    
    Instead of adding #ifdef guards around the function calls, implement them
    as empty static inline functions.
    
    Take the opportunity to move the declaration of acpi_dmar_init from the
    x86 arch-specific header to the common header, since Intel VT-d has been
    also used on IA-64 platforms.
    
    No functional change intended.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@xxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/arch/x86/include/asm/acpi.h | 6 +++++-
 xen/include/xen/acpi.h          | 7 +++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/include/asm/acpi.h b/xen/arch/x86/include/asm/acpi.h
index c453450a74..6ce79ce465 100644
--- a/xen/arch/x86/include/asm/acpi.h
+++ b/xen/arch/x86/include/asm/acpi.h
@@ -140,8 +140,12 @@ extern u32 pmtmr_ioport;
 extern unsigned int pmtmr_width;
 
 void acpi_iommu_init(void);
-int acpi_dmar_init(void);
+
+#ifdef CONFIG_AMD_IOMMU
 int acpi_ivrs_init(void);
+#else
+static inline int acpi_ivrs_init(void) { return -ENODEV; }
+#endif
 
 void acpi_mmcfg_init(void);
 
diff --git a/xen/include/xen/acpi.h b/xen/include/xen/acpi.h
index 1b9c75e68f..352f27f6a7 100644
--- a/xen/include/xen/acpi.h
+++ b/xen/include/xen/acpi.h
@@ -206,8 +206,15 @@ static inline int acpi_get_pxm(acpi_handle handle)
 
 void acpi_reboot(void);
 
+#ifdef CONFIG_INTEL_IOMMU
+int acpi_dmar_init(void);
 void acpi_dmar_zap(void);
 void acpi_dmar_reinstate(void);
+#else
+static inline int acpi_dmar_init(void) { return -ENODEV; }
+static inline void acpi_dmar_zap(void) {}
+static inline void acpi_dmar_reinstate(void) {}
+#endif
 
 #endif /* __ASSEMBLY__ */
 
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.