aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1857-drm-amd-Use-portable-do_div-helper.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1857-drm-amd-Use-portable-do_div-helper.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1857-drm-amd-Use-portable-do_div-helper.patch85
1 files changed, 85 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1857-drm-amd-Use-portable-do_div-helper.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1857-drm-amd-Use-portable-do_div-helper.patch
new file mode 100644
index 00000000..fb9643bb
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1857-drm-amd-Use-portable-do_div-helper.patch
@@ -0,0 +1,85 @@
+From 3b552082be9d28d57481dc75586f99c4d0e92b5c Mon Sep 17 00:00:00 2001
+From: Felix Kuehling <Felix.Kuehling@amd.com>
+Date: Tue, 19 Sep 2017 16:10:43 -0400
+Subject: [PATCH 1857/4131] drm/amd: Use portable do_div helper
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
+Acked-by: Christian König <christian.koenig@amd.com>
+
+ Conflicts:
+ drivers/gpu/drm/amd/lib/chash.c
+
+Change-Id: Ie2727aa5c04ceeb3a15b875a99b0d6cf4798916d
+---
+ drivers/gpu/drm/amd/lib/chash.c | 30 +++++++++++++++++++++++-------
+ 1 file changed, 23 insertions(+), 7 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/lib/chash.c b/drivers/gpu/drm/amd/lib/chash.c
+index dfa0f18..50dde25 100644
+--- a/drivers/gpu/drm/amd/lib/chash.c
++++ b/drivers/gpu/drm/amd/lib/chash.c
+@@ -28,6 +28,7 @@
+ #include <linux/slab.h>
+ #include <linux/module.h>
+ #include <linux/sched/clock.h>
++#include <asm/div64.h>
+ #include <linux/chash.h>
+
+ /**
+@@ -71,9 +72,21 @@ EXPORT_SYMBOL(chash_table_free);
+ #ifdef CONFIG_CHASH_STATS
+
+ #define DIV_FRAC(nom, denom, quot, frac, frac_digits) do { \
+- (quot) = (nom) / (denom); \
+- (frac) = ((nom) % (denom) * (frac_digits) + \
+- (denom) / 2) / (denom); \
++ u64 __nom = (nom); \
++ u64 __denom = (denom); \
++ u64 __quot, __frac; \
++ u32 __rem; \
++ \
++ while (__denom >> 32) { \
++ __nom >>= 1; \
++ __denom >>= 1; \
++ } \
++ __quot = __nom; \
++ __rem = do_div(__quot, __denom); \
++ __frac = __rem * (frac_digits) + (__denom >> 1); \
++ do_div(__frac, __denom); \
++ (quot) = __quot; \
++ (frac) = __frac; \
+ } while (0)
+
+ void __chash_table_dump_stats(struct __chash_table *table)
+@@ -563,7 +576,7 @@ module_param_named(test_iters, chash_test_iters, ulong, 0444);
+ static int __init chash_init(void)
+ {
+ int ret;
+- u64 ts1_ns, ts_delta_us;
++ u64 ts1_ns;
+
+ /* Skip self test on user errors */
+ if (chash_test_bits < 4 || chash_test_bits > 20) {
+@@ -604,10 +617,13 @@ static int __init chash_init(void)
+ chash_test_minfill, chash_test_maxfill,
+ chash_test_iters);
+ if (!ret) {
+- ts_delta_us = (local_clock() - ts1_ns) / 1000;
++ u64 ts_delta_us = local_clock() - ts1_ns;
++ u64 iters_per_second = (u64)chash_test_iters * 1000000;
++
++ do_div(ts_delta_us, 1000);
++ do_div(iters_per_second, ts_delta_us);
+ pr_info("chash: self test took %llu us, %llu iterations/s\n",
+- ts_delta_us,
+- (u64)chash_test_iters * 1000000 / ts_delta_us);
++ ts_delta_us, iters_per_second);
+ } else {
+ pr_err("chash: self test failed: %d\n", ret);
+ }
+--
+2.7.4
+