Received: by 10.213.65.68 with SMTP id h4csp1458922imn; Wed, 14 Mar 2018 23:25:11 -0700 (PDT) X-Google-Smtp-Source: AG47ELvYdSG40zgnyui4XsbeH1vpkOetnVs9xgCx6OnhUZ91RPEWLu4aLihZyRDoboqG/CBITeRe X-Received: by 10.99.185.71 with SMTP id v7mr1196193pgo.12.1521095111492; Wed, 14 Mar 2018 23:25:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521095111; cv=none; d=google.com; s=arc-20160816; b=fHmnz7KVTwtDdSO2VMs04LCa8REKUorZsE8bmFbX+HtcDTeLEHQ5pKg8nio8aTHq5I +LD/no/PvTsxsyVGwZwPfTLsiFwQbs+knqeLMtWSZXhjWNoWZRIa3vXjxYtfIZcwiJxT 9gMFEGosvF5UGFZX9fX1syVr3pjCPHkun3Dc/nL+e2yHf4Fyf0C+xPY7TwPa1jgrrmB2 Sq8s1fZgLpLJXBGutZPC6RsUd0FRBpjsDVEO1oS/YNaOvxd7wmn2lRC09V8VOt2v7eC0 spHa+6nq0kC/eyk6UDgdzEME6EiFHMYH0jqUsCIRMbX7ClVLj5bRpnU5GH2lHrKcHd0p p2UA== 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:dkim-signature :arc-authentication-results; bh=2MgU537OJh/5mRW0JeXP2Ck6jfQE8bFwDIqWVxg64b0=; b=KK8iDnlvpewfK178hM5n04BLUCrLfSpB12QzodTBHfT+wwzQ6o6sYgY3GYf3QHbD9a TC/B3mf1j2cS/9orAa3ouLEX2JUfZjDQstu/K8LgNa/sdtVBUxSxOSy1N6Lu4zS+BBTE I5AJyZNUQ3uJDtfGiOPndMHzgpgVLOKjiLYXF5KjyuUYrvBHLpNpInVAXA3RTVadF05S SBpm2V3bI0yr4114mCNpmFDEgbEH8gX2YiekUm3BIOJwbufryw6kphniLRNGnYgvWf3n vmcmqCJLz6hqyb+GB6azqJJHpntrvwDDSnNpthGQOnYTyLlocRkbDSbug07WKyhWUm4b eDHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=O+W7fu0u; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v7si3005699pgv.312.2018.03.14.23.24.56; Wed, 14 Mar 2018 23:25:11 -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=@chromium.org header.s=google header.b=O+W7fu0u; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751523AbeCOGYD (ORCPT + 99 others); Thu, 15 Mar 2018 02:24:03 -0400 Received: from mail-ua0-f196.google.com ([209.85.217.196]:39556 "EHLO mail-ua0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750720AbeCOGYC (ORCPT ); Thu, 15 Mar 2018 02:24:02 -0400 Received: by mail-ua0-f196.google.com with SMTP id e25so3667157uam.6 for ; Wed, 14 Mar 2018 23:24:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=2MgU537OJh/5mRW0JeXP2Ck6jfQE8bFwDIqWVxg64b0=; b=O+W7fu0ugem2B2svQ4H67QRPUzWiglzY7+HX+HaMmh/nNaPJXpAPN4ZfIXhDn91lV0 YAeSI+NdOs4bgpXjeW/NvNY4OREJklzJm1fW8YAK9kV7tZe9dI/SKNBoTIFD2jdDY2j4 CzZDfLOAAWDj9a7NBHMuF6JC9dWiS7VO7mHv4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=2MgU537OJh/5mRW0JeXP2Ck6jfQE8bFwDIqWVxg64b0=; b=ZdtIUSM7MtV0n9SASlBbEKmzGjHXFsx6AEvts/ZthePSZitNQQgPuqDWfHMacoUynV xIa8rDrZg618jFIkfPgQxXpGLZxl1bVwv0MLO5Na9Fg8AhiBEQPVlqOnqHVw1eDSht9B YflZoFzHiRjvkyHvTvVkw2uvlMCvITT5HVpT972m/W1m1i+Af56IqqIdMHDcp/uspzd+ sA5cNkfkSTNGq6iHuuf8zOiHY3VCrifugJwvtr8QTANfX+XQq6rmf80FYTaGc9wItaWA Cranq6u0OP1sttEfPqCkI5nzuAdp0bwTM3GVa2qyGoD/c7otNAgjmj7Lqb/P8/jraI1S g1ZA== X-Gm-Message-State: AElRT7E+V8ohWuUaN1Ipg81Cd0PXy4GTibRpRfBte5YJZwE6RqZUo8Am W7X8Cj6XVpeZK/n9G0aYL/bncGkq8eU= X-Received: by 10.176.112.52 with SMTP id u20mr5315952ual.19.1521095041290; Wed, 14 Mar 2018 23:24:01 -0700 (PDT) Received: from mail-ua0-f175.google.com (mail-ua0-f175.google.com. [209.85.217.175]) by smtp.gmail.com with ESMTPSA id o4sm637148uak.26.2018.03.14.23.24.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Mar 2018 23:24:01 -0700 (PDT) Received: by mail-ua0-f175.google.com with SMTP id d1so3653017ual.13 for ; Wed, 14 Mar 2018 23:24:00 -0700 (PDT) X-Received: by 10.176.68.197 with SMTP id n63mr5199970uan.132.1521094708686; Wed, 14 Mar 2018 23:18:28 -0700 (PDT) MIME-Version: 1.0 Received: by 10.176.0.99 with HTTP; Wed, 14 Mar 2018 23:18:08 -0700 (PDT) In-Reply-To: <8b427ea2-5c13-4712-13d1-e4c1aed0779e@arm.com> References: <20180313085534.11650-1-vivek.gautam@codeaurora.org> <20180313085534.11650-5-vivek.gautam@codeaurora.org> <8b427ea2-5c13-4712-13d1-e4c1aed0779e@arm.com> From: Tomasz Figa Date: Thu, 15 Mar 2018 15:18:08 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v9 4/5] iommu/arm-smmu: Add the device_link between masters and smmu To: Robin Murphy Cc: Vivek Gautam , Joerg Roedel , Rob Herring , "open list:IOMMU DRIVERS" , devicetree@vger.kernel.org, Linux Kernel Mailing List , Mark Rutland , Will Deacon , Rob Clark , 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 Thu, Mar 15, 2018 at 2:50 AM, Robin Murphy wrote: > On 13/03/18 08:55, 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 >> Reviewed-by: Tomasz Figa >> --- >> drivers/iommu/arm-smmu.c | 29 +++++++++++++++++++++++++++++ >> 1 file changed, 29 insertions(+) >> >> diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c >> index 56a04ae80bf3..64953ff2281f 100644 >> --- a/drivers/iommu/arm-smmu.c >> +++ b/drivers/iommu/arm-smmu.c >> @@ -1460,10 +1460,31 @@ static int arm_smmu_add_device(struct device *dev) >> iommu_device_link(&smmu->iommu, dev); >> + if (pm_runtime_enabled(smmu->dev)) { >> + struct device_link *link; >> + >> + /* >> + * 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) { > > > FWIW, given that we don't really care about link itself, I'd be quite happy > to simplify that lot down to: > > if (pm_runtime_enabled(smmu_dev) && > !device_link_add(dev, smmu->dev, DL_FLAG_PM_RUNTIME)) { > >> + dev_warn(smmu->dev, >> + "Unable to add link to the consumer >> %s\n", >> + dev_name(dev)); > > > (side note: since device_link_add() already prints a message on success, > maybe it could print its own failure message too?) I think we care whether adding the link succeeded. If it fails to be added, we might end up with a complete system lockup on a system with power domains. Best regards, Tomasz