drm/radeon: Disable writeback by default on ppc
Subsystems (2)
PATCH 1/1 drm/radeon: Disable writeback by default on ppc
At least on an IBM Power 720, this check passes, but several piglit tests will reliably trigger GPU resets due to the ring buffer pointers not being updated. There's probably a better way to limit this to just affected machines though.
--- drivers/gpu/drm/radeon/r600_cp.c | 7 +++++++ drivers/gpu/drm/radeon/radeon_cp.c | 7 +++++++ drivers/gpu/drm/radeon/radeon_device.c | 4 ++-- drivers/gpu/drm/radeon/radeon_drv.c | 2 +- 4 files changed, 17 insertions(+), 3 deletions(-)
drivers/gpu/drm/radeon/r600_cp.c +7 -0
@@ -552,6 +552,13 @@ static void r600_test_writeback(drm_radeon_private_t *dev_priv) dev_priv->writeback_works =0 ;DRM_INFO ("writeback test failed\n" ); } +#if defined(__ppc__) || defined(__ppc64__) +/* the test might succeed on ppc, but it's usually not reliable */ +if (radeon_no_wb ==-1 ) { + radeon_no_wb =1 ; +DRM_INFO ("not trusting writeback test due to arch quirk\n" ); + } +#endif if (radeon_no_wb ==1 ) { dev_priv->writeback_works =0 ;DRM_INFO ("writeback forced off\n" );
drivers/gpu/drm/radeon/radeon_cp.c +7 -0
@@ -892,6 +892,13 @@ static void radeon_test_writeback(drm_radeon_private_t * dev_priv) dev_priv->writeback_works =0 ;DRM_INFO ("writeback test failed\n" ); } +#if defined(__ppc__) || defined(__ppc64__) +/* the test might succeed on ppc, but it's usually not reliable */ +if (radeon_no_wb ==-1 ) { + radeon_no_wb =1 ; +DRM_INFO ("not trusting writeback test due to arch quirk\n" ); + } +#endif if (radeon_no_wb ==1 ) { dev_priv->writeback_works =0 ;DRM_INFO ("writeback forced off\n" );
drivers/gpu/drm/radeon/radeon_device.c +2 -2
@@ -322,8 +322,8 @@ int radeon_wb_init(struct radeon_device *rdev)/* disable event_write fences */ rdev->wb.use_event = false;/* disabled via module param */ -if (radeon_no_wb ==1 ) { - rdev->wb.enabled = false; +if (radeon_no_wb !=-1 ) { + rdev->wb.enabled = !!radeon_no_wb; }else {if (rdev->flags &RADEON_IS_AGP ) {/* often unreliable on AGP */
drivers/gpu/drm/radeon/radeon_drv.c +1 -1
@@ -146,7 +146,7 @@ static inline void radeon_register_atpx_handler(void) {}static inline void radeon_unregister_atpx_handler (void ) {}#endif -int radeon_no_wb; +int radeon_no_wb =-1 ;int radeon_modeset =-1 ;int radeon_dynclks =-1 ;int radeon_r4xx_atom =0 ;
Signature · 1 line
1.8.2.1
Quoted 4 lines · Adam Jackson
At least on an IBM Power 720, this check passes, but several piglit tests will reliably trigger GPU resets due to the ring buffer pointers not being updated. There's probably a better way to limit this to just affected machines though.
What radeon chips are you seeing this on? wb is more or less required on r6xx and newer and I'm not sure those generations will even work properly without writeback enabled these days. We force it to always be enabled on APUs and NI and newer asics. With KMS, wb encompasses more than just rptr writeback; it covers pretty much everything involving the GPU writing any status information to memory.
Alex
Quoted 80 lines
Signed-off-by Adam Jackson <[email protected]>--- drivers/gpu/drm/radeon/r600_cp.c | 7 +++++++ drivers/gpu/drm/radeon/radeon_cp.c | 7 +++++++ drivers/gpu/drm/radeon/radeon_device.c | 4 ++-- drivers/gpu/drm/radeon/radeon_drv.c | 2 +- 4 files changed, 17 insertions(+), 3 deletions(-)drivers/gpu/drm/radeon/r600_cp.c +7
-0@@ -552,6 +552,13 @@ static void r600_test_writeback(drm_radeon_private_t *dev_priv) dev_priv->writeback_works =0 ;DRM_INFO ("writeback test failed\n" ); } +#if defined(__ppc__) || defined(__ppc64__) +/* the test might succeed on ppc, but it's usually not reliable */ +if (radeon_no_wb ==-1 ) { + radeon_no_wb =1 ; +DRM_INFO ("not trusting writeback test due to arch quirk\n" ); + } +#endif if (radeon_no_wb ==1 ) { dev_priv->writeback_works =0 ;DRM_INFO ("writeback forced off\n" );drivers/gpu/drm/radeon/radeon_cp.c +7
-0@@ -892,6 +892,13 @@ static void radeon_test_writeback(drm_radeon_private_t * dev_priv) dev_priv->writeback_works =0 ;DRM_INFO ("writeback test failed\n" ); } +#if defined(__ppc__) || defined(__ppc64__) +/* the test might succeed on ppc, but it's usually not reliable */ +if (radeon_no_wb ==-1 ) { + radeon_no_wb =1 ; +DRM_INFO ("not trusting writeback test due to arch quirk\n" ); + } +#endif if (radeon_no_wb ==1 ) { dev_priv->writeback_works =0 ;DRM_INFO ("writeback forced off\n" );drivers/gpu/drm/radeon/radeon_device.c +2
-2@@ -322,8 +322,8 @@ int radeon_wb_init(struct radeon_device *rdev)/* disable event_write fences */ rdev->wb.use_event = false;/* disabled via module param */ -if (radeon_no_wb ==1 ) { - rdev->wb.enabled = false; +if (radeon_no_wb !=-1 ) { + rdev->wb.enabled = !!radeon_no_wb; }else {if (rdev->flags &RADEON_IS_AGP ) {/* often unreliable on AGP */ drivers/gpu/drm/radeon/radeon_drv.c +1
-2@@ -146,7 +146,7 @@ static inline void radeon_register_atpx_handler(void) {}static inline void radeon_unregister_atpx_handler (void ) {}#endif -int radeon_no_wb; +int radeon_no_wb =-1 ;int radeon_modeset =-1 ;int radeon_dynclks =-1 ;int radeon_r4xx_atom =0 ; --1.8.2.1
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 6 lines · Alex Deucher
Quoted 4 lines · Adam Jackson
At least on an IBM Power 720, this check passes, but several piglit tests will reliably trigger GPU resets due to the ring buffer pointers not being updated. There's probably a better way to limit this to just affected machines though.
Quoted 6 lines
What radeon chips are you seeing this on? wb is more or less required on r6xx and newer and I'm not sure those generations will even work properly without writeback enabled these days. We force it to always be enabled on APUs and NI and newer asics. With KMS, wb encompasses more than just rptr writeback; it covers pretty much everything involving the GPU writing any status information to memory.
FirePro 2270, at least. Booting with no_wb=1, piglit runs to completion with no GPU resets or IB submission failures. Booting without no_wb, the following piglits go from pass to fail, all complaining that the kernel rejected CS:
no-wb wb
(info) (info)
All 7598/9587 7403/9553 glean 362/385 361/385 pointAtten pass fail texture_srgb pass fail shaders 477/533 441/533 glsl-algebraic-add-add-1 pass fail glsl-algebraic-add-add-2 pass fail glsl-algebraic-add-add-3 pass fail glsl-algebraic-sub-zero-3 pass fail glsl-algebraic-sub-zero-4 pass fail glsl-complex-subscript pass fail glsl-copy-propagation-if-1 pass fail glsl-copy-propagation-if-2 pass fail glsl-copy-propagation-if-3 pass fail glsl-copy-propagation-vector-indexing pass fail glsl-fs-atan-2 pass fail glsl-fs-dot-vec2-2 pass fail glsl-fs-log2 pass fail glsl-fs-main-return pass fail glsl-fs-max-3 pass fail glsl-fs-min-2 pass fail glsl-fs-min-3 pass fail glsl-fs-statevar-call pass fail glsl-fs-struct-equal pass fail glsl-function-chain16 pass fail glsl-implicit-conversion-02 pass fail glsl-inout-struct-01 pass fail glsl-inout-struct-02 pass fail glsl-link-varying-TexCoord pass fail glsl-link-varyings-2 pass fail glsl-uniform-initializer-4 pass fail glsl-uniform-initializer-6 pass fail glsl-uniform-initializer-7 pass fail glsl-vs-abs-neg-with-intermediate pass fail glsl-vs-clamp-1 pass fail glsl-vs-deadcode-1 pass fail glsl-vs-deadcode-2 pass fail glsl-vs-f2b pass fail glsl-vs-position-outval pass fail link-uniform-array-size pass fail loopfunc pass fail spec 5921/7801 5763/7767 !OpenGL 1.1 118/229 101/219 depthstencil-default_fb-clear pass fail getteximage-simple pass fail texwrap formats 27/50 12/40 GL_LUMINANCE12 pass fail GL_LUMINANCE16 pass fail GL_LUMINANCE4 pass fail GL_LUMINANCE4_ALPHA4 pass fail GL_LUMINANCE8 pass fail !OpenGL 1.4 11/13 9/13 triangle-rasterization pass fail triangle-rasterization-fbo pass fail ARB_depth_buffer_float 9/63 6/63 fbo-depth-GL_DEPTH32F_STENCIL8-clear pass fail fbo-depth-GL_DEPTH_COMPONENT32F-clear pass fail fbo-stencil-GL_DEPTH32F_STENCIL8-clear pass fail ARB_depth_texture 11/53 10/53 fbo-depth-GL_DEPTH_COMPONENT32-clear pass fail ARB_fragment_program 23/28 22/28 kil-swizzle pass fail ARB_framebuffer_object 14/26 13/26 fbo-deriv pass fail ARB_framebuffer_sRGB 80/81 65/81 blit renderbuffer linear downsample disabled pass fail blit renderbuffer linear msaa enabled pass fail blit renderbuffer linear single_sampled enabled pass fail blit renderbuffer linear_to_srgb scaled disabled pass fail blit renderbuffer srgb msaa disabled pass fail blit renderbuffer srgb msaa enabled pass fail blit renderbuffer srgb scaled enabled pass fail blit renderbuffer srgb single_sampled enabled pass fail blit renderbuffer srgb upsample enabled pass fail blit renderbuffer srgb_to_linear msaa disabled pass fail blit renderbuffer srgb_to_linear msaa enabled pass fail blit texture linear scaled enabled pass fail blit texture linear_to_srgb upsample disabled pass fail blit texture srgb msaa disabled pass fail blit texture srgb msaa enabled pass fail ARB_map_buffer_range 8/8 6/8 MAP_INVALIDATE_RANGE_BIT decrement-offset pass fail MAP_INVALIDATE_RANGE_BIT offset=0 pass fail ARB_sampler_objects 1/4 0/4 sampler-objects pass fail ARB_shading_language_packing 10/10 7/10 execution 10/10 7/10 built-in-functions 10/10 7/10 const-packSnorm4x8 pass fail const-unpackSnorm2x16 pass fail const-unpackUnorm2x16 pass fail ARB_texture_compression 25/40 22/40 texwrap formats bordercolor-swizzled 3/6 0/6 GL_COMPRESSED_INTENSITY, swizzled, border color only pass fail GL_COMPRESSED_LUMINANCE, swizzled, border color only pass fail GL_COMPRESSED_LUMINANCE_ALPHA, swizzled, border color pass fail only ARB_texture_cube_map 7/8 6/8 cubemap pass fail ARB_texture_rectangle 11/21 10/21 texrect_simple_arb_texrect pass fail ARB_texture_rg 42/113 19/97 texwrap formats-int 24/28 0/12 GL_R16UI pass fail GL_R32UI pass fail GL_R8I pass fail GL_R8UI pass fail GL_RG16UI pass fail GL_RG32UI pass fail GL_RG8I pass fail GL_RG8UI pass fail ARB_texture_storage 1/1 0/1 texture-storage pass fail ARB_timer_query 1/3 0/3 query GL_TIMESTAMP pass fail ATI_draw_buffers 3/3 2/3 arbfp-no-option pass fail EXT_framebuffer_multisample 267/287 259/287 bitmap 4 pass fail bitmap 6 pass fail bitmap 8 pass fail clear 2 depth pass fail clear 6 color pass fail clear 6 depth pass fail clear 6 stencil pass fail draw-buffers-alpha-to-one 4 pass fail EXT_framebuffer_object 175/289 173/289 fbo-fragcoord2 pass fail fbo-generatemipmap-filtering pass fail fbo-generatemipmap-formats 2/76 1/76 GL_LUMINANCE4_ALPHA4 pass fail fbo-readpixels-depth-formats 14/24 16/24 GL_DEPTH24_STENCIL8_EXT 3/4 2/4 GL_UNSIGNED_INT pass fail fbo-stencil-GL_STENCIL_INDEX16-clear pass fail EXT_packed_depth_stencil 13/58 11/58 fbo-depthstencil-GL_DEPTH24_STENCIL8-clear pass fail fbo-stencil-GL_DEPTH24_STENCIL8-clear pass fail EXT_texture_compression_rgtc 31/39 11/31 fbo-generatemipmap-formats 8/8 4/8 GL_COMPRESSED_RED pass fail GL_COMPRESSED_RED_GREEN_RGTC2_EXT pass fail GL_COMPRESSED_RED_RGTC1_EXT pass fail GL_COMPRESSED_RG pass fail texwrap formats 12/12 0/4 GL_COMPRESSED_RED_RGTC1 pass fail GL_COMPRESSED_RG_RGTC2 pass fail GL_COMPRESSED_SIGNED_RED_RGTC1 pass fail GL_COMPRESSED_SIGNED_RG_RGTC2 pass fail texwrap formats bordercolor 4/4 0/4 GL_COMPRESSED_RED_RGTC1, border color only pass fail GL_COMPRESSED_RG_RGTC2, border color only pass fail GL_COMPRESSED_SIGNED_RED_RGTC1, border color only pass fail GL_COMPRESSED_SIGNED_RG_RGTC2, border color only pass fail EXT_transform_feedback 45/279 44/279 discard-bitmap pass fail glsl-1.10 1540/1636 1529/1636 execution 1295/1391 1286/1391 fs-inline-notequal pass fail fs-saturate-pow pass fail maximums 12/12 8/12 gl_MaxCombinedTextureImageUnits pass fail gl_MaxFragmentUniformComponents pass fail gl_MaxTextureImageUnits pass fail gl_MaxVertexAttribs pass fail vs-mat2-array-assignment pass fail vs-saturate-exp2 pass fail vs-saturate-pow pass fail linker 18/18 16/18 access-builtin-global-from-fn-unknown-to-main pass fail override-builtin-uniform-01 pass fail glsl-1.20 2124/2183 2097/2183 execution 788/845 761/845 maximums 12/12 7/12 gl_MaxClipPlanes pass fail gl_MaxCombinedTextureImageUnits pass fail gl_MaxTextureCoords pass fail gl_MaxVaryingFloats pass fail gl_MaxVertexTextureImageUnits pass fail uniform-initializer 64/64 44/64 fs-bool-set-by-other-stage pass fail fs-float-array pass fail fs-float-from-const pass fail fs-float-set-by-other-stage pass fail fs-int pass fail fs-int-from-const pass fail fs-int-set-by-other-stage pass fail fs-mat3-set-by-other-stage pass fail fs-mat4-from-const pass fail fs-mat4-set-by-API pass fail fs-mat4-set-by-other-stage pass fail fs-structure-array pass fail vs-bool-from-const pass fail vs-float pass fail vs-float-array pass fail vs-mat2 pass fail vs-mat3 pass fail vs-mat4 pass fail vs-mat4-from-const pass fail vs-mat4-set-by-API pass fail vs-all-equal-bool-array pass fail vs-assign-varied-struct pass fail glsl-1.30 468/604 455/604 execution 465/601 452/601 clipping 20/20 18/20 fs-clip-distance-interpolated pass fail vs-clip-distance-explicitly-sized pass fail fs-discard-exit-1 pass fail fs-discard-exit-2 pass fail fs-increment-int pass fail fs-multiply-const-ivec4 pass fail maximums 13/13 9/13 gl_MaxClipPlanes pass fail gl_MaxCombinedTextureImageUnits pass fail gl_MaxTextureImageUnits pass fail gl_MaxVaryingFloats pass fail qualifiers 1/1 0/1 vs-out-conversion-ivec4-to-vec4 pass fail uniform-initializer 8/8 6/8 fs-uint-from-const pass fail vs-uint pass fail
- ajax
Quoted 14 lines · Adam Jackson
Quoted 6 lines · Alex Deucher
Quoted 4 lines · Adam Jackson
At least on an IBM Power 720, this check passes, but several piglit tests will reliably trigger GPU resets due to the ring buffer pointers not being updated. There's probably a better way to limit this to just affected machines though.
Quoted 6 lines
What radeon chips are you seeing this on? wb is more or less required on r6xx and newer and I'm not sure those generations will even work properly without writeback enabled these days. We force it to always be enabled on APUs and NI and newer asics. With KMS, wb encompasses more than just rptr writeback; it covers pretty much everything involving the GPU writing any status information to memory.
Quoted 4 lines
FirePro 2270, at least. Booting with no_wb=1, piglit runs to completion with no GPU resets or IB submission failures. Booting without
no_wb, the following piglits go from pass to fail, all complaining that the kernel rejected CS:
Weird. I wonder if there is an issue with cache snoops on PPC. We currently use the gart in cached mode (GPU snoops CPU cache) with cached pages. I wonder if we need to use uncached pages on PPC.
Alex
Quoted 3 lines · Alex Deucher
Weird. I wonder if there is an issue with cache snoops on PPC. We currently use the gart in cached mode (GPU snoops CPU cache) with cached pages. I wonder if we need to use uncached pages on PPC.
There is no such issue and no known bugs with DMA writes on those PCIe host bridges (and they do get hammered pretty bad here).
This needs further investigation by the lab/hw guys to find out what's actually happening on the bus and the host bridge.
Thadeu, Kleber: Jerome suggested writing a test case in userspace that continuously writes to a spare scratch register (thus triggering the corresponding writeback DMA) and checks the memory location to compare the writeback value (using a debugfs file for example, or mmap).
Can you guys do something like that ? Then we need the analyzer on and/or the lab guys to look at the fabric trace & PHB trace.
Ben.
Quoted 9 lines · Benjamin Herrenschmidt
Quoted 3 lines · Alex Deucher
Weird. I wonder if there is an issue with cache snoops on PPC. We currently use the gart in cached mode (GPU snoops CPU cache) with cached pages. I wonder if we need to use uncached pages on PPC.
There is no such issue and no known bugs with DMA writes on those PCIe host bridges (and they do get hammered pretty bad here).
Quoted 8 lines
This needs further investigation by the lab/hw guys to find out what's actually happening on the bus and the host bridge.
Thadeu, Kleber: Jerome suggested writing a test case in userspace that continuously writes to a spare scratch register (thus triggering the corresponding writeback DMA) and checks the memory location to compare the writeback value (using a debugfs file for example, or mmap).
I can look into that.
Thanks,
Kleber
Quoted 6 lines
Can you guys do something like that ? Then we need the analyzer on and/or the lab guys to look at the fabric trace & PHB trace.
Ben.
Signature · 2 lines
Kleber Sacilotto de Souza IBM Linux Technology Center
Quoted 13 lines · Kleber Sacilotto de Souza
Quoted 12 lines · Benjamin Herrenschmidt
Quoted 3 lines · Alex Deucher
Weird. I wonder if there is an issue with cache snoops on PPC. We currently use the gart in cached mode (GPU snoops CPU cache) with cached pages. I wonder if we need to use uncached pages on PPC.
There is no such issue and no known bugs with DMA writes on those PCIe host bridges (and they do get hammered pretty bad here).
This needs further investigation by the lab/hw guys to find out what's actually happening on the bus and the host bridge.
Quoted 7 lines
Quoted 5 lines
Thadeu, Kleber: Jerome suggested writing a test case in userspace that continuously writes to a spare scratch register (thus triggering the corresponding writeback DMA) and checks the memory location to compare the writeback value (using a debugfs file for example, or mmap).
I can look into that.
Any news ?
Ben.
Quoted 13 lines
Thanks,
Kleber
Quoted 6 lines
Can you guys do something like that ? Then we need the analyzer on and/or the lab guys to look at the fabric trace & PHB trace.
Ben.
Quoted 13 lines · Benjamin Herrenschmidt
Quoted 12 lines · Kleber Sacilotto de Souza
Quoted 11 lines · Benjamin Herrenschmidt
Quoted 3 lines · Alex Deucher
Weird. I wonder if there is an issue with cache snoops on PPC. We currently use the gart in cached mode (GPU snoops CPU cache) with cached pages. I wonder if we need to use uncached pages on PPC.
There is no such issue and no known bugs with DMA writes on those PCIe host bridges (and they do get hammered pretty bad here).
This needs further investigation by the lab/hw guys to find out what's actually happening on the bus and the host bridge.
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Thadeu, Kleber: Jerome suggested writing a test case in userspace that continuously writes to a spare scratch register (thus triggering the corresponding writeback DMA) and checks the memory location to compare the writeback value (using a debugfs file for example, or mmap).
I can look into that.
Any news ?
Only now I've got the bandwidth to actually take a look at this. I will start to write some code and let you guys know of the results.
Thanks,
Kleber
Quoted 15 lines
Ben.
Quoted 11 lines
Thanks,
Kleber
Quoted 6 lines
Can you guys do something like that ? Then we need the analyzer on and/or the lab guys to look at the fabric trace & PHB trace.
Ben.
Signature · 2 lines
Kleber Sacilotto de Souza IBM Linux Technology Center
Quoted 11 lines · Kleber Sacilotto de Souza
Quoted 10 lines · Benjamin Herrenschmidt
Quoted 9 lines · Kleber Sacilotto de Souza
Quoted 8 lines · Benjamin Herrenschmidt
Quoted 3 lines · Alex Deucher
Weird. I wonder if there is an issue with cache snoops on PPC. We currently use the gart in cached mode (GPU snoops CPU cache) with cached pages. I wonder if we need to use uncached pages on PPC.
There is no such issue and no known bugs with DMA writes on those PCIe host bridges (and they do get hammered pretty bad here).
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
This needs further investigation by the lab/hw guys to find out what's actually happening on the bus and the host bridge.
Thadeu, Kleber: Jerome suggested writing a test case in userspace that continuously writes to a spare scratch register (thus triggering the corresponding writeback DMA) and checks the memory location to compare the writeback value (using a debugfs file for example, or mmap).
I was not able to reproduce the issue with this method, even after a weekend run.
However, doing some more investigation it seems the problem is here, where we read the ring rptr:
u32 radeon_ring_generic_get_rptr(struct radeon_device *rdev,
struct radeon_ring *ring)
{
u32 rptr;
if (rdev->wb.enabled)
rptr = le32_to_cpu(rdev->wb.wb[ring->rptr_offs/4]);
else
rptr = RREG32(ring->rptr_reg);
return rptr;
}I realized that the DMA'ed rptr value has always the opposite byte order from the MMIO value. Since RREG32 already returns the register value on the CPU byte order, it seems we don't need to byte-swap the DMA'ed value. If I remove the le32_to_cpu() call and use the DMA'ed value directly, I don't get the IB scheduling failures and piglit results are the same as with writeback disabled.
Is the adapter chipset swapping the bytes before doing the DMA to a big-endian host?
Signature · 2 lines
Kleber Sacilotto de Souza IBM Linux Technology Center
Quoted 52 lines · Kleber Sacilotto de Souza
Quoted 16 lines · Kleber Sacilotto de Souza
Quoted 14 lines · Benjamin Herrenschmidt
Quoted 12 lines · Kleber Sacilotto de Souza
Quoted 10 lines · Benjamin Herrenschmidt
Quoted 3 lines · Alex Deucher
Weird. I wonder if there is an issue with cache snoops on PPC. We currently use the gart in cached mode (GPU snoops CPU cache) with cached pages. I wonder if we need to use uncached pages on PPC.
There is no such issue and no known bugs with DMA writes on those PCIe host bridges (and they do get hammered pretty bad here).
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
This needs further investigation by the lab/hw guys to find out what's actually happening on the bus and the host bridge.
Thadeu, Kleber: Jerome suggested writing a test case in userspace that continuously writes to a spare scratch register (thus triggering the corresponding writeback DMA) and checks the memory location to compare the writeback value (using a debugfs file for example, or mmap).
I was not able to reproduce the issue with this method, even after a weekend run.
However, doing some more investigation it seems the problem is here, where we read the ring rptr:
u32 radeon_ring_generic_get_rptr(struct
radeon_device*rdev,
structradeon_ring*ring){ u32 rptr; if (rdev->wb.enabled) rptr = le32_to_cpu(rdev->wb.wb[ring->rptr_offs/4]); else rptr = RREG32(ring->rptr_reg); return rptr; }I realized that the DMA'ed rptr value has always the opposite byte order from the MMIO value. Since RREG32 already returns the register value on the CPU byte order, it seems we don't need to byte-swap the DMA'ed value. If I remove the
le32_to_cpu()call and use the DMA'ed value directly, I don't get the IB scheduling failures and piglit results are the same as with writeback disabled.
Quoted 2 lines
Is the adapter chipset swapping the bytes before doing the DMA to a big-endian host?
Setting CP_RB_CNTL.BUF_SWAP causes the CP to use the selected byte swapping for just about everything accessed by the CP (rptr writeback, indirect buffers, etc.). Looks like the DMA ring supports and enables rptr writeback as well (DMA_RB_CNTL.DMA_RPTR_WRITEBACK_SWAP_ENABLE) so I think we can drop the swapping of the rptr writeback.
Alex
Quoted 7 lines
--
Kleber Sacilotto de Souza
IBM Linux Technology Center
Quoted 54 lines · Alex Deucher
Quoted 52 lines · Kleber Sacilotto de Souza
Quoted 16 lines · Kleber Sacilotto de Souza
Quoted 14 lines · Benjamin Herrenschmidt
Quoted 12 lines · Kleber Sacilotto de Souza
Quoted 10 lines · Benjamin Herrenschmidt
Quoted 3 lines · Alex Deucher
Weird. I wonder if there is an issue with cache snoops on PPC. We currently use the gart in cached mode (GPU snoops CPU cache) with cached pages. I wonder if we need to use uncached pages on PPC.
There is no such issue and no known bugs with DMA writes on those PCIe host bridges (and they do get hammered pretty bad here).
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
This needs further investigation by the lab/hw guys to find out what's actually happening on the bus and the host bridge.
Thadeu, Kleber: Jerome suggested writing a test case in userspace that continuously writes to a spare scratch register (thus triggering the corresponding writeback DMA) and checks the memory location to compare the writeback value (using a debugfs file for example, or mmap).
I was not able to reproduce the issue with this method, even after a weekend run.
However, doing some more investigation it seems the problem is here, where we read the ring rptr:
u32 radeon_ring_generic_get_rptr(struct
radeon_device*rdev,
structradeon_ring*ring){ u32 rptr; if (rdev->wb.enabled) rptr = le32_to_cpu(rdev->wb.wb[ring->rptr_offs/4]); else rptr = RREG32(ring->rptr_reg); return rptr; }I realized that the DMA'ed rptr value has always the opposite byte order from the MMIO value. Since RREG32 already returns the register value on the CPU byte order, it seems we don't need to byte-swap the DMA'ed value. If I remove the
le32_to_cpu()call and use the DMA'ed value directly, I don't get the IB scheduling failures and piglit results are the same as with writeback disabled.
Quoted 9 lines
Quoted 2 lines
Is the adapter chipset swapping the bytes before doing the DMA to a big-endian host?
Setting CP_RB_CNTL.BUF_SWAP causes the CP to use the selected byte swapping for just about everything accessed by the CP (rptr writeback, indirect buffers, etc.). Looks like the DMA ring supports and enables rptr writeback as well (DMA_RB_CNTL.DMA_RPTR_WRITEBACK_SWAP_ENABLE) so I think we can drop the swapping of the rptr writeback.
Obvious patch attached.
Alex
Quoted 9 lines
Alex
Quoted 7 lines
--
Kleber Sacilotto de Souza
IBM Linux Technology Center
From 0f7705c378a14060552df19c0e724e47632da4d8 Mon Sep 17 00:00:00 2001
From: Alex Deucher <[email protected]>
Date: Wed, 4 Dec 2013 19:02:08 -0500
Subject: [PATCH] drm/radeon: don't byteswap readback of rptr writeback
We already enable byteswapping of the rptr writeback in the hw. Fixes incorrect rptr readback on BE systems.
--- drivers/gpu/drm/radeon/radeon_ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_ring.c +1 -1
@@ -338,7 +338,7 @@ u32 radeon_ring_generic_get_rptr(struct radeon_device *rdev,u32 rptr;if (rdev->wb.enabled) - rptr =le32_to_cpu (rdev->wb.wb[ring->rptr_offs/4 ]); + rptr = rdev->wb.wb[ring->rptr_offs/4 ];else rptr =RREG32 (ring->rptr_reg);
Signature · 1 line
1.8.3.1
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 8 lines · Alex Deucher
Quoted 6 lines
Setting CP_RB_CNTL.BUF_SWAP causes the CP to use the selected byte swapping for just about everything accessed by the CP (rptr writeback, indirect buffers, etc.). Looks like the DMA ring supports and enables rptr writeback as well (DMA_RB_CNTL.DMA_RPTR_WRITEBACK_SWAP_ENABLE) so I think we can drop the swapping of the rptr writeback.
Obvious patch attached.
This works all the way back to r300 ?
Cheers,
Ben.
Quoted 9 lines · Benjamin Herrenschmidt
Quoted 7 lines · Alex Deucher
Quoted 6 lines
Setting CP_RB_CNTL.BUF_SWAP causes the CP to use the selected byte swapping for just about everything accessed by the CP (rptr writeback, indirect buffers, etc.). Looks like the DMA ring supports and enables rptr writeback as well (DMA_RB_CNTL.DMA_RPTR_WRITEBACK_SWAP_ENABLE) so I think we can drop the swapping of the rptr writeback.
Quoted 3 lines
Quoted 1 line
Obvious patch attached.
This works all the way back to r300 ?
I don't think so, as I have writeback working without this patch on the RV350 in this PowerBook. So I think this function needs to be split, probably between R600 and older.
Also, there's more code at least potentially affected by this, e.g. in:
* cik_compute_ring_get_rptr(), cik_compute_ring_get_wptr(), cik_compute_ring_set_wptr(), cik_get_ih_wptr()
* si_get_ih_wptr()
* evergreen_get_ih_wptr()
* r600_get_ih_wptr()
* radeon_fence_write(), radeon_fence_read()
* radeon_ring_backup()
Signature · 7 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 10 lines · Michel Dänzer
Quoted 9 lines · Benjamin Herrenschmidt
Quoted 7 lines · Alex Deucher
Quoted 6 lines
Setting CP_RB_CNTL.BUF_SWAP causes the CP to use the selected byte swapping for just about everything accessed by the CP (rptr writeback, indirect buffers, etc.). Looks like the DMA ring supports and enables rptr writeback as well (DMA_RB_CNTL.DMA_RPTR_WRITEBACK_SWAP_ENABLE) so I think we can drop the swapping of the rptr writeback.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Obvious patch attached.
This works all the way back to r300 ?
I don't think so, as I have writeback working without this patch on the RV350 in this PowerBook. So I think this function needs to be split, probably between R600 and older.
Or can we tell it to not swap (setup code) and continue doing le32_to_cpu in the kernel ? Sounds better to me.
Quoted 9 lines
Also, there's more code at least potentially affected by this, e.g. in:
*
cik_compute_ring_get_rptr(),cik_compute_ring_get_wptr(),cik_compute_ring_set_wptr(),cik_get_ih_wptr()
*si_get_ih_wptr()
*evergreen_get_ih_wptr()
*r600_get_ih_wptr()
*radeon_fence_write(),radeon_fence_read()
*radeon_ring_backup()
Yeah I'd say just don't swap, write LE to memory and let the kernel use the right leXX_to_cpu.
HW swapping is evil :-)
Cheers,
Ben.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 32 lines · Benjamin Herrenschmidt
Quoted 10 lines · Michel Dänzer
Quoted 9 lines · Benjamin Herrenschmidt
Quoted 7 lines · Alex Deucher
Quoted 6 lines
Setting CP_RB_CNTL.BUF_SWAP causes the CP to use the selected byte swapping for just about everything accessed by the CP (rptr writeback, indirect buffers, etc.). Looks like the DMA ring supports and enables rptr writeback as well (DMA_RB_CNTL.DMA_RPTR_WRITEBACK_SWAP_ENABLE) so I think we can drop the swapping of the rptr writeback.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Obvious patch attached.
This works all the way back to r300 ?
I don't think so, as I have writeback working without this patch on the RV350 in this PowerBook. So I think this function needs to be split, probably between R600 and older.
Or can we tell it to not swap (setup code) and continue doing
le32_to_cpuin the kernel ? Sounds better to me.Quoted 9 lines
Also, there's more code at least potentially affected by this, e.g. in:
*
cik_compute_ring_get_rptr(),cik_compute_ring_get_wptr(),cik_compute_ring_set_wptr(),cik_get_ih_wptr()
*si_get_ih_wptr()
*evergreen_get_ih_wptr()
*r600_get_ih_wptr()
*radeon_fence_write(),radeon_fence_read()
*radeon_ring_backup()
Quoted 4 lines
Yeah I'd say just don't swap, write LE to memory and let the kernel use the right
leXX_to_cpu.HW swapping is evil :-)
Well, we'd need to start swapping indirect buffers and the ring as well then which would get tricky as the CP at least does not have separate swapping controls for different things. Probably easier to fix up as appropriate for different asic families. We have function pointers for the rtpr and wptr fetchers now, so we can do this pretty cleanly.
Alex
Quoted 5 lines
Cheers,
Ben.
Quoted 8 lines · Alex Deucher
Well, we'd need to start swapping indirect buffers and the ring as well then which would get tricky as the CP at least does not have separate swapping controls for different things. Probably easier to fix up as appropriate for different asic families. We have function pointers for the rtpr and wptr fetchers now, so we can do this pretty cleanly.
Alex
Alex,
Are you going to send a patch to fix this?
If not, I don't have the knowledge of which asic families will need this fix, but if you inform me what needs to be done I can write the patch.
Thanks,
Signature · 2 lines
Kleber Sacilotto de Souza IBM Linux Technology Center
Quoted 12 lines · Kleber Sacilotto de Souza
Quoted 9 lines · Alex Deucher
Well, we'd need to start swapping indirect buffers and the ring as well then which would get tricky as the CP at least does not have separate swapping controls for different things. Probably easier to fix up as appropriate for different asic families. We have function pointers for the rtpr and wptr fetchers now, so we can do this pretty cleanly.
Alex
Quoted 6 lines
Alex,
Are you going to send a patch to fix this?
If not, I don't have the knowledge of which asic families will need this fix, but if you inform me what needs to be done I can write the patch.
I'll try and send a patch out in the next few days.
Alex
Quoted 9 lines
Thanks,
--
Kleber Sacilotto de Souza
IBM Linux Technology Center
Quoted 14 lines · Alex Deucher
Quoted 12 lines · Kleber Sacilotto de Souza
Quoted 9 lines · Alex Deucher
Well, we'd need to start swapping indirect buffers and the ring as well then which would get tricky as the CP at least does not have separate swapping controls for different things. Probably easier to fix up as appropriate for different asic families. We have function pointers for the rtpr and wptr fetchers now, so we can do this pretty cleanly.
Alex
Quoted 8 lines
Quoted 6 lines
Alex,
Are you going to send a patch to fix this?
If not, I don't have the knowledge of which asic families will need this fix, but if you inform me what needs to be done I can write the patch.
I'll try and send a patch out in the next few days.
Patch attached. Compile tested only at the moment.
Alex
Quoted 12 lines
Alex
Quoted 9 lines
Thanks,
--
Kleber Sacilotto de Souza
IBM Linux Technology Center
From 89b31dd54d2818e16e239d840aeda4007d5fedc6 Mon Sep 17 00:00:00 2001
From: Alex Deucher <[email protected]>
Date: Mon, 9 Dec 2013 19:44:30 -0500
Subject: [PATCH] drm/radeon: remove generic rptr/wptr functions
Fill in asic family specific versions rather than using the generic version. This lets us handle asic specific differences more easily. In this case, we disable sw swapping of the rtpr writeback value on r6xx+ since the hw does it for us. Fixes bogus rptr readback on BE systems.
--- drivers/gpu/drm/radeon/cik.c | 52 ++++++++++++++++++--------- drivers/gpu/drm/radeon/cik_sdma.c | 69 ++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/radeon/evergreen.c | 3 -- drivers/gpu/drm/radeon/ni.c | 69 +++++++++++++++++++++++++++++++----- drivers/gpu/drm/radeon/ni_dma.c | 69 ++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/radeon/r100.c | 31 +++++++++++++++- drivers/gpu/drm/radeon/r600.c | 32 +++++++++++++++-- drivers/gpu/drm/radeon/r600_dma.c | 13 +++++-- drivers/gpu/drm/radeon/radeon.h | 4 +-- drivers/gpu/drm/radeon/radeon_asic.c | 66 +++++++++++++++++----------------- drivers/gpu/drm/radeon/radeon_asic.h | 57 ++++++++++++++++++++++------- drivers/gpu/drm/radeon/radeon_ring.c | 40 ++------------------- drivers/gpu/drm/radeon/rv770.c | 3 -- drivers/gpu/drm/radeon/si.c | 8 ----- 14 files changed, 386 insertions(+), 130 deletions(-)
drivers/gpu/drm/radeon/cik.c +36 -16
@@ -4015,15 +4015,43 @@ static int cik_cp_gfx_resume(struct radeon_device *rdev)return 0 ; } -u32 cik_compute_ring_get_rptr (struct radeon_device *rdev, -struct radeon_ring *ring) +u32 cik_gfx_get_rptr (struct radeon_device *rdev, +struct radeon_ring *ring) {u32 rptr; +if (rdev->wb.enabled) + rptr = rdev->wb.wb[ring->rptr_offs/4 ]; +else + rptr =RREG32 (CP_RB0_RPTR ); + +return rptr; +} + +u32 cik_gfx_get_wptr (struct radeon_device *rdev, +struct radeon_ring *ring) +{ +u32 wptr; + + wptr =RREG32 (CP_RB0_WPTR ); +return wptr; +} + +void cik_gfx_set_wptr (struct radeon_device *rdev, +struct radeon_ring *ring) +{ +WREG32 (CP_RB0_WPTR , ring->wptr); + (void )RREG32 (CP_RB0_WPTR ); +} + +u32 cik_compute_get_rptr (struct radeon_device *rdev, +struct radeon_ring *ring) +{ +u32 rptr;if (rdev->wb.enabled) { - rptr =le32_to_cpu (rdev->wb.wb[ring->rptr_offs/4 ]); + rptr = rdev->wb.wb[ring->rptr_offs/4 ]; }else {mutex_lock (&rdev->srbm_mutex);cik_srbm_select (rdev, ring->me, ring->pipe, ring->queue,0 );
@@ -4035,13 +4063,13 @@ u32 cik_compute_ring_get_rptr(struct radeon_device *rdev,return rptr; } -u32 cik_compute_ring_get_wptr (struct radeon_device *rdev, -struct radeon_ring *ring) +u32 cik_compute_get_wptr (struct radeon_device *rdev, +struct radeon_ring *ring) {u32 wptr;if (rdev->wb.enabled) { - wptr =le32_to_cpu (rdev->wb.wb[ring->wptr_offs/4 ]); + wptr = rdev->wb.wb[ring->wptr_offs/4 ]; }else {mutex_lock (&rdev->srbm_mutex);cik_srbm_select (rdev, ring->me, ring->pipe, ring->queue,0 );
@@ -4053,8 +4081,8 @@ u32 cik_compute_ring_get_wptr(struct radeon_device *rdev,return wptr; } -void cik_compute_ring_set_wptr (struct radeon_device *rdev, -struct radeon_ring *ring) +void cik_compute_set_wptr (struct radeon_device *rdev, +struct radeon_ring *ring) { rdev->wb.wb[ring->wptr_offs/4 ] =cpu_to_le32 (ring->wptr);WDOORBELL32 (ring->doorbell_index, ring->wptr);
@@ -7625,7 +7653,6 @@ static int cik_startup(struct radeon_device *rdev) ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX ]; r =radeon_ring_init (rdev, ring, ring->ring_size,RADEON_WB_CP_RPTR_OFFSET , -CP_RB0_RPTR ,CP_RB0_WPTR ,PACKET3 (PACKET3_NOP ,0x3FFF ));if (r)return r;
@@ -7634,7 +7661,6 @@ static int cik_startup(struct radeon_device *rdev)/* type-2 packets are deprecated on MEC, use type-3 instead */ ring = &rdev->ring[CAYMAN_RING_TYPE_CP1_INDEX ]; r =radeon_ring_init (rdev, ring, ring->ring_size,RADEON_WB_CP1_RPTR_OFFSET , -CP_HQD_PQ_RPTR ,CP_HQD_PQ_WPTR ,PACKET3 (PACKET3_NOP ,0x3FFF ));if (r)return r;
@@ -7646,7 +7672,6 @@ static int cik_startup(struct radeon_device *rdev)/* type-2 packets are deprecated on MEC, use type-3 instead */ ring = &rdev->ring[CAYMAN_RING_TYPE_CP2_INDEX ]; r =radeon_ring_init (rdev, ring, ring->ring_size,RADEON_WB_CP2_RPTR_OFFSET , -CP_HQD_PQ_RPTR ,CP_HQD_PQ_WPTR ,PACKET3 (PACKET3_NOP ,0x3FFF ));if (r)return r;
@@ -7658,16 +7683,12 @@ static int cik_startup(struct radeon_device *rdev) ring = &rdev->ring[R600_RING_TYPE_DMA_INDEX ]; r =radeon_ring_init (rdev, ring, ring->ring_size,R600_WB_DMA_RPTR_OFFSET , -SDMA0_GFX_RB_RPTR +SDMA0_REGISTER_OFFSET , -SDMA0_GFX_RB_WPTR +SDMA0_REGISTER_OFFSET ,SDMA_PACKET (SDMA_OPCODE_NOP ,0 ,0 ));if (r)return r; ring = &rdev->ring[CAYMAN_RING_TYPE_DMA1_INDEX ]; r =radeon_ring_init (rdev, ring, ring->ring_size,CAYMAN_WB_DMA1_RPTR_OFFSET , -SDMA0_GFX_RB_RPTR +SDMA1_REGISTER_OFFSET , -SDMA0_GFX_RB_WPTR +SDMA1_REGISTER_OFFSET ,SDMA_PACKET (SDMA_OPCODE_NOP ,0 ,0 ));if (r)return r;
@@ -7683,7 +7704,6 @@ static int cik_startup(struct radeon_device *rdev) ring = &rdev->ring[R600_RING_TYPE_UVD_INDEX ];if (ring->ring_size) { r =radeon_ring_init (rdev, ring, ring->ring_size,0 , -UVD_RBC_RB_RPTR ,UVD_RBC_RB_WPTR ,RADEON_CP_PACKET2 );if (!r) r =uvd_v1_0_init (rdev);
drivers/gpu/drm/radeon/cik_sdma.c +69 -0
75 lines not on this page · raw message
drivers/gpu/drm/radeon/evergreen.c +0 -3
@@ -5199,14 +5199,12 @@ static int evergreen_startup(struct radeon_device *rdev) ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX ]; r =radeon_ring_init (rdev, ring, ring->ring_size,RADEON_WB_CP_RPTR_OFFSET , -R600_CP_RB_RPTR ,R600_CP_RB_WPTR ,RADEON_CP_PACKET2 );if (r)return r; ring = &rdev->ring[R600_RING_TYPE_DMA_INDEX ]; r =radeon_ring_init (rdev, ring, ring->ring_size,R600_WB_DMA_RPTR_OFFSET , -DMA_RB_RPTR ,DMA_RB_WPTR ,DMA_PACKET (DMA_PACKET_NOP ,0 ,0 ));if (r)return r;
@@ -5224,7 +5222,6 @@ static int evergreen_startup(struct radeon_device *rdev) ring = &rdev->ring[R600_RING_TYPE_UVD_INDEX ];if (ring->ring_size) { r =radeon_ring_init (rdev, ring, ring->ring_size,0 , -UVD_RBC_RB_RPTR ,UVD_RBC_RB_WPTR ,RADEON_CP_PACKET2 );if (!r) r =uvd_v1_0_init (rdev);
drivers/gpu/drm/radeon/ni.c +61 -8
111 lines not on this page · raw message
drivers/gpu/drm/radeon/ni_dma.c +69 -0
75 lines not on this page · raw message
drivers/gpu/drm/radeon/r100.c +30 -1
@@ -1050,6 +1050,36 @@ static int r100_cp_init_microcode(struct radeon_device *rdev)return err; } +u32 r100_gfx_get_rptr (struct radeon_device *rdev, +struct radeon_ring *ring) +{ +u32 rptr; + +if (rdev->wb.enabled) + rptr =le32_to_cpu (rdev->wb.wb[ring->rptr_offs/4 ]); +else + rptr =RREG32 (RADEON_CP_RB_RPTR ); + +return rptr; +} + +u32 r100_gfx_get_wptr (struct radeon_device *rdev, +struct radeon_ring *ring) +{ +u32 wptr; + + wptr =RREG32 (RADEON_CP_RB_WPTR ); + +return wptr; +} + +void r100_gfx_set_wptr (struct radeon_device *rdev, +struct radeon_ring *ring) +{ +WREG32 (RADEON_CP_RB_WPTR , ring->wptr); + (void )RREG32 (RADEON_CP_RB_WPTR ); +} +static void r100_cp_load_microcode (struct radeon_device *rdev) {const __be32 *fw_data;
@@ -1102,7 +1132,6 @@ int r100_cp_init(struct radeon_device *rdev, unsigned ring_size) ring_size = (1 << (rb_bufsz +1 )) *4 ;r100_cp_load_microcode (rdev); r =radeon_ring_init (rdev, ring, ring_size,RADEON_WB_CP_RPTR_OFFSET , -RADEON_CP_RB_RPTR ,RADEON_CP_RB_WPTR ,RADEON_CP_PACKET2 );if (r) {return r;
drivers/gpu/drm/radeon/r600.c +30 -2
@@ -2382,6 +2382,36 @@ out:return err; } +u32 r600_gfx_get_rptr (struct radeon_device *rdev, +struct radeon_ring *ring) +{ +u32 rptr; + +if (rdev->wb.enabled) + rptr = rdev->wb.wb[ring->rptr_offs/4 ]; +else + rptr =RREG32 (R600_CP_RB_RPTR ); + +return rptr; +} + +u32 r600_gfx_get_wptr (struct radeon_device *rdev, +struct radeon_ring *ring) +{ +u32 wptr; + + wptr =RREG32 (R600_CP_RB_WPTR ); + +return wptr; +} + +void r600_gfx_set_wptr (struct radeon_device *rdev, +struct radeon_ring *ring) +{ +WREG32 (R600_CP_RB_WPTR , ring->wptr); + (void )RREG32 (R600_CP_RB_WPTR ); +} +static int r600_cp_load_microcode (struct radeon_device *rdev) {const __be32 *fw_data;
@@ -2826,14 +2856,12 @@ static int r600_startup(struct radeon_device *rdev) ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX ]; r =radeon_ring_init (rdev, ring, ring->ring_size,RADEON_WB_CP_RPTR_OFFSET , -R600_CP_RB_RPTR ,R600_CP_RB_WPTR ,RADEON_CP_PACKET2 );if (r)return r; ring = &rdev->ring[R600_RING_TYPE_DMA_INDEX ]; r =radeon_ring_init (rdev, ring, ring->ring_size,R600_WB_DMA_RPTR_OFFSET , -DMA_RB_RPTR ,DMA_RB_WPTR ,DMA_PACKET (DMA_PACKET_NOP ,0 ,0 ,0 ));if (r)return r;
drivers/gpu/drm/radeon/r600_dma.c +10 -3
@@ -51,7 +51,14 @@ u32 r600_gpu_check_soft_reset(struct radeon_device *rdev);uint32_t r600_dma_get_rptr (struct radeon_device *rdev,struct radeon_ring *ring) { -return (radeon_ring_generic_get_rptr (rdev, ring) &0x3fffc ) >>2 ; +u32 rptr; + +if (rdev->wb.enabled) + rptr = rdev->wb.wb[ring->rptr_offs/4 ]; +else + rptr =RREG32 (DMA_RB_RPTR ); + +return (rptr &0x3fffc ) >>2 ; }/**
@@ -65,7 +72,7 @@ uint32_t r600_dma_get_rptr(struct radeon_device *rdev,uint32_t r600_dma_get_wptr (struct radeon_device *rdev,struct radeon_ring *ring) { -return (RREG32 (ring->wptr_reg) &0x3fffc ) >>2 ; +return (RREG32 (DMA_RB_WPTR ) &0x3fffc ) >>2 ; }/**
@@ -79,7 +86,7 @@ uint32_t r600_dma_get_wptr(struct radeon_device *rdev,void r600_dma_set_wptr (struct radeon_device *rdev,struct radeon_ring *ring) { -WREG32 (ring->wptr_reg, (ring->wptr <<2 ) &0x3fffc ); +WREG32 (DMA_RB_WPTR , (ring->wptr <<2 ) &0x3fffc ); }/**
drivers/gpu/drm/radeon/radeon.h +1 -3
@@ -779,13 +779,11 @@ struct radeon_ring {volatile uint32_t *ring;unsigned rptr;unsigned rptr_offs; -unsigned rptr_reg;unsigned rptr_save_reg;u64 next_rptr_gpu_addr;volatile u32 *next_rptr_cpu_addr;unsigned wptr;unsigned wptr_old; -unsigned wptr_reg;unsigned ring_size;unsigned ring_free_dw;int count_dw;
@@ -949,7 +947,7 @@ unsigned radeon_ring_backup(struct radeon_device *rdev, struct radeon_ring *ringint radeon_ring_restore (struct radeon_device *rdev,struct radeon_ring *ring,unsigned size,uint32_t *data);int radeon_ring_init (struct radeon_device *rdev,struct radeon_ring *cp,unsigned ring_size, -unsigned rptr_offs,unsigned rptr_reg,unsigned wptr_reg,u32 nop); +unsigned rptr_offs,u32 nop);void radeon_ring_fini (struct radeon_device *rdev,struct radeon_ring *cp);
drivers/gpu/drm/radeon/radeon_asic.c +33 -33
132 lines not on this page · raw message
drivers/gpu/drm/radeon/radeon_asic.h +44 -13
87 lines not on this page · raw message
drivers/gpu/drm/radeon/radeon_ring.c +3 -37
@@ -332,36 +332,6 @@ bool radeon_ring_supports_scratch_reg(struct radeon_device *rdev, } } -u32 radeon_ring_generic_get_rptr (struct radeon_device *rdev, -struct radeon_ring *ring) -{ -u32 rptr; - -if (rdev->wb.enabled) - rptr =le32_to_cpu (rdev->wb.wb[ring->rptr_offs/4 ]); -else - rptr =RREG32 (ring->rptr_reg); - -return rptr; -} - -u32 radeon_ring_generic_get_wptr (struct radeon_device *rdev, -struct radeon_ring *ring) -{ -u32 wptr; - - wptr =RREG32 (ring->wptr_reg); - -return wptr; -} - -void radeon_ring_generic_set_wptr (struct radeon_device *rdev, -struct radeon_ring *ring) -{ -WREG32 (ring->wptr_reg, ring->wptr); - (void )RREG32 (ring->wptr_reg); -} -/** * radeon_ring_free_size - update the free size *
@@ -689,22 +659,18 @@ int radeon_ring_restore(struct radeon_device *rdev, struct radeon_ring *ring,* @ring: radeon_ring structure holding ring information * @ring_size: size of the ring * @rptr_offs: offset of the rptr writeback location in the WB buffer -* @rptr_reg: MMIO offset of the rptr register -* @wptr_reg: MMIO offset of the wptr register * @nop: nop packet for this ring * * Initialize the driver information for the selected ring (all asics). * Returns 0 on success, error on failure. */ int radeon_ring_init (struct radeon_device *rdev,struct radeon_ring *ring,unsigned ring_size, -unsigned rptr_offs,unsigned rptr_reg,unsigned wptr_reg,u32 nop) +unsigned rptr_offs,u32 nop) {int r; ring->ring_size = ring_size; ring->rptr_offs = rptr_offs; - ring->rptr_reg = rptr_reg; - ring->wptr_reg = wptr_reg; ring->nop = nop;/* Allocate ring buffer */ if (ring->ring_obj ==NULL ) {
@@ -796,9 +762,9 @@ static int radeon_debugfs_ring_info(struct seq_file *m, void *data)radeon_ring_free_size (rdev, ring); count = (ring->ring_size /4 ) - ring->ring_free_dw; tmp =radeon_ring_get_wptr (rdev, ring); -seq_printf (m,"wptr(0x%04x): 0x%08x [%5d]\n" , ring->wptr_reg, tmp, tmp); +seq_printf (m,"wptr: 0x%08x [%5d]\n" , tmp, tmp); tmp =radeon_ring_get_rptr (rdev, ring); -seq_printf (m,"rptr(0x%04x): 0x%08x [%5d]\n" , ring->rptr_reg, tmp, tmp); +seq_printf (m,"rptr: 0x%08x [%5d]\n" , tmp, tmp);if (ring->rptr_save_reg) {seq_printf (m,"rptr next(0x%04x): 0x%08x\n" , ring->rptr_save_reg,RREG32 (ring->rptr_save_reg));
drivers/gpu/drm/radeon/rv770.c +0 -3
@@ -1728,14 +1728,12 @@ static int rv770_startup(struct radeon_device *rdev) ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX ]; r =radeon_ring_init (rdev, ring, ring->ring_size,RADEON_WB_CP_RPTR_OFFSET , -R600_CP_RB_RPTR ,R600_CP_RB_WPTR ,RADEON_CP_PACKET2 );if (r)return r; ring = &rdev->ring[R600_RING_TYPE_DMA_INDEX ]; r =radeon_ring_init (rdev, ring, ring->ring_size,R600_WB_DMA_RPTR_OFFSET , -DMA_RB_RPTR ,DMA_RB_WPTR ,DMA_PACKET (DMA_PACKET_NOP ,0 ,0 ,0 ));if (r)return r;
@@ -1754,7 +1752,6 @@ static int rv770_startup(struct radeon_device *rdev) ring = &rdev->ring[R600_RING_TYPE_UVD_INDEX ];if (ring->ring_size) { r =radeon_ring_init (rdev, ring, ring->ring_size,0 , -UVD_RBC_RB_RPTR ,UVD_RBC_RB_WPTR ,RADEON_CP_PACKET2 );if (!r) r =uvd_v1_0_init (rdev);
drivers/gpu/drm/radeon/si.c +0 -8
@@ -6419,37 +6419,30 @@ static int si_startup(struct radeon_device *rdev) ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX ]; r =radeon_ring_init (rdev, ring, ring->ring_size,RADEON_WB_CP_RPTR_OFFSET , -CP_RB0_RPTR ,CP_RB0_WPTR ,RADEON_CP_PACKET2 );if (r)return r; ring = &rdev->ring[CAYMAN_RING_TYPE_CP1_INDEX ]; r =radeon_ring_init (rdev, ring, ring->ring_size,RADEON_WB_CP1_RPTR_OFFSET , -CP_RB1_RPTR ,CP_RB1_WPTR ,RADEON_CP_PACKET2 );if (r)return r; ring = &rdev->ring[CAYMAN_RING_TYPE_CP2_INDEX ]; r =radeon_ring_init (rdev, ring, ring->ring_size,RADEON_WB_CP2_RPTR_OFFSET , -CP_RB2_RPTR ,CP_RB2_WPTR ,RADEON_CP_PACKET2 );if (r)return r; ring = &rdev->ring[R600_RING_TYPE_DMA_INDEX ]; r =radeon_ring_init (rdev, ring, ring->ring_size,R600_WB_DMA_RPTR_OFFSET , -DMA_RB_RPTR +DMA0_REGISTER_OFFSET , -DMA_RB_WPTR +DMA0_REGISTER_OFFSET ,DMA_PACKET (DMA_PACKET_NOP ,0 ,0 ,0 ,0 ));if (r)return r; ring = &rdev->ring[CAYMAN_RING_TYPE_DMA1_INDEX ]; r =radeon_ring_init (rdev, ring, ring->ring_size,CAYMAN_WB_DMA1_RPTR_OFFSET , -DMA_RB_RPTR +DMA1_REGISTER_OFFSET , -DMA_RB_WPTR +DMA1_REGISTER_OFFSET ,DMA_PACKET (DMA_PACKET_NOP ,0 ,0 ,0 ,0 ));if (r)return r;
@@ -6469,7 +6462,6 @@ static int si_startup(struct radeon_device *rdev) ring = &rdev->ring[R600_RING_TYPE_UVD_INDEX ];if (ring->ring_size) { r =radeon_ring_init (rdev, ring, ring->ring_size,0 , -UVD_RBC_RB_RPTR ,UVD_RBC_RB_WPTR ,RADEON_CP_PACKET2 );if (!r) r =uvd_v1_0_init (rdev);
Signature · 1 line
1.8.3.1
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 16 lines · Alex Deucher
drivers/gpu/drm/radeon/cik.c +3
-3-u32 cik_compute_ring_get_wptr (struct radeon_device *rdev, -struct radeon_ring *ring) +u32 cik_compute_get_wptr (struct radeon_device *rdev, +struct radeon_ring *ring) {u32 wptr;if (rdev->wb.enabled) { - wptr =le32_to_cpu (rdev->wb.wb[ring->wptr_offs/4 ]); + wptr = rdev->wb.wb[ring->wptr_offs/4 ]; }else {mutex_lock (&rdev->srbm_mutex); cik_srbm_select(rdev, ring->me, ring->pipe,
ring->queue, 0);
drivers/gpu/drm/radeon/cik.c u32 cik_compute_ring_get_wptr(struct · line 4088
Quoted 10 lines
drivers/gpu/drm/radeon/cik.c +2
-2@@ -4053,8 +4081,8 @@ u32 cik_compute_ring_get_wptr(structradeon_device *rdev, return wptr; } -void cik_compute_ring_set_wptr (struct radeon_device *rdev, -struct radeon_ring *ring) +void cik_compute_set_wptr (struct radeon_device *rdev, +struct radeon_ring *ring) { rdev->wb.wb[ring->wptr_offs/4 ] =cpu_to_le32 (ring->wptr);
I think this cpu_to_le32() needs to be dropped as well to match cik_compute_ring_get_wptr().
Quoted 6 lines
drivers/gpu/drm/radeon/radeon.h +0
-0
drivers/gpu/drm/radeon/radeon.h struct radeon_ring { · line 788
Quoted 10 lines
drivers/gpu/drm/radeon/radeon.h +0
-2@@ -779,13 +779,11 @@ struct radeon_ring {volatile uint32_t *ring;unsigned rptr;unsigned rptr_offs; -unsigned rptr_reg;unsigned rptr_save_reg;u64 next_rptr_gpu_addr;volatile u32 *next_rptr_cpu_addr;unsigned wptr;unsigned wptr_old; -unsigned wptr_reg;
What's the motivation for removing these? Seems like keeping them would allow keeping this patch and the resulting code smaller (fewer function variants) and cleaner (no if/else/... for the register offsets in the variants).
Signature · 7 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 21 lines · Michel Dänzer
Quoted 20 lines · Alex Deucher
drivers/gpu/drm/radeon/cik.c +3
-3-u32 cik_compute_ring_get_wptr (struct radeon_device *rdev, -struct radeon_ring *ring) +u32 cik_compute_get_wptr (struct radeon_device *rdev, +struct radeon_ring *ring) {u32 wptr;if (rdev->wb.enabled) { - wptr =le32_to_cpu (rdev->wb.wb[ring->wptr_offs/4 ]); + wptr = rdev->wb.wb[ring->wptr_offs/4 ]; }else {mutex_lock (&rdev->srbm_mutex); cik_srbm_select(rdev, ring->me, ring->pipe,
ring->queue, 0);drivers/gpu/drm/radeon/cik.c +0
-0@@ -4053,8 +4081,8 @@ u32 cik_compute_ring_get_wptr(structradeon_device *rdev, return wptr; }
Quoted 9 lines
drivers/gpu/drm/radeon/cik.c u32 cik_compute_ring_get_wptr(struct radeon_device *rdev, · line 4087
Quoted 6 lines
drivers/gpu/drm/radeon/cik.c +2
-2-void cik_compute_ring_set_wptr (struct radeon_device *rdev, -struct radeon_ring *ring) +void cik_compute_set_wptr (struct radeon_device *rdev, +struct radeon_ring *ring) { rdev->wb.wb[ring->wptr_offs/4 ] =cpu_to_le32 (ring->wptr);I think this
cpu_to_le32()needs to be dropped as well to matchcik_compute_ring_get_wptr().
whoops, yeah, missed that one.
Quoted 15 lines
Quoted 15 lines
drivers/gpu/drm/radeon/radeon.h +0
-1@@ -779,13 +779,11 @@ struct radeon_ring {volatile uint32_t *ring;unsigned rptr;unsigned rptr_offs; -unsigned rptr_reg;unsigned rptr_save_reg;u64 next_rptr_gpu_addr;volatile u32 *next_rptr_cpu_addr;
Quoted 8 lines
drivers/gpu/drm/radeon/radeon.h struct radeon_ring { · line 788
Quoted 3 lines
drivers/gpu/drm/radeon/radeon.h +0
-1unsigned wptr;unsigned wptr_old; -unsigned wptr_reg;What's the motivation for removing these? Seems like keeping them would allow keeping this patch and the resulting code smaller (fewer function variants) and cleaner (no if/else/... for the register offsets in the variants).
I was trying to remove the asic specific info out of the ring struct and into the asic specific functions.
Alex
Quoted 32 lines · Alex Deucher
Quoted 21 lines · Michel Dänzer
Quoted 20 lines · Alex Deucher
(quoted diff) +3
-3-u32 cik_compute_ring_get_wptr(struct radeon_device *rdev, - struct radeon_ring *ring) +u32 cik_compute_get_wptr(struct radeon_device *rdev, + struct radeon_ring *ring) { u32 wptr; if (rdev->wb.enabled) { - wptr = le32_to_cpu(rdev->wb.wb[ring->wptr_offs/4]); + wptr = rdev->wb.wb[ring->wptr_offs/4]; } else { mutex_lock(&rdev->srbm_mutex); cik_srbm_select(rdev, ring->me, ring->pipe,
ring->queue, 0);(quoted diff) +0
-0@@ -4053,8 +4081,8 @@ u32 cik_compute_ring_get_wptr(struct radeon_device *rdev, return wptr; }Quoted 9 lines
Review u32 cik_compute_ring_get_wptr(struct · line 4088
Quoted 6 lines
(quoted diff) +2
-2-void cik_compute_ring_set_wptr(struct radeon_device *rdev, - struct radeon_ring *ring) +void cik_compute_set_wptr(struct radeon_device *rdev, + struct radeon_ring *ring) { rdev->wb.wb[ring->wptr_offs/4] = cpu_to_le32(ring->wptr);I think this
cpu_to_le32()needs to be dropped as well to matchcik_compute_ring_get_wptr().
Quoted 1 line
whoops, yeah, missed that one.
Updated patch attached.
Alex
Quoted 25 lines
Quoted 16 lines
Quoted 16 lines
drivers/gpu/drm/radeon/radeon.h +0
-1@@ -779,13 +779,11 @@ struct radeon_ring {volatile uint32_t *ring;unsigned rptr;unsigned rptr_offs; -unsigned rptr_reg;unsigned rptr_save_reg;u64 next_rptr_gpu_addr;volatile u32 *next_rptr_cpu_addr;Quoted 8 lines
drivers/gpu/drm/radeon/radeon.h struct radeon_ring { · line 788
Quoted 3 lines
drivers/gpu/drm/radeon/radeon.h +0
-1unsigned wptr;unsigned wptr_old; -unsigned wptr_reg;What's the motivation for removing these? Seems like keeping them would allow keeping this patch and the resulting code smaller (fewer function variants) and cleaner (no if/else/... for the register offsets in the variants).
Quoted 4 lines
I was trying to remove the asic specific info out of the ring struct and into the asic specific functions.
Alex
From 44d447981cd247aea135ca864dc205d304cf3e5f Mon Sep 17 00:00:00 2001
From: Alex Deucher <[email protected]>
Date: Mon, 9 Dec 2013 19:44:30 -0500
Subject: [PATCH] drm/radeon: remove generic rptr/wptr functions (v2)
Fill in asic family specific versions rather than using the generic version. This lets us handle asic specific differences more easily. In this case, we disable sw swapping of the rtpr writeback value on r6xx+ since the hw does it for us. Fixes bogus rptr readback on BE systems.
v2: remove missed cpu_to_le32(), add comments
--- drivers/gpu/drm/radeon/cik.c | 56 ++++++++++++++++++++--------- drivers/gpu/drm/radeon/cik_sdma.c | 69 ++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/radeon/evergreen.c | 3 -- drivers/gpu/drm/radeon/ni.c | 69 +++++++++++++++++++++++++++++++----- drivers/gpu/drm/radeon/ni_dma.c | 69 ++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/radeon/r100.c | 31 +++++++++++++++- drivers/gpu/drm/radeon/r600.c | 32 +++++++++++++++-- drivers/gpu/drm/radeon/r600_dma.c | 13 +++++-- drivers/gpu/drm/radeon/radeon.h | 4 +-- drivers/gpu/drm/radeon/radeon_asic.c | 66 +++++++++++++++++----------------- drivers/gpu/drm/radeon/radeon_asic.h | 57 ++++++++++++++++++++++------- drivers/gpu/drm/radeon/radeon_ring.c | 40 ++------------------- drivers/gpu/drm/radeon/rv770.c | 3 -- drivers/gpu/drm/radeon/si.c | 8 ----- 14 files changed, 389 insertions(+), 131 deletions(-)
drivers/gpu/drm/radeon/cik.c +39 -17
@@ -4015,15 +4015,43 @@ static int cik_cp_gfx_resume(struct radeon_device *rdev)return 0 ; } -u32 cik_compute_ring_get_rptr (struct radeon_device *rdev, -struct radeon_ring *ring) +u32 cik_gfx_get_rptr (struct radeon_device *rdev, +struct radeon_ring *ring) {u32 rptr; +if (rdev->wb.enabled) + rptr = rdev->wb.wb[ring->rptr_offs/4 ]; +else + rptr =RREG32 (CP_RB0_RPTR ); + +return rptr; +} + +u32 cik_gfx_get_wptr (struct radeon_device *rdev, +struct radeon_ring *ring) +{ +u32 wptr; + + wptr =RREG32 (CP_RB0_WPTR ); +return wptr; +} + +void cik_gfx_set_wptr (struct radeon_device *rdev, +struct radeon_ring *ring) +{ +WREG32 (CP_RB0_WPTR , ring->wptr); + (void )RREG32 (CP_RB0_WPTR ); +} + +u32 cik_compute_get_rptr (struct radeon_device *rdev, +struct radeon_ring *ring) +{ +u32 rptr;if (rdev->wb.enabled) { - rptr =le32_to_cpu (rdev->wb.wb[ring->rptr_offs/4 ]); + rptr = rdev->wb.wb[ring->rptr_offs/4 ]; }else {mutex_lock (&rdev->srbm_mutex);cik_srbm_select (rdev, ring->me, ring->pipe, ring->queue,0 );
@@ -4035,13 +4063,14 @@ u32 cik_compute_ring_get_rptr(struct radeon_device *rdev,return rptr; } -u32 cik_compute_ring_get_wptr (struct radeon_device *rdev, -struct radeon_ring *ring) +u32 cik_compute_get_wptr (struct radeon_device *rdev, +struct radeon_ring *ring) {u32 wptr;if (rdev->wb.enabled) { - wptr =le32_to_cpu (rdev->wb.wb[ring->wptr_offs/4 ]); +/* XXX check if swapping is necessary on BE */ + wptr = rdev->wb.wb[ring->wptr_offs/4 ]; }else {mutex_lock (&rdev->srbm_mutex);cik_srbm_select (rdev, ring->me, ring->pipe, ring->queue,0 );
@@ -4053,10 +4082,11 @@ u32 cik_compute_ring_get_wptr(struct radeon_device *rdev,return wptr; } -void cik_compute_ring_set_wptr (struct radeon_device *rdev, -struct radeon_ring *ring) +void cik_compute_set_wptr (struct radeon_device *rdev, +struct radeon_ring *ring) { - rdev->wb.wb[ring->wptr_offs/4 ] =cpu_to_le32 (ring->wptr); +/* XXX check if swapping is necessary on BE */ + rdev->wb.wb[ring->wptr_offs/4 ] = ring->wptr;WDOORBELL32 (ring->doorbell_index, ring->wptr); }
@@ -7625,7 +7655,6 @@ static int cik_startup(struct radeon_device *rdev) ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX ]; r =radeon_ring_init (rdev, ring, ring->ring_size,RADEON_WB_CP_RPTR_OFFSET , -CP_RB0_RPTR ,CP_RB0_WPTR ,PACKET3 (PACKET3_NOP ,0x3FFF ));if (r)return r;
@@ -7634,7 +7663,6 @@ static int cik_startup(struct radeon_device *rdev)/* type-2 packets are deprecated on MEC, use type-3 instead */ ring = &rdev->ring[CAYMAN_RING_TYPE_CP1_INDEX ]; r =radeon_ring_init (rdev, ring, ring->ring_size,RADEON_WB_CP1_RPTR_OFFSET , -CP_HQD_PQ_RPTR ,CP_HQD_PQ_WPTR ,PACKET3 (PACKET3_NOP ,0x3FFF ));if (r)return r;
@@ -7646,7 +7674,6 @@ static int cik_startup(struct radeon_device *rdev)/* type-2 packets are deprecated on MEC, use type-3 instead */ ring = &rdev->ring[CAYMAN_RING_TYPE_CP2_INDEX ]; r =radeon_ring_init (rdev, ring, ring->ring_size,RADEON_WB_CP2_RPTR_OFFSET , -CP_HQD_PQ_RPTR ,CP_HQD_PQ_WPTR ,PACKET3 (PACKET3_NOP ,0x3FFF ));if (r)return r;
@@ -7658,16 +7685,12 @@ static int cik_startup(struct radeon_device *rdev) ring = &rdev->ring[R600_RING_TYPE_DMA_INDEX ]; r =radeon_ring_init (rdev, ring, ring->ring_size,R600_WB_DMA_RPTR_OFFSET , -SDMA0_GFX_RB_RPTR +SDMA0_REGISTER_OFFSET , -SDMA0_GFX_RB_WPTR +SDMA0_REGISTER_OFFSET ,SDMA_PACKET (SDMA_OPCODE_NOP ,0 ,0 ));if (r)return r; ring = &rdev->ring[CAYMAN_RING_TYPE_DMA1_INDEX ]; r =radeon_ring_init (rdev, ring, ring->ring_size,CAYMAN_WB_DMA1_RPTR_OFFSET , -SDMA0_GFX_RB_RPTR +SDMA1_REGISTER_OFFSET , -SDMA0_GFX_RB_WPTR +SDMA1_REGISTER_OFFSET ,SDMA_PACKET (SDMA_OPCODE_NOP ,0 ,0 ));if (r)return r;
@@ -7683,7 +7706,6 @@ static int cik_startup(struct radeon_device *rdev) ring = &rdev->ring[R600_RING_TYPE_UVD_INDEX ];if (ring->ring_size) { r =radeon_ring_init (rdev, ring, ring->ring_size,0 , -UVD_RBC_RB_RPTR ,UVD_RBC_RB_WPTR ,RADEON_CP_PACKET2 );if (!r) r =uvd_v1_0_init (rdev);
drivers/gpu/drm/radeon/cik_sdma.c +69 -0
75 lines not on this page · raw message
drivers/gpu/drm/radeon/evergreen.c +0 -3
@@ -5199,14 +5199,12 @@ static int evergreen_startup(struct radeon_device *rdev) ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX ]; r =radeon_ring_init (rdev, ring, ring->ring_size,RADEON_WB_CP_RPTR_OFFSET , -R600_CP_RB_RPTR ,R600_CP_RB_WPTR ,RADEON_CP_PACKET2 );if (r)return r; ring = &rdev->ring[R600_RING_TYPE_DMA_INDEX ]; r =radeon_ring_init (rdev, ring, ring->ring_size,R600_WB_DMA_RPTR_OFFSET , -DMA_RB_RPTR ,DMA_RB_WPTR ,DMA_PACKET (DMA_PACKET_NOP ,0 ,0 ));if (r)return r;
@@ -5224,7 +5222,6 @@ static int evergreen_startup(struct radeon_device *rdev) ring = &rdev->ring[R600_RING_TYPE_UVD_INDEX ];if (ring->ring_size) { r =radeon_ring_init (rdev, ring, ring->ring_size,0 , -UVD_RBC_RB_RPTR ,UVD_RBC_RB_WPTR ,RADEON_CP_PACKET2 );if (!r) r =uvd_v1_0_init (rdev);
drivers/gpu/drm/radeon/ni.c +61 -8
111 lines not on this page · raw message
drivers/gpu/drm/radeon/ni_dma.c +69 -0
75 lines not on this page · raw message
drivers/gpu/drm/radeon/r100.c +30 -1
@@ -1050,6 +1050,36 @@ static int r100_cp_init_microcode(struct radeon_device *rdev)return err; } +u32 r100_gfx_get_rptr (struct radeon_device *rdev, +struct radeon_ring *ring) +{ +u32 rptr; + +if (rdev->wb.enabled) + rptr =le32_to_cpu (rdev->wb.wb[ring->rptr_offs/4 ]); +else + rptr =RREG32 (RADEON_CP_RB_RPTR ); + +return rptr; +} + +u32 r100_gfx_get_wptr (struct radeon_device *rdev, +struct radeon_ring *ring) +{ +u32 wptr; + + wptr =RREG32 (RADEON_CP_RB_WPTR ); + +return wptr; +} + +void r100_gfx_set_wptr (struct radeon_device *rdev, +struct radeon_ring *ring) +{ +WREG32 (RADEON_CP_RB_WPTR , ring->wptr); + (void )RREG32 (RADEON_CP_RB_WPTR ); +} +static void r100_cp_load_microcode (struct radeon_device *rdev) {const __be32 *fw_data;
@@ -1102,7 +1132,6 @@ int r100_cp_init(struct radeon_device *rdev, unsigned ring_size) ring_size = (1 << (rb_bufsz +1 )) *4 ;r100_cp_load_microcode (rdev); r =radeon_ring_init (rdev, ring, ring_size,RADEON_WB_CP_RPTR_OFFSET , -RADEON_CP_RB_RPTR ,RADEON_CP_RB_WPTR ,RADEON_CP_PACKET2 );if (r) {return r;
drivers/gpu/drm/radeon/r600.c +30 -2
@@ -2382,6 +2382,36 @@ out:return err; } +u32 r600_gfx_get_rptr (struct radeon_device *rdev, +struct radeon_ring *ring) +{ +u32 rptr; + +if (rdev->wb.enabled) + rptr = rdev->wb.wb[ring->rptr_offs/4 ]; +else + rptr =RREG32 (R600_CP_RB_RPTR ); + +return rptr; +} + +u32 r600_gfx_get_wptr (struct radeon_device *rdev, +struct radeon_ring *ring) +{ +u32 wptr; + + wptr =RREG32 (R600_CP_RB_WPTR ); + +return wptr; +} + +void r600_gfx_set_wptr (struct radeon_device *rdev, +struct radeon_ring *ring) +{ +WREG32 (R600_CP_RB_WPTR , ring->wptr); + (void )RREG32 (R600_CP_RB_WPTR ); +} +static int r600_cp_load_microcode (struct radeon_device *rdev) {const __be32 *fw_data;
@@ -2826,14 +2856,12 @@ static int r600_startup(struct radeon_device *rdev) ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX ]; r =radeon_ring_init (rdev, ring, ring->ring_size,RADEON_WB_CP_RPTR_OFFSET , -R600_CP_RB_RPTR ,R600_CP_RB_WPTR ,RADEON_CP_PACKET2 );if (r)return r; ring = &rdev->ring[R600_RING_TYPE_DMA_INDEX ]; r =radeon_ring_init (rdev, ring, ring->ring_size,R600_WB_DMA_RPTR_OFFSET , -DMA_RB_RPTR ,DMA_RB_WPTR ,DMA_PACKET (DMA_PACKET_NOP ,0 ,0 ,0 ));if (r)return r;
drivers/gpu/drm/radeon/r600_dma.c +10 -3
@@ -51,7 +51,14 @@ u32 r600_gpu_check_soft_reset(struct radeon_device *rdev);uint32_t r600_dma_get_rptr (struct radeon_device *rdev,struct radeon_ring *ring) { -return (radeon_ring_generic_get_rptr (rdev, ring) &0x3fffc ) >>2 ; +u32 rptr; + +if (rdev->wb.enabled) + rptr = rdev->wb.wb[ring->rptr_offs/4 ]; +else + rptr =RREG32 (DMA_RB_RPTR ); + +return (rptr &0x3fffc ) >>2 ; }/**
@@ -65,7 +72,7 @@ uint32_t r600_dma_get_rptr(struct radeon_device *rdev,uint32_t r600_dma_get_wptr (struct radeon_device *rdev,struct radeon_ring *ring) { -return (RREG32 (ring->wptr_reg) &0x3fffc ) >>2 ; +return (RREG32 (DMA_RB_WPTR ) &0x3fffc ) >>2 ; }/**
@@ -79,7 +86,7 @@ uint32_t r600_dma_get_wptr(struct radeon_device *rdev,void r600_dma_set_wptr (struct radeon_device *rdev,struct radeon_ring *ring) { -WREG32 (ring->wptr_reg, (ring->wptr <<2 ) &0x3fffc ); +WREG32 (DMA_RB_WPTR , (ring->wptr <<2 ) &0x3fffc ); }/**
drivers/gpu/drm/radeon/radeon.h +1 -3
@@ -779,13 +779,11 @@ struct radeon_ring {volatile uint32_t *ring;unsigned rptr;unsigned rptr_offs; -unsigned rptr_reg;unsigned rptr_save_reg;u64 next_rptr_gpu_addr;volatile u32 *next_rptr_cpu_addr;unsigned wptr;unsigned wptr_old; -unsigned wptr_reg;unsigned ring_size;unsigned ring_free_dw;int count_dw;
@@ -949,7 +947,7 @@ unsigned radeon_ring_backup(struct radeon_device *rdev, struct radeon_ring *ringint radeon_ring_restore (struct radeon_device *rdev,struct radeon_ring *ring,unsigned size,uint32_t *data);int radeon_ring_init (struct radeon_device *rdev,struct radeon_ring *cp,unsigned ring_size, -unsigned rptr_offs,unsigned rptr_reg,unsigned wptr_reg,u32 nop); +unsigned rptr_offs,u32 nop);void radeon_ring_fini (struct radeon_device *rdev,struct radeon_ring *cp);
drivers/gpu/drm/radeon/radeon_asic.c +33 -33
132 lines not on this page · raw message
drivers/gpu/drm/radeon/radeon_asic.h +44 -13
87 lines not on this page · raw message
drivers/gpu/drm/radeon/radeon_ring.c +3 -37
@@ -332,36 +332,6 @@ bool radeon_ring_supports_scratch_reg(struct radeon_device *rdev, } } -u32 radeon_ring_generic_get_rptr (struct radeon_device *rdev, -struct radeon_ring *ring) -{ -u32 rptr; - -if (rdev->wb.enabled) - rptr =le32_to_cpu (rdev->wb.wb[ring->rptr_offs/4 ]); -else - rptr =RREG32 (ring->rptr_reg); - -return rptr; -} - -u32 radeon_ring_generic_get_wptr (struct radeon_device *rdev, -struct radeon_ring *ring) -{ -u32 wptr; - - wptr =RREG32 (ring->wptr_reg); - -return wptr; -} - -void radeon_ring_generic_set_wptr (struct radeon_device *rdev, -struct radeon_ring *ring) -{ -WREG32 (ring->wptr_reg, ring->wptr); - (void )RREG32 (ring->wptr_reg); -} -/** * radeon_ring_free_size - update the free size *
@@ -689,22 +659,18 @@ int radeon_ring_restore(struct radeon_device *rdev, struct radeon_ring *ring,* @ring: radeon_ring structure holding ring information * @ring_size: size of the ring * @rptr_offs: offset of the rptr writeback location in the WB buffer -* @rptr_reg: MMIO offset of the rptr register -* @wptr_reg: MMIO offset of the wptr register * @nop: nop packet for this ring * * Initialize the driver information for the selected ring (all asics). * Returns 0 on success, error on failure. */ int radeon_ring_init (struct radeon_device *rdev,struct radeon_ring *ring,unsigned ring_size, -unsigned rptr_offs,unsigned rptr_reg,unsigned wptr_reg,u32 nop) +unsigned rptr_offs,u32 nop) {int r; ring->ring_size = ring_size; ring->rptr_offs = rptr_offs; - ring->rptr_reg = rptr_reg; - ring->wptr_reg = wptr_reg; ring->nop = nop;/* Allocate ring buffer */ if (ring->ring_obj ==NULL ) {
@@ -796,9 +762,9 @@ static int radeon_debugfs_ring_info(struct seq_file *m, void *data)radeon_ring_free_size (rdev, ring); count = (ring->ring_size /4 ) - ring->ring_free_dw; tmp =radeon_ring_get_wptr (rdev, ring); -seq_printf (m,"wptr(0x%04x): 0x%08x [%5d]\n" , ring->wptr_reg, tmp, tmp); +seq_printf (m,"wptr: 0x%08x [%5d]\n" , tmp, tmp); tmp =radeon_ring_get_rptr (rdev, ring); -seq_printf (m,"rptr(0x%04x): 0x%08x [%5d]\n" , ring->rptr_reg, tmp, tmp); +seq_printf (m,"rptr: 0x%08x [%5d]\n" , tmp, tmp);if (ring->rptr_save_reg) {seq_printf (m,"rptr next(0x%04x): 0x%08x\n" , ring->rptr_save_reg,RREG32 (ring->rptr_save_reg));
drivers/gpu/drm/radeon/rv770.c +0 -3
@@ -1728,14 +1728,12 @@ static int rv770_startup(struct radeon_device *rdev) ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX ]; r =radeon_ring_init (rdev, ring, ring->ring_size,RADEON_WB_CP_RPTR_OFFSET , -R600_CP_RB_RPTR ,R600_CP_RB_WPTR ,RADEON_CP_PACKET2 );if (r)return r; ring = &rdev->ring[R600_RING_TYPE_DMA_INDEX ]; r =radeon_ring_init (rdev, ring, ring->ring_size,R600_WB_DMA_RPTR_OFFSET , -DMA_RB_RPTR ,DMA_RB_WPTR ,DMA_PACKET (DMA_PACKET_NOP ,0 ,0 ,0 ));if (r)return r;
@@ -1754,7 +1752,6 @@ static int rv770_startup(struct radeon_device *rdev) ring = &rdev->ring[R600_RING_TYPE_UVD_INDEX ];if (ring->ring_size) { r =radeon_ring_init (rdev, ring, ring->ring_size,0 , -UVD_RBC_RB_RPTR ,UVD_RBC_RB_WPTR ,RADEON_CP_PACKET2 );if (!r) r =uvd_v1_0_init (rdev);
drivers/gpu/drm/radeon/si.c +0 -8
@@ -6419,37 +6419,30 @@ static int si_startup(struct radeon_device *rdev) ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX ]; r =radeon_ring_init (rdev, ring, ring->ring_size,RADEON_WB_CP_RPTR_OFFSET , -CP_RB0_RPTR ,CP_RB0_WPTR ,RADEON_CP_PACKET2 );if (r)return r; ring = &rdev->ring[CAYMAN_RING_TYPE_CP1_INDEX ]; r =radeon_ring_init (rdev, ring, ring->ring_size,RADEON_WB_CP1_RPTR_OFFSET , -CP_RB1_RPTR ,CP_RB1_WPTR ,RADEON_CP_PACKET2 );if (r)return r; ring = &rdev->ring[CAYMAN_RING_TYPE_CP2_INDEX ]; r =radeon_ring_init (rdev, ring, ring->ring_size,RADEON_WB_CP2_RPTR_OFFSET , -CP_RB2_RPTR ,CP_RB2_WPTR ,RADEON_CP_PACKET2 );if (r)return r; ring = &rdev->ring[R600_RING_TYPE_DMA_INDEX ]; r =radeon_ring_init (rdev, ring, ring->ring_size,R600_WB_DMA_RPTR_OFFSET , -DMA_RB_RPTR +DMA0_REGISTER_OFFSET , -DMA_RB_WPTR +DMA0_REGISTER_OFFSET ,DMA_PACKET (DMA_PACKET_NOP ,0 ,0 ,0 ,0 ));if (r)return r; ring = &rdev->ring[CAYMAN_RING_TYPE_DMA1_INDEX ]; r =radeon_ring_init (rdev, ring, ring->ring_size,CAYMAN_WB_DMA1_RPTR_OFFSET , -DMA_RB_RPTR +DMA1_REGISTER_OFFSET , -DMA_RB_WPTR +DMA1_REGISTER_OFFSET ,DMA_PACKET (DMA_PACKET_NOP ,0 ,0 ,0 ,0 ));if (r)return r;
@@ -6469,7 +6462,6 @@ static int si_startup(struct radeon_device *rdev) ring = &rdev->ring[R600_RING_TYPE_UVD_INDEX ];if (ring->ring_size) { r =radeon_ring_init (rdev, ring, ring->ring_size,0 , -UVD_RBC_RB_RPTR ,UVD_RBC_RB_WPTR ,RADEON_CP_PACKET2 );if (!r) r =uvd_v1_0_init (rdev);
Signature · 1 line
1.8.3.1
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 33 lines · Alex Deucher
Quoted 32 lines · Alex Deucher
Quoted 30 lines · Michel Dänzer
Quoted 16 lines · Alex Deucher
drivers/gpu/drm/radeon/cik.c +3
-3-u32 cik_compute_ring_get_wptr (struct radeon_device *rdev, -struct radeon_ring *ring) +u32 cik_compute_get_wptr (struct radeon_device *rdev, +struct radeon_ring *ring) {u32 wptr;if (rdev->wb.enabled) { - wptr =le32_to_cpu (rdev->wb.wb[ring->wptr_offs/4 ]); + wptr = rdev->wb.wb[ring->wptr_offs/4 ]; }else {mutex_lock (&rdev->srbm_mutex); cik_srbm_select(rdev, ring->me, ring->pipe,
ring->queue, 0);drivers/gpu/drm/radeon/cik.c u32 cik_compute_ring_get_wptr(struct · line 4088
Quoted 10 lines
drivers/gpu/drm/radeon/cik.c +2
-2@@ -4053,8 +4081,8 @@ u32 cik_compute_ring_get_wptr(structradeon_device *rdev, return wptr; } -void cik_compute_ring_set_wptr (struct radeon_device *rdev, -struct radeon_ring *ring) +void cik_compute_set_wptr (struct radeon_device *rdev, +struct radeon_ring *ring) { rdev->wb.wb[ring->wptr_offs/4 ] =cpu_to_le32 (ring->wptr);I think this
cpu_to_le32()needs to be dropped as well to matchcik_compute_ring_get_wptr().
Quoted 6 lines
Quoted 1 line
whoops, yeah, missed that one.
Updated patch attached.
Alex
Hi, Alex.
Has this patch been accepted upstream? I've tested it successfully on a ppc64 system with a FirePro 2270 adapter.
Thanks,
Signature · 2 lines
Kleber Sacilotto de Souza IBM Linux Technology Center
Quoted 46 lines · Kleber Sacilotto de Souza
Quoted 45 lines · Alex Deucher
Quoted 37 lines · Alex Deucher
Quoted 23 lines · Michel Dänzer
Quoted 21 lines · Alex Deucher
drivers/gpu/drm/radeon/cik.c +3
-3-u32 cik_compute_ring_get_wptr (struct radeon_device *rdev, -struct radeon_ring *ring) +u32 cik_compute_get_wptr (struct radeon_device *rdev, +struct radeon_ring *ring) {u32 wptr;if (rdev->wb.enabled) { - wptr =le32_to_cpu (rdev->wb.wb[ring->wptr_offs/4 ]); + wptr = rdev->wb.wb[ring->wptr_offs/4 ]; }else {mutex_lock (&rdev->srbm_mutex); cik_srbm_select(rdev, ring->me, ring->pipe,
ring->queue, 0);drivers/gpu/drm/radeon/cik.c +0
-0@@ -4053,8 +4081,8 @@ u32 cik_compute_ring_get_wptr(structradeon_device *rdev, return wptr; }Quoted 10 lines
drivers/gpu/drm/radeon/cik.c u32 cik_compute_ring_get_wptr(struct radeon_device *rdev,
Quoted 6 lines
drivers/gpu/drm/radeon/cik.c +2
-2-void cik_compute_ring_set_wptr (struct radeon_device *rdev, -struct radeon_ring *ring) +void cik_compute_set_wptr (struct radeon_device *rdev, +struct radeon_ring *ring) { rdev->wb.wb[ring->wptr_offs/4 ] =cpu_to_le32 (ring->wptr);I think this
cpu_to_le32()needs to be dropped as well to matchcik_compute_ring_get_wptr().Quoted 1 line
whoops, yeah, missed that one.
Updated patch attached.
Quoted 7 lines
Quoted 2 lines
Alex
Hi, Alex.
Has this patch been accepted upstream? I've tested it successfully on a ppc64 system with a FirePro 2270 adapter.
Not yet, I was planning to upstream it for 3.14 unless there are objections.
http://cgit.freedesktop.org/~agd5f/linux/log/?h=drm-next-3.14-wip
Alex
Quoted 10 lines
Thanks,
--
Kleber Sacilotto de Souza
IBM Linux Technology Center