Received: by 10.223.185.116 with SMTP id b49csp3440572wrg; Tue, 13 Feb 2018 02:27:15 -0800 (PST) X-Google-Smtp-Source: AH8x226F2aobGhHAWqNfNvAa8VBsorhSNL1ag1979PXY+050vhUIGYuvV1ZNjQVPaZTXGAcLR/JA X-Received: by 10.99.177.4 with SMTP id r4mr605828pgf.245.1518517635809; Tue, 13 Feb 2018 02:27:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518517635; cv=none; d=google.com; s=arc-20160816; b=cVhjBev5uGZCav/I5VTDdk3X7e+EMhNK4zB4J8rcV5fTGeABn/YqHo4OZGDN6+WFIz h8mXIb6hFMx4md+I/ZLJLIHiyVLmPcU8Dezwu3zCgiI7JikJfFPjBZZIutf6V5xVBBCy 1ZfeDGARluaj+znQ7oJ3c/pG2iZTQhDcrrQ4PiWkeO5fqDU7FTuYXrzg4mkaMOCPOhEH QvQNp73ZelmIijVaHkRZdd5XcUzaIic3ni/PgWAEUHo5VQpVoa6uFd/JkLpw+Wxj9Hrm nUOeJxGXiPdvUc7B8JBnUf1TFU2KOB6GME+aBQI2biWwlT19L1rEJFH4nqGthsnmlAdY eEng== 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=xr86nq93PJm9wLXchpW1tXXkQRtNtFDTZWjDL/WDR2w=; b=AXOyykgI0QXH5I50LMyQpBjivAGWIfjqDcUXc32E8Spuj2xB4BftGEl3QkKq4+vHpx 8TlCpMtl6NM02teKM850me/MpwKbH8E8snLTBgIGM8v2V8vj7nY9Bv1xFjGtFiXVXMMO qrtZhYCOyGXbii1lrmBF1w/H4PX//QoQH8VnemNk4xqz+v9n89pvrnApi6jrIlHdOhiq O6N7/59AWqXQP/ACdbweqZN8Nedi+goO6KBLRw0wAjIlgLGrnlA5VbgUxPVOG2oSv0qa APHfjMVGvKADoSlZmp2EBLJV2X9LQNRrEAvlOIava20rz8zTwUatifeSBdGS9DdbI8qC evog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=lcph7HLB; dkim=pass header.i=@codeaurora.org header.s=default header.b=G5SVLULB; 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 f10si6300213pgu.783.2018.02.13.02.27.00; Tue, 13 Feb 2018 02:27:15 -0800 (PST) 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=lcph7HLB; dkim=pass header.i=@codeaurora.org header.s=default header.b=G5SVLULB; 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 S1754151AbeBMKZr (ORCPT + 99 others); Tue, 13 Feb 2018 05:25:47 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:57314 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751685AbeBMKZn (ORCPT ); Tue, 13 Feb 2018 05:25:43 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 1724960F6D; Tue, 13 Feb 2018 10:25:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1518517543; bh=N56zxA30O6uhmV/Q5hSAFlWRDooTIDd8oF3lBRhwAVQ=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=lcph7HLBeiEKFA6wbeT1cjfGAfTOQBD2qCFQY6c6w0Fplj/ALEL6iwIvuDl5VRSr8 KhL6iZgPSlqK+Zf2Qrm7FVFbc5WaRGpYMVXPbwRb9LONM4CzJ7aHI8mJoB9x495QQL kZlUBw3il9YM44NB00wO1ZZTj32PYcsJNQSe2AW4= 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 946CE60F72; Tue, 13 Feb 2018 10:25:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1518517541; bh=N56zxA30O6uhmV/Q5hSAFlWRDooTIDd8oF3lBRhwAVQ=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=G5SVLULBbvk6SLZChKlR72uCrLaoEKkxUpwR60RIp8oCFv2U+BdxFdHbxJqbRSXQE hhs4154AbQwoW5NJLiZcm0HN8tDTKJdgigsv+t5DB2a3Ot9DYL3+/lPyl+Pf9w5jIB C+29HZCWVTxnUWfXxjqA/hwx8nvs/bcEE8n02t14= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 946CE60F72 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 d14so3075721qtg.1; Tue, 13 Feb 2018 02:25:41 -0800 (PST) X-Gm-Message-State: APf1xPCjH5MErxIp+JV6ogPF/TjO5rqMtXtRoKSzveU2ZzXCsiDlGyPf w5kd5z07biCVRL8wdsjZZQz4vg/eapWGScLFyis= X-Received: by 10.237.37.161 with SMTP id x30mr1093837qtc.78.1518517540694; Tue, 13 Feb 2018 02:25:40 -0800 (PST) MIME-Version: 1.0 Received: by 10.200.8.227 with HTTP; Tue, 13 Feb 2018 02:25:40 -0800 (PST) In-Reply-To: References: <1517999482-17317-1-git-send-email-vivek.gautam@codeaurora.org> <1517999482-17317-3-git-send-email-vivek.gautam@codeaurora.org> From: Vivek Gautam Date: Tue, 13 Feb 2018 15:55:40 +0530 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v7 2/6] iommu/arm-smmu: Add pm_runtime/sleep ops To: Tomasz Figa Cc: "list@263.net:IOMMU DRIVERS , Joerg Roedel ," , Rob Herring , Mark Rutland , "Rafael J. Wysocki" , Robin Murphy , Will Deacon , Rob Clark , "list@263.net:IOMMU DRIVERS , Joerg Roedel ," , devicetree@vger.kernel.org, open list , Linux PM , dri-devel , freedreno@lists.freedesktop.org, David Airlie , Greg KH , Stephen Boyd , 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 Hi Tomasz, Please find my response inline below. On Tue, Feb 13, 2018 at 1:33 PM, Tomasz Figa wrote: > Hi Vivek, > > Thanks for the patch. Please see some comments inline. > > On Wed, Feb 7, 2018 at 7:31 PM, Vivek Gautam > wrote: >> From: Sricharan R >> >> The smmu needs to be functional only when the respective >> master's using it are active. The device_link feature >> helps to track such functional dependencies, so that the >> iommu gets powered when the master device enables itself >> using pm_runtime. So by adapting the smmu driver for >> runtime pm, above said dependency can be addressed. >> >> This patch adds the pm runtime/sleep callbacks to the >> driver and also the functions to parse the smmu clocks >> from DT and enable them in resume/suspend. >> >> Signed-off-by: Sricharan R >> Signed-off-by: Archit Taneja >> [vivek: Clock rework to request bulk of clocks] >> Signed-off-by: Vivek Gautam >> --- >> drivers/iommu/arm-smmu.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++-- >> 1 file changed, 54 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c >> index 69e7c60792a8..9e2f917e16c2 100644 >> --- a/drivers/iommu/arm-smmu.c >> +++ b/drivers/iommu/arm-smmu.c >> @@ -48,6 +48,7 @@ >> #include >> #include >> #include >> +#include >> #include >> #include >> >> @@ -205,6 +206,8 @@ struct arm_smmu_device { >> u32 num_global_irqs; >> u32 num_context_irqs; >> unsigned int *irqs; >> + struct clk_bulk_data *clocks; >> + int num_clks; > > nit: Perhaps "num_clocks" to be consistent with "clocks"? > >> >> u32 cavium_id_base; /* Specific to Cavium */ >> >> @@ -1897,10 +1900,12 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu) >> struct arm_smmu_match_data { >> enum arm_smmu_arch_version version; >> enum arm_smmu_implementation model; >> + const char * const *clks; >> + int num_clks; > > nit: Perhaps s/clks/clocks/ here or s/clocks/clks/ in struct arm_smmu_device? Sure. Will change to s/clocks/clks/ in struct arm_smmu_device. > >> }; >> >> #define ARM_SMMU_MATCH_DATA(name, ver, imp) \ >> -static struct arm_smmu_match_data name = { .version = ver, .model = imp } >> +static const struct arm_smmu_match_data name = { .version = ver, .model = imp } >> >> ARM_SMMU_MATCH_DATA(smmu_generic_v1, ARM_SMMU_V1, GENERIC_SMMU); >> ARM_SMMU_MATCH_DATA(smmu_generic_v2, ARM_SMMU_V2, GENERIC_SMMU); >> @@ -2001,6 +2006,7 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev, >> data = of_device_get_match_data(dev); >> smmu->version = data->version; >> smmu->model = data->model; >> + smmu->num_clks = data->num_clks; >> >> parse_driver_options(smmu); >> >> @@ -2039,6 +2045,28 @@ static void arm_smmu_bus_init(void) >> #endif >> } >> >> +static int arm_smmu_init_clks(struct arm_smmu_device *smmu) >> +{ >> + int i; >> + int num = smmu->num_clks; >> + const struct arm_smmu_match_data *data; >> + >> + if (num < 1) >> + return 0; >> + >> + smmu->clocks = devm_kcalloc(smmu->dev, num, >> + sizeof(*smmu->clocks), GFP_KERNEL); >> + if (!smmu->clocks) >> + return -ENOMEM; >> + >> + data = of_device_get_match_data(smmu->dev); >> + >> + for (i = 0; i < num; i++) >> + smmu->clocks[i].id = data->clks[i]; > > I'd argue that arm_smmu_device_dt_probe() is a better place for all > the code above, since this function is called regardless of whether > the device is probed from DT or not. Going further, > arm_smmu_device_acpi_probe() could fill smmu->num_clks and ->clocks > using ACPI-like way (as opposed to OF match data) if necessary. Right, it's valid to fill the data in arm_smmu_device_dt_probe(). Perhaps we can just keep the devm_clk_bulk_get() in arm_smmu_device_probe() at the point where we are currently doing arm_smmu_init_clks(). Thanks & regards Vivek > > Best regards, > Tomasz > -- > 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