【メモ】Zynq - Linux Kernel 3.8.11のtimerエラーについて

Zynq - Linux 3.8.11のtimerエラーについて、作業記録。

元のエラー内容は下記である。

------------[ cut here ]------------                                           

Kernel BUG at c051889c [verbose debug info unavailable]                        

Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM                             

Modules linked in:                                                             

CPU: 0    Not tainted  (3.8.11-xilinx #1)                                      

PC is at xttcps_timer_init_old+0x38/0x36c                                      

LR is at xttcps_timer_init_old+0x38/0x36c                                      

pc : [<c051889c>]    lr : [<c051889c>]    psr: 200001d3                        

sp : c053bf90  ip : 00000000  fp : 00000000                                    

r10: 00000000  r9 : 0000002b  r8 : c09a2480                                    

r7 : c0531d28  r6 : e0804000  r5 : c053a000  r4 : fffffffe                     

r3 : c0549c80  r2 : 600001d3  r1 : 600001d3  r0 : 00000029                     

Flags: nzCv  IRQs off  FIQs off  Mode SVC_32  ISA ARM  Segment kernel          

Control: 18c5387d  Table: 0000404a  DAC: 00000015                              

Process swapper/0 (pid: 0, stack limit = 0xc053a238)                           

Stack: (0xc053bf90 to 0xc053c000)                                              

bf80:                                     00000000 c047834c c053bf78 c05736c0  

bfa0: c053a000 ffffffff c0531d28 c09a3300 413fc090 00000000 00000000 c0513c0c  

bfc0: 00000000 c05106ac ffffffff ffffffff c05102dc 00000000 00000000 c0531d28  

bfe0: 18c5387d c0542430 c0531d20 c0545c6c 0000406a 00008078 00000000 00000000  

[<c051889c>] (xttcps_timer_init_old+0x38/0x36c) from [<c0513c0c>] (time_init+0x)

[<c0513c0c>] (time_init+0x20/0x30) from [<c05106ac>] (start_kernel+0x1b0/0x2ec)

[<c05106ac>] (start_kernel+0x1b0/0x2ec) from [<00008078>] (0x8078)             

Code: e2506000 1a000002 e59f02e4 ebfa3af7 (e7f001f2)                           

---[ end trace 1b75b31a2719ed1c ]---                                           

下記に出力メッセージがある。

arch/arm/kernel/trap.c

ここの__dieから出力されている。

----L.853

ifdef CONFIG_PREEMPT

define S_PREEMPT " PREEMPT"

else

define S_PREEMPT ""

endif

ifdef CONFIG_SMP

define S_SMP " SMP"

else

define S_SMP ""

endif

ifdef CONFIG_THUMB2_KERNEL

define S_ISA " THUMB2"

else

define S_ISA " ARM"

endif

static int __die(const char str, int err, struct pt_regs regs)

{

        struct task_struct *tsk = current;

        static int die_counter;

        int ret;

        printk(KERN_EMERG "Internal error: %s: %x [#%d]" S_PREEMPT S_SMP

               S_ISA "\n", str, err, ++die_counter),


つまり、”PREEMPT SMP ARM”がエラー本体ではなく、"xttcps_timer_init_old"に問題がある。

"xttcps_timer_init_old"自体は下記にある。

arch/arm/mach-zynq/timer.c

ここでエラーが発生しているようだ。

この"xttcps_timer_init_old"関数は

arch/arm/mach-zynq/common.cのみの参照になる。

xilinx_zynq_timer_init()関数からのみ参照している。

ここでは"xttcps_timer_init_old"関数の前に"zynq_slcr_init()"を実行してる。

"xttcps_timer_init_old"関数内部は下記になる。

----ここから

/*

 * This will be replaced in v3.10 by

 * CLOCKSOURCE_OF_DECLARE(zynq, "xlnx,ttc",xttcps_timer_init),

 * or

 * CLOCKSOURCE_OF_DECLARE(zynq, "xlnx,ps7-ttc-1.00.a",xttcps_timer_init),

 */

void __init xttcps_timer_init_old(void)

{

        const char * const timer_list[] = {

                "xlnx,ps7-ttc-1.00.a",

                NULL

        };

        struct device_node *timer;

        timer = of_find_compatible_node(NULL, NULL, timer_list[0]),

        if (!timer) {

                pr_err("ERROR: no compatible timer found\n"),

                BUG(),

        }

        xttcps_timer_init(timer),

}

----ここまで

----kernel 3.8.0のdmesg

[    0.000000] Booting Linux on physical CPU 0x0                               

[    0.000000] Linux version 3.8.0-xilinx (hidemi@saturn) (gcc version 4.8.1 (G3

[    0.000000] CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d 

[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instructie

[    0.000000] Machine: Xilinx Zynq Platform, model: ZedBoard                  

[    0.000000] bootconsole [earlycon0] enabled                                 

[    0.000000] cma: CMA: reserved 16 MiB at 1e800000                           

[    0.000000] Memory policy: ECC disabled, Data cache writealloc              

[    0.000000] On node 0 totalpages: 131072                                    

[    0.000000] free_area_init_node: node 0, pgdat c056a7c0, node_mem_map c059d00

[    0.000000]   Normal zone: 1024 pages used for memmap                       

[    0.000000]   Normal zone: 0 pages reserved                                 

[    0.000000]   Normal zone: 130048 pages, LIFO batch:31                      

[    0.000000] PERCPU: Embedded 7 pages/cpu @c09a5000 s7616 r8192 d12864 u32768

[    0.000000] pcpu-alloc: s7616 r8192 d12864 u32768 alloc=8*4096              

[    0.000000] pcpu-alloc: [0] 0 [0] 1                                         

[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pa8

[    0.000000] Kernel command line: console=ttyPS0,115200 root=/dev/mmcblk0p2 rk

[    0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)             

[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes) 

[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)  

[    0.000000] __ex_table already sorted, skipping sort                        

[    0.000000] Memory: 512MB = 512MB total                                     

[    0.000000] Memory: 497488k/497488k available, 26800k reserved, 0K highmem  

[    0.000000] Virtual kernel memory layout:                                   

    vector  : 0xffff0000 - 0xffff1000   (   4 kB)                              

    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)                              

    vmalloc : 0xe0800000 - 0xff000000   ( 488 MB)                              

    lowmem  : 0xc0000000 - 0xe0000000   ( 512 MB)                              

    pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)                              

    modules : 0xbf000000 - 0xbfe00000   (  14 MB)                              

      .text : 0xc0008000 - 0xc050e8c4   (5147 kB)                              

      .init : 0xc050f000 - 0xc0538dc0   ( 168 kB)                              

      .data : 0xc053a000 - 0xc05729e8   ( 227 kB)                              

       .bss : 0xc05729e8 - 0xc059cf18   ( 170 kB)                              

[    0.000000] Preemptible hierarchical RCU implementation.                    

[    0.000000]  Dump stacks of tasks blocking RCU-preempt GP.                  

[    0.000000]  RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.           

[    0.000000] NR_IRQS:16 nr_irqs:16 16                                        

[    0.000000] xslcr mapped to e0802000                                        

[    0.000000] Zynq clock init                                                 

[    0.000000] ps7-ttc #0 at e0804000, irq=43                                  

[    0.000000] sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps eves

[    0.000000] Console: colour dummy device 80x30                              

[    0.010000] Calibrating delay loop... 1332.01 BogoMIPS (lpj=6660096)        

[    0.050000] pid_max: default: 32768 minimum: 301                            

[    0.050000] Mount-cache hash table entries: 512                             

[    0.050000] CPU: Testing write buffer coherency: ok                         

[    0.050000] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000                

[    0.060000] Setting up static identity map for 0x3ab918 - 0x3ab94c          

[    0.060000] L310 cache controller enabled                                   

[    0.060000] l2x0: 8 ways, CACHE_ID 0x000000c0, AUX_CTRL 0x72360000, Cache siB

[    0.150000] CPU1: Booted secondary processor                                

[    0.240000] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001                

[    0.240000] Brought up 2 CPUs                                               

[    0.240000] SMP: Total of 2 processors activated (2664.03 BogoMIPS).        

[    0.240000] devtmpfs: initialized                                           

[    0.250000] NET: Registered protocol family 16                              

[    0.270000] DMA: preallocated 256 KiB pool for atomic coherent allocations  

[    0.270000] xgpiops e000a000.ps7-gpio: gpio at 0xe000a000 mapped to 0xe080c00

[    0.280000] hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint.

[    0.280000] hw-breakpoint: maximum watchpoint size is 4 bytes.              

[    0.300000] bio: create slab <bio-0> at 0                                   

[    0.300000] vgaarb: loaded                                                  

[    0.300000] SCSI subsystem initialized                                      

[    0.300000] usbcore: registered new interface driver usbfs                  

[    0.310000] usbcore: registered new interface driver hub                    

[    0.310000] usbcore: registered new device driver usb                       

[    0.320000] pps_core: LinuxPPS API ver. 1 registered                        

[    0.320000] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giom>

[    0.330000] PTP clock support registered                                    

[    0.330000] Switching to clocksource xttcps_clocksource                     

[    0.340000] NET: Registered protocol family 2                               

[    0.340000] TCP established hash table entries: 4096 (order: 3, 32768 bytes)

[    0.340000] TCP bind hash table entries: 4096 (order: 3, 32768 bytes)       

[    0.350000] TCP: Hash tables configured (established 4096 bind 4096)        

[    0.350000] TCP: reno registered                                            

[    0.360000] UDP hash table entries: 256 (order: 1, 8192 bytes)              

[    0.360000] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)         

[    0.370000] NET: Registered protocol family 1                               

[    0.370000] RPC: Registered named UNIX socket transport module.             

[    0.370000] RPC: Registered udp transport module.                           

[    0.380000] RPC: Registered tcp transport module.                           

[    0.380000] RPC: Registered tcp NFSv4.1 backchannel transport module.       

[    0.390000] PCI: CLS 0 bytes, default 64                                    

[    0.390000] hw perfevents: enabled with ARMv7 Cortex-A9 PMU driver, 7 countee

[    0.420000] jffs2: version 2.2. (NAND) (SUMMARY)  xffffffc2xffffffa9 2001-.

[    0.420000] msgmni has been set to 1003                                     

[    0.420000] io scheduler noop registered                                    

[    0.420000] io scheduler deadline registered                                

[    0.430000] io scheduler cfq registered (default)                           

[    0.430000] dma-pl330 f8003000.ps7-dma: Loaded driver for PL330 DMAC-267056 

[    0.440000] dma-pl330 f8003000.ps7-dma:      DBUFF-128x8bytes Num_Chans-8 Nu6

[    0.440000] e0001000.serial: ttyPS0 at MMIO 0xe0001000 (irq = 82) is a xuarts

[    0.450000] console [ttyPS0] enabled, bootconsole disabled                  

[    0.450000] xdevcfg f8007000.ps7-dev-cfg: ioremap f8007000 to e0862000 with 0

[    0.470000] brd: module loaded                                              

[    0.480000] loop: module loaded                                             

[    0.480000] xspips e0006000.ps7-spi: master is unqueued, this is deprecated 

[    0.490000] xspips e0006000.ps7-spi: at 0xE0006000 mapped to 0xE0864000, irq8

[    0.500000] xspips e0007000.ps7-spi: master is unqueued, this is deprecated 

[    0.500000] xspips e0007000.ps7-spi: at 0xE0007000 mapped to 0xE0866000, irq1

[    0.510000] xqspips e000d000.ps7-qspi: master is unqueued, this is deprecated

[    0.520000] m25p80 spi2.0: found mr25h256, expected n25q128                 

[    0.520000] m25p80 spi2.0: mr25h256 (32 Kbytes)                             

[    0.520000] 5 ofpart partitions found on MTD device spi2.0                  

[    0.530000] Creating 5 MTD partitions on "spi2.0":                          

[    0.530000] 0x000000000000-0x000000100000 : "qspi-fsbl-uboot"               

[    0.530000] mtd: partition "qspi-fsbl-uboot" extends beyond the end of devic0

[    0.540000] 0x000000100000-0x000000600000 : "qspi-linux"                    

[    0.550000] mtd: partition "qspi-linux" is out of reach -- disabled         

[    0.550000] 0x000000600000-0x000000620000 : "qspi-device-tree"              

[    0.560000] mtd: partition "qspi-device-tree" is out of reach -- disabled   

[    0.570000] 0x000000620000-0x000000c00000 : "qspi-rootfs"                   

[    0.570000] mtd: partition "qspi-rootfs" is out of reach -- disabled        

[    0.580000] 0x000000c00000-0x000001000000 : "qspi-bitstream"                

[    0.580000] mtd: partition "qspi-bitstream" is out of reach -- disabled     

[    0.590000] xqspips e000d000.ps7-qspi: at 0xE000D000 mapped to 0xE0868000, i1

[    0.590000] e1000e: Intel(R) PRO/1000 Network Driver - 2.1.4-k              

[    0.600000] e1000e: Copyright(c) 1999 - 2012 Intel Corporation.             

[    0.610000] libphy: XEMACPS mii bus: probed                                 

[    0.610000] xemacps e000b000.ps7-ethernet: pdev->id -1, baseaddr 0xe000b000,4

[    0.620000] ehci_hcd: USB 2.0 ''Enhanced'' Host Controller (EHCI) Driver      

[    0.620000] ehci-pci: EHCI PCI platform driver                              

[    0.630000] xusbps-dr e0002000.ps7-usb: Unable to init USB phy, missing?    

[    0.630000] Initializing USB Mass Storage driver...                         

[    0.640000] usbcore: registered new interface driver usb-storage            

[    0.640000] USB Mass Storage support registered.                            

[    0.650000] mousedev: PS/2 mouse device common for all mice                 

[    0.650000] i2c /dev entries driver                                         

[    0.650000] xadcps f8007100.ps7-xadc: enabled:       yes     reference:     l

[    0.660000] sdhci: Secure Digital Host Controller Interface driver          

[    0.660000] sdhci: Copyright(c) Pierre Ossman                               

[    0.670000] sdhci-pltfm: SDHCI platform and OF driver helper                

[    0.670000] mmc0: Invalid maximum block size, assuming 512 bytes            

[    0.720000] mmc0: SDHCI controller on e0100000.ps7-sdio [e0100000.ps7-sdio] A

[    0.730000] usbcore: registered new interface driver usbhid                 

[    0.730000] usbhid: USB HID core driver                                     

[    0.740000] TCP: cubic registered                                           

[    0.740000] NET: Registered protocol family 17                              

[    0.740000] VFP support v0.3: implementor 41 architecture 3 part 30 variant 4

[    0.750000] Registering SWP/SWPB emulation handler                          

[    0.760000] dmatest: Started 1 threads using dma0chan0                      

[    0.760000] dmatest: Started 1 threads using dma0chan1                      

[    0.770000] dmatest: Started 1 threads using dma0chan2                      

[    0.770000] dmatest: Started 1 threads using dma0chan3                      

[    0.780000] dmatest: Started 1 threads using dma0chan4                      

[    0.780000] dmatest: Started 1 threads using dma0chan5                      

[    0.800000] mmc0: new high speed SDHC card at address 0007                  

[    0.800000] mmcblk0: mmc0:0007 SD04G 3.70 GiB                               

[    0.810000] dmatest: Started 1 threads using dma0chan6                      

[    0.810000]  mmcblk0: p1 p2                                                 

[    0.810000] dmatest: Started 1 threads using dma0chan7                      

[    0.830000] EXT3-fs (mmcblk0p2): error: couldn''t mount because of unsupporte)

[    0.840000] EXT2-fs (mmcblk0p2): error: couldn''t mount because of unsupporte)

[    0.860000] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. )

[    0.870000] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.   

[    0.890000] devtmpfs: mounted                                               

[    0.890000] Freeing init memory: 164K                                       

[    1.920000] udevd[704]: starting version 182                                

[    2.430000] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)                   

[    6.590000] xemacps e000b000.ps7-ethernet: Set clk to 124999998 Hz          

[    6.590000] xemacps e000b000.ps7-ethernet: link up (1000/FULL)              

----kernel 3.8.0のdmesg

----エラーが出るkernel 3.8.11のdmesg

Linux version 3.8.11-xilinx (hidemi@saturn) (gcc version 4.8.2 (GCC) ) #1 SMP P3

CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d                

CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache       

Machine: Xilinx Zynq Platform, model: ZedBoard                                 

bootconsole [earlycon0] enabled                                                

cma: CMA: reserved 16 MiB at 1e800000                                          

Memory policy: ECC disabled, Data cache writealloc                             

PERCPU: Embedded 7 pages/cpu @c09a6000 s7616 r8192 d12864 u32768               

Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 130048    

Kernel command line: console=ttyPS0,115200 root=/dev/mmcblk0p2 ro earlyprintk  

PID hash table entries: 2048 (order: 1, 8192 bytes)                            

Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)                

Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)                 

__ex_table already sorted, skipping sort                                       

Memory: 512MB = 512MB total                                                    

Memory: 497484k/497484k available, 26804k reserved, 0K highmem                 

Virtual kernel memory layout:                                                  

    vector  : 0xffff0000 - 0xffff1000   (   4 kB)                              

    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)                              

    vmalloc : 0xe0800000 - 0xff000000   ( 488 MB)                              

    lowmem  : 0xc0000000 - 0xe0000000   ( 512 MB)                              

    pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)                              

    modules : 0xbf000000 - 0xbfe00000   (  14 MB)                              

      .text : 0xc0008000 - 0xc050f8bc   (5151 kB)                              

      .init : 0xc0510000 - 0xc0539dc0   ( 168 kB)                              

      .data : 0xc053a000 - 0xc0573688   ( 230 kB)                              

       .bss : 0xc0573688 - 0xc059dcdc   ( 170 kB)                              

Preemptible hierarchical RCU implementation.                                   

        Dump stacks of tasks blocking RCU-preempt GP.                          

        RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.                   

NR_IRQS:16 nr_irqs:16 16                                                       

xslcr mapped to e0802000                                                       

ERROR: clock source input clock not found                                      

------------[ cut here ]------------                                           

Kernel BUG at c051889c [verbose debug info unavailable]                        

Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM                             

Modules linked in:                                                             

CPU: 0    Not tainted  (3.8.11-xilinx #1)                                      

PC is at xttcps_timer_init_old+0x38/0x36c                                      

LR is at xttcps_timer_init_old+0x38/0x36c                                      

pc : [<c051889c>]    lr : [<c051889c>]    psr: 200001d3                        

sp : c053bf90  ip : 00000000  fp : 00000000                                    

r10: 00000000  r9 : 0000002b  r8 : c09a2480                                    

r7 : c0531d28  r6 : e0804000  r5 : c053a000  r4 : fffffffe                     

r3 : c0549c80  r2 : 600001d3  r1 : 600001d3  r0 : 00000029                     

Flags: nzCv  IRQs off  FIQs off  Mode SVC_32  ISA ARM  Segment kernel          

Control: 18c5387d  Table: 0000404a  DAC: 00000015                              

Process swapper/0 (pid: 0, stack limit = 0xc053a238)                           

Stack: (0xc053bf90 to 0xc053c000)                                              

bf80:                                     00000000 c047834c c053bf78 c05736c0  

bfa0: c053a000 ffffffff c0531d28 c09a3300 413fc090 00000000 00000000 c0513c0c  

bfc0: 00000000 c05106ac ffffffff ffffffff c05102dc 00000000 00000000 c0531d28  

bfe0: 18c5387d c0542430 c0531d20 c0545c6c 0000406a 00008078 00000000 00000000  

[<c051889c>] (xttcps_timer_init_old+0x38/0x36c) from [<c0513c0c>] (time_init+0x)

[<c0513c0c>] (time_init+0x20/0x30) from [<c05106ac>] (start_kernel+0x1b0/0x2ec)

[<c05106ac>] (start_kernel+0x1b0/0x2ec) from [<00008078>] (0x8078)             

Code: e2506000 1a000002 e59f02e4 ebfa3af7 (e7f001f2)                           

---[ end trace 1b75b31a2719ed1c ]---                                           

----kernel 3.8.11のログ

下記のエラーはtimer.cに含まれる。

arch/arm/mach-zynq/timer.c

"ERROR: clock source input clock not found "

xttcps_timer_init()関数内にこのエラー出力が存在する。

----ここから

/*

 * Timer Register Offset Definitions of Timer 1, Increment base address by 4

 * and use same offsets for Timer 2

 */

define XTTCPS_CLK_CNTRL_OFFSET 0x00 / Clock Control Reg, RW /

define XTTCPS_CNT_CNTRL_OFFSET 0x0C / Counter Control Reg, RW /

define XTTCPS_COUNT_VAL_OFFSET 0x18 / Counter Value Reg, RO /

define XTTCPS_INTR_VAL_OFFSET          0x24 / Interval Count Reg, RW /

define XTTCPS_ISR_OFFSET               0x54 / Interrupt Status Reg, RO /

define XTTCPS_IER_OFFSET               0x60 / Interrupt Enable Reg, RW /

define XTTCPS_CLK_CNTRL_CSRC_MASK      (1 << 5)        / clock source /

define XTTCPS_CNT_CNTRL_DISABLE_MASK   0x1

----ここまで

----ここから

        clksel = __raw_readl(timer_baseaddr + XTTCPS_CLK_CNTRL_OFFSET),

        clksel = !!(clksel & XTTCPS_CLK_CNTRL_CSRC_MASK),

        clk_cs = of_clk_get(timer, clksel),

        if (IS_ERR(clk_cs)) {

                pr_err("ERROR: clock source input clock not found\n"),

                BUG(),

        }

----ここまで

clksel = !!(clksel & XTTCPS_CLK_CNTRL_CSRC_MASK),

上記の一文がclock sourceを判定している文になっている。

このマスクが下記を示すビットを判定している。

Register Clock_Control_1 - bit5 C_Src

"Clock Source: when this bit is set the counter uses  the external clock input, ext_clk; the default clock source is pclk."

UG585の1683ページ目あたり。

write: 2013/12/10/ 02:11:09