All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robherring2@gmail.com>
To: Murali Karicheri <m-karicheri2@ti.com>
Cc: "linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Linux IOMMU <iommu@lists.linux-foundation.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	Joerg Roedel <joro@8bytes.org>,
	Grant Likely <grant.likely@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Will Deacon <will.deacon@arm.com>,
	Russell King <linux@arm.linux.org.uk>,
	Arnd Bergmann <arnd@arndb.de>,
	Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Subject: Re: [PATCH v5 1/8] of: iommu: add ptr to OF node arg to of_iommu_configure()
Date: Tue, 27 Jan 2015 20:18:28 -0600	[thread overview]
Message-ID: <CAL_JsqLSxzWt6JiKbzpPPZEygU07AJ+oj24zcPmnhUXoLTnQjA@mail.gmail.com> (raw)
In-Reply-To: <1422392405-32196-2-git-send-email-m-karicheri2@ti.com>

On Tue, Jan 27, 2015 at 2:59 PM, Murali Karicheri <m-karicheri2@ti.com> wrote:
> Function of_iommu_configure() is called from of_dma_configure() to
> setup iommu ops using DT property. This API is currently used for
> platform devices for which DMA configuration (including iommu ops)
> may come from device's parent. To extend this functionality for PCI
> devices, this API need to take a parent node ptr as an argument
> instead of assuming device's parent. This is needed since for PCI, the
> dma configuration may be defined in the DT node of the root bus bridge's
> parent device. Currently only dma-range is used for PCI and iommu is not
> supported. So return error if the device is PCI.
>
> Cc: Joerg Roedel <joro@8bytes.org>
> Cc: Grant Likely <grant.likely@linaro.org>
> Cc: Rob Herring <robh+dt@kernel.org>

Acked-by: Rob Herring <robh@kernel.org>

> Cc: Will Deacon <will.deacon@arm.com>
> Cc: Russell King <linux@arm.linux.org.uk>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
>
> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
> Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
> ---
>  drivers/iommu/of_iommu.c |   10 ++++++++--
>  drivers/of/platform.c    |    2 +-
>  include/linux/of_iommu.h |    6 ++++--
>  3 files changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c
> index af1dc6a..439235b 100644
> --- a/drivers/iommu/of_iommu.c
> +++ b/drivers/iommu/of_iommu.c
> @@ -133,19 +133,25 @@ struct iommu_ops *of_iommu_get_ops(struct device_node *np)
>         return ops;
>  }
>
> -struct iommu_ops *of_iommu_configure(struct device *dev)
> +struct iommu_ops *of_iommu_configure(struct device *dev,
> +                                    struct device_node *iommu_np)
>  {
>         struct of_phandle_args iommu_spec;
>         struct device_node *np;
>         struct iommu_ops *ops = NULL;
>         int idx = 0;
>
> +       if (dev_is_pci(dev)) {
> +               dev_err(dev, "iommu is currently not supported for PCI\n");
> +               return NULL;
> +       }
> +
>         /*
>          * We don't currently walk up the tree looking for a parent IOMMU.
>          * See the `Notes:' section of
>          * Documentation/devicetree/bindings/iommu/iommu.txt
>          */
> -       while (!of_parse_phandle_with_args(dev->of_node, "iommus",
> +       while (!of_parse_phandle_with_args(iommu_np, "iommus",
>                                            "#iommu-cells", idx,
>                                            &iommu_spec)) {
>                 np = iommu_spec.np;
> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
> index b0d50d7..d3f3988 100644
> --- a/drivers/of/platform.c
> +++ b/drivers/of/platform.c
> @@ -196,7 +196,7 @@ static void of_dma_configure(struct device *dev)
>         dev_dbg(dev, "device is%sdma coherent\n",
>                 coherent ? " " : " not ");
>
> -       iommu = of_iommu_configure(dev);
> +       iommu = of_iommu_configure(dev, dev->of_node);
>         dev_dbg(dev, "device is%sbehind an iommu\n",
>                 iommu ? " " : " not ");
>
> diff --git a/include/linux/of_iommu.h b/include/linux/of_iommu.h
> index 16c7554..a97e5bd 100644
> --- a/include/linux/of_iommu.h
> +++ b/include/linux/of_iommu.h
> @@ -12,7 +12,8 @@ extern int of_get_dma_window(struct device_node *dn, const char *prefix,
>                              size_t *size);
>
>  extern void of_iommu_init(void);
> -extern struct iommu_ops *of_iommu_configure(struct device *dev);
> +extern struct iommu_ops *of_iommu_configure(struct device *dev,
> +                                       struct device_node *iommu_np);
>
>  #else
>
> @@ -24,7 +25,8 @@ static inline int of_get_dma_window(struct device_node *dn, const char *prefix,
>  }
>
>  static inline void of_iommu_init(void) { }
> -static inline struct iommu_ops *of_iommu_configure(struct device *dev)
> +static inline struct iommu_ops *of_iommu_configure(struct device *dev,
> +                                        struct device_node *iommu_np)
>  {
>         return NULL;
>  }
> --
> 1.7.9.5
>

WARNING: multiple messages have this Message-ID (diff)
From: Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Murali Karicheri <m-karicheri2-l0cyMroinI0@public.gmane.org>
Cc: "devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Russell King <linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>,
	Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>,
	"linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Linux IOMMU
	<iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Grant Likely
	<grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
Subject: Re: [PATCH v5 1/8] of: iommu: add ptr to OF node arg to of_iommu_configure()
Date: Tue, 27 Jan 2015 20:18:28 -0600	[thread overview]
Message-ID: <CAL_JsqLSxzWt6JiKbzpPPZEygU07AJ+oj24zcPmnhUXoLTnQjA@mail.gmail.com> (raw)
In-Reply-To: <1422392405-32196-2-git-send-email-m-karicheri2-l0cyMroinI0@public.gmane.org>

On Tue, Jan 27, 2015 at 2:59 PM, Murali Karicheri <m-karicheri2-l0cyMroinI0@public.gmane.org> wrote:
> Function of_iommu_configure() is called from of_dma_configure() to
> setup iommu ops using DT property. This API is currently used for
> platform devices for which DMA configuration (including iommu ops)
> may come from device's parent. To extend this functionality for PCI
> devices, this API need to take a parent node ptr as an argument
> instead of assuming device's parent. This is needed since for PCI, the
> dma configuration may be defined in the DT node of the root bus bridge's
> parent device. Currently only dma-range is used for PCI and iommu is not
> supported. So return error if the device is PCI.
>
> Cc: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
> Cc: Grant Likely <grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> Cc: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

> Cc: Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>
> Cc: Russell King <linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>
> Cc: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
> Cc: Suravee Suthikulpanit <Suravee.Suthikulpanit-5C7GfCeVMHo@public.gmane.org>
>
> Acked-by: Bjorn Helgaas <bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
> Signed-off-by: Murali Karicheri <m-karicheri2-l0cyMroinI0@public.gmane.org>
> ---
>  drivers/iommu/of_iommu.c |   10 ++++++++--
>  drivers/of/platform.c    |    2 +-
>  include/linux/of_iommu.h |    6 ++++--
>  3 files changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c
> index af1dc6a..439235b 100644
> --- a/drivers/iommu/of_iommu.c
> +++ b/drivers/iommu/of_iommu.c
> @@ -133,19 +133,25 @@ struct iommu_ops *of_iommu_get_ops(struct device_node *np)
>         return ops;
>  }
>
> -struct iommu_ops *of_iommu_configure(struct device *dev)
> +struct iommu_ops *of_iommu_configure(struct device *dev,
> +                                    struct device_node *iommu_np)
>  {
>         struct of_phandle_args iommu_spec;
>         struct device_node *np;
>         struct iommu_ops *ops = NULL;
>         int idx = 0;
>
> +       if (dev_is_pci(dev)) {
> +               dev_err(dev, "iommu is currently not supported for PCI\n");
> +               return NULL;
> +       }
> +
>         /*
>          * We don't currently walk up the tree looking for a parent IOMMU.
>          * See the `Notes:' section of
>          * Documentation/devicetree/bindings/iommu/iommu.txt
>          */
> -       while (!of_parse_phandle_with_args(dev->of_node, "iommus",
> +       while (!of_parse_phandle_with_args(iommu_np, "iommus",
>                                            "#iommu-cells", idx,
>                                            &iommu_spec)) {
>                 np = iommu_spec.np;
> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
> index b0d50d7..d3f3988 100644
> --- a/drivers/of/platform.c
> +++ b/drivers/of/platform.c
> @@ -196,7 +196,7 @@ static void of_dma_configure(struct device *dev)
>         dev_dbg(dev, "device is%sdma coherent\n",
>                 coherent ? " " : " not ");
>
> -       iommu = of_iommu_configure(dev);
> +       iommu = of_iommu_configure(dev, dev->of_node);
>         dev_dbg(dev, "device is%sbehind an iommu\n",
>                 iommu ? " " : " not ");
>
> diff --git a/include/linux/of_iommu.h b/include/linux/of_iommu.h
> index 16c7554..a97e5bd 100644
> --- a/include/linux/of_iommu.h
> +++ b/include/linux/of_iommu.h
> @@ -12,7 +12,8 @@ extern int of_get_dma_window(struct device_node *dn, const char *prefix,
>                              size_t *size);
>
>  extern void of_iommu_init(void);
> -extern struct iommu_ops *of_iommu_configure(struct device *dev);
> +extern struct iommu_ops *of_iommu_configure(struct device *dev,
> +                                       struct device_node *iommu_np);
>
>  #else
>
> @@ -24,7 +25,8 @@ static inline int of_get_dma_window(struct device_node *dn, const char *prefix,
>  }
>
>  static inline void of_iommu_init(void) { }
> -static inline struct iommu_ops *of_iommu_configure(struct device *dev)
> +static inline struct iommu_ops *of_iommu_configure(struct device *dev,
> +                                        struct device_node *iommu_np)
>  {
>         return NULL;
>  }
> --
> 1.7.9.5
>

WARNING: multiple messages have this Message-ID (diff)
From: robherring2@gmail.com (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v5 1/8] of: iommu: add ptr to OF node arg to of_iommu_configure()
Date: Tue, 27 Jan 2015 20:18:28 -0600	[thread overview]
Message-ID: <CAL_JsqLSxzWt6JiKbzpPPZEygU07AJ+oj24zcPmnhUXoLTnQjA@mail.gmail.com> (raw)
In-Reply-To: <1422392405-32196-2-git-send-email-m-karicheri2@ti.com>

On Tue, Jan 27, 2015 at 2:59 PM, Murali Karicheri <m-karicheri2@ti.com> wrote:
> Function of_iommu_configure() is called from of_dma_configure() to
> setup iommu ops using DT property. This API is currently used for
> platform devices for which DMA configuration (including iommu ops)
> may come from device's parent. To extend this functionality for PCI
> devices, this API need to take a parent node ptr as an argument
> instead of assuming device's parent. This is needed since for PCI, the
> dma configuration may be defined in the DT node of the root bus bridge's
> parent device. Currently only dma-range is used for PCI and iommu is not
> supported. So return error if the device is PCI.
>
> Cc: Joerg Roedel <joro@8bytes.org>
> Cc: Grant Likely <grant.likely@linaro.org>
> Cc: Rob Herring <robh+dt@kernel.org>

Acked-by: Rob Herring <robh@kernel.org>

> Cc: Will Deacon <will.deacon@arm.com>
> Cc: Russell King <linux@arm.linux.org.uk>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
>
> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
> Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
> ---
>  drivers/iommu/of_iommu.c |   10 ++++++++--
>  drivers/of/platform.c    |    2 +-
>  include/linux/of_iommu.h |    6 ++++--
>  3 files changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c
> index af1dc6a..439235b 100644
> --- a/drivers/iommu/of_iommu.c
> +++ b/drivers/iommu/of_iommu.c
> @@ -133,19 +133,25 @@ struct iommu_ops *of_iommu_get_ops(struct device_node *np)
>         return ops;
>  }
>
> -struct iommu_ops *of_iommu_configure(struct device *dev)
> +struct iommu_ops *of_iommu_configure(struct device *dev,
> +                                    struct device_node *iommu_np)
>  {
>         struct of_phandle_args iommu_spec;
>         struct device_node *np;
>         struct iommu_ops *ops = NULL;
>         int idx = 0;
>
> +       if (dev_is_pci(dev)) {
> +               dev_err(dev, "iommu is currently not supported for PCI\n");
> +               return NULL;
> +       }
> +
>         /*
>          * We don't currently walk up the tree looking for a parent IOMMU.
>          * See the `Notes:' section of
>          * Documentation/devicetree/bindings/iommu/iommu.txt
>          */
> -       while (!of_parse_phandle_with_args(dev->of_node, "iommus",
> +       while (!of_parse_phandle_with_args(iommu_np, "iommus",
>                                            "#iommu-cells", idx,
>                                            &iommu_spec)) {
>                 np = iommu_spec.np;
> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
> index b0d50d7..d3f3988 100644
> --- a/drivers/of/platform.c
> +++ b/drivers/of/platform.c
> @@ -196,7 +196,7 @@ static void of_dma_configure(struct device *dev)
>         dev_dbg(dev, "device is%sdma coherent\n",
>                 coherent ? " " : " not ");
>
> -       iommu = of_iommu_configure(dev);
> +       iommu = of_iommu_configure(dev, dev->of_node);
>         dev_dbg(dev, "device is%sbehind an iommu\n",
>                 iommu ? " " : " not ");
>
> diff --git a/include/linux/of_iommu.h b/include/linux/of_iommu.h
> index 16c7554..a97e5bd 100644
> --- a/include/linux/of_iommu.h
> +++ b/include/linux/of_iommu.h
> @@ -12,7 +12,8 @@ extern int of_get_dma_window(struct device_node *dn, const char *prefix,
>                              size_t *size);
>
>  extern void of_iommu_init(void);
> -extern struct iommu_ops *of_iommu_configure(struct device *dev);
> +extern struct iommu_ops *of_iommu_configure(struct device *dev,
> +                                       struct device_node *iommu_np);
>
>  #else
>
> @@ -24,7 +25,8 @@ static inline int of_get_dma_window(struct device_node *dn, const char *prefix,
>  }
>
>  static inline void of_iommu_init(void) { }
> -static inline struct iommu_ops *of_iommu_configure(struct device *dev)
> +static inline struct iommu_ops *of_iommu_configure(struct device *dev,
> +                                        struct device_node *iommu_np)
>  {
>         return NULL;
>  }
> --
> 1.7.9.5
>

  reply	other threads:[~2015-01-28  2:18 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-27 20:59 [PATCH v5 0/8] PCI: get DMA configuration from parent device Murali Karicheri
2015-01-27 20:59 ` Murali Karicheri
2015-01-27 20:59 ` Murali Karicheri
2015-01-27 20:59 ` [PATCH v5 1/8] of: iommu: add ptr to OF node arg to of_iommu_configure() Murali Karicheri
2015-01-27 20:59   ` Murali Karicheri
2015-01-27 20:59   ` Murali Karicheri
2015-01-28  2:18   ` Rob Herring [this message]
2015-01-28  2:18     ` Rob Herring
2015-01-28  2:18     ` Rob Herring
2015-01-28  2:18     ` Rob Herring
2015-01-27 20:59 ` [PATCH v5 2/8] of: move of_dma_configure() to device.c to help re-use Murali Karicheri
2015-01-27 20:59   ` Murali Karicheri
2015-01-27 20:59   ` Murali Karicheri
2015-01-27 21:00 ` [PATCH v5 3/8] of: fix size when dma-range is not used Murali Karicheri
2015-01-27 21:00   ` Murali Karicheri
2015-01-27 21:00   ` Murali Karicheri
2015-01-28  2:37   ` Rob Herring
2015-01-28  2:37     ` Rob Herring
2015-01-28  2:37     ` Rob Herring
2015-01-28  2:37     ` Rob Herring
2015-01-28 11:21   ` Robin Murphy
2015-01-28 11:21     ` Robin Murphy
2015-01-28 11:21     ` Robin Murphy
2015-01-28 11:21     ` Robin Murphy
2015-01-28 15:28     ` Murali Karicheri
2015-01-28 15:28       ` Murali Karicheri
2015-01-28 15:28       ` Murali Karicheri
2015-01-28 15:28       ` Murali Karicheri
2015-01-27 21:00 ` [PATCH v5 4/8] PCI: add helper functions pci_get[put]_host_bridge_device() Murali Karicheri
2015-01-27 21:00   ` Murali Karicheri
2015-01-27 21:00   ` Murali Karicheri
2015-01-27 21:00 ` [PATCH v5 5/8] of/pci: add of_pci_dma_configure() update dma configuration Murali Karicheri
2015-01-27 21:00   ` Murali Karicheri
2015-01-27 21:00   ` Murali Karicheri
2015-01-28  2:49   ` Rob Herring
2015-01-28  2:49     ` Rob Herring
2015-01-28  2:49     ` Rob Herring
2015-01-28  2:49     ` Rob Herring
2015-01-27 21:00 ` [PATCH v5 6/8] PCI: update dma configuration from DT Murali Karicheri
2015-01-27 21:00   ` Murali Karicheri
2015-01-27 21:00   ` Murali Karicheri
2015-01-27 21:00 ` [PATCH v5 7/8] arm: dma-mapping: limit iommu mapping size Murali Karicheri
2015-01-27 21:00   ` Murali Karicheri
2015-01-27 21:00   ` Murali Karicheri
2015-01-27 21:00 ` [PATCH v5 8/8] of: limit dma_mask of the device based on dma-range size Murali Karicheri
2015-01-27 21:00   ` Murali Karicheri
2015-01-27 21:00   ` Murali Karicheri

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAL_JsqLSxzWt6JiKbzpPPZEygU07AJ+oj24zcPmnhUXoLTnQjA@mail.gmail.com \
    --to=robherring2@gmail.com \
    --cc=Suravee.Suthikulpanit@amd.com \
    --cc=arnd@arndb.de \
    --cc=devicetree@vger.kernel.org \
    --cc=grant.likely@linaro.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=m-karicheri2@ti.com \
    --cc=robh+dt@kernel.org \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.