[PATCH v1 2/2] drm/ttm: enable ioremap buffer according to TTM mem caching setting for arm64

Cong Liu liucong2 at kylinos.cn
Tue Mar 22 09:34:44 UTC 2022


Arm64 also need the function in commit b849bec29a99 ("drm/ttm:
ioremap buffer according to TTM mem caching setting"), so enable
it. The following Call Trace captured in arm64 with qxl card.

[    5.609923] Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015
[    5.610592] pstate: 00400005 (nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[    5.611271] pc : __memset+0x90/0x188
[    5.611641] lr : qxl_create_monitors_object+0xe0/0x180 [qxl]
[    5.612208] sp : ffff800012cd37a0
[    5.612533] x29: ffff800012cd37a0 x28: 0000000000000000 x27: 0000000000000001
[    5.613228] x26: ffff800012cd3d30 x25: ffffb70116ef5f10 x24: ffffb70116ef5ed8
[    5.613953] x23: ffffb70116ef5000 x22: 0000000000000000 x21: ffff000300020000
[    5.614645] x20: ffff0003008e4000 x19: 0000000000000074 x18: 0000000000000014
[    5.615331] x17: 0000000038ca76f1 x16: ffffb70138fd0600 x15: ffffb7013b1a9950
[    5.616018] x14: ffff800010000000 x13: ffffb7013a8a2d78 x12: ffffb7013a8a2d78
[    5.616709] x11: ffffb7013a8aa767 x10: 0000000000000000 x9 : ffffb701398fc5bc
[    5.617409] x8 : ffff8000100ad074 x7 : 0000000000000000 x6 : 0000000000000002
[    5.618206] x5 : ffff0003008e50b0 x4 : 0000000000000000 x3 : 0000000000000030
[    5.618933] x2 : 0000000000000004 x1 : 0000000000000000 x0 : ffff8000100ad000
[    5.619624] Call trace:
[    5.619872]  __memset+0x90/0x188
[    5.620188]  qxl_modeset_init+0x4c/0x320 [qxl]
[    5.620627]  qxl_pci_probe+0x11c/0x1d0 [qxl]
[    5.621029]  local_pci_probe+0x48/0xb8
[    5.621390]  pci_device_probe+0x194/0x208
[    5.621762]  really_probe+0xd0/0x458
[    5.622122]  __driver_probe_device+0x124/0x1c0
[    5.622534]  driver_probe_device+0x48/0x130
[    5.622923]  __driver_attach+0xc4/0x1a8
[    5.623280]  bus_for_each_dev+0x78/0xd0
[    5.623636]  driver_attach+0x2c/0x38
[    5.623969]  bus_add_driver+0x154/0x248
[    5.624324]  driver_register+0x6c/0x128
[    5.624678]  __pci_register_driver+0x4c/0x58
[    5.625072]  qxl_init+0x48/0x1000 [qxl]
[    5.625439]  do_one_initcall+0x50/0x240
[    5.625825]  do_init_module+0x60/0x238
[    5.626189]  load_module+0x2458/0x2900
[    5.626543]  __do_sys_finit_module+0xbc/0x128
[    5.626952]  __arm64_sys_finit_module+0x28/0x38
[    5.627384]  invoke_syscall+0x74/0xf0
[    5.627732]  el0_svc_common.constprop.0+0x58/0x1a8
[    5.628190]  do_el0_svc+0x2c/0x90
[    5.628503]  el0_svc+0x40/0x190
[    5.628811]  el0t_64_sync_handler+0xb0/0xb8
[    5.629206]  el0t_64_sync+0x1a4/0x1a8
[    5.629552] Code: a8811d07 f2400c42 b4000062 8b020108 (a93f1d07)
[    5.630152] ---[ end trace 35a380fcdcd5b8f7 ]---

Signed-off-by: Cong Liu <liucong2 at kylinos.cn>
---
 drivers/gpu/drm/ttm/ttm_bo_util.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index 72a94301bc95..3df96e76c424 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -281,7 +281,7 @@ static int ttm_bo_ioremap(struct ttm_buffer_object *bo,
 		map->bo_kmap_type = ttm_bo_map_iomap;
 		if (mem->bus.caching == ttm_write_combined)
 			map->virtual = ioremap_wc(res, size);
-#ifdef CONFIG_X86
+#if (defined CONFIG_X86) || (defined CONFIG_ARM64)
 		else if (mem->bus.caching == ttm_cached)
 			map->virtual = ioremap_cache(res, size);
 #endif
@@ -402,7 +402,7 @@ 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);
-#ifdef CONFIG_X86
+#if (defined CONFIG_X86) || (defined CONFIG_ARM64)
 		else if (mem->bus.caching == ttm_cached)
 			vaddr_iomem = ioremap_cache(mem->bus.offset,
 						  bo->base.size);
-- 
2.25.1



More information about the dri-devel mailing list