* [PATCH 1/1] iommu/tegra: smmu: Add DMA window parser [not found] ` <20120518085051.4a0fca863c5ab37cf8d42cb1-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> @ 2012-05-18 6:43 ` Hiroshi DOYU 2012-05-18 15:15 ` Stephen Warren 0 siblings, 1 reply; 17+ messages in thread From: Hiroshi DOYU @ 2012-05-18 6:43 UTC (permalink / raw) To: hdoyu-DDmLM1+adcrQT0dZR+AlfA, joerg.roedel-5C7GfCeVMHo, swarren-3lzwWm7+Weoh9ZMKESR00Q Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Thierry Reding, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring, Grant Likely, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA, linux-tegra-u79uwXL29TY76Z2rM5mHXA This code was based on: "arch/microblaze/kernel/prom_parse.c" "arch/powerpc/kernel/prom_parse.c" Can be promoted as a global function for general use. Signed-off-by: Hiroshi DOYU <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> --- Based on the discussion: http://marc.info/?l=linux-tegra&m=133732046606458&w=2 --- drivers/iommu/tegra-smmu.c | 50 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 50 insertions(+), 0 deletions(-) diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index 192fc4a..7fc444b 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c @@ -874,6 +874,56 @@ static struct iommu_ops smmu_iommu_ops = { .pgsize_bitmap = SMMU_IOMMU_PGSIZES, }; +static int of_get_dma_window(struct device_node *dn, + const char *propname, int index, + unsigned long *busno, + dma_addr_t *addr, size_t *size) +{ + const __be32 *dma_window, *end; + int bytes, cur_index = 0; + + if (!dn || !addr || !size) + return -EINVAL; + + if (!propname) + propname = "dma-window"; + + dma_window = of_get_property(dn, propname, &bytes); + if (!dma_window) + return -ENODEV; + end = dma_window + bytes / sizeof(*dma_window); + + while (dma_window < end) { + u32 cells; + const void *prop; + + /* busno is always one cell */ + if (busno) + *busno = be32_to_cpup(dma_window++); + + prop = of_get_property(dn, "#dma-address-cells", NULL); + if (!prop) + prop = of_get_property(dn, "#address-cells", NULL); + + cells = prop ? be32_to_cpup(prop) : of_n_addr_cells(dn); + if (!cells) + return -EINVAL; + *addr = of_read_number(dma_window, cells); + dma_window += cells; + + prop = of_get_property(dn, "#dma-size-cells", NULL); + cells = prop ? be32_to_cpup(prop) : of_n_size_cells(dn); + if (!cells) + return -EINVAL; + *size = of_read_number(dma_window, cells); + dma_window += cells; + + if (cur_index++ == index) + break; + } + return 0; +} + static int tegra_smmu_suspend(struct device *dev) { struct smmu_device *smmu = dev_get_drvdata(dev); -- 1.7.5.4 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 1/1] iommu/tegra: smmu: Add DMA window parser 2012-05-18 6:43 ` [PATCH 1/1] iommu/tegra: smmu: Add DMA window parser Hiroshi DOYU @ 2012-05-18 15:15 ` Stephen Warren [not found] ` <4FB66796.1030007-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> 0 siblings, 1 reply; 17+ messages in thread From: Stephen Warren @ 2012-05-18 15:15 UTC (permalink / raw) To: Hiroshi DOYU Cc: joerg.roedel, iommu, linux-tegra, linux-kernel, Grant Likely, Rob Herring, Thierry Reding, devicetree-discuss On 05/18/2012 12:43 AM, Hiroshi DOYU wrote: > This code was based on: > "arch/microblaze/kernel/prom_parse.c" > "arch/powerpc/kernel/prom_parse.c" > > Can be promoted as a global function for general use. > > Signed-off-by: Hiroshi DOYU <hdoyu@nvidia.com> Hiroshi, Once this is accepted, it might be worth following up on the original of_get_dma_window thread and noting that once it's approved, an updated version of the patch will be needed to remove this code at the same time. A couple comments below though: > +static int of_get_dma_window(struct device_node *dn, > + const char *propname, int index, > + unsigned long *busno, > + dma_addr_t *addr, size_t *size) > +{ > + const __be32 *dma_window, *end; > + int bytes, cur_index = 0; Since bytes is an out parameter from of_get_property, do you need to wrap the declaration in uninitialized_var() to prevent a compile warning like the other patch you sent me downstream? > + if (!dn || !addr || !size) > + return -EINVAL; > + > + if (!propname) > + propname = "dma-window"; > + > + dma_window = of_get_property(dn, propname, &bytes); > + if (!dma_window) > + return -ENODEV; > + end = dma_window + bytes / sizeof(*dma_window); > + > + while (dma_window < end) { > + u32 cells; > + const void *prop; > + > + /* busno is always one cell */ > + if (busno) > + *busno = be32_to_cpup(dma_window++); Shouldn't the ++ happen even if (!busno)? Once those are fixed, in the interests of fixing the compile error, Acked-by: Stephen Warren <swarren@wwwdotorg.org> ^ permalink raw reply [flat|nested] 17+ messages in thread
[parent not found: <4FB66796.1030007-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>]
* Re: [PATCH 1/1] iommu/tegra: smmu: Add DMA window parser [not found] ` <4FB66796.1030007-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> @ 2012-05-18 20:56 ` Hiroshi Doyu [not found] ` <20120518.235619.175499431618565933.hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 0 siblings, 1 reply; 17+ messages in thread From: Hiroshi Doyu @ 2012-05-18 20:56 UTC (permalink / raw) To: joerg.roedel-5C7GfCeVMHo@public.gmane.org, swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org, arnd-r2nGTMty4D4@public.gmane.org Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org, rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org, thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org Hi Stephen, Joerg, Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> wrote @ Fri, 18 May 2012 17:15:34 +0200: > On 05/18/2012 12:43 AM, Hiroshi DOYU wrote: > > This code was based on: > > "arch/microblaze/kernel/prom_parse.c" > > "arch/powerpc/kernel/prom_parse.c" > > > > Can be promoted as a global function for general use. > > > > Signed-off-by: Hiroshi DOYU <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> > > Hiroshi, > > Once this is accepted, it might be worth following up on the original > of_get_dma_window thread and noting that once it's approved, an updated > version of the patch will be needed to remove this code at the same time. > > A couple comments below though: > > > +static int of_get_dma_window(struct device_node *dn, > > + const char *propname, int index, > > + unsigned long *busno, > > + dma_addr_t *addr, size_t *size) > > +{ > > + const __be32 *dma_window, *end; > > + int bytes, cur_index = 0; > > Since bytes is an out parameter from of_get_property, do you need to > wrap the declaration in uninitialized_var() to prevent a compile warning > like the other patch you sent me downstream? > > > + if (!dn || !addr || !size) > > + return -EINVAL; > > + > > + if (!propname) > > + propname = "dma-window"; > > + > > + dma_window = of_get_property(dn, propname, &bytes); > > + if (!dma_window) > > + return -ENODEV; > > + end = dma_window + bytes / sizeof(*dma_window); > > + > > + while (dma_window < end) { > > + u32 cells; > > + const void *prop; > > + > > + /* busno is always one cell */ > > + if (busno) > > + *busno = be32_to_cpup(dma_window++); > > Shouldn't the ++ happen even if (!busno)? Hm...the above code happens to work with our "dma-window" format right now, but most likely this seems incmpatible with "ibm,dma-window" format. I couldn't find the official format previously. I'm wondering that those "(ibm,)dma-window" and "(ibm,)dma-range" may be able to be generally used since those parameters are quite common to any IOMMUs. I'll hold off those patches at least this time Joerg, as Stephen proposed originally. Could you please revert or drop the original one this time? [PATCH 1/2] iommu/tegra: smmu: Add device tree support for SMMU PS: I'm being off-line'd mostly next four weeks, and my response would be delayed. ^ permalink raw reply [flat|nested] 17+ messages in thread
[parent not found: <20120518.235619.175499431618565933.hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH 1/1] iommu/tegra: smmu: Add DMA window parser [not found] ` <20120518.235619.175499431618565933.hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> @ 2012-05-21 12:47 ` joerg.roedel-5C7GfCeVMHo [not found] ` <20120521124707.GC2604-5C7GfCeVMHo@public.gmane.org> 0 siblings, 1 reply; 17+ messages in thread From: joerg.roedel-5C7GfCeVMHo @ 2012-05-21 12:47 UTC (permalink / raw) To: Hiroshi Doyu Cc: arnd-r2nGTMty4D4@public.gmane.org, swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org, thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org, grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On Fri, May 18, 2012 at 10:56:19PM +0200, Hiroshi Doyu wrote: > Joerg, as Stephen proposed originally. Could you please revert or drop > the original one this time? > > [PATCH 1/2] iommu/tegra: smmu: Add device tree support for SMMU I removed the patch from my tree. Regards, Joerg -- AMD Operating System Research Center Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach General Managers: Alberto Bozzo Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632 ^ permalink raw reply [flat|nested] 17+ messages in thread
[parent not found: <20120521124707.GC2604-5C7GfCeVMHo@public.gmane.org>]
* [PATCH 1/5] iommu/tegra: smmu: Add DMA window parser, of_get_dma_window() [not found] ` <20120521124707.GC2604-5C7GfCeVMHo@public.gmane.org> @ 2012-06-20 7:16 ` Hiroshi DOYU [not found] ` <1340176620-13012-1-git-send-email-hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 0 siblings, 1 reply; 17+ messages in thread From: Hiroshi DOYU @ 2012-06-20 7:16 UTC (permalink / raw) To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA, Hiroshi DOYU From: Hiroshi Doyu <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> This code was based on: "arch/microblaze/kernel/prom_parse.c" "arch/powerpc/kernel/prom_parse.c" Can be promoted as a global function for general use to replace "of_parse_dma_window()" in the above. This supports different formats flexibly. "prefix" can be configured if any. "busno" and "index" are optionally specified. Set NULL and 0 if not used. Signed-off-by: Hiroshi DOYU <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> --- Based on the discussion: http://marc.info/?l=linux-tegra&m=133732046606458&w=2 --- drivers/iommu/tegra-smmu.c | 70 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 70 insertions(+), 0 deletions(-) diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index ecd6790..6f87ae4 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c @@ -30,6 +30,7 @@ #include <linux/sched.h> #include <linux/iommu.h> #include <linux/io.h> +#include <linux/of.h> #include <asm/page.h> #include <asm/cacheflush.h> @@ -858,6 +859,75 @@ static struct iommu_ops smmu_iommu_ops = { .pgsize_bitmap = SMMU_IOMMU_PGSIZES, }; +/** + * of_get_dma_window - Parse *dma-window property and returns 0 if found. + * + * @dn: device node + * @prefix: prefix for property name if any + * @index: index to start to parse + * @busno: Returns busno if supported. Otherwise pass NULL + * @addr: Returns address that DMA starts + * @size: Returns the range that DMA can handle + * + * This supports different formats flexibly. "prefix" can be + * configured if any. "busno" and "index" are optionally + * specified. Set 0(or NULL) if not used. + */ +static int of_get_dma_window(struct device_node *dn, + const char *prefix, int index, + unsigned long *busno, + dma_addr_t *addr, size_t *size) +{ + const __be32 *dma_window, *end; + int bytes, cur_index = 0; + char propname[NAME_MAX], addrname[NAME_MAX], sizename[NAME_MAX]; + const char *s = ""; + + if (!dn || !addr || !size) + return -EINVAL; + + if (prefix) + s = prefix; + snprintf(propname, sizeof(propname), "%sdma-window", s); + snprintf(addrname, sizeof(addrname), "%s#dma-address-cells", s); + snprintf(sizename, sizeof(sizename), "%s#dma-size-cells", s); + + dma_window = of_get_property(dn, propname, &bytes); + if (!dma_window) + return -ENODEV; + end = dma_window + bytes / sizeof(*dma_window); + + while (dma_window < end) { + u32 cells; + const void *prop; + + /* busno is one cell if supported */ + if (busno) + *busno = be32_to_cpup(dma_window++); + + prop = of_get_property(dn, addrname, NULL); + if (!prop) + prop = of_get_property(dn, "#address-cells", NULL); + + cells = prop ? be32_to_cpup(prop) : of_n_addr_cells(dn); + if (!cells) + return -EINVAL; + *addr = of_read_number(dma_window, cells); + dma_window += cells; + + prop = of_get_property(dn, sizename, NULL); + cells = prop ? be32_to_cpup(prop) : of_n_size_cells(dn); + if (!cells) + return -EINVAL; + *size = of_read_number(dma_window, cells); + dma_window += cells; + + if (cur_index++ == index) + break; + } + return 0; +} + static int tegra_smmu_suspend(struct device *dev) { struct smmu_device *smmu = dev_get_drvdata(dev); -- 1.7.5.4 ^ permalink raw reply related [flat|nested] 17+ messages in thread
[parent not found: <1340176620-13012-1-git-send-email-hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>]
* [PATCH 2/5] iommu/tegra: smmu: Add device tree support for SMMU [not found] ` <1340176620-13012-1-git-send-email-hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> @ 2012-06-20 7:16 ` Hiroshi DOYU [not found] ` <1340176620-13012-2-git-send-email-hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 2012-06-20 7:16 ` [PATCH 3/5] iommu/tegra: smmu: Simplify allocation at once Hiroshi DOYU ` (3 subsequent siblings) 4 siblings, 1 reply; 17+ messages in thread From: Hiroshi DOYU @ 2012-06-20 7:16 UTC (permalink / raw) To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA, Hiroshi Doyu From: Hiroshi Doyu <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> From: Hiroshi Doyu <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> The necessary info is expected to pass from DT. For more precise resource reservation, there shouldn't be any overlapping of register range between SMMU and MC. SMMU register offset needs to be calculated correctly, based on its register bank. Signed-off-by: Hiroshi DOYU <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> Acked-by: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> --- .../bindings/iommu/nvidia,tegra30-smmu.txt | 21 +++ drivers/iommu/Kconfig | 2 +- drivers/iommu/tegra-smmu.c | 147 ++++++++++++------- 3 files changed, 115 insertions(+), 55 deletions(-) diff --git a/Documentation/devicetree/bindings/iommu/nvidia,tegra30-smmu.txt b/Documentation/devicetree/bindings/iommu/nvidia,tegra30-smmu.txt new file mode 100644 index 0000000..89fb543 --- /dev/null +++ b/Documentation/devicetree/bindings/iommu/nvidia,tegra30-smmu.txt @@ -0,0 +1,21 @@ +NVIDIA Tegra 30 IOMMU H/W, SMMU (System Memory Management Unit) + +Required properties: +- compatible : "nvidia,tegra30-smmu" +- reg : Should contain 3 register banks(address and length) for each + of the SMMU register blocks. +- interrupts : Should contain MC General interrupt. +- nvidia,#asids : # of ASIDs +- dma-window : IOVA start address and length. +- nvidia,ahb : phandle to the ahb bus connected to SMMU. + +Example: + smmu { + compatible = "nvidia,tegra30-smmu"; + reg = <0x7000f010 0x02c + 0x7000f1f0 0x010 + 0x7000f228 0x05c>; + nvidia,#asids = <4>; /* # of ASIDs */ + dma-window = <0 0x40000000>; /* IOVA start & length */ + nvidia,ahb = <&ahb>; + }; diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index 3408937..969fc4b 100644 --- a/drivers/iommu/Kconfig +++ b/drivers/iommu/Kconfig @@ -154,7 +154,7 @@ config TEGRA_IOMMU_GART config TEGRA_IOMMU_SMMU bool "Tegra SMMU IOMMU Support" - depends on ARCH_TEGRA_3x_SOC + depends on ARCH_TEGRA_3x_SOC && TEGRA_AHB select IOMMU_API help Enables support for remapping discontiguous physical memory diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index 6f87ae4..9ebb887 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c @@ -37,6 +37,7 @@ #include <mach/iomap.h> #include <mach/smmu.h> +#include <mach/tegra-ahb.h> /* bitmap of the page sizes currently supported */ #define SMMU_IOMMU_PGSIZES (SZ_4K) @@ -112,12 +113,6 @@ #define SMMU_PDE_NEXT_SHIFT 28 -/* AHB Arbiter Registers */ -#define AHB_XBAR_CTRL 0xe0 -#define AHB_XBAR_CTRL_SMMU_INIT_DONE_DONE 1 -#define AHB_XBAR_CTRL_SMMU_INIT_DONE_SHIFT 17 - -#define SMMU_NUM_ASIDS 4 #define SMMU_TLB_FLUSH_VA_SECTION__MASK 0xffc00000 #define SMMU_TLB_FLUSH_VA_SECTION__SHIFT 12 /* right shift */ #define SMMU_TLB_FLUSH_VA_GROUP__MASK 0xffffc000 @@ -137,6 +132,7 @@ #define SMMU_PAGE_SHIFT 12 #define SMMU_PAGE_SIZE (1 << SMMU_PAGE_SHIFT) +#define SMMU_PAGE_MASK ((1 << SMMU_PAGE_SHIFT) - 1) #define SMMU_PDIR_COUNT 1024 #define SMMU_PDIR_SIZE (sizeof(unsigned long) * SMMU_PDIR_COUNT) @@ -178,6 +174,8 @@ #define SMMU_ASID_DISABLE 0 #define SMMU_ASID_ASID(n) ((n) & ~SMMU_ASID_ENABLE(0)) +#define NUM_SMMU_REG_BANKS 3 + #define smmu_client_enable_hwgrp(c, m) smmu_client_set_hwgrp(c, m, 1) #define smmu_client_disable_hwgrp(c) smmu_client_set_hwgrp(c, 0, 0) #define __smmu_client_enable_hwgrp(c, m) __smmu_client_set_hwgrp(c, m, 1) @@ -236,7 +234,7 @@ struct smmu_as { * Per SMMU device - IOMMU device */ struct smmu_device { - void __iomem *regs, *regs_ahbarb; + void __iomem *regs[NUM_SMMU_REG_BANKS]; unsigned long iovmm_base; /* remappable base address */ unsigned long page_count; /* total remappable size */ spinlock_t lock; @@ -253,29 +251,47 @@ struct smmu_device { unsigned long translation_enable_1; unsigned long translation_enable_2; unsigned long asid_security; + + struct device_node *ahb; }; static struct smmu_device *smmu_handle; /* unique for a system */ /* - * SMMU/AHB register accessors + * SMMU register accessors */ static inline u32 smmu_read(struct smmu_device *smmu, size_t offs) { - return readl(smmu->regs + offs); -} -static inline void smmu_write(struct smmu_device *smmu, u32 val, size_t offs) -{ - writel(val, smmu->regs + offs); + BUG_ON(offs < 0x10); + if (offs < 0x3c) + return readl(smmu->regs[0] + offs - 0x10); + BUG_ON(offs < 0x1f0); + if (offs < 0x200) + return readl(smmu->regs[1] + offs - 0x1f0); + BUG_ON(offs < 0x228); + if (offs < 0x284) + return readl(smmu->regs[2] + offs - 0x228); + BUG(); } -static inline u32 ahb_read(struct smmu_device *smmu, size_t offs) -{ - return readl(smmu->regs_ahbarb + offs); -} -static inline void ahb_write(struct smmu_device *smmu, u32 val, size_t offs) +static inline void smmu_write(struct smmu_device *smmu, u32 val, size_t offs) { - writel(val, smmu->regs_ahbarb + offs); + BUG_ON(offs < 0x10); + if (offs < 0x3c) { + writel(val, smmu->regs[0] + offs - 0x10); + return; + } + BUG_ON(offs < 0x1f0); + if (offs < 0x200) { + writel(val, smmu->regs[1] + offs - 0x1f0); + return; + } + BUG_ON(offs < 0x228); + if (offs < 0x284) { + writel(val, smmu->regs[2] + offs - 0x228); + return; + } + BUG(); } #define VA_PAGE_TO_PA(va, page) \ @@ -371,7 +387,7 @@ static void smmu_flush_regs(struct smmu_device *smmu, int enable) FLUSH_SMMU_REGS(smmu); } -static void smmu_setup_regs(struct smmu_device *smmu) +static int smmu_setup_regs(struct smmu_device *smmu) { int i; u32 val; @@ -399,10 +415,7 @@ static void smmu_setup_regs(struct smmu_device *smmu) smmu_flush_regs(smmu, 1); - val = ahb_read(smmu, AHB_XBAR_CTRL); - val |= AHB_XBAR_CTRL_SMMU_INIT_DONE_DONE << - AHB_XBAR_CTRL_SMMU_INIT_DONE_SHIFT; - ahb_write(smmu, val, AHB_XBAR_CTRL); + return tegra_ahb_enable_smmu(smmu->ahb); } static void flush_ptc_and_tlb(struct smmu_device *smmu, @@ -943,52 +956,72 @@ static int tegra_smmu_resume(struct device *dev) { struct smmu_device *smmu = dev_get_drvdata(dev); unsigned long flags; + int err; spin_lock_irqsave(&smmu->lock, flags); - smmu_setup_regs(smmu); + err = smmu_setup_regs(smmu); spin_unlock_irqrestore(&smmu->lock, flags); - return 0; + return err; } static int tegra_smmu_probe(struct platform_device *pdev) { struct smmu_device *smmu; - struct resource *regs, *regs2, *window; struct device *dev = &pdev->dev; - int i, err = 0; + int i, asids, err = 0; + dma_addr_t base; + size_t size; + const void *prop; if (smmu_handle) return -EIO; BUILD_BUG_ON(PAGE_SHIFT != SMMU_PAGE_SHIFT); - regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); - regs2 = platform_get_resource(pdev, IORESOURCE_MEM, 1); - window = platform_get_resource(pdev, IORESOURCE_MEM, 2); - if (!regs || !regs2 || !window) { - dev_err(dev, "No SMMU resources\n"); - return -ENODEV; - } - smmu = devm_kzalloc(dev, sizeof(*smmu), GFP_KERNEL); if (!smmu) { dev_err(dev, "failed to allocate smmu_device\n"); return -ENOMEM; } - smmu->dev = dev; - smmu->num_as = SMMU_NUM_ASIDS; - smmu->iovmm_base = (unsigned long)window->start; - smmu->page_count = resource_size(window) >> SMMU_PAGE_SHIFT; - smmu->regs = devm_ioremap(dev, regs->start, resource_size(regs)); - smmu->regs_ahbarb = devm_ioremap(dev, regs2->start, - resource_size(regs2)); - if (!smmu->regs || !smmu->regs_ahbarb) { - dev_err(dev, "failed to remap SMMU registers\n"); - err = -ENXIO; - goto fail; + for (i = 0; i < ARRAY_SIZE(smmu->regs); i++) { + struct resource *res; + + res = platform_get_resource(pdev, IORESOURCE_MEM, i); + if (!res) + return -ENODEV; + smmu->regs[i] = devm_request_and_ioremap(&pdev->dev, res); + if (!smmu->regs[i]) + return -EBUSY; } + err = of_get_dma_window(dev->of_node, NULL, 0, NULL, &base, &size); + if (err) + return -ENODEV; + + if (size & SMMU_PAGE_MASK) + return -EINVAL; + + size >>= SMMU_PAGE_SHIFT; + if (!size) + return -EINVAL; + + prop = of_get_property(dev->of_node, "nvidia,#asids", NULL); + if (!prop) + return -ENODEV; + asids = be32_to_cpup(prop); + if (!asids) + return -ENODEV; + + smmu->ahb = of_parse_phandle(dev->of_node, "nvidia,ahb", 0); + if (!smmu->ahb) + return -ENODEV; + + smmu->dev = dev; + smmu->num_as = asids; + smmu->iovmm_base = base; + smmu->page_count = size; + smmu->translation_enable_0 = ~0; smmu->translation_enable_1 = ~0; smmu->translation_enable_2 = ~0; @@ -1015,7 +1048,9 @@ static int tegra_smmu_probe(struct platform_device *pdev) INIT_LIST_HEAD(&as->client); } spin_lock_init(&smmu->lock); - smmu_setup_regs(smmu); + err = smmu_setup_regs(smmu); + if (err) + goto fail; platform_set_drvdata(pdev, smmu); smmu->avp_vector_page = alloc_page(GFP_KERNEL); @@ -1028,10 +1063,6 @@ static int tegra_smmu_probe(struct platform_device *pdev) fail: if (smmu->avp_vector_page) __free_page(smmu->avp_vector_page); - if (smmu->regs) - devm_iounmap(dev, smmu->regs); - if (smmu->regs_ahbarb) - devm_iounmap(dev, smmu->regs_ahbarb); if (smmu && smmu->as) { for (i = 0; i < smmu->num_as; i++) { if (smmu->as[i].pdir_page) { @@ -1063,8 +1094,6 @@ static int tegra_smmu_remove(struct platform_device *pdev) __free_page(smmu->avp_vector_page); if (smmu->regs) devm_iounmap(dev, smmu->regs); - if (smmu->regs_ahbarb) - devm_iounmap(dev, smmu->regs_ahbarb); devm_kfree(dev, smmu); smmu_handle = NULL; return 0; @@ -1075,6 +1104,14 @@ const struct dev_pm_ops tegra_smmu_pm_ops = { .resume = tegra_smmu_resume, }; +#ifdef CONFIG_OF +static struct of_device_id tegra_smmu_of_match[] __devinitdata = { + { .compatible = "nvidia,tegra30-smmu", }, + { }, +}; +MODULE_DEVICE_TABLE(of, tegra_smmu_of_match); +#endif + static struct platform_driver tegra_smmu_driver = { .probe = tegra_smmu_probe, .remove = tegra_smmu_remove, @@ -1082,6 +1119,7 @@ static struct platform_driver tegra_smmu_driver = { .owner = THIS_MODULE, .name = "tegra-smmu", .pm = &tegra_smmu_pm_ops, + .of_match_table = of_match_ptr(tegra_smmu_of_match), }, }; @@ -1101,4 +1139,5 @@ module_exit(tegra_smmu_exit); MODULE_DESCRIPTION("IOMMU API for SMMU in Tegra30"); MODULE_AUTHOR("Hiroshi DOYU <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>"); +MODULE_ALIAS("platform:tegra-smmu"); MODULE_LICENSE("GPL v2"); -- 1.7.5.4 ^ permalink raw reply related [flat|nested] 17+ messages in thread
[parent not found: <1340176620-13012-2-git-send-email-hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>]
* [v2 2/5] iommu/tegra: smmu: Add device tree support for SMMU [not found] ` <1340176620-13012-2-git-send-email-hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> @ 2012-06-21 8:31 ` Hiroshi Doyu 0 siblings, 0 replies; 17+ messages in thread From: Hiroshi Doyu @ 2012-06-21 8:31 UTC (permalink / raw) To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org From: Hiroshi Doyu <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> The necessary info is expected to pass from DT. For more precise resource reservation, there shouldn't be any overlapping of register range between SMMU and MC. SMMU register offset needs to be calculated correctly, based on its register bank. Signed-off-by: Hiroshi DOYU <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> Acked-by: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> --- Update: Header files are added because of the removal of of_get_dma_window(). --- .../bindings/iommu/nvidia,tegra30-smmu.txt | 21 +++ drivers/iommu/Kconfig | 2 +- drivers/iommu/tegra-smmu.c | 149 +++++++++++++------- 3 files changed, 117 insertions(+), 55 deletions(-) diff --git a/Documentation/devicetree/bindings/iommu/nvidia,tegra30-smmu.txt b/Documentation/devicetree/bindings/iommu/nvidia,tegra30-smmu.txt new file mode 100644 index 0000000..89fb543 --- /dev/null +++ b/Documentation/devicetree/bindings/iommu/nvidia,tegra30-smmu.txt @@ -0,0 +1,21 @@ +NVIDIA Tegra 30 IOMMU H/W, SMMU (System Memory Management Unit) + +Required properties: +- compatible : "nvidia,tegra30-smmu" +- reg : Should contain 3 register banks(address and length) for each + of the SMMU register blocks. +- interrupts : Should contain MC General interrupt. +- nvidia,#asids : # of ASIDs +- dma-window : IOVA start address and length. +- nvidia,ahb : phandle to the ahb bus connected to SMMU. + +Example: + smmu { + compatible = "nvidia,tegra30-smmu"; + reg = <0x7000f010 0x02c + 0x7000f1f0 0x010 + 0x7000f228 0x05c>; + nvidia,#asids = <4>; /* # of ASIDs */ + dma-window = <0 0x40000000>; /* IOVA start & length */ + nvidia,ahb = <&ahb>; + }; diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index 4826af6..9f69b56 100644 --- a/drivers/iommu/Kconfig +++ b/drivers/iommu/Kconfig @@ -158,7 +158,7 @@ config TEGRA_IOMMU_GART config TEGRA_IOMMU_SMMU bool "Tegra SMMU IOMMU Support" - depends on ARCH_TEGRA_3x_SOC + depends on ARCH_TEGRA_3x_SOC && TEGRA_AHB select IOMMU_API help Enables support for remapping discontiguous physical memory diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index ecd6790..2c92b8c 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c @@ -30,12 +30,15 @@ #include <linux/sched.h> #include <linux/iommu.h> #include <linux/io.h> +#include <linux/of.h> +#include <linux/of_iommu.h> #include <asm/page.h> #include <asm/cacheflush.h> #include <mach/iomap.h> #include <mach/smmu.h> +#include <mach/tegra-ahb.h> /* bitmap of the page sizes currently supported */ #define SMMU_IOMMU_PGSIZES (SZ_4K) @@ -111,12 +114,6 @@ #define SMMU_PDE_NEXT_SHIFT 28 -/* AHB Arbiter Registers */ -#define AHB_XBAR_CTRL 0xe0 -#define AHB_XBAR_CTRL_SMMU_INIT_DONE_DONE 1 -#define AHB_XBAR_CTRL_SMMU_INIT_DONE_SHIFT 17 - -#define SMMU_NUM_ASIDS 4 #define SMMU_TLB_FLUSH_VA_SECTION__MASK 0xffc00000 #define SMMU_TLB_FLUSH_VA_SECTION__SHIFT 12 /* right shift */ #define SMMU_TLB_FLUSH_VA_GROUP__MASK 0xffffc000 @@ -136,6 +133,7 @@ #define SMMU_PAGE_SHIFT 12 #define SMMU_PAGE_SIZE (1 << SMMU_PAGE_SHIFT) +#define SMMU_PAGE_MASK ((1 << SMMU_PAGE_SHIFT) - 1) #define SMMU_PDIR_COUNT 1024 #define SMMU_PDIR_SIZE (sizeof(unsigned long) * SMMU_PDIR_COUNT) @@ -177,6 +175,8 @@ #define SMMU_ASID_DISABLE 0 #define SMMU_ASID_ASID(n) ((n) & ~SMMU_ASID_ENABLE(0)) +#define NUM_SMMU_REG_BANKS 3 + #define smmu_client_enable_hwgrp(c, m) smmu_client_set_hwgrp(c, m, 1) #define smmu_client_disable_hwgrp(c) smmu_client_set_hwgrp(c, 0, 0) #define __smmu_client_enable_hwgrp(c, m) __smmu_client_set_hwgrp(c, m, 1) @@ -235,7 +235,7 @@ struct smmu_as { * Per SMMU device - IOMMU device */ struct smmu_device { - void __iomem *regs, *regs_ahbarb; + void __iomem *regs[NUM_SMMU_REG_BANKS]; unsigned long iovmm_base; /* remappable base address */ unsigned long page_count; /* total remappable size */ spinlock_t lock; @@ -252,29 +252,47 @@ struct smmu_device { unsigned long translation_enable_1; unsigned long translation_enable_2; unsigned long asid_security; + + struct device_node *ahb; }; static struct smmu_device *smmu_handle; /* unique for a system */ /* - * SMMU/AHB register accessors + * SMMU register accessors */ static inline u32 smmu_read(struct smmu_device *smmu, size_t offs) { - return readl(smmu->regs + offs); -} -static inline void smmu_write(struct smmu_device *smmu, u32 val, size_t offs) -{ - writel(val, smmu->regs + offs); + BUG_ON(offs < 0x10); + if (offs < 0x3c) + return readl(smmu->regs[0] + offs - 0x10); + BUG_ON(offs < 0x1f0); + if (offs < 0x200) + return readl(smmu->regs[1] + offs - 0x1f0); + BUG_ON(offs < 0x228); + if (offs < 0x284) + return readl(smmu->regs[2] + offs - 0x228); + BUG(); } -static inline u32 ahb_read(struct smmu_device *smmu, size_t offs) -{ - return readl(smmu->regs_ahbarb + offs); -} -static inline void ahb_write(struct smmu_device *smmu, u32 val, size_t offs) +static inline void smmu_write(struct smmu_device *smmu, u32 val, size_t offs) { - writel(val, smmu->regs_ahbarb + offs); + BUG_ON(offs < 0x10); + if (offs < 0x3c) { + writel(val, smmu->regs[0] + offs - 0x10); + return; + } + BUG_ON(offs < 0x1f0); + if (offs < 0x200) { + writel(val, smmu->regs[1] + offs - 0x1f0); + return; + } + BUG_ON(offs < 0x228); + if (offs < 0x284) { + writel(val, smmu->regs[2] + offs - 0x228); + return; + } + BUG(); } #define VA_PAGE_TO_PA(va, page) \ @@ -370,7 +388,7 @@ static void smmu_flush_regs(struct smmu_device *smmu, int enable) FLUSH_SMMU_REGS(smmu); } -static void smmu_setup_regs(struct smmu_device *smmu) +static int smmu_setup_regs(struct smmu_device *smmu) { int i; u32 val; @@ -398,10 +416,7 @@ static void smmu_setup_regs(struct smmu_device *smmu) smmu_flush_regs(smmu, 1); - val = ahb_read(smmu, AHB_XBAR_CTRL); - val |= AHB_XBAR_CTRL_SMMU_INIT_DONE_DONE << - AHB_XBAR_CTRL_SMMU_INIT_DONE_SHIFT; - ahb_write(smmu, val, AHB_XBAR_CTRL); + return tegra_ahb_enable_smmu(smmu->ahb); } static void flush_ptc_and_tlb(struct smmu_device *smmu, @@ -873,52 +888,72 @@ static int tegra_smmu_resume(struct device *dev) { struct smmu_device *smmu = dev_get_drvdata(dev); unsigned long flags; + int err; spin_lock_irqsave(&smmu->lock, flags); - smmu_setup_regs(smmu); + err = smmu_setup_regs(smmu); spin_unlock_irqrestore(&smmu->lock, flags); - return 0; + return err; } static int tegra_smmu_probe(struct platform_device *pdev) { struct smmu_device *smmu; - struct resource *regs, *regs2, *window; struct device *dev = &pdev->dev; - int i, err = 0; + int i, asids, err = 0; + dma_addr_t base; + size_t size; + const void *prop; if (smmu_handle) return -EIO; BUILD_BUG_ON(PAGE_SHIFT != SMMU_PAGE_SHIFT); - regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); - regs2 = platform_get_resource(pdev, IORESOURCE_MEM, 1); - window = platform_get_resource(pdev, IORESOURCE_MEM, 2); - if (!regs || !regs2 || !window) { - dev_err(dev, "No SMMU resources\n"); - return -ENODEV; - } - smmu = devm_kzalloc(dev, sizeof(*smmu), GFP_KERNEL); if (!smmu) { dev_err(dev, "failed to allocate smmu_device\n"); return -ENOMEM; } - smmu->dev = dev; - smmu->num_as = SMMU_NUM_ASIDS; - smmu->iovmm_base = (unsigned long)window->start; - smmu->page_count = resource_size(window) >> SMMU_PAGE_SHIFT; - smmu->regs = devm_ioremap(dev, regs->start, resource_size(regs)); - smmu->regs_ahbarb = devm_ioremap(dev, regs2->start, - resource_size(regs2)); - if (!smmu->regs || !smmu->regs_ahbarb) { - dev_err(dev, "failed to remap SMMU registers\n"); - err = -ENXIO; - goto fail; + for (i = 0; i < ARRAY_SIZE(smmu->regs); i++) { + struct resource *res; + + res = platform_get_resource(pdev, IORESOURCE_MEM, i); + if (!res) + return -ENODEV; + smmu->regs[i] = devm_request_and_ioremap(&pdev->dev, res); + if (!smmu->regs[i]) + return -EBUSY; } + err = of_get_dma_window(dev->of_node, NULL, 0, NULL, &base, &size); + if (err) + return -ENODEV; + + if (size & SMMU_PAGE_MASK) + return -EINVAL; + + size >>= SMMU_PAGE_SHIFT; + if (!size) + return -EINVAL; + + prop = of_get_property(dev->of_node, "nvidia,#asids", NULL); + if (!prop) + return -ENODEV; + asids = be32_to_cpup(prop); + if (!asids) + return -ENODEV; + + smmu->ahb = of_parse_phandle(dev->of_node, "nvidia,ahb", 0); + if (!smmu->ahb) + return -ENODEV; + + smmu->dev = dev; + smmu->num_as = asids; + smmu->iovmm_base = base; + smmu->page_count = size; + smmu->translation_enable_0 = ~0; smmu->translation_enable_1 = ~0; smmu->translation_enable_2 = ~0; @@ -945,7 +980,9 @@ static int tegra_smmu_probe(struct platform_device *pdev) INIT_LIST_HEAD(&as->client); } spin_lock_init(&smmu->lock); - smmu_setup_regs(smmu); + err = smmu_setup_regs(smmu); + if (err) + goto fail; platform_set_drvdata(pdev, smmu); smmu->avp_vector_page = alloc_page(GFP_KERNEL); @@ -958,10 +995,6 @@ static int tegra_smmu_probe(struct platform_device *pdev) fail: if (smmu->avp_vector_page) __free_page(smmu->avp_vector_page); - if (smmu->regs) - devm_iounmap(dev, smmu->regs); - if (smmu->regs_ahbarb) - devm_iounmap(dev, smmu->regs_ahbarb); if (smmu && smmu->as) { for (i = 0; i < smmu->num_as; i++) { if (smmu->as[i].pdir_page) { @@ -993,8 +1026,6 @@ static int tegra_smmu_remove(struct platform_device *pdev) __free_page(smmu->avp_vector_page); if (smmu->regs) devm_iounmap(dev, smmu->regs); - if (smmu->regs_ahbarb) - devm_iounmap(dev, smmu->regs_ahbarb); devm_kfree(dev, smmu); smmu_handle = NULL; return 0; @@ -1005,6 +1036,14 @@ const struct dev_pm_ops tegra_smmu_pm_ops = { .resume = tegra_smmu_resume, }; +#ifdef CONFIG_OF +static struct of_device_id tegra_smmu_of_match[] __devinitdata = { + { .compatible = "nvidia,tegra30-smmu", }, + { }, +}; +MODULE_DEVICE_TABLE(of, tegra_smmu_of_match); +#endif + static struct platform_driver tegra_smmu_driver = { .probe = tegra_smmu_probe, .remove = tegra_smmu_remove, @@ -1012,6 +1051,7 @@ static struct platform_driver tegra_smmu_driver = { .owner = THIS_MODULE, .name = "tegra-smmu", .pm = &tegra_smmu_pm_ops, + .of_match_table = of_match_ptr(tegra_smmu_of_match), }, }; @@ -1031,4 +1071,5 @@ module_exit(tegra_smmu_exit); MODULE_DESCRIPTION("IOMMU API for SMMU in Tegra30"); MODULE_AUTHOR("Hiroshi DOYU <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>"); +MODULE_ALIAS("platform:tegra-smmu"); MODULE_LICENSE("GPL v2"); -- 1.7.5.4 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 3/5] iommu/tegra: smmu: Simplify allocation at once [not found] ` <1340176620-13012-1-git-send-email-hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 2012-06-20 7:16 ` [PATCH 2/5] iommu/tegra: smmu: Add device tree support for SMMU Hiroshi DOYU @ 2012-06-20 7:16 ` Hiroshi DOYU 2012-06-20 7:16 ` [PATCH 4/5] iommu/tegra: smmu: Remove unnecessary cleanups with devm_*() Hiroshi DOYU ` (2 subsequent siblings) 4 siblings, 0 replies; 17+ messages in thread From: Hiroshi DOYU @ 2012-06-20 7:16 UTC (permalink / raw) To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA, Hiroshi Doyu From: Hiroshi Doyu <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> From: Hiroshi Doyu <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> To simplify the code, alloc necessary data at once. Signed-off-by: Hiroshi DOYU <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> Acked-by: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> --- drivers/iommu/tegra-smmu.c | 29 +++++++++-------------------- 1 files changed, 9 insertions(+), 20 deletions(-) diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index 9ebb887..5447f05 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c @@ -240,8 +240,6 @@ struct smmu_device { spinlock_t lock; char *name; struct device *dev; - int num_as; - struct smmu_as *as; /* Run-time allocated array */ struct page *avp_vector_page; /* dummy page shared by all AS's */ /* @@ -253,6 +251,9 @@ struct smmu_device { unsigned long asid_security; struct device_node *ahb; + + int num_as; + struct smmu_as as[0]; /* Run-time allocated array */ }; static struct smmu_device *smmu_handle; /* unique for a system */ @@ -970,15 +971,18 @@ static int tegra_smmu_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int i, asids, err = 0; dma_addr_t base; - size_t size; - const void *prop; + size_t bytes, size; if (smmu_handle) return -EIO; BUILD_BUG_ON(PAGE_SHIFT != SMMU_PAGE_SHIFT); - smmu = devm_kzalloc(dev, sizeof(*smmu), GFP_KERNEL); + if (of_property_read_u32(dev->of_node, "nvidia,#asids", &asids)) + return -ENODEV; + + bytes = sizeof(*smmu) + asids * sizeof(*smmu->as); + smmu = devm_kzalloc(dev, bytes, GFP_KERNEL); if (!smmu) { dev_err(dev, "failed to allocate smmu_device\n"); return -ENOMEM; @@ -1006,13 +1010,6 @@ static int tegra_smmu_probe(struct platform_device *pdev) if (!size) return -EINVAL; - prop = of_get_property(dev->of_node, "nvidia,#asids", NULL); - if (!prop) - return -ENODEV; - asids = be32_to_cpup(prop); - if (!asids) - return -ENODEV; - smmu->ahb = of_parse_phandle(dev->of_node, "nvidia,ahb", 0); if (!smmu->ahb) return -ENODEV; @@ -1027,14 +1024,6 @@ static int tegra_smmu_probe(struct platform_device *pdev) smmu->translation_enable_2 = ~0; smmu->asid_security = 0; - smmu->as = devm_kzalloc(dev, - sizeof(smmu->as[0]) * smmu->num_as, GFP_KERNEL); - if (!smmu->as) { - dev_err(dev, "failed to allocate smmu_as\n"); - err = -ENOMEM; - goto fail; - } - for (i = 0; i < smmu->num_as; i++) { struct smmu_as *as = &smmu->as[i]; -- 1.7.5.4 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 4/5] iommu/tegra: smmu: Remove unnecessary cleanups with devm_*() [not found] ` <1340176620-13012-1-git-send-email-hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 2012-06-20 7:16 ` [PATCH 2/5] iommu/tegra: smmu: Add device tree support for SMMU Hiroshi DOYU 2012-06-20 7:16 ` [PATCH 3/5] iommu/tegra: smmu: Simplify allocation at once Hiroshi DOYU @ 2012-06-20 7:16 ` Hiroshi DOYU 2012-06-20 7:17 ` [PATCH 5/5] iommu/tegra: smmu: Fix uninitialized var warning Hiroshi DOYU 2012-06-20 17:11 ` [PATCH 1/5] iommu/tegra: smmu: Add DMA window parser, of_get_dma_window() Stephen Warren 4 siblings, 0 replies; 17+ messages in thread From: Hiroshi DOYU @ 2012-06-20 7:16 UTC (permalink / raw) To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA From: Hiroshi Doyu <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> From: Hiroshi Doyu <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> Remove unnecessary cleanup procedures with devm_*() functions. Signed-off-by: Hiroshi DOYU <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> Acked-by: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> --- drivers/iommu/tegra-smmu.c | 37 ++++++------------------------------- 1 files changed, 6 insertions(+), 31 deletions(-) diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index 5447f05..3ef7dea 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c @@ -1039,51 +1039,26 @@ static int tegra_smmu_probe(struct platform_device *pdev) spin_lock_init(&smmu->lock); err = smmu_setup_regs(smmu); if (err) - goto fail; + return err; platform_set_drvdata(pdev, smmu); smmu->avp_vector_page = alloc_page(GFP_KERNEL); if (!smmu->avp_vector_page) - goto fail; + return -ENOMEM; smmu_handle = smmu; return 0; - -fail: - if (smmu->avp_vector_page) - __free_page(smmu->avp_vector_page); - if (smmu && smmu->as) { - for (i = 0; i < smmu->num_as; i++) { - if (smmu->as[i].pdir_page) { - ClearPageReserved(smmu->as[i].pdir_page); - __free_page(smmu->as[i].pdir_page); - } - } - devm_kfree(dev, smmu->as); - } - devm_kfree(dev, smmu); - return err; } static int tegra_smmu_remove(struct platform_device *pdev) { struct smmu_device *smmu = platform_get_drvdata(pdev); - struct device *dev = smmu->dev; + int i; smmu_write(smmu, SMMU_CONFIG_DISABLE, SMMU_CONFIG); - platform_set_drvdata(pdev, NULL); - if (smmu->as) { - int i; - - for (i = 0; i < smmu->num_as; i++) - free_pdir(&smmu->as[i]); - devm_kfree(dev, smmu->as); - } - if (smmu->avp_vector_page) - __free_page(smmu->avp_vector_page); - if (smmu->regs) - devm_iounmap(dev, smmu->regs); - devm_kfree(dev, smmu); + for (i = 0; i < smmu->num_as; i++) + free_pdir(&smmu->as[i]); + __free_page(smmu->avp_vector_page); smmu_handle = NULL; return 0; } -- 1.7.5.4 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 5/5] iommu/tegra: smmu: Fix uninitialized var warning [not found] ` <1340176620-13012-1-git-send-email-hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> ` (2 preceding siblings ...) 2012-06-20 7:16 ` [PATCH 4/5] iommu/tegra: smmu: Remove unnecessary cleanups with devm_*() Hiroshi DOYU @ 2012-06-20 7:17 ` Hiroshi DOYU 2012-06-20 17:11 ` [PATCH 1/5] iommu/tegra: smmu: Add DMA window parser, of_get_dma_window() Stephen Warren 4 siblings, 0 replies; 17+ messages in thread From: Hiroshi DOYU @ 2012-06-20 7:17 UTC (permalink / raw) To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA From: Hiroshi Doyu <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> From: Hiroshi Doyu <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> For the compiler warning, uninitizlized var when getting value by a pointer. Signed-off-by: Hiroshi DOYU <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> --- drivers/iommu/tegra-smmu.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index 3ef7dea..536e24c 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c @@ -970,8 +970,8 @@ static int tegra_smmu_probe(struct platform_device *pdev) struct smmu_device *smmu; struct device *dev = &pdev->dev; int i, asids, err = 0; - dma_addr_t base; - size_t bytes, size; + dma_addr_t uninitialized_var(base); + size_t bytes, uninitialized_var(size); if (smmu_handle) return -EIO; -- 1.7.5.4 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 1/5] iommu/tegra: smmu: Add DMA window parser, of_get_dma_window() [not found] ` <1340176620-13012-1-git-send-email-hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> ` (3 preceding siblings ...) 2012-06-20 7:17 ` [PATCH 5/5] iommu/tegra: smmu: Fix uninitialized var warning Hiroshi DOYU @ 2012-06-20 17:11 ` Stephen Warren 2012-06-21 6:46 ` Hiroshi Doyu 4 siblings, 1 reply; 17+ messages in thread From: Stephen Warren @ 2012-06-20 17:11 UTC (permalink / raw) To: Hiroshi DOYU Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA, Grant Likely, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA, Rob Herring On 06/20/2012 01:16 AM, Hiroshi DOYU wrote: > From: Hiroshi Doyu <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> > > This code was based on: > "arch/microblaze/kernel/prom_parse.c" > "arch/powerpc/kernel/prom_parse.c" > > Can be promoted as a global function for general use to replace > "of_parse_dma_window()" in the above. This supports different formats > flexibly. "prefix" can be configured if any. "busno" and "index" are > optionally specified. Set NULL and 0 if not used. > > Signed-off-by: Hiroshi DOYU <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> > --- > Based on the discussion: > http://marc.info/?l=linux-tegra&m=133732046606458&w=2 Hmmm. This function really should be in some common location and available for all drivers to use. Can't we add it to that common location from the start? What prevented the earlier patch that did this from getting merged into 3.5? One thing that might help here would be /not/ to add the common code to drivers/of/of_dma.c as was done in the earlier revisions of this patch - I believe that Grant has been trying to push subsystem-specific OF functionality into files in those individual subsystems, so that drivers/of can be kept for core support. Perhaps this patch should create drivers/iommu/of_iommu.c or similar? But I wonder: Is this function likely to be useful outside of drivers/iommu/ - you mentioned that similar code already exists in the two arch-specific prom_parse.c files; where are the existing users of those functions. If not in drivers/iommu/, then probably drivers/iommu/ isn't a good place to put the new common function... > diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c > +static int of_get_dma_window(struct device_node *dn, > + const char *prefix, int index, > + unsigned long *busno, > + dma_addr_t *addr, size_t *size) > + const char *s = ""; > + if (prefix) > + s = prefix; One minor nit, you could just do this and remove variable s: if (!prefix) prefix = ""; ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 1/5] iommu/tegra: smmu: Add DMA window parser, of_get_dma_window() 2012-06-20 17:11 ` [PATCH 1/5] iommu/tegra: smmu: Add DMA window parser, of_get_dma_window() Stephen Warren @ 2012-06-21 6:46 ` Hiroshi Doyu [not found] ` <20120621.094611.2108645748323641310.hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 0 siblings, 1 reply; 17+ messages in thread From: Hiroshi Doyu @ 2012-06-21 6:46 UTC (permalink / raw) To: swarren@wwwdotorg.org, joerg.roedel@amd.com, arnd@arndb.de Cc: iommu@lists.linux-foundation.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, grant.likely@secretlab.ca, rob.herring@calxeda.com Stephen Warren <swarren@wwwdotorg.org> wrote @ Wed, 20 Jun 2012 19:11:51 +0200: > On 06/20/2012 01:16 AM, Hiroshi DOYU wrote: > > From: Hiroshi Doyu <hdoyu@nvidia.com> > > > > This code was based on: > > "arch/microblaze/kernel/prom_parse.c" > > "arch/powerpc/kernel/prom_parse.c" > > > > Can be promoted as a global function for general use to replace > > "of_parse_dma_window()" in the above. This supports different formats > > flexibly. "prefix" can be configured if any. "busno" and "index" are > > optionally specified. Set NULL and 0 if not used. > > > > Signed-off-by: Hiroshi DOYU <hdoyu@nvidia.com> > > --- > > Based on the discussion: > > http://marc.info/?l=linux-tegra&m=133732046606458&w=2 > > Hmmm. This function really should be in some common location and > available for all drivers to use. Can't we add it to that common > location from the start? What prevented the earlier patch that did this > from getting merged into 3.5? It's because there was no feedback against the original patches(the common location ones, *1,*2) from DT side. *1: http://article.gmane.org/gmane.linux.ports.tegra/4468 *2: https://lkml.org/lkml/2012/4/30/153 > One thing that might help here would be /not/ to add the common code to > drivers/of/of_dma.c as was done in the earlier revisions of this patch - > I believe that Grant has been trying to push subsystem-specific OF > functionality into files in those individual subsystems, so that > drivers/of can be kept for core support. Perhaps this patch should > create drivers/iommu/of_iommu.c or similar? "drivers/iommu/of_iommu.c" seems quite reasonable for this function. > But I wonder: Is this function likely to be useful outside of > drivers/iommu/ - you mentioned that similar code already exists in the > two arch-specific prom_parse.c files; where are the existing users of > those functions. If not in drivers/iommu/, then probably drivers/iommu/ > isn't a good place to put the new common function... There are the following 3 users of of_parse_dma_window() as below. All of them are IOMMU related, but they are architecture specific ones, not for the standard IOMMU API. I guess that the current trend is to convert Arch specific IOMMU API to the standard one basically. arch/powerpc/kernel/vio.c of_parse_dma_window(dev->dev.of_node, dma_window, arch/powerpc/platforms/cell/iommu.c of_parse_dma_window(np, dma_window, &index, base, size); arch/powerpc/platforms/pseries/iommu.c of_parse_dma_window(dn, dma_window, &tbl->it_index, &offset, &size); I think that the common "dma-window" DT parser is necessary for the standard IOMMU because "dma-window" info is dealt as DOMAIN_ATTR_GEOMETRY in the following Joerg's patch too. [PATCH 0/5] IOMMU: Make IOMMU-API ready for GART-like hardware https://lkml.org/lkml/2012/1/19/170 If it's ok to have of_get_dma_window() in "drivers/iommu/of_iommu.c", I'll post that version. Any comment? ^ permalink raw reply [flat|nested] 17+ messages in thread
[parent not found: <20120621.094611.2108645748323641310.hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH 1/5] iommu/tegra: smmu: Add DMA window parser, of_get_dma_window() [not found] ` <20120621.094611.2108645748323641310.hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> @ 2012-06-21 6:57 ` Stephen Warren [not found] ` <4FE2C5F3.1010007-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> 0 siblings, 1 reply; 17+ messages in thread From: Stephen Warren @ 2012-06-21 6:57 UTC (permalink / raw) To: Hiroshi Doyu Cc: joerg.roedel-5C7GfCeVMHo@public.gmane.org, arnd-r2nGTMty4D4@public.gmane.org, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org, rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org On 06/21/2012 12:46 AM, Hiroshi Doyu wrote: ... > There are the following 3 users of of_parse_dma_window() as below. All > of them are IOMMU related, but they are architecture specific ones, > not for the standard IOMMU API. I guess that the current trend is to > convert Arch specific IOMMU API to the standard one basically. > > arch/powerpc/kernel/vio.c of_parse_dma_window(dev->dev.of_node, dma_window, > arch/powerpc/platforms/cell/iommu.c of_parse_dma_window(np, dma_window, &index, base, size); > arch/powerpc/platforms/pseries/iommu.c of_parse_dma_window(dn, dma_window, &tbl->it_index, &offset, &size); > > I think that the common "dma-window" DT parser is necessary for the > standard IOMMU because "dma-window" info is dealt as > DOMAIN_ATTR_GEOMETRY in the following Joerg's patch too. > > [PATCH 0/5] IOMMU: Make IOMMU-API ready for GART-like hardware > https://lkml.org/lkml/2012/1/19/170 > > If it's ok to have of_get_dma_window() in "drivers/iommu/of_iommu.c", > I'll post that version. Sounds sane to me. ^ permalink raw reply [flat|nested] 17+ messages in thread
[parent not found: <4FE2C5F3.1010007-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>]
* [v2 1/5] iommu: Add DMA window parser, of_get_dma_window() [not found] ` <4FE2C5F3.1010007-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> @ 2012-06-21 8:30 ` Hiroshi Doyu [not found] ` <20120621.113023.1324461719984328307.hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 0 siblings, 1 reply; 17+ messages in thread From: Hiroshi Doyu @ 2012-06-21 8:30 UTC (permalink / raw) To: joerg.roedel-5C7GfCeVMHo@public.gmane.org, swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Cc: arnd-r2nGTMty4D4@public.gmane.org, linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org, rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org From: Hiroshi DOYU <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> This code was based on: "arch/microblaze/kernel/prom_parse.c" "arch/powerpc/kernel/prom_parse.c" Can replace "of_parse_dma_window()" in the above. This supports different formats flexibly. "prefix" can be configured if any. "busno" and "index" are optionally specified. Set NULL and 0 if not used. Signed-off-by: Hiroshi DOYU <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> --- Update: Move of_get_dma_window() in drivers/iommu/of_iommu.c Based on the discussion: http://marc.info/?l=linux-tegra&m=133732046606458&w=2 --- drivers/iommu/Kconfig | 4 ++ drivers/iommu/Makefile | 1 + drivers/iommu/of_iommu.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++ include/linux/of_iommu.h | 21 +++++++++++ 4 files changed, 116 insertions(+), 0 deletions(-) diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index 3408937..4826af6 100644 --- a/drivers/iommu/Kconfig +++ b/drivers/iommu/Kconfig @@ -13,6 +13,10 @@ menuconfig IOMMU_SUPPORT if IOMMU_SUPPORT +config OF_IOMMU + def_bool y + depends on OF + # MSM IOMMU support config MSM_IOMMU bool "MSM IOMMU Support" diff --git a/drivers/iommu/Makefile b/drivers/iommu/Makefile index 76e54ef..14a4d5f 100644 --- a/drivers/iommu/Makefile +++ b/drivers/iommu/Makefile @@ -1,4 +1,5 @@ obj-$(CONFIG_IOMMU_API) += iommu.o +obj-$(CONFIG_OF_IOMMU) += of_iommu.o obj-$(CONFIG_MSM_IOMMU) += msm_iommu.o msm_iommu_dev.o obj-$(CONFIG_AMD_IOMMU) += amd_iommu.o amd_iommu_init.o obj-$(CONFIG_AMD_IOMMU_V2) += amd_iommu_v2.o diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c new file mode 100644 index 0000000..ee249bc --- /dev/null +++ b/drivers/iommu/of_iommu.c @@ -0,0 +1,90 @@ +/* + * OF helpers for IOMMU + * + * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include <linux/export.h> +#include <linux/limits.h> +#include <linux/of.h> + +/** + * of_get_dma_window - Parse *dma-window property and returns 0 if found. + * + * @dn: device node + * @prefix: prefix for property name if any + * @index: index to start to parse + * @busno: Returns busno if supported. Otherwise pass NULL + * @addr: Returns address that DMA starts + * @size: Returns the range that DMA can handle + * + * This supports different formats flexibly. "prefix" can be + * configured if any. "busno" and "index" are optionally + * specified. Set 0(or NULL) if not used. + */ +int of_get_dma_window(struct device_node *dn, const char *prefix, int index, + unsigned long *busno, dma_addr_t *addr, size_t *size) +{ + const __be32 *dma_window, *end; + int bytes, cur_index = 0; + char propname[NAME_MAX], addrname[NAME_MAX], sizename[NAME_MAX]; + + if (!dn || !addr || !size) + return -EINVAL; + + if (!prefix) + prefix = ""; + + snprintf(propname, sizeof(propname), "%sdma-window", prefix); + snprintf(addrname, sizeof(addrname), "%s#dma-address-cells", prefix); + snprintf(sizename, sizeof(sizename), "%s#dma-size-cells", prefix); + + dma_window = of_get_property(dn, propname, &bytes); + if (!dma_window) + return -ENODEV; + end = dma_window + bytes / sizeof(*dma_window); + + while (dma_window < end) { + u32 cells; + const void *prop; + + /* busno is one cell if supported */ + if (busno) + *busno = be32_to_cpup(dma_window++); + + prop = of_get_property(dn, addrname, NULL); + if (!prop) + prop = of_get_property(dn, "#address-cells", NULL); + + cells = prop ? be32_to_cpup(prop) : of_n_addr_cells(dn); + if (!cells) + return -EINVAL; + *addr = of_read_number(dma_window, cells); + dma_window += cells; + + prop = of_get_property(dn, sizename, NULL); + cells = prop ? be32_to_cpup(prop) : of_n_size_cells(dn); + if (!cells) + return -EINVAL; + *size = of_read_number(dma_window, cells); + dma_window += cells; + + if (cur_index++ == index) + break; + } + return 0; +} +EXPORT_SYMBOL_GPL(of_get_dma_window); diff --git a/include/linux/of_iommu.h b/include/linux/of_iommu.h new file mode 100644 index 0000000..51a560f --- /dev/null +++ b/include/linux/of_iommu.h @@ -0,0 +1,21 @@ +#ifndef __OF_IOMMU_H +#define __OF_IOMMU_H + +#ifdef CONFIG_OF_IOMMU + +extern int of_get_dma_window(struct device_node *dn, const char *prefix, + int index, unsigned long *busno, dma_addr_t *addr, + size_t *size); + +#else + +static inline int of_get_dma_window(struct device_node *dn, const char *prefix, + int index, unsigned long *busno, dma_addr_t *addr, + size_t *size) +{ + return -EINVAL; +} + +#endif /* CONFIG_OF_IOMMU */ + +#endif /* __OF_IOMMU_H */ -- 1.7.5.4 ^ permalink raw reply related [flat|nested] 17+ messages in thread
[parent not found: <20120621.113023.1324461719984328307.hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>]
* Re: [v2 1/5] iommu: Add DMA window parser, of_get_dma_window() [not found] ` <20120621.113023.1324461719984328307.hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> @ 2012-06-21 16:18 ` Stephen Warren [not found] ` <4FE34973.1020400-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> 0 siblings, 1 reply; 17+ messages in thread From: Stephen Warren @ 2012-06-21 16:18 UTC (permalink / raw) To: Hiroshi Doyu Cc: arnd-r2nGTMty4D4@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org, grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On 06/21/2012 02:30 AM, Hiroshi Doyu wrote: > From: Hiroshi DOYU <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> > > This code was based on: > "arch/microblaze/kernel/prom_parse.c" > "arch/powerpc/kernel/prom_parse.c" > > Can replace "of_parse_dma_window()" in the above. This supports > different formats flexibly. "prefix" can be configured if any. "busno" > and "index" are optionally specified. Set NULL and 0 if not used. > > Signed-off-by: Hiroshi DOYU <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> Acked-by: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> BTW, I only see patches 1 & 2 of 5 in this series; did you only mean to post just 2 patches or did the others get lost on the way to my system somehow? ^ permalink raw reply [flat|nested] 17+ messages in thread
[parent not found: <4FE34973.1020400-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>]
* Re: [v2 1/5] iommu: Add DMA window parser, of_get_dma_window() [not found] ` <4FE34973.1020400-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> @ 2012-06-25 5:15 ` Hiroshi Doyu [not found] ` <20120625081543.bf25af1f74d7d1057d9cd216-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 0 siblings, 1 reply; 17+ messages in thread From: Hiroshi Doyu @ 2012-06-25 5:15 UTC (permalink / raw) To: Stephen Warren Cc: arnd-r2nGTMty4D4@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org, grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On Thu, 21 Jun 2012 18:18:59 +0200 Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> wrote: > On 06/21/2012 02:30 AM, Hiroshi Doyu wrote: > > From: Hiroshi DOYU <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> > > > > This code was based on: > > "arch/microblaze/kernel/prom_parse.c" > > "arch/powerpc/kernel/prom_parse.c" > > > > Can replace "of_parse_dma_window()" in the above. This supports > > different formats flexibly. "prefix" can be configured if any. "busno" > > and "index" are optionally specified. Set NULL and 0 if not used. > > > > Signed-off-by: Hiroshi DOYU <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> > > Acked-by: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> Thanks. > BTW, I only see patches 1 & 2 of 5 in this series; did you only mean to > post just 2 patches or did the others get lost on the way to my system > somehow? I reposted only [1/5] and [2/5] as "v2" because the rests are same. Probably it was better to send a whole series again. Sorry for confusion. ^ permalink raw reply [flat|nested] 17+ messages in thread
[parent not found: <20120625081543.bf25af1f74d7d1057d9cd216-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>]
* Re: [v2 1/5] iommu: Add DMA window parser, of_get_dma_window() [not found] ` <20120625081543.bf25af1f74d7d1057d9cd216-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> @ 2012-06-25 10:42 ` joerg.roedel-5C7GfCeVMHo 0 siblings, 0 replies; 17+ messages in thread From: joerg.roedel-5C7GfCeVMHo @ 2012-06-25 10:42 UTC (permalink / raw) To: Hiroshi Doyu Cc: arnd-r2nGTMty4D4@public.gmane.org, Stephen Warren, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org, grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On Mon, Jun 25, 2012 at 08:15:43AM +0300, Hiroshi Doyu wrote: > On Thu, 21 Jun 2012 18:18:59 +0200 > Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> wrote: > > > On 06/21/2012 02:30 AM, Hiroshi Doyu wrote: > > > From: Hiroshi DOYU <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> > > > > > > This code was based on: > > > "arch/microblaze/kernel/prom_parse.c" > > > "arch/powerpc/kernel/prom_parse.c" > > > > > > Can replace "of_parse_dma_window()" in the above. This supports > > > different formats flexibly. "prefix" can be configured if any. "busno" > > > and "index" are optionally specified. Set NULL and 0 if not used. > > > > > > Signed-off-by: Hiroshi DOYU <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> > > > > Acked-by: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> > > Thanks. > > > BTW, I only see patches 1 & 2 of 5 in this series; did you only mean to > > post just 2 patches or did the others get lost on the way to my system > > somehow? > > I reposted only [1/5] and [2/5] as "v2" because the rests are > same. Probably it was better to send a whole series again. Sorry for > confusion. Please repost the whole series with the Acks included as a new thread so that I can easily apply them. Joerg -- AMD Operating System Research Center Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach General Managers: Alberto Bozzo Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632 ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2012-06-25 10:42 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20120518085051.4a0fca863c5ab37cf8d42cb1@nvidia.com>
[not found] ` <20120518085051.4a0fca863c5ab37cf8d42cb1-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-05-18 6:43 ` [PATCH 1/1] iommu/tegra: smmu: Add DMA window parser Hiroshi DOYU
2012-05-18 15:15 ` Stephen Warren
[not found] ` <4FB66796.1030007-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-05-18 20:56 ` Hiroshi Doyu
[not found] ` <20120518.235619.175499431618565933.hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-05-21 12:47 ` joerg.roedel-5C7GfCeVMHo
[not found] ` <20120521124707.GC2604-5C7GfCeVMHo@public.gmane.org>
2012-06-20 7:16 ` [PATCH 1/5] iommu/tegra: smmu: Add DMA window parser, of_get_dma_window() Hiroshi DOYU
[not found] ` <1340176620-13012-1-git-send-email-hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-06-20 7:16 ` [PATCH 2/5] iommu/tegra: smmu: Add device tree support for SMMU Hiroshi DOYU
[not found] ` <1340176620-13012-2-git-send-email-hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-06-21 8:31 ` [v2 " Hiroshi Doyu
2012-06-20 7:16 ` [PATCH 3/5] iommu/tegra: smmu: Simplify allocation at once Hiroshi DOYU
2012-06-20 7:16 ` [PATCH 4/5] iommu/tegra: smmu: Remove unnecessary cleanups with devm_*() Hiroshi DOYU
2012-06-20 7:17 ` [PATCH 5/5] iommu/tegra: smmu: Fix uninitialized var warning Hiroshi DOYU
2012-06-20 17:11 ` [PATCH 1/5] iommu/tegra: smmu: Add DMA window parser, of_get_dma_window() Stephen Warren
2012-06-21 6:46 ` Hiroshi Doyu
[not found] ` <20120621.094611.2108645748323641310.hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-06-21 6:57 ` Stephen Warren
[not found] ` <4FE2C5F3.1010007-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-06-21 8:30 ` [v2 1/5] iommu: " Hiroshi Doyu
[not found] ` <20120621.113023.1324461719984328307.hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-06-21 16:18 ` Stephen Warren
[not found] ` <4FE34973.1020400-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-06-25 5:15 ` Hiroshi Doyu
[not found] ` <20120625081543.bf25af1f74d7d1057d9cd216-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-06-25 10:42 ` joerg.roedel-5C7GfCeVMHo
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).