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

Commit d0ecb4b7 authored by Sushmita Susheelendra's avatar Sushmita Susheelendra
Browse files

msm: kgsl: Change throttling counter weight from 15% to 5%



Change weights for throttling counters from (15%, 50%, 90%)
to (5%, 50%, 90%) for GMU FW step version > 0x104.

Change-Id: Ia98303dc894ac07e285e8145923d6ad1c152b3cf
Signed-off-by: default avatarSushmita Susheelendra <ssusheel@codeaurora.org>
parent ebfbb23f
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@
#include "kgsl.h"
#include "kgsl_hfi.h"
#include "kgsl_trace.h"
#include "kgsl_gmu.h"

#define MIN_HBB		13

@@ -1445,6 +1446,8 @@ static int64_t a6xx_read_throttling_counters(struct adreno_device *adreno_dev)
	int64_t adj = -1;
	uint32_t counts[ADRENO_GPMU_THROTTLE_COUNTERS];
	struct adreno_busy_data *busy = &adreno_dev->busy_data;
	struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
	struct gmu_device *gmu = KGSL_GMU_DEVICE(device);

	for (i = 0; i < ARRAY_SIZE(counts); i++) {
		if (!adreno_dev->gpmu_throttle_counters[i])
@@ -1458,12 +1461,18 @@ static int64_t a6xx_read_throttling_counters(struct adreno_device *adreno_dev)
	/*
	 * The adjustment is the number of cycles lost to throttling, which
	 * is calculated as a weighted average of the cycles throttled
	 * at 15%, 50%, and 90%. The adjustment is negative because in A6XX,
	 * at 5% or 15% based on GMU FW version, 50%, and 90%.
	 * The adjustment is negative because in A6XX,
	 * the busy count includes the throttled cycles. Therefore, we want
	 * to remove them to prevent appearing to be busier than
	 * we actually are.
	 */
	adj *= ((counts[0] * 15) + (counts[1] * 50) + (counts[2] * 90)) / 100;
	if (GMU_VER_STEP(gmu->ver) > 0x104)
		adj *= ((counts[0] * 5) + (counts[1] * 50) + (counts[2] * 90))
			/ 100;
	else
		adj *= ((counts[0] * 15) + (counts[1] * 50) + (counts[2] * 90))
			/ 100;

	trace_kgsl_clock_throttling(0, counts[1], counts[2],
			counts[0], adj);
+5 −1
Original line number Diff line number Diff line
@@ -1316,7 +1316,7 @@ static uint32_t lm_limit(struct adreno_device *adreno_dev)
}

static int a640_throttling_counters[ADRENO_GPMU_THROTTLE_COUNTERS] = {
	0x11, 0x15, 0x19
	0x11, 0x15, 0x19,
};

static void _setup_throttling_counters(struct adreno_device *adreno_dev)
@@ -1325,6 +1325,10 @@ static void _setup_throttling_counters(struct adreno_device *adreno_dev)
	struct gmu_device *gmu = KGSL_GMU_DEVICE(device);
	int i, ret;

	/* Select counter for 5% throttling instead of 15% */
	if (GMU_VER_STEP(gmu->ver) > 0x104)
		a640_throttling_counters[0] = 0x10;

	for (i = 0; i < ARRAY_SIZE(a640_throttling_counters); i++) {
		adreno_dev->busy_data.throttle_cycles[i] = 0;

+7 −1
Original line number Diff line number Diff line
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2018-2019, 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
@@ -21,6 +21,12 @@
	(((_devops) != NULL) && \
	 ((_devops)->_field != NULL))

#define GMU_VER_MAJOR(ver) (((ver) >> 28) & 0xF)
#define GMU_VER_MINOR(ver) (((ver) >> 16) & 0xFFF)
#define GMU_VER_STEP(ver) (((ver) >> 0) & 0xFFFF)
#define GMU_VERSION(major, minor) \
	((((major) & 0xF) << 28) | (((minor) & 0xFFF) << 16))

#define NUM_BW_LEVELS		100
#define MAX_GX_LEVELS		16
#define MAX_CX_LEVELS		4
+1 −6
Original line number Diff line number Diff line
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2018-2019, 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
@@ -628,11 +628,6 @@ void hfi_receiver(unsigned long data)
	hfi_process_queue((struct gmu_device *) data, HFI_DBG_ID, NULL);
}

#define GMU_VER_MAJOR(ver) (((ver) >> 28) & 0xF)
#define GMU_VER_MINOR(ver) (((ver) >> 16) & 0xFFF)
#define GMU_VERSION(major, minor) \
	((((major) & 0xF) << 28) | (((minor) & 0xFFF) << 16))

static int hfi_verify_fw_version(struct kgsl_device *device,
		struct gmu_device *gmu)
{