Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7d7a110c authored by Joerg Roedel's avatar Joerg Roedel
Browse files

amd-iommu: add function to flush tlb for all devices



This function is required for suspend/resume support with AMD IOMMU
enabled.

Signed-off-by: default avatarJoerg Roedel <joerg.roedel@amd.com>
parent bfd1be18
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ extern int amd_iommu_init_dma_ops(void);
extern void amd_iommu_detect(void);
extern irqreturn_t amd_iommu_int_handler(int irq, void *data);
extern void amd_iommu_flush_all_domains(void);
extern void amd_iommu_flush_all_devices(void);
#else
static inline int amd_iommu_init(void) { return -ENODEV; }
static inline void amd_iommu_detect(void) { }
+18 −0
Original line number Diff line number Diff line
@@ -460,6 +460,24 @@ void amd_iommu_flush_all_domains(void)
	}
}

void amd_iommu_flush_all_devices(void)
{
	struct amd_iommu *iommu;
	int i;

	for (i = 0; i <= amd_iommu_last_bdf; ++i) {
		if (amd_iommu_pd_table[i] == NULL)
			continue;

		iommu = amd_iommu_rlookup_table[i];
		if (!iommu)
			continue;

		iommu_queue_inv_dev_entry(iommu, i);
		iommu_completion_wait(iommu);
	}
}

/****************************************************************************
 *
 * The functions below are used the create the page table mappings for