I am working a customized imx8qm mek board, and run into trouble with hardware partition. During uboot period, if "scu_rm dtb" is called, the memory @ 0x85000000 cannot be accessed, as a result, system reset when load Dom0 kernel to that address, the details as follows:
=> fatload mmc 0:1 0x80280000 xen
819536 bytes read in 11 ms (71.1 MiB/s)
=> fatload mmc 0:1 0x83000000 fsl-imx8qm-mek-dom0.dtb
104201 bytes read in 9 ms (11 MiB/s)
=> scu_rm dtb 0x83000000
fdt addr 0000000083000000
partition_alloc: os_part, 4: parent_part, 3
=> scu_rm print
part id: 4 3
=> fatload mmc 0:1 0x85000000 Image
"Synchronous Abort" handler, esr 0x96000210
elr: 000000008004acdc lr : 000000008004accc (reloc)
elr: 00000000ffea6cdc lr : 00000000ffea6ccc
x0 : 00000000ffffffff x1 : 00000000fd66b320
x2 : 00000000fd66b308 x3 : 00000000ffea6c98
x4 : 000000000000000e x5 : 000000000000000e
x6 : 0000000000000000 x7 : 0000000000000010
x8 : 0000000000000044 x9 : 0000000000000008
x10: 00000000ffffffd8 x11: 0000000000000006
x12: 000000000001869f x13: 00000000000187ac
x14: 00000000fd66b70c x15: 00000000ffffffff
x16: 0000000000002080 x17: 0000000000000000
x18: 00000000fd679da8 x19: 000000005b010000
x20: 00000000fd684f50 x21: 00000000fd66b308
x22: 00000000fd66b320 x23: 0000000000000000
x24: 0000000000000000 x25: 00000000fd686970
x26: 00000000ffee346d x27: 0000000000000011
x28: 0000000000000001 x29: 00000000fd66b250
Resetting CPU ...
However, if I skip "scu_rm dtb 0x83000000 ", Xen can boot but will panic later:
=> fatload mmc 0:1 0x80280000 xen
819536 bytes read in 11 ms (71.1 MiB/s)
=> fatload mmc 0:1 0x83000000 fsl-imx8qm-mek-dom0.dtb
104201 bytes read in 9 ms (11 MiB/s)
=> fatload mmc 0:1 0x85000000 Image
23175680 bytes read in 101 ms (218.8 MiB/s)
=> fdt addr 0x83000000
=> fdt resize 256
=> fdt set /chosen/module@0 reg <0x00000000 0x85000000 0x00000000 0x${filesize}>
=> fdt set /chosen/module@0 bootargs "${bootargs} ${xenlinux_bootargs}"
=> setenv bootargs ${xenhyper_bootargs};
=> booti ${loadaddr} - ${fdt_addr};
## Flattened Device Tree blob at 83000000
Booting using the fdt blob at 0x83000000
reserving fdt memory region: addr=84000000 size=2000000
reserving fdt memory region: addr=86000000 size=400000
reserving fdt memory region: addr=90000000 size=400000
reserving fdt memory region: addr=90400000 size=1c00000
reserving fdt memory region: addr=92000000 size=200000
reserving fdt memory region: addr=92400000 size=2000000
reserving fdt memory region: addr=83000000 size=1a000
Using Device Tree in place at 0000000083000000, end 000000008301cfff
/dma-controller@599F0000, 67608
Starting kernel ...
Xen 4.11.1-pre
(XEN) Xen version 4.11.1-pre (minskey@) (aarch64-poky-linux-gcc (GCC) 7.3.0) debug=n Wed May 22 14:49:04 UTC 2019
(XEN) Latest ChangeSet: Tue Apr 16 16:24:07 2019 +0800 git:2eb8336-dirty
(XEN) Processor: 410fd034: "ARM Limited", variant: 0x0, part 0xd03, rev 0x4
(XEN) 64-bit Execution:
(XEN) Processor Features: 0000000001002222 0000000000000000
(XEN) Exception Levels: EL3:64+32 EL2:64+32 EL1:64+32 EL0:64+32
(XEN) Extensions: FloatingPoint AdvancedSIMD GICv3-SysReg
(XEN) Debug Features: 0000000010305106 0000000000000000
(XEN) Auxiliary Features: 0000000000000000 0000000000000000
(XEN) Memory Model Features: 0000000000001122 0000000000000000
(XEN) ISA Features: 0000000000011120 0000000000000000
(XEN) 32-bit Execution:
(XEN) Processor Features: 00000131:10011011
(XEN) Instruction Sets: AArch32 A32 Thumb Thumb-2 Jazelle
(XEN) Extensions: GenericTimer Security
(XEN) Debug Features: 03010066
(XEN) Auxiliary Features: 00000000
(XEN) Memory Model Features: 10201105 40000000 01260000 02102211
(XEN) ISA Features: 02101110 13112111 21232042 01112131 00011142 00011121
(XEN) Generic Timer IRQ: phys=30 hyp=26 virt=27 Freq: 8000 KHz
(XEN) GICv3 initialization:
(XEN) gic_dist_addr=0x00000051a00000
(XEN) gic_maintenance_irq=25
(XEN) gic_rdist_stride=0
(XEN) gic_rdist_regions=1
(XEN) redistributor regions:
(XEN) - region 0: 0x00000051b00000 - 0x00000051bc0000
(XEN) GICv3 compatible with GICv2 cbase 0x00000052000000 vbase 0x00000052020000
(XEN) GICv3: 544 lines, (IID 0001143b).
(XEN) GICv3: CPU0: Found redistributor in region 0 @000000004002d000
(XEN) Using scheduler: SMP Credit Scheduler (credit)
(XEN) Allocated console ring of 16 KiB.
(XEN) Bringing up CPU1
(XEN) GICv3: CPU1: Found redistributor in region 0 @000000004004d000
(XEN) Bringing up CPU2
(XEN) GICv3: CPU2: Found redistributor in region 0 @000000004006d000
(XEN) Bringing up CPU3
(XEN) GICv3: CPU3: Found redistributor in region 0 @000000004008d000
(XEN) Bringing up CPU4
(XEN) GICv3: CPU4: Found redistributor in region 0 @00000000400ad000
(XEN) Bringing up CPU5
(XEN) GICv3: CPU5: Found redistributor in region 0 @00000000400cd000
(XEN) Brought up 6 CPUs
(XEN) P2M: 40-bit IPA with 40-bit PA and 8-bit VMID
(XEN) P2M: 3 levels with order-1 root, VTCR 0x80023558
(XEN) I/O virtualisation enabled
(XEN) - Dom0 mode: Relaxed
(XEN) Interrupt remapping enabled
(XEN) *** LOADING DOMAIN 0 ***
(XEN) Loading kernel from boot module @ 0000000085000000
(XEN) Allocating 1:1 mappings totalling 2048MB for dom0:
(XEN) BANK[0] 0x00000088000000-0x00000090000000 (128MB)
(XEN) BANK[1] 0x00000098000000-0x00000100000000 (1664MB)
(XEN) BANK[2] 0x00000960000000-0x00000970000000 (256MB)
(XEN) Grant table range: 0x0000097fe00000-0x0000097fe40000
(XEN) Ignore reserved memory reg, /reserved-memory/decoder_boot@0x84000000!
(XEN) Ignore reserved memory reg, /reserved-memory/encoder_boot@0x86000000!
(XEN) Ignore reserved memory reg, /reserved-memory/rpmsg@0x90000000!
(XEN) Ignore reserved memory reg, /reserved-memory/rpmsg_dma@0x90400000!
(XEN) Ignore reserved memory reg, /reserved-memory/decoder_rpc@0x92000000!
(XEN) Ignore reserved memory reg, /reserved-memory/encoder_rpc@0x92200000!
(XEN) Ignore reserved memory reg, /reserved-memory/dsp@0x92400000!
(XEN) Ignore reserved memory reg, /reserved-memory/encoder_reserved@0x94400000!
(XEN) Share gpio between Domains: /gpio@5d090000
(XEN) Share gpio between Domains: /gpio@5d0c0000
(XEN) HACK: skip /imx8_gpu_ss setup!
(XEN) NODE /m41_mem@0x94400000 conflicts with kernel address 0x00000088080000-0x0000008969a200
(XEN) Adjust load_offset to 0x00000008000000
(XEN) Allocating PPI 16 for event channel interrupt
(XEN) Loading zImage from 0000000085000000 to 0000000090080000-000000009169a200
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) Unable to copy the kernel in the hwdom memory
(XEN) ****************************************
(XEN)
(XEN) Reboot in five seconds...
U-Boot 2018.03-imx_v2018.03_4.14.98_2.0.0_ga+g87a19df (May 17 2019 - 00:08:15 +0000)
Can u give me some clues about this issue ? Like, is it caused by uboot or scu firmware ? The code is based on 4.14.98_2.0.0_ga+g87a19df release.
Regards,
-Minskey
Hi Minskey
for xen building and usage one can look at sect.5.6.11 Building Xen
attached Yocto Guide and sect.11.3 Xen Linux Guide.
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
During Xen booting, Xen allocates 2048MB memory for Dom0 as follows:
(XEN) Allocating 1:1 mappings totalling 2048MB for dom0:
(XEN) BANK[0] 0x00000088000000-0x00000090000000 (128MB)
(XEN) BANK[1] 0x00000098000000-0x00000100000000 (1664MB)
(XEN) BANK[2] 0x00000960000000-0x00000970000000 (256MB)
And, in mek-dom0.dts, m41 memory is 0x88800000 ~ 0x90000000(at the end of bandk[0]);
m41_mem: m41_mem@0x94400000 {
xen,passthrough;
reg = <0 0x88800000 0 0x7800000>;
};
The size of Dom0 kernel is 0x161A200, and the size of m41_mem is 120MB/0x7800000B. if we load dom0 kernel into bank0 (@0x88000000 + text_offset(0x8 00000), there must be an overlapping with m41_mem.
For my customized Mek Board, when the conflict occurs, Xen tries to load dom0 kernel to 0x90080000-0x9169a200, which is not in any bank allocated to Dom0. So, system panic when Xen tries to move Dom0 kernel from 0x92000000 to 0x9008000.
Can I change the memory range of m41_mem to other position, like bank1 ?
Do I misunderstand anything ?
Regards,
-minskey
Hi minskey
partition and memory management are performed by scfw, so one can look at its documentation:
Best regards
igor
Yes, I read the scfw doc. What I want to understand is :
The memory of Bank0 allocated to Dom0 is only 128M, but the m41_memory occupies 120M, only 8M for Dom0 kernel, although the size of Dom0 kernel is 0x161A200.
I tried to move m41-mem to 0x98800000, it does work. But I don't know if there is any potential issue here.
thanks,
-minskey
At last, I found the root cause. In uboot config file (imx8qm_mek_defconfig), it reserves that range of memory for CM41, but my friend remove the configuration. Add it back fix this issue,
CONFIG_BOOTAUX_RESERVED_MEM_BASE=0x88000000
CONFIG_BOOTAUX_RESERVED_MEM_SIZE=0x08000000
Now, I move the kernel Image load address from 0x85000000 to 0x92000000 as qm MEK board, Xen boot makes some progress. But still panic in uboot kernel_zimage_load().
Do we have a document which lists the memory layout for Xen, Dom0, Domu, M4_0/1 ?
The following is the Xen message during booting.
Xen 4.11.1-pre
(XEN) Xen version 4.11.1-pre (minskey@) (aarch64-poky-linux-gcc (GCC) 7.3.0) debug=n Sun May 26 22:13:12 UTC 2019
(XEN) Latest ChangeSet: Tue Apr 16 16:24:07 2019 +0800 git:2eb8336-dirty
(XEN) Processor: 410fd034: "ARM Limited", variant: 0x0, part 0xd03, rev 0x4
(XEN) 64-bit Execution:
(XEN) Processor Features: 0000000001002222 0000000000000000
(XEN) Exception Levels: EL3:64+32 EL2:64+32 EL1:64+32 EL0:64+32
(XEN) Extensions: FloatingPoint AdvancedSIMD GICv3-SysReg
(XEN) Debug Features: 0000000010305106 0000000000000000
(XEN) Auxiliary Features: 0000000000000000 0000000000000000
(XEN) Memory Model Features: 0000000000001122 0000000000000000
(XEN) ISA Features: 0000000000011120 0000000000000000
(XEN) 32-bit Execution:
(XEN) Processor Features: 00000131:10011011
(XEN) Instruction Sets: AArch32 A32 Thumb Thumb-2 Jazelle
(XEN) Extensions: GenericTimer Security
(XEN) Debug Features: 03010066
(XEN) Auxiliary Features: 00000000
(XEN) Memory Model Features: 10201105 40000000 01260000 02102211
(XEN) ISA Features: 02101110 13112111 21232042 01112131 00011142 00011121
(XEN) Generic Timer IRQ: phys=30 hyp=26 virt=27 Freq: 8000 KHz
(XEN) GICv3 initialization:
(XEN) gic_dist_addr=0x00000051a00000
(XEN) gic_maintenance_irq=25
(XEN) gic_rdist_stride=0
(XEN) gic_rdist_regions=1
(XEN) redistributor regions:
(XEN) - region 0: 0x00000051b00000 - 0x00000051bc0000
(XEN) GICv3 compatible with GICv2 cbase 0x00000052000000 vbase 0x00000052020000
(XEN) GICv3: 544 lines, (IID 0001143b).
(XEN) GICv3: CPU0: Found redistributor in region 0 @000000004002d000
(XEN) Using scheduler: SMP Credit Scheduler (credit)
(XEN) Allocated console ring of 16 KiB.
(XEN) Bringing up CPU1
(XEN) GICv3: CPU1: Found redistributor in region 0 @000000004004d000
(XEN) Bringing up CPU2
(XEN) GICv3: CPU2: Found redistributor in region 0 @000000004006d000
(XEN) Bringing up CPU3
(XEN) GICv3: CPU3: Found redistributor in region 0 @000000004008d000
(XEN) Bringing up CPU4
(XEN) GICv3: CPU4: Found redistributor in region 0 @00000000400ad000
(XEN) Bringing up CPU5
(XEN) GICv3: CPU5: Found redistributor in region 0 @00000000400cd000
(XEN) Brought up 6 CPUs
(XEN) P2M: 40-bit IPA with 40-bit PA and 8-bit VMID
(XEN) P2M: 3 levels with order-1 root, VTCR 0x80023558
(XEN) I/O virtualisation enabled
(XEN) - Dom0 mode: Relaxed
(XEN) Interrupt remapping enabled
(XEN) *** LOADING DOMAIN 0 ***
(XEN) Loading kernel from boot module @ 0000000092000000
(XEN) Allocating 1:1 mappings totalling 2048MB for dom0:
(XEN) BANK[0] 0x00000088000000-0x00000090000000 (128MB)
(XEN) BANK[1] 0x00000098000000-0x00000100000000 (1664MB)
(XEN) BANK[2] 0x00000960000000-0x00000970000000 (256MB)
(XEN) Grant table range: 0x0000097fe00000-0x0000097fe40000
(XEN) Ignore reserved memory reg, /reserved-memory/decoder_boot@0x84000000!
(XEN) Ignore reserved memory reg, /reserved-memory/encoder_boot@0x86000000!
(XEN) Ignore reserved memory reg, /reserved-memory/rpmsg@0x90000000!
(XEN) Ignore reserved memory reg, /reserved-memory/rpmsg_dma@0x90400000!
(XEN) Ignore reserved memory reg, /reserved-memory/decoder_rpc@0x92000000!
(XEN) Ignore reserved memory reg, /reserved-memory/encoder_rpc@0x92200000!
(XEN) Ignore reserved memory reg, /reserved-memory/dsp@0x92400000!
(XEN) Ignore reserved memory reg, /reserved-memory/encoder_reserved@0x94400000!
(XEN) Share gpio between Domains: /gpio@5d090000
(XEN) Share gpio between Domains: /gpio@5d0c0000
(XEN) HACK: skip /imx8_gpu_ss setup!
(XEN) NODE /m41_mem@0x94400000 conflicts with kernel address 0x00000088080000-0x0000008969a200
(XEN) Adjust load_offset to 0x00000008000000
(XEN) Allocating PPI 16 for event channel interrupt
(XEN) Loading zImage from 0000000092000000 to 0000000090080000-000000009169a200
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) Unable to copy the kernel in the hwdom memory
(XEN) ****************************************
(XEN)
(XEN) Reboot in five seconds...
thanks,
-minskey