From: Joerg Roedel Date: Mon, 26 Sep 2022 13:52:31 +0000 (+0200) Subject: Merge branches 'apple/dart', 'arm/mediatek', 'arm/omap', 'arm/smmu', 'virtio', 'x86... X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=38713c6028a3172c4c256512c3fbcfc799fe2d43;p=linux.git Merge branches 'apple/dart', 'arm/mediatek', 'arm/omap', 'arm/smmu', 'virtio', 'x86/vt-d', 'x86/amd' and 'core' into next --- 38713c6028a3172c4c256512c3fbcfc799fe2d43 diff --cc drivers/iommu/amd/iommu.c index 65b8e4fd82177,65b8e4fd82177,65b8e4fd82177,65b8e4fd82177,65b8e4fd82177,828672a46a3d4,d72d8a3253809,67de9c42205af..65856e4019494 --- a/drivers/iommu/amd/iommu.c +++ b/drivers/iommu/amd/iommu.c @@@@@@@@@ -2468,24 -2468,24 -2468,24 -2468,24 -2468,24 -2469,24 -2525,14 -2452,24 +2509,14 @@@@@@@@@ int amd_iommu_domain_enable_v2(struct i * devices attached when it is switched into IOMMUv2 mode. */ ret = -EBUSY; ------ - if (domain->dev_cnt > 0 || domain->flags & PD_IOMMUV2_MASK) - goto out; - - ret = -ENOMEM; - domain->gcr3_tbl = (void *)get_zeroed_page(GFP_ATOMIC); - if (domain->gcr3_tbl == NULL) ++++++ + if (pdom->dev_cnt > 0 || pdom->flags & PD_IOMMUV2_MASK) goto out; ------ ret = -ENOMEM; ------ domain->gcr3_tbl = (void *)get_zeroed_page(GFP_ATOMIC); ------ if (domain->gcr3_tbl == NULL) ------ goto out; ------ ------ - domain->glx = levels; ------ - domain->flags |= PD_IOMMUV2_MASK; ------ - ------ - amd_iommu_domain_update(domain); ------ - ------ - ret = 0; ++++++ + if (!pdom->gcr3_tbl) ++++++ + ret = domain_enable_v2(pdom, pasids); out: ------ - spin_unlock_irqrestore(&domain->lock, flags); ------ - ++++++ + spin_unlock_irqrestore(&pdom->lock, flags); return ret; } EXPORT_SYMBOL(amd_iommu_domain_enable_v2); diff --cc drivers/iommu/intel/Kconfig index 39a06d245f12e,39a06d245f12e,39a06d245f12e,39a06d245f12e,39a06d245f12e,cd0ec7ed48b62,39a06d245f12e,c48005147ac5e..b7dff5092fd21 --- a/drivers/iommu/intel/Kconfig +++ b/drivers/iommu/intel/Kconfig @@@@@@@@@ -19,8 -19,8 -19,8 -19,8 -19,8 -19,10 -19,8 -19,7 +19,9 @@@@@@@@@ config INTEL_IOMM select DMAR_TABLE select SWIOTLB select IOASID ------- select IOMMU_DMA select PCI_ATS +++++ ++ select PCI_PRI +++++ ++ select PCI_PASID help DMA remapping (DMAR) devices support enables independent address translations for Direct Memory Access (DMA) from devices. diff --cc drivers/iommu/intel/iommu.c index 7cca030a508e1,7cca030a508e1,7cca030a508e1,7cca030a508e1,7cca030a508e1,2d142ee7bbfa7,7cca030a508e1,2c6eca037f0a7..a8b36c3fddf1a --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@@@@@@@@ -402,6 -402,6 -402,6 -402,6 -402,6 -395,29 -402,6 -390,29 +395,29 @@@@@@@@@ static inline int domain_pfn_supported( return !(addr_width < BITS_PER_LONG && pfn >> addr_width); } +++++ + /* +++++ + * Calculate the Supported Adjusted Guest Address Widths of an IOMMU. +++++ + * Refer to 11.4.2 of the VT-d spec for the encoding of each bit of +++++ + * the returned SAGAW. +++++ + */ +++++ + static unsigned long __iommu_calculate_sagaw(struct intel_iommu *iommu) +++++ + { +++++ + unsigned long fl_sagaw, sl_sagaw; +++++ + - fl_sagaw = BIT(2) | (cap_fl1gp_support(iommu->cap) ? BIT(3) : 0); +++++ ++ fl_sagaw = BIT(2) | (cap_fl5lp_support(iommu->cap) ? BIT(3) : 0); +++++ + sl_sagaw = cap_sagaw(iommu->cap); +++++ + +++++ + /* Second level only. */ +++++ + if (!sm_supported(iommu) || !ecap_flts(iommu->ecap)) +++++ + return sl_sagaw; +++++ + +++++ + /* First level only. */ +++++ + if (!ecap_slts(iommu->ecap)) +++++ + return fl_sagaw; +++++ + +++++ + return fl_sagaw & sl_sagaw; +++++ + } +++++ + static int __iommu_calculate_agaw(struct intel_iommu *iommu, int max_gaw) { unsigned long sagaw; @@@@@@@@@ -1341,23 -1341,23 -1341,23 -1341,23 -1341,23 -1362,21 -1341,23 -1350,24 +1362,21 @@@@@@@@@ static void __iommu_flush_iotlb(struct } static struct device_domain_info * ----- --iommu_support_dev_iotlb(struct dmar_domain *domain, struct intel_iommu *iommu, ----- -- u8 bus, u8 devfn) +++++ ++domain_lookup_dev_info(struct dmar_domain *domain, +++++ ++ struct intel_iommu *iommu, u8 bus, u8 devfn) { struct device_domain_info *info; +++++ + unsigned long flags; ----- -- if (!iommu->qi) ----- -- return NULL; ----- -- ----- - spin_lock(&domain->lock); +++++ + spin_lock_irqsave(&domain->lock, flags); list_for_each_entry(info, &domain->devices, link) { if (info->iommu == iommu && info->bus == bus && info->devfn == devfn) { ----- - spin_unlock(&domain->lock); ----- - return info->ats_supported ? info : NULL; +++++ + spin_unlock_irqrestore(&domain->lock, flags); - return info->ats_supported ? info : NULL; +++++ ++ return info; } } ----- - spin_unlock(&domain->lock); +++++ + spin_unlock_irqrestore(&domain->lock, flags); return NULL; } @@@@@@@@@ -1375,10 -1375,10 -1375,10 -1375,10 -1375,10 -1395,10 -1375,10 -1386,10 +1395,10 @@@@@@@@@ static void domain_update_iotlb(struct } } domain->has_iotlb_device = has_iotlb_device; ----- - spin_unlock(&domain->lock); +++++ + spin_unlock_irqrestore(&domain->lock, flags); } ----- --static void iommu_enable_dev_iotlb(struct device_domain_info *info) +++++ ++static void iommu_enable_pci_caps(struct device_domain_info *info) { struct pci_dev *pdev; diff --cc drivers/iommu/virtio-iommu.c index 08eeafc9529fa,08eeafc9529fa,08eeafc9529fa,08eeafc9529fa,9fe723f55213f,80151176ba128,08eeafc9529fa,1b12825e2df12..b7c22802f57c0 --- a/drivers/iommu/virtio-iommu.c +++ b/drivers/iommu/virtio-iommu.c @@@@@@@@@ -1006,7 -1006,7 -1006,7 -1006,7 -1006,7 -1006,18 -1006,7 -1005,18 +1005,18 @@@@@@@@@ static int viommu_of_xlate(struct devic return iommu_fwspec_add_ids(dev, args->args, 1); } - static bool viommu_capable(enum iommu_cap cap) +++++++ static bool viommu_capable(struct device *dev, enum iommu_cap cap) +++++ + { +++++ + switch (cap) { +++++ + case IOMMU_CAP_CACHE_COHERENCY: +++++ + return true; +++++ + default: +++++ + return false; +++++ + } +++++ + } +++++ + static struct iommu_ops viommu_ops = { +++++ + .capable = viommu_capable, .domain_alloc = viommu_domain_alloc, .probe_device = viommu_probe_device, .probe_finalize = viommu_probe_finalize, diff --cc include/linux/io-pgtable.h index b768937382cd5,ca98aeadcc804,ca98aeadcc804,ca98aeadcc804,ca98aeadcc804,ca98aeadcc804,ffe616db9409f,ca98aeadcc804..1f068dfdb140c --- a/include/linux/io-pgtable.h +++ b/include/linux/io-pgtable.h @@@@@@@@@ -16,8 -16,7 -16,7 -16,7 -16,7 -16,7 -16,8 -16,7 +16,9 @@@@@@@@@ enum io_pgtable_fmt ARM_V7S, ARM_MALI_LPAE, AMD_IOMMU_V1, ++++++ + AMD_IOMMU_V2, APPLE_DART, +++++++ APPLE_DART2, IO_PGTABLE_NUM_FMTS, };