Problems in linux kernel porting, stuck in paging_init function

1

reference board : i.mx6q sabresd, kernel version : 4.9.17

    Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.9.17-04736-ga88711e-dirty (mrigendra.chaubey@CPU-384U) (gcc version 4.9.x 20150123 (prerelease) (GCC) ) #6 SMP PREEMPT Sun Jul 8 12:13:44 IST 2018
[    0.000000] CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c53c7d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt:Machine model: Freescale i.MX6 Quad SABRE Smart Device Board
[    0.000000] cma: Reserved 448 MiB at 0x2a000000
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] ##DEBUGsmb_tlb.c: flush_tlb_kernel_range1
[    0.000000] ##DEBUGsmb_tlb.c: start: da000000 end: f6000000
[    0.000000] ##DEBUGsmb_tlb.c: flush_tlb_kernel_range2
[    0.000000] percpu: Embedded 15 pages/cpu @f6eb6000 s31040 r8192 d22208 u61440
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 260368
[    0.000000] Kernel command line: console=ttymxc0,115200 init=/init earlyprintk video=mxcfb0:dev=ldb,fbpix=RGB32,bpp=32 video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off vmalloc=128M androidboot.console=ttymxc0 consoleblank=0 androidboot.hardware=freescale cma=448M galcore.contiguousSize=33554432 buildvariant=userdebug androidboot.serialno=071f21d4d72d7372 androidboot.soc_type=imx6q androidboot.storage_type=sd gpt
[    0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Memory: 556280K/1048576K available (13312K kernel code, 1121K rwdata, 4300K rodata, 1024K init, 612K bss, 33544K reserved, 458752K cma-reserved, 139264K highmem)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xf8000000 - 0xff800000   ( 120 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xf7800000   ( 888 MB)

Above logs are from a working sabresd board. My source are taken from nxp's android O source.

I am porting android on our custom board, that is similar to sabresd and based on imx6q . My ported kernel is stuck. Here are the logs,

Uncompressing Linux... done, booting the kernel.
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.9.17 (mrigendra.chaubey@CPU-384U) (gcc version 4.9.x 20150123 (prerelease) (GCC) ) #23 SMP PREEMPT Sat Jul 7 23:29:19 IST 2018
[    0.000000] CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c53c7d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt:Machine model: Freescale i.MX6 MYSABRE Board
[    0.000000] bootconsole [earlycon0] enabled
[    0.000000] cma: early_cma(448M)
[    0.000000] cma: dma_contiguous_reserve(limit ffffffff)
[    0.000000] cma: dma_contiguous_reserve: reserving 448 MiB for global area
[    0.000000] cma: cma_declare_contiguous(size 0x1c000000, base 0x00000000, limit 0x50000000 alignment 0x00000000)
[    0.000000] cma: Reserved 448 MiB at 0x2a000000
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] ##DEBUGmmu.c: build_mem_type_table done
[    0.000000] ##DEBUGmmu.c: build_mem_type_table done
[    0.000000] ##DEBUGmmu.c: prepare_page_table done
[    0.000000] ##DEBUGmmu.c: map_lowmem done
[    0.000000] ##DEBUGmmu.c: memblock_set_current_limit done
[    0.000000] ##DEBUGdna-mapping.c: dma_contiguous_remap1
[    0.000000] ##DEBUGdna-mapping.c: dma_contiguous_remap2
[    0.000000] ##DEBUGsmb_tlb.c: flush_tlb_kernel_range1
[    0.000000] ##DEBUGsmb_tlb.c: start: da000000 end: f6000000

Both boards are configured for vmsplit_3g.

My setup_arch call is not completed due to some issue that I am not able to find, this is the call flow

start_kernel > setup_arch > paging_init > dma_contiguous_remap > flush_kernel_tlb_range > local_flush_tlb_range

one thing I am not able to understand where this function go

local_flush_tlb_kernel_range(start, end);

the start and end I printed just above local_flush_tlb_kernel_range(start, end) call in function flush_tlb_kernel_range.

In my case and in nxp sabre case this is local_flush_tlb_kernel_range becomes

struct cpu_tlb_fns {
    void (*flush_user_range)(unsigned long, unsigned long, struct vm_area_struct *);
    void (*flush_kern_range)(unsigned long, unsigned long);
    unsigned long tlb_flags;
};

/*
 * Select the calling method
 */
#ifdef MULTI_TLB

#define __cpu_flush_user_tlb_range  cpu_tlb.flush_user_range
#define __cpu_flush_kern_tlb_range  cpu_tlb.flush_kern_range

#else
xx
#define __cpu_flush_user_tlb_range  __glue(_TLB,_flush_user_tlb_range)
#define __cpu_flush_kern_tlb_range  __glue(_TLB,_flush_kern_tlb_range)

extern void __cpu_flush_user_tlb_range(unsigned long, unsigned long, struct vm_area_struct *);
extern void __cpu_flush_kern_tlb_range(unsigned long, unsigned long);

So I thought that somewhere in kernel flush_kern_range will be defined but I am not able to find that definition

As both workspaces are different there are some extra ##DEBUGfile.c are in my logs.

  1. I have this idea that setup_arch have nothing to do with my board specific functions and its a generic call to all arm architectures.

  2. I tried to put sabresd dtb in uboot, so that if something related to memory is done inside it, atleast that much initialisation will happen, same result as this.

  3. Tried to put pr_info until I could not find defenition of the function flush_kern_range. In nxp sabre this function is called again and again.

Can anyone help me with some of the points.

c
kernel
paging
tlb
nxp-microcontroller
asked on Stack Overflow Jul 8, 2018 by mrigendra • edited Jul 8, 2018 by mrigendra

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0