summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Diver <diverj@google.com>2024-03-13 16:33:34 +0000
committerJack Diver <diverj@google.com>2024-03-14 10:13:35 +0000
commita96467622576b7f1318c55c61a862554ff6ebce9 (patch)
tree0b15dc3751ac9f8f90c9beb03789c1fe8f3f8ffd
parent1dd0e69d4683cade5e1d53356d4663a3657a7a6c (diff)
downloadgpu-a96467622576b7f1318c55c61a862554ff6ebce9.tar.gz
[DO NOT MERGE ANYWHERE] Revert "mali_pixel: Implement SLC partition ref counting"
Revert submission 2753879-gpu-slcv2-gs201 Reason for revert: Prebuild did not land before cutoff Reverted changes: /q/submissionid:2753879-gpu-slcv2-gs201 Bug: 329447972 Change-Id: I13716375afbe5be1ae04eb059ed24e8780e503cd
-rw-r--r--common/include/uapi/gpu/arm/midgard/platform/pixel/pixel_memory_group_manager.h4
-rw-r--r--mali_kbase/platform/pixel/mali_kbase_config_platform.h6
-rw-r--r--mali_kbase/platform/pixel/pixel_gpu_slc.c51
-rw-r--r--mali_pixel/memory_group_manager.c16
-rw-r--r--mali_pixel/pixel_slc.c129
-rw-r--r--mali_pixel/pixel_slc.h13
6 files changed, 5 insertions, 214 deletions
diff --git a/common/include/uapi/gpu/arm/midgard/platform/pixel/pixel_memory_group_manager.h b/common/include/uapi/gpu/arm/midgard/platform/pixel/pixel_memory_group_manager.h
index d410f7b..893cdca 100644
--- a/common/include/uapi/gpu/arm/midgard/platform/pixel/pixel_memory_group_manager.h
+++ b/common/include/uapi/gpu/arm/midgard/platform/pixel/pixel_memory_group_manager.h
@@ -7,8 +7,4 @@
#ifndef _UAPI_PIXEL_MEMORY_GROUP_MANAGER_H_
#define _UAPI_PIXEL_MEMORY_GROUP_MANAGER_H_
-void pixel_mgm_slc_inc_refcount(struct memory_group_manager_device* mgm_dev);
-
-void pixel_mgm_slc_dec_refcount(struct memory_group_manager_device* mgm_dev);
-
#endif /* _UAPI_PIXEL_MEMORY_GROUP_MANAGER_H_ */
diff --git a/mali_kbase/platform/pixel/mali_kbase_config_platform.h b/mali_kbase/platform/pixel/mali_kbase_config_platform.h
index 47b1318..06b76ea 100644
--- a/mali_kbase/platform/pixel/mali_kbase_config_platform.h
+++ b/mali_kbase/platform/pixel/mali_kbase_config_platform.h
@@ -428,14 +428,12 @@ struct pixel_context {
/**
* struct pixel_platform_data - Per kbase_context Pixel specific platform data
*
- * @kctx: Handle to the parent kctx
- * @stats: Tracks the dvfs metrics for the UID associated with this context
- * @slc_vote: Tracks whether this context is voting for slc
+ * @kctx: Handle to the parent kctx
+ * @stats: Tracks the dvfs metrics for the UID associated with this context
*/
struct pixel_platform_data {
struct kbase_context *kctx;
struct gpu_dvfs_metrics_uid_stats* stats;
- int slc_vote;
};
#endif /* _KBASE_CONFIG_PLATFORM_H_ */
diff --git a/mali_kbase/platform/pixel/pixel_gpu_slc.c b/mali_kbase/platform/pixel/pixel_gpu_slc.c
index e8aae75..8e46be1 100644
--- a/mali_kbase/platform/pixel/pixel_gpu_slc.c
+++ b/mali_kbase/platform/pixel/pixel_gpu_slc.c
@@ -17,37 +17,6 @@
#include "mali_kbase_config_platform.h"
#include "pixel_gpu_slc.h"
-#include <uapi/gpu/arm/midgard/platform/pixel/pixel_memory_group_manager.h>
-
-/**
- * enum slc_vote_state - Whether a context is voting for SLC
- */
-enum slc_vote_state {
- /** @IDLE: Idle, not voting for SLC */
- IDLE = 0,
- /** @VOTING: Active, voting for SLC */
- VOTING = 1,
-};
-
-/**
- * transition() - Try to transition from one value to another
- *
- * @v: Value to transition
- * @old: Starting state to transition from
- * @new: Destination state to transition to
- *
- * Return: Whether the transition was successful
- */
-static bool transition(int *v, int old, int new)
-{
- bool const cond = *v == old;
-
- if (cond)
- *v = new;
-
- return cond;
-}
-
/**
* gpu_pixel_handle_buffer_liveness_update_ioctl() - See gpu_slc_liveness_update
*
@@ -88,11 +57,7 @@ int gpu_slc_kctx_init(struct kbase_context *kctx)
*/
void gpu_slc_kctx_term(struct kbase_context *kctx)
{
- struct pixel_platform_data *pd = kctx->platform_data;
-
- /* Contexts can be terminated without being idled first */
- if (transition(&pd->slc_vote, VOTING, IDLE))
- pixel_mgm_slc_dec_refcount(kctx->kbdev->mgm_dev);
+ (void)kctx;
}
/**
@@ -102,12 +67,7 @@ void gpu_slc_kctx_term(struct kbase_context *kctx)
*/
void gpu_slc_kctx_active(struct kbase_context *kctx)
{
- struct pixel_platform_data *pd = kctx->platform_data;
-
- lockdep_assert_held(&kctx->kbdev->hwaccess_lock);
-
- if (transition(&pd->slc_vote, IDLE, VOTING))
- pixel_mgm_slc_inc_refcount(kctx->kbdev->mgm_dev);
+ (void)kctx;
}
/**
@@ -117,12 +77,7 @@ void gpu_slc_kctx_active(struct kbase_context *kctx)
*/
void gpu_slc_kctx_idle(struct kbase_context *kctx)
{
- struct pixel_platform_data *pd = kctx->platform_data;
-
- lockdep_assert_held(&kctx->kbdev->hwaccess_lock);
-
- if (transition(&pd->slc_vote, VOTING, IDLE))
- pixel_mgm_slc_dec_refcount(kctx->kbdev->mgm_dev);
+ (void)kctx;
}
/**
diff --git a/mali_pixel/memory_group_manager.c b/mali_pixel/memory_group_manager.c
index 03c6f74..4d92ea7 100644
--- a/mali_pixel/memory_group_manager.c
+++ b/mali_pixel/memory_group_manager.c
@@ -533,22 +533,6 @@ static vm_fault_t mgm_vmf_insert_pfn_prot(
return fault;
}
-void pixel_mgm_slc_inc_refcount(struct memory_group_manager_device* mgm_dev)
-{
- struct mgm_groups *const data = mgm_dev->data;
-
- slc_inc_refcount(&data->slc_data);
-}
-EXPORT_SYMBOL_GPL(pixel_mgm_slc_inc_refcount);
-
-void pixel_mgm_slc_dec_refcount(struct memory_group_manager_device* mgm_dev)
-{
- struct mgm_groups *const data = mgm_dev->data;
-
- slc_dec_refcount(&data->slc_data);
-}
-EXPORT_SYMBOL_GPL(pixel_mgm_slc_dec_refcount);
-
static int mgm_initialize_data(struct mgm_groups *mgm_data)
{
int i, ret;
diff --git a/mali_pixel/pixel_slc.c b/mali_pixel/pixel_slc.c
index 78f1b74..62c6908 100644
--- a/mali_pixel/pixel_slc.c
+++ b/mali_pixel/pixel_slc.c
@@ -37,50 +37,6 @@
#endif
#define PBHA_BIT_MASK (0xf)
-#define PARTITION_DISABLE_HYSTERESIS (msecs_to_jiffies(100))
-
-
-/**
- * partition_required() - Determine whether we require a partition to be enabled
- *
- * @pt: The partition to check.
- *
- * Check whether a partition meets the requirements for being enabled.
- *
- * Return: True, if the partition is required to be enabled, otherwise false.
- */
-static bool partition_required(struct slc_partition *pt)
-{
- lockdep_assert_held(&pt->lock);
-
- return atomic_read(&pt->refcount);
-}
-
-/**
- * pixel_atomic_dec_and_lock_irqsave - lock on reaching reference count zero
- *
- * @val: The atomic counter
- * @lock: The spinlock in question
- * @flags: Storage for the current interrupt enable state
- *
- * Decrements @val by 1, if the result is 0, locks @lock.
- *
- * Return: True if the lock was taken, false for all other cases.
- */
-static int pixel_atomic_dec_and_lock_irqsave(atomic_t* val, spinlock_t* lock, unsigned long* flags)
-{
- /* Subtract 1 from counter unless that drops it to 0 (ie. it was 1) */
- if (atomic_add_unless(val, -1, 1))
- return 0;
-
- /* Otherwise do it the slow way */
- spin_lock_irqsave(lock, *flags);
- if (atomic_dec_and_test(val))
- return 1;
- spin_unlock_irqrestore(lock, *flags);
-
- return 0;
-}
/**
* slc_wipe_pbha - Clear any set PBHA bits from the pte.
@@ -148,84 +104,6 @@ static void disable_partition(struct slc_data *data, struct slc_partition *pt)
}
/**
- * queue_disable_worker - Queue a delayed partition disable op
- *
- * @data: The &struct slc_data tracking partition information.
- */
-static void queue_disable_worker(struct slc_data *data)
-{
- queue_delayed_work(system_highpri_wq, &data->disable_work, PARTITION_DISABLE_HYSTERESIS);
-}
-
-/**
- * partition_disable_worker - Callback to lazily disable a partition
- *
- * @work: The &struct work_struct dequeued
- */
-static void partition_disable_worker(struct work_struct *work)
-{
- struct slc_data* data = container_of(work, struct slc_data, disable_work.work);
- struct slc_partition *pt = &data->partition;
- unsigned long flags;
-
- /* Complete any pending disable ops */
- spin_lock_irqsave(&pt->lock, flags);
-
- if (!partition_required(pt))
- disable_partition(data, pt);
-
- spin_unlock_irqrestore(&pt->lock, flags);
-}
-
-/**
- * slc_inc_refcount - Increase the partition reference count.
- *
- * @data: The &struct slc_data tracking partition information.
- *
- * If this is the first reference being taken, the partition will be enabled.
- */
-void slc_inc_refcount(struct slc_data *data)
-{
- struct slc_partition *pt = &data->partition;
-
- /* Try to re-enable the partition if this is the first reference */
- if (atomic_inc_return(&pt->refcount) == 1) {
- unsigned long flags;
-
- spin_lock_irqsave(&pt->lock, flags);
-
- /* Enable the partition immediately if it's required */
- if (partition_required(pt))
- enable_partition(data, pt);
-
- spin_unlock_irqrestore(&pt->lock, flags);
- }
-}
-
-/**
- * slc_dec_refcount - Decrease the partition reference count.
- *
- * @data: The &struct slc_data tracking partition information.
- *
- * If this is the last reference being released, the partition will be disabled.
- */
-void slc_dec_refcount(struct slc_data *data)
-{
- struct slc_partition *pt = &data->partition;
- unsigned long flags;
-
- /* Disable the partition if this was the last reference */
- if (pixel_atomic_dec_and_lock_irqsave(&pt->refcount, &pt->lock, &flags)) {
-
- /* Lazily disable the partition if it's no longer required */
- if (!partition_required(pt))
- queue_disable_worker(data);
-
- spin_unlock_irqrestore(&pt->lock, flags);
- }
-}
-
-/**
* init_partition - Register and initialize a partition with the SLC driver.
*
* @data: The &struct slc_data tracking partition information.
@@ -263,9 +141,7 @@ static int init_partition(struct slc_data *data, struct slc_partition *pt, u32 i
.ptid = ptid,
.pbha = pbha,
.enabled = false,
- .refcount = ATOMIC_INIT(0),
};
- spin_lock_init(&pt->lock);
err_exit:
return err;
@@ -304,8 +180,6 @@ int slc_init_data(struct slc_data *data, struct device* dev)
/* Inherit the platform device */
data->dev = dev;
- INIT_DELAYED_WORK(&data->disable_work, partition_disable_worker);
-
/* Register our node with the SLC driver.
* This detects our partitions defined within the DT.
*/
@@ -335,9 +209,6 @@ err_exit:
*/
void slc_term_data(struct slc_data *data)
{
- /* Ensure all pending disable ops are complete */
- cancel_delayed_work_sync(&data->disable_work);
-
term_partition(data, &data->partition);
pt_client_unregister(data->pt_handle);
diff --git a/mali_pixel/pixel_slc.h b/mali_pixel/pixel_slc.h
index bcaf1ff..40b5ad7 100644
--- a/mali_pixel/pixel_slc.h
+++ b/mali_pixel/pixel_slc.h
@@ -45,12 +45,6 @@ struct slc_partition {
/** @enabled: Is the partition currently enabled */
bool enabled;
-
- /** @refcount: Reference count for this partition */
- atomic_t refcount;
-
- /** @lock: Lock protecting enable/disable ops on this partition */
- spinlock_t lock;
};
/**
@@ -65,9 +59,6 @@ struct slc_data {
/** @dev: Inherited pointer to device attached */
struct device *dev;
-
- /** @disable_work: Work item used to queue lazy SLC partition disable ops. */
- struct delayed_work disable_work;
};
int slc_init_data(struct slc_data *data, struct device* dev);
@@ -78,8 +69,4 @@ u64 slc_set_pbha(struct slc_data const *data, u64 pte);
u64 slc_wipe_pbha(u64 pte);
-void slc_inc_refcount(struct slc_data *data);
-
-void slc_dec_refcount(struct slc_data *data);
-
#endif /* _PIXEL_SLC_H_ */