* [PATCH] drm/nouveau/bios: fix a bit shift error introduced by 457e77b
@ 2014-04-15 21:18 Sergei Antonov
[not found] ` <1397596717-6862-1-git-send-email-saproj-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Sergei Antonov @ 2014-04-15 21:18 UTC (permalink / raw)
To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Cc: Dave Airlie, Andrew Morton, Ben Skeggs
Commit 457e77b26428ab4a24998eecfb99f27fa4195397 added two checks applied to a
value received from nv_rd32(bios, 0x619f04). But after this new piece of code
is executed, the addr local variable does not hold the same value it used to
hold before the commit. Here is what is was assigned in the original code:
(u64)(nv_rd32(bios, 0x619f04) & 0xffffff00) << 8
in the committed code it ends up with this value:
(u64)(nv_rd32(bios, 0x619f04) >> 8) << 8
These expressions are obviously not equivalent.
My Nvidia video card does not show anything on the display when I boot a
kernel containing this commit.
The patch fixes the code so that the new checks are still done, but the
side effect of an incorrect addr value is gone.
Cc: Ben Skeggs <bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Dave Airlie <airlied-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
Signed-off-by: Sergei Antonov <saproj-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
drivers/gpu/drm/nouveau/core/subdev/bios/base.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
index e9df94f..291adb6 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
@@ -109,7 +109,7 @@ nouveau_bios_shadow_pramin(struct nouveau_bios *bios)
return;
}
- addr = (u64)(addr >> 8) << 8;
+ addr = (u64)(addr & 0xffffff00) << 8;
if (!addr) {
addr = (u64)nv_rd32(bios, 0x001700) << 16;
addr += 0xf0000;
--
1.9.0
^ permalink raw reply related [flat|nested] 4+ messages in thread[parent not found: <1397596717-6862-1-git-send-email-saproj-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH] drm/nouveau/bios: fix a bit shift error introduced by 457e77b [not found] ` <1397596717-6862-1-git-send-email-saproj-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2014-04-15 21:49 ` Sergei Antonov [not found] ` <CABikg9yL9y49ws5yJq9R0LV7++ysgPD0wwAeoNd3g8Tm34ysHg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Sergei Antonov @ 2014-04-15 21:49 UTC (permalink / raw) To: Andrew Morton, nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW Cc: Dave Airlie, Ben Skeggs On 15 April 2014 23:18, Sergei Antonov <saproj-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > Commit 457e77b26428ab4a24998eecfb99f27fa4195397 added two checks applied to a > value received from nv_rd32(bios, 0x619f04). But after this new piece of code > is executed, the addr local variable does not hold the same value it used to > hold before the commit. Here is what is was assigned in the original code: > (u64)(nv_rd32(bios, 0x619f04) & 0xffffff00) << 8 > in the committed code it ends up with this value: > (u64)(nv_rd32(bios, 0x619f04) >> 8) << 8 > These expressions are obviously not equivalent. > > My Nvidia video card does not show anything on the display when I boot a > kernel containing this commit. > > The patch fixes the code so that the new checks are still done, but the > side effect of an incorrect addr value is gone. > > Cc: Ben Skeggs <bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> > Cc: Dave Airlie <airlied-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> > Cc: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org> > Signed-off-by: Sergei Antonov <saproj-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > --- > drivers/gpu/drm/nouveau/core/subdev/bios/base.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c > index e9df94f..291adb6 100644 > --- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c > +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c > @@ -109,7 +109,7 @@ nouveau_bios_shadow_pramin(struct nouveau_bios *bios) > return; > } > > - addr = (u64)(addr >> 8) << 8; > + addr = (u64)(addr & 0xffffff00) << 8; I just noticed that "(u64)" is redundant here. Can it be removed in the patch without resubmitting, Andrew? > if (!addr) { > addr = (u64)nv_rd32(bios, 0x001700) << 16; > addr += 0xf0000; > -- > 1.9.0 > ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <CABikg9yL9y49ws5yJq9R0LV7++ysgPD0wwAeoNd3g8Tm34ysHg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH] drm/nouveau/bios: fix a bit shift error introduced by 457e77b [not found] ` <CABikg9yL9y49ws5yJq9R0LV7++ysgPD0wwAeoNd3g8Tm34ysHg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2014-04-19 20:14 ` Emil Velikov [not found] ` <5352D943.407-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Emil Velikov @ 2014-04-19 20:14 UTC (permalink / raw) To: Sergei Antonov, Andrew Morton, nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW Cc: Dave Airlie, emil.l.velikov-Re5JQEeQqe8AvxtiuMwx3w, Ben Skeggs On 15/04/14 22:49, Sergei Antonov wrote: > On 15 April 2014 23:18, Sergei Antonov <saproj-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> Commit 457e77b26428ab4a24998eecfb99f27fa4195397 added two checks applied to a >> value received from nv_rd32(bios, 0x619f04). But after this new piece of code >> is executed, the addr local variable does not hold the same value it used to >> hold before the commit. Here is what is was assigned in the original code: >> (u64)(nv_rd32(bios, 0x619f04) & 0xffffff00) << 8 >> in the committed code it ends up with this value: >> (u64)(nv_rd32(bios, 0x619f04) >> 8) << 8 >> These expressions are obviously not equivalent. >> >> My Nvidia video card does not show anything on the display when I boot a >> kernel containing this commit. >> >> The patch fixes the code so that the new checks are still done, but the >> side effect of an incorrect addr value is gone. >> Hi Sergei A similar patch [1] has been sent a few days prior to yours, and I'm assuming it will be queued/merged shortly. Just letting you know. Cheers -Emil [1] http://lists.freedesktop.org/archives/dri-devel/2014-April/057318.html ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <5352D943.407-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH] drm/nouveau/bios: fix a bit shift error introduced by 457e77b [not found] ` <5352D943.407-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2014-04-20 13:25 ` Sergei Antonov 0 siblings, 0 replies; 4+ messages in thread From: Sergei Antonov @ 2014-04-20 13:25 UTC (permalink / raw) To: Emil Velikov Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Andrew Morton, Ben Skeggs, Dave Airlie On 19 April 2014 22:14, Emil Velikov <emil.l.velikov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > On 15/04/14 22:49, Sergei Antonov wrote: >> On 15 April 2014 23:18, Sergei Antonov <saproj-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>> Commit 457e77b26428ab4a24998eecfb99f27fa4195397 added two checks applied to a >>> value received from nv_rd32(bios, 0x619f04). But after this new piece of code >>> is executed, the addr local variable does not hold the same value it used to >>> hold before the commit. Here is what is was assigned in the original code: >>> (u64)(nv_rd32(bios, 0x619f04) & 0xffffff00) << 8 >>> in the committed code it ends up with this value: >>> (u64)(nv_rd32(bios, 0x619f04) >> 8) << 8 >>> These expressions are obviously not equivalent. >>> >>> My Nvidia video card does not show anything on the display when I boot a >>> kernel containing this commit. >>> >>> The patch fixes the code so that the new checks are still done, but the >>> side effect of an incorrect addr value is gone. >>> > Hi Sergei > > A similar patch [1] has been sent a few days prior to yours, and I'm assuming > it will be queued/merged shortly. Just letting you know. > > Cheers > -Emil > > [1] http://lists.freedesktop.org/archives/dri-devel/2014-April/057318.html Thanks! I didn't know about this patch. Sorry for accidentally creating a race condition. My patch has been merged today (included in "drm fixes" from Dave Airlie). ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-04-20 13:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-15 21:18 [PATCH] drm/nouveau/bios: fix a bit shift error introduced by 457e77b Sergei Antonov
[not found] ` <1397596717-6862-1-git-send-email-saproj-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-04-15 21:49 ` Sergei Antonov
[not found] ` <CABikg9yL9y49ws5yJq9R0LV7++ysgPD0wwAeoNd3g8Tm34ysHg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-19 20:14 ` Emil Velikov
[not found] ` <5352D943.407-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-04-20 13:25 ` Sergei Antonov
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.