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-6.3-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu

Pull iommu fixes from Joerg Roedel:

- Maintainer update for S390 IOMMU driver

- A fix for the set_platform_dma_ops() call-back in the Exynos
IOMMU driver

- Intel VT-d fixes from Lu Baolu:
- Fix a lockdep splat
- Fix a supplement of the specification
- Fix a warning in perfmon code

* tag 'iommu-fixes-6.3-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
iommu/vt-d: Fix an IOMMU perfmon warning when CPU hotplug
iommu/vt-d: Allow zero SAGAW if second-stage not supported
iommu/vt-d: Remove unnecessary locking in intel_irq_remapping_alloc()
iommu/exynos: Fix set_platform_dma_ops() callback
MAINTAINERS: Update s390-iommu driver maintainer information

+60 -40
+2 -1
MAINTAINERS
··· 18288 18288 F: include/linux/dasd_mod.h 18289 18289 18290 18290 S390 IOMMU (PCI) 18291 + M: Niklas Schnelle <schnelle@linux.ibm.com> 18291 18292 M: Matthew Rosato <mjrosato@linux.ibm.com> 18292 - M: Gerald Schaefer <gerald.schaefer@linux.ibm.com> 18293 + R: Gerald Schaefer <gerald.schaefer@linux.ibm.com> 18293 18294 L: linux-s390@vger.kernel.org 18294 18295 S: Supported 18295 18296 F: drivers/iommu/s390-iommu.c
+10 -7
drivers/iommu/exynos-iommu.c
··· 1415 1415 return &data->iommu; 1416 1416 } 1417 1417 1418 - static void exynos_iommu_release_device(struct device *dev) 1418 + static void exynos_iommu_set_platform_dma(struct device *dev) 1419 1419 { 1420 1420 struct exynos_iommu_owner *owner = dev_iommu_priv_get(dev); 1421 - struct sysmmu_drvdata *data; 1422 1421 1423 1422 if (owner->domain) { 1424 1423 struct iommu_group *group = iommu_group_get(dev); 1425 1424 1426 1425 if (group) { 1427 - #ifndef CONFIG_ARM 1428 - WARN_ON(owner->domain != 1429 - iommu_group_default_domain(group)); 1430 - #endif 1431 1426 exynos_iommu_detach_device(owner->domain, dev); 1432 1427 iommu_group_put(group); 1433 1428 } 1434 1429 } 1430 + } 1431 + 1432 + static void exynos_iommu_release_device(struct device *dev) 1433 + { 1434 + struct exynos_iommu_owner *owner = dev_iommu_priv_get(dev); 1435 + struct sysmmu_drvdata *data; 1436 + 1437 + exynos_iommu_set_platform_dma(dev); 1435 1438 1436 1439 list_for_each_entry(data, &owner->controllers, owner_node) 1437 1440 device_link_del(data->link); ··· 1482 1479 .domain_alloc = exynos_iommu_domain_alloc, 1483 1480 .device_group = generic_device_group, 1484 1481 #ifdef CONFIG_ARM 1485 - .set_platform_dma_ops = exynos_iommu_release_device, 1482 + .set_platform_dma_ops = exynos_iommu_set_platform_dma, 1486 1483 #endif 1487 1484 .probe_device = exynos_iommu_probe_device, 1488 1485 .release_device = exynos_iommu_release_device,
+2 -1
drivers/iommu/intel/dmar.c
··· 1071 1071 } 1072 1072 1073 1073 err = -EINVAL; 1074 - if (cap_sagaw(iommu->cap) == 0) { 1074 + if (!cap_sagaw(iommu->cap) && 1075 + (!ecap_smts(iommu->ecap) || ecap_slts(iommu->ecap))) { 1075 1076 pr_info("%s: No supported address widths. Not attempting DMA translation.\n", 1076 1077 iommu->name); 1077 1078 drhd->ignored = 1;
+2
drivers/iommu/intel/iommu.h
··· 641 641 DECLARE_BITMAP(used_mask, IOMMU_PMU_IDX_MAX); 642 642 struct perf_event *event_list[IOMMU_PMU_IDX_MAX]; 643 643 unsigned char irq_name[16]; 644 + struct hlist_node cpuhp_node; 645 + int cpu; 644 646 }; 645 647 646 648 #define IOMMU_IRQ_ID_OFFSET_PRQ (DMAR_UNITS_SUPPORTED)
-6
drivers/iommu/intel/irq_remapping.c
··· 311 311 if (!irte) 312 312 return -1; 313 313 314 - down_read(&dmar_global_lock); 315 314 for (i = 0; i < MAX_IO_APICS; i++) { 316 315 if (ir_ioapic[i].iommu && ir_ioapic[i].id == apic) { 317 316 sid = (ir_ioapic[i].bus << 8) | ir_ioapic[i].devfn; 318 317 break; 319 318 } 320 319 } 321 - up_read(&dmar_global_lock); 322 320 323 321 if (sid == 0) { 324 322 pr_warn("Failed to set source-id of IOAPIC (%d)\n", apic); ··· 336 338 if (!irte) 337 339 return -1; 338 340 339 - down_read(&dmar_global_lock); 340 341 for (i = 0; i < MAX_HPET_TBS; i++) { 341 342 if (ir_hpet[i].iommu && ir_hpet[i].id == id) { 342 343 sid = (ir_hpet[i].bus << 8) | ir_hpet[i].devfn; 343 344 break; 344 345 } 345 346 } 346 - up_read(&dmar_global_lock); 347 347 348 348 if (sid == 0) { 349 349 pr_warn("Failed to set source-id of HPET block (%d)\n", id); ··· 1335 1339 if (!data) 1336 1340 goto out_free_parent; 1337 1341 1338 - down_read(&dmar_global_lock); 1339 1342 index = alloc_irte(iommu, &data->irq_2_iommu, nr_irqs); 1340 - up_read(&dmar_global_lock); 1341 1343 if (index < 0) { 1342 1344 pr_warn("Failed to allocate IRTE\n"); 1343 1345 kfree(data);
+44 -24
drivers/iommu/intel/perfmon.c
··· 773 773 iommu->perf_irq = 0; 774 774 } 775 775 776 - static int iommu_pmu_cpu_online(unsigned int cpu) 776 + static int iommu_pmu_cpu_online(unsigned int cpu, struct hlist_node *node) 777 777 { 778 + struct iommu_pmu *iommu_pmu = hlist_entry_safe(node, typeof(*iommu_pmu), cpuhp_node); 779 + 778 780 if (cpumask_empty(&iommu_pmu_cpu_mask)) 779 781 cpumask_set_cpu(cpu, &iommu_pmu_cpu_mask); 782 + 783 + if (cpumask_test_cpu(cpu, &iommu_pmu_cpu_mask)) 784 + iommu_pmu->cpu = cpu; 780 785 781 786 return 0; 782 787 } 783 788 784 - static int iommu_pmu_cpu_offline(unsigned int cpu) 789 + static int iommu_pmu_cpu_offline(unsigned int cpu, struct hlist_node *node) 785 790 { 786 - struct dmar_drhd_unit *drhd; 787 - struct intel_iommu *iommu; 788 - int target; 791 + struct iommu_pmu *iommu_pmu = hlist_entry_safe(node, typeof(*iommu_pmu), cpuhp_node); 792 + int target = cpumask_first(&iommu_pmu_cpu_mask); 793 + 794 + /* 795 + * The iommu_pmu_cpu_mask has been updated when offline the CPU 796 + * for the first iommu_pmu. Migrate the other iommu_pmu to the 797 + * new target. 798 + */ 799 + if (target < nr_cpu_ids && target != iommu_pmu->cpu) { 800 + perf_pmu_migrate_context(&iommu_pmu->pmu, cpu, target); 801 + iommu_pmu->cpu = target; 802 + return 0; 803 + } 789 804 790 805 if (!cpumask_test_and_clear_cpu(cpu, &iommu_pmu_cpu_mask)) 791 806 return 0; ··· 810 795 if (target < nr_cpu_ids) 811 796 cpumask_set_cpu(target, &iommu_pmu_cpu_mask); 812 797 else 813 - target = -1; 798 + return 0; 814 799 815 - rcu_read_lock(); 816 - 817 - for_each_iommu(iommu, drhd) { 818 - if (!iommu->pmu) 819 - continue; 820 - perf_pmu_migrate_context(&iommu->pmu->pmu, cpu, target); 821 - } 822 - rcu_read_unlock(); 800 + perf_pmu_migrate_context(&iommu_pmu->pmu, cpu, target); 801 + iommu_pmu->cpu = target; 823 802 824 803 return 0; 825 804 } 826 805 827 806 static int nr_iommu_pmu; 807 + static enum cpuhp_state iommu_cpuhp_slot; 828 808 829 809 static int iommu_pmu_cpuhp_setup(struct iommu_pmu *iommu_pmu) 830 810 { 831 811 int ret; 832 812 833 - if (nr_iommu_pmu++) 834 - return 0; 813 + if (!nr_iommu_pmu) { 814 + ret = cpuhp_setup_state_multi(CPUHP_AP_ONLINE_DYN, 815 + "driver/iommu/intel/perfmon:online", 816 + iommu_pmu_cpu_online, 817 + iommu_pmu_cpu_offline); 818 + if (ret < 0) 819 + return ret; 820 + iommu_cpuhp_slot = ret; 821 + } 835 822 836 - ret = cpuhp_setup_state(CPUHP_AP_PERF_X86_IOMMU_PERF_ONLINE, 837 - "driver/iommu/intel/perfmon:online", 838 - iommu_pmu_cpu_online, 839 - iommu_pmu_cpu_offline); 840 - if (ret) 841 - nr_iommu_pmu = 0; 823 + ret = cpuhp_state_add_instance(iommu_cpuhp_slot, &iommu_pmu->cpuhp_node); 824 + if (ret) { 825 + if (!nr_iommu_pmu) 826 + cpuhp_remove_multi_state(iommu_cpuhp_slot); 827 + return ret; 828 + } 829 + nr_iommu_pmu++; 842 830 843 - return ret; 831 + return 0; 844 832 } 845 833 846 834 static void iommu_pmu_cpuhp_free(struct iommu_pmu *iommu_pmu) 847 835 { 836 + cpuhp_state_remove_instance(iommu_cpuhp_slot, &iommu_pmu->cpuhp_node); 837 + 848 838 if (--nr_iommu_pmu) 849 839 return; 850 840 851 - cpuhp_remove_state(CPUHP_AP_PERF_X86_IOMMU_PERF_ONLINE); 841 + cpuhp_remove_multi_state(iommu_cpuhp_slot); 852 842 } 853 843 854 844 void iommu_pmu_register(struct intel_iommu *iommu)
-1
include/linux/cpuhotplug.h
··· 218 218 CPUHP_AP_PERF_X86_CQM_ONLINE, 219 219 CPUHP_AP_PERF_X86_CSTATE_ONLINE, 220 220 CPUHP_AP_PERF_X86_IDXD_ONLINE, 221 - CPUHP_AP_PERF_X86_IOMMU_PERF_ONLINE, 222 221 CPUHP_AP_PERF_S390_CF_ONLINE, 223 222 CPUHP_AP_PERF_S390_SF_ONLINE, 224 223 CPUHP_AP_PERF_ARM_CCI_ONLINE,