RE: [PATCH] cpufreq: Add Kryo CPU scaling driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 == cpu_topology[cpu].cluster_id) &&
			(0 == cpu_topology[cpu].core_id))
			return get_cpu_device(cpu);
	}

	return NULL;
}
-----------------------------------------------------------------------------------------------

> -----Original Message-----
> From: ilialin@xxxxxxxxxxxxxx <ilialin@xxxxxxxxxxxxxx>
> Sent: Tuesday, May 22, 2018 09:56
> To: 'Sudeep Holla' <sudeep.holla@xxxxxxx>; 'mturquette@xxxxxxxxxxxx'
> <mturquette@xxxxxxxxxxxx>; 'sboyd@xxxxxxxxxx' <sboyd@xxxxxxxxxx>;
> 'robh@xxxxxxxxxx' <robh@xxxxxxxxxx>; 'mark.rutland@xxxxxxx'
> <mark.rutland@xxxxxxx>; 'viresh.kumar@xxxxxxxxxx'
> <viresh.kumar@xxxxxxxxxx>; 'nm@xxxxxx' <nm@xxxxxx>;
> 'lgirdwood@xxxxxxxxx' <lgirdwood@xxxxxxxxx>; 'broonie@xxxxxxxxxx'
> <broonie@xxxxxxxxxx>; 'andy.gross@xxxxxxxxxx' <andy.gross@xxxxxxxxxx>;
> 'david.brown@xxxxxxxxxx' <david.brown@xxxxxxxxxx>;
> 'catalin.marinas@xxxxxxx' <catalin.marinas@xxxxxxx>;
> 'will.deacon@xxxxxxx' <will.deacon@xxxxxxx>; 'rjw@xxxxxxxxxxxxx'
> <rjw@xxxxxxxxxxxxx>; 'linux-clk@xxxxxxxxxxxxxxx' <linux-
> clk@xxxxxxxxxxxxxxx>
> Cc: 'devicetree@xxxxxxxxxxxxxxx' <devicetree@xxxxxxxxxxxxxxx>; 'linux-
> kernel@xxxxxxxxxxxxxxx' <linux-kernel@xxxxxxxxxxxxxxx>; 'linux-
> pm@xxxxxxxxxxxxxxx' <linux-pm@xxxxxxxxxxxxxxx>; 'linux-arm-
> msm@xxxxxxxxxxxxxxx' <linux-arm-msm@xxxxxxxxxxxxxxx>; 'linux-
> soc@xxxxxxxxxxxxxxx' <linux-soc@xxxxxxxxxxxxxxx>; 'linux-arm-
> kernel@xxxxxxxxxxxxxxxxxxx' <linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>;
> 'rnayak@xxxxxxxxxxxxxx' <rnayak@xxxxxxxxxxxxxx>;
> 'amit.kucheria@xxxxxxxxxx' <amit.kucheria@xxxxxxxxxx>;
> 'nicolas.dechesne@xxxxxxxxxx' <nicolas.dechesne@xxxxxxxxxx>;
> 'celster@xxxxxxxxxxxxxx' <celster@xxxxxxxxxxxxxx>;
> 'tfinkel@xxxxxxxxxxxxxx' <tfinkel@xxxxxxxxxxxxxx>
> Subject: RE: [PATCH] cpufreq: Add Kryo CPU scaling driver
> 
> 
> 
> > -----Original Message-----
> > From: Sudeep Holla <sudeep.holla@xxxxxxx>
> > Sent: Monday, May 21, 2018 16:05
> > To: ilialin@xxxxxxxxxxxxxx; mturquette@xxxxxxxxxxxx; sboyd@xxxxxxxxxx;
> > robh@xxxxxxxxxx; mark.rutland@xxxxxxx; viresh.kumar@xxxxxxxxxx;
> > nm@xxxxxx; lgirdwood@xxxxxxxxx; broonie@xxxxxxxxxx;
> > andy.gross@xxxxxxxxxx; david.brown@xxxxxxxxxx;
> > catalin.marinas@xxxxxxx; will.deacon@xxxxxxx; rjw@xxxxxxxxxxxxx;
> > linux-clk@xxxxxxxxxxxxxxx
> > Cc: Sudeep Holla <sudeep.holla@xxxxxxx>; devicetree@xxxxxxxxxxxxxxx;
> > linux-kernel@xxxxxxxxxxxxxxx; linux-pm@xxxxxxxxxxxxxxx; linux-arm-
> > msm@xxxxxxxxxxxxxxx; linux-soc@xxxxxxxxxxxxxxx; linux-arm-
> > kernel@xxxxxxxxxxxxxxxxxxx; rnayak@xxxxxxxxxxxxxx;
> > amit.kucheria@xxxxxxxxxx; nicolas.dechesne@xxxxxxxxxx;
> > celster@xxxxxxxxxxxxxx; tfinkel@xxxxxxxxxxxxxx
> > Subject: Re: [PATCH] cpufreq: Add Kryo CPU scaling driver
> >
> >
> >
> > On 21/05/18 13:57, ilialin@xxxxxxxxxxxxxx wrote:
> > >
> > [...]
> >
> > >>> +#include <linux/cpu.h>
> > >>> +#include <linux/err.h>
> > >>> +#include <linux/init.h>
> > >>> +#include <linux/kernel.h>
> > >>> +#include <linux/module.h>
> > >>> +#include <linux/nvmem-consumer.h> #include <linux/of.h> #include
> > >>> +<linux/platform_device.h> #include <linux/pm_opp.h> #include
> > >>> +<linux/slab.h> #include <linux/soc/qcom/smem.h>
> > >>> +
> > >>> +#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.
> 
> Got your point. In fact CPUs are numbered 0-3 and ordered into 2 clusters in
> the DT:
> 
> cpus {
> 	#address-cells = <2>;
> 	#size-cells = <0>;
> 
> 	CPU0: cpu@0 {
> 		...
> 		reg = <0x0 0x0>;
> 		...
> 	};
> 
> 	CPU1: cpu@1 {
> 		...
> 		reg = <0x0 0x1>;
> 		...
> 	};
> 
> 	CPU2: cpu@100 {
> 		...
> 		reg = <0x0 0x100>;
> 		...
> 	};
> 
> 	CPU3: cpu@101 {
> 		...
> 		reg = <0x0 0x101>;
> 		...
> 	};
> 
> 	cpu-map {
> 		cluster0 {
> 			core0 {
> 				cpu = <&CPU0>;
> 			};
> 
> 			core1 {
> 				cpu = <&CPU1>;
> 			};
> 		};
> 
> 		cluster1 {
> 			core0 {
> 				cpu = <&CPU2>;
> 			};
> 
> 			core1 {
> 				cpu = <&CPU3>;
> 			};
> 		};
> 	};
> };
> 
> 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?
> 
> 
> 
> >
> > --
> > Regards,
> > Sudeep

--
To unsubscribe from this list: send the line "unsubscribe linux-soc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux