From patchwork Thu Mar 9 15:35:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sricharan Ramabadhran X-Patchwork-Id: 9613577 X-Patchwork-Delegate: sboyd@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A9C70604D9 for ; Thu, 9 Mar 2017 15:36:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A5BE28658 for ; Thu, 9 Mar 2017 15:36:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7F55828676; Thu, 9 Mar 2017 15:36:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 229DD28658 for ; Thu, 9 Mar 2017 15:36:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932565AbdCIPgn (ORCPT ); Thu, 9 Mar 2017 10:36:43 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:57572 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754932AbdCIPgm (ORCPT ); Thu, 9 Mar 2017 10:36:42 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 9AB0C6089A; Thu, 9 Mar 2017 15:36:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1489073800; bh=u8ACv1eq0LFemxkrC5Pe6+1Aob4/P3GWReyusRjI7Bk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SEbI4bdK+ZcFM/TwmmLA5aCaiEE54SWVz5xkdOMt74FS1uNspuPQLO96GOVqcb94r 1fvAcJpmUHbf4tasQDo7Em1Ul0y8DOt+ZYNFJfuohDFCplLAtZ3Hk40PBAZbrSRkKK Kjpc5b/hveeM1+Y+2uiML9bwFmJdKoblJWnR5BOs= Received: from blr-ubuntu-32.ap.qualcomm.com (unknown [202.46.23.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: sricharan@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 167F4607A7; Thu, 9 Mar 2017 15:36:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1489073798; bh=u8ACv1eq0LFemxkrC5Pe6+1Aob4/P3GWReyusRjI7Bk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=czmr/Hgp71Fh4iR3TZq06xPwADERDljlS0Vw3c8e1EN79Y8Eq3uSufL6gaAOooxQ1 H13KHeBwdKEhkr2uwzPReFcbifVnLQUc72EPWL8hd9wXthSU4RVdWIA9Kxm/ACk5DV R2D3drOxD7xClz1pCuqbsEBaYivXD1kaLt9PUOxA= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 167F4607A7 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=sricharan@codeaurora.org From: Sricharan R To: robin.murphy@arm.com, will.deacon@arm.com, joro@8bytes.org, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, m.szyprowski@samsung.com, linux-clk@vger.kernel.org, sboyd@codeaurora.org, devicetree@vger.kernel.org, robh+dt@kernel.org, mathieu.poirier@linaro.org, mark.rutland@arm.com Cc: sricharan@codeaurora.org Subject: [PATCH V3 5/5] iommu/arm-smmu: Add the device_link between masters and smmu Date: Thu, 9 Mar 2017 21:05:48 +0530 Message-Id: <1489073748-3659-6-git-send-email-sricharan@codeaurora.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1489073748-3659-1-git-send-email-sricharan@codeaurora.org> References: <1489073748-3659-1-git-send-email-sricharan@codeaurora.org> Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/iommu/arm-smmu.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 6370421..b06f86c7 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -1671,6 +1671,7 @@ static int arm_smmu_add_device(struct device *dev) struct arm_smmu_device *smmu; struct arm_smmu_master_cfg *cfg; struct iommu_fwspec *fwspec = dev->iommu_fwspec; + struct device_link *link = NULL; int i, ret; unsigned long err; @@ -1727,6 +1728,16 @@ static int arm_smmu_add_device(struct device *dev) if (IS_ERR_VALUE(err)) goto out_free; + /* + * Establish the link between smmu and master, so that the + * smmu gets runtime enabled/disabled as per the master's + * needs. + */ + link = device_link_add(dev, smmu->dev, DL_FLAG_PM_RUNTIME); + if (!link) + dev_warn(smmu->dev, "Unable to create device link between %s and %s\n", + dev_name(smmu->dev), dev_name(dev)); + return 0; out_free: