xref: /openbmc/linux/arch/x86/include/asm/iommu.h (revision 8e7ae8ba)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_X86_IOMMU_H
3 #define _ASM_X86_IOMMU_H
4 
5 #include <linux/acpi.h>
6 
7 #include <asm/e820/api.h>
8 
9 extern int force_iommu, no_iommu;
10 extern int iommu_detected;
11 extern int iommu_merge;
12 extern int panic_on_overflow;
13 
14 #ifdef CONFIG_SWIOTLB
15 extern bool x86_swiotlb_enable;
16 #else
17 #define x86_swiotlb_enable false
18 #endif
19 
20 /* 10 seconds */
21 #define DMAR_OPERATION_TIMEOUT ((cycles_t) tsc_khz*10*1000)
22 
23 static inline int __init
24 arch_rmrr_sanity_check(struct acpi_dmar_reserved_memory *rmrr)
25 {
26 	u64 start = rmrr->base_address;
27 	u64 end = rmrr->end_address + 1;
28 
29 	if (e820__mapped_all(start, end, E820_TYPE_RESERVED))
30 		return 0;
31 
32 	pr_err(FW_BUG "No firmware reserved region can cover this RMRR [%#018Lx-%#018Lx], contact BIOS vendor for fixes\n",
33 	       start, end - 1);
34 	return -EINVAL;
35 }
36 
37 #endif /* _ASM_X86_IOMMU_H */
38