summaryrefslogtreecommitdiff
path: root/mali_kbase
diff options
context:
space:
mode:
authorJack Diver <diverj@google.com>2023-03-30 16:10:44 +0000
committerJack Diver <diverj@google.com>2023-04-06 10:24:02 +0000
commitbd8eda43700d4789a42881c5483544a4b403c4a6 (patch)
tree4835779243e676d2c1142c93c5581b91364257e2 /mali_kbase
parentb141d6e750e9651a243433eac73fa3b8c00cd763 (diff)
downloadgpu-bd8eda43700d4789a42881c5483544a4b403c4a6.tar.gz
mali_kbase: platform: mgm: Get accurate SLC partition size
Use mgm_resize_callback to update memory group size. Add entry point allowing memory group size to be queried. Bug: 264990406 Test: Boot to home Test: gfx-bench mh3.1 Change-Id: I80f595724c7418b97e07679719d2b76e4ee7b96f Signed-off-by: Jack Diver <diverj@google.com>
Diffstat (limited to 'mali_kbase')
-rw-r--r--mali_kbase/platform/pixel/mali_kbase_config_platform.h2
-rw-r--r--mali_kbase/platform/pixel/pixel_gpu_slc.c29
2 files changed, 21 insertions, 10 deletions
diff --git a/mali_kbase/platform/pixel/mali_kbase_config_platform.h b/mali_kbase/platform/pixel/mali_kbase_config_platform.h
index bb13101..872d455 100644
--- a/mali_kbase/platform/pixel/mali_kbase_config_platform.h
+++ b/mali_kbase/platform/pixel/mali_kbase_config_platform.h
@@ -295,7 +295,6 @@ struct gpu_dvfs_metrics_uid_stats;
* @dvfs.qos.bts.scenario: The index of the BTS scenario to be used. Set via DT.
*
* @slc.lock: Synchronize updates to the SLC partition accounting variables.
- * @slc.partition_size: The size of the GPU's SLC partition.
* @slc.demand: The total demand for SLC space, an aggregation of each kctx's demand.
* @slc.usage: The total amount of SLC space used, an aggregation of each kctx's usage.
*/
@@ -410,7 +409,6 @@ struct pixel_context {
struct {
struct mutex lock;
- u64 partition_size;
u64 demand;
u64 usage;
} slc;
diff --git a/mali_kbase/platform/pixel/pixel_gpu_slc.c b/mali_kbase/platform/pixel/pixel_gpu_slc.c
index 6c1e921..152779d 100644
--- a/mali_kbase/platform/pixel/pixel_gpu_slc.c
+++ b/mali_kbase/platform/pixel/pixel_gpu_slc.c
@@ -133,13 +133,25 @@ static void gpu_slc_resize_partition(struct kbase_device* kbdev)
struct pixel_context *pc = kbdev->platform_context;
/* Request that the mgm select an SLC partition that fits our demand */
- pc->slc.partition_size =
- pixel_mgm_resize_group_to_fit(kbdev->mgm_dev, MGM_SLC_GROUP_ID, pc->slc.demand);
+ pixel_mgm_resize_group_to_fit(kbdev->mgm_dev, MGM_SLC_GROUP_ID, pc->slc.demand);
- dev_dbg(kbdev->dev,
- "pixel: resized GPU SLC partition to: %llu, to meet demand: %llu",
- pc->slc.partition_size,
- pc->slc.demand);
+ dev_dbg(kbdev->dev, "pixel: resized GPU SLC partition to meet demand: %llu", pc->slc.demand);
+}
+
+/**
+ * gpu_slc_get_partition_size - Query the current size of the GPU's SLC partition.
+ *
+ * @kbdev: The &struct kbase_device for the GPU.
+ *
+ * Returns the size of the GPU's SLC partition.
+ */
+static u64 gpu_slc_get_partition_size(struct kbase_device* kbdev)
+{
+ u64 const partition_size = pixel_mgm_query_group_size(kbdev->mgm_dev, MGM_SLC_GROUP_ID);
+
+ dev_dbg(kbdev->dev, "pixel: GPU SLC partition partition size: %llu", partition_size);
+
+ return partition_size;
}
/**
@@ -175,8 +187,9 @@ static void gpu_slc_liveness_update(struct kbase_context* kctx,
kctx_pd->slc.peak_demand = 0;
kctx_pd->slc.peak_usage = 0;
- /* Calculate the remaining free space in the SLC partition */
- free_space = pc->slc.partition_size - pc->slc.usage;
+ /* Calculate the remaining free space in the SLC partition (floored at 0) */
+ free_space = gpu_slc_get_partition_size(kbdev);
+ free_space -= min(free_space, pc->slc.usage);
for (i = 0; i < info->live_ranges_count; ++i)
{