drm: radeon: fix up bus mastering when writeback is disabled
authorMichel Dänzer <michel@tungstengraphics.com>
Mon, 7 Aug 2006 10:37:46 +0000 (20:37 +1000)
committerDave Airlie <airlied@linux.ie>
Thu, 21 Sep 2006 19:32:30 +0000 (05:32 +1000)
When writeback isn't used, actually disable it in the hardware.

Not doing this might waste bus bandwidth or even cause memory corruption or
system crashes on systems that check bus transfers. No such incident has been
reported though.

Signed-off-by: Dave Airlie <airlied@linux.ie>
drivers/char/drm/radeon_cp.c
drivers/char/drm/radeon_drv.h

index 5ad43ba7b5aa16fa526a8428d507a212073688ae..3956628b2576ce611dc441df9c1de637e5ce982f 100644 (file)
@@ -1258,6 +1258,13 @@ static void radeon_test_writeback(drm_radeon_private_t * dev_priv)
                dev_priv->writeback_works = 0;
                DRM_INFO("writeback forced off\n");
        }
+
+       if (!dev_priv->writeback_works) {
+               /* Disable writeback to avoid unnecessary bus master transfer */
+               RADEON_WRITE(RADEON_CP_RB_CNTL, RADEON_READ(RADEON_CP_RB_CNTL) |
+                            RADEON_RB_NO_UPDATE);
+               RADEON_WRITE(RADEON_SCRATCH_UMSK, 0);
+       }
 }
 
 /* Enable or disable PCI-E GART on the chip */
index e5a256f5429c81c504d1ec15086caea2489c67cb..b54b8967dcd23be75f1ca2ca5653938058c4453f 100644 (file)
@@ -681,6 +681,7 @@ extern int r300_do_cp_cmdbuf(drm_device_t * dev, DRMFILE filp,
 #define RADEON_CP_RB_BASE              0x0700
 #define RADEON_CP_RB_CNTL              0x0704
 #      define RADEON_BUF_SWAP_32BIT            (2 << 16)
+#      define RADEON_RB_NO_UPDATE              (1 << 27)
 #define RADEON_CP_RB_RPTR_ADDR         0x070c
 #define RADEON_CP_RB_RPTR              0x0710
 #define RADEON_CP_RB_WPTR              0x0714