From patchwork Thu Jul 6 09:37:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vivek Gautam X-Patchwork-Id: 9827837 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 D4D8F60317 for ; Thu, 6 Jul 2017 09:38:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 59094283C0 for ; Thu, 6 Jul 2017 09:38:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4CAB12847B; Thu, 6 Jul 2017 09:38: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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BF4E5283C0 for ; Thu, 6 Jul 2017 09:38:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=7UCd2d4gA5K6bFXe6s/tvu5VxKMb0+ekmlAesdvxQVE=; b=AKdJ/LDaUK2cZ87SBH6oNTaZhq fcFr9mqCK0Hr/z55738EXlBdESD67XH7YeOJrq2jE5RTQhu+ZzFvrbqpdFdiY8RihCS26krpUO6fs oLUNAIFb3mVr11xU8G/SATmeJtfO0GXqQD3MzoawBzsj2x+HPU9WGdWNmy4rkUdm6QFO4xrQwF4vC 6snfzG+FYDsqK5SxW6f/rd9Q8SWE1px/5RIZb9pXmkbagNEPJ8QVvhgMTMoxDzgnQJHQbQWu+vHfm zmHpXZeGjpgdFJ2sduY9dPUaiIKYw3ZUU67TJE8QWXKWJMwn53VGNOND51aJBTyMBznrFm/cHXtS4 pjUWwN9g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dT3F8-00081d-VW; Thu, 06 Jul 2017 09:38:38 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dT3EW-0006oH-M8 for linux-arm-kernel@lists.infradead.org; Thu, 06 Jul 2017 09:38:06 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id D060060FEE; Thu, 6 Jul 2017 09:37:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1499333860; bh=xWhO+mNR9HoJJGWGHO7z1rGVdt3HffreN90XNINNJks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dRRYU9gyRbMk615z5K4u8purlWTrRaakps6WpViGVNhLJZdJyiBCRHJLtpEqKIBX6 nd9Dns5AdiWNiNXQEqL1ZUXHkK3FtR7juUyUyB2E7+aluN3mAzXFucLsZrwCl8XSfP ZqYWnnPnMc42j7OPSFn7OADorMbYLNxgP6HOHMaw= Received: from blr-ubuntu-41.ap.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.18.19]) (using TLSv1.1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: vivek.gautam@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 5363760F8F; Thu, 6 Jul 2017 09:37:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1499333860; bh=xWhO+mNR9HoJJGWGHO7z1rGVdt3HffreN90XNINNJks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dRRYU9gyRbMk615z5K4u8purlWTrRaakps6WpViGVNhLJZdJyiBCRHJLtpEqKIBX6 nd9Dns5AdiWNiNXQEqL1ZUXHkK3FtR7juUyUyB2E7+aluN3mAzXFucLsZrwCl8XSfP ZqYWnnPnMc42j7OPSFn7OADorMbYLNxgP6HOHMaw= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 5363760F8F 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 From: Vivek Gautam To: joro@8bytes.org, robin.murphy@arm.com, robh+dt@kernel.org, mark.rutland@arm.com, will.deacon@arm.com, m.szyprowski@samsung.com, sboyd@codeaurora.org, robdclark@gmail.com, iommu@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org Subject: [PATCH V4 4/6] iommu/arm-smmu: Add the device_link between masters and smmu Date: Thu, 6 Jul 2017 15:07:03 +0530 Message-Id: <1499333825-7658-5-git-send-email-vivek.gautam@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1499333825-7658-1-git-send-email-vivek.gautam@codeaurora.org> References: <1499333825-7658-1-git-send-email-vivek.gautam@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170706_023801_752750_22D6A4E4 X-CRM114-Status: GOOD ( 12.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: architt@codeaurora.org, linux-arm-msm@vger.kernel.org, stanimir.varbanov@linaro.org, vivek.gautam@codeaurora.org, sricharan@codeaurora.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 ddbfa8ab69e6..75567d9698ab 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -1348,6 +1348,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; if (using_legacy_binding) { @@ -1403,6 +1404,16 @@ static int arm_smmu_add_device(struct device *dev) pm_runtime_put_sync(smmu->dev); + /* + * 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_cfg_free: