Received: by 10.213.65.16 with SMTP id m16csp272762imf; Mon, 12 Mar 2018 03:22:58 -0700 (PDT) X-Google-Smtp-Source: AG47ELtMhzwUdApaKa8cTaUpZtDSmHODaUaldZwZWSvPh6xSZCjOY7OQiDjoY4bI7Bu5coa6pXXK X-Received: by 10.99.170.5 with SMTP id e5mr6018087pgf.92.1520850178269; Mon, 12 Mar 2018 03:22:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520850178; cv=none; d=google.com; s=arc-20160816; b=hNDTTwqRn2iAZLzL6Jk0GvQyY9nVGNlIdKolVlfyGQXIkl1Uw9VQ3+LZyrXdBw24Oq nvRnbOXsb2WKP6bwxoNIoRhp7WFssyk3vphqFUHD4pwgoI5+PjXR9yOQMqhq5tTDL7bn 9luCspGRXuWA37eJ88ef3LkJmQJqNZW6B1Y/ZTlLbQhWEoi/GAN8HLmbMUJs4K78pWY+ 5cD1nhrrV2bFsu+g+yUEQHNhRlYLXj+07nlRAPxwJb8N8qkEkv1bLd4AujkArCMDmNik B53GZSRzSG3KFssFw4BXE7bzgUzsPaMtZUH+Dph7ATx5RHlqNFAGVf2mM7cQx77ltqLg hIzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dmarc-filter:dkim-signature :dkim-signature:arc-authentication-results; bh=5vkkg4O3oeBWkL4LvNl5fvC1+WTAMVFv18CKWDs/b8E=; b=zaZHaOXcDRjSZmmxtgGVnfRqivGNFiVR3HYa8hH3pGnhjSrLFiX1+14unjINj4wLB8 FXvmeNwroPjI7Xdzmid3i8V4rjkHv4S5AEwoYYRi2n+hGceK7ZhpcqN/7hXsGzp5AkiW t2ANadD6Ac3GGM1bZpihmUdi6GY6uP6rrZj+HQ4elQPLvkaTjgi+zTFN/zZd49zaNR7g Di0ygmrWmOCh9AMeDmOdVXIax4ifkjbeO1KJwQC12qvdvMyko4U9/6LccEwMU0vANWV3 VlvSigRWojRbPgV1YTRp4gJ7VPfx0qoeOgvhU2SRJju85J5JKK+q4jPe2diEi0OEg/9K wyiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=pDbbCCc3; dkim=pass header.i=@codeaurora.org header.s=default header.b=hRfSKHsg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y8si3409177pgq.548.2018.03.12.03.22.43; Mon, 12 Mar 2018 03:22:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=pDbbCCc3; dkim=pass header.i=@codeaurora.org header.s=default header.b=hRfSKHsg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752293AbeCLKVu (ORCPT + 99 others); Mon, 12 Mar 2018 06:21:50 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:50626 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751252AbeCLKVs (ORCPT ); Mon, 12 Mar 2018 06:21:48 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id BE966606DB; Mon, 12 Mar 2018 10:21:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520850107; bh=tj5BP+5PArpjDO5DEtu+ZuqWBMrKvhUa4n84NYaVQbI=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=pDbbCCc3UJA7jRFWz5srqrVTfRa05LnUfmQV1/0ZcMRRHazzgPkzfj22bsP0Z8QQI M+5Y3HvvSeGNmyvcicHV7bwYsgZUjuR0WMAYndHUZXJ90+HQN6w9+TB0/9Lk/3NWg3 JK2iDNhztVxtHqtFliANtBc7M90wEUFuiorY+jlU= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from mail-qt0-f181.google.com (mail-qt0-f181.google.com [209.85.216.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: vivek.gautam@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 93DF0607A2; Mon, 12 Mar 2018 10:21:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520850106; bh=tj5BP+5PArpjDO5DEtu+ZuqWBMrKvhUa4n84NYaVQbI=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=hRfSKHsgZyMcEwEZlWjDgwSHJLNbkrrU02+4y3eSL7mcOCTD4QXYQLV7W4Rg8+gtP j1BX30lTsb0ZkdLxqU14gTI1jWBa/RQVOEyEJXE/8gCsWBV561HeJ2juWNIBm+j1jS P+SVH6hxkLT6mUblbcdJ23hWv+ju51YDTzRUTa0Y= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 93DF0607A2 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=vivek.gautam@codeaurora.org Received: by mail-qt0-f181.google.com with SMTP id j4so18143242qth.8; Mon, 12 Mar 2018 03:21:46 -0700 (PDT) X-Gm-Message-State: AElRT7EouiIhz9vC0U366M2UJjfJyZRAYxl72k3+aSfR5EXyuOjd9b3j 3e4nu2i/HQFp2D2SdxlbfEuD0DAJSYWQ4O6XfOE= X-Received: by 10.200.15.58 with SMTP id e55mr10908954qtk.261.1520850105751; Mon, 12 Mar 2018 03:21:45 -0700 (PDT) MIME-Version: 1.0 Received: by 10.200.83.10 with HTTP; Mon, 12 Mar 2018 03:21:44 -0700 (PDT) In-Reply-To: References: <20180302101050.6191-1-vivek.gautam@codeaurora.org> <20180302101050.6191-5-vivek.gautam@codeaurora.org> From: Vivek Gautam Date: Mon, 12 Mar 2018 15:51:44 +0530 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v8 4/5] iommu/arm-smmu: Add the device_link between masters and smmu To: Robin Murphy Cc: "Rafael J. Wysocki" , "list@263.net:IOMMU DRIVERS" , Joerg Roedel , "robh+dt" , Mark Rutland , Will Deacon , Rob Clark , devicetree@vger.kernel.org, open list , Tomasz Figa , jcrouse@codeaurora.org, Stephen Boyd , Sricharan R , Marek Szyprowski , Archit Taneja , linux-arm-msm Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 9, 2018 at 6:04 PM, Robin Murphy wrote: > On 09/03/18 07:11, Vivek Gautam wrote: >> >> On Thu, Mar 8, 2018 at 10:29 AM, Vivek Gautam >> wrote: >>> >>> On Wed, Mar 7, 2018 at 6:17 PM, Robin Murphy >>> wrote: >>>> >>>> On 02/03/18 10:10, Vivek Gautam wrote: >>>>> >>>>> >>>>> From: Sricharan R >>>>> >>>>> Finally add the device link between the master device and >>>>> smmu, so that the smmu gets runtime enabled/disabled only when the >>>>> master needs it. This is done from add_device callback which gets >>>>> called once when the master is added to the smmu. >>>>> >>>>> Signed-off-by: Sricharan R >>>>> Signed-off-by: Vivek Gautam >>>>> --- >>>>> drivers/iommu/arm-smmu.c | 21 +++++++++++++++++++++ >>>>> 1 file changed, 21 insertions(+) >>>>> >>>>> diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c >>>>> index 3d6a1875431f..bb1ea82c1003 100644 >>>>> --- a/drivers/iommu/arm-smmu.c >>>>> +++ b/drivers/iommu/arm-smmu.c >>>>> @@ -217,6 +217,9 @@ struct arm_smmu_device { >>>>> /* IOMMU core code handle */ >>>>> struct iommu_device iommu; >>>>> + >>>>> + /* runtime PM link to master */ >>>>> + struct device_link *link; >>>> >>>> >>>> >>>> Just the one? >> >> >> we will either have to count all the devices that are present on the >> iommu bus, or >> maintain a list to which all the links can be added. >> But to add the list, we will have to initialize a LIST_HEAD in struct >> device_link >> as well. >> >> Or, I think we don't even need to maintain a pointer to link with smmu. >> In arm_smmu_remove_device(), we can find out the correct link, and delete >> it. >> >> list_for_each_entry(link, &dev->links.suppliers, c_node) >> if (link->supplier == smmu->dev); >> device_link_del(link); >> >> Should that be fine? >> >> Rafael, does the above snippet looks right to you? Context: smmu->dev >> is the supplier, and dev is the consumer. We want to find the link, >> and delete it. > > > Actually, looking at the existing code, it seems like device_link_add() will > in fact look up and return any existing link between a given supplier and > consumer - is that intentional API behaviour that users may rely on to avoid > keeping track of explicit link pointers? > (or conversely, might it be > reasonable to factor out a device_link_find() function?) Yea, that sounds better. regards Vivek > > Robin. > > -- > To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation