Skip to contentSkip to conversation

drm/ttm: ioremap buffer according to TTM mem caching setting

PATCH In review Oak Zeng 4 participants 7 messages Mar 4, 2021

Subsystems (3)
lore
Share & tools
lore

Oak Zeng

author
#0 lore raw

PATCH 1/1 drm/ttm: ioremap buffer according to TTM mem caching setting

If tbo.mem.bus.caching is cached, buffer is intended to be mapped as cached from CPU. Map it with ioremap_cache.

This wasn't necessary before as device memory was never mapped as cached from CPU side. It becomes necessary for aldebaran as device memory is mapped cached from CPU.

---
 drivers/gpu/drm/ttm/ttm_bo_util.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/gpu/drm/ttm/ttm_bo_util.c +14 -0
index 031e581..7429464 100644
@@ -91,6 +91,10 @@ static int ttm_resource_ioremap(struct ttm_device *bdev,
 
 		if (mem->bus.caching == ttm_write_combined)
 			addr = ioremap_wc(mem->bus.offset, bus_size);
+#ifdef CONFIG_X86
+		else if (mem->bus.caching == ttm_cached)
+			addr = ioremap_cache(mem->bus.offset, bus_size);
+#endif
 		else
 			addr = ioremap(mem->bus.offset, bus_size);
 		if (!addr) {
@@ -372,6 +376,11 @@ static int ttm_bo_ioremap(struct ttm_buffer_object *bo,
 		if (mem->bus.caching == ttm_write_combined)
 			map->virtual = ioremap_wc(bo->mem.bus.offset + offset,
 						  size);
+#ifdef CONFIG_X86
+		else if (mem->bus.caching == ttm_cached)
+			map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
+						  size);
+#endif
 		else
 			map->virtual = ioremap(bo->mem.bus.offset + offset,
 					       size);
@@ -490,6 +499,11 @@ int ttm_bo_vmap(struct ttm_buffer_object *bo, struct dma_buf_map *map)
 		else if (mem->bus.caching == ttm_write_combined)
 			vaddr_iomem = ioremap_wc(mem->bus.offset,
 						 bo->base.size);
+		else if (mem->bus.caching == ttm_cached)
+#ifdef CONFIG_X86
+			vaddr_iomem = ioremap_cache(mem->bus.offset,
+						  bo->base.size);
+#endif
 		else
 			vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);
 
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Acked-by on v1 1/1
#1 lore raw

I was wondering if a managed version of such API exists but looks like none. We only have devm_ioremap_wc but that is valid only for PAGE_CACHE_MODE_WC whereas ioremap_cache uses _WB. One more small comment below.

Quoted 18 lines · Oak Zeng

If tbo.mem.bus.caching is cached, buffer is intended to be mapped as cached from CPU. Map it with ioremap_cache.

This wasn't necessary before as device memory was never mapped as cached from CPU side. It becomes necessary for aldebaran as device memory is mapped cached from CPU.

---
  drivers/gpu/drm/ttm/ttm_bo_util.c | 14 ++++++++++++++
  1 file changed, 14 insertions(+)
drivers/gpu/drm/ttm/ttm_bo_util.c +0 -0
index 031e581..7429464 100644

drivers/gpu/drm/ttm/ttm_bo_util.c static int ttm_resource_ioremap(struct ttm_device *bdev, · line 94

Quoted 4 lines
drivers/gpu/drm/ttm/ttm_bo_util.c +1 -0
@@ -91,6 +91,10 @@ static int ttm_resource_ioremap(struct ttm_device *bdev,
 
  		if (mem->bus.caching == ttm_write_combined)
  			addr = ioremap_wc(mem->bus.offset, bus_size);
+#ifdef CONFIG_X86

Please use #if defined (CONFIG_X86)

Quoted 20 lines
drivers/gpu/drm/ttm/ttm_bo_util.c +8 -0
+		else if (mem->bus.caching == ttm_cached)
+			addr = ioremap_cache(mem->bus.offset, bus_size);
+#endif
  		else
  			addr = ioremap(mem->bus.offset, bus_size);
  		if (!addr) {
@@ -372,6 +376,11 @@ static int ttm_bo_ioremap(struct ttm_buffer_object *bo,
  		if (mem->bus.caching == ttm_write_combined)
  			map->virtual = ioremap_wc(bo->mem.bus.offset + offset,
  						  size);
+#ifdef CONFIG_X86
+		else if (mem->bus.caching == ttm_cached)
+			map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
+						  size);
+#endif
  		else
  			map->virtual = ioremap(bo->mem.bus.offset + offset,
  					       size);
@@ -490,6 +499,11 @@ int ttm_bo_vmap(struct ttm_buffer_object *bo, struct dma_buf_map *map)
  		else if (mem->bus.caching == ttm_write_combined)

drivers/gpu/drm/ttm/ttm_bo_util.c int ttm_bo_vmap(struct ttm_buffer_object *bo, struct dma_buf_map *map) · line 509

Quoted 10 lines
drivers/gpu/drm/ttm/ttm_bo_util.c +5 -0
  			vaddr_iomem = ioremap_wc(mem->bus.offset,
  						 bo->base.size);
+		else if (mem->bus.caching == ttm_cached)
+#ifdef CONFIG_X86
+			vaddr_iomem = ioremap_cache(mem->bus.offset,
+						  bo->base.size);
+#endif
  		else
  			vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);
 

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw

Am 04.03.21 um 18:01 schrieb Bhardwaj, Rajneesh:

Quoted 19 lines

I was wondering if a managed version of such API exists but looks like none. We only have devm_ioremap_wc but that is valid only for PAGE_CACHE_MODE_WC whereas ioremap_cache uses _WB. One more small comment below.

Quoted 13 lines · Oak Zeng

If tbo.mem.bus.caching is cached, buffer is intended to be mapped as cached from CPU. Map it with ioremap_cache.

This wasn't necessary before as device memory was never mapped as cached from CPU side. It becomes necessary for aldebaran as device memory is mapped cached from CPU.

---
  drivers/gpu/drm/ttm/ttm_bo_util.c | 14 ++++++++++++++

  1 file changed, 14 insertions(+)
Quoted 12 lines

drivers/gpu/drm/ttm/ttm_bo_util.c static int ttm_resource_ioremap(struct ttm_device · line 94

Quoted 9 lines
drivers/gpu/drm/ttm/ttm_bo_util.c +1 -0
index 031e581..7429464 100644
@@ -91,6 +91,10 @@ static int ttm_resource_ioremap(struct ttm_device 
 *bdev,
             if (mem->bus.caching == ttm_write_combined)
               addr = ioremap_wc(mem->bus.offset, bus_size);
+#ifdef CONFIG_X86

Please use #if defined (CONFIG_X86)

Actually #ifdef is usually preferred.

Christian.

Quoted 28 lines
Quoted 28 lines
drivers/gpu/drm/ttm/ttm_bo_util.c +3 -0
+        else if (mem->bus.caching == ttm_cached)
+            addr = ioremap_cache(mem->bus.offset, bus_size);
+#endif

          else
              addr = ioremap(mem->bus.offset, bus_size); if (!addr) {

drivers/gpu/drm/ttm/ttm_bo_util.c +5 -0
@@ -372,6 +376,11 @@ static int ttm_bo_ioremap(struct 
 ttm_buffer_object *bo,
           if (mem->bus.caching == ttm_write_combined)
               map->virtual = ioremap_wc(bo->mem.bus.offset + offset,
                             size);
+#ifdef CONFIG_X86
+        else if (mem->bus.caching == ttm_cached)
+            map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
+                          size);
+#endif

          else
              map->virtual = ioremap(bo->mem.bus.offset + offset, size);

drivers/gpu/drm/ttm/ttm_bo_util.c +3 -0
@@ -490,6 +499,11 @@ int ttm_bo_vmap(struct ttm_buffer_object *bo, 
 struct dma_buf_map *map)
           else if (mem->bus.caching == ttm_write_combined)
               vaddr_iomem = ioremap_wc(mem->bus.offset,
                            bo->base.size);
+        else if (mem->bus.caching == ttm_cached)
+#ifdef CONFIG_X86
+            vaddr_iomem = ioremap_cache(mem->bus.offset,
Quoted 8 lines
Quoted 4 lines
drivers/gpu/drm/ttm/ttm_bo_util.c +2 -0
+                          bo->base.size);
+#endif

          else
              vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw
Quoted 39 lines · Christian König

[CAUTION: External Email]

Am 04.03.21 um 18:01 schrieb Bhardwaj, Rajneesh:

Quoted 22 lines

I was wondering if a managed version of such API exists but looks like none. We only have devm_ioremap_wc but that is valid only for PAGE_CACHE_MODE_WC whereas ioremap_cache uses _WB. One more small comment below.

Quoted 13 lines · Oak Zeng

If tbo.mem.bus.caching is cached, buffer is intended to be mapped as cached from CPU. Map it with ioremap_cache.

This wasn't necessary before as device memory was never mapped as cached from CPU side. It becomes necessary for aldebaran as device memory is mapped cached from CPU.

---
  drivers/gpu/drm/ttm/ttm_bo_util.c | 14 ++++++++++++++

  1 file changed, 14 insertions(+)
Quoted 13 lines

drivers/gpu/drm/ttm/ttm_bo_util.c static int ttm_resource_ioremap(struct ttm_device · line 94

Quoted 10 lines
drivers/gpu/drm/ttm/ttm_bo_util.c +1 -0
index 031e581..7429464 100644
@@ -91,6 +91,10 @@ static int ttm_resource_ioremap(struct ttm_device
 *bdev,
             if (mem->bus.caching == ttm_write_combined)
               addr = ioremap_wc(mem->bus.offset, bus_size);
+#ifdef CONFIG_X86

Please use #if defined (CONFIG_X86)

Quoted 1 line

Actually #ifdef is usually preferred.

oops, i was referring to IS_ENABLED (CONFIG) and not if defined.

Quoted 41 lines

Christian.

Quoted 37 lines
Quoted 30 lines
drivers/gpu/drm/ttm/ttm_bo_util.c +3 -0
+        else if (mem->bus.caching == ttm_cached)
+            addr = ioremap_cache(mem->bus.offset, bus_size);
+#endif

          else
              addr = ioremap(mem->bus.offset, bus_size); if (!addr) {

drivers/gpu/drm/ttm/ttm_bo_util.c +5 -0
@@ -372,6 +376,11 @@ static int ttm_bo_ioremap(struct
 ttm_buffer_object *bo,
           if (mem->bus.caching == ttm_write_combined)
               map->virtual = ioremap_wc(bo->mem.bus.offset + offset,
                             size);
+#ifdef CONFIG_X86
+        else if (mem->bus.caching == ttm_cached)
+            map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
+                          size);
+#endif

          else
              map->virtual = ioremap(bo->mem.bus.offset + offset, size);

drivers/gpu/drm/ttm/ttm_bo_util.c +5 -0
@@ -490,6 +499,11 @@ int ttm_bo_vmap(struct ttm_buffer_object *bo,
 struct dma_buf_map *map)
           else if (mem->bus.caching == ttm_write_combined)
               vaddr_iomem = ioremap_wc(mem->bus.offset,
                            bo->base.size);
+        else if (mem->bus.caching == ttm_cached)
+#ifdef CONFIG_X86
+            vaddr_iomem = ioremap_cache(mem->bus.offset,
+                          bo->base.size);
+#endif
Quoted 2 lines

          else
              vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Crajneesh.bhardwaj%40amd.com%7Cc4386544ea10487d3a0c08d8df3363a1%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637504759264793970%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=nM2UtQQdActyapfZSrhfx%2BoJ%2BdszV4Yp62LTehsUWwY%3D&reserved=0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw

Am 04.03.21 um 18:40 schrieb Bhardwaj, Rajneesh:

Quoted 41 lines · Christian König
Quoted 39 lines

[CAUTION: External Email]

Am 04.03.21 um 18:01 schrieb Bhardwaj, Rajneesh:

Quoted 35 lines

I was wondering if a managed version of such API exists but looks like none. We only have devm_ioremap_wc but that is valid only for PAGE_CACHE_MODE_WC whereas ioremap_cache uses _WB. One more small comment below.

Quoted 19 lines · Oak Zeng

If tbo.mem.bus.caching is cached, buffer is intended to be mapped as cached from CPU. Map it with ioremap_cache.

This wasn't necessary before as device memory was never mapped as cached from CPU side. It becomes necessary for aldebaran as device memory is mapped cached from CPU.

---
  drivers/gpu/drm/ttm/ttm_bo_util.c | 14 ++++++++++++++

  1 file changed, 14 insertions(+)
drivers/gpu/drm/ttm/ttm_bo_util.c +0 -0
index 031e581..7429464 100644

drivers/gpu/drm/ttm/ttm_bo_util.c static int ttm_resource_ioremap(struct ttm_device · line 94

Quoted 4 lines
drivers/gpu/drm/ttm/ttm_bo_util.c +1 -0
@@ -91,6 +91,10 @@ static int ttm_resource_ioremap(struct ttm_device
 *bdev,
             if (mem->bus.caching == ttm_write_combined)
               addr = ioremap_wc(mem->bus.offset, bus_size);
+#ifdef CONFIG_X86

Please use #if defined (CONFIG_X86)

Quoted 3 lines
Quoted 1 line

Actually #ifdef is usually preferred.

oops, i was referring to IS_ENABLED (CONFIG) and not if defined.

Well, that is indeed a good idea for most config options.

But in this case #ifdef alone should work as well.

Christian.

Quoted 35 lines
Quoted 35 lines

Christian.

Quoted 30 lines
Quoted 30 lines
drivers/gpu/drm/ttm/ttm_bo_util.c +3 -0
+        else if (mem->bus.caching == ttm_cached)
+            addr = ioremap_cache(mem->bus.offset, bus_size);
+#endif

          else
              addr = ioremap(mem->bus.offset, bus_size); if (!addr) {

drivers/gpu/drm/ttm/ttm_bo_util.c +5 -0
@@ -372,6 +376,11 @@ static int ttm_bo_ioremap(struct
 ttm_buffer_object *bo,
           if (mem->bus.caching == ttm_write_combined)
               map->virtual = ioremap_wc(bo->mem.bus.offset + offset,
                             size);
+#ifdef CONFIG_X86
+        else if (mem->bus.caching == ttm_cached)
+            map->virtual = ioremap_cache(bo->mem.bus.offset + offset,
+                          size);
+#endif

          else
              map->virtual = ioremap(bo->mem.bus.offset + offset, size);

drivers/gpu/drm/ttm/ttm_bo_util.c +5 -0
@@ -490,6 +499,11 @@ int ttm_bo_vmap(struct ttm_buffer_object *bo,
 struct dma_buf_map *map)
           else if (mem->bus.caching == ttm_write_combined)
               vaddr_iomem = ioremap_wc(mem->bus.offset,
                            bo->base.size);
+        else if (mem->bus.caching == ttm_cached)
+#ifdef CONFIG_X86
+            vaddr_iomem = ioremap_cache(mem->bus.offset,
+                          bo->base.size);
+#endif
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

          else
              vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Crajneesh.bhardwaj%40amd.com%7Cc4386544ea10487d3a0c08d8df3363a1%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637504759264793970%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=nM2UtQQdActyapfZSrhfx%2BoJ%2BdszV4Yp62LTehsUWwY%3D&reserved=0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw
In reply to Oak Zeng
Thank you for the patch! Yet something to improve:

Hi Oak,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on drm-tip/drm-tip linus/master v5.12-rc1 next-20210304] [cannot apply to tegra-drm/drm/tegra/for-next drm-exynos/exynos-drm-next drm/drm-next] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210305-000626
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: arm-defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/e89ba86e56d95eb097cacfac83b667a92acbf56b
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210305-000626 git checkout e89ba86e56d95eb097cacfac83b667a92acbf56b
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_vmap':

>> drivers/gpu/drm/ttm/ttm_bo_util.c:508:3: error: expected expression before 'else'
     508 |   else
         |   ^~~~

vim +/else +508 drivers/gpu/drm/ttm/ttm_bo_util.c

ba4e7d973dd09b Thomas Hellstrom  2009-06-10  485  
43676605f890b2 Thomas Zimmermann 2020-11-03  486  int ttm_bo_vmap(struct ttm_buffer_object *bo, struct dma_buf_map *map)
43676605f890b2 Thomas Zimmermann 2020-11-03  487  {
43676605f890b2 Thomas Zimmermann 2020-11-03  488  	struct ttm_resource *mem = &bo->mem;
43676605f890b2 Thomas Zimmermann 2020-11-03  489  	int ret;
43676605f890b2 Thomas Zimmermann 2020-11-03  490  
43676605f890b2 Thomas Zimmermann 2020-11-03  491  	ret = ttm_mem_io_reserve(bo->bdev, mem);
43676605f890b2 Thomas Zimmermann 2020-11-03  492  	if (ret)
43676605f890b2 Thomas Zimmermann 2020-11-03  493  		return ret;
43676605f890b2 Thomas Zimmermann 2020-11-03  494  
43676605f890b2 Thomas Zimmermann 2020-11-03  495  	if (mem->bus.is_iomem) {
43676605f890b2 Thomas Zimmermann 2020-11-03  496  		void __iomem *vaddr_iomem;
43676605f890b2 Thomas Zimmermann 2020-11-03  497  
43676605f890b2 Thomas Zimmermann 2020-11-03  498  		if (mem->bus.addr)
43676605f890b2 Thomas Zimmermann 2020-11-03  499  			vaddr_iomem = (void __iomem *)mem->bus.addr;
43676605f890b2 Thomas Zimmermann 2020-11-03  500  		else if (mem->bus.caching == ttm_write_combined)
e11bfb99d6ece2 Christian König   2020-12-09  501  			vaddr_iomem = ioremap_wc(mem->bus.offset,
e11bfb99d6ece2 Christian König   2020-12-09  502  						 bo->base.size);
e89ba86e56d95e Oak Zeng          2021-03-04  503  		else if (mem->bus.caching == ttm_cached)
e89ba86e56d95e Oak Zeng          2021-03-04  504  #ifdef CONFIG_X86
e89ba86e56d95e Oak Zeng          2021-03-04  505  			vaddr_iomem = ioremap_cache(mem->bus.offset,
e89ba86e56d95e Oak Zeng          2021-03-04  506  						  bo->base.size);
e89ba86e56d95e Oak Zeng          2021-03-04  507  #endif
43676605f890b2 Thomas Zimmermann 2020-11-03 @508  		else
e11bfb99d6ece2 Christian König   2020-12-09  509  			vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);
43676605f890b2 Thomas Zimmermann 2020-11-03  510  
43676605f890b2 Thomas Zimmermann 2020-11-03  511  		if (!vaddr_iomem)
43676605f890b2 Thomas Zimmermann 2020-11-03  512  			return -ENOMEM;
43676605f890b2 Thomas Zimmermann 2020-11-03  513  
43676605f890b2 Thomas Zimmermann 2020-11-03  514  		dma_buf_map_set_vaddr_iomem(map, vaddr_iomem);
43676605f890b2 Thomas Zimmermann 2020-11-03  515  
43676605f890b2 Thomas Zimmermann 2020-11-03  516  	} else {
43676605f890b2 Thomas Zimmermann 2020-11-03  517  		struct ttm_operation_ctx ctx = {
43676605f890b2 Thomas Zimmermann 2020-11-03  518  			.interruptible = false,
43676605f890b2 Thomas Zimmermann 2020-11-03  519  			.no_wait_gpu = false
43676605f890b2 Thomas Zimmermann 2020-11-03  520  		};
43676605f890b2 Thomas Zimmermann 2020-11-03  521  		struct ttm_tt *ttm = bo->ttm;
43676605f890b2 Thomas Zimmermann 2020-11-03  522  		pgprot_t prot;
43676605f890b2 Thomas Zimmermann 2020-11-03  523  		void *vaddr;
43676605f890b2 Thomas Zimmermann 2020-11-03  524  
43676605f890b2 Thomas Zimmermann 2020-11-03  525  		ret = ttm_tt_populate(bo->bdev, ttm, &ctx);
43676605f890b2 Thomas Zimmermann 2020-11-03  526  		if (ret)
43676605f890b2 Thomas Zimmermann 2020-11-03  527  			return ret;
43676605f890b2 Thomas Zimmermann 2020-11-03  528  
43676605f890b2 Thomas Zimmermann 2020-11-03  529  		/*
43676605f890b2 Thomas Zimmermann 2020-11-03  530  		 * We need to use vmap to get the desired page protection
43676605f890b2 Thomas Zimmermann 2020-11-03  531  		 * or to make the buffer object look contiguous.
43676605f890b2 Thomas Zimmermann 2020-11-03  532  		 */
43676605f890b2 Thomas Zimmermann 2020-11-03  533  		prot = ttm_io_prot(bo, mem, PAGE_KERNEL);
e11bfb99d6ece2 Christian König   2020-12-09  534  		vaddr = vmap(ttm->pages, ttm->num_pages, 0, prot);
43676605f890b2 Thomas Zimmermann 2020-11-03  535  		if (!vaddr)
43676605f890b2 Thomas Zimmermann 2020-11-03  536  			return -ENOMEM;
43676605f890b2 Thomas Zimmermann 2020-11-03  537  
43676605f890b2 Thomas Zimmermann 2020-11-03  538  		dma_buf_map_set_vaddr(map, vaddr);
43676605f890b2 Thomas Zimmermann 2020-11-03  539  	}
43676605f890b2 Thomas Zimmermann 2020-11-03  540  
43676605f890b2 Thomas Zimmermann 2020-11-03  541  	return 0;
43676605f890b2 Thomas Zimmermann 2020-11-03  542  }
43676605f890b2 Thomas Zimmermann 2020-11-03  543  EXPORT_SYMBOL(ttm_bo_vmap);
43676605f890b2 Thomas Zimmermann 2020-11-03  544  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#6 lore raw
In reply to Oak Zeng
Thank you for the patch! Yet something to improve:

Hi Oak,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on drm-tip/drm-tip linus/master v5.12-rc1 next-20210304] [cannot apply to tegra-drm/drm/tegra/for-next drm-exynos/exynos-drm-next drm/drm-next] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210305-000626
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: arm64-randconfig-r021-20210304 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project eec7f8f7b1226be422a76542cb403d02538f453a)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://github.com/0day-ci/linux/commit/e89ba86e56d95eb097cacfac83b667a92acbf56b
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Oak-Zeng/drm-ttm-ioremap-buffer-according-to-TTM-mem-caching-setting/20210305-000626 git checkout e89ba86e56d95eb097cacfac83b667a92acbf56b
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/ttm/ttm_bo_util.c:508:3: error: expected expression
                   else
                   ^

1 error generated.

vim +508 drivers/gpu/drm/ttm/ttm_bo_util.c

ba4e7d973dd09b66 Thomas Hellstrom  2009-06-10  485  
43676605f890b218 Thomas Zimmermann 2020-11-03  486  int ttm_bo_vmap(struct ttm_buffer_object *bo, struct dma_buf_map *map)
43676605f890b218 Thomas Zimmermann 2020-11-03  487  {
43676605f890b218 Thomas Zimmermann 2020-11-03  488  	struct ttm_resource *mem = &bo->mem;
43676605f890b218 Thomas Zimmermann 2020-11-03  489  	int ret;
43676605f890b218 Thomas Zimmermann 2020-11-03  490  
43676605f890b218 Thomas Zimmermann 2020-11-03  491  	ret = ttm_mem_io_reserve(bo->bdev, mem);
43676605f890b218 Thomas Zimmermann 2020-11-03  492  	if (ret)
43676605f890b218 Thomas Zimmermann 2020-11-03  493  		return ret;
43676605f890b218 Thomas Zimmermann 2020-11-03  494  
43676605f890b218 Thomas Zimmermann 2020-11-03  495  	if (mem->bus.is_iomem) {
43676605f890b218 Thomas Zimmermann 2020-11-03  496  		void __iomem *vaddr_iomem;
43676605f890b218 Thomas Zimmermann 2020-11-03  497  
43676605f890b218 Thomas Zimmermann 2020-11-03  498  		if (mem->bus.addr)
43676605f890b218 Thomas Zimmermann 2020-11-03  499  			vaddr_iomem = (void __iomem *)mem->bus.addr;
43676605f890b218 Thomas Zimmermann 2020-11-03  500  		else if (mem->bus.caching == ttm_write_combined)
e11bfb99d6ece23b Christian König   2020-12-09  501  			vaddr_iomem = ioremap_wc(mem->bus.offset,
e11bfb99d6ece23b Christian König   2020-12-09  502  						 bo->base.size);
e89ba86e56d95eb0 Oak Zeng          2021-03-04  503  		else if (mem->bus.caching == ttm_cached)
e89ba86e56d95eb0 Oak Zeng          2021-03-04  504  #ifdef CONFIG_X86
e89ba86e56d95eb0 Oak Zeng          2021-03-04  505  			vaddr_iomem = ioremap_cache(mem->bus.offset,
e89ba86e56d95eb0 Oak Zeng          2021-03-04  506  						  bo->base.size);
e89ba86e56d95eb0 Oak Zeng          2021-03-04  507  #endif
43676605f890b218 Thomas Zimmermann 2020-11-03 @508  		else
e11bfb99d6ece23b Christian König   2020-12-09  509  			vaddr_iomem = ioremap(mem->bus.offset, bo->base.size);
43676605f890b218 Thomas Zimmermann 2020-11-03  510  
43676605f890b218 Thomas Zimmermann 2020-11-03  511  		if (!vaddr_iomem)
43676605f890b218 Thomas Zimmermann 2020-11-03  512  			return -ENOMEM;
43676605f890b218 Thomas Zimmermann 2020-11-03  513  
43676605f890b218 Thomas Zimmermann 2020-11-03  514  		dma_buf_map_set_vaddr_iomem(map, vaddr_iomem);
43676605f890b218 Thomas Zimmermann 2020-11-03  515  
43676605f890b218 Thomas Zimmermann 2020-11-03  516  	} else {
43676605f890b218 Thomas Zimmermann 2020-11-03  517  		struct ttm_operation_ctx ctx = {
43676605f890b218 Thomas Zimmermann 2020-11-03  518  			.interruptible = false,
43676605f890b218 Thomas Zimmermann 2020-11-03  519  			.no_wait_gpu = false
43676605f890b218 Thomas Zimmermann 2020-11-03  520  		};
43676605f890b218 Thomas Zimmermann 2020-11-03  521  		struct ttm_tt *ttm = bo->ttm;
43676605f890b218 Thomas Zimmermann 2020-11-03  522  		pgprot_t prot;
43676605f890b218 Thomas Zimmermann 2020-11-03  523  		void *vaddr;
43676605f890b218 Thomas Zimmermann 2020-11-03  524  
43676605f890b218 Thomas Zimmermann 2020-11-03  525  		ret = ttm_tt_populate(bo->bdev, ttm, &ctx);
43676605f890b218 Thomas Zimmermann 2020-11-03  526  		if (ret)
43676605f890b218 Thomas Zimmermann 2020-11-03  527  			return ret;
43676605f890b218 Thomas Zimmermann 2020-11-03  528  
43676605f890b218 Thomas Zimmermann 2020-11-03  529  		/*
43676605f890b218 Thomas Zimmermann 2020-11-03  530  		 * We need to use vmap to get the desired page protection
43676605f890b218 Thomas Zimmermann 2020-11-03  531  		 * or to make the buffer object look contiguous.
43676605f890b218 Thomas Zimmermann 2020-11-03  532  		 */
43676605f890b218 Thomas Zimmermann 2020-11-03  533  		prot = ttm_io_prot(bo, mem, PAGE_KERNEL);
e11bfb99d6ece23b Christian König   2020-12-09  534  		vaddr = vmap(ttm->pages, ttm->num_pages, 0, prot);
43676605f890b218 Thomas Zimmermann 2020-11-03  535  		if (!vaddr)
43676605f890b218 Thomas Zimmermann 2020-11-03  536  			return -ENOMEM;
43676605f890b218 Thomas Zimmermann 2020-11-03  537  
43676605f890b218 Thomas Zimmermann 2020-11-03  538  		dma_buf_map_set_vaddr(map, vaddr);
43676605f890b218 Thomas Zimmermann 2020-11-03  539  	}
43676605f890b218 Thomas Zimmermann 2020-11-03  540  
43676605f890b218 Thomas Zimmermann 2020-11-03  541  	return 0;
43676605f890b218 Thomas Zimmermann 2020-11-03  542  }
43676605f890b218 Thomas Zimmermann 2020-11-03  543  EXPORT_SYMBOL(ttm_bo_vmap);
43676605f890b218 Thomas Zimmermann 2020-11-03  544  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel