From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hiroshi Doyu Subject: Re: [PATCHv3 14/19] iommu/tegra: smmu: Get "nvidia,memory-clients" from DT Date: Thu, 31 Oct 2013 09:18:08 +0100 Message-ID: <20131031.101808.1830527808656695540.hdoyu@nvidia.com> References: <1382092020-13170-1-git-send-email-hdoyu@nvidia.com><1382092020-13170-15-git-send-email-hdoyu@nvidia.com><52718BB4.4090007@wwwdotorg.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <52718BB4.4090007-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: "swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org" Cc: "devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , Stephen Warren , "rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org" , "linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org" , "grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org" List-Id: devicetree@vger.kernel.org Stephen Warren wrote @ Wed, 30 Oct 2013 23:44:04 +0100: > > + host1x { > > + compatible = "nvidia,tegra30-host1x", "simple-bus"; > > + nvidia,memory-clients = <&smmu TEGRA_SWGROUP_HC>; > > + .... > > + gr3d { > > + compatible = "nvidia,tegra30-gr3d"; > > + nvidia,memory-clients = <&smmu TEGRA_SWGROUP_NV > > + TEGRA_SWGROUP_NV2>; > > Why one cell for the host1x property, and two cells for the gr3d > property; shouldn't they be the same length? That can vary. Even a single device node in DT can belong to multiple software groups. > > diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c > > > +static u64 smmu_of_get_memory_client(struct device *dev) > > > + np = of_parse_phandle(dev->of_node, propname, 0); > > + if (np != smmu_handle->dev->of_node) > > + return ~0; > > + > > + prop = of_get_property(dev->of_node, propname, &bytes); > > + if (!prop || !bytes) > > + return ~0; > > of_parse_phandle_with_fixed_args() might be a good fit here, or perhaps > require a property #smmu-cells in the SMMU node, thus allowing the > non-fixed-length of_parse_phandle_with_args() to be used here. I once considered of_parse_phandle_with_args() but I couldn't use that since "#smmu-cells" needed to be fixed in smmu node, not in client node. In this case, the number of argument(number of swgroup IDs) varies per client device.