summaryrefslogtreecommitdiff
path: root/dvalin/kernel/drivers/gpu/arm/midgard/ipa/mali_kbase_ipa.h
diff options
context:
space:
mode:
Diffstat (limited to 'dvalin/kernel/drivers/gpu/arm/midgard/ipa/mali_kbase_ipa.h')
-rw-r--r--dvalin/kernel/drivers/gpu/arm/midgard/ipa/mali_kbase_ipa.h90
1 files changed, 69 insertions, 21 deletions
diff --git a/dvalin/kernel/drivers/gpu/arm/midgard/ipa/mali_kbase_ipa.h b/dvalin/kernel/drivers/gpu/arm/midgard/ipa/mali_kbase_ipa.h
index 92aace9..c668af9 100644
--- a/dvalin/kernel/drivers/gpu/arm/midgard/ipa/mali_kbase_ipa.h
+++ b/dvalin/kernel/drivers/gpu/arm/midgard/ipa/mali_kbase_ipa.h
@@ -1,11 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
*
- * (C) COPYRIGHT 2016-2019 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2016-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
* Foundation, and any use by you of this program is subject to the terms
- * of such GNU licence.
+ * of such GNU license.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -16,8 +17,6 @@
* along with this program; if not, you can access it online at
* http://www.gnu.org/licenses/gpl-2.0.html.
*
- * SPDX-License-Identifier: GPL-2.0
- *
*/
#ifndef _KBASE_IPA_H_
@@ -28,6 +27,20 @@
struct devfreq;
/**
+ * enum kbase_ipa_block_type - Type of block for which power estimation is done.
+ *
+ * @KBASE_IPA_BLOCK_TYPE_TOP_LEVEL: Top-level block, that covers CSHW,
+ * MEMSYS, Tiler.
+ * @KBASE_IPA_BLOCK_TYPE_SHADER_CORES: All Shader cores.
+ * @KBASE_IPA_BLOCK_TYPE_NUM: Number of blocks.
+ */
+enum kbase_ipa_block_type {
+ KBASE_IPA_BLOCK_TYPE_TOP_LEVEL,
+ KBASE_IPA_BLOCK_TYPE_SHADER_CORES,
+ KBASE_IPA_BLOCK_TYPE_NUM
+};
+
+/**
* struct kbase_ipa_model - Object describing a particular IPA model.
* @kbdev: pointer to kbase device
* @model_data: opaque pointer to model specific data, accessed
@@ -89,7 +102,8 @@ struct kbase_ipa_model_ops {
int (*init)(struct kbase_ipa_model *model);
/* Called immediately after init(), or when a parameter is changed, so
* that any coefficients derived from model parameters can be
- * recalculated. */
+ * recalculated
+ */
int (*recalculate)(struct kbase_ipa_model *model);
void (*term)(struct kbase_ipa_model *model);
/*
@@ -101,7 +115,9 @@ struct kbase_ipa_model_ops {
* is then scaled by the IPA framework according to the current OPP's
* frequency and voltage.
*
- * Return: 0 on success, or an error code.
+ * Return: 0 on success, or an error code. -EOVERFLOW error code will
+ * indicate that sampling interval was too large and no meaningful
+ * scaling for GPU utiliation can be done.
*/
int (*get_dynamic_coeff)(struct kbase_ipa_model *model, u32 *coeffp);
/*
@@ -115,6 +131,18 @@ struct kbase_ipa_model_ops {
* Return: 0 on success, or an error code.
*/
int (*get_static_coeff)(struct kbase_ipa_model *model, u32 *coeffp);
+
+ /*
+ * reset_counter_data() - Reset the HW counter data used for calculating
+ * dynamic power coefficient
+ * @model: pointer to model
+ *
+ * This method is currently applicable only to the counter based model.
+ * The next call to get_dynamic_coeff() will have to calculate the
+ * dynamic power coefficient based on the HW counter data generated
+ * from this point onwards.
+ */
+ void (*reset_counter_data)(struct kbase_ipa_model *model);
};
/**
@@ -164,6 +192,17 @@ const struct kbase_ipa_model_ops *kbase_ipa_model_ops_find(struct kbase_device *
const char *name);
/**
+ * kbase_ipa_counter_model_ops_find - Lookup an IPA counter model using its name
+ * @kbdev: pointer to kbase device
+ * @name: name of counter model to lookup
+ *
+ * Return: Pointer to counter model's 'ops' structure, or NULL if the lookup
+ * failed.
+ */
+const struct kbase_ipa_model_ops *kbase_ipa_counter_model_ops_find(
+ struct kbase_device *kbdev, const char *name);
+
+/**
* kbase_ipa_model_name_from_id - Find the best model for a given GPU ID
* @gpu_id: GPU ID of GPU the model will be used for
*
@@ -173,6 +212,16 @@ const struct kbase_ipa_model_ops *kbase_ipa_model_ops_find(struct kbase_device *
const char *kbase_ipa_model_name_from_id(u32 gpu_id);
/**
+ * kbase_ipa_counter_model_name_from_id - Find the best counter model for a
+ * given GPU ID
+ * @gpu_id: GPU ID of GPU the counter model will be used for
+ *
+ * Return: The name of the appropriate counter-based model, or NULL if the
+ * no counter model exists.
+ */
+const char *kbase_ipa_counter_model_name_from_id(u32 gpu_id);
+
+/**
* kbase_ipa_init_model - Initilaize the particular IPA model
* @kbdev: pointer to kbase device
* @ops: pointer to object containing model specific methods.
@@ -183,7 +232,7 @@ const char *kbase_ipa_model_name_from_id(u32 gpu_id);
* Return: pointer to kbase_ipa_model on success, NULL on error
*/
struct kbase_ipa_model *kbase_ipa_init_model(struct kbase_device *kbdev,
- const struct kbase_ipa_model_ops *ops);
+ const struct kbase_ipa_model_ops *ops);
/**
* kbase_ipa_term_model - Terminate the particular IPA model
* @model: pointer to the IPA model object, already initialized
@@ -202,16 +251,6 @@ void kbase_ipa_term_model(struct kbase_ipa_model *model);
*/
void kbase_ipa_protection_mode_switch_event(struct kbase_device *kbdev);
-extern const struct kbase_ipa_model_ops kbase_g71_ipa_model_ops;
-extern const struct kbase_ipa_model_ops kbase_g72_ipa_model_ops;
-extern const struct kbase_ipa_model_ops kbase_g76_ipa_model_ops;
-extern const struct kbase_ipa_model_ops kbase_g52_ipa_model_ops;
-extern const struct kbase_ipa_model_ops kbase_g52_r1_ipa_model_ops;
-extern const struct kbase_ipa_model_ops kbase_g51_ipa_model_ops;
-extern const struct kbase_ipa_model_ops kbase_g77_ipa_model_ops;
-extern const struct kbase_ipa_model_ops kbase_tnax_ipa_model_ops;
-extern const struct kbase_ipa_model_ops kbase_tbex_ipa_model_ops;
-
/**
* kbase_get_real_power() - get the real power consumption of the GPU
* @df: dynamic voltage and frequency scaling information for the GPU.
@@ -237,11 +276,20 @@ int kbase_get_real_power_locked(struct kbase_device *kbdev, u32 *power,
unsigned long voltage);
#endif /* MALI_UNIT_TEST */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0)
-extern struct devfreq_cooling_ops kbase_ipa_power_model_ops;
-#else
extern struct devfreq_cooling_power kbase_ipa_power_model_ops;
-#endif
+
+/**
+ * kbase_ipa_reset_data() - Reset the data required for power estimation.
+ * @kbdev: Pointer to kbase device.
+ *
+ * This function is called to ensure a meaningful baseline for
+ * kbase_get_real_power(), when thermal governor starts the polling, and
+ * that is achieved by updating the GPU utilization metrics and retrieving
+ * the accumulated value of HW counters.
+ * Basically this function collects all the data required for power estimation
+ * but does not process it.
+ */
+void kbase_ipa_reset_data(struct kbase_device *kbdev);
#else /* !(defined(CONFIG_MALI_DEVFREQ) && defined(CONFIG_DEVFREQ_THERMAL)) */