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: 9613589 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 26DA460414 for ; Thu, 9 Mar 2017 15:39:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 074A028679 for ; Thu, 9 Mar 2017 15:39:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EFD6A2867A; Thu, 9 Mar 2017 15:39:09 +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 7ACB52867B for ; Thu, 9 Mar 2017 15:39:09 +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=y7Z2T0fGMBjUDtM8oQHSEW2b4zO+We0rr0bl19cYvi4=; b=CO44sgVRLZwJN6sjZGpkhODvmi 8pbmUMv2LgEbNn3VdyergaPancdaqg1jBwnjHfTanEZudHer8Ngkr+Dh/0w2uer2G4JvnUXfh2QTN RUM/P3pVZxHy4WN/lipxz5bjTAnE8GjC5BotNR0eGfmRU/xR10asTo2BiM4hj/WJUTZXVMxGpAY02 iS/ov9Oko8gpos5/GzctoAjBWx3HbTN0sHbKTIXBGjBGdmVw47oK1EkXxyd3Fv7o2BKTVq+3uBRbi A1WbH8/TOAVvr/Oe0ClhsIwoJDmjAYq6J6rgit3ziYd6+39lZvEEmoFB1BzOG0jC+dn08951PC3u4 y94gTf0Q==; 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 1cm09k-0000dY-UG; Thu, 09 Mar 2017 15:39:08 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cm07f-0007Br-4S for linux-arm-kernel@lists.infradead.org; Thu, 09 Mar 2017 15:37:00 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id D643A609F2; 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=1489073801; bh=u8ACv1eq0LFemxkrC5Pe6+1Aob4/P3GWReyusRjI7Bk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RbsOfuzdRP9og7pcMi0yS5NWZR8MdWT1QO0zelN8BxM+r1o5UUnY8c0g9XZks+PRe qKX5eZT185RIsZlI24tKWDeQQtKsjNhSNxI4Bs7vYCeexs8SGJcyviyjVUgGfKxHRR Dt9fEMHwhXq2KvPkOKMxMzym6hrrHG4EIwQhpPps= 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170309_073659_201114_139E3ADC X-CRM114-Status: GOOD ( 12.20 ) 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: sricharan@codeaurora.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 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: