* [PATCH] drm/vmwgfx: use *_32_bits() macros
@ 2016-03-03 10:26 Paul Bolle
2016-04-14 11:32 ` Paul Bolle
0 siblings, 1 reply; 6+ messages in thread
From: Paul Bolle @ 2016-03-03 10:26 UTC (permalink / raw)
To: David Airlie; +Cc: dri-devel, linux-kernel
Use the upper_32_bits() macro instead of the four line equivalent that
triggers a GCC warning on 32 bits x86:
drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c: In function 'vmw_cmdbuf_header_submit':
drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c:297:25: warning: right shift count >= width of type [-Wshift-count-overflow]
val = (header->handle >> 32);
^
And use the lower_32_bits() macro instead of and-ing with a 32 bits
mask.
Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
---
Note: compile tested only (I don't use any of vmware's products).
drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c
index 67cebb23c940..aa04fb0159a7 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c
@@ -293,13 +293,10 @@ static int vmw_cmdbuf_header_submit(struct vmw_cmdbuf_header *header)
struct vmw_cmdbuf_man *man = header->man;
u32 val;
- if (sizeof(header->handle) > 4)
- val = (header->handle >> 32);
- else
- val = 0;
+ val = upper_32_bits(header->handle);
vmw_write(man->dev_priv, SVGA_REG_COMMAND_HIGH, val);
- val = (header->handle & 0xFFFFFFFFULL);
+ val = lower_32_bits(header->handle);
val |= header->cb_context & SVGA_CB_CONTEXT_MASK;
vmw_write(man->dev_priv, SVGA_REG_COMMAND_LOW, val);
--
2.4.3
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] drm/vmwgfx: use *_32_bits() macros 2016-03-03 10:26 [PATCH] drm/vmwgfx: use *_32_bits() macros Paul Bolle @ 2016-04-14 11:32 ` Paul Bolle 2016-04-14 14:34 ` Joe Perches 0 siblings, 1 reply; 6+ messages in thread From: Paul Bolle @ 2016-04-14 11:32 UTC (permalink / raw) To: David Airlie; +Cc: dri-devel, linux-kernel On do, 2016-03-03 at 11:26 +0100, Paul Bolle wrote: > Use the upper_32_bits() macro instead of the four line equivalent that > triggers a GCC warning on 32 bits x86: > drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c: In function > 'vmw_cmdbuf_header_submit': > drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c:297:25: warning: right > shift count >= width of type [-Wshift-count-overflow] > val = (header->handle >> 32); > ^ > > And use the lower_32_bits() macro instead of and-ing with a 32 bits > mask. > > Signed-off-by: Paul Bolle <pebolle@tiscali.nl> > --- > Note: compile tested only (I don't use any of vmware's products). The warning can still be seen on v4.6-rc3 for 32 bits x86. This patch applies cleanly to that rc. Has anyone had a chance to look at this patch, and perhaps even test it? Thanks, Paul Bolle > drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c > b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c > index 67cebb23c940..aa04fb0159a7 100644 > --- a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c > +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c > @@ -293,13 +293,10 @@ static int vmw_cmdbuf_header_submit(struct > vmw_cmdbuf_header *header) > struct vmw_cmdbuf_man *man = header->man; > u32 val; > > - if (sizeof(header->handle) > 4) > - val = (header->handle >> 32); > - else > - val = 0; > + val = upper_32_bits(header->handle); > vmw_write(man->dev_priv, SVGA_REG_COMMAND_HIGH, val); > > - val = (header->handle & 0xFFFFFFFFULL); > + val = lower_32_bits(header->handle); > val |= header->cb_context & SVGA_CB_CONTEXT_MASK; > vmw_write(man->dev_priv, SVGA_REG_COMMAND_LOW, val); > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/vmwgfx: use *_32_bits() macros 2016-04-14 11:32 ` Paul Bolle @ 2016-04-14 14:34 ` Joe Perches 2016-06-15 8:37 ` Paul Bolle 0 siblings, 1 reply; 6+ messages in thread From: Joe Perches @ 2016-04-14 14:34 UTC (permalink / raw) To: Paul Bolle, David Airlie; +Cc: dri-devel, linux-kernel On Thu, 2016-04-14 at 13:32 +0200, Paul Bolle wrote: > On do, 2016-03-03 at 11:26 +0100, Paul Bolle wrote: > > > > Use the upper_32_bits() macro instead of the four line equivalent that > > triggers a GCC warning on 32 bits x86: > > drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c: In function > > 'vmw_cmdbuf_header_submit': > > drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c:297:25: warning: right > > shift count >= width of type [-Wshift-count-overflow] > > val = (header->handle >> 32); > > ^ > > > > And use the lower_32_bits() macro instead of and-ing with a 32 bits > > mask. > > > > Signed-off-by: Paul Bolle <pebolle@tiscali.nl> > > --- > > Note: compile tested only (I don't use any of vmware's products). > The warning can still be seen on v4.6-rc3 for 32 bits x86. This patch > applies cleanly to that rc. > > Has anyone had a chance to look at this patch, and perhaps even test it? Test? Nope. Seems obviously correct. It might be clearer removing the temporary though: Maybe: --- drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c index 67cebb2..330794f 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c @@ -291,17 +291,12 @@ void vmw_cmdbuf_header_free(struct vmw_cmdbuf_header *header) static int vmw_cmdbuf_header_submit(struct vmw_cmdbuf_header *header) { struct vmw_cmdbuf_man *man = header->man; - u32 val; - if (sizeof(header->handle) > 4) - val = (header->handle >> 32); - else - val = 0; - vmw_write(man->dev_priv, SVGA_REG_COMMAND_HIGH, val); - - val = (header->handle & 0xFFFFFFFFULL); - val |= header->cb_context & SVGA_CB_CONTEXT_MASK; - vmw_write(man->dev_priv, SVGA_REG_COMMAND_LOW, val); + vmw_write(man->dev_priv, SVGA_REG_COMMAND_HIGH, + upper_32_bits(header->handle)); + vmw_write(man->dev_priv, SVGA_REG_COMMAND_LOW, + lower_32_bits(header->handle) | + (header->cb_context & SVGA_CB_CONTEXT_MASK)); return header->cb_header->status; } ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/vmwgfx: use *_32_bits() macros 2016-04-14 14:34 ` Joe Perches @ 2016-06-15 8:37 ` Paul Bolle 2016-06-15 11:11 ` Daniel Vetter 0 siblings, 1 reply; 6+ messages in thread From: Paul Bolle @ 2016-06-15 8:37 UTC (permalink / raw) To: VMware Graphics, Sinclair Yeh, Thomas Hellstrom Cc: Joe Perches, David Airlie, dri-devel, linux-kernel [Added Sinclair, Thomas, and "VMware Graphics".] On do, 2016-04-14 at 07:34 -0700, Joe Perches wrote: > On Thu, 2016-04-14 at 13:32 +0200, Paul Bolle wrote: > > On do, 2016-03-03 at 11:26 +0100, Paul Bolle wrote: > > > > > > Use the upper_32_bits() macro instead of the four line equivalent that > > > triggers a GCC warning on 32 bits x86: > > > drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c: In function > > > 'vmw_cmdbuf_header_submit': > > > drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c:297:25: warning: right > > > shift count >= width of type [-Wshift-count-overflow] > > > val = (header->handle >> 32); > > > ^ > > > > > > And use the lower_32_bits() macro instead of and-ing with a 32 bits > > > mask. > > > > > > Signed-off-by: Paul Bolle <pebolle@tiscali.nl> > > > --- > > > Note: compile tested only (I don't use any of vmware's products). > > The warning can still be seen on v4.6-rc3 for 32 bits x86. This patch > > applies cleanly to that rc. > > > > Has anyone had a chance to look at this patch, and perhaps even test > > it? > > Test? Nope. Seems obviously correct. This warning still shows up when building v4.7-rc3 for 32 bits x86. Since my previous message an entry for this driver showed up in MAINTAINERS. So I'd guess Sinclair, Thomas, etc want me to resend this small patch. Is that correct? Thanks, Paul Bolle ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/vmwgfx: use *_32_bits() macros 2016-06-15 8:37 ` Paul Bolle @ 2016-06-15 11:11 ` Daniel Vetter 2016-06-15 11:59 ` Thomas Hellstrom 0 siblings, 1 reply; 6+ messages in thread From: Daniel Vetter @ 2016-06-15 11:11 UTC (permalink / raw) To: Paul Bolle Cc: VMware Graphics, Sinclair Yeh, Thomas Hellstrom, Joe Perches, linux-kernel, dri-devel On Wed, Jun 15, 2016 at 10:37:24AM +0200, Paul Bolle wrote: > [Added Sinclair, Thomas, and "VMware Graphics".] > > On do, 2016-04-14 at 07:34 -0700, Joe Perches wrote: > > On Thu, 2016-04-14 at 13:32 +0200, Paul Bolle wrote: > > > On do, 2016-03-03 at 11:26 +0100, Paul Bolle wrote: > > > > > > > > Use the upper_32_bits() macro instead of the four line equivalent that > > > > triggers a GCC warning on 32 bits x86: > > > > drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c: In function > > > > 'vmw_cmdbuf_header_submit': > > > > drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c:297:25: warning: right > > > > shift count >= width of type [-Wshift-count-overflow] > > > > val = (header->handle >> 32); > > > > ^ > > > > > > > > And use the lower_32_bits() macro instead of and-ing with a 32 bits > > > > mask. > > > > > > > > Signed-off-by: Paul Bolle <pebolle@tiscali.nl> > > > > --- > > > > Note: compile tested only (I don't use any of vmware's products). > > > The warning can still be seen on v4.6-rc3 for 32 bits x86. This patch > > > applies cleanly to that rc. > > > > > > Has anyone had a chance to look at this patch, and perhaps even test > > > it? > > > > Test? Nope. Seems obviously correct. > > This warning still shows up when building v4.7-rc3 for 32 bits x86. > > Since my previous message an entry for this driver showed up in > MAINTAINERS. So I'd guess Sinclair, Thomas, etc want me to resend this > small patch. Is that correct? Sounds more like maintainers asleep at the helm ;-) I've applied this to drm-misc, Sinclair can apply polish later on if he wants to. Thanks, Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/vmwgfx: use *_32_bits() macros 2016-06-15 11:11 ` Daniel Vetter @ 2016-06-15 11:59 ` Thomas Hellstrom 0 siblings, 0 replies; 6+ messages in thread From: Thomas Hellstrom @ 2016-06-15 11:59 UTC (permalink / raw) To: Paul Bolle, VMware Graphics, Sinclair Yeh, Thomas Hellstrom, Joe Perches, linux-kernel, dri-devel On 06/15/2016 01:11 PM, Daniel Vetter wrote: > On Wed, Jun 15, 2016 at 10:37:24AM +0200, Paul Bolle wrote: >> [Added Sinclair, Thomas, and "VMware Graphics".] >> >> On do, 2016-04-14 at 07:34 -0700, Joe Perches wrote: >>> On Thu, 2016-04-14 at 13:32 +0200, Paul Bolle wrote: >>>> On do, 2016-03-03 at 11:26 +0100, Paul Bolle wrote: >>>>> Use the upper_32_bits() macro instead of the four line equivalent that >>>>> triggers a GCC warning on 32 bits x86: >>>>> drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c: In function >>>>> 'vmw_cmdbuf_header_submit': >>>>> drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c:297:25: warning: right >>>>> shift count >= width of type [-Wshift-count-overflow] >>>>> val = (header->handle >> 32); >>>>> ^ >>>>> >>>>> And use the lower_32_bits() macro instead of and-ing with a 32 bits >>>>> mask. >>>>> >>>>> Signed-off-by: Paul Bolle <pebolle@tiscali.nl> >>>>> --- >>>>> Note: compile tested only (I don't use any of vmware's products). >>>> The warning can still be seen on v4.6-rc3 for 32 bits x86. This patch >>>> applies cleanly to that rc. >>>> >>>> Has anyone had a chance to look at this patch, and perhaps even test >>>> it? >>> Test? Nope. Seems obviously correct. >> This warning still shows up when building v4.7-rc3 for 32 bits x86. >> >> Since my previous message an entry for this driver showed up in >> MAINTAINERS. So I'd guess Sinclair, Thomas, etc want me to resend this >> small patch. Is that correct? > Sounds more like maintainers asleep at the helm ;-) > > I've applied this to drm-misc, Sinclair can apply polish later on if he > wants to. > > Thanks, Daniel Thanks for applying this. FWIW, Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> /Thomas ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-06-15 12:00 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-03-03 10:26 [PATCH] drm/vmwgfx: use *_32_bits() macros Paul Bolle 2016-04-14 11:32 ` Paul Bolle 2016-04-14 14:34 ` Joe Perches 2016-06-15 8:37 ` Paul Bolle 2016-06-15 11:11 ` Daniel Vetter 2016-06-15 11:59 ` Thomas Hellstrom
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox