Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp2711890pxb; Mon, 6 Sep 2021 03:44:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/8aLdfp0u2BAdP1fLUhEuTdwhGviCz7RNOcwHDSjvN9JeSo9rV5XqASGYOMFMRUfqpmni X-Received: by 2002:aa7:d157:: with SMTP id r23mr12474680edo.322.1630925088111; Mon, 06 Sep 2021 03:44:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630925088; cv=none; d=google.com; s=arc-20160816; b=GwO3qR8z+olr7dqHVLrC+bs3q8DI9McXw8PbgHoVDGSFIrqUFvzDlOQ46m+H8NIl7u VkaLu6mH/QhTKt4hLfBGEeWNkzFTLs28X80FLReMJvOsSziXvAOzAsrZzaGNP/etcxHE SYmqL95fTwqCrW2D6JB1ZonCIKNXuXhamM9CwXpY96LEetH8A4P/ByTSpRkmowSRofNq sx2n9OMV9Q4JWgv9qk1++008d/oqkpEP/CDAd7iOVXGCfQi/5p4SSsXxM5CnQBR2hEWp dZALsLoSzkxYWn714pUTLzaxM7CvDP3hlkLm+TW1wIAO7DyiEZFGKS8WsBUek+glYIlM zojw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=9/JoqdqiEGw1zuw7XMiYKWfm9jX2kazYBZmS7xdP1/k=; b=H8cYfVTIvvQUeUiQybc7IvMOuv++Cerck35NqC7N43rdSCKIT45cJqdrLNIc+GAS1E gNWWGbnVOwWkh+Ip6bzlwGY3bWlQRRAzO8jIur8lbcdKCNn3GmEBeL+OBG8qIGZESnHK Iezz388mI1TH1US3iR4O9fTXHDVq68cK8iSFa7dO+5oxyHfSGJa+R3Uqvxt6Svct0VrK 9cfVt8HaO17PrbeLSfBxUQVp6p6ywbCKz/MAxZKDQvH1gFkVG64DItZRcFIo9ST/vBbQ ZmByaKADywUOnOzSpCJt3wZRBVNBaz01HyGp0hcQVrMElMAO7EfZQdxELEGs1nSkGPRM /WbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WYPYOXSV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id p4si7175569eju.502.2021.09.06.03.44.24; Mon, 06 Sep 2021 03:44:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WYPYOXSV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S241543AbhIFJo2 (ORCPT + 99 others); Mon, 6 Sep 2021 05:44:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241563AbhIFJoU (ORCPT ); Mon, 6 Sep 2021 05:44:20 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0707C06175F for ; Mon, 6 Sep 2021 02:43:14 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id pi15-20020a17090b1e4f00b00197449fc059so1354069pjb.0 for ; Mon, 06 Sep 2021 02:43:14 -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=9/JoqdqiEGw1zuw7XMiYKWfm9jX2kazYBZmS7xdP1/k=; b=WYPYOXSVHBptRJ0q9Gd1rc5ipBPKlx481Ahac7qF5CeFDcDQ2zjxcKbJwCRrjFpQA4 hURmftGEPPPZNGOKyhyCUZvuAxvoFu33cooDNL0sJtGNAE3U83er9Yo+w+FA+xCLTaHp zdDpeLZIpgkTEJxbeUl9iSRWd0rTUZP8FUqiSSAUUA6OzGshEmCXKPWrS5XlqffUrHk6 c5SwHWXP7iWD/nwZCyJM4vHpLhvsDwp7lVeG+xUOpQK3PyQxl9nbvpbddhkSXThLbJ9t IugRlfJRpSlP7nSdjEded1/CYqOnSt88zcdqT80QJRhYS1Qx0S22hjgqwZZ3zpqZwsXG QHwg== 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=9/JoqdqiEGw1zuw7XMiYKWfm9jX2kazYBZmS7xdP1/k=; b=T20pCgJsX/aonMgxT4XgJyB0IgMnMQSFNfXbiWpKiPWbugkX+krEPG4Cg6ZW9n9lph JCFdooWOdMs5GrnXQmBUrngp9vebjocisfZWWioJ9aOIrHk7H1hAD63Jz+VYs5frsm1e ZLD94ZIWgOlyILiqWv6pQpHDZ5DhQtIunUONQWtsm2zSVekmzWtzrxYtjKoquHWZozfb YJ1D21d0vKT7pZKRncji4p1aBLh4sZZXcR6+0usbdd8Bta6+gBG1+pTwBUijB4wkAX3H TkXT4I4351f4fZs653hIZa0TvwmKy+DT4Uzu3A3Cj2VO0L7HCOR5bJBHOVkjqyfsm61R 53yA== X-Gm-Message-State: AOAM533YVxpvECtAy1hthfG59M5q3Bj1fEk6yTG7EiZiyDZQi9zO3bUE PGzFCdU7x7piXksbYUSCFDh2uw== X-Received: by 2002:a17:902:e34b:b0:134:66bd:f241 with SMTP id p11-20020a170902e34b00b0013466bdf241mr9959608plc.27.1630921394459; Mon, 06 Sep 2021 02:43:14 -0700 (PDT) Received: from localhost ([122.172.201.85]) by smtp.gmail.com with ESMTPSA id nh21sm6955135pjb.34.2021.09.06.02.43.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Sep 2021 02:43:12 -0700 (PDT) Date: Mon, 6 Sep 2021 15:13:09 +0530 From: Viresh Kumar To: Hector Yuan Cc: linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, "Rafael J. Wysocki" , Rob Herring , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, wsd_upstream@mediatek.com Subject: Re: [PATCH v15 2/3] cpufreq: Add of_perf_domain_get_sharing_cpumask Message-ID: <20210906094309.rcacbme27zpvdd4a@vireshk-i7> References: <1630658364-6192-1-git-send-email-hector.yuan@mediatek.com> <1630658364-6192-3-git-send-email-hector.yuan@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1630658364-6192-3-git-send-email-hector.yuan@mediatek.com> User-Agent: NeoMutt/20180716-391-311a52 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03-09-21, 16:39, Hector Yuan wrote: > From: "Hector.Yuan" > > Add of_perf_domain_get_sharing_cpumask function to group cpu > to specific performance domain. > > Signed-off-by: Hector.Yuan > --- > include/linux/cpufreq.h | 46 +++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 45 insertions(+), 1 deletion(-) To speed things up, I have applied this with following changes. Please test my branch and see if something breaks: https://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm.git/log/?h=cpufreq/arm/linux-next -- viresh -------------------------8<------------------------- diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 9eb1fa17a8a4..acd3ee5b8b0a 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -1006,37 +1006,49 @@ static inline int cpufreq_table_count_valid_entries(const struct cpufreq_policy return count; } -static inline int of_perf_domain_get_sharing_cpumask(int pcpu, const char *list_name, - const char *cell_name, struct cpumask *cpumask) +static inline int parse_perf_domain(int cpu, const char *list_name, + const char *cell_name) { struct device_node *cpu_np; struct of_phandle_args args; + int ret; + + cpu_np = of_cpu_device_node_get(cpu); + if (!cpu_np) + return -ENODEV; + + ret = of_parse_phandle_with_args(cpu_np, list_name, cell_name, 0, + &args); + if (ret < 0) + return ret; + + of_node_put(cpu_np); + + return args.args[0]; +} + +static inline int of_perf_domain_get_sharing_cpumask(int pcpu, const char *list_name, + const char *cell_name, struct cpumask *cpumask) +{ int target_idx; int cpu, ret; - cpu_np = of_cpu_device_node_get(pcpu); - of_parse_phandle_with_args(cpu_np, list_name, - cell_name, 0, &args); - of_node_put(cpu_np); - target_idx = args.args[0]; + ret = parse_perf_domain(pcpu, list_name, cell_name); + if (ret < 0) + return ret; + + target_idx = ret; + cpumask_set_cpu(pcpu, cpumask); for_each_possible_cpu(cpu) { if (cpu == pcpu) continue; - cpu_np = of_cpu_device_node_get(cpu); - if (!cpu_np) - continue; - - ret = of_parse_phandle_with_args(cpu_np, list_name, - cell_name, 0, - &args); - - of_node_put(cpu_np); + ret = parse_perf_domain(pcpu, list_name, cell_name); if (ret < 0) continue; - if (target_idx == args.args[0]) + if (target_idx == ret) cpumask_set_cpu(cpu, cpumask); }