From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lorenzo Pieralisi Subject: Re: [PATCH v5 07/14] drivers: acpi: iort: add support for ARM SMMU platform devices creation Date: Tue, 13 Sep 2016 09:24:41 +0100 Message-ID: <20160913082441.GA28804@red-moon> References: <20160909142343.13314-1-lorenzo.pieralisi@arm.com> <20160909142343.13314-8-lorenzo.pieralisi@arm.com> <7a63cf312b6e9714cdce1d0aca88cf4d@codeaurora.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: 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: Hanjun Guo Cc: "Rafael J. Wysocki" , linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Marc Zyngier , Tomasz Nowicki , Will Deacon , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Sinan Kaya , iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, Jon Masters , Dennis Chen , Prem Mallappa List-Id: linux-acpi@vger.kernel.org On Tue, Sep 13, 2016 at 04:15:31PM +0800, Hanjun Guo wrote: [...] > >>+static acpi_status __init iort_match_iommu_callback(struct > >>acpi_iort_node *node, > >>+ void *context) > >>+{ > >>+ int ret; > >>+ struct fwnode_handle *fwnode; > >>+ > >>+ fwnode = iort_get_fwnode(node); > >>+ > >>+ if (!fwnode) > >>+ return AE_NOT_FOUND; > >>+ > >>+ ret = iort_add_smmu_platform_device(fwnode, node); > >>+ if (ret) { > >>+ pr_err("Error in platform device creation\n"); > >>+ return AE_ERROR; > >>+ } > >>+ > >>+ return AE_OK; > >>+} > >>+ > >>+static void __init iort_smmu_init(void) > >>+{ > >>+ iort_scan_node(ACPI_IORT_NODE_SMMU, iort_match_iommu_callback, > >>NULL); > >>+ iort_scan_node(ACPI_IORT_NODE_SMMU_V3, iort_match_iommu_callback, > >>NULL); > > > >Since iort_scan_node() returns after the first successful match it finds, > >only the first SMMU_V3 in my IORT is being enumerated. I think you need > >to go back to the "iterator" like approach you had been using or make > >iort_match_iommu_callback() always return a non-AE_OK value so the scan > >continues and has a chance to visit all of the SMMU_V3 nodes. > > Please use the updated version of IORT patch (aka Tomasz's v11) > then things will work fine. Nate is right, I was too keen on using iort_scan_node(), it does not really work here (unless as he said I return a value !AE_OK in the callback, which is horrible), I reverted back to the iterator approach and I can push out a fixed up branch if useful before next posting. Thanks, Lorenzo