Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/boot/tboot: Move tboot_force_iommu() to Intel IOMMU

tboot_force_iommu() is only called by the Intel IOMMU driver. Move the
helper into that driver. No functional change intended.

Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Steve Wahl <steve.wahl@hpe.com>
Link: https://lore.kernel.org/r/20220514014322.2927339-7-baolu.lu@linux.intel.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>

authored by

Lu Baolu and committed by
Joerg Roedel
853788b9 bfd39a73

+14 -17
-15
arch/x86/kernel/tboot.c
··· 6 6 * Copyright (c) 2006-2009, Intel Corporation 7 7 */ 8 8 9 - #include <linux/intel-iommu.h> 10 9 #include <linux/init_task.h> 11 10 #include <linux/spinlock.h> 12 11 #include <linux/export.h> ··· 514 515 /* don't unmap heap because dmar.c needs access to this */ 515 516 516 517 return dmar_tbl; 517 - } 518 - 519 - int tboot_force_iommu(void) 520 - { 521 - if (!tboot_enabled()) 522 - return 0; 523 - 524 - if (no_iommu || dmar_disabled) 525 - pr_warn("Forcing Intel-IOMMU to enabled\n"); 526 - 527 - dmar_disabled = 0; 528 - no_iommu = 0; 529 - 530 - return 1; 531 518 }
+14
drivers/iommu/intel/iommu.c
··· 4019 4019 return 0; 4020 4020 } 4021 4021 4022 + static __init int tboot_force_iommu(void) 4023 + { 4024 + if (!tboot_enabled()) 4025 + return 0; 4026 + 4027 + if (no_iommu || dmar_disabled) 4028 + pr_warn("Forcing Intel-IOMMU to enabled\n"); 4029 + 4030 + dmar_disabled = 0; 4031 + no_iommu = 0; 4032 + 4033 + return 1; 4034 + } 4035 + 4022 4036 int __init intel_iommu_init(void) 4023 4037 { 4024 4038 int ret = -ENODEV;
-2
include/linux/tboot.h
··· 126 126 extern void tboot_shutdown(u32 shutdown_type); 127 127 extern struct acpi_table_header *tboot_get_dmar_table( 128 128 struct acpi_table_header *dmar_tbl); 129 - extern int tboot_force_iommu(void); 130 129 131 130 #else 132 131 ··· 135 136 #define tboot_sleep(sleep_state, pm1a_control, pm1b_control) \ 136 137 do { } while (0) 137 138 #define tboot_get_dmar_table(dmar_tbl) (dmar_tbl) 138 - #define tboot_force_iommu() 0 139 139 140 140 #endif /* !CONFIG_INTEL_TXT */ 141 141