All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bharat Bhushan <bharat.bhushan@nxp.com>
To: Robin Murphy <robin.murphy@arm.com>,
	Nipun Gupta <nipun.gupta@nxp.com>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"frowand.list@gmail.com" <frowand.list@gmail.com>
Cc: "will.deacon@arm.com" <will.deacon@arm.com>,
	"mark.rutland@arm.com" <mark.rutland@arm.com>,
	"catalin.marinas@arm.com" <catalin.marinas@arm.com>,
	"hch@lst.de" <hch@lst.de>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"joro@8bytes.org" <joro@8bytes.org>,
	"m.szyprowski@samsung.com" <m.szyprowski@samsung.com>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	"bhelgaas@google.com" <bhelgaas@google.com>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"stuyoder@gmail.com" <stuyoder@gmail.com>,
	Laurentiu Tudor <laurentiu.tudor@nxp.com>,
	Leo Li <leoyang.li@nxp.com>
Subject: RE: [PATCH 2/6 v2] iommu: of: make of_pci_map_rid() available for other devices too
Date: Wed, 18 Apr 2018 05:09:47 +0000	[thread overview]
Message-ID: <AM5PR0401MB25452C7E2281806F90163E519AB60@AM5PR0401MB2545.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <41b32766-e21a-e946-6c8f-440e5c87d0ee@arm.com>



> -----Original Message-----
> From: Robin Murphy [mailto:robin.murphy@arm.com]
> Sent: Tuesday, April 17, 2018 10:23 PM
> To: Nipun Gupta <nipun.gupta@nxp.com>; robh+dt@kernel.org;
> frowand.list@gmail.com
> Cc: will.deacon@arm.com; mark.rutland@arm.com; catalin.marinas@arm.com;
> hch@lst.de; gregkh@linuxfoundation.org; joro@8bytes.org;
> m.szyprowski@samsung.com; shawnguo@kernel.org; bhelgaas@google.com;
> iommu@lists.linux-foundation.org; linux-kernel@vger.kernel.org;
> devicetree@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linuxppc-
> dev@lists.ozlabs.org; linux-pci@vger.kernel.org; Bharat Bhushan
> <bharat.bhushan@nxp.com>; stuyoder@gmail.com; Laurentiu Tudor
> <laurentiu.tudor@nxp.com>; Leo Li <leoyang.li@nxp.com>
> Subject: Re: [PATCH 2/6 v2] iommu: of: make of_pci_map_rid() available for
> other devices too
> 
> On 17/04/18 11:21, Nipun Gupta wrote:
> > iommu-map property is also used by devices with fsl-mc. This patch
> > moves the of_pci_map_rid to generic location, so that it can be used
> > by other busses too.

Nipun, please clarify that only function name is changed and rest of body is same.

> >
> > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > ---
> >   drivers/iommu/of_iommu.c | 106
> > +++++++++++++++++++++++++++++++++++++++++++++--
> 
> Doesn't this break "msi-parent" parsing for !CONFIG_OF_IOMMU?

Yes, this will be a problem with MSI 

> I guess you
> don't want fsl-mc to have to depend on PCI, but this looks like a step in the
> wrong direction.
> 
> I'm not entirely sure where of_map_rid() fits best, but from a quick look around
> the least-worst option might be drivers/of/of_address.c, unless Rob and Frank
> have a better idea of where generic DT-based ID translation routines could live?

drivers/of/address.c may be proper place to move until someone have better idea.

Thanks
-Bharat

> 
> >   drivers/of/irq.c         |   6 +--
> >   drivers/pci/of.c         | 101 --------------------------------------------
> >   include/linux/of_iommu.h |  11 +++++
> >   include/linux/of_pci.h   |  10 -----
> >   5 files changed, 117 insertions(+), 117 deletions(-)
> >
> > diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c index
> > 5c36a8b..4e7712f 100644
> > --- a/drivers/iommu/of_iommu.c
> > +++ b/drivers/iommu/of_iommu.c
> > @@ -138,6 +138,106 @@ static int of_iommu_xlate(struct device *dev,
> >   	return ops->of_xlate(dev, iommu_spec);
> >   }
> >
> > +/**
> > + * of_map_rid - Translate a requester ID through a downstream mapping.
> > + * @np: root complex device node.
> > + * @rid: device requester ID to map.
> > + * @map_name: property name of the map to use.
> > + * @map_mask_name: optional property name of the mask to use.
> > + * @target: optional pointer to a target device node.
> > + * @id_out: optional pointer to receive the translated ID.
> > + *
> > + * Given a device requester ID, look up the appropriate
> > +implementation-defined
> > + * platform ID and/or the target device which receives transactions
> > +on that
> > + * ID, as per the "iommu-map" and "msi-map" bindings. Either of
> > +@target or
> > + * @id_out may be NULL if only the other is required. If @target
> > +points to
> > + * a non-NULL device node pointer, only entries targeting that node
> > +will be
> > + * matched; if it points to a NULL value, it will receive the device
> > +node of
> > + * the first matching target phandle, with a reference held.
> > + *
> > + * Return: 0 on success or a standard error code on failure.
> > + */
> > +int of_map_rid(struct device_node *np, u32 rid,
> > +		   const char *map_name, const char *map_mask_name,
> > +		   struct device_node **target, u32 *id_out) {
> > +	u32 map_mask, masked_rid;
> > +	int map_len;
> > +	const __be32 *map = NULL;
> > +
> > +	if (!np || !map_name || (!target && !id_out))
> > +		return -EINVAL;
> > +
> > +	map = of_get_property(np, map_name, &map_len);
> > +	if (!map) {
> > +		if (target)
> > +			return -ENODEV;
> > +		/* Otherwise, no map implies no translation */
> > +		*id_out = rid;
> > +		return 0;
> > +	}
> > +
> > +	if (!map_len || map_len % (4 * sizeof(*map))) {
> > +		pr_err("%pOF: Error: Bad %s length: %d\n", np,
> > +			map_name, map_len);
> > +		return -EINVAL;
> > +	}
> > +
> > +	/* The default is to select all bits. */
> > +	map_mask = 0xffffffff;
> > +
> > +	/*
> > +	 * Can be overridden by "{iommu,msi}-map-mask" property.
> > +	 */
> > +	if (map_mask_name)
> > +		of_property_read_u32(np, map_mask_name, &map_mask);
> > +
> > +	masked_rid = map_mask & rid;
> > +	for ( ; map_len > 0; map_len -= 4 * sizeof(*map), map += 4) {
> > +		struct device_node *phandle_node;
> > +		u32 rid_base = be32_to_cpup(map + 0);
> > +		u32 phandle = be32_to_cpup(map + 1);
> > +		u32 out_base = be32_to_cpup(map + 2);
> > +		u32 rid_len = be32_to_cpup(map + 3);
> > +
> > +		if (rid_base & ~map_mask) {
> > +			pr_err("%pOF: Invalid %s translation - %s-mask (0x%x)
> ignores rid-base (0x%x)\n",
> > +				np, map_name, map_name,
> > +				map_mask, rid_base);
> > +			return -EFAULT;
> > +		}
> > +
> > +		if (masked_rid < rid_base || masked_rid >= rid_base + rid_len)
> > +			continue;
> > +
> > +		phandle_node = of_find_node_by_phandle(phandle);
> > +		if (!phandle_node)
> > +			return -ENODEV;
> > +
> > +		if (target) {
> > +			if (*target)
> > +				of_node_put(phandle_node);
> > +			else
> > +				*target = phandle_node;
> > +
> > +			if (*target != phandle_node)
> > +				continue;
> > +		}
> > +
> > +		if (id_out)
> > +			*id_out = masked_rid - rid_base + out_base;
> > +
> > +		pr_debug("%pOF: %s, using mask %08x, rid-base: %08x, out-
> base: %08x, length: %08x, rid: %08x -> %08x\n",
> > +			np, map_name, map_mask, rid_base, out_base,
> > +			rid_len, rid, masked_rid - rid_base + out_base);
> > +		return 0;
> > +	}
> > +
> > +	pr_err("%pOF: Invalid %s translation - no match for rid 0x%x on
> %pOF\n",
> > +		np, map_name, rid, target && *target ? *target : NULL);
> > +	return -EFAULT;
> > +}
> > +
> >   struct of_pci_iommu_alias_info {
> >   	struct device *dev;
> >   	struct device_node *np;
> > @@ -149,9 +249,9 @@ static int of_pci_iommu_init(struct pci_dev *pdev, u16
> alias, void *data)
> >   	struct of_phandle_args iommu_spec = { .args_count = 1 };
> >   	int err;
> >
> > -	err = of_pci_map_rid(info->np, alias, "iommu-map",
> > -			     "iommu-map-mask", &iommu_spec.np,
> > -			     iommu_spec.args);
> > +	err = of_map_rid(info->np, alias, "iommu-map",
> > +			 "iommu-map-mask", &iommu_spec.np,
> > +			 iommu_spec.args);
> 
> Super-nit: Apparently I missed rewrapping this to 2 lines in d87beb749281, but if
> it's being touched again, that would be nice ;)
> 
> Robin.
> 
> >   	if (err)
> >   		return err == -ENODEV ? NO_IOMMU : err;
> >
> > diff --git a/drivers/of/irq.c b/drivers/of/irq.c index
> > 02ad93a..b72eeec 100644
> > --- a/drivers/of/irq.c
> > +++ b/drivers/of/irq.c
> > @@ -22,7 +22,7 @@
> >   #include <linux/module.h>
> >   #include <linux/of.h>
> >   #include <linux/of_irq.h>
> > -#include <linux/of_pci.h>
> > +#include <linux/of_iommu.h>
> >   #include <linux/string.h>
> >   #include <linux/slab.h>
> >
> > @@ -588,8 +588,8 @@ static u32 __of_msi_map_rid(struct device *dev,
> struct device_node **np,
> >   	 * "msi-map" property.
> >   	 */
> >   	for (parent_dev = dev; parent_dev; parent_dev = parent_dev->parent)
> > -		if (!of_pci_map_rid(parent_dev->of_node, rid_in, "msi-map",
> > -				    "msi-map-mask", np, &rid_out))
> > +		if (!of_map_rid(parent_dev->of_node, rid_in, "msi-map",
> > +				"msi-map-mask", np, &rid_out))
> >   			break;
> >   	return rid_out;
> >   }
> > diff --git a/drivers/pci/of.c b/drivers/pci/of.c index
> > a28355c..d2cebbe 100644
> > --- a/drivers/pci/of.c
> > +++ b/drivers/pci/of.c
> > @@ -362,107 +362,6 @@ int of_pci_get_host_bridge_resources(struct
> device_node *dev,
> >   EXPORT_SYMBOL_GPL(of_pci_get_host_bridge_resources);
> >   #endif /* CONFIG_OF_ADDRESS */
> >
> > -/**
> > - * of_pci_map_rid - Translate a requester ID through a downstream mapping.
> > - * @np: root complex device node.
> > - * @rid: PCI requester ID to map.
> > - * @map_name: property name of the map to use.
> > - * @map_mask_name: optional property name of the mask to use.
> > - * @target: optional pointer to a target device node.
> > - * @id_out: optional pointer to receive the translated ID.
> > - *
> > - * Given a PCI requester ID, look up the appropriate
> > implementation-defined
> > - * platform ID and/or the target device which receives transactions
> > on that
> > - * ID, as per the "iommu-map" and "msi-map" bindings. Either of
> > @target or
> > - * @id_out may be NULL if only the other is required. If @target
> > points to
> > - * a non-NULL device node pointer, only entries targeting that node
> > will be
> > - * matched; if it points to a NULL value, it will receive the device
> > node of
> > - * the first matching target phandle, with a reference held.
> > - *
> > - * Return: 0 on success or a standard error code on failure.
> > - */
> > -int of_pci_map_rid(struct device_node *np, u32 rid,
> > -		   const char *map_name, const char *map_mask_name,
> > -		   struct device_node **target, u32 *id_out)
> > -{
> > -	u32 map_mask, masked_rid;
> > -	int map_len;
> > -	const __be32 *map = NULL;
> > -
> > -	if (!np || !map_name || (!target && !id_out))
> > -		return -EINVAL;
> > -
> > -	map = of_get_property(np, map_name, &map_len);
> > -	if (!map) {
> > -		if (target)
> > -			return -ENODEV;
> > -		/* Otherwise, no map implies no translation */
> > -		*id_out = rid;
> > -		return 0;
> > -	}
> > -
> > -	if (!map_len || map_len % (4 * sizeof(*map))) {
> > -		pr_err("%pOF: Error: Bad %s length: %d\n", np,
> > -			map_name, map_len);
> > -		return -EINVAL;
> > -	}
> > -
> > -	/* The default is to select all bits. */
> > -	map_mask = 0xffffffff;
> > -
> > -	/*
> > -	 * Can be overridden by "{iommu,msi}-map-mask" property.
> > -	 * If of_property_read_u32() fails, the default is used.
> > -	 */
> > -	if (map_mask_name)
> > -		of_property_read_u32(np, map_mask_name, &map_mask);
> > -
> > -	masked_rid = map_mask & rid;
> > -	for ( ; map_len > 0; map_len -= 4 * sizeof(*map), map += 4) {
> > -		struct device_node *phandle_node;
> > -		u32 rid_base = be32_to_cpup(map + 0);
> > -		u32 phandle = be32_to_cpup(map + 1);
> > -		u32 out_base = be32_to_cpup(map + 2);
> > -		u32 rid_len = be32_to_cpup(map + 3);
> > -
> > -		if (rid_base & ~map_mask) {
> > -			pr_err("%pOF: Invalid %s translation - %s-mask (0x%x)
> ignores rid-base (0x%x)\n",
> > -				np, map_name, map_name,
> > -				map_mask, rid_base);
> > -			return -EFAULT;
> > -		}
> > -
> > -		if (masked_rid < rid_base || masked_rid >= rid_base + rid_len)
> > -			continue;
> > -
> > -		phandle_node = of_find_node_by_phandle(phandle);
> > -		if (!phandle_node)
> > -			return -ENODEV;
> > -
> > -		if (target) {
> > -			if (*target)
> > -				of_node_put(phandle_node);
> > -			else
> > -				*target = phandle_node;
> > -
> > -			if (*target != phandle_node)
> > -				continue;
> > -		}
> > -
> > -		if (id_out)
> > -			*id_out = masked_rid - rid_base + out_base;
> > -
> > -		pr_debug("%pOF: %s, using mask %08x, rid-base: %08x, out-
> base: %08x, length: %08x, rid: %08x -> %08x\n",
> > -			np, map_name, map_mask, rid_base, out_base,
> > -			rid_len, rid, masked_rid - rid_base + out_base);
> > -		return 0;
> > -	}
> > -
> > -	pr_err("%pOF: Invalid %s translation - no match for rid 0x%x on
> %pOF\n",
> > -		np, map_name, rid, target && *target ? *target : NULL);
> > -	return -EFAULT;
> > -}
> > -
> >   #if IS_ENABLED(CONFIG_OF_IRQ)
> >   /**
> >    * of_irq_parse_pci - Resolve the interrupt for a PCI device diff
> > --git a/include/linux/of_iommu.h b/include/linux/of_iommu.h index
> > 4fa654e..432b53c 100644
> > --- a/include/linux/of_iommu.h
> > +++ b/include/linux/of_iommu.h
> > @@ -15,6 +15,10 @@ extern int of_get_dma_window(struct device_node
> *dn, const char *prefix,
> >   extern const struct iommu_ops *of_iommu_configure(struct device *dev,
> >   					struct device_node *master_np);
> >
> > +int of_map_rid(struct device_node *np, u32 rid,
> > +	       const char *map_name, const char *map_mask_name,
> > +	       struct device_node **target, u32 *id_out);
> > +
> >   #else
> >
> >   static inline int of_get_dma_window(struct device_node *dn, const
> > char *prefix, @@ -30,6 +34,13 @@ static inline const struct iommu_ops
> *of_iommu_configure(struct device *dev,
> >   	return NULL;
> >   }
> >
> > +static inline int of_map_rid(struct device_node *np, u32 rid,
> > +			     const char *map_name, const char
> *map_mask_name,
> > +			     struct device_node **target, u32 *id_out) {
> > +	return -EINVAL;
> > +}
> > +
> >   #endif	/* CONFIG_OF_IOMMU */
> >
> >   extern struct of_device_id __iommu_of_table; diff --git
> > a/include/linux/of_pci.h b/include/linux/of_pci.h index
> > 091033a..a23b44a 100644
> > --- a/include/linux/of_pci.h
> > +++ b/include/linux/of_pci.h
> > @@ -17,9 +17,6 @@ struct device_node *of_pci_find_child_device(struct
> device_node *parent,
> >   int of_get_pci_domain_nr(struct device_node *node);
> >   int of_pci_get_max_link_speed(struct device_node *node);
> >   void of_pci_check_probe_only(void);
> > -int of_pci_map_rid(struct device_node *np, u32 rid,
> > -		   const char *map_name, const char *map_mask_name,
> > -		   struct device_node **target, u32 *id_out);
> >   #else
> >   static inline struct device_node *of_pci_find_child_device(struct device_node
> *parent,
> >   					     unsigned int devfn)
> > @@ -44,13 +41,6 @@ static inline int of_pci_get_devfn(struct device_node
> *np)
> >   	return -1;
> >   }
> >
> > -static inline int of_pci_map_rid(struct device_node *np, u32 rid,
> > -			const char *map_name, const char *map_mask_name,
> > -			struct device_node **target, u32 *id_out)
> > -{
> > -	return -EINVAL;
> > -}
> > -
> >   static inline int
> >   of_pci_get_max_link_speed(struct device_node *node)
> >   {
> >

WARNING: multiple messages have this Message-ID (diff)
From: Bharat Bhushan <bharat.bhushan-3arQi8VN3Tc@public.gmane.org>
To: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>,
	Nipun Gupta <nipun.gupta-3arQi8VN3Tc@public.gmane.org>,
	"robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org"
	<robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	"frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org"
	<frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: "mark.rutland-5wv7dgnIgG8@public.gmane.org"
	<mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"stuyoder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org"
	<stuyoder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"catalin.marinas-5wv7dgnIgG8@public.gmane.org"
	<catalin.marinas-5wv7dgnIgG8@public.gmane.org>,
	"linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org"
	<linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org>,
	"will.deacon-5wv7dgnIgG8@public.gmane.org"
	<will.deacon-5wv7dgnIgG8@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Leo Li <leoyang.li-3arQi8VN3Tc@public.gmane.org>,
	"iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org"
	<iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
	"gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org"
	<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
	"bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org"
	<bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	"shawnguo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org"
	<shawnguo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	"hch-jcswGhMUV9g@public.gmane.org"
	<hch-jcswGhMUV9g@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
Subject: RE: [PATCH 2/6 v2] iommu: of: make of_pci_map_rid() available for other devices too
Date: Wed, 18 Apr 2018 05:09:47 +0000	[thread overview]
Message-ID: <AM5PR0401MB25452C7E2281806F90163E519AB60@AM5PR0401MB2545.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <41b32766-e21a-e946-6c8f-440e5c87d0ee-5wv7dgnIgG8@public.gmane.org>



> -----Original Message-----
> From: Robin Murphy [mailto:robin.murphy-5wv7dgnIgG8@public.gmane.org]
> Sent: Tuesday, April 17, 2018 10:23 PM
> To: Nipun Gupta <nipun.gupta-3arQi8VN3Tc@public.gmane.org>; robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org;
> frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
> Cc: will.deacon-5wv7dgnIgG8@public.gmane.org; mark.rutland-5wv7dgnIgG8@public.gmane.org; catalin.marinas-5wv7dgnIgG8@public.gmane.org;
> hch-jcswGhMUV9g@public.gmane.org; gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org; joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org;
> m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org; shawnguo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org; bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org;
> iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org; linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org;
> devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org; linuxppc-
> dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org; linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; Bharat Bhushan
> <bharat.bhushan-3arQi8VN3Tc@public.gmane.org>; stuyoder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; Laurentiu Tudor
> <laurentiu.tudor-3arQi8VN3Tc@public.gmane.org>; Leo Li <leoyang.li-3arQi8VN3Tc@public.gmane.org>
> Subject: Re: [PATCH 2/6 v2] iommu: of: make of_pci_map_rid() available for
> other devices too
> 
> On 17/04/18 11:21, Nipun Gupta wrote:
> > iommu-map property is also used by devices with fsl-mc. This patch
> > moves the of_pci_map_rid to generic location, so that it can be used
> > by other busses too.

Nipun, please clarify that only function name is changed and rest of body is same.

> >
> > Signed-off-by: Nipun Gupta <nipun.gupta-3arQi8VN3Tc@public.gmane.org>
> > ---
> >   drivers/iommu/of_iommu.c | 106
> > +++++++++++++++++++++++++++++++++++++++++++++--
> 
> Doesn't this break "msi-parent" parsing for !CONFIG_OF_IOMMU?

Yes, this will be a problem with MSI 

> I guess you
> don't want fsl-mc to have to depend on PCI, but this looks like a step in the
> wrong direction.
> 
> I'm not entirely sure where of_map_rid() fits best, but from a quick look around
> the least-worst option might be drivers/of/of_address.c, unless Rob and Frank
> have a better idea of where generic DT-based ID translation routines could live?

drivers/of/address.c may be proper place to move until someone have better idea.

Thanks
-Bharat

> 
> >   drivers/of/irq.c         |   6 +--
> >   drivers/pci/of.c         | 101 --------------------------------------------
> >   include/linux/of_iommu.h |  11 +++++
> >   include/linux/of_pci.h   |  10 -----
> >   5 files changed, 117 insertions(+), 117 deletions(-)
> >
> > diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c index
> > 5c36a8b..4e7712f 100644
> > --- a/drivers/iommu/of_iommu.c
> > +++ b/drivers/iommu/of_iommu.c
> > @@ -138,6 +138,106 @@ static int of_iommu_xlate(struct device *dev,
> >   	return ops->of_xlate(dev, iommu_spec);
> >   }
> >
> > +/**
> > + * of_map_rid - Translate a requester ID through a downstream mapping.
> > + * @np: root complex device node.
> > + * @rid: device requester ID to map.
> > + * @map_name: property name of the map to use.
> > + * @map_mask_name: optional property name of the mask to use.
> > + * @target: optional pointer to a target device node.
> > + * @id_out: optional pointer to receive the translated ID.
> > + *
> > + * Given a device requester ID, look up the appropriate
> > +implementation-defined
> > + * platform ID and/or the target device which receives transactions
> > +on that
> > + * ID, as per the "iommu-map" and "msi-map" bindings. Either of
> > +@target or
> > + * @id_out may be NULL if only the other is required. If @target
> > +points to
> > + * a non-NULL device node pointer, only entries targeting that node
> > +will be
> > + * matched; if it points to a NULL value, it will receive the device
> > +node of
> > + * the first matching target phandle, with a reference held.
> > + *
> > + * Return: 0 on success or a standard error code on failure.
> > + */
> > +int of_map_rid(struct device_node *np, u32 rid,
> > +		   const char *map_name, const char *map_mask_name,
> > +		   struct device_node **target, u32 *id_out) {
> > +	u32 map_mask, masked_rid;
> > +	int map_len;
> > +	const __be32 *map = NULL;
> > +
> > +	if (!np || !map_name || (!target && !id_out))
> > +		return -EINVAL;
> > +
> > +	map = of_get_property(np, map_name, &map_len);
> > +	if (!map) {
> > +		if (target)
> > +			return -ENODEV;
> > +		/* Otherwise, no map implies no translation */
> > +		*id_out = rid;
> > +		return 0;
> > +	}
> > +
> > +	if (!map_len || map_len % (4 * sizeof(*map))) {
> > +		pr_err("%pOF: Error: Bad %s length: %d\n", np,
> > +			map_name, map_len);
> > +		return -EINVAL;
> > +	}
> > +
> > +	/* The default is to select all bits. */
> > +	map_mask = 0xffffffff;
> > +
> > +	/*
> > +	 * Can be overridden by "{iommu,msi}-map-mask" property.
> > +	 */
> > +	if (map_mask_name)
> > +		of_property_read_u32(np, map_mask_name, &map_mask);
> > +
> > +	masked_rid = map_mask & rid;
> > +	for ( ; map_len > 0; map_len -= 4 * sizeof(*map), map += 4) {
> > +		struct device_node *phandle_node;
> > +		u32 rid_base = be32_to_cpup(map + 0);
> > +		u32 phandle = be32_to_cpup(map + 1);
> > +		u32 out_base = be32_to_cpup(map + 2);
> > +		u32 rid_len = be32_to_cpup(map + 3);
> > +
> > +		if (rid_base & ~map_mask) {
> > +			pr_err("%pOF: Invalid %s translation - %s-mask (0x%x)
> ignores rid-base (0x%x)\n",
> > +				np, map_name, map_name,
> > +				map_mask, rid_base);
> > +			return -EFAULT;
> > +		}
> > +
> > +		if (masked_rid < rid_base || masked_rid >= rid_base + rid_len)
> > +			continue;
> > +
> > +		phandle_node = of_find_node_by_phandle(phandle);
> > +		if (!phandle_node)
> > +			return -ENODEV;
> > +
> > +		if (target) {
> > +			if (*target)
> > +				of_node_put(phandle_node);
> > +			else
> > +				*target = phandle_node;
> > +
> > +			if (*target != phandle_node)
> > +				continue;
> > +		}
> > +
> > +		if (id_out)
> > +			*id_out = masked_rid - rid_base + out_base;
> > +
> > +		pr_debug("%pOF: %s, using mask %08x, rid-base: %08x, out-
> base: %08x, length: %08x, rid: %08x -> %08x\n",
> > +			np, map_name, map_mask, rid_base, out_base,
> > +			rid_len, rid, masked_rid - rid_base + out_base);
> > +		return 0;
> > +	}
> > +
> > +	pr_err("%pOF: Invalid %s translation - no match for rid 0x%x on
> %pOF\n",
> > +		np, map_name, rid, target && *target ? *target : NULL);
> > +	return -EFAULT;
> > +}
> > +
> >   struct of_pci_iommu_alias_info {
> >   	struct device *dev;
> >   	struct device_node *np;
> > @@ -149,9 +249,9 @@ static int of_pci_iommu_init(struct pci_dev *pdev, u16
> alias, void *data)
> >   	struct of_phandle_args iommu_spec = { .args_count = 1 };
> >   	int err;
> >
> > -	err = of_pci_map_rid(info->np, alias, "iommu-map",
> > -			     "iommu-map-mask", &iommu_spec.np,
> > -			     iommu_spec.args);
> > +	err = of_map_rid(info->np, alias, "iommu-map",
> > +			 "iommu-map-mask", &iommu_spec.np,
> > +			 iommu_spec.args);
> 
> Super-nit: Apparently I missed rewrapping this to 2 lines in d87beb749281, but if
> it's being touched again, that would be nice ;)
> 
> Robin.
> 
> >   	if (err)
> >   		return err == -ENODEV ? NO_IOMMU : err;
> >
> > diff --git a/drivers/of/irq.c b/drivers/of/irq.c index
> > 02ad93a..b72eeec 100644
> > --- a/drivers/of/irq.c
> > +++ b/drivers/of/irq.c
> > @@ -22,7 +22,7 @@
> >   #include <linux/module.h>
> >   #include <linux/of.h>
> >   #include <linux/of_irq.h>
> > -#include <linux/of_pci.h>
> > +#include <linux/of_iommu.h>
> >   #include <linux/string.h>
> >   #include <linux/slab.h>
> >
> > @@ -588,8 +588,8 @@ static u32 __of_msi_map_rid(struct device *dev,
> struct device_node **np,
> >   	 * "msi-map" property.
> >   	 */
> >   	for (parent_dev = dev; parent_dev; parent_dev = parent_dev->parent)
> > -		if (!of_pci_map_rid(parent_dev->of_node, rid_in, "msi-map",
> > -				    "msi-map-mask", np, &rid_out))
> > +		if (!of_map_rid(parent_dev->of_node, rid_in, "msi-map",
> > +				"msi-map-mask", np, &rid_out))
> >   			break;
> >   	return rid_out;
> >   }
> > diff --git a/drivers/pci/of.c b/drivers/pci/of.c index
> > a28355c..d2cebbe 100644
> > --- a/drivers/pci/of.c
> > +++ b/drivers/pci/of.c
> > @@ -362,107 +362,6 @@ int of_pci_get_host_bridge_resources(struct
> device_node *dev,
> >   EXPORT_SYMBOL_GPL(of_pci_get_host_bridge_resources);
> >   #endif /* CONFIG_OF_ADDRESS */
> >
> > -/**
> > - * of_pci_map_rid - Translate a requester ID through a downstream mapping.
> > - * @np: root complex device node.
> > - * @rid: PCI requester ID to map.
> > - * @map_name: property name of the map to use.
> > - * @map_mask_name: optional property name of the mask to use.
> > - * @target: optional pointer to a target device node.
> > - * @id_out: optional pointer to receive the translated ID.
> > - *
> > - * Given a PCI requester ID, look up the appropriate
> > implementation-defined
> > - * platform ID and/or the target device which receives transactions
> > on that
> > - * ID, as per the "iommu-map" and "msi-map" bindings. Either of
> > @target or
> > - * @id_out may be NULL if only the other is required. If @target
> > points to
> > - * a non-NULL device node pointer, only entries targeting that node
> > will be
> > - * matched; if it points to a NULL value, it will receive the device
> > node of
> > - * the first matching target phandle, with a reference held.
> > - *
> > - * Return: 0 on success or a standard error code on failure.
> > - */
> > -int of_pci_map_rid(struct device_node *np, u32 rid,
> > -		   const char *map_name, const char *map_mask_name,
> > -		   struct device_node **target, u32 *id_out)
> > -{
> > -	u32 map_mask, masked_rid;
> > -	int map_len;
> > -	const __be32 *map = NULL;
> > -
> > -	if (!np || !map_name || (!target && !id_out))
> > -		return -EINVAL;
> > -
> > -	map = of_get_property(np, map_name, &map_len);
> > -	if (!map) {
> > -		if (target)
> > -			return -ENODEV;
> > -		/* Otherwise, no map implies no translation */
> > -		*id_out = rid;
> > -		return 0;
> > -	}
> > -
> > -	if (!map_len || map_len % (4 * sizeof(*map))) {
> > -		pr_err("%pOF: Error: Bad %s length: %d\n", np,
> > -			map_name, map_len);
> > -		return -EINVAL;
> > -	}
> > -
> > -	/* The default is to select all bits. */
> > -	map_mask = 0xffffffff;
> > -
> > -	/*
> > -	 * Can be overridden by "{iommu,msi}-map-mask" property.
> > -	 * If of_property_read_u32() fails, the default is used.
> > -	 */
> > -	if (map_mask_name)
> > -		of_property_read_u32(np, map_mask_name, &map_mask);
> > -
> > -	masked_rid = map_mask & rid;
> > -	for ( ; map_len > 0; map_len -= 4 * sizeof(*map), map += 4) {
> > -		struct device_node *phandle_node;
> > -		u32 rid_base = be32_to_cpup(map + 0);
> > -		u32 phandle = be32_to_cpup(map + 1);
> > -		u32 out_base = be32_to_cpup(map + 2);
> > -		u32 rid_len = be32_to_cpup(map + 3);
> > -
> > -		if (rid_base & ~map_mask) {
> > -			pr_err("%pOF: Invalid %s translation - %s-mask (0x%x)
> ignores rid-base (0x%x)\n",
> > -				np, map_name, map_name,
> > -				map_mask, rid_base);
> > -			return -EFAULT;
> > -		}
> > -
> > -		if (masked_rid < rid_base || masked_rid >= rid_base + rid_len)
> > -			continue;
> > -
> > -		phandle_node = of_find_node_by_phandle(phandle);
> > -		if (!phandle_node)
> > -			return -ENODEV;
> > -
> > -		if (target) {
> > -			if (*target)
> > -				of_node_put(phandle_node);
> > -			else
> > -				*target = phandle_node;
> > -
> > -			if (*target != phandle_node)
> > -				continue;
> > -		}
> > -
> > -		if (id_out)
> > -			*id_out = masked_rid - rid_base + out_base;
> > -
> > -		pr_debug("%pOF: %s, using mask %08x, rid-base: %08x, out-
> base: %08x, length: %08x, rid: %08x -> %08x\n",
> > -			np, map_name, map_mask, rid_base, out_base,
> > -			rid_len, rid, masked_rid - rid_base + out_base);
> > -		return 0;
> > -	}
> > -
> > -	pr_err("%pOF: Invalid %s translation - no match for rid 0x%x on
> %pOF\n",
> > -		np, map_name, rid, target && *target ? *target : NULL);
> > -	return -EFAULT;
> > -}
> > -
> >   #if IS_ENABLED(CONFIG_OF_IRQ)
> >   /**
> >    * of_irq_parse_pci - Resolve the interrupt for a PCI device diff
> > --git a/include/linux/of_iommu.h b/include/linux/of_iommu.h index
> > 4fa654e..432b53c 100644
> > --- a/include/linux/of_iommu.h
> > +++ b/include/linux/of_iommu.h
> > @@ -15,6 +15,10 @@ extern int of_get_dma_window(struct device_node
> *dn, const char *prefix,
> >   extern const struct iommu_ops *of_iommu_configure(struct device *dev,
> >   					struct device_node *master_np);
> >
> > +int of_map_rid(struct device_node *np, u32 rid,
> > +	       const char *map_name, const char *map_mask_name,
> > +	       struct device_node **target, u32 *id_out);
> > +
> >   #else
> >
> >   static inline int of_get_dma_window(struct device_node *dn, const
> > char *prefix, @@ -30,6 +34,13 @@ static inline const struct iommu_ops
> *of_iommu_configure(struct device *dev,
> >   	return NULL;
> >   }
> >
> > +static inline int of_map_rid(struct device_node *np, u32 rid,
> > +			     const char *map_name, const char
> *map_mask_name,
> > +			     struct device_node **target, u32 *id_out) {
> > +	return -EINVAL;
> > +}
> > +
> >   #endif	/* CONFIG_OF_IOMMU */
> >
> >   extern struct of_device_id __iommu_of_table; diff --git
> > a/include/linux/of_pci.h b/include/linux/of_pci.h index
> > 091033a..a23b44a 100644
> > --- a/include/linux/of_pci.h
> > +++ b/include/linux/of_pci.h
> > @@ -17,9 +17,6 @@ struct device_node *of_pci_find_child_device(struct
> device_node *parent,
> >   int of_get_pci_domain_nr(struct device_node *node);
> >   int of_pci_get_max_link_speed(struct device_node *node);
> >   void of_pci_check_probe_only(void);
> > -int of_pci_map_rid(struct device_node *np, u32 rid,
> > -		   const char *map_name, const char *map_mask_name,
> > -		   struct device_node **target, u32 *id_out);
> >   #else
> >   static inline struct device_node *of_pci_find_child_device(struct device_node
> *parent,
> >   					     unsigned int devfn)
> > @@ -44,13 +41,6 @@ static inline int of_pci_get_devfn(struct device_node
> *np)
> >   	return -1;
> >   }
> >
> > -static inline int of_pci_map_rid(struct device_node *np, u32 rid,
> > -			const char *map_name, const char *map_mask_name,
> > -			struct device_node **target, u32 *id_out)
> > -{
> > -	return -EINVAL;
> > -}
> > -
> >   static inline int
> >   of_pci_get_max_link_speed(struct device_node *node)
> >   {
> >

WARNING: multiple messages have this Message-ID (diff)
From: Bharat Bhushan <bharat.bhushan@nxp.com>
To: Robin Murphy <robin.murphy@arm.com>,
	Nipun Gupta <nipun.gupta@nxp.com>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"frowand.list@gmail.com" <frowand.list@gmail.com>
Cc: "mark.rutland@arm.com" <mark.rutland@arm.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"stuyoder@gmail.com" <stuyoder@gmail.com>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"catalin.marinas@arm.com" <catalin.marinas@arm.com>,
	"joro@8bytes.org" <joro@8bytes.org>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	"will.deacon@arm.com" <will.deacon@arm.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Leo Li <leoyang.li@nxp.com>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"bhelgaas@google.com" <bhelgaas@google.com>,
	Laurentiu Tudor <laurentiu.tudor@nxp.com>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	"hch@lst.de" <hch@lst.de>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"m.szyprowski@samsung.com" <m.szyprowski@samsung.com>
Subject: RE: [PATCH 2/6 v2] iommu: of: make of_pci_map_rid() available for other devices too
Date: Wed, 18 Apr 2018 05:09:47 +0000	[thread overview]
Message-ID: <AM5PR0401MB25452C7E2281806F90163E519AB60@AM5PR0401MB2545.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <41b32766-e21a-e946-6c8f-440e5c87d0ee@arm.com>



> -----Original Message-----
> From: Robin Murphy [mailto:robin.murphy@arm.com]
> Sent: Tuesday, April 17, 2018 10:23 PM
> To: Nipun Gupta <nipun.gupta@nxp.com>; robh+dt@kernel.org;
> frowand.list@gmail.com
> Cc: will.deacon@arm.com; mark.rutland@arm.com; catalin.marinas@arm.com;
> hch@lst.de; gregkh@linuxfoundation.org; joro@8bytes.org;
> m.szyprowski@samsung.com; shawnguo@kernel.org; bhelgaas@google.com;
> iommu@lists.linux-foundation.org; linux-kernel@vger.kernel.org;
> devicetree@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linuxppc-
> dev@lists.ozlabs.org; linux-pci@vger.kernel.org; Bharat Bhushan
> <bharat.bhushan@nxp.com>; stuyoder@gmail.com; Laurentiu Tudor
> <laurentiu.tudor@nxp.com>; Leo Li <leoyang.li@nxp.com>
> Subject: Re: [PATCH 2/6 v2] iommu: of: make of_pci_map_rid() available for
> other devices too
> 
> On 17/04/18 11:21, Nipun Gupta wrote:
> > iommu-map property is also used by devices with fsl-mc. This patch
> > moves the of_pci_map_rid to generic location, so that it can be used
> > by other busses too.

Nipun, please clarify that only function name is changed and rest of body is same.

> >
> > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > ---
> >   drivers/iommu/of_iommu.c | 106
> > +++++++++++++++++++++++++++++++++++++++++++++--
> 
> Doesn't this break "msi-parent" parsing for !CONFIG_OF_IOMMU?

Yes, this will be a problem with MSI 

> I guess you
> don't want fsl-mc to have to depend on PCI, but this looks like a step in the
> wrong direction.
> 
> I'm not entirely sure where of_map_rid() fits best, but from a quick look around
> the least-worst option might be drivers/of/of_address.c, unless Rob and Frank
> have a better idea of where generic DT-based ID translation routines could live?

drivers/of/address.c may be proper place to move until someone have better idea.

Thanks
-Bharat

> 
> >   drivers/of/irq.c         |   6 +--
> >   drivers/pci/of.c         | 101 --------------------------------------------
> >   include/linux/of_iommu.h |  11 +++++
> >   include/linux/of_pci.h   |  10 -----
> >   5 files changed, 117 insertions(+), 117 deletions(-)
> >
> > diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c index
> > 5c36a8b..4e7712f 100644
> > --- a/drivers/iommu/of_iommu.c
> > +++ b/drivers/iommu/of_iommu.c
> > @@ -138,6 +138,106 @@ static int of_iommu_xlate(struct device *dev,
> >   	return ops->of_xlate(dev, iommu_spec);
> >   }
> >
> > +/**
> > + * of_map_rid - Translate a requester ID through a downstream mapping.
> > + * @np: root complex device node.
> > + * @rid: device requester ID to map.
> > + * @map_name: property name of the map to use.
> > + * @map_mask_name: optional property name of the mask to use.
> > + * @target: optional pointer to a target device node.
> > + * @id_out: optional pointer to receive the translated ID.
> > + *
> > + * Given a device requester ID, look up the appropriate
> > +implementation-defined
> > + * platform ID and/or the target device which receives transactions
> > +on that
> > + * ID, as per the "iommu-map" and "msi-map" bindings. Either of
> > +@target or
> > + * @id_out may be NULL if only the other is required. If @target
> > +points to
> > + * a non-NULL device node pointer, only entries targeting that node
> > +will be
> > + * matched; if it points to a NULL value, it will receive the device
> > +node of
> > + * the first matching target phandle, with a reference held.
> > + *
> > + * Return: 0 on success or a standard error code on failure.
> > + */
> > +int of_map_rid(struct device_node *np, u32 rid,
> > +		   const char *map_name, const char *map_mask_name,
> > +		   struct device_node **target, u32 *id_out) {
> > +	u32 map_mask, masked_rid;
> > +	int map_len;
> > +	const __be32 *map = NULL;
> > +
> > +	if (!np || !map_name || (!target && !id_out))
> > +		return -EINVAL;
> > +
> > +	map = of_get_property(np, map_name, &map_len);
> > +	if (!map) {
> > +		if (target)
> > +			return -ENODEV;
> > +		/* Otherwise, no map implies no translation */
> > +		*id_out = rid;
> > +		return 0;
> > +	}
> > +
> > +	if (!map_len || map_len % (4 * sizeof(*map))) {
> > +		pr_err("%pOF: Error: Bad %s length: %d\n", np,
> > +			map_name, map_len);
> > +		return -EINVAL;
> > +	}
> > +
> > +	/* The default is to select all bits. */
> > +	map_mask = 0xffffffff;
> > +
> > +	/*
> > +	 * Can be overridden by "{iommu,msi}-map-mask" property.
> > +	 */
> > +	if (map_mask_name)
> > +		of_property_read_u32(np, map_mask_name, &map_mask);
> > +
> > +	masked_rid = map_mask & rid;
> > +	for ( ; map_len > 0; map_len -= 4 * sizeof(*map), map += 4) {
> > +		struct device_node *phandle_node;
> > +		u32 rid_base = be32_to_cpup(map + 0);
> > +		u32 phandle = be32_to_cpup(map + 1);
> > +		u32 out_base = be32_to_cpup(map + 2);
> > +		u32 rid_len = be32_to_cpup(map + 3);
> > +
> > +		if (rid_base & ~map_mask) {
> > +			pr_err("%pOF: Invalid %s translation - %s-mask (0x%x)
> ignores rid-base (0x%x)\n",
> > +				np, map_name, map_name,
> > +				map_mask, rid_base);
> > +			return -EFAULT;
> > +		}
> > +
> > +		if (masked_rid < rid_base || masked_rid >= rid_base + rid_len)
> > +			continue;
> > +
> > +		phandle_node = of_find_node_by_phandle(phandle);
> > +		if (!phandle_node)
> > +			return -ENODEV;
> > +
> > +		if (target) {
> > +			if (*target)
> > +				of_node_put(phandle_node);
> > +			else
> > +				*target = phandle_node;
> > +
> > +			if (*target != phandle_node)
> > +				continue;
> > +		}
> > +
> > +		if (id_out)
> > +			*id_out = masked_rid - rid_base + out_base;
> > +
> > +		pr_debug("%pOF: %s, using mask %08x, rid-base: %08x, out-
> base: %08x, length: %08x, rid: %08x -> %08x\n",
> > +			np, map_name, map_mask, rid_base, out_base,
> > +			rid_len, rid, masked_rid - rid_base + out_base);
> > +		return 0;
> > +	}
> > +
> > +	pr_err("%pOF: Invalid %s translation - no match for rid 0x%x on
> %pOF\n",
> > +		np, map_name, rid, target && *target ? *target : NULL);
> > +	return -EFAULT;
> > +}
> > +
> >   struct of_pci_iommu_alias_info {
> >   	struct device *dev;
> >   	struct device_node *np;
> > @@ -149,9 +249,9 @@ static int of_pci_iommu_init(struct pci_dev *pdev, u16
> alias, void *data)
> >   	struct of_phandle_args iommu_spec = { .args_count = 1 };
> >   	int err;
> >
> > -	err = of_pci_map_rid(info->np, alias, "iommu-map",
> > -			     "iommu-map-mask", &iommu_spec.np,
> > -			     iommu_spec.args);
> > +	err = of_map_rid(info->np, alias, "iommu-map",
> > +			 "iommu-map-mask", &iommu_spec.np,
> > +			 iommu_spec.args);
> 
> Super-nit: Apparently I missed rewrapping this to 2 lines in d87beb749281, but if
> it's being touched again, that would be nice ;)
> 
> Robin.
> 
> >   	if (err)
> >   		return err == -ENODEV ? NO_IOMMU : err;
> >
> > diff --git a/drivers/of/irq.c b/drivers/of/irq.c index
> > 02ad93a..b72eeec 100644
> > --- a/drivers/of/irq.c
> > +++ b/drivers/of/irq.c
> > @@ -22,7 +22,7 @@
> >   #include <linux/module.h>
> >   #include <linux/of.h>
> >   #include <linux/of_irq.h>
> > -#include <linux/of_pci.h>
> > +#include <linux/of_iommu.h>
> >   #include <linux/string.h>
> >   #include <linux/slab.h>
> >
> > @@ -588,8 +588,8 @@ static u32 __of_msi_map_rid(struct device *dev,
> struct device_node **np,
> >   	 * "msi-map" property.
> >   	 */
> >   	for (parent_dev = dev; parent_dev; parent_dev = parent_dev->parent)
> > -		if (!of_pci_map_rid(parent_dev->of_node, rid_in, "msi-map",
> > -				    "msi-map-mask", np, &rid_out))
> > +		if (!of_map_rid(parent_dev->of_node, rid_in, "msi-map",
> > +				"msi-map-mask", np, &rid_out))
> >   			break;
> >   	return rid_out;
> >   }
> > diff --git a/drivers/pci/of.c b/drivers/pci/of.c index
> > a28355c..d2cebbe 100644
> > --- a/drivers/pci/of.c
> > +++ b/drivers/pci/of.c
> > @@ -362,107 +362,6 @@ int of_pci_get_host_bridge_resources(struct
> device_node *dev,
> >   EXPORT_SYMBOL_GPL(of_pci_get_host_bridge_resources);
> >   #endif /* CONFIG_OF_ADDRESS */
> >
> > -/**
> > - * of_pci_map_rid - Translate a requester ID through a downstream mapping.
> > - * @np: root complex device node.
> > - * @rid: PCI requester ID to map.
> > - * @map_name: property name of the map to use.
> > - * @map_mask_name: optional property name of the mask to use.
> > - * @target: optional pointer to a target device node.
> > - * @id_out: optional pointer to receive the translated ID.
> > - *
> > - * Given a PCI requester ID, look up the appropriate
> > implementation-defined
> > - * platform ID and/or the target device which receives transactions
> > on that
> > - * ID, as per the "iommu-map" and "msi-map" bindings. Either of
> > @target or
> > - * @id_out may be NULL if only the other is required. If @target
> > points to
> > - * a non-NULL device node pointer, only entries targeting that node
> > will be
> > - * matched; if it points to a NULL value, it will receive the device
> > node of
> > - * the first matching target phandle, with a reference held.
> > - *
> > - * Return: 0 on success or a standard error code on failure.
> > - */
> > -int of_pci_map_rid(struct device_node *np, u32 rid,
> > -		   const char *map_name, const char *map_mask_name,
> > -		   struct device_node **target, u32 *id_out)
> > -{
> > -	u32 map_mask, masked_rid;
> > -	int map_len;
> > -	const __be32 *map = NULL;
> > -
> > -	if (!np || !map_name || (!target && !id_out))
> > -		return -EINVAL;
> > -
> > -	map = of_get_property(np, map_name, &map_len);
> > -	if (!map) {
> > -		if (target)
> > -			return -ENODEV;
> > -		/* Otherwise, no map implies no translation */
> > -		*id_out = rid;
> > -		return 0;
> > -	}
> > -
> > -	if (!map_len || map_len % (4 * sizeof(*map))) {
> > -		pr_err("%pOF: Error: Bad %s length: %d\n", np,
> > -			map_name, map_len);
> > -		return -EINVAL;
> > -	}
> > -
> > -	/* The default is to select all bits. */
> > -	map_mask = 0xffffffff;
> > -
> > -	/*
> > -	 * Can be overridden by "{iommu,msi}-map-mask" property.
> > -	 * If of_property_read_u32() fails, the default is used.
> > -	 */
> > -	if (map_mask_name)
> > -		of_property_read_u32(np, map_mask_name, &map_mask);
> > -
> > -	masked_rid = map_mask & rid;
> > -	for ( ; map_len > 0; map_len -= 4 * sizeof(*map), map += 4) {
> > -		struct device_node *phandle_node;
> > -		u32 rid_base = be32_to_cpup(map + 0);
> > -		u32 phandle = be32_to_cpup(map + 1);
> > -		u32 out_base = be32_to_cpup(map + 2);
> > -		u32 rid_len = be32_to_cpup(map + 3);
> > -
> > -		if (rid_base & ~map_mask) {
> > -			pr_err("%pOF: Invalid %s translation - %s-mask (0x%x)
> ignores rid-base (0x%x)\n",
> > -				np, map_name, map_name,
> > -				map_mask, rid_base);
> > -			return -EFAULT;
> > -		}
> > -
> > -		if (masked_rid < rid_base || masked_rid >= rid_base + rid_len)
> > -			continue;
> > -
> > -		phandle_node = of_find_node_by_phandle(phandle);
> > -		if (!phandle_node)
> > -			return -ENODEV;
> > -
> > -		if (target) {
> > -			if (*target)
> > -				of_node_put(phandle_node);
> > -			else
> > -				*target = phandle_node;
> > -
> > -			if (*target != phandle_node)
> > -				continue;
> > -		}
> > -
> > -		if (id_out)
> > -			*id_out = masked_rid - rid_base + out_base;
> > -
> > -		pr_debug("%pOF: %s, using mask %08x, rid-base: %08x, out-
> base: %08x, length: %08x, rid: %08x -> %08x\n",
> > -			np, map_name, map_mask, rid_base, out_base,
> > -			rid_len, rid, masked_rid - rid_base + out_base);
> > -		return 0;
> > -	}
> > -
> > -	pr_err("%pOF: Invalid %s translation - no match for rid 0x%x on
> %pOF\n",
> > -		np, map_name, rid, target && *target ? *target : NULL);
> > -	return -EFAULT;
> > -}
> > -
> >   #if IS_ENABLED(CONFIG_OF_IRQ)
> >   /**
> >    * of_irq_parse_pci - Resolve the interrupt for a PCI device diff
> > --git a/include/linux/of_iommu.h b/include/linux/of_iommu.h index
> > 4fa654e..432b53c 100644
> > --- a/include/linux/of_iommu.h
> > +++ b/include/linux/of_iommu.h
> > @@ -15,6 +15,10 @@ extern int of_get_dma_window(struct device_node
> *dn, const char *prefix,
> >   extern const struct iommu_ops *of_iommu_configure(struct device *dev,
> >   					struct device_node *master_np);
> >
> > +int of_map_rid(struct device_node *np, u32 rid,
> > +	       const char *map_name, const char *map_mask_name,
> > +	       struct device_node **target, u32 *id_out);
> > +
> >   #else
> >
> >   static inline int of_get_dma_window(struct device_node *dn, const
> > char *prefix, @@ -30,6 +34,13 @@ static inline const struct iommu_ops
> *of_iommu_configure(struct device *dev,
> >   	return NULL;
> >   }
> >
> > +static inline int of_map_rid(struct device_node *np, u32 rid,
> > +			     const char *map_name, const char
> *map_mask_name,
> > +			     struct device_node **target, u32 *id_out) {
> > +	return -EINVAL;
> > +}
> > +
> >   #endif	/* CONFIG_OF_IOMMU */
> >
> >   extern struct of_device_id __iommu_of_table; diff --git
> > a/include/linux/of_pci.h b/include/linux/of_pci.h index
> > 091033a..a23b44a 100644
> > --- a/include/linux/of_pci.h
> > +++ b/include/linux/of_pci.h
> > @@ -17,9 +17,6 @@ struct device_node *of_pci_find_child_device(struct
> device_node *parent,
> >   int of_get_pci_domain_nr(struct device_node *node);
> >   int of_pci_get_max_link_speed(struct device_node *node);
> >   void of_pci_check_probe_only(void);
> > -int of_pci_map_rid(struct device_node *np, u32 rid,
> > -		   const char *map_name, const char *map_mask_name,
> > -		   struct device_node **target, u32 *id_out);
> >   #else
> >   static inline struct device_node *of_pci_find_child_device(struct device_node
> *parent,
> >   					     unsigned int devfn)
> > @@ -44,13 +41,6 @@ static inline int of_pci_get_devfn(struct device_node
> *np)
> >   	return -1;
> >   }
> >
> > -static inline int of_pci_map_rid(struct device_node *np, u32 rid,
> > -			const char *map_name, const char *map_mask_name,
> > -			struct device_node **target, u32 *id_out)
> > -{
> > -	return -EINVAL;
> > -}
> > -
> >   static inline int
> >   of_pci_get_max_link_speed(struct device_node *node)
> >   {
> >
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Bharat Bhushan <bharat.bhushan@nxp.com>
To: Robin Murphy <robin.murphy@arm.com>,
	Nipun Gupta <nipun.gupta@nxp.com>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"frowand.list@gmail.com" <frowand.list@gmail.com>
Cc: "will.deacon@arm.com" <will.deacon@arm.com>,
	"mark.rutland@arm.com" <mark.rutland@arm.com>,
	"catalin.marinas@arm.com" <catalin.marinas@arm.com>,
	"hch@lst.de" <hch@lst.de>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"joro@8bytes.org" <joro@8bytes.org>,
	"m.szyprowski@samsung.com" <m.szyprowski@samsung.com>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	"bhelgaas@google.com" <bhelgaas@google.com>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"stuyoder@gmail.com" <stuyoder@gmail.com>,
	Laurentiu Tudor <laurentiu.tudor@nxp.com>,
	Leo Li <leoyang.li@nxp.com>
Subject: RE: [PATCH 2/6 v2] iommu: of: make of_pci_map_rid() available for other devices too
Date: Wed, 18 Apr 2018 05:09:47 +0000	[thread overview]
Message-ID: <AM5PR0401MB25452C7E2281806F90163E519AB60@AM5PR0401MB2545.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <41b32766-e21a-e946-6c8f-440e5c87d0ee@arm.com>

DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogUm9iaW4gTXVycGh5IFtt
YWlsdG86cm9iaW4ubXVycGh5QGFybS5jb21dDQo+IFNlbnQ6IFR1ZXNkYXksIEFwcmlsIDE3LCAy
MDE4IDEwOjIzIFBNDQo+IFRvOiBOaXB1biBHdXB0YSA8bmlwdW4uZ3VwdGFAbnhwLmNvbT47IHJv
YmgrZHRAa2VybmVsLm9yZz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fbGlua19zcGVlZChzdHJ1Y3QgZGV2
aWNlX25vZGUgKm5vZGUpDQo+ID4gICB7DQo+ID4NCg==

WARNING: multiple messages have this Message-ID (diff)
From: bharat.bhushan@nxp.com (Bharat Bhushan)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/6 v2] iommu: of: make of_pci_map_rid() available for other devices too
Date: Wed, 18 Apr 2018 05:09:47 +0000	[thread overview]
Message-ID: <AM5PR0401MB25452C7E2281806F90163E519AB60@AM5PR0401MB2545.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <41b32766-e21a-e946-6c8f-440e5c87d0ee@arm.com>



> -----Original Message-----
> From: Robin Murphy [mailto:robin.murphy at arm.com]
> Sent: Tuesday, April 17, 2018 10:23 PM
> To: Nipun Gupta <nipun.gupta@nxp.com>; robh+dt at kernel.org;
> frowand.list at gmail.com
> Cc: will.deacon at arm.com; mark.rutland at arm.com; catalin.marinas at arm.com;
> hch at lst.de; gregkh at linuxfoundation.org; joro at 8bytes.org;
> m.szyprowski at samsung.com; shawnguo at kernel.org; bhelgaas at google.com;
> iommu at lists.linux-foundation.org; linux-kernel at vger.kernel.org;
> devicetree at vger.kernel.org; linux-arm-kernel at lists.infradead.org; linuxppc-
> dev at lists.ozlabs.org; linux-pci at vger.kernel.org; Bharat Bhushan
> <bharat.bhushan@nxp.com>; stuyoder at gmail.com; Laurentiu Tudor
> <laurentiu.tudor@nxp.com>; Leo Li <leoyang.li@nxp.com>
> Subject: Re: [PATCH 2/6 v2] iommu: of: make of_pci_map_rid() available for
> other devices too
> 
> On 17/04/18 11:21, Nipun Gupta wrote:
> > iommu-map property is also used by devices with fsl-mc. This patch
> > moves the of_pci_map_rid to generic location, so that it can be used
> > by other busses too.

Nipun, please clarify that only function name is changed and rest of body is same.

> >
> > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > ---
> >   drivers/iommu/of_iommu.c | 106
> > +++++++++++++++++++++++++++++++++++++++++++++--
> 
> Doesn't this break "msi-parent" parsing for !CONFIG_OF_IOMMU?

Yes, this will be a problem with MSI 

> I guess you
> don't want fsl-mc to have to depend on PCI, but this looks like a step in the
> wrong direction.
> 
> I'm not entirely sure where of_map_rid() fits best, but from a quick look around
> the least-worst option might be drivers/of/of_address.c, unless Rob and Frank
> have a better idea of where generic DT-based ID translation routines could live?

drivers/of/address.c may be proper place to move until someone have better idea.

Thanks
-Bharat

> 
> >   drivers/of/irq.c         |   6 +--
> >   drivers/pci/of.c         | 101 --------------------------------------------
> >   include/linux/of_iommu.h |  11 +++++
> >   include/linux/of_pci.h   |  10 -----
> >   5 files changed, 117 insertions(+), 117 deletions(-)
> >
> > diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c index
> > 5c36a8b..4e7712f 100644
> > --- a/drivers/iommu/of_iommu.c
> > +++ b/drivers/iommu/of_iommu.c
> > @@ -138,6 +138,106 @@ static int of_iommu_xlate(struct device *dev,
> >   	return ops->of_xlate(dev, iommu_spec);
> >   }
> >
> > +/**
> > + * of_map_rid - Translate a requester ID through a downstream mapping.
> > + * @np: root complex device node.
> > + * @rid: device requester ID to map.
> > + * @map_name: property name of the map to use.
> > + * @map_mask_name: optional property name of the mask to use.
> > + * @target: optional pointer to a target device node.
> > + * @id_out: optional pointer to receive the translated ID.
> > + *
> > + * Given a device requester ID, look up the appropriate
> > +implementation-defined
> > + * platform ID and/or the target device which receives transactions
> > +on that
> > + * ID, as per the "iommu-map" and "msi-map" bindings. Either of
> > + at target or
> > + * @id_out may be NULL if only the other is required. If @target
> > +points to
> > + * a non-NULL device node pointer, only entries targeting that node
> > +will be
> > + * matched; if it points to a NULL value, it will receive the device
> > +node of
> > + * the first matching target phandle, with a reference held.
> > + *
> > + * Return: 0 on success or a standard error code on failure.
> > + */
> > +int of_map_rid(struct device_node *np, u32 rid,
> > +		   const char *map_name, const char *map_mask_name,
> > +		   struct device_node **target, u32 *id_out) {
> > +	u32 map_mask, masked_rid;
> > +	int map_len;
> > +	const __be32 *map = NULL;
> > +
> > +	if (!np || !map_name || (!target && !id_out))
> > +		return -EINVAL;
> > +
> > +	map = of_get_property(np, map_name, &map_len);
> > +	if (!map) {
> > +		if (target)
> > +			return -ENODEV;
> > +		/* Otherwise, no map implies no translation */
> > +		*id_out = rid;
> > +		return 0;
> > +	}
> > +
> > +	if (!map_len || map_len % (4 * sizeof(*map))) {
> > +		pr_err("%pOF: Error: Bad %s length: %d\n", np,
> > +			map_name, map_len);
> > +		return -EINVAL;
> > +	}
> > +
> > +	/* The default is to select all bits. */
> > +	map_mask = 0xffffffff;
> > +
> > +	/*
> > +	 * Can be overridden by "{iommu,msi}-map-mask" property.
> > +	 */
> > +	if (map_mask_name)
> > +		of_property_read_u32(np, map_mask_name, &map_mask);
> > +
> > +	masked_rid = map_mask & rid;
> > +	for ( ; map_len > 0; map_len -= 4 * sizeof(*map), map += 4) {
> > +		struct device_node *phandle_node;
> > +		u32 rid_base = be32_to_cpup(map + 0);
> > +		u32 phandle = be32_to_cpup(map + 1);
> > +		u32 out_base = be32_to_cpup(map + 2);
> > +		u32 rid_len = be32_to_cpup(map + 3);
> > +
> > +		if (rid_base & ~map_mask) {
> > +			pr_err("%pOF: Invalid %s translation - %s-mask (0x%x)
> ignores rid-base (0x%x)\n",
> > +				np, map_name, map_name,
> > +				map_mask, rid_base);
> > +			return -EFAULT;
> > +		}
> > +
> > +		if (masked_rid < rid_base || masked_rid >= rid_base + rid_len)
> > +			continue;
> > +
> > +		phandle_node = of_find_node_by_phandle(phandle);
> > +		if (!phandle_node)
> > +			return -ENODEV;
> > +
> > +		if (target) {
> > +			if (*target)
> > +				of_node_put(phandle_node);
> > +			else
> > +				*target = phandle_node;
> > +
> > +			if (*target != phandle_node)
> > +				continue;
> > +		}
> > +
> > +		if (id_out)
> > +			*id_out = masked_rid - rid_base + out_base;
> > +
> > +		pr_debug("%pOF: %s, using mask %08x, rid-base: %08x, out-
> base: %08x, length: %08x, rid: %08x -> %08x\n",
> > +			np, map_name, map_mask, rid_base, out_base,
> > +			rid_len, rid, masked_rid - rid_base + out_base);
> > +		return 0;
> > +	}
> > +
> > +	pr_err("%pOF: Invalid %s translation - no match for rid 0x%x on
> %pOF\n",
> > +		np, map_name, rid, target && *target ? *target : NULL);
> > +	return -EFAULT;
> > +}
> > +
> >   struct of_pci_iommu_alias_info {
> >   	struct device *dev;
> >   	struct device_node *np;
> > @@ -149,9 +249,9 @@ static int of_pci_iommu_init(struct pci_dev *pdev, u16
> alias, void *data)
> >   	struct of_phandle_args iommu_spec = { .args_count = 1 };
> >   	int err;
> >
> > -	err = of_pci_map_rid(info->np, alias, "iommu-map",
> > -			     "iommu-map-mask", &iommu_spec.np,
> > -			     iommu_spec.args);
> > +	err = of_map_rid(info->np, alias, "iommu-map",
> > +			 "iommu-map-mask", &iommu_spec.np,
> > +			 iommu_spec.args);
> 
> Super-nit: Apparently I missed rewrapping this to 2 lines in d87beb749281, but if
> it's being touched again, that would be nice ;)
> 
> Robin.
> 
> >   	if (err)
> >   		return err == -ENODEV ? NO_IOMMU : err;
> >
> > diff --git a/drivers/of/irq.c b/drivers/of/irq.c index
> > 02ad93a..b72eeec 100644
> > --- a/drivers/of/irq.c
> > +++ b/drivers/of/irq.c
> > @@ -22,7 +22,7 @@
> >   #include <linux/module.h>
> >   #include <linux/of.h>
> >   #include <linux/of_irq.h>
> > -#include <linux/of_pci.h>
> > +#include <linux/of_iommu.h>
> >   #include <linux/string.h>
> >   #include <linux/slab.h>
> >
> > @@ -588,8 +588,8 @@ static u32 __of_msi_map_rid(struct device *dev,
> struct device_node **np,
> >   	 * "msi-map" property.
> >   	 */
> >   	for (parent_dev = dev; parent_dev; parent_dev = parent_dev->parent)
> > -		if (!of_pci_map_rid(parent_dev->of_node, rid_in, "msi-map",
> > -				    "msi-map-mask", np, &rid_out))
> > +		if (!of_map_rid(parent_dev->of_node, rid_in, "msi-map",
> > +				"msi-map-mask", np, &rid_out))
> >   			break;
> >   	return rid_out;
> >   }
> > diff --git a/drivers/pci/of.c b/drivers/pci/of.c index
> > a28355c..d2cebbe 100644
> > --- a/drivers/pci/of.c
> > +++ b/drivers/pci/of.c
> > @@ -362,107 +362,6 @@ int of_pci_get_host_bridge_resources(struct
> device_node *dev,
> >   EXPORT_SYMBOL_GPL(of_pci_get_host_bridge_resources);
> >   #endif /* CONFIG_OF_ADDRESS */
> >
> > -/**
> > - * of_pci_map_rid - Translate a requester ID through a downstream mapping.
> > - * @np: root complex device node.
> > - * @rid: PCI requester ID to map.
> > - * @map_name: property name of the map to use.
> > - * @map_mask_name: optional property name of the mask to use.
> > - * @target: optional pointer to a target device node.
> > - * @id_out: optional pointer to receive the translated ID.
> > - *
> > - * Given a PCI requester ID, look up the appropriate
> > implementation-defined
> > - * platform ID and/or the target device which receives transactions
> > on that
> > - * ID, as per the "iommu-map" and "msi-map" bindings. Either of
> > @target or
> > - * @id_out may be NULL if only the other is required. If @target
> > points to
> > - * a non-NULL device node pointer, only entries targeting that node
> > will be
> > - * matched; if it points to a NULL value, it will receive the device
> > node of
> > - * the first matching target phandle, with a reference held.
> > - *
> > - * Return: 0 on success or a standard error code on failure.
> > - */
> > -int of_pci_map_rid(struct device_node *np, u32 rid,
> > -		   const char *map_name, const char *map_mask_name,
> > -		   struct device_node **target, u32 *id_out)
> > -{
> > -	u32 map_mask, masked_rid;
> > -	int map_len;
> > -	const __be32 *map = NULL;
> > -
> > -	if (!np || !map_name || (!target && !id_out))
> > -		return -EINVAL;
> > -
> > -	map = of_get_property(np, map_name, &map_len);
> > -	if (!map) {
> > -		if (target)
> > -			return -ENODEV;
> > -		/* Otherwise, no map implies no translation */
> > -		*id_out = rid;
> > -		return 0;
> > -	}
> > -
> > -	if (!map_len || map_len % (4 * sizeof(*map))) {
> > -		pr_err("%pOF: Error: Bad %s length: %d\n", np,
> > -			map_name, map_len);
> > -		return -EINVAL;
> > -	}
> > -
> > -	/* The default is to select all bits. */
> > -	map_mask = 0xffffffff;
> > -
> > -	/*
> > -	 * Can be overridden by "{iommu,msi}-map-mask" property.
> > -	 * If of_property_read_u32() fails, the default is used.
> > -	 */
> > -	if (map_mask_name)
> > -		of_property_read_u32(np, map_mask_name, &map_mask);
> > -
> > -	masked_rid = map_mask & rid;
> > -	for ( ; map_len > 0; map_len -= 4 * sizeof(*map), map += 4) {
> > -		struct device_node *phandle_node;
> > -		u32 rid_base = be32_to_cpup(map + 0);
> > -		u32 phandle = be32_to_cpup(map + 1);
> > -		u32 out_base = be32_to_cpup(map + 2);
> > -		u32 rid_len = be32_to_cpup(map + 3);
> > -
> > -		if (rid_base & ~map_mask) {
> > -			pr_err("%pOF: Invalid %s translation - %s-mask (0x%x)
> ignores rid-base (0x%x)\n",
> > -				np, map_name, map_name,
> > -				map_mask, rid_base);
> > -			return -EFAULT;
> > -		}
> > -
> > -		if (masked_rid < rid_base || masked_rid >= rid_base + rid_len)
> > -			continue;
> > -
> > -		phandle_node = of_find_node_by_phandle(phandle);
> > -		if (!phandle_node)
> > -			return -ENODEV;
> > -
> > -		if (target) {
> > -			if (*target)
> > -				of_node_put(phandle_node);
> > -			else
> > -				*target = phandle_node;
> > -
> > -			if (*target != phandle_node)
> > -				continue;
> > -		}
> > -
> > -		if (id_out)
> > -			*id_out = masked_rid - rid_base + out_base;
> > -
> > -		pr_debug("%pOF: %s, using mask %08x, rid-base: %08x, out-
> base: %08x, length: %08x, rid: %08x -> %08x\n",
> > -			np, map_name, map_mask, rid_base, out_base,
> > -			rid_len, rid, masked_rid - rid_base + out_base);
> > -		return 0;
> > -	}
> > -
> > -	pr_err("%pOF: Invalid %s translation - no match for rid 0x%x on
> %pOF\n",
> > -		np, map_name, rid, target && *target ? *target : NULL);
> > -	return -EFAULT;
> > -}
> > -
> >   #if IS_ENABLED(CONFIG_OF_IRQ)
> >   /**
> >    * of_irq_parse_pci - Resolve the interrupt for a PCI device diff
> > --git a/include/linux/of_iommu.h b/include/linux/of_iommu.h index
> > 4fa654e..432b53c 100644
> > --- a/include/linux/of_iommu.h
> > +++ b/include/linux/of_iommu.h
> > @@ -15,6 +15,10 @@ extern int of_get_dma_window(struct device_node
> *dn, const char *prefix,
> >   extern const struct iommu_ops *of_iommu_configure(struct device *dev,
> >   					struct device_node *master_np);
> >
> > +int of_map_rid(struct device_node *np, u32 rid,
> > +	       const char *map_name, const char *map_mask_name,
> > +	       struct device_node **target, u32 *id_out);
> > +
> >   #else
> >
> >   static inline int of_get_dma_window(struct device_node *dn, const
> > char *prefix, @@ -30,6 +34,13 @@ static inline const struct iommu_ops
> *of_iommu_configure(struct device *dev,
> >   	return NULL;
> >   }
> >
> > +static inline int of_map_rid(struct device_node *np, u32 rid,
> > +			     const char *map_name, const char
> *map_mask_name,
> > +			     struct device_node **target, u32 *id_out) {
> > +	return -EINVAL;
> > +}
> > +
> >   #endif	/* CONFIG_OF_IOMMU */
> >
> >   extern struct of_device_id __iommu_of_table; diff --git
> > a/include/linux/of_pci.h b/include/linux/of_pci.h index
> > 091033a..a23b44a 100644
> > --- a/include/linux/of_pci.h
> > +++ b/include/linux/of_pci.h
> > @@ -17,9 +17,6 @@ struct device_node *of_pci_find_child_device(struct
> device_node *parent,
> >   int of_get_pci_domain_nr(struct device_node *node);
> >   int of_pci_get_max_link_speed(struct device_node *node);
> >   void of_pci_check_probe_only(void);
> > -int of_pci_map_rid(struct device_node *np, u32 rid,
> > -		   const char *map_name, const char *map_mask_name,
> > -		   struct device_node **target, u32 *id_out);
> >   #else
> >   static inline struct device_node *of_pci_find_child_device(struct device_node
> *parent,
> >   					     unsigned int devfn)
> > @@ -44,13 +41,6 @@ static inline int of_pci_get_devfn(struct device_node
> *np)
> >   	return -1;
> >   }
> >
> > -static inline int of_pci_map_rid(struct device_node *np, u32 rid,
> > -			const char *map_name, const char *map_mask_name,
> > -			struct device_node **target, u32 *id_out)
> > -{
> > -	return -EINVAL;
> > -}
> > -
> >   static inline int
> >   of_pci_get_max_link_speed(struct device_node *node)
> >   {
> >

  reply	other threads:[~2018-04-18  5:09 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-05 14:29 [PATCH 0/6] Support for fsl-mc bus and its devices in SMMU Nipun Gupta
2018-03-05 14:29 ` Nipun Gupta
2018-03-05 14:29 ` Nipun Gupta
2018-03-05 14:29 ` [PATCH 1/6] Docs: dt: add fsl-mc iommu-parent device-tree binding Nipun Gupta
2018-03-05 14:29   ` Nipun Gupta
2018-03-05 14:29   ` Nipun Gupta
2018-03-05 14:53   ` Robin Murphy
2018-03-05 14:53     ` Robin Murphy
2018-03-05 15:00     ` Nipun Gupta
2018-03-05 15:00       ` Nipun Gupta
2018-03-05 15:00       ` Nipun Gupta
2018-03-05 15:37       ` Robin Murphy
2018-03-05 15:37         ` Robin Murphy
2018-03-05 15:37         ` Robin Murphy
2018-03-05 15:54         ` Nipun Gupta
2018-03-05 15:54           ` Nipun Gupta
2018-03-05 15:54           ` Nipun Gupta
2018-03-07 22:40   ` Rob Herring
2018-03-07 22:40     ` Rob Herring
2018-03-07 22:40     ` Rob Herring
2018-03-08 12:32     ` Nipun Gupta
2018-03-08 12:32       ` Nipun Gupta
2018-03-08 12:32       ` Nipun Gupta
2018-03-08 12:32       ` Nipun Gupta
2018-03-05 14:29 ` [PATCH 2/6] iommu: support iommu configuration for fsl-mc devices Nipun Gupta
2018-03-05 14:29   ` Nipun Gupta
2018-03-05 14:29   ` Nipun Gupta
2018-03-05 14:29 ` [PATCH 3/6] iommu: arm-smmu: Add support for the fsl-mc bus Nipun Gupta
2018-03-05 14:29   ` Nipun Gupta
2018-03-05 14:29   ` Nipun Gupta
2018-03-05 14:29 ` [PATCH 4/6] bus: fsl-mc: remove dma ops setup from driver Nipun Gupta
2018-03-05 14:29   ` Nipun Gupta
2018-03-05 14:29   ` Nipun Gupta
2018-03-05 14:29 ` [PATCH 5/6] dma-mapping: support fsl-mc bus Nipun Gupta
2018-03-05 14:29   ` Nipun Gupta
2018-03-05 14:29   ` Nipun Gupta
2018-03-05 15:08   ` Christoph Hellwig
2018-03-05 15:08     ` Christoph Hellwig
2018-03-05 15:48     ` Robin Murphy
2018-03-05 15:48       ` Robin Murphy
2018-03-05 15:48       ` Robin Murphy
2018-03-05 18:39       ` Christoph Hellwig
2018-03-05 18:39         ` Christoph Hellwig
2018-03-05 18:39         ` Christoph Hellwig
2018-03-05 18:51         ` Robin Murphy
2018-03-05 18:51           ` Robin Murphy
2018-03-05 18:51           ` Robin Murphy
2018-03-06  4:41           ` Nipun Gupta
2018-03-06  4:41             ` Nipun Gupta
2018-03-06  4:41             ` Nipun Gupta
2018-03-06  4:41             ` Nipun Gupta
2018-03-08  7:41             ` Christoph Hellwig
2018-03-08  7:41               ` Christoph Hellwig
2018-03-08  7:41               ` Christoph Hellwig
2018-03-09 18:29               ` Nipun Gupta
2018-03-09 18:29                 ` Nipun Gupta
2018-03-09 18:29                 ` Nipun Gupta
2018-03-09 18:29                 ` Nipun Gupta
2018-03-09 18:50                 ` Robin Murphy
2018-03-09 18:50                   ` Robin Murphy
2018-03-09 18:50                   ` Robin Murphy
2018-03-05 14:29 ` [PATCH 6/6] dts: fsl-ls208x: updated DT with SMMU support for fsl-mc Nipun Gupta
2018-03-05 14:29   ` Nipun Gupta
2018-03-05 14:29   ` Nipun Gupta
2018-04-17 10:21 ` [PATCH 0/6 v2] Support for fsl-mc bus and its devices in SMMU Nipun Gupta
2018-04-17 10:21   ` Nipun Gupta
2018-04-17 10:21   ` Nipun Gupta
2018-04-17 10:21   ` Nipun Gupta
2018-04-17 10:21   ` [PATCH 1/6 v2] Docs: dt: add fsl-mc iommu-map device-tree binding Nipun Gupta
2018-04-17 10:21     ` Nipun Gupta
2018-04-17 10:21     ` Nipun Gupta
2018-04-17 10:21     ` Nipun Gupta
2018-04-17 10:21   ` [PATCH 2/6 v2] iommu: of: make of_pci_map_rid() available for other devices too Nipun Gupta
2018-04-17 10:21     ` Nipun Gupta
2018-04-17 10:21     ` Nipun Gupta
2018-04-17 10:21     ` Nipun Gupta
2018-04-17 16:52     ` Robin Murphy
2018-04-17 16:52       ` Robin Murphy
2018-04-17 16:52       ` Robin Murphy
2018-04-18  5:09       ` Bharat Bhushan [this message]
2018-04-18  5:09         ` Bharat Bhushan
2018-04-18  5:09         ` Bharat Bhushan
2018-04-18  5:09         ` Bharat Bhushan
2018-04-18  5:09         ` Bharat Bhushan
2018-04-18  6:21       ` Nipun Gupta
2018-04-18  6:21         ` Nipun Gupta
2018-04-18  6:21         ` Nipun Gupta
2018-04-18  6:21         ` Nipun Gupta
2018-04-18  6:21         ` Nipun Gupta
2018-04-17 10:21   ` [PATCH 3/6 v2] iommu: support iommu configuration for fsl-mc devices Nipun Gupta
2018-04-17 10:21     ` Nipun Gupta
2018-04-17 10:21     ` Nipun Gupta
2018-04-17 10:21     ` Nipun Gupta
2018-04-17 10:21   ` [PATCH 4/6 v2] iommu: arm-smmu: Add support for the fsl-mc bus Nipun Gupta
2018-04-17 10:21     ` Nipun Gupta
2018-04-17 10:21     ` Nipun Gupta
2018-04-17 10:21   ` [PATCH 5/6 v2] bus: fsl-mc: supoprt dma configure for devices on " Nipun Gupta
2018-04-17 10:21     ` Nipun Gupta
2018-04-17 10:21     ` Nipun Gupta
2018-04-26  0:00     ` kbuild test robot
2018-04-26  0:00       ` kbuild test robot
2018-04-26  0:00       ` kbuild test robot
2018-04-26  0:00       ` kbuild test robot
2018-04-17 10:21   ` [PATCH 6/6 v2] arm64: dts: ls208xa: comply with the iommu map binding for fsl_mc Nipun Gupta
2018-04-17 10:21     ` Nipun Gupta
2018-04-17 10:21     ` Nipun Gupta

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=AM5PR0401MB25452C7E2281806F90163E519AB60@AM5PR0401MB2545.eurprd04.prod.outlook.com \
    --to=bharat.bhushan@nxp.com \
    --cc=bhelgaas@google.com \
    --cc=catalin.marinas@arm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=laurentiu.tudor@nxp.com \
    --cc=leoyang.li@nxp.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mark.rutland@arm.com \
    --cc=nipun.gupta@nxp.com \
    --cc=robh+dt@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=shawnguo@kernel.org \
    --cc=stuyoder@gmail.com \
    --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.