[PATCH 2/2] drm/radeon/kms: move pci bus master enable further into driver.

Dave Airlie airlied at gmail.com
Mon Dec 19 06:16:30 PST 2011


From: Dave Airlie <airlied at redhat.com>

This doesn't completely close the kexec hole for all drivers, but it fixes
it for some cases, by enabling PCI bus mastering later.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 drivers/gpu/drm/radeon/evergreen.c  |    2 ++
 drivers/gpu/drm/radeon/ni.c         |    2 ++
 drivers/gpu/drm/radeon/r100.c       |   10 ++++++++++
 drivers/gpu/drm/radeon/r300.c       |    5 +----
 drivers/gpu/drm/radeon/r420.c       |    4 ++--
 drivers/gpu/drm/radeon/r600.c       |    2 ++
 drivers/gpu/drm/radeon/radeon_kms.c |    2 --
 drivers/gpu/drm/radeon/rv770.c      |    2 ++
 8 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 5d51035..bb01c04 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -3001,6 +3001,8 @@ static int evergreen_startup(struct radeon_device *rdev)
 	/* enable pcie gen2 link */
 	evergreen_pcie_gen2_enable(rdev);
 
+	pci_set_master(rdev->pdev);
+
 	if (ASIC_IS_DCE5(rdev)) {
 		if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw || !rdev->mc_fw) {
 			r = ni_init_microcode(rdev);
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c
index 1d1047a..60b4b9b 100644
--- a/drivers/gpu/drm/radeon/ni.c
+++ b/drivers/gpu/drm/radeon/ni.c
@@ -1343,6 +1343,8 @@ static int cayman_startup(struct radeon_device *rdev)
 	/* enable pcie gen2 link */
 	evergreen_pcie_gen2_enable(rdev);
 
+	pci_set_master(rdev->pdev);
+
 	if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw || !rdev->mc_fw) {
 		r = ni_init_microcode(rdev);
 		if (r) {
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index dcc5b3c..567924c 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -596,6 +596,16 @@ int r100_pci_gart_init(struct radeon_device *rdev)
 void r100_enable_bm(struct radeon_device *rdev)
 {
 	uint32_t tmp;
+
+	pci_set_master(rdev->pdev);
+
+	if (rdev->family == CHIP_R300 ||
+	    rdev->family == CHIP_R350 ||
+	    rdev->family == CHIP_RV350 ||
+	    rdev->family == CHIP_R423 ||
+	    rdev->family == CHIP_RV410)
+		return;
+
 	/* Enable bus mastering */
 	tmp = RREG32(RADEON_BUS_CNTL) & ~RADEON_BUS_MASTER_DIS;
 	WREG32(RADEON_BUS_CNTL, tmp);
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c
index 400b26d..b1c171f 100644
--- a/drivers/gpu/drm/radeon/r300.c
+++ b/drivers/gpu/drm/radeon/r300.c
@@ -1372,10 +1372,7 @@ static int r300_startup(struct radeon_device *rdev)
 			return r;
 	}
 
-	if (rdev->family == CHIP_R300 ||
-	    rdev->family == CHIP_R350 ||
-	    rdev->family == CHIP_RV350)
-		r100_enable_bm(rdev);
+	r100_enable_bm(rdev);
 
 	if (rdev->flags & RADEON_IS_PCI) {
 		r = r100_pci_gart_enable(rdev);
diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c
index 417fab8..b9123d6 100644
--- a/drivers/gpu/drm/radeon/r420.c
+++ b/drivers/gpu/drm/radeon/r420.c
@@ -400,8 +400,8 @@ int r420_init(struct radeon_device *rdev)
 	if (r) {
 		return r;
 	}
-	if (rdev->family == CHIP_R420)
-		r100_enable_bm(rdev);
+
+	r100_enable_bm(rdev);
 
 	if (rdev->flags & RADEON_IS_PCIE) {
 		r = rv370_pcie_gart_init(rdev);
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 936d107..36c9b86 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -2468,6 +2468,8 @@ int r600_startup(struct radeon_device *rdev)
 	/* enable pcie gen2 link */
 	r600_pcie_gen2_enable(rdev);
 
+	pci_set_master(rdev->pdev);
+
 	if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) {
 		r = r600_init_microcode(rdev);
 		if (r) {
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
index 601b6bd..be2c122 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -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;
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index e4e2132..ac1b451 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -1043,6 +1043,8 @@ static int rv770_startup(struct radeon_device *rdev)
 	/* enable pcie gen2 link */
 	rv770_pcie_gen2_enable(rdev);
 
+	pci_set_master(rdev->pdev);
+
 	if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) {
 		r = r600_init_microcode(rdev);
 		if (r) {
-- 
1.7.7.3



More information about the dri-devel mailing list