From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-22.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 761F2C433EF for ; Mon, 6 Sep 2021 09:43:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5AE2860F3A for ; Mon, 6 Sep 2021 09:43:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241448AbhIFJo3 (ORCPT ); Mon, 6 Sep 2021 05:44:29 -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-Google-Smtp-Source: ABdhPJwNLy/dXfiYyQnEloJsYlqUGd8CyWCxWl/Kjp+bv4L5M2+jjwqp/8iOZhRvgKnezUoJoGhmkg== 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); }