Commit e6be8d9d17bd44061116f601fe2609b3ace7aa69

Authored by Zhenyu Wang
Committed by Dave Airlie
1 parent 29ebdf925c

drm: remove address mask param for drm_pci_alloc()

drm_pci_alloc() has input of address mask for setting pci dma
mask on the device, which should be properly setup by drm driver.
And leave it as a param for drm_pci_alloc() would cause confusion
or mistake would corrupt the correct dma mask setting, as seen on
intel hw which set wrong dma mask for hw status page. So remove
it from drm_pci_alloc() function.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

Showing 6 changed files with 14 additions and 14 deletions Side-by-side Diff

drivers/gpu/drm/ati_pcigart.c
... ... @@ -39,8 +39,7 @@
39 39 struct drm_ati_pcigart_info *gart_info)
40 40 {
41 41 gart_info->table_handle = drm_pci_alloc(dev, gart_info->table_size,
42   - PAGE_SIZE,
43   - gart_info->table_mask);
  42 + PAGE_SIZE);
44 43 if (gart_info->table_handle == NULL)
45 44 return -ENOMEM;
46 45  
... ... @@ -111,6 +110,13 @@
111 110  
112 111 if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) {
113 112 DRM_DEBUG("PCI: no table in VRAM: using normal RAM\n");
  113 +
  114 + if (pci_set_dma_mask(dev->pdev, gart_info->table_mask)) {
  115 + DRM_ERROR("fail to set dma mask to 0x%Lx\n",
  116 + gart_info->table_mask);
  117 + ret = 1;
  118 + goto done;
  119 + }
114 120  
115 121 ret = drm_ati_alloc_pcigart_table(dev, gart_info);
116 122 if (ret) {
drivers/gpu/drm/drm_bufs.c
... ... @@ -326,7 +326,7 @@
326 326 * As we're limiting the address to 2^32-1 (or less),
327 327 * casting it down to 32 bits is no problem, but we
328 328 * need to point to a 64bit variable first. */
329   - dmah = drm_pci_alloc(dev, map->size, map->size, 0xffffffffUL);
  329 + dmah = drm_pci_alloc(dev, map->size, map->size);
330 330 if (!dmah) {
331 331 kfree(map);
332 332 return -ENOMEM;
... ... @@ -885,7 +885,7 @@
885 885  
886 886 while (entry->buf_count < count) {
887 887  
888   - dmah = drm_pci_alloc(dev, PAGE_SIZE << page_order, 0x1000, 0xfffffffful);
  888 + dmah = drm_pci_alloc(dev, PAGE_SIZE << page_order, 0x1000);
889 889  
890 890 if (!dmah) {
891 891 /* Set count correctly so we free the proper amount. */
drivers/gpu/drm/drm_pci.c
... ... @@ -47,8 +47,7 @@
47 47 /**
48 48 * \brief Allocate a PCI consistent memory block, for DMA.
49 49 */
50   -drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t align,
51   - dma_addr_t maxaddr)
  50 +drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t align)
52 51 {
53 52 drm_dma_handle_t *dmah;
54 53 #if 1
... ... @@ -62,11 +61,6 @@
62 61 */
63 62 if (align > size)
64 63 return NULL;
65   -
66   - if (pci_set_dma_mask(dev->pdev, maxaddr) != 0) {
67   - DRM_ERROR("Setting pci dma mask failed\n");
68   - return NULL;
69   - }
70 64  
71 65 dmah = kmalloc(sizeof(drm_dma_handle_t), GFP_KERNEL);
72 66 if (!dmah)
drivers/gpu/drm/i915/i915_dma.c
... ... @@ -123,7 +123,7 @@
123 123 drm_i915_private_t *dev_priv = dev->dev_private;
124 124 /* Program Hardware Status Page */
125 125 dev_priv->status_page_dmah =
126   - drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE, 0xffffffff);
  126 + drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE);
127 127  
128 128 if (!dev_priv->status_page_dmah) {
129 129 DRM_ERROR("Can not allocate hardware status page\n");
drivers/gpu/drm/i915/i915_gem.c
... ... @@ -4708,7 +4708,7 @@
4708 4708  
4709 4709 phys_obj->id = id;
4710 4710  
4711   - phys_obj->handle = drm_pci_alloc(dev, size, 0, 0xffffffff);
  4711 + phys_obj->handle = drm_pci_alloc(dev, size, 0);
4712 4712 if (!phys_obj->handle) {
4713 4713 ret = -ENOMEM;
4714 4714 goto kfree_obj;
... ... @@ -1408,7 +1408,7 @@
1408 1408 struct drm_ati_pcigart_info * gart_info);
1409 1409  
1410 1410 extern drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size,
1411   - size_t align, dma_addr_t maxaddr);
  1411 + size_t align);
1412 1412 extern void __drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah);
1413 1413 extern void drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah);
1414 1414