cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Explorer
Explorer
746 Views
Registered: ‎11-09-2015

vtc driver's __raw_readl cause kernel panic

hi ,

    I'm trying to get Linux framebuffer output with VDMA and AXI4-Stream to Video Out. The hardware is Trenz Electronic TE820 XCZU4EV SOM board,and a custom carry board. 

The kernel version is linux-xlnx-2018.2. And the display hardware pipeline is depicted below:

      vdma-[remap]-(rgb2yuv)-(cresample)-(osd)-[axi2vid]-adv7511
                                   vdma-- |        |        
                                       axiclkgen ->vtc

 When the kernel started, I  got those panic message:

 

[    2.248924] Synchronous External Abort: synchronous external abort (0x96000210) at 0xffffff800ab20000
[    2.258020] Internal error: : 96000210 [#1] SMP
[    2.262511] Modules linked in:
[    2.265540] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 4.14.0 #49
[    2.271506] Hardware name: Trenz TE820 (DT)
[    2.275659] task: ffffffc06d846d00 task.stack: ffffff8008038000
[    2.281543] PC is at xilinx_vtc_reset+0x14/0x30
[    2.286041] LR is at xilinx_vtc_probe+0xcc/0x168
[    2.290624] pc : [<ffffff800854c4cc>] lr : [<ffffff800854c604>] pstate: 60000045
[    2.297975] sp : ffffff800803bb40
[    2.301263] x29: ffffff800803bb40 x28: ffffff8008e06f28 
[    2.306539] x27: 0000000000000007 x26: ffffff8008df9068 
[    2.311815] x25: 0000000000000000 x24: ffffff8008e59000 
[    2.317092] x23: ffffffc06da92018 x22: ffffffc06db90100 
[    2.322368] x21: ffffffc06db29010 x20: ffffffc06ffcf848 
[    2.327645] x19: ffffffc06db90098 x18: 0000000000000001 
[    2.332921] x17: 0000000000000001 x16: 0000000000000019 
[    2.338198] x15: ffffffffffffffff x14: ffffff808803ba15 
[    2.343474] x13: ffff000000000000 x12: 0000000000000010 
[    2.348751] x11: 0101010101010101 x10: ffffffff7f7f7f7f 
[    2.354027] x9 : 0000000000000000 x8 : ffffffc06c875300 
[    2.359304] x7 : ffffffc06c875348 x6 : ffffffc06c875348 
[    2.364580] x5 : ffffffc06c875648 x4 : ffffffc06db29210 
[    2.369857] x3 : ffffffc06ce21680 x2 : ffffff800ab20000 
[    2.375133] x1 : ffffff800ab20000 x0 : ffffffc06db90098 
[    2.380411] Process swapper/0 (pid: 1, stack limit = 0xffffff8008038000)
[    2.387070] Call trace:
[    2.389494] Exception stack(0xffffff800803ba00 to 0xffffff800803bb40)
[    2.395896] ba00: ffffffc06db90098 ffffff800ab20000 ffffff800ab20000 ffffffc06ce21680
[    2.403681] ba20: ffffffc06db29210 ffffffc06c875648 ffffffc06c875348 ffffffc06c875348
[    2.411466] ba40: ffffffc06c875300 0000000000000000 ffffffff7f7f7f7f 0101010101010101
[    2.419251] ba60: 0000000000000010 ffff000000000000 ffffff808803ba15 ffffffffffffffff
[    2.427035] ba80: 0000000000000019 0000000000000001 0000000000000001 ffffffc06db90098
[    2.434821] baa0: ffffffc06ffcf848 ffffffc06db29010 ffffffc06db90100 ffffffc06da92018
[    2.442605] bac0: ffffff8008e59000 0000000000000000 ffffff8008df9068 0000000000000007
[    2.450391] bae0: ffffff8008e06f28 ffffff800803bb40 ffffff800854c604 ffffff800803bb40
[    2.458176] bb00: ffffff800854c4cc 0000000060000045 ffffffc06db29010 ffffffc06db90100
[    2.465961] bb20: ffffffffffffffff ffffff8008e59000 ffffff800803bb40 ffffff800854c4cc
[    2.473746] [<ffffff800854c4cc>] xilinx_vtc_reset+0x14/0x30
[    2.479282] [<ffffff800854822c>] xilinx_drm_crtc_create+0x194/0x3b8
[    2.485510] [<ffffff8008548b1c>] xilinx_drm_platform_probe+0x74/0x3c8
[    2.491910] [<ffffff8008569ab0>] platform_drv_probe+0x58/0xb8
[    2.497620] [<ffffff8008567bcc>] driver_probe_device+0x2bc/0x440
[    2.503589] [<ffffff8008567e50>] __driver_attach+0x100/0x118
[    2.509211] [<ffffff800856594c>] bus_for_each_dev+0x4c/0x98
[    2.514747] [<ffffff80085673a0>] driver_attach+0x20/0x28
[    2.520023] [<ffffff8008566db4>] bus_add_driver+0x1f4/0x280
[    2.525560] [<ffffff8008568898>] driver_register+0x60/0xf8
[    2.531008] [<ffffff8008569a00>] __platform_driver_register+0x40/0x48
[    2.537411] [<ffffff8008dc2c98>] xilinx_drm_private_driver_init+0x18/0x20
[    2.544157] [<ffffff80080839a8>] do_one_initcall+0x38/0x120
[    2.549693] [<ffffff8008da0cd4>] kernel_init_freeable+0x138/0x1d8
[    2.555748] [<ffffff8008a3b640>] kernel_init+0x10/0x100
[    2.560938] [<ffffff8008084a88>] ret_from_fork+0x10/0x18
[    2.566216] Code: d5033e9f 52b00001 b9000041 f9400001 (b9400021) 
[    2.572272] ---[ end trace 97be0d45cc5b664f ]---
[    2.576869] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
[    2.576869] 
[    2.585936] SMP: stopping secondary CPUs
[    2.589828] Kernel Offset: disabled
[    2.593288] CPU features: 0x002004
[    2.596660] Memory Limit: none
[    2.599690] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
[    2.599690] 

 The PC is at : ffffff800854c4cc,I use the addrline tool to find the line

hsq@hsq-vm:~/projects/opensouce/kernel/zynq/linux-xlnx-xilinx-v2018.2$ aarch64-linux-gnu-addr2line -f -e vmlinux ffffff800854c4cc
__raw_readl

The  __raw_readl() funtction cause the kernel panic. (xilinx_drm_read() ->  readl() -> readlrelaxed() -> __raw_readl() )

I comment the function call xilinx_drm_read() in xilinx_vtc_probe(),the panic disappear,but it's just a temporary workaround.

/* probe vtc */
struct xilinx_vtc *xilinx_vtc_probe(struct device *dev,
				    struct device_node *node)
{
	struct xilinx_vtc *vtc;
	const struct of_device_id *match;
	struct resource res;
	int ret;

	match = of_match_node(xilinx_vtc_of_match, node);
	if (!match) {
		dev_err(dev, "failed to match the device node\n");
		return ERR_PTR(-ENODEV);
	}

	vtc = devm_kzalloc(dev, sizeof(*vtc), GFP_KERNEL);
	if (!vtc)
		return ERR_PTR(-ENOMEM);

	ret = of_address_to_resource(node, 0, &res);
	if (ret) {
		dev_err(dev, "failed to of_address_to_resource\n");
		return ERR_PTR(ret);
	}

	vtc->base = devm_ioremap_resource(dev, &res);
	if (IS_ERR(vtc->base))
		return ERR_CAST(vtc->base);

	//xilinx_vtc_intr_disable(vtc, VTC_IXR_ALLINTR_MASK);//temp debug
	vtc->irq = irq_of_parse_and_map(node, 0);
	if (vtc->irq > 0) {
		ret = devm_request_irq(dev, vtc->irq, xilinx_vtc_intr_handler,
				       IRQF_SHARED, "xilinx_vtc", vtc);
		if (ret) {
			dev_warn(dev, "failed to requet_irq() for vtc\n");
			return ERR_PTR(ret);
		}
	}

	//xilinx_vtc_reset(vtc);//temp_debug

	return vtc;
}

Any iedas? 

BestRegards,

HSQ

 

 

0 Kudos
Reply
6 Replies
Explorer
Explorer
701 Views
Registered: ‎11-09-2015

aarch64-linux-gnu-addr2line -f -e vmlinux ffffff80085690b8
__raw_readl
/home/hsq/projects/peta_project/xilinx-vcu-trd-zcu106-zu7-v2018.2/build/tmp/work-shared/plnx-zynqmp/kernel-source/arch/arm64/include/asm/io.h:90
#define __raw_readl __raw_readl
static inline u32 __raw_readl(const volatile void __iomem *addr)
{
        u32 val;
        asm volatile(ALTERNATIVE("ldr %w0, [%1]",
                                 "ldar %w0, [%1]",
                                 ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE)
                     : "=r" (val) : "r" (addr));
        return val;
}

line 90 is marked line.

0 Kudos
Reply
Explorer
Explorer
685 Views
Registered: ‎02-15-2019

我用的硬件是MPSOC,软件版本是petalinux2018.3.不要轻易改驱动程序,你这个设计如果跟kms drm参考设计一样,只需要把device tree 设计好就可以。
0 Kudos
Reply
Explorer
Explorer
678 Views
Registered: ‎11-09-2015

hi 

     mpsoc平台上,目前没有使用旧的drm框架的例子(driver/gpu/drm/xilinx),至少我还没有看到。我只能根据以前在zynq7000上的经验来搭建IPI。我想问下,你的工程中像素时钟是怎么提供的?按你之前的帖子的设备树,像素时钟就是vid_s_axi_clk吗? 你对外的显示接口是什么?

0 Kudos
Reply
Explorer
Explorer
671 Views
Registered: ‎02-15-2019

网址是https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842520/Xilinx+DRM+KMS+driver,clk可以通过PS生成,或者板上时钟生成。
0 Kudos
Reply
Explorer
Explorer
644 Views
Registered: ‎11-09-2015

hi 

    update about this thread:

     I remove devicetree about drm part,but keep the boot.bin the same as before. I want to use devmem to read the vtc's registers. 

Here are the Base Address of the IPI.hdmi_out20190816212153.png

all those base address are auto assigned. 

here are devmem read result:

root@CHFW:~# devmem 0x80040000
0x00040063
root@CHFW:~# devmem 0x80030000 
0x00000000
root@CHFW:~# devmem 0x80020000 
0x00000000
root@CHFW:~# devmem 0x80010000 
0x00000000
root@CHFW:~# devmem 0x80050000 
[ 1466.648378] Synchronous External Abort: synchronous external abort (0x92000210) at 0x0000007f88ada000
Bus error

read vtc cause bus error. The error look the same as vtc driver probe 's panic;

Two VDMA's address reange only 4K(auto assigned ).  

BestRegards

HSQ

 

0 Kudos
Reply
Explorer
Explorer
634 Views
Registered: ‎02-15-2019

vtc的复位信号是否接的是GPIO,device tree里有没有VTC的映射。
0 Kudos
Reply