Skip to content

Commit d4afddc

Browse files
committed
Revert "hv: init_iommu rework to enable IOMMU for partition mode ACRN"
This reverts commit d8508e4.
1 parent 40dfd3f commit d4afddc

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

hypervisor/arch/x86/vtd.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -659,18 +659,9 @@ static void dmar_set_root_table(struct dmar_drhd_rt *dmar_uint)
659659
{
660660
uint64_t address;
661661
uint32_t status;
662-
void *root_table_vaddr = NULL;
663662

664663
spinlock_obtain(&(dmar_uint->lock));
665664

666-
root_table_vaddr = alloc_paging_struct();
667-
668-
if (root_table_vaddr != NULL) {
669-
dmar_uint->root_table_addr = hva2hpa(root_table_vaddr);
670-
} else {
671-
ASSERT(false, "failed to allocate root table!");
672-
}
673-
674665
/* Currently don't support extended root table */
675666
address = dmar_uint->root_table_addr;
676667

@@ -982,7 +973,16 @@ static int add_iommu_device(struct iommu_domain *domain, uint16_t segment,
982973
return 1;
983974
}
984975

985-
ASSERT(dmar_uint->root_table_addr != 0UL, "root table is not setup");
976+
if (dmar_uint->root_table_addr == 0UL) {
977+
void *root_table_vaddr = alloc_paging_struct();
978+
979+
if (root_table_vaddr != NULL) {
980+
dmar_uint->root_table_addr = hva2hpa(root_table_vaddr);
981+
} else {
982+
ASSERT(false, "failed to allocate root table!");
983+
return 1;
984+
}
985+
}
986986

987987
root_table =
988988
(struct dmar_root_entry *)hpa2hva(dmar_uint->root_table_addr);
@@ -1277,8 +1277,6 @@ void init_iommu(void)
12771277
spinlock_init(&domain_lock);
12781278

12791279
register_hrhd_units();
1280-
1281-
enable_iommu();
12821280
}
12831281

12841282
void init_iommu_vm0_domain(struct vm *vm0)
@@ -1298,4 +1296,5 @@ void init_iommu_vm0_domain(struct vm *vm0)
12981296
}
12991297
}
13001298
cache_flush_invalidate_all();
1299+
enable_iommu();
13011300
}

0 commit comments

Comments
 (0)