Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2223099pxb; Sat, 28 Aug 2021 08:07:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4bGPCh6m1Q0ojbBHS/2dhRzdYGtattT5rQ5dMRhkXjdNIdT2apkQauERiiQ1CXWz1Bg/u X-Received: by 2002:a05:6402:2708:: with SMTP id y8mr15584539edd.84.1630163234516; Sat, 28 Aug 2021 08:07:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630163234; cv=none; d=google.com; s=arc-20160816; b=gmkVoFkIonCrkhCHRQiMcSSGvS9NqA7fLapH5UekDbSjaevWsVw3ws9IGIeJsygFvA ZtokHXLE0EUUHqw/oUEMxsI/6gIMBcgCI54XaB9yZ4dXkt45t5R31BYkH1YkcOriE6dW OLhwJsb3O+zvVgUVg86juHW216pbgBA6ZIuRmlj9VdPYGOatVdadNEs1bu0qN/w6w+8h xf6+XEGcKwZf6x6Rc0MH7oAxZTdshcVyNwZrtVMOmio/kaiq5kK6O0HMVBK5t/O86x1a 0WXNG6aQ1irieBKyl2IeYFK7kcbo6j+TEDSQoXSRd+qIjqCvfbXBrduTGu1JW6+sdzKe QGbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=JkCVrdR1D+CKO66XP67mPooQ9rxHn6L0XQsjY0wsFY8=; b=tbb+AfQfmOJHxGKeIVtzgcVF5soV3BwxE9gGSqnHwYC57cPdnglIVmgBjrjnKohvB1 Q/27ykJp/PbPxtI3/1xCnMIK813CtlRurlLAj/BqidJRHlF/tUULZgsEOfvdpDXGghrH ahhsIcfvLQtsdhlwULPiJxm8KrqcSH35sp24oPQhdDf9LC6evQ2ydZSwxmBLS/KNjmoT 5EVzFIEXhsKENf0MIbDZVCOIEBdxTbdpKYdW7JPQdp1kF6ezKxeAjQLaod7Mxl0rT4eF nDuoOTz6sOCBCjtRNGguTmUlgeJloqJhs2QCE4S8vWwtDYub8Vmxatx+FPpqQR5i2om4 w0Eg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a2si9206218edx.80.2021.08.28.08.06.43; Sat, 28 Aug 2021 08:07:14 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234479AbhH1PCU (ORCPT + 99 others); Sat, 28 Aug 2021 11:02:20 -0400 Received: from mailgw01.mediatek.com ([60.244.123.138]:58326 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S229911AbhH1PCO (ORCPT ); Sat, 28 Aug 2021 11:02:14 -0400 X-UUID: c09bd4759c3e4f208db091893519ae32-20210828 X-UUID: c09bd4759c3e4f208db091893519ae32-20210828 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 773976302; Sat, 28 Aug 2021 23:01:18 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs06n1.mediatek.inc (172.21.101.129) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 28 Aug 2021 23:01:17 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sat, 28 Aug 2021 23:01:17 +0800 From: Hector Yuan To: , , , "Rafael J. Wysocki" , Viresh Kumar , Rob Herring , CC: , , Subject: [PATCH v14 2/3] cpufreq: Add of_perf_domain_get_sharing_cpumask Date: Sat, 28 Aug 2021 23:01:11 +0800 Message-ID: <1630162872-25452-3-git-send-email-hector.yuan@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1630162872-25452-1-git-send-email-hector.yuan@mediatek.com> References: <1630162872-25452-1-git-send-email-hector.yuan@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 9fd7194..4916d70 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -13,6 +13,8 @@ #include #include #include +#include +#include #include #include #include @@ -1036,6 +1038,43 @@ void arch_set_freq_scale(const struct cpumask *cpus, } #endif +#ifdef CONFIG_CPU_FREQ +static inline int of_perf_domain_get_sharing_cpumask(int index, const char *list_name, + const char *cell_name, + struct cpumask *cpumask) +{ + struct device_node *cpu_np; + struct of_phandle_args args; + int cpu, ret; + + for_each_possible_cpu(cpu) { + 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); + if (ret < 0) + continue; + + if (index == args.args[0]) + cpumask_set_cpu(cpu, cpumask); + } + + return 0; +} +#else +static inline int of_perf_domain_get_sharing_cpumask(int index, const char *list_name, + const char *cell_name, + struct cpumask *cpumask) +{ + return 0; +} +#endif + /* the following are really really optional */ extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs; extern struct freq_attr cpufreq_freq_attr_scaling_boost_freqs; -- 1.7.9.5