Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp354401ybi; Tue, 16 Jul 2019 21:50:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqwsuNZdMCP7KRVee9VvARhg85uhtqRuejV3MGaKecIjy3RcEcAEZr1UnSgf9lQOdwRBsBDO X-Received: by 2002:a17:90a:30e4:: with SMTP id h91mr39936892pjb.37.1563339020716; Tue, 16 Jul 2019 21:50:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563339020; cv=none; d=google.com; s=arc-20160816; b=RGWl/cpSX3Jnkx6TUqIJZQqzsZnjqPOHGd0HRLYPPlVdTYLmNQzRh6m/Ng7qnMjrUa Zp31qM1c2RFCIY8dmQOnjFtIKSufp6xB9zy1sd+14SD+dgOHomabzXYs0aiWLDLonCWM mKNAwrTLYEmDW9xkECnIFJ3xSgkvN2CztpjrqQS8cv9pQ/5Mp1XBTX3ovtFP5JdOqtDW LQolJK7S6a7ymsIU4JX+EtnqtFgSe8mCLZbYSs7JLh456la08xu6OKOaTxqJwt2INC// 7mGrLQicmPOkA1Es73KUNtPkjm/yJLT3elSlDCv5PfMP3KLU6N6m7BlJCH2HJB9ZBgzG m9Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=O04V+mnqaZZSFIQWw8Fuzbne8J4qoFLTWcKpTxEH+P4=; b=DlkRTpcobbDZm582RUKBJf05RnlzYHqLUrg3eErf2y0P2MRZCIkFXgXLdfaiHX5pwF 943TRIo+xuOChbgDsXgkOjvDvaIiuXIjPlbWzMuhYPUJLcuwJq1c1n10zRRduF3WKI9S Daa8xVSVB/OftEyxDtD+Mx1Hk3w7SfAT2/SVFh1jURr3AQk/d7oKL6KP+bg3vxzB6GGC oEFz9AdZBnBHIBYltPN/atr+4cFeEyBXK5DIwnsEmVlr7qSiXqUcUmoKmkmMgHPXTHDu JXmfJse1voxFhMTIOfeE5rL3wGeG6uZKyDnfR+NWkb4YNVZRTobShF3LGVy7g7ldUuGW hoOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PmXILe8O; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e24si1640101pff.125.2019.07.16.21.50.04; Tue, 16 Jul 2019 21:50:20 -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=@linaro.org header.s=google header.b=PmXILe8O; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726346AbfGQEt2 (ORCPT + 99 others); Wed, 17 Jul 2019 00:49:28 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:42964 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725873AbfGQEt1 (ORCPT ); Wed, 17 Jul 2019 00:49:27 -0400 Received: by mail-pl1-f196.google.com with SMTP id ay6so11273364plb.9 for ; Tue, 16 Jul 2019 21:49:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=O04V+mnqaZZSFIQWw8Fuzbne8J4qoFLTWcKpTxEH+P4=; b=PmXILe8OGM0O744zqLu+hX0av+bvqIsNEcGWGbVedAXnUNeXg92pbZFI5Isnxl8Riu o5Fi07TzEwaherJbHgIj3g/NFiB7kulMNPTla4EGXbVPg0ZJrPxxWvkY9dzFHSan5GGy Lqzl8Nd8pp94VtmeP+5NIOuCewluem5U/c7nqIhJm1wnelU657sNeuEmLYUye8/5L3Pg JdPVfPROpeU7N370X+4gnYAwy1AhsPpebl63BbcdD/K1esDBp+wpv+l1Qd+d34/drH4p 1LbXMZvSUFsnPgZW8umAm8IajXp48gmXPZzwQIvfi7gFBJfapwk0ubfwwr7gIn1a9hUA XIIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=O04V+mnqaZZSFIQWw8Fuzbne8J4qoFLTWcKpTxEH+P4=; b=oHUyHEh+3M6xlMVlz9Jc1N9VhAlloD/eemGyaRXneb+4A/xACuFUZb9Adznmh6Wwbp jvJ+H0xe4/lxuSUCcQ6SHYnYMwzZEDKDb4YxNI4kTk60kNsRBlzVu4KcSUFqPmRpwsak nMGrVkNrLAd48sSFYPQwh2qecuZwaK1MfDxfBCFpscIhuUbGYymlWOa1W4Oo2NmSQdBK jkF9scupFQAiFgV7MdKpwbnteBQsHueMyuLg118S32RKZwy2T8R54n8rAjV3IiDNFMpz FSuLXs5Hp/1HC8yYyT7sl9P/LjuhBmen7nic/3jALmS9Fj2n2j++54MhJAQ+qUhAj8vg kLQA== X-Gm-Message-State: APjAAAUgq0XjiSlLWbrWoeTLROQjyMNoOXaqIbcFTqLmY5//yoHOwXQU SLu1ZjajYhG+tpykP/PP9rgQDg== X-Received: by 2002:a17:902:42d:: with SMTP id 42mr38815911ple.228.1563338967066; Tue, 16 Jul 2019 21:49:27 -0700 (PDT) Received: from localhost ([122.172.28.117]) by smtp.gmail.com with ESMTPSA id g9sm17146851pgs.78.2019.07.16.21.49.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jul 2019 21:49:25 -0700 (PDT) Date: Wed, 17 Jul 2019 10:19:23 +0530 From: Viresh Kumar To: Niklas Cassel Cc: Andy Gross , linux-arm-msm@vger.kernel.org, jorge.ramirez-ortiz@linaro.org, sboyd@kernel.org, vireshk@kernel.org, bjorn.andersson@linaro.org, ulf.hansson@linaro.org, Rob Herring , Mark Rutland , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 11/13] arm64: dts: qcom: qcs404: Add CPR and populate OPP table Message-ID: <20190717044923.ccmebeewbinlslkm@vireshk-i7> References: <20190705095726.21433-1-niklas.cassel@linaro.org> <20190705095726.21433-12-niklas.cassel@linaro.org> <20190710090303.tb5ue3wq6r7ofyev@vireshk-i7> <20190715132405.GA5040@centauri> <20190716103436.az5rdk6f3yoa3apz@vireshk-i7> <20190716105318.GA26592@centauri> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190716105318.GA26592@centauri> User-Agent: NeoMutt/20180716-391-311a52 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16-07-19, 12:53, Niklas Cassel wrote: > Here I cheated and simply used get_cpu_device(0). > > Since I cheated, I used get_cpu_device(0) always, > so even when CPU1,CPU2,CPU3 is attached, dev_pm_opp_get_opp_count(cpu0) is > still 0. > > I added a print in > [ 3.836533] cpr_set_performance: number of OPPs for dev: cpu0: 3 > > And there I can see that OPP count is 3, so it appears that with the > current code, we need to wait until cpufreq-dt.c:cpufreq_init() > has been called, maybe dev_pm_opp_of_cpumask_add_table() needs > to be called before dev_pm_opp_get_opp_count(cpu0) actually returns 3. > > cpufreq_init() is called by platform_device_register_simple("cpufreq-dt", -1, > NULL, 0); > which is called after dev_pm_opp_attach_genpd(). > > What I don't understand is that dev_pm_opp_attach_genpd() actually returns > a OPP table. So why do we need to wait for dev_pm_opp_of_cpumask_add_table(), > before either dev_pm_opp_get_opp_count(cpu0) or > dev_pm_opp_get_opp_count(genpd_virtdev_for_cpu0) returns 3? Ah, I see the problems now. No, cpufreq table can't be available at this point of time and we aren't going to change that. It is the right thing to do. Now, even if the kernel isn't written in a way which works for you, it isn't right to put more things in DT than required. DT is (should be) very much independent of the Linux kernel. So we have to parse DT to find highest frequency for each required-opp. Best is to put that code in the OPP core and use it from your driver. -- viresh