diff options
| author | Rohit Gupta <rohgup@codeaurora.org> | 2015-10-27 17:46:49 -0700 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-23 20:04:40 -0700 |
| commit | e0bb9942b488e20ce315ab5d536aa1085f75be99 (patch) | |
| tree | eb2539f5cb3c92c2149433bb6165c32e65e5e23d | |
| parent | 43f61ed8aa3ebb85c40b329b83f33b79f08712c6 (diff) | |
PM / devfreq: memlat: Get complete CPU list during the probe
Currently arm-memlat-mon driver uses cpu_coregroup_mask to get
the sibling CPUs for the first CPU specified during the probe.
However if any of the CPUs in a cluster isn't hotplugged in
even once before the probe runs then the call to cpu_coregroup_mask
might not give the updated list of all the sibling CPUs for the
specified CPU.
With this change the initialization of the cpumask for the memlat
device is obtained from the list of CPU phandles specified in the
dtsi file.
Change-Id: Ide97d60d9eecbbe1d33deda72a13951059822896
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
[junjiew@codeaurora.org: dropped changes in dtsi files.]
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
| -rw-r--r-- | Documentation/devicetree/bindings/devfreq/arm-memlat-mon.txt | 4 | ||||
| -rw-r--r-- | drivers/devfreq/arm-memlat-mon.c | 28 |
2 files changed, 19 insertions, 13 deletions
diff --git a/Documentation/devicetree/bindings/devfreq/arm-memlat-mon.txt b/Documentation/devicetree/bindings/devfreq/arm-memlat-mon.txt index 483c672363a6..ecfab3617a75 100644 --- a/Documentation/devicetree/bindings/devfreq/arm-memlat-mon.txt +++ b/Documentation/devicetree/bindings/devfreq/arm-memlat-mon.txt @@ -5,12 +5,12 @@ to measure the parameters for latency driven memory access patterns. Required properties: - compatible: Must be "qcom,arm-memlat-mon" -- qcom,firstcpu: First CPU of the cluster to be monitored +- qcom,cpulist: List of CPU phandles to be monitored in a cluster - qcom,target-dev: The DT device that corresponds to this master port Example: qcom,arm-memlat-mon { compatible = "qcom,arm-memlat-mon"; - qcom,firstcpu = <&CPU0>; + qcom,cpulist = <&CPU0 &CPU1>; qcom,target-dev = <&memlat0>; }; diff --git a/drivers/devfreq/arm-memlat-mon.c b/drivers/devfreq/arm-memlat-mon.c index a13cb1995329..4bafdd7e76de 100644 --- a/drivers/devfreq/arm-memlat-mon.c +++ b/drivers/devfreq/arm-memlat-mon.c @@ -222,21 +222,27 @@ err: static int get_mask_from_dev_handle(struct platform_device *pdev, cpumask_t *mask) { + struct device *dev = &pdev->dev; struct device_node *dev_phandle; - int cpu = 0; - - dev_phandle = of_parse_phandle(pdev->dev.of_node, "qcom,firstcpu", 0); - if (!dev_phandle) - return -ENOENT; - - for_each_possible_cpu(cpu) { - if (arch_find_n_match_cpu_physical_id(dev_phandle, cpu, NULL)) { - cpumask_copy(mask, cpu_coregroup_mask(cpu)); - return 0; + struct device *cpu_dev; + int cpu, i = 0; + int ret = -ENOENT; + + dev_phandle = of_parse_phandle(dev->of_node, "qcom,cpulist", i++); + while (dev_phandle) { + for_each_possible_cpu(cpu) { + cpu_dev = get_cpu_device(cpu); + if (cpu_dev && cpu_dev->of_node == dev_phandle) { + cpumask_set_cpu(cpu, mask); + ret = 0; + break; + } } + dev_phandle = of_parse_phandle(dev->of_node, + "qcom,cpulist", i++); } - return -ENOENT; + return ret; } static int arm_memlat_mon_driver_probe(struct platform_device *pdev) |
