Skip to content

Commit 9f341a2

Browse files
committed
Merge branch 'intel/vt-d' into next
* intel/vt-d: iommu/vt-d: Fix UAF on sva unbind with pending IOPFs iommu/vt-d: Make iotlb_sync_map a static property of dmar_domain iommu/vt-d: Deduplicate cache_tag_flush_all by reusing flush_range iommu/vt-d: Fix missing PASID in dev TLB flush with cache_tag_flush_all iommu/vt-d: Split paging_domain_compatible() iommu/vt-d: Split intel_iommu_enforce_cache_coherency() iommu/vt-d: Create unique domain ops for each stage iommu/vt-d: Split intel_iommu_domain_alloc_paging_flags() iommu/vt-d: Do not wipe out the page table NID when devices detach iommu/vt-d: Fold domain_exit() into intel_iommu_domain_free() iommu/vt-d: Lift the __pa to domain_setup_first_level/intel_svm_set_dev_pasid() iommu/vt-d: Optimize iotlb_sync_map for non-caching/non-RWBF modes iommu/vt-d: Remove the CONFIG_X86 wrapping from iommu init hook
2 parents ab1de3f + f0b9d31 commit 9f341a2

File tree

9 files changed

+275
-198
lines changed

9 files changed

+275
-198
lines changed

drivers/iommu/intel/cache.c

Lines changed: 11 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ static void cache_tag_flush_iotlb(struct dmar_domain *domain, struct cache_tag *
371371
struct intel_iommu *iommu = tag->iommu;
372372
u64 type = DMA_TLB_PSI_FLUSH;
373373

374-
if (domain->use_first_level) {
374+
if (intel_domain_is_fs_paging(domain)) {
375375
qi_batch_add_piotlb(iommu, tag->domain_id, tag->pasid, addr,
376376
pages, ih, domain->qi_batch);
377377
return;
@@ -423,22 +423,6 @@ static void cache_tag_flush_devtlb_psi(struct dmar_domain *domain, struct cache_
423423
domain->qi_batch);
424424
}
425425

426-
static void cache_tag_flush_devtlb_all(struct dmar_domain *domain, struct cache_tag *tag)
427-
{
428-
struct intel_iommu *iommu = tag->iommu;
429-
struct device_domain_info *info;
430-
u16 sid;
431-
432-
info = dev_iommu_priv_get(tag->dev);
433-
sid = PCI_DEVID(info->bus, info->devfn);
434-
435-
qi_batch_add_dev_iotlb(iommu, sid, info->pfsid, info->ats_qdep, 0,
436-
MAX_AGAW_PFN_WIDTH, domain->qi_batch);
437-
if (info->dtlb_extra_inval)
438-
qi_batch_add_dev_iotlb(iommu, sid, info->pfsid, info->ats_qdep, 0,
439-
MAX_AGAW_PFN_WIDTH, domain->qi_batch);
440-
}
441-
442426
/*
443427
* Invalidates a range of IOVA from @start (inclusive) to @end (inclusive)
444428
* when the memory mappings in the target domain have been modified.
@@ -451,7 +435,13 @@ void cache_tag_flush_range(struct dmar_domain *domain, unsigned long start,
451435
struct cache_tag *tag;
452436
unsigned long flags;
453437

454-
addr = calculate_psi_aligned_address(start, end, &pages, &mask);
438+
if (start == 0 && end == ULONG_MAX) {
439+
addr = 0;
440+
pages = -1;
441+
mask = MAX_AGAW_PFN_WIDTH;
442+
} else {
443+
addr = calculate_psi_aligned_address(start, end, &pages, &mask);
444+
}
455445

456446
spin_lock_irqsave(&domain->cache_lock, flags);
457447
list_for_each_entry(tag, &domain->cache_tags, node) {
@@ -492,31 +482,7 @@ void cache_tag_flush_range(struct dmar_domain *domain, unsigned long start,
492482
*/
493483
void cache_tag_flush_all(struct dmar_domain *domain)
494484
{
495-
struct intel_iommu *iommu = NULL;
496-
struct cache_tag *tag;
497-
unsigned long flags;
498-
499-
spin_lock_irqsave(&domain->cache_lock, flags);
500-
list_for_each_entry(tag, &domain->cache_tags, node) {
501-
if (iommu && iommu != tag->iommu)
502-
qi_batch_flush_descs(iommu, domain->qi_batch);
503-
iommu = tag->iommu;
504-
505-
switch (tag->type) {
506-
case CACHE_TAG_IOTLB:
507-
case CACHE_TAG_NESTING_IOTLB:
508-
cache_tag_flush_iotlb(domain, tag, 0, -1, 0, 0);
509-
break;
510-
case CACHE_TAG_DEVTLB:
511-
case CACHE_TAG_NESTING_DEVTLB:
512-
cache_tag_flush_devtlb_all(domain, tag);
513-
break;
514-
}
515-
516-
trace_cache_tag_flush_all(tag);
517-
}
518-
qi_batch_flush_descs(iommu, domain->qi_batch);
519-
spin_unlock_irqrestore(&domain->cache_lock, flags);
485+
cache_tag_flush_range(domain, 0, ULONG_MAX, 0);
520486
}
521487

522488
/*
@@ -546,7 +512,8 @@ void cache_tag_flush_range_np(struct dmar_domain *domain, unsigned long start,
546512
qi_batch_flush_descs(iommu, domain->qi_batch);
547513
iommu = tag->iommu;
548514

549-
if (!cap_caching_mode(iommu->cap) || domain->use_first_level) {
515+
if (!cap_caching_mode(iommu->cap) ||
516+
intel_domain_is_fs_paging(domain)) {
550517
iommu_flush_write_buffer(iommu);
551518
continue;
552519
}

drivers/iommu/intel/dmar.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -935,14 +935,11 @@ void __init detect_intel_iommu(void)
935935
pci_request_acs();
936936
}
937937

938-
#ifdef CONFIG_X86
939938
if (!ret) {
940939
x86_init.iommu.iommu_init = intel_iommu_init;
941940
x86_platform.iommu_shutdown = intel_iommu_shutdown;
942941
}
943942

944-
#endif
945-
946943
if (dmar_tbl) {
947944
acpi_put_table(dmar_tbl);
948945
dmar_tbl = NULL;

0 commit comments

Comments
 (0)