drm/radeon: enable pci bus mastering after card is initialised (v2)
authorDave Airlie <airlied@redhat.com>
Tue, 3 Apr 2012 10:53:05 +0000 (11:53 +0100)
committerDave Airlie <airlied@redhat.com>
Thu, 12 Apr 2012 08:27:47 +0000 (09:27 +0100)
This closes a race seen with kexec where we enable PCI bus mastering
but the card has been reinitialised fully yet.

This was previously fixed by a patch from Jerome, but this should
close the race completely.

v2: add SI support as suggested by Alex.

Reported-and-tested-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/radeon/r100.c
drivers/gpu/drm/radeon/r600.c
drivers/gpu/drm/radeon/radeon_device.c
drivers/gpu/drm/radeon/radeon_kms.c
drivers/gpu/drm/radeon/si.c

index 81801c176aa5c8b4cc45644df5c5a7a471128cd3..e11df778e194359f5bd02b19239c449ca5fc61e6 100644 (file)
@@ -1180,6 +1180,10 @@ int r100_cp_init(struct radeon_device *rdev, unsigned ring_size)
        WREG32(RADEON_CP_RB_WPTR_DELAY, 0);
        WREG32(RADEON_CP_CSQ_MODE, 0x00004D4D);
        WREG32(RADEON_CP_CSQ_CNTL, RADEON_CSQ_PRIBM_INDBM);
+
+       /* at this point everything should be setup correctly to enable master */
+       pci_set_master(rdev->pdev);
+
        radeon_ring_start(rdev, RADEON_RING_TYPE_GFX_INDEX, &rdev->ring[RADEON_RING_TYPE_GFX_INDEX]);
        r = radeon_ring_test(rdev, RADEON_RING_TYPE_GFX_INDEX, ring);
        if (r) {
index 391bd2636a8054bb5e102388060e54a1b10f9c97..4added1c7ee90d8c82d8eb136169206ce3f92a84 100644 (file)
@@ -3047,6 +3047,9 @@ int r600_irq_init(struct radeon_device *rdev)
        else
                r600_disable_interrupt_state(rdev);
 
+       /* at this point everything should be setup correctly to enable master */
+       pci_set_master(rdev->pdev);
+
        /* enable irqs */
        r600_enable_interrupts(rdev);
 
index ea7df16e2f84f267f0a129fac762333b96d54b56..0fb4f8993caec4f07844452d35b1c27450692884 100644 (file)
@@ -955,7 +955,6 @@ int radeon_resume_kms(struct drm_device *dev)
                console_unlock();
                return -1;
        }
-       pci_set_master(dev->pdev);
        /* resume AGP if in use */
        radeon_agp_resume(rdev);
        radeon_resume(rdev);
index 3c2628b14d56231997f5eb704a8e8a974611a081..f1016a5820d1f0b0cc3e89195f4576b836e9a269 100644 (file)
@@ -57,8 +57,6 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags)
        }
        dev->dev_private = (void *)rdev;
 
-       pci_set_master(dev->pdev);
-
        /* update BUS flag */
        if (drm_pci_device_is_agp(dev)) {
                flags |= RADEON_IS_AGP;
index ac7a199ffece9cd3df519187561aa2b6a5617f59..14919e1539fafa89d62c5bcd3c926ed9a3747fd9 100644 (file)
@@ -3217,6 +3217,8 @@ static int si_irq_init(struct radeon_device *rdev)
        /* force the active interrupt state to all disabled */
        si_disable_interrupt_state(rdev);
 
+       pci_set_master(rdev->pdev);
+
        /* enable irqs */
        si_enable_interrupts(rdev);