Skip to content

Commit 5269519

Browse files
committed
Merge tag 'iommu-fixes-v3.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu
Pull iommu fixes from Joerg Roedel: "Fixes for regressions: - fix wrong IOMMU enumeration causing some SCSI device drivers initialization failures - ARM-SMMU fixes for a panic condition and a wrong return value" * tag 'iommu-fixes-v3.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: iommu/arm-smmu: fix panic in arm_smmu_alloc_init_pte iommu/arm-smmu: Return 0 on unmap failure iommu/vt-d: fix bug in matching PCI devices with DRHD/RMRR descriptors iommu/vt-d: Fix get_domain_for_dev() handling of upstream PCIe bridges iommu/vt-d: fix memory leakage caused by commit ea8ea46
2 parents 200bde2 + 3426cb3 commit 5269519

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

drivers/iommu/arm-smmu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,7 +1381,7 @@ static int arm_smmu_alloc_init_pmd(struct arm_smmu_device *smmu, pud_t *pud,
13811381

13821382
do {
13831383
next = pmd_addr_end(addr, end);
1384-
ret = arm_smmu_alloc_init_pte(smmu, pmd, addr, end, pfn,
1384+
ret = arm_smmu_alloc_init_pte(smmu, pmd, addr, next, pfn,
13851385
prot, stage);
13861386
phys += next - addr;
13871387
} while (pmd++, addr = next, addr < end);
@@ -1499,7 +1499,7 @@ static size_t arm_smmu_unmap(struct iommu_domain *domain, unsigned long iova,
14991499

15001500
ret = arm_smmu_handle_mapping(smmu_domain, iova, 0, size, 0);
15011501
arm_smmu_tlb_inv_context(&smmu_domain->root_cfg);
1502-
return ret ? ret : size;
1502+
return ret ? 0 : size;
15031503
}
15041504

15051505
static phys_addr_t arm_smmu_iova_to_phys(struct iommu_domain *domain,

drivers/iommu/dmar.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ dmar_alloc_pci_notify_info(struct pci_dev *dev, unsigned long event)
152152
info->seg = pci_domain_nr(dev->bus);
153153
info->level = level;
154154
if (event == BUS_NOTIFY_ADD_DEVICE) {
155-
for (tmp = dev, level--; tmp; tmp = tmp->bus->self) {
155+
for (tmp = dev; tmp; tmp = tmp->bus->self) {
156+
level--;
156157
info->path[level].device = PCI_SLOT(tmp->devfn);
157158
info->path[level].function = PCI_FUNC(tmp->devfn);
158159
if (pci_is_root_bus(tmp->bus))

drivers/iommu/intel-iommu.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,11 +1009,13 @@ static struct page *dma_pte_list_pagetables(struct dmar_domain *domain,
10091009
if (level == 1)
10101010
return freelist;
10111011

1012-
for (pte = page_address(pg); !first_pte_in_page(pte); pte++) {
1012+
pte = page_address(pg);
1013+
do {
10131014
if (dma_pte_present(pte) && !dma_pte_superpage(pte))
10141015
freelist = dma_pte_list_pagetables(domain, level - 1,
10151016
pte, freelist);
1016-
}
1017+
pte++;
1018+
} while (!first_pte_in_page(pte));
10171019

10181020
return freelist;
10191021
}
@@ -2235,7 +2237,9 @@ static struct dmar_domain *get_domain_for_dev(struct device *dev, int gaw)
22352237
bridge_devfn = dev_tmp->devfn;
22362238
}
22372239
spin_lock_irqsave(&device_domain_lock, flags);
2238-
info = dmar_search_domain_by_dev_info(segment, bus, devfn);
2240+
info = dmar_search_domain_by_dev_info(segment,
2241+
bridge_bus,
2242+
bridge_devfn);
22392243
if (info) {
22402244
iommu = info->iommu;
22412245
domain = info->domain;

0 commit comments

Comments
 (0)