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

Commit ebfbcd59 authored by Jonathan Avila's avatar Jonathan Avila
Browse files

perf: Remove BEAC registers from LLCC PMU



These are no longer required for the proper functioning of the PMU, so they
can be removed. Update the scaling factor, which we previously set, to the
default value to reflect this.

Change-Id: Iaf6800277f51478bc6fa2699cbd218bbb7a8f974
Signed-off-by: default avatarJonathan Avila <avilaj@codeaurora.org>
parent b2bdf7dc
Loading
Loading
Loading
Loading
+6 −9
Original line number Diff line number Diff line
@@ -9,17 +9,14 @@ The follow section describes the LLCC PMU DT node binding.

Required properties:
- compatible		: Shall be "qcom,qcom-llcc-pmu"
- reg			: There shall be two resources, each a pair of the form
			  < base_address total_size >.  One will represent the
			  DDR LAGG region, the other will represent the LLCC
			  BEAC region.
- reg-names		: There shall be two values, one 'lagg-base', one
			  'beac-base', corresponding to the order of the two
			  'reg' values.
- reg			: There shall be one resource, a pair of the form
			  < base_address total_size > representing the DDR_LAGG
			  region.
- reg-names		: Shall be "lagg-base".

Example:
	llcc_pmu: llcc-pmu {
		compatible = "qcom,qcom-llcc-pmu";
		reg = < 0x090CC000 0x300 >, < 0x09648000 0x110 >;
		reg-names = "lagg-base", "beac-base";
		reg = < 0x090CC000 0x300 >;
		reg-names = "lagg-base";
	};
+4 −21
Original line number Diff line number Diff line
/*
 * Copyright (c) 2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -26,21 +26,18 @@ struct llcc_pmu {
	struct pmu pmu;
	struct hlist_node node;
	void __iomem *lagg_base;
	void __iomem *beac_base;
	struct perf_event event;
};

#define MON_CFG(m) ((m)->lagg_base + 0x200)
#define MON_CNT(m, cpu) ((m)->lagg_base + 0x220 + 0x4 * cpu)
#define BEAC_ENABLE(m) ((m)->beac_base + 0x100)
#define BEAC_SCALE(m) ((m)->beac_base + 0x110)
#define to_llcc_pmu(ptr) (container_of(ptr, struct llcc_pmu, pmu))

#define LLCC_RD_EV 0x1000
#define ENABLE 0x01
#define CLEAR 0x10
#define DISABLE 0x00
#define SCALING_FACTOR 0x4
#define SCALING_FACTOR 0x3
#define NUM_COUNTERS NR_CPUS
#define VALUE_MASK 0xFFFFFF

@@ -107,10 +104,8 @@ static int qcom_llcc_event_add(struct perf_event *event, int flags)
	struct llcc_pmu *llccpmu = to_llcc_pmu(event->pmu);

	raw_spin_lock(&users_lock);
	if (!users) {
	if (!users)
		writel_relaxed(ENABLE, MON_CFG(llccpmu));
		writel_relaxed(ENABLE, BEAC_ENABLE(llccpmu));
	}
	users++;
	raw_spin_unlock(&users_lock);

@@ -128,10 +123,8 @@ static void qcom_llcc_event_del(struct perf_event *event, int flags)

	raw_spin_lock(&users_lock);
	users--;
	if (!users) {
	if (!users)
		writel_relaxed(DISABLE, MON_CFG(llccpmu));
		writel_relaxed(DISABLE, BEAC_ENABLE(llccpmu));
	}
	raw_spin_unlock(&users_lock);
}

@@ -164,16 +157,6 @@ static int qcom_llcc_pmu_probe(struct platform_device *pdev)
		return PTR_ERR(llccpmu->lagg_base);
	}

	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "beac-base");
	llccpmu->beac_base = devm_ioremap_resource(&pdev->dev, res);
	if (IS_ERR(llccpmu->beac_base)) {
		dev_err(&pdev->dev, "Can't map PMU beac base @%pa\n",
			&res->start);
		return PTR_ERR(llccpmu->beac_base);
	}

	writel_relaxed(SCALING_FACTOR, BEAC_SCALE(llccpmu));

	raw_spin_lock_init(&counter_lock);
	raw_spin_lock_init(&users_lock);