diff options
| -rw-r--r-- | arch/x86/include/asm/amd_iommu.h | 1 | ||||
| -rw-r--r-- | arch/x86/kernel/amd_iommu.c | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/arch/x86/include/asm/amd_iommu.h b/arch/x86/include/asm/amd_iommu.h index 1750e1f85d3c..262e02820049 100644 --- a/arch/x86/include/asm/amd_iommu.h +++ b/arch/x86/include/asm/amd_iommu.h | |||
| @@ -28,6 +28,7 @@ extern int amd_iommu_init_dma_ops(void); | |||
| 28 | extern void amd_iommu_detect(void); | 28 | extern void amd_iommu_detect(void); |
| 29 | extern irqreturn_t amd_iommu_int_handler(int irq, void *data); | 29 | extern irqreturn_t amd_iommu_int_handler(int irq, void *data); |
| 30 | extern void amd_iommu_flush_all_domains(void); | 30 | extern void amd_iommu_flush_all_domains(void); |
| 31 | extern void amd_iommu_flush_all_devices(void); | ||
| 31 | #else | 32 | #else |
| 32 | static inline int amd_iommu_init(void) { return -ENODEV; } | 33 | static inline int amd_iommu_init(void) { return -ENODEV; } |
| 33 | static inline void amd_iommu_detect(void) { } | 34 | static inline void amd_iommu_detect(void) { } |
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c index 826ad079efc4..92b0e1881e09 100644 --- a/arch/x86/kernel/amd_iommu.c +++ b/arch/x86/kernel/amd_iommu.c | |||
| @@ -460,6 +460,24 @@ void amd_iommu_flush_all_domains(void) | |||
| 460 | } | 460 | } |
| 461 | } | 461 | } |
| 462 | 462 | ||
| 463 | void amd_iommu_flush_all_devices(void) | ||
| 464 | { | ||
| 465 | struct amd_iommu *iommu; | ||
| 466 | int i; | ||
| 467 | |||
| 468 | for (i = 0; i <= amd_iommu_last_bdf; ++i) { | ||
| 469 | if (amd_iommu_pd_table[i] == NULL) | ||
| 470 | continue; | ||
| 471 | |||
| 472 | iommu = amd_iommu_rlookup_table[i]; | ||
| 473 | if (!iommu) | ||
| 474 | continue; | ||
| 475 | |||
| 476 | iommu_queue_inv_dev_entry(iommu, i); | ||
| 477 | iommu_completion_wait(iommu); | ||
| 478 | } | ||
| 479 | } | ||
| 480 | |||
| 463 | /**************************************************************************** | 481 | /**************************************************************************** |
| 464 | * | 482 | * |
| 465 | * The functions below are used the create the page table mappings for | 483 | * The functions below are used the create the page table mappings for |
