You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge tag 'iommu-updates-v3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu
Pull IOMMU updates from Joerg Roedel: "A few new features this merge-window. The most important one is probably, that dma-debug now warns if a dma-handle is not checked with dma_mapping_error by the device driver. This requires minor changes to some architectures which make use of dma-debug. Most of these changes have the respective Acks by the Arch-Maintainers. Besides that there are updates to the AMD IOMMU driver for refactor the IOMMU-Groups support and to make sure it does not trigger a hardware erratum. The OMAP changes (for which I pulled in a branch from Tony Lindgren's tree) have a conflict in linux-next with the arm-soc tree. The conflict is in the file arch/arm/mach-omap2/clock44xx_data.c which is deleted in the arm-soc tree. It is safe to delete the file too so solve the conflict. Similar changes are done in the arm-soc tree in the common clock framework migration. A missing hunk from the patch in the IOMMU tree will be submitted as a seperate patch when the merge-window is closed." * tag 'iommu-updates-v3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (29 commits) ARM: dma-mapping: support debug_dma_mapping_error ARM: OMAP4: hwmod data: ipu and dsp to use parent clocks instead of leaf clocks iommu/omap: Adapt to runtime pm iommu/omap: Migrate to hwmod framework iommu/omap: Keep mmu enabled when requested iommu/omap: Remove redundant clock handling on ISR iommu/amd: Remove obsolete comment iommu/amd: Don't use 512GB pages iommu/tegra: smmu: Move bus_set_iommu after probe for multi arch iommu/tegra: gart: Move bus_set_iommu after probe for multi arch iommu/tegra: smmu: Remove unnecessary PTC/TLB flush all tile: dma_debug: add debug_dma_mapping_error support sh: dma_debug: add debug_dma_mapping_error support powerpc: dma_debug: add debug_dma_mapping_error support mips: dma_debug: add debug_dma_mapping_error support microblaze: dma-mapping: support debug_dma_mapping_error ia64: dma_debug: add debug_dma_mapping_error support c6x: dma_debug: add debug_dma_mapping_error support ARM64: dma_debug: add debug_dma_mapping_error support intel-iommu: Prevent devices with RMRRs from being placed into SI Domain ...
This commit is contained in:
@@ -91,6 +91,7 @@ static inline dma_addr_t virt_to_dma(struct device *dev, void *addr)
|
||||
*/
|
||||
static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
|
||||
{
|
||||
debug_dma_mapping_error(dev, dma_addr);
|
||||
return dma_addr == DMA_ERROR_CODE;
|
||||
}
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ static struct platform_device omap3isp_device = {
|
||||
};
|
||||
|
||||
static struct omap_iommu_arch_data omap3_isp_iommu = {
|
||||
.name = "isp",
|
||||
.name = "mmu_isp",
|
||||
};
|
||||
|
||||
int omap3_init_camera(struct isp_platform_data *pdata)
|
||||
|
||||
@@ -12,153 +12,60 @@
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include <linux/platform_data/iommu-omap.h>
|
||||
#include <plat/omap_hwmod.h>
|
||||
#include <plat/omap_device.h>
|
||||
|
||||
#include "soc.h"
|
||||
#include "common.h"
|
||||
static int __init omap_iommu_dev_init(struct omap_hwmod *oh, void *unused)
|
||||
{
|
||||
struct platform_device *pdev;
|
||||
struct iommu_platform_data *pdata;
|
||||
struct omap_mmu_dev_attr *a = (struct omap_mmu_dev_attr *)oh->dev_attr;
|
||||
static int i;
|
||||
|
||||
struct iommu_device {
|
||||
resource_size_t base;
|
||||
int irq;
|
||||
struct iommu_platform_data pdata;
|
||||
struct resource res[2];
|
||||
};
|
||||
static struct iommu_device *devices;
|
||||
static int num_iommu_devices;
|
||||
pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
|
||||
if (!pdata)
|
||||
return -ENOMEM;
|
||||
|
||||
#ifdef CONFIG_ARCH_OMAP3
|
||||
static struct iommu_device omap3_devices[] = {
|
||||
{
|
||||
.base = 0x480bd400,
|
||||
.irq = 24 + OMAP_INTC_START,
|
||||
.pdata = {
|
||||
.name = "isp",
|
||||
.nr_tlb_entries = 8,
|
||||
.clk_name = "cam_ick",
|
||||
.da_start = 0x0,
|
||||
.da_end = 0xFFFFF000,
|
||||
},
|
||||
},
|
||||
#if defined(CONFIG_OMAP_IOMMU_IVA2)
|
||||
{
|
||||
.base = 0x5d000000,
|
||||
.irq = 28 + OMAP_INTC_START,
|
||||
.pdata = {
|
||||
.name = "iva2",
|
||||
.nr_tlb_entries = 32,
|
||||
.clk_name = "iva2_ck",
|
||||
.da_start = 0x11000000,
|
||||
.da_end = 0xFFFFF000,
|
||||
},
|
||||
},
|
||||
#endif
|
||||
};
|
||||
#define NR_OMAP3_IOMMU_DEVICES ARRAY_SIZE(omap3_devices)
|
||||
static struct platform_device *omap3_iommu_pdev[NR_OMAP3_IOMMU_DEVICES];
|
||||
#else
|
||||
#define omap3_devices NULL
|
||||
#define NR_OMAP3_IOMMU_DEVICES 0
|
||||
#define omap3_iommu_pdev NULL
|
||||
#endif
|
||||
pdata->name = oh->name;
|
||||
pdata->nr_tlb_entries = a->nr_tlb_entries;
|
||||
pdata->da_start = a->da_start;
|
||||
pdata->da_end = a->da_end;
|
||||
|
||||
#ifdef CONFIG_ARCH_OMAP4
|
||||
static struct iommu_device omap4_devices[] = {
|
||||
{
|
||||
.base = OMAP4_MMU1_BASE,
|
||||
.irq = 100 + OMAP44XX_IRQ_GIC_START,
|
||||
.pdata = {
|
||||
.name = "ducati",
|
||||
.nr_tlb_entries = 32,
|
||||
.clk_name = "ipu_fck",
|
||||
.da_start = 0x0,
|
||||
.da_end = 0xFFFFF000,
|
||||
},
|
||||
},
|
||||
{
|
||||
.base = OMAP4_MMU2_BASE,
|
||||
.irq = 28 + OMAP44XX_IRQ_GIC_START,
|
||||
.pdata = {
|
||||
.name = "tesla",
|
||||
.nr_tlb_entries = 32,
|
||||
.clk_name = "dsp_fck",
|
||||
.da_start = 0x0,
|
||||
.da_end = 0xFFFFF000,
|
||||
},
|
||||
},
|
||||
};
|
||||
#define NR_OMAP4_IOMMU_DEVICES ARRAY_SIZE(omap4_devices)
|
||||
static struct platform_device *omap4_iommu_pdev[NR_OMAP4_IOMMU_DEVICES];
|
||||
#else
|
||||
#define omap4_devices NULL
|
||||
#define NR_OMAP4_IOMMU_DEVICES 0
|
||||
#define omap4_iommu_pdev NULL
|
||||
#endif
|
||||
if (oh->rst_lines_cnt == 1) {
|
||||
pdata->reset_name = oh->rst_lines->name;
|
||||
pdata->assert_reset = omap_device_assert_hardreset;
|
||||
pdata->deassert_reset = omap_device_deassert_hardreset;
|
||||
}
|
||||
|
||||
static struct platform_device **omap_iommu_pdev;
|
||||
pdev = omap_device_build("omap-iommu", i, oh, pdata, sizeof(*pdata),
|
||||
NULL, 0, 0);
|
||||
|
||||
kfree(pdata);
|
||||
|
||||
if (IS_ERR(pdev)) {
|
||||
pr_err("%s: device build err: %ld\n", __func__, PTR_ERR(pdev));
|
||||
return PTR_ERR(pdev);
|
||||
}
|
||||
|
||||
i++;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __init omap_iommu_init(void)
|
||||
{
|
||||
int i, err;
|
||||
struct resource res[] = {
|
||||
{ .flags = IORESOURCE_MEM },
|
||||
{ .flags = IORESOURCE_IRQ },
|
||||
};
|
||||
|
||||
if (cpu_is_omap34xx()) {
|
||||
devices = omap3_devices;
|
||||
omap_iommu_pdev = omap3_iommu_pdev;
|
||||
num_iommu_devices = NR_OMAP3_IOMMU_DEVICES;
|
||||
} else if (cpu_is_omap44xx()) {
|
||||
devices = omap4_devices;
|
||||
omap_iommu_pdev = omap4_iommu_pdev;
|
||||
num_iommu_devices = NR_OMAP4_IOMMU_DEVICES;
|
||||
} else
|
||||
return -ENODEV;
|
||||
|
||||
for (i = 0; i < num_iommu_devices; i++) {
|
||||
struct platform_device *pdev;
|
||||
const struct iommu_device *d = &devices[i];
|
||||
|
||||
pdev = platform_device_alloc("omap-iommu", i);
|
||||
if (!pdev) {
|
||||
err = -ENOMEM;
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
res[0].start = d->base;
|
||||
res[0].end = d->base + MMU_REG_SIZE - 1;
|
||||
res[1].start = res[1].end = d->irq;
|
||||
|
||||
err = platform_device_add_resources(pdev, res,
|
||||
ARRAY_SIZE(res));
|
||||
if (err)
|
||||
goto err_out;
|
||||
err = platform_device_add_data(pdev, &d->pdata,
|
||||
sizeof(d->pdata));
|
||||
if (err)
|
||||
goto err_out;
|
||||
err = platform_device_add(pdev);
|
||||
if (err)
|
||||
goto err_out;
|
||||
omap_iommu_pdev[i] = pdev;
|
||||
}
|
||||
return 0;
|
||||
|
||||
err_out:
|
||||
while (i--)
|
||||
platform_device_put(omap_iommu_pdev[i]);
|
||||
return err;
|
||||
return omap_hwmod_for_each_by_class("mmu", omap_iommu_dev_init, NULL);
|
||||
}
|
||||
/* must be ready before omap3isp is probed */
|
||||
subsys_initcall(omap_iommu_init);
|
||||
|
||||
static void __exit omap_iommu_exit(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < num_iommu_devices; i++)
|
||||
platform_device_unregister(omap_iommu_pdev[i]);
|
||||
/* Do nothing */
|
||||
}
|
||||
module_exit(omap_iommu_exit);
|
||||
|
||||
|
||||
@@ -653,7 +653,7 @@ static struct omap_hwmod omap44xx_dsp_hwmod = {
|
||||
.mpu_irqs = omap44xx_dsp_irqs,
|
||||
.rst_lines = omap44xx_dsp_resets,
|
||||
.rst_lines_cnt = ARRAY_SIZE(omap44xx_dsp_resets),
|
||||
.main_clk = "dsp_fck",
|
||||
.main_clk = "dpll_iva_m4x2_ck",
|
||||
.prcm = {
|
||||
.omap4 = {
|
||||
.clkctrl_offs = OMAP4_CM_TESLA_TESLA_CLKCTRL_OFFSET,
|
||||
@@ -1679,7 +1679,7 @@ static struct omap_hwmod omap44xx_ipu_hwmod = {
|
||||
.mpu_irqs = omap44xx_ipu_irqs,
|
||||
.rst_lines = omap44xx_ipu_resets,
|
||||
.rst_lines_cnt = ARRAY_SIZE(omap44xx_ipu_resets),
|
||||
.main_clk = "ipu_fck",
|
||||
.main_clk = "ducati_clk_mux_ck",
|
||||
.prcm = {
|
||||
.omap4 = {
|
||||
.clkctrl_offs = OMAP4_CM_DUCATI_DUCATI_CLKCTRL_OFFSET,
|
||||
|
||||
@@ -50,6 +50,7 @@ static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t dev_addr)
|
||||
static inline int dma_mapping_error(struct device *dev, dma_addr_t dev_addr)
|
||||
{
|
||||
struct dma_map_ops *ops = get_dma_ops(dev);
|
||||
debug_dma_mapping_error(dev, dev_addr);
|
||||
return ops->mapping_error(dev, dev_addr);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ static inline int dma_set_mask(struct device *dev, u64 dma_mask)
|
||||
*/
|
||||
static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
|
||||
{
|
||||
debug_dma_mapping_error(dev, dma_addr);
|
||||
return dma_addr == ~0;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ static inline void dma_free_attrs(struct device *dev, size_t size,
|
||||
static inline int dma_mapping_error(struct device *dev, dma_addr_t daddr)
|
||||
{
|
||||
struct dma_map_ops *ops = platform_dma_get_ops(dev);
|
||||
debug_dma_mapping_error(dev, daddr);
|
||||
return ops->mapping_error(dev, daddr);
|
||||
}
|
||||
|
||||
|
||||
@@ -114,6 +114,8 @@ static inline void __dma_sync(unsigned long paddr,
|
||||
static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
|
||||
{
|
||||
struct dma_map_ops *ops = get_dma_ops(dev);
|
||||
|
||||
debug_dma_mapping_error(dev, dma_addr);
|
||||
if (ops->mapping_error)
|
||||
return ops->mapping_error(dev, dma_addr);
|
||||
|
||||
|
||||
@@ -40,6 +40,8 @@ static inline int dma_supported(struct device *dev, u64 mask)
|
||||
static inline int dma_mapping_error(struct device *dev, u64 mask)
|
||||
{
|
||||
struct dma_map_ops *ops = get_dma_ops(dev);
|
||||
|
||||
debug_dma_mapping_error(dev, mask);
|
||||
return ops->mapping_error(dev, mask);
|
||||
}
|
||||
|
||||
|
||||
@@ -172,6 +172,7 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
|
||||
{
|
||||
struct dma_map_ops *dma_ops = get_dma_ops(dev);
|
||||
|
||||
debug_dma_mapping_error(dev, dma_addr);
|
||||
if (dma_ops->mapping_error)
|
||||
return dma_ops->mapping_error(dev, dma_addr);
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
|
||||
{
|
||||
struct dma_map_ops *ops = get_dma_ops(dev);
|
||||
|
||||
debug_dma_mapping_error(dev, dma_addr);
|
||||
if (ops->mapping_error)
|
||||
return ops->mapping_error(dev, dma_addr);
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ static inline void dma_free_attrs(struct device *dev, size_t size,
|
||||
|
||||
static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
|
||||
{
|
||||
debug_dma_mapping_error(dev, dma_addr);
|
||||
return (dma_addr == DMA_ERROR_CODE);
|
||||
}
|
||||
|
||||
|
||||
@@ -72,6 +72,7 @@ static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
|
||||
static inline int
|
||||
dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
|
||||
{
|
||||
debug_dma_mapping_error(dev, dma_addr);
|
||||
return get_dma_ops(dev)->mapping_error(dev, dma_addr);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev)
|
||||
static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
|
||||
{
|
||||
struct dma_map_ops *ops = get_dma_ops(dev);
|
||||
debug_dma_mapping_error(dev, dma_addr);
|
||||
if (ops->mapping_error)
|
||||
return ops->mapping_error(dev, dma_addr);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user