OP-TEE / optee_os

Trusted side of the TEE
Other
1.58k stars 1.07k forks source link

how to add iwave-imx8qm_iwg27s board (imx8qm processor) optee support in yocto project #4078

Closed gitgonewithwind closed 4 years ago

gitgonewithwind commented 4 years ago

hi I am playing iwave-imx8qm_iwg27s board(imx8qm processor) , I tried to add optee support for it. but in optee source code ,it can not directly support iwave-imx8qm_iwg27s board. optee source code support imx8qmmek board which has same processor with iwave-imx8qm_iwg27s board

therefore I directly selected imx8qmmek (in optee is mx8qmmek), I passed the compilation in yocto, and generated SPL uboot code too, and /lib/optee*

error 1: if I use uboot iamge: imx-boot-imx8qm_iwg27s-sd.bin-flash but it could not start up optee , I did not find the /dev/tee* , xtest is failed.

error 2: if I change uboot code to imx-boot-imx8qm_iwg27s_2gb-sd.bin-flash_spl ,uboot completely could not start up, no any output.

questions: 1.I want to know can I select mx8qmmek optee for iwave-imx8qm_iwg27s board? 2.how to enable optee in uboot? do I additionally change uboot code ?

maybe my porting was wrong in yocto at somewhere, can I use directly use mx8qmmek optee source?

Thank you very much.

before I add optee for maaxboard (imx8mq, different processor ), it seems it's easy to add.

jbech-linaro commented 4 years ago

I did not find the /dev/tee*

Not sure, but a wild guess, did you either forget to add the optee firmware node to device tree? Alternatively forgot to add it to U-Boot such that it'll add the node in run-time before passing the DTB to Linux. IIRC that is something that is happening on some IMX builds.

$ dmesg | grep optee if that is totally empty, then the firmware node and/or that the OP-TEE is enabled in Kconfig files.

gitgonewithwind commented 4 years ago

I did not find the /dev/tee*

Not sure, but a wild guess, did you either forget to add the optee firmware node to device tree? Alternatively forgot to add it to U-Boot such that it'll add the node in run-time before passing the DTB to Linux. IIRC that is something that is happening on some IMX builds.

$ dmesg | grep optee if that is totally empty, then the firmware node and/or that the OP-TEE is enabled in Kconfig files.

thank you very much for your reply so soon

dmesg | grep optee


yes! it's totally empty

I checked my .config (defconfig) for kernel of iwave-imx8qm_iwg27s. CONFIG_OPTEE is enable. you mean I need add something in device tree (dts files) of iwave-imx8qm_iwg27s or enable more XXX_OPTEE options in kernel .config file?

gitgonewithwind commented 4 years ago

in my uderstanding, for optee source code itself, all same imx8qm processors can use the same optee source code, am I correct? if that, my issue is in uboot ,dtb or Kconfig wrong configs ? do not need add a lot of code to fix it?

jbech-linaro commented 4 years ago

For Linux kernel .config you need to add: https://github.com/OP-TEE/build/blob/master/kconfigs/fvp.conf

For the firmware node you need to add: https://github.com/linaro-swg/linux/commit/30d114344eb24a160109e24d28e3c0f85f2d2ed2

With that done, you should at least see the "optee" in dmesg. If it is visible, but fails when probing the driver etc, then the next issues is probably a secure side thing that goes wrong.

gitgonewithwind commented 4 years ago

For Linux kernel .config you need to add: https://github.com/OP-TEE/build/blob/master/kconfigs/fvp.conf

For the firmware node you need to add: linaro-swg/linux@30d1143

With that done, you should at least see the "optee" in dmesg. If it is visible, but fails when probing the driver etc, then the next issues is probably a secure side thing that goes wrong.


thank you very much for your reply so soo.

I checked my .config. it has CONFIG_TEE=y CONFIG_OPTEE=y


let me check the device tree firmware node

gitgonewithwind commented 4 years ago

hi @jbech-linaro

I check the freescale dts folder with "grep -r optee ." at kernel-source/arch/arm64//boot/dts/freescale do not find any keyword "optee" in dts , dtsi files and find something for keyword "firmware", but it's not for optee.

and I check my old maaxboard (imx8mq) source code for tdb , I still do not find. I remember when I ported maaxboard optee, I did not touched dts,dtsi (dtb) file. I think ,for im8 processor, maybe the functions do not enable at dtb

maybe the issue is at imx-mkimage/imx-boot_0.2.bb, when finally the yocto is to package the u-boot image.


grep -r optee .

/opt/oe/iw/iw/iwg27s-release-bsp/build_imx8qm_2gb/tmp/work-shared/imx8qm_iwg27s_2gb/kernel-source/arch/arm64/boot/dts/freescale> grep -r firmware . ./fsl-imx8qm-device.dtsi: fsl,dsp-firmware = "imx/dsp/hifi4.bin"; ./fsl-imx8qm-ddr4-arm2.dts: bcmdhd_fw = "/lib/firmware/bcm/1FD_BCM89359/fw_bcmdhd.bin"; ./fsl-imx8qm-ddr4-arm2.dts: bcmdhd_nv = "/lib/firmware/bcm/1FD_BCM89359/bcmdhd.cal"; ./fsl-imx8dx.dtsi: fsl,dsp-firmware = "imx/dsp/hifi4.bin"; ./fsl-imx8qm-mek-domu.dts: firmware { ./fsl-imx8qm-mek-domu.dts: compatible = "android,firmware"; ./fsl-imx8qm-mek-domu-dpu1.dts: firmware { ./fsl-imx8qm-mek-domu-dpu1.dts: compatible = "android,firmware"; ./fsl-imx8qm-mek-dsp.dts: fsl,dsp-firmware = "imx/dsp/hifi4.bin"; ./fsl-imx8qm-lpddr4-arm2-domu.dts: firmware { ./fsl-imx8qm-lpddr4-arm2-domu.dts: compatible = "android,firmware"; ./fsl-imx8qxp-mek-dsp.dts: fsl,dsp-firmware = "imx/dsp/hifi4.bin";

jbech-linaro commented 4 years ago

I check the freescale dts folder with "grep -r optee ." at kernel-source/arch/arm64//boot/dts/freescale do not find any keyword "optee" in dts , dtsi files and find something for keyword "firmware", but it's not for optee.

Hi, that's what I meant when saying that the imx-uboot adds the node in runtime. This is NXP thing, I'm not aware of others doing that. So in theory, with correct version of imx-uboot and the correct flags set, the firmware node should automatically have been added by U-Boot. But! If that doesn't happen, then you can manually yourself simply add it as I described in my previous post.

Worth saying that my personal experience working with NXP devices is brand new, so I haven't that much knowledge about it all. I'm just telling what I've learnt when playing around with a device (imx8mq-evk) the last couple of weeks.

Btw, from the i.MX porting guide one can read:

On Arm V8, Arm has a specified preferred way to boot Secure Component with the Arm
Trusted Firmware (ATF). The ATF first loads the OP-TEE OS. The OP-TEE OS
initializes the secure world. Then, the ATF loads U-Boot that modifies the DTB on the
fly to add a specific node to load Linux TEE drivers. Then, the Linux OS is booted.

I.e., that is where my claim about U-Boot adding the node comes from.

jbech-linaro commented 4 years ago

@MrVan , @sdininno , @OP-TEE/plat-imx I guess you can confirm whether I'm right or not with my comment above.

jforissier commented 4 years ago

If the sysfs is mounted you may have /sys/firmware/devicetree entry in which case it is easy to check for an OP-TEE node. For example with QEMUv8:

$ find /sys/firmware/devicetree -name optee*
/sys/firmware/devicetree/base/firmware/optee
/sys/firmware/devicetree/base/reserved-memory/optee_shm@0x42000000
/sys/firmware/devicetree/base/reserved-memory/optee_core@0xe100000
gitgonewithwind commented 4 years ago

@jforissier Thank you very much for reply. I am burning and going to check. I remember when I added optee to maaxboard (imx8mq, is different with my just porting imx8qm processor). I do not touch kernel and uboot code . I only changed imx-mkimage/imx-boot_0.2.bb in yocto to finally package and generate the uboot image. but for my just porting imx8qm processor, I do not change anything imx-mkimage/imx-boot_0.2.bb, it can generate u-boot image directly,but now not work well. let me compare what are the differences

gitgonewithwind commented 4 years ago

If the sysfs is mounted you may have /sys/firmware/devicetree entry in which case it is easy to check for an OP-TEE node. For example with QEMUv8:

$ find /sys/firmware/devicetree -name optee*
/sys/firmware/devicetree/base/firmware/optee
/sys/firmware/devicetree/base/reserved-memory/optee_shm@0x42000000
/sys/firmware/devicetree/base/reserved-memory/optee_core@0xe100000

find nothing.

I think maybe I changed something, my uboot config code somewhere in yocto to generate uboot image is wrong configure.

I only added optee feather in meta-fsl-bsp-release/imx/meta-bsp/conf/layer.conf before, error happened: /opt/oe/iw/iw/iwg27s-release-bsp/build_imx8qm_2gb/tmp/work/imx8qm_iwg27s_2gb-poky-linux/u-boot-iwg27s/2018.03-r0/build/imx8qm_iwg27s_2gb_defconfig/spl/u-boot-spl.bin': No such file or directory

so I added something in sources/meta-fsl-bsp-release/imx/meta-bsp/conf/machine/imx8qm_iwg27s.conf that copying from imx8qmmek.conf , It generated u-boot image, but can not run!

gitgonewithwind commented 4 years ago

@jforissier Do I need to modified u-boot source code itself? the original yocto source code(adding patches from freescale source code) from iwave company does not support optee, so maybe its u-boot source code does not support optee. (but for maaxboard ,it does not support optee either, but I did modified any source code for u-boot source code. I directly used it. and I only changed imx-mkimage/imx-boot_0.2.bb source in yocto that I mentioned before)

gitgonewithwind commented 4 years ago

hi all Maybe I find the reason: in source code of u-boot config from iwave board's company , there are no CONFIG_SPL these kind of config but it have there kind of config in maaxboard source code. I need to add them, and then to generate u-boot-spl.bin

gitgonewithwind commented 4 years ago

hi all Maybe I find the reason: in source code of u-boot config from iwave board's company , there are no CONFIG_SPL these kind of config but it have there kind of config in maaxboard source code. I need to add them, and then to generate u-boot-spl.bin

but after I add CONFIG_SPL, there is no u-boot-spl.bin generate! do I need modify source code ?

gitgonewithwind commented 4 years ago

@jforissier

It seem I fix u-boot coe. because u-boot patch from iwave disable CONFIG_SPL, but after boot, kernel panic I directly chosen mx8qmmek for optee, becuase in optee source code ,there no imx8qm_iwg27s board. can I use mx8qmmek ? or need to porting some code add imx8qm_iwg27s board iin optee? any suggestion? thanks

U-Boot 2018.03-imx_v2018.03_4.14.98_2.0.0_ga+g87a19df5e4 (Sep 23 2020 - 14:06:00 +0000)

CPU: Freescale i.MX8QM revB A53 at 1200 MHz at 58C Model: iW-RainboW-G27S-i.MX8QM/QP-SBC Board: iW-RainboW-G27S-i.MX8QM/QP Pico ITX SBC Boot: MMC0 DRAM: 2 GiB MMC: FSL_SDHC: 0, FSL_SDHC: 1 Loading Environment from MMC... *** Warning - bad CRC, using default environment

Failed (-5) In: serial Out: serial Err: serial

BuildInfo:

Board Info: BSP Version : iW-PRGEE-SC-01-R1.0-REL1.0a-Linux4.14.98 SOM Version : iW-PRGEE-AP-01-R1.3

switch to partitions #0, OK mmc0(part 0) is current device Saving Environment to MMC... Writing to MMC(0)... OK flash target is MMC:0 Net: eth0: ethernet@5b040000 [PRIME], eth1: ethernet@5b050000 Fastboot: Normal Normal Boot Hit any key to stop autoboot: 0 switch to partitions #0, OK mmc0(part 0) is current device 22481408 bytes read in 80 ms (268 MiB/s) Booting from mmc ... 102464 bytes read in 9 ms (10.9 MiB/s) Loading hdp firmware from 0x0000000084000000 offset 0x0000000000002000 Loading hdp firmware Complete 102464 bytes read in 10 ms (9.8 MiB/s) Loading hdprx firmware from 0x0000000084800000 offset 0x0000000000002000 Loading hdp rx firmware Complete 97919 bytes read in 9 ms (10.4 MiB/s)

Flattened Device Tree blob at 83000000

Booting using the fdt blob at 0x83000000 Using Device Tree in place at 0000000083000000, end 000000008301ae7e /dma-controller@5a1f0000, 67668 /dma-controller@591F0000, 68460 /dma-controller@591F0000, 68460 /dma-controller@599F0000, 69436

Starting kernel ...

[ 0.000000] Booting Linux on physical CPU 0x0 [ 0.000000] Linux version 4.14.98-imx_4.14.98_2.0.0_ga+g5d6cbeafb80c (oe-user@oe-host) (gcc version 7.3.0 (GCC)) #1 SMP PREEMPT Tue Sep 22 17:46:32 UTC 2020 [ 0.000000] Boot CPU: AArch64 Processor [410fd034] [ 0.000000] Machine model: iW-RainboW-G27D-i.MX8QM-SBC [ 0.000000] earlycon: lpuart32 at MMIO 0x000000005a0a0000 (options '115200') [ 0.000000] bootconsole [lpuart32] enabled [ 0.000000] efi: Getting EFI parameters from FDT: [ 0.000000] efi: UEFI not found. [ 0.000000] Reserved memory: created CMA memory pool at 0x00000000aa000000, size 640 MiB [ 0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool [ 0.000000] Reserved memory: created DMA memory pool at 0x0000000090400000, size 28 MiB [ 0.000000] OF: reserved mem: initialized node rpmsg_dma@0x90400000, compatible id shared-dma-pool [ 0.000000] NUMA: No NUMA configuration found [ 0.000000] NUMA: Faking a node at [mem 0x0000000000000000-0x00000000ffffffff] [ 0.000000] NUMA: NODE_DATA [mem 0xfff65680-0xfff6747f] [ 0.000000] Zone ranges: [ 0.000000] DMA [mem 0x0000000080200000-0x00000000ffffffff] [ 0.000000] Normal empty [ 0.000000] Movable zone start for each node [ 0.000000] Early memory node ranges [ 0.000000] node 0: [mem 0x0000000080200000-0x0000000083ffffff] [ 0.000000] node 0: [mem 0x0000000086400000-0x000000008fffffff] [ 0.000000] node 0: [mem 0x0000000094c00000-0x00000000fdffffff] [ 0.000000] node 0: [mem 0x00000000ffc00000-0x00000000ffffffff] [ 0.000000] Initmem setup node 0 [mem 0x0000000080200000-0x00000000ffffffff] [ 0.000000] psci: probing for conduit method from DT. [ 0.000000] psci: PSCIv1.1 detected in firmware. [ 0.000000] psci: Using standard PSCI v0.2 function IDs [ 0.000000] psci: Trusted OS migration not required [ 0.000000] psci: SMC Calling Convention v1.1 [ 0.000000] percpu: Embedded 24 pages/cpu @ffff80007fed0000 s57624 r8192 d32488 u98304 [ 0.000000] Detected VIPT I-cache on CPU0 [ 0.000000] CPU features: enabling workaround for ARM erratum 845719 [ 0.000000] Speculative Store Bypass Disable mitigation not required [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 480312 [ 0.000000] Policy zone: DMA [ 0.000000] Kernel command line: console=ttyLP4,115200 earlycon=lpuart32,0x5a0a0000,115200 root=/dev/mmcblk0p2 rootwait rw [ 0.000000] PID hash table entries: 4096 (order: 3, 32768 bytes) [ 0.000000] Memory: 1239856K/1951744K available (13052K kernel code, 1666K rwdata, 5928K rodata, 1280K init, 431K bss, 56528K reserved, 655360K cma-reserved) [ 0.000000] Virtual kernel memory layout: [ 0.000000] modules : 0xffff000000000000 - 0xffff000008000000 ( 128 MB) [ 0.000000] vmalloc : 0xffff000008000000 - 0xffff7dffbfff0000 (129022 GB) [ 0.000000] .text : 0xffff000008080000 - 0xffff000008d40000 ( 13056 KB) [ 0.000000] .rodata : 0xffff000008d40000 - 0xffff000009310000 ( 5952 KB) [ 0.000000] .init : 0xffff000009310000 - 0xffff000009450000 ( 1280 KB) [ 0.000000] .data : 0xffff000009450000 - 0xffff0000095f0a00 ( 1667 KB) [ 0.000000] .bss : 0xffff0000095f0a00 - 0xffff00000965c7f0 ( 432 KB) [ 0.000000] fixed : 0xffff7dfffe7f9000 - 0xffff7dfffec00000 ( 4124 KB) [ 0.000000] PCI I/O : 0xffff7dfffee00000 - 0xffff7dffffe00000 ( 16 MB) [ 0.000000] vmemmap : 0xffff7e0000000000 - 0xffff800000000000 ( 2048 GB maximum) [ 0.000000] 0xffff7e0000008000 - 0xffff7e0002000000 ( 31 MB actual) [ 0.000000] memory : 0xffff800000200000 - 0xffff800080000000 ( 2046 MB) [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=6, Nodes=1 [ 0.000000] Preemptible hierarchical RCU implementation. [ 0.000000] RCU restricting CPUs from NR_CPUS=64 to nr_cpu_ids=6. [ 0.000000] Tasks RCU enabled. [ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=6 [ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0 [ 0.000000] GICv3: GIC: Using split EOI/Deactivate mode [ 0.000000] GICv3: no VLPI support, no direct LPI support [ 0.000000] ITS: No ITS available, not enabling LPIs [ 0.000000] GICv3: CPU0: found redistributor 0 region 0:0x0000000051b00000 [ 0.000000] arch_timer: cp15 timer(s) running at 8.00MHz (phys). [ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x1d854df40, max_idle_ns: 440795202120 ns [ 0.000004] sched_clock: 56 bits at 8MHz, resolution 125ns, wraps every 2199023255500ns [ 0.010846] Console: colour dummy device 80x25 [ 0.014994] Calibrating delay loop (skipped), value calculated using timer frequency.. 16.00 BogoMIPS (lpj=32000) [ 0.025197] pid_max: default: 32768 minimum: 301 [ 0.029862] Security Framework initialized [ 0.034515] Dentry cache hash table entries: 262144 (order: 9, 2097152 bytes) [ 0.041625] Inode-cache hash table entries: 131072 (order: 8, 1048576 bytes) [ 0.048372] Mount-cache hash table entries: 4096 (order: 3, 32768 bytes) [ 0.055047] Mountpoint-cache hash table entries: 4096 (order: 3, 32768 bytes) [ 0.078219] ASID allocator initialised with 32768 entries [ 0.091295] Hierarchical SRCU implementation. [ 0.103908] Initialized MU [ 0.106722] imx8_init_pm_domains [ 0.112117] CPU identified as i.MX8QM, silicon rev 1.1 [ 0.118369] EFI services will not be available. [ 0.130577] smp: Bringing up secondary CPUs ... [ 0.163570] Detected VIPT I-cache on CPU1 [ 0.163600] GICv3: CPU1: found redistributor 1 region 0:0x0000000051b20000 [ 0.163627] CPU1: Booted secondary processor [410fd034] [ 0.191580] Detected VIPT I-cache on CPU2 [ 0.191594] GICv3: CPU2: found redistributor 2 region 0:0x0000000051b40000 [ 0.191608] CPU2: Booted secondary processor [410fd034] [ 0.219623] Detected VIPT I-cache on CPU3 [ 0.219637] GICv3: CPU3: found redistributor 3 region 0:0x0000000051b60000 [ 0.219650] CPU3: Booted secondary processor [410fd034] [ 0.248779] Detected PIPT I-cache on CPU4 [ 0.248797] GICv3: CPU4: found redistributor 100 region 0:0x0000000051b80000 [ 0.248813] CPU4: Booted secondary processor [410fd082] [ 0.275704] Detected PIPT I-cache on CPU5 [ 0.275715] GICv3: CPU5: found redistributor 101 region 0:0x0000000051ba0000 [ 0.275725] CPU5: Booted secondary processor [410fd082] [ 0.275780] smp: Brought up 1 node, 6 CPUs [ 0.360245] SMP: Total of 6 processors activated. [ 0.364934] CPU features: detected feature: GIC system register CPU interface [ 0.372066] CPU features: detected feature: 32-bit EL0 Support [ 0.377876] CPU features: detected feature: Kernel page table isolation (KPTI) [ 0.392980] CPU: All CPU(s) started at EL2 [ 0.396753] alternatives: patching kernel code [ 0.401822] devtmpfs: initialized [ 0.416894] random: get_random_u32 called from bucket_table_alloc+0x108/0x260 with crng_init=0 [ 0.425678] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns [ 0.435145] futex hash table entries: 2048 (order: 6, 262144 bytes) [ 0.455837] pinctrl core: initialized pinctrl subsystem [ 0.462690] DMI not present or invalid. [ 0.466503] NET: Registered protocol family 16 [ 0.474657] cpuidle: using governor menu [ 0.479339] vdso: 2 pages (1 code @ ffff000008d46000, 1 data @ ffff000009454000) [ 0.486455] hw-breakpoint: found 6 breakpoint and 4 watchpoint registers. [ 0.498210] DMA: preallocated 256 KiB pool for atomic allocations [ 0.504514] Serial: AMBA PL011 UART driver [ 0.508396] imx rpmsg driver is registered. [ 0.514764] MU and Power domains initialized [ 0.518708] imx8qm_clocks_init ***** [ 0.584421] imx8qm-pinctrl iomuxc: initialized IMX pinctrl driver [ 0.592129] ARM CCI_400_r1 PMU driver probed [ 0.627442] mxs_phy 5b100000.usbphy: 5b100000.usbphy supply phy-3p0 not found, using dummy regulator [ 0.658509] HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages [ 0.700028] ACPI: Interpreter disabled. [ 0.709710] vgaarb: loaded [ 0.712341] SCSI subsystem initialized [ 0.716210] usbcore: registered new interface driver usbfs [ 0.721389] usbcore: registered new interface driver hub [ 0.726710] usbcore: registered new device driver usb [ 0.732246] usb_phy_generic usbphynop1: usbphynop1 supply vcc not found, using dummy regulator [ 0.740842] usb_phy_generic usbphynop2: usbphynop2 supply vcc not found, using dummy regulator [ 0.750707] i2c i2c-2: LPI2C adapter registered [ 0.755882] media: Linux media interface: v0.10 [ 0.760101] Linux video capture interface: v2.00 [ 0.764853] pps_core: LinuxPPS API ver. 1 registered [ 0.769629] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti giometti@linux.it [ 0.778766] PTP clock support registered [ 0.782838] EDAC MC: Ver: 3.0.0 [ 0.786012] dmi: Firmware registration failed. [ 0.791407] Advanced Linux Sound Architecture Driver Initialized. [ 0.798372] clocksource: Switched to clocksource arch_sys_counter [ 0.804262] VFS: Disk quotas dquot_6.6.0 [ 0.808081] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes) [ 0.815017] pnp: PnP ACPI: disabled [ 0.823916] NET: Registered protocol family 2 [ 0.828515] TCP established hash table entries: 16384 (order: 5, 131072 bytes) [ 0.835542] TCP bind hash table entries: 16384 (order: 6, 262144 bytes) [ 0.842217] TCP: Hash tables configured (established 16384 bind 16384) [ 0.848605] UDP hash table entries: 1024 (order: 3, 32768 bytes) [ 0.854648] UDP-Lite hash table entries: 1024 (order: 3, 32768 bytes) [ 0.861075] NET: Registered protocol family 1 [ 0.865701] RPC: Registered named UNIX socket transport module. [ 0.871284] RPC: Registered udp transport module. [ 0.875981] RPC: Registered tcp transport module. [ 0.880665] RPC: Registered tcp NFSv4.1 backchannel transport module. [ 0.888357] hw perfevents: enabled with armv8_pmuv3 PMU driver, 7 counters available [ 0.896237] kvm [1]: 8-bit VMID

[ 0.903650] kvm [1]: GIC system register CPU interface enabled [ 0.909533] kvm [1]: vgic interrupt IRQ1 [ 0.913457] kvm [1]: Hyp mode initialized successfully [ 0.921040] audit: initializing netlink subsys (disabled) [ 0.926188] audit: type=2000 audit(0.812:1): state=initialized audit_enabled=0 res=1 [ 0.926595] workingset: timestamp_bits=44 max_order=19 bucket_order=0 [ 0.945398] squashfs: version 4.0 (2009/01/31) Phillip Lougher [ 0.951389] NFS: Registering the id_resolver key type [ 0.956124] Key type id_resolver registered [ 0.960266] Key type id_legacy registered [ 0.964271] nfs4filelayout_init: NFSv4 File Layout Driver Registering... [ 0.970970] jffs2: version 2.2. (NAND) ?© 2001-2006 Red Hat, Inc. [ 0.977640] 9p: Installing v9fs 9p2000 file system support [ 0.987114] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 244) [ 0.994190] io scheduler noop registered [ 0.998180] io scheduler cfq registered (default) [ 1.002776] io scheduler mq-deadline registered [ 1.007295] io scheduler kyber registered [ 1.028024] Bus freq driver module loaded [ 1.033170] [ 1.034312] Board Info: [ 1.036753] BSP Version : iW-PRGEE-SC-01-R1.0-REL1.0a-Linux4.14.98 [ 1.043358] SOM Version : iW-PRGEE-AP-01-R1.3 [ 1.048134] [ 1.055237] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled [ 1.063661] SuperH (H)SCI(F) driver initialized [ 1.068712] msm_serial: driver initialized [ 1.073695] Unable to handle kernel NULL pointer dereference at virtual address 00000170 [ 1.073713] 5a060000.serial: ttyLP0 at MMIO 0x5a060010 (irq = 50, base_baud = 5000000) is a FSL_LPUART [ 1.081441] Mem abort info: [ 1.081444] Exception class = DABT (current EL), IL = 32 bits [ 1.081446] SET = 0, FnV = 0 [ 1.081448] EA = 0, S1PTW = 0 [ 1.081449] Data abort info: [ 1.081451] ISV = 0, ISS = 0x00000004 [ 1.081453] CM = 0, WnR = 0 [ 1.081455] [0000000000000170] user address but active_mm is swapper [ 1.081460] Internal error: Oops: 96000004 [#1] PREEMPT SMP [ 1.081462] Modules linked in[ 1.081471] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.14.98-imx_4.14.98_2.0.0_ga+g5d6cbeafb80c #1 [ 1.081473] Hardware name: iW-RainboW-G27D-i.MX8QM-SBC (DT) [ 1.081476] task: ffff000009462580 task.stack: ffff000009450000 [ 1.081490] PC is at lpuart_txint.isra.5+0x6c/0x388 [ 1.081494] LR is at lpuart_txint.isra.5+0x1c/0x388 [ 1.081497] pc : [] lr : [] pstate: 600001c5 [ 1.081498] sp : ffff000008003de0 [ 1.081500] x29: ffff000008003de0 x28: ffff000009462580 [ 1.081505] x27: 0000000000000000 x26: ffff00000915b028 [ 1.081509] x25: ffff0000095d4733 x24: ffff80007aad4400 [ 1.081513] x23: 0000000000000032 x22: 00000000000001c0 [ 1.081517] x21: 0000000000000200 x20: 0000000000c00000 [ 1.081522] x19: ffff80007ac84818 x18: 0000000000000007 [ 1.081526] x17: 0000000000000001 x16: 0000000000000019 [ 1.081530] x15: 0000000000000033 x14: ffff80007ab1d180 [ 1.081534] x13: 0000000000000000 x12: 0000000000000001 [ 1.081538] x11: 0000000000000000 x10: 0000000000000040 [ 1.091098] fsl-lpuart 5a060000.serial: NO DMA tx channel, run at cpu mode [ 1.099436] fsl-lpuart 5a060000.serial: NO DMA rx channel, run at cpu mode [ 1.102464] x9 : ffff000009472fe8 x8 : ffff800078000248 [ 1.102468] x7 : ffff800078000270 x6 : 0000000000000000 [ 1.106222] 5a070000.serial: ttyLP1 at MMIO 0x5a070010 (irq = 51, base_baud = 5000000) is a FSL_LPUART [ 1.108459] x5 : ffff800078000248 x4 : 0000000000000000 [ 1.108463] x3 : 00000000000001c0 x2 : 0000000000000000 [ 1.108468] x1 : 0000000000000003 [ 1.113156] 5a090000.serial: ttyLP3 at MMIO 0x5a090010 (irq = 52, base_baud = 5000000) is a FSL_LPUART [ 1.115234] x0 : 0000000000000000 [ 1.115238] Process swapper/0 (pid: 0, stack limit = 0xffff000009450000) [ 1.115241] Call trace: [ 1.115245] Exception stack(0xffff000008003ca0 to 0xffff000008003de0) [ 1.115249] 3ca0: 0000000000000000 0000000000000003 0000000000000000 00000000000001c0 [ 1.122384] 5a0a0000.serial: ttyLP4 at MMIO 0x5a0a0010 (irq = 53, base_baud = 5000000) is a FSL_LPUART [ 1.127138] 3cc0: 0000000000000000 ffff800078000248 0000000000000000 ffff800078000270 [ 1.127142] 3ce0: ffff800078000248 ffff000009472fe8 0000000000000040 0000000000000000 [ 1.127146] 3d00: 0000000000000001 0000000000000000 ffff80007ab1d180 0000000000000033 [ 1.340503] 3d20: 0000000000000019 0000000000000001 0000000000000007 ffff80007ac84818 [ 1.348322] 3d40: 0000000000c00000 0000000000000200 00000000000001c0 0000000000000032 [ 1.356141] 3d60: ffff80007aad4400 ffff0000095d4733 ffff00000915b028 0000000000000000 [ 1.363962] 3d80: ffff000009462580 ffff000008003de0 ffff0000086390a4 ffff000008003de0 [ 1.371779] 3da0: ffff0000086390f4 00000000600001c5 00000000fffedbfa ffff000008003db0 [ 1.379599] 3dc0: 0000ffffffffffff ffff000008104a84 ffff000008003de0 ffff0000086390f4 [ 1.387421] [] lpuart_txint.isra.5+0x6c/0x388 [ 1.393324] [] lpuart32_int+0x2a8/0x680 [ 1.398717] [] handle_irq_event_percpu+0x5c/0x148 [ 1.405139] [] handle_irq_event_percpu+0x1c/0x58 [ 1.411308] [] handle_irq_event+0x48/0x78 [ 1.416872] [] handle_fasteoi_irq+0xa8/0x180 [ 1.422690] [] generic_handle_irq+0x24/0x38 [ 1.428423] [] handle_domain_irq+0x5c/0xb8 [ 1.434245] [] gic_handle_irq+0x78/0x174 [ 1.439715] Exception stack(0xffff000009453dd0 to 0xffff000009453f10) [ 1.446144] 3dc0: 0000000000000000 0000000000000000 [ 1.453962] 3de0: 0000000000000001 0000000000000000 ffff000009442388 ffff000009453f00 [ 1.461783] 3e00: 0000800076a94000 00000000ffffffff ffff000009462f60 ffff000009453e90 [ 1.469599] 3e20: 0000000000000980 0000000000000000 0000000000000001 0000000000000000 [ 1.477420] 3e40: ffff80007ab1d180 0000000000000033 0000000000000019 0000000000000001 [ 1.485237] 3e60: 0000000000000007 ffff00000943c018 ffff000009458000 ffff000009458000 [ 1.493056] 3e80: ffff000009447cc0 ffff000009458e9c 0000000000000000 0000000000000000 [ 1.500875] 3ea0: ffff000009462580 0000000000000400 0000000081510018 ffff000009453f10 [ 1.508695] 3ec0: ffff00000808581c ffff000009453f10 ffff000008085820 0000000000000045 [ 1.516514] 3ee0: 0000000000000000 00000000fde72b80 ffffffffffffffff ffff000008141ad4 [ 1.524330] 3f00: ffff000009453f10 ffff000008085820 [ 1.529197] [] el1_irq+0xb0/0x124 [ 1.534064] [] arch_cpu_idle+0x10/0x18 [ 1.539365] [] do_idle+0x120/0x1e0 [ 1.544312] [] cpu_startup_entry+0x20/0x28 [ 1.549965] [] rest_init+0xd0/0xe0 [ 1.554919] [] start_kernel+0x398/0x3ac [ 1.560300] Code: 14000022 910802b5 39428a61 71000c3f (296e0aa3) [ 1.566391] ---[ end trace db317933232d2f66 ]--- [ 1.570984] Kernel panic - not syncing: Fatal exception in interrupt [ 1.577326] SMP: stopping secondary CPUs [ 1.581417] Kernel Offset: disabled [ 1.584803] CPU features: 0x180200c [ 1.588277] Memory Limit: none [ 1.591319] ---[ end Kernel panic - not syncing: Fatal exception in interrupt

github-actions[bot] commented 4 years ago

This issue has been marked as a stale issue because it has been open (more than) 30 days with no activity. Remove the stale label or add a comment, otherwise this issue will automatically be closed in 5 days. Note, that you can always re-open a closed issue at any time.

Gimli05 commented 3 years ago

Sorry for resurrecting this thread, but I'm having the exact same issue. @gitgonewithwind have you managed to solve this issue by any chance?

gitgonewithwind commented 3 years ago

Sorry for resurrecting this thread, but I'm having the exact same issue. @gitgonewithwind have you managed to solve this issue by any chance?

yes, I have found the solution. firstly. you ask the company to get the update source code that always supports the iwave 4GB & 8GB memory size boards optee . but it does not support iwave 2GB board(what board you use ?),unfortunatley, I am using 2GB board. ( I do not touch my code for a few months, maybe it can support now, you ask them,and tell me , thank you very much) secondly, I added some patch(only for 2GB board) to support it,I show as following( my patch is separated, you read carefaully, *ori files are orignal files) the most important files need to be modified are in u-boot code ,(the others are easy to find, please read the following for references)

diff ./meta-iwave/recipes-bsp/u-boot/u-boot-iwg27s_2020.04.bb ./meta-iwave/recipes-bsp/u-boot/u-boot-iwg27s_2020.04.bb_ori 19,21c19,21 < SRC_URI = "${UBOOT_SRC};branch=${SRCBRANCH} file://PATCH001-iW-PRGEE-SC-01-R2.0-REL0.1-Linux5.4.24_Uboot_2GB_LPDDR4_Optee.patch" < <

SRC_URI = "${UBOOT_SRC};branch=${SRCBRANCH} \ ${@bb.utils.contains('MACHINE_FEATURES', 'optee', 'file://PATCH001-iW-PRGEE-SC-01-R2.0-REL0.1-Linux5.4.24_Uboot_4GB_LPDDR4_Optee.patch', "", d)}"

1.1 ./meta-iwave/recipes-bsp/u-boot/u-boot-iwg27s/PATCH001-iW-PRGEE-SC-01-R2.0-REL0.1-Linux5.4.24_Uboot_2GB_LPDDR4_Optee.patch

content in file:

diff -Naur u-ori/arch/arm/dts/fsl-imx8qm-iwg27s.dts u-patches/arch/arm/dts/fsl-imx8qm-iwg27s.dts --- u-ori/arch/arm/dts/fsl-imx8qm-iwg27s.dts 2021-01-13 13:17:02.122306740 -0500 +++ u-patches/arch/arm/dts/fsl-imx8qm-iwg27s.dts 2021-01-18 14:01:27.043620339 -0500 @@ -64,6 +64,19 @@ }; }; }; +/ CMA: If Optee is enabled, change the CMA memory alloc-range for 4GB LPDDR4 supported board / +#ifdef CONFIG_SDRAM_SIZE_2GB +&{/reserved-memory} {

diff -Naur u-ori/board/freescale/imx8qm_iwg27s/imx8qm_iwg27s.c u-patches/board/freescale/imx8qm_iwg27s/imx8qm_iwg27s.c --- u-ori/board/freescale/imx8qm_iwg27s/imx8qm_iwg27s.c 2021-01-13 13:16:41.290415027 -0500 +++ u-patches/board/freescale/imx8qm_iwg27s/imx8qm_iwg27s.c 2021-01-18 14:00:15.979997132 -0500 @@ -454,12 +454,26 @@ /IWG27S: CMA: Assigning 640MB CMA value for 2GB memory size /

ifdef CONFIG_SDRAM_SIZE_2GB

    reg[0] = cpu_to_fdt32(0x0);

2.

diff ./meta-iwave/recipes-bsp/imx-mkimage/imx-mkimage_git.inc ./meta-iwave/recipes-bsp/imx-mkimage/imx-mkimage_git.inc_ori 8c8 < file://imx_mkimage_4gb_lpddr4_optee_support_iwg27s.patch"

${@bb.utils.contains('MACHINE_FEATURES', 'optee', bb.utils.contains('MACHINE', 'imx8qm-iwg27s', 'file://imx_mkimage_4gb_lpddr4_optee_support_iwg27s.patch', '', d), '', d)}"

3. diff ./meta-iwave/recipes-bsp/imx-atf/imx-atf_2.2.bb ./meta-iwave/recipes-bsp/imx-atf/imx-atf_2.2.bb_ori 13c13 < ${@bb.utils.contains('MACHINE_FEATURES', 'optee', bb.utils.contains('MACHINE', 'imx8qm-iwg27s-2gb', 'file://imx_atf_support_iwg27s.patch file://imx_atf_4gb_lpddr4_optee_support_iwg27s.patch', 'file://imx_atf_support_iwg27s.patch', d), '', d)}"

${@bb.utils.contains('MACHINE_FEATURES', 'optee', bb.utils.contains('MACHINE', 'imx8qm-iwg27s', 'file://imx_atf_support_iwg27s.patch file://imx_atf_4gb_lpddr4_optee_support_iwg27s.patch', 'file://imx_atf_support_iwg27s.patch', d), '', d)}"

3 diff ./meta-iwave/conf/machine/imx8qm-iwg27s-2gb.conf ./meta-iwave/conf/machine/imx8qm-iwg27s-2gb.conf_ori 13c13 < MACHINE_FEATURES_append += " optee"

MACHINE_FEATURES_append += "optee"

4. diff ./meta-iwave/recipes-security/optee-imx/files/Optee_support_iwg27s.patch ./meta-iwave/recipes-security/optee-imx/files/Optee_support_iwg27s.patch_ori 1,3c1,3 < diff -Naur ori/core/arch/arm/plat-imx/conf.mk patches/core/arch/arm/plat-imx/conf.mk < --- ori/core/arch/arm/plat-imx/conf.mk 2020-12-30 09:50:32.999945361 -0500 < +++ patches/core/arch/arm/plat-imx/conf.mk 2020-12-30 09:57:11.650121952 -0500

diff -Naur A/core/arch/arm/plat-imx/conf.mk B/core/arch/arm/plat-imx/conf.mk --- A/core/arch/arm/plat-imx/conf.mk 2020-11-10 16:01:39.803666299 +0530 +++ B/core/arch/arm/plat-imx/conf.mk 2020-11-10 16:05:16.902051810 +0530 14c14 < @@ -344,9 +347,19 @@

@@ -344,11 +347,17 @@ 28,32d27 < +endif < + < +ifneq (,$(filter $(PLATFORM_FLAVOR),mx8qm_iwg27s_2gb)) < +CFG_DDR_SIZE ?= 0x40000000 < +CFG_UART_BASE ?= UART4_BASE 34a30 + 35a32,33 CFG_DDR_SIZE ?= 0x40000000 CFG_UART_BASE ?= UART0_BASE

4.1 content in file ./meta-iwave/recipes-security/optee-imx/files/Optee_support_iwg27s.patch

diff -Naur ori/core/arch/arm/plat-imx/conf.mk patches/core/arch/arm/plat-imx/conf.mk --- ori/core/arch/arm/plat-imx/conf.mk 2020-12-30 09:50:32.999945361 -0500 +++ patches/core/arch/arm/plat-imx/conf.mk 2020-12-30 09:57:11.650121952 -0500 @@ -72,6 +72,9 @@

mx8qm-flavorlist = \ mx8qmmek \

-ifneq (,$(filter $(PLATFORM_FLAVOR),mx8qxpmek mx8qmmek)) +ifneq (,$(filter $(PLATFORM_FLAVOR),mx8qxpmek mx8qmmek mx8qm_iwg27s_8gb)) CFG_DDR_SIZE ?= 0x80000000 -CFG_UART_BASE ?= UART0_BASE +CFG_UART_BASE ?= UART4_BASE +endif + +ifneq (,$(filter $(PLATFORM_FLAVOR),mx8qm_iwg27s)) +CFG_DDR_SIZE ?= 0x40000000 +CFG_UART_BASE ?= UART4_BASE +endif + +ifneq (,$(filter $(PLATFORM_FLAVOR),mx8qm_iwg27s_2gb)) +CFG_DDR_SIZE ?= 0x40000000 +CFG_UART_BASE ?= UART4_BASE endif

ifneq (,$(filter $(PLATFORM_FLAVOR),mx8dxmek)) diff -Naur A/core/arch/arm/plat-imx/registers/imx8q.h B/core/arch/arm/plat-imx/registers/imx8q.h --- A/core/arch/arm/plat-imx/registers/imx8q.h 2020-11-10 16:01:39.807666358 +0530 +++ B/core/arch/arm/plat-imx/registers/imx8q.h 2020-11-10 16:05:54.742326741 +0530 @@ -12,6 +12,7 @@

define UART1_BASE 0x5a070000

define UART2_BASE 0x5a080000

define UART3_BASE 0x5a090000

+#define UART4_BASE 0x5a0a0000

define SC_IPC_BASE_SECURE 0x5d1b0000

define CAAM_BASE 0x31400000

define SECMEM_BASE 0x31800000

gitgonewithwind commented 3 years ago

@Gimli05 please read the upper as references