Message ID | 1459331120-27864-2-git-send-email-daniel.vetter@ffwll.ch (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 30 March 2016 at 10:45, Daniel Vetter <daniel.vetter@ffwll.ch> wrote: > --- a/drivers/gpu/drm/Kconfig > +++ b/drivers/gpu/drm/Kconfig > @@ -83,6 +83,7 @@ config DRM_LOAD_EDID_FIRMWARE > config DRM_TTM > tristate > depends on DRM > + depends on (AGP || AGP=n) Already part of config DRM, so we don't need it here ? > --- a/include/drm/ttm/ttm_bo_driver.h > +++ b/include/drm/ttm/ttm_bo_driver.h > @@ -1030,8 +1030,7 @@ extern pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp); > > extern const struct ttm_mem_type_manager_func ttm_bo_manager_func; > > -#if (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE))) > -#define TTM_HAS_AGP > +#ifdef CONFIG_AGP #if IS_ENABLED(CONFIG_AGP) ? -Emil
Hi Daniel, [auto build test ERROR on drm/drm-next] [also build test ERROR on v4.6-rc1 next-20160330] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] url: https://github.com/0day-ci/linux/commits/Daniel-Vetter/Another-shot-at-cruft-removal/20160330-174803 base: git://people.freedesktop.org/~airlied/linux.git drm-next config: i386-allmodconfig (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=i386 All error/warnings (new ones prefixed by >>): drivers/gpu/drm/nouveau/nouveau_bo.c: In function 'nouveau_ttm_tt_create': >> drivers/gpu/drm/nouveau/nouveau_bo.c:581:10: error: implicit declaration of function 'ttm_agp_tt_create' [-Werror=implicit-function-declaration] return ttm_agp_tt_create(bdev, drm->agp.bridge, size, ^ >> drivers/gpu/drm/nouveau/nouveau_bo.c:581:10: warning: return makes pointer from integer without a cast [-Wint-conversion] drivers/gpu/drm/nouveau/nouveau_bo.c: In function 'nouveau_ttm_tt_populate': >> drivers/gpu/drm/nouveau/nouveau_bo.c:1501:10: error: implicit declaration of function 'ttm_agp_tt_populate' [-Werror=implicit-function-declaration] return ttm_agp_tt_populate(ttm); ^ drivers/gpu/drm/nouveau/nouveau_bo.c: In function 'nouveau_ttm_tt_unpopulate': >> drivers/gpu/drm/nouveau/nouveau_bo.c:1568:3: error: implicit declaration of function 'ttm_agp_tt_unpopulate' [-Werror=implicit-function-declaration] ttm_agp_tt_unpopulate(ttm); ^ cc1: some warnings being treated as errors -- drivers/gpu/drm/radeon/radeon_ttm.c: In function 'radeon_ttm_tt_create': >> drivers/gpu/drm/radeon/radeon_ttm.c:685:10: error: implicit declaration of function 'ttm_agp_tt_create' [-Werror=implicit-function-declaration] return ttm_agp_tt_create(bdev, rdev->ddev->agp->bridge, ^ >> drivers/gpu/drm/radeon/radeon_ttm.c:685:10: warning: return makes pointer from integer without a cast [-Wint-conversion] drivers/gpu/drm/radeon/radeon_ttm.c: In function 'radeon_ttm_tt_populate': >> drivers/gpu/drm/radeon/radeon_ttm.c:741:10: error: implicit declaration of function 'ttm_agp_tt_populate' [-Werror=implicit-function-declaration] return ttm_agp_tt_populate(ttm); ^ drivers/gpu/drm/radeon/radeon_ttm.c: In function 'radeon_ttm_tt_unpopulate': >> drivers/gpu/drm/radeon/radeon_ttm.c:792:3: error: implicit declaration of function 'ttm_agp_tt_unpopulate' [-Werror=implicit-function-declaration] ttm_agp_tt_unpopulate(ttm); ^ cc1: some warnings being treated as errors vim +/ttm_agp_tt_unpopulate +1568 drivers/gpu/drm/nouveau/nouveau_bo.c 26c9e8eff Ben Skeggs 2015-08-20 1495 if (!nvxx_device(&drm->device)->func->cpu_coherent && c3a0c771e Alexandre Courbot 2014-10-27 1496 ttm->caching_state == tt_uncached) c3a0c771e Alexandre Courbot 2014-10-27 1497 return ttm_dma_populate(ttm_dma, dev->dev); c3a0c771e Alexandre Courbot 2014-10-27 1498 a7fb8a23c Daniel Vetter 2015-09-09 1499 #if IS_ENABLED(CONFIG_AGP) 340b0e7c5 Ben Skeggs 2015-08-20 1500 if (drm->agp.bridge) { dea7e0ac4 Jerome Glisse 2012-01-03 @1501 return ttm_agp_tt_populate(ttm); dea7e0ac4 Jerome Glisse 2012-01-03 1502 } dea7e0ac4 Jerome Glisse 2012-01-03 1503 #endif dea7e0ac4 Jerome Glisse 2012-01-03 1504 9bcd38de5 Alexandre Courbot 2016-03-02 1505 #if IS_ENABLED(CONFIG_SWIOTLB) && IS_ENABLED(CONFIG_X86) 3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1506 if (swiotlb_nr_tbl()) { 8e7e70522 Jerome Glisse 2011-11-09 1507 return ttm_dma_populate((void *)ttm, dev->dev); 3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1508 } 3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1509 #endif 3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1510 3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1511 r = ttm_pool_populate(ttm); 3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1512 if (r) { 3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1513 return r; 3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1514 } 3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1515 3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1516 for (i = 0; i < ttm->num_pages; i++) { fd1496a0f Alexandre Courbot 2014-07-31 1517 dma_addr_t addr; fd1496a0f Alexandre Courbot 2014-07-31 1518 fd1496a0f Alexandre Courbot 2014-07-31 1519 addr = dma_map_page(pdev, ttm->pages[i], 0, PAGE_SIZE, fd1496a0f Alexandre Courbot 2014-07-31 1520 DMA_BIDIRECTIONAL); fd1496a0f Alexandre Courbot 2014-07-31 1521 fd1496a0f Alexandre Courbot 2014-07-31 1522 if (dma_mapping_error(pdev, addr)) { 4fbbed46d Rasmus Villemoes 2016-02-15 1523 while (i--) { fd1496a0f Alexandre Courbot 2014-07-31 1524 dma_unmap_page(pdev, ttm_dma->dma_address[i], fd1496a0f Alexandre Courbot 2014-07-31 1525 PAGE_SIZE, DMA_BIDIRECTIONAL); 8e7e70522 Jerome Glisse 2011-11-09 1526 ttm_dma->dma_address[i] = 0; 3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1527 } 3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1528 ttm_pool_unpopulate(ttm); 3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1529 return -EFAULT; 3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1530 } fd1496a0f Alexandre Courbot 2014-07-31 1531 fd1496a0f Alexandre Courbot 2014-07-31 1532 ttm_dma->dma_address[i] = addr; 3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1533 } 3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1534 return 0; 3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1535 } 3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1536 3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1537 static void 3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1538 nouveau_ttm_tt_unpopulate(struct ttm_tt *ttm) 3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1539 { 8e7e70522 Jerome Glisse 2011-11-09 1540 struct ttm_dma_tt *ttm_dma = (void *)ttm; ebb945a94 Ben Skeggs 2012-07-20 1541 struct nouveau_drm *drm; be83cd4ef Ben Skeggs 2015-01-14 1542 struct nvkm_device *device; 3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1543 struct drm_device *dev; fd1496a0f Alexandre Courbot 2014-07-31 1544 struct device *pdev; 3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1545 unsigned i; 22b33e8ed Dave Airlie 2012-04-02 1546 bool slave = !!(ttm->page_flags & TTM_PAGE_FLAG_SG); 22b33e8ed Dave Airlie 2012-04-02 1547 22b33e8ed Dave Airlie 2012-04-02 1548 if (slave) 22b33e8ed Dave Airlie 2012-04-02 1549 return; 3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1550 ebb945a94 Ben Skeggs 2012-07-20 1551 drm = nouveau_bdev(ttm->bdev); 989aa5b76 Ben Skeggs 2015-01-12 1552 device = nvxx_device(&drm->device); ebb945a94 Ben Skeggs 2012-07-20 1553 dev = drm->dev; 26c9e8eff Ben Skeggs 2015-08-20 1554 pdev = device->dev; 3230cfc34 Konrad Rzeszutek Wilk 2011-10-17 1555 c3a0c771e Alexandre Courbot 2014-10-27 1556 /* c3a0c771e Alexandre Courbot 2014-10-27 1557 * Objects matching this condition have been marked as force_coherent, c3a0c771e Alexandre Courbot 2014-10-27 1558 * so use the DMA API for them. c3a0c771e Alexandre Courbot 2014-10-27 1559 */ 26c9e8eff Ben Skeggs 2015-08-20 1560 if (!nvxx_device(&drm->device)->func->cpu_coherent && dcccdc143 Alexandre Courbot 2014-12-11 1561 ttm->caching_state == tt_uncached) { c3a0c771e Alexandre Courbot 2014-10-27 1562 ttm_dma_unpopulate(ttm_dma, dev->dev); dcccdc143 Alexandre Courbot 2014-12-11 1563 return; dcccdc143 Alexandre Courbot 2014-12-11 1564 } c3a0c771e Alexandre Courbot 2014-10-27 1565 a7fb8a23c Daniel Vetter 2015-09-09 1566 #if IS_ENABLED(CONFIG_AGP) 340b0e7c5 Ben Skeggs 2015-08-20 1567 if (drm->agp.bridge) { dea7e0ac4 Jerome Glisse 2012-01-03 @1568 ttm_agp_tt_unpopulate(ttm); dea7e0ac4 Jerome Glisse 2012-01-03 1569 return; dea7e0ac4 Jerome Glisse 2012-01-03 1570 } dea7e0ac4 Jerome Glisse 2012-01-03 1571 #endif :::::: The code at line 1568 was first introduced by commit :::::: dea7e0ac45fd28f90bbc38ff226d36a9f788efbf ttm: fix agp since ttm tt rework :::::: TO: Jerome Glisse <jglisse@redhat.com> :::::: CC: Dave Airlie <airlied@redhat.com> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index f2a74d0b68ae..7c9fc451f1aa 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -83,6 +83,7 @@ config DRM_LOAD_EDID_FIRMWARE config DRM_TTM tristate depends on DRM + depends on (AGP || AGP=n) help GPU memory management subsystem for devices with multiple GPU memory types. Will be enabled automatically if a device driver diff --git a/drivers/gpu/drm/ttm/Makefile b/drivers/gpu/drm/ttm/Makefile index b433b9f040c9..f92325800f8a 100644 --- a/drivers/gpu/drm/ttm/Makefile +++ b/drivers/gpu/drm/ttm/Makefile @@ -2,9 +2,10 @@ # Makefile for the drm device driver. This driver provides support for the ccflags-y := -Iinclude/drm -ttm-y := ttm_agp_backend.o ttm_memory.o ttm_tt.o ttm_bo.o \ +ttm-y := ttm_memory.o ttm_tt.o ttm_bo.o \ ttm_bo_util.o ttm_bo_vm.o ttm_module.o \ ttm_object.o ttm_lock.o ttm_execbuf_util.o ttm_page_alloc.o \ ttm_bo_manager.o ttm_page_alloc_dma.o +ttm-$(CONFIG_AGP) += ttm_agp_backend.o obj-$(CONFIG_DRM_TTM) += ttm.o diff --git a/drivers/gpu/drm/ttm/ttm_agp_backend.c b/drivers/gpu/drm/ttm/ttm_agp_backend.c index 764be36397fd..028ab6007873 100644 --- a/drivers/gpu/drm/ttm/ttm_agp_backend.c +++ b/drivers/gpu/drm/ttm/ttm_agp_backend.c @@ -34,7 +34,6 @@ #include <drm/ttm/ttm_module.h> #include <drm/ttm/ttm_bo_driver.h> #include <drm/ttm/ttm_page_alloc.h> -#ifdef TTM_HAS_AGP #include <drm/ttm/ttm_placement.h> #include <linux/agp_backend.h> #include <linux/module.h> @@ -148,5 +147,3 @@ void ttm_agp_tt_unpopulate(struct ttm_tt *ttm) ttm_pool_unpopulate(ttm); } EXPORT_SYMBOL(ttm_agp_tt_unpopulate); - -#endif diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c index 025c429050c0..a37de5db5731 100644 --- a/drivers/gpu/drm/ttm/ttm_page_alloc.c +++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c @@ -48,7 +48,7 @@ #include <drm/ttm/ttm_bo_driver.h> #include <drm/ttm/ttm_page_alloc.h> -#ifdef TTM_HAS_AGP +#if IS_ENABLED(CONFIG_AGP) #include <asm/agp.h> #endif @@ -219,7 +219,7 @@ static struct ttm_pool_manager *_manager; #ifndef CONFIG_X86 static int set_pages_array_wb(struct page **pages, int addrinarray) { -#ifdef TTM_HAS_AGP +#if IS_ENABLED(CONFIG_AGP) int i; for (i = 0; i < addrinarray; i++) @@ -230,7 +230,7 @@ static int set_pages_array_wb(struct page **pages, int addrinarray) static int set_pages_array_wc(struct page **pages, int addrinarray) { -#ifdef TTM_HAS_AGP +#if IS_ENABLED(CONFIG_AGP) int i; for (i = 0; i < addrinarray; i++) @@ -241,7 +241,7 @@ static int set_pages_array_wc(struct page **pages, int addrinarray) static int set_pages_array_uc(struct page **pages, int addrinarray) { -#ifdef TTM_HAS_AGP +#if IS_ENABLED(CONFIG_AGP) int i; for (i = 0; i < addrinarray; i++) diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c index 624d941aaad1..bef9f6feb635 100644 --- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c @@ -50,7 +50,7 @@ #include <linux/kthread.h> #include <drm/ttm/ttm_bo_driver.h> #include <drm/ttm/ttm_page_alloc.h> -#ifdef TTM_HAS_AGP +#if IS_ENABLED(CONFIG_AGP) #include <asm/agp.h> #endif @@ -271,7 +271,7 @@ static struct kobj_type ttm_pool_kobj_type = { #ifndef CONFIG_X86 static int set_pages_array_wb(struct page **pages, int addrinarray) { -#ifdef TTM_HAS_AGP +#if IS_ENABLED(CONFIG_AGP) int i; for (i = 0; i < addrinarray; i++) @@ -282,7 +282,7 @@ static int set_pages_array_wb(struct page **pages, int addrinarray) static int set_pages_array_wc(struct page **pages, int addrinarray) { -#ifdef TTM_HAS_AGP +#if IS_ENABLED(CONFIG_AGP) int i; for (i = 0; i < addrinarray; i++) @@ -293,7 +293,7 @@ static int set_pages_array_wc(struct page **pages, int addrinarray) static int set_pages_array_uc(struct page **pages, int addrinarray) { -#ifdef TTM_HAS_AGP +#if IS_ENABLED(CONFIG_AGP) int i; for (i = 0; i < addrinarray; i++) diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index 3d4bf08aa21f..ff544e3e37a7 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h @@ -1030,8 +1030,7 @@ extern pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp); extern const struct ttm_mem_type_manager_func ttm_bo_manager_func; -#if (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE))) -#define TTM_HAS_AGP +#ifdef CONFIG_AGP #include <linux/agp_backend.h> /**
It tries to do fancy things with excluding agp support if ttm is built-in, but agp isn't. Instead just express this depency like drm does and use CONFIG_AGP everywhere. Also use the neat Makefile magic to make the entire ttm_agp_backend file optional. v2: Use IS_ENABLED(CONFIG_AGP) as suggested by Ville Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> --- drivers/gpu/drm/Kconfig | 1 + drivers/gpu/drm/ttm/Makefile | 3 ++- drivers/gpu/drm/ttm/ttm_agp_backend.c | 3 --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 8 ++++---- drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 8 ++++---- include/drm/ttm/ttm_bo_driver.h | 3 +-- 6 files changed, 12 insertions(+), 14 deletions(-)