From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B3C6C433E2 for ; Thu, 4 Jun 2020 14:49:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1298B20823 for ; Thu, 4 Jun 2020 14:49:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729120AbgFDOt6 (ORCPT ); Thu, 4 Jun 2020 10:49:58 -0400 Received: from foss.arm.com ([217.140.110.172]:45326 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729021AbgFDOt6 (ORCPT ); Thu, 4 Jun 2020 10:49:58 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1C5B62B; Thu, 4 Jun 2020 07:49:57 -0700 (PDT) Received: from e121166-lin.cambridge.arm.com (e121166-lin.cambridge.arm.com [10.1.196.255]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9ECCE3F305; Thu, 4 Jun 2020 07:49:54 -0700 (PDT) Date: Thu, 4 Jun 2020 15:49:52 +0100 From: Lorenzo Pieralisi To: Rob Herring Cc: "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , Robin Murphy , Joerg Roedel , Laurentiu Tudor , Linux IOMMU , linux-acpi@vger.kernel.org, devicetree@vger.kernel.org, PCI , "Rafael J. Wysocki" , Hanjun Guo , Bjorn Helgaas , Sudeep Holla , Catalin Marinas , Will Deacon , Marc Zyngier , Makarand Pawagi , Diana Craciun Subject: Re: [PATCH 07/12] of/device: Add input id to of_dma_configure() Message-ID: <20200604144952.GB476@e121166-lin.cambridge.arm.com> References: <20200521130008.8266-1-lorenzo.pieralisi@arm.com> <20200521130008.8266-8-lorenzo.pieralisi@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Thu, May 21, 2020 at 05:02:20PM -0600, Rob Herring wrote: > On Thu, May 21, 2020 at 7:00 AM Lorenzo Pieralisi > wrote: > > > > Devices sitting on proprietary busses have a device ID space that > > is owned by the respective bus and related firmware bindings. In order > > to let the generic OF layer handle the input translations to > > an IOMMU id, for such busses the current of_dma_configure() interface > > should be extended in order to allow the bus layer to provide the > > device input id parameter - that is retrieved/assigned in bus > > specific code and firmware. > > > > Augment of_dma_configure() to add an optional input_id parameter, > > leaving current functionality unchanged. > > > > Signed-off-by: Lorenzo Pieralisi > > Cc: Rob Herring > > Cc: Robin Murphy > > Cc: Joerg Roedel > > Cc: Laurentiu Tudor > > --- > > drivers/bus/fsl-mc/fsl-mc-bus.c | 4 ++- > > drivers/iommu/of_iommu.c | 53 +++++++++++++++++++++------------ > > drivers/of/device.c | 8 +++-- > > include/linux/of_device.h | 16 ++++++++-- > > include/linux/of_iommu.h | 6 ++-- > > 5 files changed, 60 insertions(+), 27 deletions(-) > > > > diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c > > index 40526da5c6a6..8ead3f0238f2 100644 > > --- a/drivers/bus/fsl-mc/fsl-mc-bus.c > > +++ b/drivers/bus/fsl-mc/fsl-mc-bus.c > > @@ -118,11 +118,13 @@ static int fsl_mc_bus_uevent(struct device *dev, struct kobj_uevent_env *env) > > static int fsl_mc_dma_configure(struct device *dev) > > { > > struct device *dma_dev = dev; > > + struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev); > > + u32 input_id = mc_dev->icid; > > > > while (dev_is_fsl_mc(dma_dev)) > > dma_dev = dma_dev->parent; > > > > - return of_dma_configure(dev, dma_dev->of_node, 0); > > + return of_dma_configure_id(dev, dma_dev->of_node, 0, &input_id); > > } > > > > static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, > > diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c > > index ad96b87137d6..4516d5bf6cc9 100644 > > --- a/drivers/iommu/of_iommu.c > > +++ b/drivers/iommu/of_iommu.c > > @@ -139,25 +139,53 @@ static int of_pci_iommu_init(struct pci_dev *pdev, u16 alias, void *data) > > return err; > > } > > > > -static int of_fsl_mc_iommu_init(struct fsl_mc_device *mc_dev, > > - struct device_node *master_np) > > +static int of_iommu_configure_dev_id(struct device_node *master_np, > > + struct device *dev, > > + const u32 *id) > > Should have read this patch before #6. I guess you could still make > of_pci_iommu_init() call > of_iommu_configure_dev_id. Yes that makes sense, I will update it. Thanks, Lorenzo