Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1266392imm; Tue, 22 May 2018 01:00:11 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoNehiRPwHVisfTLqt9OxpwQ6gG/laO2rDmKm+hJMWsTzHPsZbRVznMh0RAvNCWV23dhYlj X-Received: by 2002:a17:902:5a46:: with SMTP id f6-v6mr23588307plm.85.1526976011325; Tue, 22 May 2018 01:00:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526976011; cv=none; d=google.com; s=arc-20160816; b=Ux8WH4muytcPuKdL3+r9JbzxTjv3GuSXVIuOiFgHrJhQgQPtwOfoIaoUMDQ+V3QoR6 k2XV65bsn2YVVmqS4yLTS1zjlfwyNvCDlbhyn0mPQRTbnDBl3t33S+hk0Ecs7IvITiOn /NvnKfWxOICbSJuj/09MGvsl3tpPRM/Zd6rPiEP49ynpfQbWFN2ktus26EtR5KVzjGZ6 rPFSP+PZ46MIK5j7uZWLckkQkPg8pnS4wid10nbiauQWR61spESDGBJFbsn0pM0MKb9y rg/xaQ4qlULEJ7IBydnG3eEfaiBjq6qK0W71K4sfawHsNqhnUsYVmfi8u4hwqQxtYuCm HZDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language:thread-index :content-transfer-encoding:mime-version:message-id:date:subject :in-reply-to:references:cc:to:from:dmarc-filter:dkim-signature :dkim-signature:arc-authentication-results; bh=lw/YD1WO/lUe23FDefLxF3Ttwzqrx1+mhpssvAsG8FY=; b=ws4qE6Dwfyq4fN5rsHGFe//BwE3guPvGdnf2TZDaIE6d8du6N+Aei0FpZNRUhQxDh/ G0JKn5uB2b1D9DPze/rZwqfOZSfN33GMfuSAjROPkdmQk1C2b/evLqub7SUeMdd9TcZy sz5xvFgxjuU4RiXNwXPLARmzzXSSjPrXpaRJyOkLMbzJDoQjqb30Td07uT27NgMFFUrW WM8EeY6HpbG0CNxtLbQFRzPNEitxjO0UrxI2sMImX+ZoX6YUyi3aaopT7IvyiXHCbV1Y h7I2BM60Omij1rKkroWt4ztzslhS/GLEJBsOa+MNoSvbh/oaGKasujMFjus93vbADsA8 PcZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=PpZuG0kX; dkim=pass header.i=@codeaurora.org header.s=default header.b=I3b6VwCk; 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 l1-v6si2396014pgs.623.2018.05.22.00.59.56; Tue, 22 May 2018 01:00:11 -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=@codeaurora.org header.s=default header.b=PpZuG0kX; dkim=pass header.i=@codeaurora.org header.s=default header.b=I3b6VwCk; 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 S1752240AbeEVH7e (ORCPT + 99 others); Tue, 22 May 2018 03:59:34 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:55178 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751380AbeEVH7X (ORCPT ); Tue, 22 May 2018 03:59:23 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 6CF5760262; Tue, 22 May 2018 07:59:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1526975962; bh=yWhWZs7U6p0SqamxyMvM/pQxzd7Na9Hzh9Wj/+tVqOM=; h=From:To:Cc:References:In-Reply-To:Subject:Date:From; b=PpZuG0kXciZMTpaIMyGhz1Y9WaX0uUZ+9loaxW6hy0L0p3oj4V/DjxGAFLFQgQuMp TPXVeNOKeXAu7UCm8gdyKZd/63TNcgQVy+n+9J8bGUkSTTG4Za623gQr6oDpOmORnf oJJ1DnQHyp00XWzShJpE8SJhGH0BrgmnzdrsSw/4= 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 ilial (unknown [185.23.60.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: ilialin@codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id E6A44604D4; Tue, 22 May 2018 07:59:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1526975955; bh=yWhWZs7U6p0SqamxyMvM/pQxzd7Na9Hzh9Wj/+tVqOM=; h=From:To:Cc:References:In-Reply-To:Subject:Date:From; b=I3b6VwCkDEsVa36FGXdrgajEqnhThU8egjhERexAIk3ZNxHGfjSTLDFtziAdzjL3L w+561jcne0U60kSNGzBlIuIXO2LqLCt03MSvM7HPgqKKSPgsSjqofYQBBGy/ojYSda 7276FhRFw82HKn7Y/kpUzYFvHM8ojGAyZYr4ghpA= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E6A44604D4 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=ilialin@codeaurora.org From: To: "'Sudeep Holla'" , , , , , , , , , , , , , , Cc: , , , , , , , , , , References: <1526555955-29960-11-git-send-email-ilialin@codeaurora.org> <1526729701-8589-1-git-send-email-ilialin@codeaurora.org> <153cc316-dcb5-972f-5a2f-c91fe0f6348b@arm.com> <000f01d3f103$3ff78ba0$bfe6a2e0$@codeaurora.org> <2ace10bc-e1c4-2060-94d3-eb71e966ffbe@arm.com> In-Reply-To: Subject: RE: [PATCH] cpufreq: Add Kryo CPU scaling driver Date: Tue, 22 May 2018 10:59:07 +0300 Message-ID: <001401d3f1a2$c7328850$559798f0$@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQF4oTaoNxz6XIk2qh8MCLQUCquwggJzguYXAj6kKpQCSNS3vQG6YwsHAY+VlECkn9smEA== Content-Language: en-us Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org OK, I think I found out the way. Would this be correct? -------------------------------------------------------------------------= ---------------------- extern struct cpu_topology cpu_topology[NR_CPUS]; static struct device *qcom_cpufreq_kryo_get_cluster_lead(int cluster) { unsigned cpu; for_each_possible_cpu(cpu) { if ((cluster =3D=3D cpu_topology[cpu].cluster_id) && (0 =3D=3D cpu_topology[cpu].core_id)) return get_cpu_device(cpu); } return NULL; } -------------------------------------------------------------------------= ---------------------- > -----Original Message----- > From: ilialin@codeaurora.org > Sent: Tuesday, May 22, 2018 09:56 > To: 'Sudeep Holla' ; 'mturquette@baylibre.com' > ; 'sboyd@kernel.org' ; > 'robh@kernel.org' ; 'mark.rutland@arm.com' > ; 'viresh.kumar@linaro.org' > ; 'nm@ti.com' ; > 'lgirdwood@gmail.com' ; 'broonie@kernel.org' > ; 'andy.gross@linaro.org' ; > 'david.brown@linaro.org' ; > 'catalin.marinas@arm.com' ; > 'will.deacon@arm.com' ; 'rjw@rjwysocki.net' > ; 'linux-clk@vger.kernel.org' clk@vger.kernel.org> > Cc: 'devicetree@vger.kernel.org' ; 'linux- > kernel@vger.kernel.org' ; 'linux- > pm@vger.kernel.org' ; 'linux-arm- > msm@vger.kernel.org' ; 'linux- > soc@vger.kernel.org' ; 'linux-arm- > kernel@lists.infradead.org' ; > 'rnayak@codeaurora.org' ; > 'amit.kucheria@linaro.org' ; > 'nicolas.dechesne@linaro.org' ; > 'celster@codeaurora.org' ; > 'tfinkel@codeaurora.org' > Subject: RE: [PATCH] cpufreq: Add Kryo CPU scaling driver >=20 >=20 >=20 > > -----Original Message----- > > From: Sudeep Holla > > Sent: Monday, May 21, 2018 16:05 > > To: ilialin@codeaurora.org; mturquette@baylibre.com; = sboyd@kernel.org; > > robh@kernel.org; mark.rutland@arm.com; viresh.kumar@linaro.org; > > nm@ti.com; lgirdwood@gmail.com; broonie@kernel.org; > > andy.gross@linaro.org; david.brown@linaro.org; > > catalin.marinas@arm.com; will.deacon@arm.com; rjw@rjwysocki.net; > > linux-clk@vger.kernel.org > > Cc: Sudeep Holla ; devicetree@vger.kernel.org; > > linux-kernel@vger.kernel.org; linux-pm@vger.kernel.org; linux-arm- > > msm@vger.kernel.org; linux-soc@vger.kernel.org; linux-arm- > > kernel@lists.infradead.org; rnayak@codeaurora.org; > > amit.kucheria@linaro.org; nicolas.dechesne@linaro.org; > > celster@codeaurora.org; tfinkel@codeaurora.org > > Subject: Re: [PATCH] cpufreq: Add Kryo CPU scaling driver > > > > > > > > On 21/05/18 13:57, ilialin@codeaurora.org wrote: > > > > > [...] > > > > >>> +#include > > >>> +#include > > >>> +#include > > >>> +#include > > >>> +#include > > >>> +#include #include = #include > > >>> + #include #include > > >>> + #include > > >>> + > > >>> +#define MSM_ID_SMEM 137 > > >>> +#define SILVER_LEAD 0 > > >>> +#define GOLD_LEAD 2 > > >>> + > > >> > > >> So I gather form other emails, that these are physical cpu > > >> number(not even unique identifier like MPIDR). Will this work on > > >> parts or platforms that need to boot in GOLD LEAD cpus. > > > > > > The driver is for Kryo CPU, which (and AFAIK all multicore MSMs) > > > always boots on the CPU0. > > > > > > That may be true and I am not that bothered about it. But assuming > > physical ordering from the logical cpu number is *incorrect* and = will > > break if kernel decides to change the allocation algorithm. Kernel > > provides no guarantee on that, so you need to depend on some = physical > > ID or may be DT to achieve what your want. But the current code as = it > stands is wrong. >=20 > Got your point. In fact CPUs are numbered 0-3 and ordered into 2 = clusters in > the DT: >=20 > cpus { > #address-cells =3D <2>; > #size-cells =3D <0>; >=20 > CPU0: cpu@0 { > ... > reg =3D <0x0 0x0>; > ... > }; >=20 > CPU1: cpu@1 { > ... > reg =3D <0x0 0x1>; > ... > }; >=20 > CPU2: cpu@100 { > ... > reg =3D <0x0 0x100>; > ... > }; >=20 > CPU3: cpu@101 { > ... > reg =3D <0x0 0x101>; > ... > }; >=20 > cpu-map { > cluster0 { > core0 { > cpu =3D <&CPU0>; > }; >=20 > core1 { > cpu =3D <&CPU1>; > }; > }; >=20 > cluster1 { > core0 { > cpu =3D <&CPU2>; > }; >=20 > core1 { > cpu =3D <&CPU3>; > }; > }; > }; > }; >=20 > As far, as I understand, they are probed in the same order. However, = to be > certain that the physical CPU is the one I intend to configure, I have = to fetch > the device structure pointer for the cpu-map -> clusterX -> core0 -> = cpu path. > Could you suggest a kernel API to do that? >=20 >=20 >=20 > > > > -- > > Regards, > > Sudeep