diff for duplicates of <20160818105005.GA20404@arm.com> diff --git a/a/1.txt b/N1/1.txt index 91c6e66..78b4771 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -6,25 +6,26 @@ On Mon, Aug 15, 2016 at 04:23:34PM +0100, Lorenzo Pieralisi wrote: > corresponding ARM SMMU components, IORT kernel code should be made > able to parse IORT table entries and create platform devices > dynamically. -> +>=20 > This patch adds the generic IORT infrastructure required to create > platform devices for ARM SMMUs. -> +>=20 > ARM SMMU versions have different resources requirement therefore this > patch also introduces an IORT specific structure (ie iort_iommu_config) > that contains hooks (to be defined when the corresponding ARM SMMU > driver support is added to the kernel) to be used to define the > platform devices names, init the IOMMUs, count their resources and > finally initialize them. -> -> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi-5wv7dgnIgG8@public.gmane.org> -> Cc: Hanjun Guo <hanjun.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> -> Cc: Tomasz Nowicki <tn-nYOzD4b6Jr9Wk0Htik3J/w@public.gmane.org> -> Cc: "Rafael J. Wysocki" <rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org> +>=20 +> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> +> Cc: Hanjun Guo <hanjun.guo@linaro.org> +> Cc: Tomasz Nowicki <tn@semihalf.com> +> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net> > --- -> drivers/acpi/arm64/iort.c | 153 ++++++++++++++++++++++++++++++++++++++++++++++ +> drivers/acpi/arm64/iort.c | 153 ++++++++++++++++++++++++++++++++++++++++= +++++++ > 1 file changed, 153 insertions(+) -> +>=20 > diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c > index f6db3d8..4043071 100644 > --- a/drivers/acpi/arm64/iort.c @@ -35,25 +36,26 @@ On Mon, Aug 15, 2016 at 04:23:34PM +0100, Lorenzo Pieralisi wrote: > #include <linux/pci.h> > +#include <linux/platform_device.h> > #include <linux/slab.h> -> +> =20 > struct iort_its_msi_chip { -> @@ -454,6 +455,157 @@ iort_get_device_domain(struct device *dev, u32 req_id) -> return irq_find_matching_fwnode(handle, DOMAIN_BUS_PCI_MSI); +> @@ -454,6 +455,157 @@ iort_get_device_domain(struct device *dev, u32 req_= +id) +> =09return irq_find_matching_fwnode(handle, DOMAIN_BUS_PCI_MSI); > } -> +> =20 > +struct iort_iommu_config { -> + const char *name; -> + int (*iommu_init)(struct acpi_iort_node *node); -> + bool (*iommu_is_coherent)(struct acpi_iort_node *node); -> + int (*iommu_count_resources)(struct acpi_iort_node *node); -> + void (*iommu_init_resources)(struct resource *res, -> + struct acpi_iort_node *node); +> +=09const char *name; +> +=09int (*iommu_init)(struct acpi_iort_node *node); +> +=09bool (*iommu_is_coherent)(struct acpi_iort_node *node); +> +=09int (*iommu_count_resources)(struct acpi_iort_node *node); +> +=09void (*iommu_init_resources)(struct resource *res, +> +=09=09=09=09 struct acpi_iort_node *node); > +}; > + > +static const struct iort_iommu_config * __init > +iort_get_iommu_config(struct acpi_iort_node *node) > +{ -> + return NULL; +> +=09return NULL; > +} > + > +/** @@ -65,150 +67,154 @@ On Mon, Aug 15, 2016 at 04:23:34PM +0100, Lorenzo Pieralisi wrote: > + */ > +static int __init > +iort_add_smmu_platform_device(struct fwnode_handle *fwnode, -> + struct acpi_iort_node *node) +> +=09=09=09 struct acpi_iort_node *node) > +{ -> + struct platform_device *pdev; -> + struct resource *r; -> + enum dev_dma_attr attr; -> + int ret, count; -> + const struct iort_iommu_config *ops = -> + iort_get_iommu_config(node); -> + -> + if (!ops) -> + return -ENODEV; -> + -> + pdev = platform_device_alloc(ops->name, PLATFORM_DEVID_AUTO); -> + if (!pdev) -> + return PTR_ERR(pdev); -> + -> + count = ops->iommu_count_resources(node); -> + -> + r = kcalloc(count, sizeof(*r), GFP_KERNEL); -> + if (!r) { -> + ret = -ENOMEM; -> + goto dev_put; -> + } -> + -> + ops->iommu_init_resources(r, node); -> + -> + ret = platform_device_add_resources(pdev, r, count); -> + /* -> + * Resources are duplicated in platform_device_add_resources, -> + * free their allocated memory -> + */ -> + kfree(r); -> + -> + if (ret) -> + goto dev_put; -> + -> + /* -> + * Add a copy of IORT node pointer to platform_data to -> + * be used to retrieve IORT data information. -> + */ -> + ret = platform_device_add_data(pdev, &node, sizeof(node)); -> + if (ret) -> + goto dev_put; -> + -> + pdev->dev.dma_mask = kmalloc(sizeof(*pdev->dev.dma_mask), GFP_KERNEL); -> + if (!pdev->dev.dma_mask) { -> + ret = -ENOMEM; -> + goto dev_put; -> + } -> + -> + pdev->dev.fwnode = fwnode; -> + -> + /* -> + * Set default dma mask value for the table walker, -> + * to be overridden on probing with correct value. -> + */ -> + *pdev->dev.dma_mask = DMA_BIT_MASK(32); -> + pdev->dev.coherent_dma_mask = *pdev->dev.dma_mask; -> + -> + attr = ops->iommu_is_coherent(node) ? -> + DEV_DMA_COHERENT : DEV_DMA_NON_COHERENT; -> + -> + /* Configure DMA for the page table walker */ -> + acpi_dma_configure(&pdev->dev, attr); -> + -> + ret = platform_device_add(pdev); -> + if (ret) -> + goto dma_deconfigure; -> + -> + return 0; +> +=09struct platform_device *pdev; +> +=09struct resource *r; +> +=09enum dev_dma_attr attr; +> +=09int ret, count; +> +=09const struct iort_iommu_config *ops =3D +> +=09=09=09=09iort_get_iommu_config(node); +> + +> +=09if (!ops) +> +=09=09return -ENODEV; +> + +> +=09pdev =3D platform_device_alloc(ops->name, PLATFORM_DEVID_AUTO); +> +=09if (!pdev) +> +=09=09return PTR_ERR(pdev); +> + +> +=09count =3D ops->iommu_count_resources(node); +> + +> +=09r =3D kcalloc(count, sizeof(*r), GFP_KERNEL); +> +=09if (!r) { +> +=09=09ret =3D -ENOMEM; +> +=09=09goto dev_put; +> +=09} +> + +> +=09ops->iommu_init_resources(r, node); +> + +> +=09ret =3D platform_device_add_resources(pdev, r, count); +> +=09/* +> +=09 * Resources are duplicated in platform_device_add_resources, +> +=09 * free their allocated memory +> +=09 */ +> +=09kfree(r); +> + +> +=09if (ret) +> +=09=09goto dev_put; +> + +> +=09/* +> +=09 * Add a copy of IORT node pointer to platform_data to +> +=09 * be used to retrieve IORT data information. +> +=09 */ +> +=09ret =3D platform_device_add_data(pdev, &node, sizeof(node)); +> +=09if (ret) +> +=09=09goto dev_put; +> + +> +=09pdev->dev.dma_mask =3D kmalloc(sizeof(*pdev->dev.dma_mask), GFP_KERNE= +L); +> +=09if (!pdev->dev.dma_mask) { +> +=09=09ret =3D -ENOMEM; +> +=09=09goto dev_put; +> +=09} +> + +> +=09pdev->dev.fwnode =3D fwnode; +> + +> +=09/* +> +=09 * Set default dma mask value for the table walker, +> +=09 * to be overridden on probing with correct value. +> +=09 */ +> +=09*pdev->dev.dma_mask =3D DMA_BIT_MASK(32); +> +=09pdev->dev.coherent_dma_mask =3D *pdev->dev.dma_mask; +> + +> +=09attr =3D ops->iommu_is_coherent(node) ? +> +=09=09=09 DEV_DMA_COHERENT : DEV_DMA_NON_COHERENT; +> + +> +=09/* Configure DMA for the page table walker */ +> +=09acpi_dma_configure(&pdev->dev, attr); +> + +> +=09ret =3D platform_device_add(pdev); +> +=09if (ret) +> +=09=09goto dma_deconfigure; +> + +> +=09return 0; > + > +dma_deconfigure: -> + acpi_dma_deconfigure(&pdev->dev); -> + kfree(pdev->dev.dma_mask); +> +=09acpi_dma_deconfigure(&pdev->dev); +> +=09kfree(pdev->dev.dma_mask); > + > +dev_put: -> + platform_device_put(pdev); +> +=09platform_device_put(pdev); > + -> + return ret; +> +=09return ret; > +} > + > +static void __init iort_smmu_init(void) > +{ -> + struct acpi_iort_node *iort_node, *iort_end; -> + struct acpi_table_iort *iort; -> + struct fwnode_handle *fwnode; -> + int i, ret; -> + -> + /* -> + * table and iort will both point to the start of IORT table, but -> + * have different struct types -> + */ -> + iort = (struct acpi_table_iort *)iort_table; +> +=09struct acpi_iort_node *iort_node, *iort_end; +> +=09struct acpi_table_iort *iort; +> +=09struct fwnode_handle *fwnode; +> +=09int i, ret; +> + +> +=09/* +> +=09 * table and iort will both point to the start of IORT table, but +> +=09 * have different struct types +> +=09 */ +> +=09iort =3D (struct acpi_table_iort *)iort_table; > -If the firmware of a platform happens to miss the IORT table, then iort_table here -will be a NULL pointer, in this case 'NULL pointer dereference' kernel panic will occur, -if this is not an expected behavior then we can add a sanity check here to avoid this. +If the firmware of a platform happens to miss the IORT table, then iort_tab= +le here +will be a NULL pointer, in this case 'NULL pointer dereference' kernel pani= +c will occur,=20 +if this is not an expected behavior then we can add a sanity check here to = +avoid this.=20 IORT missing is a fatal error? I don't think so. Thanks, Dennis > + -> + /* Get the first IORT node */ -> + iort_node = ACPI_ADD_PTR(struct acpi_iort_node, iort_table, -> + iort->node_offset); -> + iort_end = ACPI_ADD_PTR(struct acpi_iort_node, iort_table, -> + iort_table->length); -> + -> + for (i = 0; i < iort->node_count; i++) { -> + -> + if (iort_node >= iort_end) { -> + pr_err("iort node pointer overflows, bad table\n"); -> + return; -> + } -> + -> + if (iort_node->type == ACPI_IORT_NODE_SMMU || -> + iort_node->type == ACPI_IORT_NODE_SMMU_V3) { -> + fwnode = iort_get_fwnode(iort_node); -> + -> + if (!fwnode) -> + continue; -> + -> + ret = iort_add_smmu_platform_device(fwnode, -> + iort_node); -> + if (ret) { -> + pr_err("Error in platform device creation\n"); -> + return; -> + } -> + } -> + -> + iort_node = ACPI_ADD_PTR(struct acpi_iort_node, iort_node, -> + iort_node->length); -> + } +> +=09/* Get the first IORT node */ +> +=09iort_node =3D ACPI_ADD_PTR(struct acpi_iort_node, iort_table, +> +=09=09=09=09 iort->node_offset); +> +=09iort_end =3D ACPI_ADD_PTR(struct acpi_iort_node, iort_table, +> +=09=09=09=09iort_table->length); +> + +> +=09for (i =3D 0; i < iort->node_count; i++) { +> + +> +=09=09if (iort_node >=3D iort_end) { +> +=09=09=09pr_err("iort node pointer overflows, bad table\n"); +> +=09=09=09return; +> +=09=09} +> + +> +=09=09if (iort_node->type =3D=3D ACPI_IORT_NODE_SMMU || +> +=09=09 iort_node->type =3D=3D ACPI_IORT_NODE_SMMU_V3) { +> +=09=09=09fwnode =3D iort_get_fwnode(iort_node); +> + +> +=09=09=09if (!fwnode) +> +=09=09=09=09continue; +> + +> +=09=09=09ret =3D iort_add_smmu_platform_device(fwnode, +> +=09=09=09=09=09=09=09 iort_node); +> +=09=09=09if (ret) { +> +=09=09=09=09pr_err("Error in platform device creation\n"); +> +=09=09=09=09return; +> +=09=09=09} +> +=09=09} +> + +> +=09=09iort_node =3D ACPI_ADD_PTR(struct acpi_iort_node, iort_node, +> +=09=09=09=09=09 iort_node->length); +> +=09} > +} > + > void __init iort_table_detect(void) > { -> acpi_status status; +> =09acpi_status status; > @@ -465,4 +617,5 @@ void __init iort_table_detect(void) -> } -> -> acpi_probe_device_table(iort); -> + iort_smmu_init(); +> =09} +> =20 +> =09acpi_probe_device_table(iort); +> +=09iort_smmu_init(); > } -> -- +> --=20 > 2.6.4 -> +>=20 diff --git a/a/content_digest b/N1/content_digest index 015e47b..8afa5b9 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -1,23 +1,25 @@ "ref\01471274620-20754-1-git-send-email-lorenzo.pieralisi@arm.com\0" "ref\01471274620-20754-10-git-send-email-lorenzo.pieralisi@arm.com\0" - "ref\01471274620-20754-10-git-send-email-lorenzo.pieralisi-5wv7dgnIgG8@public.gmane.org\0" - "From\0Dennis Chen <dennis.chen-5wv7dgnIgG8@public.gmane.org>\0" + "From\0Dennis Chen <dennis.chen@arm.com>\0" "Subject\0Re: [PATCH v4 09/15] drivers: acpi: iort: add support for ARM SMMU platform devices creation\0" "Date\0Thu, 18 Aug 2016 18:50:07 +0800\0" - "To\0Lorenzo Pieralisi <lorenzo.pieralisi-5wv7dgnIgG8@public.gmane.org>\0" - "Cc\0linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org" - Marc Zyngier <marc.zyngier-5wv7dgnIgG8@public.gmane.org> - Tomasz Nowicki <tn-nYOzD4b6Jr9Wk0Htik3J/w@public.gmane.org> - Rafael J. Wysocki <rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org> - linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org - Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org> - linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org - Sinan Kaya <okaya-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org> - linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org - iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org - Hanjun Guo <hanjun.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> - Jon Masters <jcm-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> - " nd-5wv7dgnIgG8@public.gmane.org\0" + "To\0Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>\0" + "Cc\0<iommu@lists.linux-foundation.org>" + Hanjun Guo <hanjun.guo@linaro.org> + Tomasz Nowicki <tn@semihalf.com> + Rafael J. Wysocki <rjw@rjwysocki.net> + Will Deacon <will.deacon@arm.com> + Marc Zyngier <marc.zyngier@arm.com> + Robin Murphy <robin.murphy@arm.com> + Joerg Roedel <joro@8bytes.org> + Jon Masters <jcm@redhat.com> + Sinan Kaya <okaya@codeaurora.org> + Nate Watterson <nwatters@codeaurora.org> + <linux-acpi@vger.kernel.org> + <linux-pci@vger.kernel.org> + <linux-kernel@vger.kernel.org> + <linux-arm-kernel@lists.infradead.org> + " <nd@arm.com>\0" "\00:1\0" "b\0" "Hi Lorenzo,\n" @@ -28,25 +30,26 @@ "> corresponding ARM SMMU components, IORT kernel code should be made\n" "> able to parse IORT table entries and create platform devices\n" "> dynamically.\n" - "> \n" + ">=20\n" "> This patch adds the generic IORT infrastructure required to create\n" "> platform devices for ARM SMMUs.\n" - "> \n" + ">=20\n" "> ARM SMMU versions have different resources requirement therefore this\n" "> patch also introduces an IORT specific structure (ie iort_iommu_config)\n" "> that contains hooks (to be defined when the corresponding ARM SMMU\n" "> driver support is added to the kernel) to be used to define the\n" "> platform devices names, init the IOMMUs, count their resources and\n" "> finally initialize them.\n" - "> \n" - "> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi-5wv7dgnIgG8@public.gmane.org>\n" - "> Cc: Hanjun Guo <hanjun.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>\n" - "> Cc: Tomasz Nowicki <tn-nYOzD4b6Jr9Wk0Htik3J/w@public.gmane.org>\n" - "> Cc: \"Rafael J. Wysocki\" <rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org>\n" + ">=20\n" + "> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>\n" + "> Cc: Hanjun Guo <hanjun.guo@linaro.org>\n" + "> Cc: Tomasz Nowicki <tn@semihalf.com>\n" + "> Cc: \"Rafael J. Wysocki\" <rjw@rjwysocki.net>\n" "> ---\n" - "> drivers/acpi/arm64/iort.c | 153 ++++++++++++++++++++++++++++++++++++++++++++++\n" + "> drivers/acpi/arm64/iort.c | 153 ++++++++++++++++++++++++++++++++++++++++=\n" + "++++++\n" "> 1 file changed, 153 insertions(+)\n" - "> \n" + ">=20\n" "> diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c\n" "> index f6db3d8..4043071 100644\n" "> --- a/drivers/acpi/arm64/iort.c\n" @@ -57,25 +60,26 @@ "> #include <linux/pci.h>\n" "> +#include <linux/platform_device.h>\n" "> #include <linux/slab.h>\n" - "> \n" + "> =20\n" "> struct iort_its_msi_chip {\n" - "> @@ -454,6 +455,157 @@ iort_get_device_domain(struct device *dev, u32 req_id)\n" - "> \treturn irq_find_matching_fwnode(handle, DOMAIN_BUS_PCI_MSI);\n" + "> @@ -454,6 +455,157 @@ iort_get_device_domain(struct device *dev, u32 req_=\n" + "id)\n" + "> =09return irq_find_matching_fwnode(handle, DOMAIN_BUS_PCI_MSI);\n" "> }\n" - "> \n" + "> =20\n" "> +struct iort_iommu_config {\n" - "> +\tconst char *name;\n" - "> +\tint (*iommu_init)(struct acpi_iort_node *node);\n" - "> +\tbool (*iommu_is_coherent)(struct acpi_iort_node *node);\n" - "> +\tint (*iommu_count_resources)(struct acpi_iort_node *node);\n" - "> +\tvoid (*iommu_init_resources)(struct resource *res,\n" - "> +\t\t\t\t struct acpi_iort_node *node);\n" + "> +=09const char *name;\n" + "> +=09int (*iommu_init)(struct acpi_iort_node *node);\n" + "> +=09bool (*iommu_is_coherent)(struct acpi_iort_node *node);\n" + "> +=09int (*iommu_count_resources)(struct acpi_iort_node *node);\n" + "> +=09void (*iommu_init_resources)(struct resource *res,\n" + "> +=09=09=09=09 struct acpi_iort_node *node);\n" "> +};\n" "> +\n" "> +static const struct iort_iommu_config * __init\n" "> +iort_get_iommu_config(struct acpi_iort_node *node)\n" "> +{\n" - "> +\treturn NULL;\n" + "> +=09return NULL;\n" "> +}\n" "> +\n" "> +/**\n" @@ -87,152 +91,156 @@ "> + */\n" "> +static int __init\n" "> +iort_add_smmu_platform_device(struct fwnode_handle *fwnode,\n" - "> +\t\t\t struct acpi_iort_node *node)\n" + "> +=09=09=09 struct acpi_iort_node *node)\n" "> +{\n" - "> +\tstruct platform_device *pdev;\n" - "> +\tstruct resource *r;\n" - "> +\tenum dev_dma_attr attr;\n" - "> +\tint ret, count;\n" - "> +\tconst struct iort_iommu_config *ops =\n" - "> +\t\t\t\tiort_get_iommu_config(node);\n" - "> +\n" - "> +\tif (!ops)\n" - "> +\t\treturn -ENODEV;\n" - "> +\n" - "> +\tpdev = platform_device_alloc(ops->name, PLATFORM_DEVID_AUTO);\n" - "> +\tif (!pdev)\n" - "> +\t\treturn PTR_ERR(pdev);\n" - "> +\n" - "> +\tcount = ops->iommu_count_resources(node);\n" - "> +\n" - "> +\tr = kcalloc(count, sizeof(*r), GFP_KERNEL);\n" - "> +\tif (!r) {\n" - "> +\t\tret = -ENOMEM;\n" - "> +\t\tgoto dev_put;\n" - "> +\t}\n" - "> +\n" - "> +\tops->iommu_init_resources(r, node);\n" - "> +\n" - "> +\tret = platform_device_add_resources(pdev, r, count);\n" - "> +\t/*\n" - "> +\t * Resources are duplicated in platform_device_add_resources,\n" - "> +\t * free their allocated memory\n" - "> +\t */\n" - "> +\tkfree(r);\n" - "> +\n" - "> +\tif (ret)\n" - "> +\t\tgoto dev_put;\n" - "> +\n" - "> +\t/*\n" - "> +\t * Add a copy of IORT node pointer to platform_data to\n" - "> +\t * be used to retrieve IORT data information.\n" - "> +\t */\n" - "> +\tret = platform_device_add_data(pdev, &node, sizeof(node));\n" - "> +\tif (ret)\n" - "> +\t\tgoto dev_put;\n" - "> +\n" - "> +\tpdev->dev.dma_mask = kmalloc(sizeof(*pdev->dev.dma_mask), GFP_KERNEL);\n" - "> +\tif (!pdev->dev.dma_mask) {\n" - "> +\t\tret = -ENOMEM;\n" - "> +\t\tgoto dev_put;\n" - "> +\t}\n" - "> +\n" - "> +\tpdev->dev.fwnode = fwnode;\n" - "> +\n" - "> +\t/*\n" - "> +\t * Set default dma mask value for the table walker,\n" - "> +\t * to be overridden on probing with correct value.\n" - "> +\t */\n" - "> +\t*pdev->dev.dma_mask = DMA_BIT_MASK(32);\n" - "> +\tpdev->dev.coherent_dma_mask = *pdev->dev.dma_mask;\n" - "> +\n" - "> +\tattr = ops->iommu_is_coherent(node) ?\n" - "> +\t\t\t DEV_DMA_COHERENT : DEV_DMA_NON_COHERENT;\n" - "> +\n" - "> +\t/* Configure DMA for the page table walker */\n" - "> +\tacpi_dma_configure(&pdev->dev, attr);\n" - "> +\n" - "> +\tret = platform_device_add(pdev);\n" - "> +\tif (ret)\n" - "> +\t\tgoto dma_deconfigure;\n" - "> +\n" - "> +\treturn 0;\n" + "> +=09struct platform_device *pdev;\n" + "> +=09struct resource *r;\n" + "> +=09enum dev_dma_attr attr;\n" + "> +=09int ret, count;\n" + "> +=09const struct iort_iommu_config *ops =3D\n" + "> +=09=09=09=09iort_get_iommu_config(node);\n" + "> +\n" + "> +=09if (!ops)\n" + "> +=09=09return -ENODEV;\n" + "> +\n" + "> +=09pdev =3D platform_device_alloc(ops->name, PLATFORM_DEVID_AUTO);\n" + "> +=09if (!pdev)\n" + "> +=09=09return PTR_ERR(pdev);\n" + "> +\n" + "> +=09count =3D ops->iommu_count_resources(node);\n" + "> +\n" + "> +=09r =3D kcalloc(count, sizeof(*r), GFP_KERNEL);\n" + "> +=09if (!r) {\n" + "> +=09=09ret =3D -ENOMEM;\n" + "> +=09=09goto dev_put;\n" + "> +=09}\n" + "> +\n" + "> +=09ops->iommu_init_resources(r, node);\n" + "> +\n" + "> +=09ret =3D platform_device_add_resources(pdev, r, count);\n" + "> +=09/*\n" + "> +=09 * Resources are duplicated in platform_device_add_resources,\n" + "> +=09 * free their allocated memory\n" + "> +=09 */\n" + "> +=09kfree(r);\n" + "> +\n" + "> +=09if (ret)\n" + "> +=09=09goto dev_put;\n" + "> +\n" + "> +=09/*\n" + "> +=09 * Add a copy of IORT node pointer to platform_data to\n" + "> +=09 * be used to retrieve IORT data information.\n" + "> +=09 */\n" + "> +=09ret =3D platform_device_add_data(pdev, &node, sizeof(node));\n" + "> +=09if (ret)\n" + "> +=09=09goto dev_put;\n" + "> +\n" + "> +=09pdev->dev.dma_mask =3D kmalloc(sizeof(*pdev->dev.dma_mask), GFP_KERNE=\n" + "L);\n" + "> +=09if (!pdev->dev.dma_mask) {\n" + "> +=09=09ret =3D -ENOMEM;\n" + "> +=09=09goto dev_put;\n" + "> +=09}\n" + "> +\n" + "> +=09pdev->dev.fwnode =3D fwnode;\n" + "> +\n" + "> +=09/*\n" + "> +=09 * Set default dma mask value for the table walker,\n" + "> +=09 * to be overridden on probing with correct value.\n" + "> +=09 */\n" + "> +=09*pdev->dev.dma_mask =3D DMA_BIT_MASK(32);\n" + "> +=09pdev->dev.coherent_dma_mask =3D *pdev->dev.dma_mask;\n" + "> +\n" + "> +=09attr =3D ops->iommu_is_coherent(node) ?\n" + "> +=09=09=09 DEV_DMA_COHERENT : DEV_DMA_NON_COHERENT;\n" + "> +\n" + "> +=09/* Configure DMA for the page table walker */\n" + "> +=09acpi_dma_configure(&pdev->dev, attr);\n" + "> +\n" + "> +=09ret =3D platform_device_add(pdev);\n" + "> +=09if (ret)\n" + "> +=09=09goto dma_deconfigure;\n" + "> +\n" + "> +=09return 0;\n" "> +\n" "> +dma_deconfigure:\n" - "> +\tacpi_dma_deconfigure(&pdev->dev);\n" - "> +\tkfree(pdev->dev.dma_mask);\n" + "> +=09acpi_dma_deconfigure(&pdev->dev);\n" + "> +=09kfree(pdev->dev.dma_mask);\n" "> +\n" "> +dev_put:\n" - "> +\tplatform_device_put(pdev);\n" + "> +=09platform_device_put(pdev);\n" "> +\n" - "> +\treturn ret;\n" + "> +=09return ret;\n" "> +}\n" "> +\n" "> +static void __init iort_smmu_init(void)\n" "> +{\n" - "> +\tstruct acpi_iort_node *iort_node, *iort_end;\n" - "> +\tstruct acpi_table_iort *iort;\n" - "> +\tstruct fwnode_handle *fwnode;\n" - "> +\tint i, ret;\n" - "> +\n" - "> +\t/*\n" - "> +\t * table and iort will both point to the start of IORT table, but\n" - "> +\t * have different struct types\n" - "> +\t */\n" - "> +\tiort = (struct acpi_table_iort *)iort_table;\n" + "> +=09struct acpi_iort_node *iort_node, *iort_end;\n" + "> +=09struct acpi_table_iort *iort;\n" + "> +=09struct fwnode_handle *fwnode;\n" + "> +=09int i, ret;\n" + "> +\n" + "> +=09/*\n" + "> +=09 * table and iort will both point to the start of IORT table, but\n" + "> +=09 * have different struct types\n" + "> +=09 */\n" + "> +=09iort =3D (struct acpi_table_iort *)iort_table;\n" ">\n" - "If the firmware of a platform happens to miss the IORT table, then iort_table here\n" - "will be a NULL pointer, in this case 'NULL pointer dereference' kernel panic will occur, \n" - "if this is not an expected behavior then we can add a sanity check here to avoid this. \n" + "If the firmware of a platform happens to miss the IORT table, then iort_tab=\n" + "le here\n" + "will be a NULL pointer, in this case 'NULL pointer dereference' kernel pani=\n" + "c will occur,=20\n" + "if this is not an expected behavior then we can add a sanity check here to =\n" + "avoid this.=20\n" "IORT missing is a fatal error? I don't think so.\n" "\n" "Thanks,\n" "Dennis\n" "> +\n" - "> +\t/* Get the first IORT node */\n" - "> +\tiort_node = ACPI_ADD_PTR(struct acpi_iort_node, iort_table,\n" - "> +\t\t\t\t iort->node_offset);\n" - "> +\tiort_end = ACPI_ADD_PTR(struct acpi_iort_node, iort_table,\n" - "> +\t\t\t\tiort_table->length);\n" - "> +\n" - "> +\tfor (i = 0; i < iort->node_count; i++) {\n" - "> +\n" - "> +\t\tif (iort_node >= iort_end) {\n" - "> +\t\t\tpr_err(\"iort node pointer overflows, bad table\\n\");\n" - "> +\t\t\treturn;\n" - "> +\t\t}\n" - "> +\n" - "> +\t\tif (iort_node->type == ACPI_IORT_NODE_SMMU ||\n" - "> +\t\t iort_node->type == ACPI_IORT_NODE_SMMU_V3) {\n" - "> +\t\t\tfwnode = iort_get_fwnode(iort_node);\n" - "> +\n" - "> +\t\t\tif (!fwnode)\n" - "> +\t\t\t\tcontinue;\n" - "> +\n" - "> +\t\t\tret = iort_add_smmu_platform_device(fwnode,\n" - "> +\t\t\t\t\t\t\t iort_node);\n" - "> +\t\t\tif (ret) {\n" - "> +\t\t\t\tpr_err(\"Error in platform device creation\\n\");\n" - "> +\t\t\t\treturn;\n" - "> +\t\t\t}\n" - "> +\t\t}\n" - "> +\n" - "> +\t\tiort_node = ACPI_ADD_PTR(struct acpi_iort_node, iort_node,\n" - "> +\t\t\t\t\t iort_node->length);\n" - "> +\t}\n" + "> +=09/* Get the first IORT node */\n" + "> +=09iort_node =3D ACPI_ADD_PTR(struct acpi_iort_node, iort_table,\n" + "> +=09=09=09=09 iort->node_offset);\n" + "> +=09iort_end =3D ACPI_ADD_PTR(struct acpi_iort_node, iort_table,\n" + "> +=09=09=09=09iort_table->length);\n" + "> +\n" + "> +=09for (i =3D 0; i < iort->node_count; i++) {\n" + "> +\n" + "> +=09=09if (iort_node >=3D iort_end) {\n" + "> +=09=09=09pr_err(\"iort node pointer overflows, bad table\\n\");\n" + "> +=09=09=09return;\n" + "> +=09=09}\n" + "> +\n" + "> +=09=09if (iort_node->type =3D=3D ACPI_IORT_NODE_SMMU ||\n" + "> +=09=09 iort_node->type =3D=3D ACPI_IORT_NODE_SMMU_V3) {\n" + "> +=09=09=09fwnode =3D iort_get_fwnode(iort_node);\n" + "> +\n" + "> +=09=09=09if (!fwnode)\n" + "> +=09=09=09=09continue;\n" + "> +\n" + "> +=09=09=09ret =3D iort_add_smmu_platform_device(fwnode,\n" + "> +=09=09=09=09=09=09=09 iort_node);\n" + "> +=09=09=09if (ret) {\n" + "> +=09=09=09=09pr_err(\"Error in platform device creation\\n\");\n" + "> +=09=09=09=09return;\n" + "> +=09=09=09}\n" + "> +=09=09}\n" + "> +\n" + "> +=09=09iort_node =3D ACPI_ADD_PTR(struct acpi_iort_node, iort_node,\n" + "> +=09=09=09=09=09 iort_node->length);\n" + "> +=09}\n" "> +}\n" "> +\n" "> void __init iort_table_detect(void)\n" "> {\n" - "> \tacpi_status status;\n" + "> =09acpi_status status;\n" "> @@ -465,4 +617,5 @@ void __init iort_table_detect(void)\n" - "> \t}\n" - "> \n" - "> \tacpi_probe_device_table(iort);\n" - "> +\tiort_smmu_init();\n" + "> =09}\n" + "> =20\n" + "> =09acpi_probe_device_table(iort);\n" + "> +=09iort_smmu_init();\n" "> }\n" - "> -- \n" + "> --=20\n" "> 2.6.4\n" - > + >=20 -7b5f26006562d376b9b245194a9fbb80f5cf87f1f18d42bcc5dce2e1b9d937f4 +b9ff8663a491b48b981b5e1e8a6c189ff1e26fcd4f7a9e60ca9647ea1ee0f1d4
diff --git a/a/1.txt b/N2/1.txt index 91c6e66..0f8a54a 100644 --- a/a/1.txt +++ b/N2/1.txt @@ -17,10 +17,10 @@ On Mon, Aug 15, 2016 at 04:23:34PM +0100, Lorenzo Pieralisi wrote: > platform devices names, init the IOMMUs, count their resources and > finally initialize them. > -> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi-5wv7dgnIgG8@public.gmane.org> -> Cc: Hanjun Guo <hanjun.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> -> Cc: Tomasz Nowicki <tn-nYOzD4b6Jr9Wk0Htik3J/w@public.gmane.org> -> Cc: "Rafael J. Wysocki" <rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org> +> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> +> Cc: Hanjun Guo <hanjun.guo@linaro.org> +> Cc: Tomasz Nowicki <tn@semihalf.com> +> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net> > --- > drivers/acpi/arm64/iort.c | 153 ++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 153 insertions(+) diff --git a/a/content_digest b/N2/content_digest index 015e47b..80130a9 100644 --- a/a/content_digest +++ b/N2/content_digest @@ -1,23 +1,9 @@ "ref\01471274620-20754-1-git-send-email-lorenzo.pieralisi@arm.com\0" "ref\01471274620-20754-10-git-send-email-lorenzo.pieralisi@arm.com\0" - "ref\01471274620-20754-10-git-send-email-lorenzo.pieralisi-5wv7dgnIgG8@public.gmane.org\0" - "From\0Dennis Chen <dennis.chen-5wv7dgnIgG8@public.gmane.org>\0" - "Subject\0Re: [PATCH v4 09/15] drivers: acpi: iort: add support for ARM SMMU platform devices creation\0" + "From\0dennis.chen@arm.com (Dennis Chen)\0" + "Subject\0[PATCH v4 09/15] drivers: acpi: iort: add support for ARM SMMU platform devices creation\0" "Date\0Thu, 18 Aug 2016 18:50:07 +0800\0" - "To\0Lorenzo Pieralisi <lorenzo.pieralisi-5wv7dgnIgG8@public.gmane.org>\0" - "Cc\0linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org" - Marc Zyngier <marc.zyngier-5wv7dgnIgG8@public.gmane.org> - Tomasz Nowicki <tn-nYOzD4b6Jr9Wk0Htik3J/w@public.gmane.org> - Rafael J. Wysocki <rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org> - linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org - Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org> - linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org - Sinan Kaya <okaya-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org> - linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org - iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org - Hanjun Guo <hanjun.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> - Jon Masters <jcm-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> - " nd-5wv7dgnIgG8@public.gmane.org\0" + "To\0linux-arm-kernel@lists.infradead.org\0" "\00:1\0" "b\0" "Hi Lorenzo,\n" @@ -39,10 +25,10 @@ "> platform devices names, init the IOMMUs, count their resources and\n" "> finally initialize them.\n" "> \n" - "> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi-5wv7dgnIgG8@public.gmane.org>\n" - "> Cc: Hanjun Guo <hanjun.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>\n" - "> Cc: Tomasz Nowicki <tn-nYOzD4b6Jr9Wk0Htik3J/w@public.gmane.org>\n" - "> Cc: \"Rafael J. Wysocki\" <rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org>\n" + "> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>\n" + "> Cc: Hanjun Guo <hanjun.guo@linaro.org>\n" + "> Cc: Tomasz Nowicki <tn@semihalf.com>\n" + "> Cc: \"Rafael J. Wysocki\" <rjw@rjwysocki.net>\n" "> ---\n" "> drivers/acpi/arm64/iort.c | 153 ++++++++++++++++++++++++++++++++++++++++++++++\n" "> 1 file changed, 153 insertions(+)\n" @@ -235,4 +221,4 @@ "> 2.6.4\n" > -7b5f26006562d376b9b245194a9fbb80f5cf87f1f18d42bcc5dce2e1b9d937f4 +23597ea03d862c7f6fc2b167496380fc54da09fa8b5aae941f6f69b95f45784e
diff --git a/a/1.txt b/N3/1.txt index 91c6e66..0f8a54a 100644 --- a/a/1.txt +++ b/N3/1.txt @@ -17,10 +17,10 @@ On Mon, Aug 15, 2016 at 04:23:34PM +0100, Lorenzo Pieralisi wrote: > platform devices names, init the IOMMUs, count their resources and > finally initialize them. > -> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi-5wv7dgnIgG8@public.gmane.org> -> Cc: Hanjun Guo <hanjun.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> -> Cc: Tomasz Nowicki <tn-nYOzD4b6Jr9Wk0Htik3J/w@public.gmane.org> -> Cc: "Rafael J. Wysocki" <rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org> +> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> +> Cc: Hanjun Guo <hanjun.guo@linaro.org> +> Cc: Tomasz Nowicki <tn@semihalf.com> +> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net> > --- > drivers/acpi/arm64/iort.c | 153 ++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 153 insertions(+) diff --git a/a/content_digest b/N3/content_digest index 015e47b..ac8bc36 100644 --- a/a/content_digest +++ b/N3/content_digest @@ -1,23 +1,25 @@ "ref\01471274620-20754-1-git-send-email-lorenzo.pieralisi@arm.com\0" "ref\01471274620-20754-10-git-send-email-lorenzo.pieralisi@arm.com\0" - "ref\01471274620-20754-10-git-send-email-lorenzo.pieralisi-5wv7dgnIgG8@public.gmane.org\0" - "From\0Dennis Chen <dennis.chen-5wv7dgnIgG8@public.gmane.org>\0" + "From\0Dennis Chen <dennis.chen@arm.com>\0" "Subject\0Re: [PATCH v4 09/15] drivers: acpi: iort: add support for ARM SMMU platform devices creation\0" "Date\0Thu, 18 Aug 2016 18:50:07 +0800\0" - "To\0Lorenzo Pieralisi <lorenzo.pieralisi-5wv7dgnIgG8@public.gmane.org>\0" - "Cc\0linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org" - Marc Zyngier <marc.zyngier-5wv7dgnIgG8@public.gmane.org> - Tomasz Nowicki <tn-nYOzD4b6Jr9Wk0Htik3J/w@public.gmane.org> - Rafael J. Wysocki <rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org> - linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org - Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org> - linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org - Sinan Kaya <okaya-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org> - linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org - iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org - Hanjun Guo <hanjun.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> - Jon Masters <jcm-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> - " nd-5wv7dgnIgG8@public.gmane.org\0" + "To\0Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>\0" + "Cc\0<iommu@lists.linux-foundation.org>" + Hanjun Guo <hanjun.guo@linaro.org> + Tomasz Nowicki <tn@semihalf.com> + Rafael J. Wysocki <rjw@rjwysocki.net> + Will Deacon <will.deacon@arm.com> + Marc Zyngier <marc.zyngier@arm.com> + Robin Murphy <robin.murphy@arm.com> + Joerg Roedel <joro@8bytes.org> + Jon Masters <jcm@redhat.com> + Sinan Kaya <okaya@codeaurora.org> + Nate Watterson <nwatters@codeaurora.org> + <linux-acpi@vger.kernel.org> + <linux-pci@vger.kernel.org> + <linux-kernel@vger.kernel.org> + <linux-arm-kernel@lists.infradead.org> + " <nd@arm.com>\0" "\00:1\0" "b\0" "Hi Lorenzo,\n" @@ -39,10 +41,10 @@ "> platform devices names, init the IOMMUs, count their resources and\n" "> finally initialize them.\n" "> \n" - "> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi-5wv7dgnIgG8@public.gmane.org>\n" - "> Cc: Hanjun Guo <hanjun.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>\n" - "> Cc: Tomasz Nowicki <tn-nYOzD4b6Jr9Wk0Htik3J/w@public.gmane.org>\n" - "> Cc: \"Rafael J. Wysocki\" <rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org>\n" + "> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>\n" + "> Cc: Hanjun Guo <hanjun.guo@linaro.org>\n" + "> Cc: Tomasz Nowicki <tn@semihalf.com>\n" + "> Cc: \"Rafael J. Wysocki\" <rjw@rjwysocki.net>\n" "> ---\n" "> drivers/acpi/arm64/iort.c | 153 ++++++++++++++++++++++++++++++++++++++++++++++\n" "> 1 file changed, 153 insertions(+)\n" @@ -235,4 +237,4 @@ "> 2.6.4\n" > -7b5f26006562d376b9b245194a9fbb80f5cf87f1f18d42bcc5dce2e1b9d937f4 +b3f2882316c3ad0d863a1bde0baca35c7f5d10c02a1fe9588a699af868f92d45
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.