forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/gpu/arm/bifrost/ipa/backend/mali_kbase_ipa_counter_common_jm.c
....@@ -1,7 +1,7 @@
11 // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
22 /*
33 *
4
- * (C) COPYRIGHT 2017-2021 ARM Limited. All rights reserved.
4
+ * (C) COPYRIGHT 2017-2022 ARM Limited. All rights reserved.
55 *
66 * This program is free software and is provided to you under the terms of the
77 * GNU General Public License version 2 as published by the Free Software
....@@ -31,7 +31,7 @@
3131 #define DEFAULT_MIN_SAMPLE_CYCLES 10000
3232
3333 /**
34
- * read_hwcnt() - read a counter value
34
+ * kbase_ipa_read_hwcnt() - read a counter value
3535 * @model_data: pointer to model data
3636 * @offset: offset, in bytes, into vinstr buffer
3737 *
....@@ -44,8 +44,9 @@
4444 u32 offset)
4545 {
4646 u8 *p = (u8 *)model_data->dump_buf.dump_buf;
47
+ u64 val = *(u64 *)&p[offset];
4748
48
- return *(u32 *)&p[offset];
49
+ return (val > U32_MAX) ? U32_MAX : (u32)val;
4950 }
5051
5152 static inline s64 kbase_ipa_add_saturate(s64 a, s64 b)