Commit c3928e75 authored by Joerg Roedel's avatar Joerg Roedel

Merge branch 'for-joerg/arm-smmu/updates' of...

Merge branch 'for-joerg/arm-smmu/updates' of git://git.kernel.org/pub/scm/linux/kernel/git/will/linux into arm/smmu
parents 92d21ac7 bee14004
* ARM SMMUv3 Architecture Implementation * ARM SMMUv3 Architecture Implementation
The SMMUv3 architecture is a significant deparature from previous The SMMUv3 architecture is a significant departure from previous
revisions, replacing the MMIO register interface with in-memory command revisions, replacing the MMIO register interface with in-memory command
and event queues and adding support for the ATS and PRI components of and event queues and adding support for the ATS and PRI components of
the PCIe specification. the PCIe specification.
......
...@@ -2687,6 +2687,8 @@ static int __init arm_smmu_init(void) ...@@ -2687,6 +2687,8 @@ static int __init arm_smmu_init(void)
if (ret) if (ret)
return ret; return ret;
pci_request_acs();
return bus_set_iommu(&pci_bus_type, &arm_smmu_ops); return bus_set_iommu(&pci_bus_type, &arm_smmu_ops);
} }
......
...@@ -987,8 +987,8 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain, ...@@ -987,8 +987,8 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain,
* handler seeing a half-initialised domain state. * handler seeing a half-initialised domain state.
*/ */
irq = smmu->irqs[smmu->num_global_irqs + cfg->irptndx]; irq = smmu->irqs[smmu->num_global_irqs + cfg->irptndx];
ret = request_irq(irq, arm_smmu_context_fault, IRQF_SHARED, ret = devm_request_irq(smmu->dev, irq, arm_smmu_context_fault,
"arm-smmu-context-fault", domain); IRQF_SHARED, "arm-smmu-context-fault", domain);
if (ret < 0) { if (ret < 0) {
dev_err(smmu->dev, "failed to request context IRQ %d (%u)\n", dev_err(smmu->dev, "failed to request context IRQ %d (%u)\n",
cfg->irptndx, irq); cfg->irptndx, irq);
...@@ -1028,7 +1028,7 @@ static void arm_smmu_destroy_domain_context(struct iommu_domain *domain) ...@@ -1028,7 +1028,7 @@ static void arm_smmu_destroy_domain_context(struct iommu_domain *domain)
if (cfg->irptndx != INVALID_IRPTNDX) { if (cfg->irptndx != INVALID_IRPTNDX) {
irq = smmu->irqs[smmu->num_global_irqs + cfg->irptndx]; irq = smmu->irqs[smmu->num_global_irqs + cfg->irptndx];
free_irq(irq, domain); devm_free_irq(smmu->dev, irq, domain);
} }
free_io_pgtable_ops(smmu_domain->pgtbl_ops); free_io_pgtable_ops(smmu_domain->pgtbl_ops);
...@@ -1986,15 +1986,15 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev) ...@@ -1986,15 +1986,15 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev)
} }
for (i = 0; i < smmu->num_global_irqs; ++i) { for (i = 0; i < smmu->num_global_irqs; ++i) {
err = request_irq(smmu->irqs[i], err = devm_request_irq(smmu->dev, smmu->irqs[i],
arm_smmu_global_fault, arm_smmu_global_fault,
IRQF_SHARED, IRQF_SHARED,
"arm-smmu global fault", "arm-smmu global fault",
smmu); smmu);
if (err) { if (err) {
dev_err(dev, "failed to request global IRQ %d (%u)\n", dev_err(dev, "failed to request global IRQ %d (%u)\n",
i, smmu->irqs[i]); i, smmu->irqs[i]);
goto out_free_irqs; goto out_put_masters;
} }
} }
...@@ -2006,10 +2006,6 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev) ...@@ -2006,10 +2006,6 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev)
arm_smmu_device_reset(smmu); arm_smmu_device_reset(smmu);
return 0; return 0;
out_free_irqs:
while (i--)
free_irq(smmu->irqs[i], smmu);
out_put_masters: out_put_masters:
for (node = rb_first(&smmu->masters); node; node = rb_next(node)) { for (node = rb_first(&smmu->masters); node; node = rb_next(node)) {
struct arm_smmu_master *master struct arm_smmu_master *master
...@@ -2050,7 +2046,7 @@ static int arm_smmu_device_remove(struct platform_device *pdev) ...@@ -2050,7 +2046,7 @@ static int arm_smmu_device_remove(struct platform_device *pdev)
dev_err(dev, "removing device with active domains!\n"); dev_err(dev, "removing device with active domains!\n");
for (i = 0; i < smmu->num_global_irqs; ++i) for (i = 0; i < smmu->num_global_irqs; ++i)
free_irq(smmu->irqs[i], smmu); devm_free_irq(smmu->dev, smmu->irqs[i], smmu);
/* Turn the thing off */ /* Turn the thing off */
writel(sCR0_CLIENTPD, ARM_SMMU_GR0_NS(smmu) + ARM_SMMU_GR0_sCR0); writel(sCR0_CLIENTPD, ARM_SMMU_GR0_NS(smmu) + ARM_SMMU_GR0_sCR0);
...@@ -2096,8 +2092,10 @@ static int __init arm_smmu_init(void) ...@@ -2096,8 +2092,10 @@ static int __init arm_smmu_init(void)
#endif #endif
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
if (!iommu_present(&pci_bus_type)) if (!iommu_present(&pci_bus_type)) {
pci_request_acs();
bus_set_iommu(&pci_bus_type, &arm_smmu_ops); bus_set_iommu(&pci_bus_type, &arm_smmu_ops);
}
#endif #endif
return 0; return 0;
......
...@@ -576,7 +576,7 @@ static phys_addr_t arm_lpae_iova_to_phys(struct io_pgtable_ops *ops, ...@@ -576,7 +576,7 @@ static phys_addr_t arm_lpae_iova_to_phys(struct io_pgtable_ops *ops,
return 0; return 0;
found_translation: found_translation:
iova &= (ARM_LPAE_GRANULE(data) - 1); iova &= (ARM_LPAE_BLOCK_SIZE(lvl, data) - 1);
return ((phys_addr_t)iopte_to_pfn(pte,data) << data->pg_shift) | iova; return ((phys_addr_t)iopte_to_pfn(pte,data) << data->pg_shift) | iova;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment