Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f680eb3a authored by Rohit Gupta's avatar Rohit Gupta
Browse files

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: default avatarRohit Gupta <rohgup@codeaurora.org>
parent b06f2ad5
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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>;
	};
+2 −2
Original line number Diff line number Diff line
@@ -544,13 +544,13 @@

	qcom,arm-memlat-mon-0 {
		compatible = "qcom,arm-memlat-mon";
		qcom,firstcpu = <&CPU0>;
		qcom,cpulist =	<&CPU0 &CPU1>;
		qcom,target-dev = <&memlat_cpu0>;
	};

	qcom,arm-memlat-mon-2 {
		compatible = "qcom,arm-memlat-mon";
		qcom,firstcpu = <&CPU2>;
		qcom,cpulist =	<&CPU2 &CPU3>;
		qcom,target-dev = <&memlat_cpu2>;
	};

+17 −11
Original line number Diff line number Diff line
@@ -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;
	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) {
		if (arch_find_n_match_cpu_physical_id(dev_phandle, cpu, NULL)) {
			cpumask_copy(mask, cpu_coregroup_mask(cpu));
			return 0;
			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)