<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 23, 2016 at 3:07 PM, Chris Wilson <span dir="ltr"><<a href="mailto:chris@chris-wilson.co.uk" target="_blank">chris@chris-wilson.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Just a couple of naked 64bit divides causing link errors on 32bit<br>
builds, with:<br>
<br>
        ERROR: "__udivdi3" [drivers/gpu/drm/i915/i915.ko] undefined!<br>
<br>
</span><span class="">v2: do_div() is only u64/u32, we need a u32/u64!<br>
</span>v3: div_u64() == u64/u32, div64_u64() == u64/u64<br>
<span class=""><br>
Reported-by: kbuild test robot <<a href="mailto:fengguang.wu@intel.com">fengguang.wu@intel.com</a>><br>
Fixes: d79651522e89 ("drm/i915: Enable i915 perf stream for Haswell OA unit")<br>
Signed-off-by: Chris Wilson <<a href="mailto:chris@chris-wilson.co.uk">chris@chris-wilson.co.uk</a>><br>
Cc: Robert Bragg <<a href="mailto:robert@sixbynine.org">robert@sixbynine.org</a>><br>
---<br>
</span> drivers/gpu/drm/i915/i915_<wbr>perf.c | 13 +++++++------<br>
 1 file changed, 7 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/i915/i915_<wbr>perf.c b/drivers/gpu/drm/i915/i915_<wbr>perf.c<br>
index 95512824922b..14de9a4eee27 100644<br>
--- a/drivers/gpu/drm/i915/i915_<wbr>perf.c<br>
+++ b/drivers/gpu/drm/i915/i915_<wbr>perf.c<br>
@@ -974,8 +974,8 @@ static void i915_oa_stream_disable(struct i915_perf_stream *stream)<br>
<span class=""><br>
 static u64 oa_exponent_to_ns(struct drm_i915_private *dev_priv, int exponent)<br>
 {<br>
-       return 1000000000ULL * (2ULL << exponent) /<br>
-               dev_priv->perf.oa.timestamp_<wbr>frequency;<br>
</span>+       return div_u64(1000000000ULL * (2ULL << exponent),<br>
+                      dev_priv->perf.oa.timestamp_<wbr>frequency);<br>
 }<br>
<br>
<span class=""> static const struct i915_perf_stream_ops i915_oa_stream_ops = {<br>
</span>@@ -1051,16 +1051,17 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,<br>
<span class=""><br>
        dev_priv->perf.oa.periodic = props->oa_periodic;<br>
        if (dev_priv->perf.oa.periodic) {<br>
-               u64 period_ns = oa_exponent_to_ns(dev_priv,<br>
-                                                 props->oa_period_exponent);<br>
</span>+               u32 tail;<br>
<span class=""><br>
                dev_priv->perf.oa.period_<wbr>exponent = props->oa_period_exponent;<br>
<br>
                /* See comment for OA_TAIL_MARGIN_NSEC for details<br>
                 * about this tail_margin...<br>
                 */<br>
-               dev_priv->perf.oa.tail_margin =<br>
-                       ((OA_TAIL_MARGIN_NSEC / period_ns) + 1) * format_size;<br>
</span>+               tail = div64_u64(OA_TAIL_MARGIN_NSEC,<br>
+                                oa_exponent_to_ns(dev_priv,<br>
+                                                  props->oa_period_exponent));<br>
+               dev_priv->perf.oa.tail_margin = (tail + 1) * format_size;<br>
<div class="HOEnZb"><div class="h5">        }<br>
<br>
        if (stream->ctx) {<br>
--<br>
2.10.2<br>
<br></div></div></blockquote><div><br></div><div>This looks good to me, thanks.<br><br></div><div>Reviewed-by: Robert Bragg <<a href="mailto:robert@sixbynine.org">robert@sixbynine.org</a>> <br></div></div><br></div></div>