This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] J721S2XSOMXEVM:J721S2 上的 Jailhouse Linux 配合使用

Guru**** 2867040 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1635421/j721s2xsomxevm-jailhouse-linux-inmate-on-j721s2

器件型号: J721S2XSOMXEVM

大家好、我在基于 J721S2 的定制电路板上运行 Jailhouse Linux 囚犯时遇到问题。

我知道 TI 不支持在 J721S2 上运行 Jailhouse、但我使用现有的 J721E 单元配置作为 J721S2 配置的基础、我将在下面提供该配置。

我在第二个 A72 内核上运行了一个裸机连接器、它只能打印到 UART、看起来运行良好。

我有一个 Linux 实例几乎在第二个核心上运行、但问题是、一旦内核从用户空间运行/init、系统就会减慢速度、即登录提示永远不会出现、所有与 systemd 相关的驱动程序消息都会在 30 秒内打印、慢慢增加到 60 秒、然后再增加 90 秒、然后停止。

这里是 dmesg 的一个片段

[    0.072299] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    0.075902] printk: console [ttyS3] disabled
[    0.076093] 2850000.serial: ttyS3 at MMIO 0x2850000 (irq = 13, base_baud = 3000000) is a 8250
[    0.076278] printk: console [ttyS3] enabled
[    0.512285] loop: module loaded
[    0.956672] i2c_dev: i2c /dev entries driver
[    0.961281] device-mapper: ioctl: 4.48.0-ioctl (2023-03-01) initialised: dm-devel@redhat.com
[    0.970175] sdhci: Secure Digital Host Controller Interface driver
[    0.977660] sdhci: Copyright(c) Pierre Ossman
[    0.977735] sdhci-pltfm: SDHCI platform and OF driver helper
[    0.987847] ledtrig-cpu: registered to indicate activity on CPUs
[    0.995775] hw perfevents: enabled with armv8_pmuv3 PMU driver, 7 counters available
[    1.004375] NET: Registered PF_PACKET protocol family
[    1.016820] registered taskstats version 1
[    1.016851] Loading compiled-in X.509 certificates
[    1.036733] ti-sci 44083000.dmsc: ABI: 4.0 (firmware rev 0x000b '11.0.9--v11.00.09+ (Fancy Rat)')
[    1.047730] ti-sci-intr interconnect@100000:interconnect0:interrupt-controller1: Interrupt Router 227 domain created
[    1.059745] ti-sci-inta 33d00000.interrupt-controller: Interrupt Aggregator domain 265 created
[    1.068676] clk: Not disabling unused clocks
[    1.068695] ALSA device list:
[    1.068703]   No soundcards found.
[    1.828794] Freeing initrd memory: 29692K
[    1.834028] Freeing unused kernel memory: 1728K
[    1.838762] Run /init as init process
[    1.842440]   with arguments:
[    1.842442]     /init
[    1.842444]   with environment:
[    1.842446]     HOME=/
[    1.842447]     TERM=linux
[    1.842449]     tsc=reliable
[    1.874635] systemd[1]: System time before build time, advancing clock.
[    1.887376] NET: Registered PF_INET6 protocol family
[    1.893137] Segment Routing with IPv6
[    1.896852] In-situ OAM (IOAM) with IPv6
[    1.905308] systemd[1]: systemd 255.17^ running in system mode (+PAM -AUDIT -SELINUX -APPARMOR +IMA -SMACK +SECCOMP -GCRYPT -GNUTLS -OPENSSL +ACL +BLKID -CURL -ELFUTILS -FIDO2 -IDN2 -IDN -IPTC +KMOD -LIBCRYPTSETUP +LIBFDISK -PCRE2 -PWQUALITY -P11KIT -QRENCODE -TPM2 -BZIP2 -LZ4 -XZ -ZLIB +ZSTD -BPF_FRAMEWORK -XKBCOMMON +UTMP +SYSVINIT default-hierarchy=unified)
[    1.937285] systemd[1]: Detected virtualization vm-other.
[    1.937302] systemd[1]: Detected architecture arm64.
[   32.225073] systemd[1]: Hostname set to <am68-fas-xm1>.
[   32.230597] systemd[1]: Initializing machine ID from random generator.
[   62.533900] systemd[1]: Queued start job for default target Multi-User System.
[   62.553740] systemd[1]: Created slice Slice /system/getty.
[   92.642288] systemd[1]: Created slice Slice /system/modprobe.
[  122.850367] systemd[1]: Created slice Slice /system/serial-getty.
[  153.058087] systemd[1]: Created slice User and Session Slice.
[  183.265198] systemd[1]: Started Dispatch Password Requests to Console Directory Watch.
[  213.473177] systemd[1]: Started Forward Password Requests to Wall Directory Watch.

 

它似乎与内核调度器和 arch_timer 有关、就像计时器中断发生频率不够高、或者调度器由于任何原因都无法正常工作一样。

我怀疑我的单元配置在中断配置方面不正确、或者我的囚犯 DTS 不正确。 下面附加了单元配置和 DTS。

我使用以下命令启动单元格

modprobe jailhouse
jailhouse enable /usr/share/jailhouse/cells/k3-j721s2.cell
jailhouse cell linux /usr/share/jailhouse/cells/k3-j721s2-linux-demo.cell /boot/Image -d /usr/share/jailhouse/cells/inmate-k3-j721s2-linux.dtb -i /root/rootfs.cpio.gz -c ""

 

k3-j721s2.c

k3-j721s2-linux-demo.c 

inmate-k3-j721s2-linux.dts.txt 

 

我理解 TI 不对此提供官方支持、但如果有相关经验的人能向我发出提示并指明方向、我将不胜感激。

非常感谢!
Darko

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Darko、

    我们已经停止支持越狱很久了。 几乎 5-6 年、因为我们在 SDK 中支持它。 因此、相同的指令可能无法正常工作、并且内核本身已移动多个版本。 在这一点上,我对什么可能失败没有很好的想法。

    此致、
    Keerthy

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Keerthy、

    感谢您的意见。 我使用的是 ti-linux-6.6.y-jailhouse https://git.ti.com/cgit/processor-sdk/linux/commit/?h=ti-linux-6.6.y-jailhouse&id=9419c5563fb71ff032ef2b406681db1cd3bf667d

    它是相对较旧的内核版本。

    您的同事  Shaik Mahammed Sadik 最近推送了 Jailhouse 驱动程序的一些修复程序
    https://git.ti.com/cgit/jailhouse/ti-jailhouse/commit/?id=b44c3548252bb3818b0dd0815728ca210d8fac2b

    它实际上解决了我们在测试中看到的 OPTEE 问题。

    在 AM62 等其他系列中、似乎仍然有一些对 Jailhouse 的支持?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我将与 AM62 团队核实并返回给您。

    - Keerthy

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    谢谢 Keerthy、我们成功找到了这个问题。

    在上面的示例中、在 k3-j721s2-linux-demo.c 中、在 irqchip 位图中配置了 UART1 SPI_193 中断、但应将其配置为 UART5 和 SPI_197。

    将 IRQ 位图调整到此位图后

    .address = 0x01800000,
    .pin_base = 160,
    /*
    * virtual PCI SPI_163 to 166 => idx 1 bit [6:3]
    * main_uart5 SPI_197 => idx 2 bit 5
    * important to have UART5 interrupt configured correctly, otherwise
    * the init stalls.
    */
    .pin_bitmap = {
    0x00000000, 0x00000078, 0x00000020, 0x00000000,
    },
    Linux inmate 启动正常。

    上述配置单元格和 DTS 中还有其他错误、但这一个错误阻止 userspace init 运行。