Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: Remove __OS_HAS_AGP

We already express the drm/agp depencies correctly in Kconfig, so we
can rip this remnant from the shared drm core days.

Aside: Pretty much all the #ifdefs in radeon/nouveau could be killed
if ttm would provide dummy functions. I'm not going to volunteer for
that though.

v2: Use IS_ENABLED(CONFIG_AGP) as suggested by Ville

v3: Polish from Ville's review.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Christian König <christian.koenig@amd.com> (v2)
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

+55 -61
+2 -1
drivers/gpu/drm/Makefile
··· 6 6 drm_context.o drm_dma.o \ 7 7 drm_fops.o drm_gem.o drm_ioctl.o drm_irq.o \ 8 8 drm_lock.o drm_memory.o drm_drv.o drm_vm.o \ 9 - drm_agpsupport.o drm_scatter.o drm_pci.o \ 9 + drm_scatter.o drm_pci.o \ 10 10 drm_platform.o drm_sysfs.o drm_hashtab.o drm_mm.o \ 11 11 drm_crtc.o drm_modes.o drm_edid.o \ 12 12 drm_info.o drm_debugfs.o drm_encoder_slave.o \ ··· 19 19 drm-$(CONFIG_PCI) += ati_pcigart.o 20 20 drm-$(CONFIG_DRM_PANEL) += drm_panel.o 21 21 drm-$(CONFIG_OF) += drm_of.o 22 + drm-$(CONFIG_AGP) += drm_agpsupport.o 22 23 23 24 drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o drm_probe_helper.o \ 24 25 drm_plane_helper.o drm_dp_mst_topology.o drm_atomic_helper.o
-4
drivers/gpu/drm/drm_agpsupport.c
··· 36 36 #include <linux/slab.h> 37 37 #include "drm_legacy.h" 38 38 39 - #if __OS_HAS_AGP 40 - 41 39 #include <asm/agp.h> 42 40 43 41 /** ··· 500 502 return mem; 501 503 } 502 504 EXPORT_SYMBOL(drm_agp_bind_pages); 503 - 504 - #endif /* __OS_HAS_AGP */
+3 -3
drivers/gpu/drm/drm_bufs.c
··· 582 582 } 583 583 } 584 584 585 - #if __OS_HAS_AGP 585 + #if IS_ENABLED(CONFIG_AGP) 586 586 /** 587 587 * Add AGP buffers for DMA transfers. 588 588 * ··· 756 756 return 0; 757 757 } 758 758 EXPORT_SYMBOL(drm_legacy_addbufs_agp); 759 - #endif /* __OS_HAS_AGP */ 759 + #endif /* CONFIG_AGP */ 760 760 761 761 int drm_legacy_addbufs_pci(struct drm_device *dev, 762 762 struct drm_buf_desc *request) ··· 1145 1145 if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) 1146 1146 return -EINVAL; 1147 1147 1148 - #if __OS_HAS_AGP 1148 + #if IS_ENABLED(CONFIG_AGP) 1149 1149 if (request->flags & _DRM_AGP_BUFFER) 1150 1150 ret = drm_legacy_addbufs_agp(dev, request); 1151 1151 else
+3 -3
drivers/gpu/drm/drm_ioc32.c
··· 720 720 return 0; 721 721 } 722 722 723 - #if __OS_HAS_AGP 723 + #if IS_ENABLED(CONFIG_AGP) 724 724 typedef struct drm_agp_mode32 { 725 725 u32 mode; /**< AGP mode */ 726 726 } drm_agp_mode32_t; ··· 882 882 883 883 return drm_ioctl(file, DRM_IOCTL_AGP_UNBIND, (unsigned long)request); 884 884 } 885 - #endif /* __OS_HAS_AGP */ 885 + #endif /* CONFIG_AGP */ 886 886 887 887 typedef struct drm_scatter_gather32 { 888 888 u32 size; /**< In bytes -- will round to page boundary */ ··· 1090 1090 [DRM_IOCTL_NR(DRM_IOCTL_GET_SAREA_CTX32)] = compat_drm_getsareactx, 1091 1091 [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX32)] = compat_drm_resctx, 1092 1092 [DRM_IOCTL_NR(DRM_IOCTL_DMA32)] = compat_drm_dma, 1093 - #if __OS_HAS_AGP 1093 + #if IS_ENABLED(CONFIG_AGP) 1094 1094 [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE32)] = compat_drm_agp_enable, 1095 1095 [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO32)] = compat_drm_agp_info, 1096 1096 [DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC32)] = compat_drm_agp_alloc,
+1 -1
drivers/gpu/drm/drm_ioctl.c
··· 571 571 572 572 DRM_IOCTL_DEF(DRM_IOCTL_CONTROL, drm_control, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), 573 573 574 - #if __OS_HAS_AGP 574 + #if IS_ENABLED(CONFIG_AGP) 575 575 DRM_IOCTL_DEF(DRM_IOCTL_AGP_ACQUIRE, drm_agp_acquire_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), 576 576 DRM_IOCTL_DEF(DRM_IOCTL_AGP_RELEASE, drm_agp_release_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), 577 577 DRM_IOCTL_DEF(DRM_IOCTL_AGP_ENABLE, drm_agp_enable_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
+3 -3
drivers/gpu/drm/drm_memory.c
··· 38 38 #include <drm/drmP.h> 39 39 #include "drm_legacy.h" 40 40 41 - #if __OS_HAS_AGP 41 + #if IS_ENABLED(CONFIG_AGP) 42 42 43 43 #ifdef HAVE_PAGE_AGP 44 44 # include <asm/agp.h> ··· 111 111 return agp_unbind_memory(handle); 112 112 } 113 113 114 - #else /* __OS_HAS_AGP */ 114 + #else /* CONFIG_AGP */ 115 115 static inline void *agp_remap(unsigned long offset, unsigned long size, 116 116 struct drm_device * dev) 117 117 { 118 118 return NULL; 119 119 } 120 120 121 - #endif /* agp */ 121 + #endif /* CONFIG_AGP */ 122 122 123 123 void drm_legacy_ioremap(struct drm_local_map *map, struct drm_device *dev) 124 124 {
+4 -4
drivers/gpu/drm/drm_vm.c
··· 95 95 * Find the right map and if it's AGP memory find the real physical page to 96 96 * map, get the page, increment the use count and return it. 97 97 */ 98 - #if __OS_HAS_AGP 98 + #if IS_ENABLED(CONFIG_AGP) 99 99 static int drm_do_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf) 100 100 { 101 101 struct drm_file *priv = vma->vm_file->private_data; ··· 168 168 vm_fault_error: 169 169 return VM_FAULT_SIGBUS; /* Disallow mremap */ 170 170 } 171 - #else /* __OS_HAS_AGP */ 171 + #else 172 172 static int drm_do_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf) 173 173 { 174 174 return VM_FAULT_SIGBUS; 175 175 } 176 - #endif /* __OS_HAS_AGP */ 176 + #endif 177 177 178 178 /** 179 179 * \c nopage method for shared virtual memory. ··· 556 556 * --BenH. 557 557 */ 558 558 if (!vma->vm_pgoff 559 - #if __OS_HAS_AGP 559 + #if IS_ENABLED(CONFIG_AGP) 560 560 && (!dev->agp 561 561 || dev->agp->agp_info.device->vendor != PCI_VENDOR_ID_APPLE) 562 562 #endif
+2 -2
drivers/gpu/drm/mga/mga_dma.c
··· 416 416 return 0; 417 417 } 418 418 419 - #if __OS_HAS_AGP 419 + #if IS_ENABLED(CONFIG_AGP) 420 420 /** 421 421 * Bootstrap the driver for AGP DMA. 422 422 * ··· 947 947 drm_legacy_ioremapfree(dev->agp_buffer_map, dev); 948 948 949 949 if (dev_priv->used_new_dma_init) { 950 - #if __OS_HAS_AGP 950 + #if IS_ENABLED(CONFIG_AGP) 951 951 if (dev_priv->agp_handle != 0) { 952 952 struct drm_agp_binding unbind_req; 953 953 struct drm_agp_buffer free_req;
+4 -4
drivers/gpu/drm/nouveau/nouveau_bo.c
··· 574 574 nouveau_ttm_tt_create(struct ttm_bo_device *bdev, unsigned long size, 575 575 uint32_t page_flags, struct page *dummy_read) 576 576 { 577 - #if __OS_HAS_AGP 577 + #if IS_ENABLED(CONFIG_AGP) 578 578 struct nouveau_drm *drm = nouveau_bdev(bdev); 579 579 580 580 if (drm->agp.bridge) { ··· 1366 1366 /* System memory */ 1367 1367 return 0; 1368 1368 case TTM_PL_TT: 1369 - #if __OS_HAS_AGP 1369 + #if IS_ENABLED(CONFIG_AGP) 1370 1370 if (drm->agp.bridge) { 1371 1371 mem->bus.offset = mem->start << PAGE_SHIFT; 1372 1372 mem->bus.base = drm->agp.base; ··· 1496 1496 ttm->caching_state == tt_uncached) 1497 1497 return ttm_dma_populate(ttm_dma, dev->dev); 1498 1498 1499 - #if __OS_HAS_AGP 1499 + #if IS_ENABLED(CONFIG_AGP) 1500 1500 if (drm->agp.bridge) { 1501 1501 return ttm_agp_tt_populate(ttm); 1502 1502 } ··· 1563 1563 return; 1564 1564 } 1565 1565 1566 - #if __OS_HAS_AGP 1566 + #if IS_ENABLED(CONFIG_AGP) 1567 1567 if (drm->agp.bridge) { 1568 1568 ttm_agp_tt_unpopulate(ttm); 1569 1569 return;
+6 -6
drivers/gpu/drm/r128/r128_cce.c
··· 311 311 /* The manual (p. 2) says this address is in "VM space". This 312 312 * means it's an offset from the start of AGP space. 313 313 */ 314 - #if __OS_HAS_AGP 314 + #if IS_ENABLED(CONFIG_AGP) 315 315 if (!dev_priv->is_pci) 316 316 ring_start = dev_priv->cce_ring->offset - dev->agp->base; 317 317 else ··· 505 505 (drm_r128_sarea_t *) ((u8 *) dev_priv->sarea->handle + 506 506 init->sarea_priv_offset); 507 507 508 - #if __OS_HAS_AGP 508 + #if IS_ENABLED(CONFIG_AGP) 509 509 if (!dev_priv->is_pci) { 510 510 drm_legacy_ioremap_wc(dev_priv->cce_ring, dev); 511 511 drm_legacy_ioremap_wc(dev_priv->ring_rptr, dev); ··· 529 529 (void *)(unsigned long)dev->agp_buffer_map->offset; 530 530 } 531 531 532 - #if __OS_HAS_AGP 532 + #if IS_ENABLED(CONFIG_AGP) 533 533 if (!dev_priv->is_pci) 534 534 dev_priv->cce_buffers_offset = dev->agp->base; 535 535 else ··· 552 552 dev_priv->sarea_priv->last_dispatch = 0; 553 553 R128_WRITE(R128_LAST_DISPATCH_REG, dev_priv->sarea_priv->last_dispatch); 554 554 555 - #if __OS_HAS_AGP 555 + #if IS_ENABLED(CONFIG_AGP) 556 556 if (dev_priv->is_pci) { 557 557 #endif 558 558 dev_priv->gart_info.table_mask = DMA_BIT_MASK(32); ··· 568 568 return -ENOMEM; 569 569 } 570 570 R128_WRITE(R128_PCI_GART_PAGE, dev_priv->gart_info.bus_addr); 571 - #if __OS_HAS_AGP 571 + #if IS_ENABLED(CONFIG_AGP) 572 572 } 573 573 #endif 574 574 ··· 600 600 if (dev->dev_private) { 601 601 drm_r128_private_t *dev_priv = dev->dev_private; 602 602 603 - #if __OS_HAS_AGP 603 + #if IS_ENABLED(CONFIG_AGP) 604 604 if (!dev_priv->is_pci) { 605 605 if (dev_priv->cce_ring != NULL) 606 606 drm_legacy_ioremapfree(dev_priv->cce_ring, dev);
+7 -7
drivers/gpu/drm/radeon/r600_cp.c
··· 1837 1837 SET_RING_HEAD(dev_priv, 0); 1838 1838 dev_priv->ring.tail = 0; 1839 1839 1840 - #if __OS_HAS_AGP 1840 + #if IS_ENABLED(CONFIG_AGP) 1841 1841 if (dev_priv->flags & RADEON_IS_AGP) { 1842 1842 rptr_addr = dev_priv->ring_rptr->offset 1843 1843 - dev->agp->base + ··· 1863 1863 dev_priv->ring.size_l2qw); 1864 1864 #endif 1865 1865 1866 - #if __OS_HAS_AGP 1866 + #if IS_ENABLED(CONFIG_AGP) 1867 1867 if (dev_priv->flags & RADEON_IS_AGP) { 1868 1868 /* XXX */ 1869 1869 radeon_write_agp_base(dev_priv, dev->agp->base); ··· 1946 1946 if (dev->irq_enabled) 1947 1947 drm_irq_uninstall(dev); 1948 1948 1949 - #if __OS_HAS_AGP 1949 + #if IS_ENABLED(CONFIG_AGP) 1950 1950 if (dev_priv->flags & RADEON_IS_AGP) { 1951 1951 if (dev_priv->cp_ring != NULL) { 1952 1952 drm_legacy_ioremapfree(dev_priv->cp_ring, dev); ··· 2089 2089 } 2090 2090 } 2091 2091 2092 - #if __OS_HAS_AGP 2092 + #if IS_ENABLED(CONFIG_AGP) 2093 2093 /* XXX */ 2094 2094 if (dev_priv->flags & RADEON_IS_AGP) { 2095 2095 drm_legacy_ioremap_wc(dev_priv->cp_ring, dev); ··· 2148 2148 * location in the card and on the bus, though we have to 2149 2149 * align it down. 2150 2150 */ 2151 - #if __OS_HAS_AGP 2151 + #if IS_ENABLED(CONFIG_AGP) 2152 2152 /* XXX */ 2153 2153 if (dev_priv->flags & RADEON_IS_AGP) { 2154 2154 base = dev->agp->base; ··· 2175 2175 base, dev_priv->gart_vm_start); 2176 2176 } 2177 2177 2178 - #if __OS_HAS_AGP 2178 + #if IS_ENABLED(CONFIG_AGP) 2179 2179 /* XXX */ 2180 2180 if (dev_priv->flags & RADEON_IS_AGP) 2181 2181 dev_priv->gart_buffers_offset = (dev->agp_buffer_map->offset ··· 2212 2212 2213 2213 dev_priv->ring.high_mark = RADEON_RING_HIGH_MARK; 2214 2214 2215 - #if __OS_HAS_AGP 2215 + #if IS_ENABLED(CONFIG_AGP) 2216 2216 if (dev_priv->flags & RADEON_IS_AGP) { 2217 2217 /* XXX turn off pcie gart */ 2218 2218 } else
+4 -4
drivers/gpu/drm/radeon/radeon_agp.c
··· 28 28 #include "radeon.h" 29 29 #include <drm/radeon_drm.h> 30 30 31 - #if __OS_HAS_AGP 31 + #if IS_ENABLED(CONFIG_AGP) 32 32 33 33 struct radeon_agpmode_quirk { 34 34 u32 hostbridge_vendor; ··· 123 123 124 124 int radeon_agp_init(struct radeon_device *rdev) 125 125 { 126 - #if __OS_HAS_AGP 126 + #if IS_ENABLED(CONFIG_AGP) 127 127 struct radeon_agpmode_quirk *p = radeon_agpmode_quirk_list; 128 128 struct drm_agp_mode mode; 129 129 struct drm_agp_info info; ··· 257 257 258 258 void radeon_agp_resume(struct radeon_device *rdev) 259 259 { 260 - #if __OS_HAS_AGP 260 + #if IS_ENABLED(CONFIG_AGP) 261 261 int r; 262 262 if (rdev->flags & RADEON_IS_AGP) { 263 263 r = radeon_agp_init(rdev); ··· 269 269 270 270 void radeon_agp_fini(struct radeon_device *rdev) 271 271 { 272 - #if __OS_HAS_AGP 272 + #if IS_ENABLED(CONFIG_AGP) 273 273 if (rdev->ddev->agp && rdev->ddev->agp->acquired) { 274 274 drm_agp_release(rdev->ddev); 275 275 }
+8 -8
drivers/gpu/drm/radeon/radeon_cp.c
··· 762 762 ((dev_priv->gart_vm_start - 1) & 0xffff0000) 763 763 | (dev_priv->fb_location >> 16)); 764 764 765 - #if __OS_HAS_AGP 765 + #if IS_ENABLED(CONFIG_AGP) 766 766 if (dev_priv->flags & RADEON_IS_AGP) { 767 767 radeon_write_agp_base(dev_priv, dev->agp->base); 768 768 ··· 791 791 SET_RING_HEAD(dev_priv, cur_read_ptr); 792 792 dev_priv->ring.tail = cur_read_ptr; 793 793 794 - #if __OS_HAS_AGP 794 + #if IS_ENABLED(CONFIG_AGP) 795 795 if (dev_priv->flags & RADEON_IS_AGP) { 796 796 RADEON_WRITE(RADEON_CP_RB_RPTR_ADDR, 797 797 dev_priv->ring_rptr->offset ··· 1335 1335 } 1336 1336 } 1337 1337 1338 - #if __OS_HAS_AGP 1338 + #if IS_ENABLED(CONFIG_AGP) 1339 1339 if (dev_priv->flags & RADEON_IS_AGP) { 1340 1340 drm_legacy_ioremap_wc(dev_priv->cp_ring, dev); 1341 1341 drm_legacy_ioremap_wc(dev_priv->ring_rptr, dev); ··· 1394 1394 * location in the card and on the bus, though we have to 1395 1395 * align it down. 1396 1396 */ 1397 - #if __OS_HAS_AGP 1397 + #if IS_ENABLED(CONFIG_AGP) 1398 1398 if (dev_priv->flags & RADEON_IS_AGP) { 1399 1399 base = dev->agp->base; 1400 1400 /* Check if valid */ ··· 1424 1424 RADEON_READ(RADEON_CONFIG_APER_SIZE); 1425 1425 } 1426 1426 1427 - #if __OS_HAS_AGP 1427 + #if IS_ENABLED(CONFIG_AGP) 1428 1428 if (dev_priv->flags & RADEON_IS_AGP) 1429 1429 dev_priv->gart_buffers_offset = (dev->agp_buffer_map->offset 1430 1430 - dev->agp->base ··· 1455 1455 1456 1456 dev_priv->ring.high_mark = RADEON_RING_HIGH_MARK; 1457 1457 1458 - #if __OS_HAS_AGP 1458 + #if IS_ENABLED(CONFIG_AGP) 1459 1459 if (dev_priv->flags & RADEON_IS_AGP) { 1460 1460 /* Turn off PCI GART */ 1461 1461 radeon_set_pcigart(dev_priv, 0); ··· 1566 1566 if (dev->irq_enabled) 1567 1567 drm_irq_uninstall(dev); 1568 1568 1569 - #if __OS_HAS_AGP 1569 + #if IS_ENABLED(CONFIG_AGP) 1570 1570 if (dev_priv->flags & RADEON_IS_AGP) { 1571 1571 if (dev_priv->cp_ring != NULL) { 1572 1572 drm_legacy_ioremapfree(dev_priv->cp_ring, dev); ··· 1625 1625 1626 1626 DRM_DEBUG("Starting radeon_do_resume_cp()\n"); 1627 1627 1628 - #if __OS_HAS_AGP 1628 + #if IS_ENABLED(CONFIG_AGP) 1629 1629 if (dev_priv->flags & RADEON_IS_AGP) { 1630 1630 /* Turn off PCI GART */ 1631 1631 radeon_set_pcigart(dev_priv, 0);
+5 -5
drivers/gpu/drm/radeon/radeon_ttm.c
··· 144 144 man->available_caching = TTM_PL_MASK_CACHING; 145 145 man->default_caching = TTM_PL_FLAG_CACHED; 146 146 man->flags = TTM_MEMTYPE_FLAG_MAPPABLE | TTM_MEMTYPE_FLAG_CMA; 147 - #if __OS_HAS_AGP 147 + #if IS_ENABLED(CONFIG_AGP) 148 148 if (rdev->flags & RADEON_IS_AGP) { 149 149 if (!rdev->ddev->agp) { 150 150 DRM_ERROR("AGP is not enabled for memory type %u\n", ··· 461 461 /* system memory */ 462 462 return 0; 463 463 case TTM_PL_TT: 464 - #if __OS_HAS_AGP 464 + #if IS_ENABLED(CONFIG_AGP) 465 465 if (rdev->flags & RADEON_IS_AGP) { 466 466 /* RADEON_IS_AGP is set only if AGP is active */ 467 467 mem->bus.offset = mem->start << PAGE_SHIFT; ··· 680 680 struct radeon_ttm_tt *gtt; 681 681 682 682 rdev = radeon_get_rdev(bdev); 683 - #if __OS_HAS_AGP 683 + #if IS_ENABLED(CONFIG_AGP) 684 684 if (rdev->flags & RADEON_IS_AGP) { 685 685 return ttm_agp_tt_create(bdev, rdev->ddev->agp->bridge, 686 686 size, page_flags, dummy_read_page); ··· 736 736 } 737 737 738 738 rdev = radeon_get_rdev(ttm->bdev); 739 - #if __OS_HAS_AGP 739 + #if IS_ENABLED(CONFIG_AGP) 740 740 if (rdev->flags & RADEON_IS_AGP) { 741 741 return ttm_agp_tt_populate(ttm); 742 742 } ··· 787 787 return; 788 788 789 789 rdev = radeon_get_rdev(ttm->bdev); 790 - #if __OS_HAS_AGP 790 + #if IS_ENABLED(CONFIG_AGP) 791 791 if (rdev->flags & RADEON_IS_AGP) { 792 792 ttm_agp_tt_unpopulate(ttm); 793 793 return;
+3 -6
include/drm/drm_agpsupport.h
··· 12 12 struct drm_device; 13 13 struct drm_file; 14 14 15 - #define __OS_HAS_AGP (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && \ 16 - defined(MODULE))) 17 - 18 15 struct drm_agp_head { 19 16 struct agp_kern_info agp_info; 20 17 struct list_head memory; ··· 25 28 unsigned long page_mask; 26 29 }; 27 30 28 - #if __OS_HAS_AGP 31 + #if IS_ENABLED(CONFIG_AGP) 29 32 30 33 void drm_free_agp(struct agp_memory * handle, int pages); 31 34 int drm_bind_agp(struct agp_memory * handle, unsigned int start); ··· 63 66 int drm_agp_bind_ioctl(struct drm_device *dev, void *data, 64 67 struct drm_file *file_priv); 65 68 66 - #else /* __OS_HAS_AGP */ 69 + #else /* CONFIG_AGP */ 67 70 68 71 static inline void drm_free_agp(struct agp_memory * handle, int pages) 69 72 { ··· 191 194 return -ENODEV; 192 195 } 193 196 194 - #endif /* __OS_HAS_AGP */ 197 + #endif /* CONFIG_AGP */ 195 198 196 199 #endif /* _DRM_AGPSUPPORT_H_ */