aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2011-12-19 06:15:29 -0500
committerDave Airlie <airlied@redhat.com>2012-02-16 13:31:07 -0500
commit466e69b8b03b8c1987367912782bc12988ad8794 (patch)
tree60ac84ef32b7590618bc81b0b52a5ba14a49bf45
parent42b923b587d055cd98fb84f32e3e758672026ae9 (diff)
drm: move pci bus master enable into driver.
The current enabling of bus mastering in the drm midlayer allows a large race condition under kexec. When a kexec'ed kernel re-enables bus mastering for the GPU, previously setup dma blocks may cause writes to random pieces of memory. On radeon the writeback mechanism can cause these sorts of issues. This patch doesn't fix the problem, but it moves the bus master enable under the individual drivers control so they can move enabling it until later in their load cycle and close the race. Fix for radeon kms driver will be in a follow-up patch. Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--drivers/gpu/drm/drm_pci.c2
-rw-r--r--drivers/gpu/drm/gma500/psb_drv.c2
-rw-r--r--drivers/gpu/drm/i810/i810_dma.c2
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c2
-rw-r--r--drivers/gpu/drm/mga/mga_dma.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_state.c2
-rw-r--r--drivers/gpu/drm/r128/r128_drv.c1
-rw-r--r--drivers/gpu/drm/radeon/radeon_cp.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_kms.c2
-rw-r--r--drivers/gpu/drm/sis/sis_drv.c2
-rw-r--r--drivers/gpu/drm/via/via_map.c2
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_drv.c2
12 files changed, 21 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index d4d10b7880cf..13f3d936472f 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -324,8 +324,6 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
324 if (ret) 324 if (ret)
325 goto err_g1; 325 goto err_g1;
326 326
327 pci_set_master(pdev);
328
329 dev->pdev = pdev; 327 dev->pdev = pdev;
330 dev->dev = &pdev->dev; 328 dev->dev = &pdev->dev;
331 329
diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
index f14768f2b364..1f57aac2cf80 100644
--- a/drivers/gpu/drm/gma500/psb_drv.c
+++ b/drivers/gpu/drm/gma500/psb_drv.c
@@ -283,6 +283,8 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset)
283 dev_priv->dev = dev; 283 dev_priv->dev = dev;
284 dev->dev_private = (void *) dev_priv; 284 dev->dev_private = (void *) dev_priv;
285 285
286 pci_set_master(dev->pdev);
287
286 if (!IS_PSB(dev)) { 288 if (!IS_PSB(dev)) {
287 if (pci_enable_msi(dev->pdev)) 289 if (pci_enable_msi(dev->pdev))
288 dev_warn(dev->dev, "Enabling MSI failed!\n"); 290 dev_warn(dev->dev, "Enabling MSI failed!\n");
diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c
index 7f4b4e10246e..64a989ed5b8f 100644
--- a/drivers/gpu/drm/i810/i810_dma.c
+++ b/drivers/gpu/drm/i810/i810_dma.c
@@ -1208,6 +1208,8 @@ int i810_driver_load(struct drm_device *dev, unsigned long flags)
1208 dev->types[8] = _DRM_STAT_SECONDARY; 1208 dev->types[8] = _DRM_STAT_SECONDARY;
1209 dev->types[9] = _DRM_STAT_DMA; 1209 dev->types[9] = _DRM_STAT_DMA;
1210 1210
1211 pci_set_master(dev->pdev);
1212
1211 return 0; 1213 return 0;
1212} 1214}
1213 1215
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 8919dcc07ed8..a8081f2efaea 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1933,6 +1933,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
1933 goto free_priv; 1933 goto free_priv;
1934 } 1934 }
1935 1935
1936 pci_set_master(dev->pdev);
1937
1936 /* overlay on gen2 is broken and can't address above 1G */ 1938 /* overlay on gen2 is broken and can't address above 1G */
1937 if (IS_GEN2(dev)) 1939 if (IS_GEN2(dev))
1938 dma_set_coherent_mask(&dev->pdev->dev, DMA_BIT_MASK(30)); 1940 dma_set_coherent_mask(&dev->pdev->dev, DMA_BIT_MASK(30));
diff --git a/drivers/gpu/drm/mga/mga_dma.c b/drivers/gpu/drm/mga/mga_dma.c
index 5ccb65deb83c..507aa3df0168 100644
--- a/drivers/gpu/drm/mga/mga_dma.c
+++ b/drivers/gpu/drm/mga/mga_dma.c
@@ -403,6 +403,8 @@ int mga_driver_load(struct drm_device *dev, unsigned long flags)
403 dev_priv->usec_timeout = MGA_DEFAULT_USEC_TIMEOUT; 403 dev_priv->usec_timeout = MGA_DEFAULT_USEC_TIMEOUT;
404 dev_priv->chipset = flags; 404 dev_priv->chipset = flags;
405 405
406 pci_set_master(dev->pdev);
407
406 dev_priv->mmio_base = pci_resource_start(dev->pdev, 1); 408 dev_priv->mmio_base = pci_resource_start(dev->pdev, 1);
407 dev_priv->mmio_size = pci_resource_len(dev->pdev, 1); 409 dev_priv->mmio_size = pci_resource_len(dev->pdev, 1);
408 410
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c
index f80c5e0762ff..912839c2bc16 100644
--- a/drivers/gpu/drm/nouveau/nouveau_state.c
+++ b/drivers/gpu/drm/nouveau/nouveau_state.c
@@ -1002,6 +1002,8 @@ int nouveau_load(struct drm_device *dev, unsigned long flags)
1002 dev->dev_private = dev_priv; 1002 dev->dev_private = dev_priv;
1003 dev_priv->dev = dev; 1003 dev_priv->dev = dev;
1004 1004
1005 pci_set_master(dev->pdev);
1006
1005 dev_priv->flags = flags & NOUVEAU_FLAGS; 1007 dev_priv->flags = flags & NOUVEAU_FLAGS;
1006 1008
1007 NV_DEBUG(dev, "vendor: 0x%X device: 0x%X class: 0x%X\n", 1009 NV_DEBUG(dev, "vendor: 0x%X device: 0x%X class: 0x%X\n",
diff --git a/drivers/gpu/drm/r128/r128_drv.c b/drivers/gpu/drm/r128/r128_drv.c
index 6a5f4395838f..88718fad5d6d 100644
--- a/drivers/gpu/drm/r128/r128_drv.c
+++ b/drivers/gpu/drm/r128/r128_drv.c
@@ -85,6 +85,7 @@ static struct drm_driver driver = {
85 85
86int r128_driver_load(struct drm_device *dev, unsigned long flags) 86int r128_driver_load(struct drm_device *dev, unsigned long flags)
87{ 87{
88 pci_set_master(dev->pdev);
88 return drm_vblank_init(dev, 1); 89 return drm_vblank_init(dev, 1);
89} 90}
90 91
diff --git a/drivers/gpu/drm/radeon/radeon_cp.c b/drivers/gpu/drm/radeon/radeon_cp.c
index 72ae8266b8e9..0ebb7d4796fa 100644
--- a/drivers/gpu/drm/radeon/radeon_cp.c
+++ b/drivers/gpu/drm/radeon/radeon_cp.c
@@ -2115,6 +2115,8 @@ int radeon_driver_load(struct drm_device *dev, unsigned long flags)
2115 break; 2115 break;
2116 } 2116 }
2117 2117
2118 pci_set_master(dev->pdev);
2119
2118 if (drm_pci_device_is_agp(dev)) 2120 if (drm_pci_device_is_agp(dev))
2119 dev_priv->flags |= RADEON_IS_AGP; 2121 dev_priv->flags |= RADEON_IS_AGP;
2120 else if (pci_is_pcie(dev->pdev)) 2122 else if (pci_is_pcie(dev->pdev))
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
index d3352889a870..1986ebae1ef2 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -57,6 +57,8 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags)
57 } 57 }
58 dev->dev_private = (void *)rdev; 58 dev->dev_private = (void *)rdev;
59 59
60 pci_set_master(dev->pdev);
61
60 /* update BUS flag */ 62 /* update BUS flag */
61 if (drm_pci_device_is_agp(dev)) { 63 if (drm_pci_device_is_agp(dev)) {
62 flags |= RADEON_IS_AGP; 64 flags |= RADEON_IS_AGP;
diff --git a/drivers/gpu/drm/sis/sis_drv.c b/drivers/gpu/drm/sis/sis_drv.c
index 573220cc5269..30d98d14b5c5 100644
--- a/drivers/gpu/drm/sis/sis_drv.c
+++ b/drivers/gpu/drm/sis/sis_drv.c
@@ -41,6 +41,8 @@ static int sis_driver_load(struct drm_device *dev, unsigned long chipset)
41{ 41{
42 drm_sis_private_t *dev_priv; 42 drm_sis_private_t *dev_priv;
43 43
44 pci_set_master(dev->pdev);
45
44 dev_priv = kzalloc(sizeof(drm_sis_private_t), GFP_KERNEL); 46 dev_priv = kzalloc(sizeof(drm_sis_private_t), GFP_KERNEL);
45 if (dev_priv == NULL) 47 if (dev_priv == NULL)
46 return -ENOMEM; 48 return -ENOMEM;
diff --git a/drivers/gpu/drm/via/via_map.c b/drivers/gpu/drm/via/via_map.c
index a2ab34365151..1f182254e81e 100644
--- a/drivers/gpu/drm/via/via_map.c
+++ b/drivers/gpu/drm/via/via_map.c
@@ -106,6 +106,8 @@ int via_driver_load(struct drm_device *dev, unsigned long chipset)
106 106
107 idr_init(&dev->object_name_idr); 107 idr_init(&dev->object_name_idr);
108 108
109 pci_set_master(dev->pdev);
110
109 ret = drm_vblank_init(dev, 1); 111 ret = drm_vblank_init(dev, 1);
110 if (ret) { 112 if (ret) {
111 kfree(dev_priv); 113 kfree(dev_priv);
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index f076f66b1153..1760aba9ecef 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -439,6 +439,8 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
439 } 439 }
440 memset(dev_priv, 0, sizeof(*dev_priv)); 440 memset(dev_priv, 0, sizeof(*dev_priv));
441 441
442 pci_set_master(dev->pdev);
443
442 dev_priv->dev = dev; 444 dev_priv->dev = dev;
443 dev_priv->vmw_chipset = chipset; 445 dev_priv->vmw_chipset = chipset;
444 dev_priv->last_read_seqno = (uint32_t) -100; 446 dev_priv->last_read_seqno = (uint32_t) -100;