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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'iommu-fixes-v5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu

Pull iommu fixes from Joerg Roedel:

- Fix a double list_add() in Intel VT-d code

- Add missing put_device() in Tegra SMMU driver

- Two AMD IOMMU fixes:
- Memory leak in IO page-table freeing code
- Add missing recovery from event-log overflow

* tag 'iommu-fixes-v5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
iommu/tegra-smmu: Fix missing put_device() call in tegra_smmu_find
iommu/vt-d: Fix double list_add when enabling VMD in scalable mode
iommu/amd: Fix I/O page table memory leak
iommu/amd: Recover from event log overflow

+30 -10
+1
drivers/iommu/amd/amd_iommu.h
··· 14 14 extern irqreturn_t amd_iommu_int_thread(int irq, void *data); 15 15 extern irqreturn_t amd_iommu_int_handler(int irq, void *data); 16 16 extern void amd_iommu_apply_erratum_63(u16 devid); 17 + extern void amd_iommu_restart_event_logging(struct amd_iommu *iommu); 17 18 extern void amd_iommu_reset_cmd_buffer(struct amd_iommu *iommu); 18 19 extern int amd_iommu_init_devices(void); 19 20 extern void amd_iommu_uninit_devices(void);
+1
drivers/iommu/amd/amd_iommu_types.h
··· 110 110 #define PASID_MASK 0x0000ffff 111 111 112 112 /* MMIO status bits */ 113 + #define MMIO_STATUS_EVT_OVERFLOW_INT_MASK (1 << 0) 113 114 #define MMIO_STATUS_EVT_INT_MASK (1 << 1) 114 115 #define MMIO_STATUS_COM_WAIT_INT_MASK (1 << 2) 115 116 #define MMIO_STATUS_PPR_INT_MASK (1 << 6)
+10
drivers/iommu/amd/init.c
··· 658 658 } 659 659 660 660 /* 661 + * This function restarts event logging in case the IOMMU experienced 662 + * an event log buffer overflow. 663 + */ 664 + void amd_iommu_restart_event_logging(struct amd_iommu *iommu) 665 + { 666 + iommu_feature_disable(iommu, CONTROL_EVT_LOG_EN); 667 + iommu_feature_enable(iommu, CONTROL_EVT_LOG_EN); 668 + } 669 + 670 + /* 661 671 * This function resets the command buffer if the IOMMU stopped fetching 662 672 * commands from it. 663 673 */
+6 -6
drivers/iommu/amd/io_pgtable.c
··· 492 492 493 493 dom = container_of(pgtable, struct protection_domain, iop); 494 494 495 - /* Update data structure */ 496 - amd_iommu_domain_clr_pt_root(dom); 497 - 498 - /* Make changes visible to IOMMUs */ 499 - amd_iommu_domain_update(dom); 500 - 501 495 /* Page-table is not visible to IOMMU anymore, so free it */ 502 496 BUG_ON(pgtable->mode < PAGE_MODE_NONE || 503 497 pgtable->mode > PAGE_MODE_6_LEVEL); 504 498 505 499 free_sub_pt(pgtable->root, pgtable->mode, &freelist); 500 + 501 + /* Update data structure */ 502 + amd_iommu_domain_clr_pt_root(dom); 503 + 504 + /* Make changes visible to IOMMUs */ 505 + amd_iommu_domain_update(dom); 506 506 507 507 put_pages_list(&freelist); 508 508 }
+8 -2
drivers/iommu/amd/iommu.c
··· 764 764 #endif /* !CONFIG_IRQ_REMAP */ 765 765 766 766 #define AMD_IOMMU_INT_MASK \ 767 - (MMIO_STATUS_EVT_INT_MASK | \ 767 + (MMIO_STATUS_EVT_OVERFLOW_INT_MASK | \ 768 + MMIO_STATUS_EVT_INT_MASK | \ 768 769 MMIO_STATUS_PPR_INT_MASK | \ 769 770 MMIO_STATUS_GALOG_INT_MASK) 770 771 ··· 775 774 u32 status = readl(iommu->mmio_base + MMIO_STATUS_OFFSET); 776 775 777 776 while (status & AMD_IOMMU_INT_MASK) { 778 - /* Enable EVT and PPR and GA interrupts again */ 777 + /* Enable interrupt sources again */ 779 778 writel(AMD_IOMMU_INT_MASK, 780 779 iommu->mmio_base + MMIO_STATUS_OFFSET); 781 780 ··· 795 794 iommu_poll_ga_log(iommu); 796 795 } 797 796 #endif 797 + 798 + if (status & MMIO_STATUS_EVT_OVERFLOW_INT_MASK) { 799 + pr_info_ratelimited("IOMMU event log overflow\n"); 800 + amd_iommu_restart_event_logging(iommu); 801 + } 798 802 799 803 /* 800 804 * Hardware bug: ERBT1312
+1 -1
drivers/iommu/intel/iommu.c
··· 2738 2738 spin_unlock_irqrestore(&device_domain_lock, flags); 2739 2739 2740 2740 /* PASID table is mandatory for a PCI device in scalable mode. */ 2741 - if (dev && dev_is_pci(dev) && sm_supported(iommu)) { 2741 + if (sm_supported(iommu) && !dev_is_real_dma_subdevice(dev)) { 2742 2742 ret = intel_pasid_alloc_table(dev); 2743 2743 if (ret) { 2744 2744 dev_err(dev, "PASID table allocation failed\n");
+3 -1
drivers/iommu/tegra-smmu.c
··· 808 808 return NULL; 809 809 810 810 mc = platform_get_drvdata(pdev); 811 - if (!mc) 811 + if (!mc) { 812 + put_device(&pdev->dev); 812 813 return NULL; 814 + } 813 815 814 816 return mc->smmu; 815 817 }