Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 123 additions & 0 deletions platform/aarch64/sysoul_x3300/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# sysoul_x3300-dual — RK3588 dual-zone (Linux NPU zone1 + Android zone2)

Dual-zone variant of `sysoul_x3300` / `sysoul_x3300-scmi` on the same
Rockchip RK3588 "sysoul x3300" board:

| Zone | CPUs | Role | Devices |
|------|------|------|---------|
| **Zone 0 (root-linux)** | 0, 1 | hvisor.ko + hvisor-tool (VirtIO-SCMI server), console on **plain uart2** (`serial@feb50000` = ttyS2), rootfs on the **SD card** (`sdmmc@fe2c0000`), network via **gmac** passthrough | CRU/PMU/GRF, sdmmc, gmac |
| **Zone 1 (npu linux)** | 4, 5 | NPU inference (rknn), virtio console/net, rootfs on virtio-blk | RKNPU passthrough (no IOMMU, `npu-memory@38000000` 64 MB shared-dma-pool), SCMI clk 0-7 / rst 0-5 / pd 0-2 |
| **Zone 2 (android)** | 6, 7 | Android 13 GUI, virtio console/net, clocks via VirtIO-SCMI | **Passthrough**: Mali GPU, VOP2+VOP IOMMU, DSI0+dcphy0, eMMC (`mmc@fe2e0000`), gpio2 (panel), lcd backlight pwm. SCMI clk/rst/pd for all of them |

## Files

- `board.rs` — root zone layout. vs `sysoul_x3300-scmi`: eMMC (INTID 0xed),
dsi0 (0xc7), gpio2 (0x137), lcd-pwm block (0x178/0x179) and fiq-debugger
(0x1c7) IRQs removed from the root bitmap (moved to zone2 / unused);
everything else identical.
- `image/dts/zone0.dts` — root dts (based on the scmi evb7-v11 root dts):
uart2 console, SD-card rootfs, eMMC/gpio2/pwm/backlight/fiq-debugger
disabled, `hvisor_virtio_device` extended with the zone2 resource list
(clock indices 38-50, reset indices 30-39; indices 0-37 unchanged so the
npu/gpu/vop/hdmi mappings of the scmi platform stay valid).
- `image/dts/zone1-linux-npu.dts` — npu zone dts, cpus 4/5 (cpu section
spliced from the validated zone2-linux-gpu-hdmi template).
- `image/dts/zone2-android.dts` — android zone dts, generated from the
working passthrough android dts (`sysoul_x3300` `zone1-android.dts`):
cpus 6/7, 2 GB RAM at 0x58000000, all non-zone2 nodes disabled, enabled
devices rewired to VirtIO-SCMI. **See the header comment in the file for
the full list of deltas vs bare-metal android.**
- `configs/zone1-linux-npu.json`, `configs/zone2-android.json` — full zone
configs (zone start).
- `configs/zones-npu-android.json` — virtio activation file for both zones.

## SCMI virtual id layout (zone2-android)

Virtual ids are positions in `clock_ids` / `reset_ids` / `power_ids` of
`zone2-android.json`, which index into zone0's `hvisor_virtio_device`
lists. Layout used by `zone2-android.dts`:

| virtual | resource (hvisor list idx) |
|---------|----------------------------|
| clk 0-3 | gpu clk_mali/coregroup/stacks/clk_gpu (idx 8-11) |
| clk 4-13 | vop aclk/hclk/dclk_vp0-3/pclk/dclk_src_vp0-2 (idx 12-21) |
| clk 17-18 | dsi0 pclk/sys_clk (idx 47-48) |
| clk 19-20 | dcphy0 pclk/ref (idx 49-50) |
| clk 21-25 | eMMC core/bus/axi/block/timer (idx 38-42) |
| clk 26-27 | gpio2 (idx 43-44) |
| clk 28-29 | lcd pwm / pclk (idx 45-46) |
| rst 0-5 | vop axi/ahb/dclk_vp0-3 (idx 6-11) |
| rst 6-10 | eMMC core..timer (idx 30-34) |
| rst 11 | dsi0 apb (idx 35) |
| rst 12-15 | dcphy0 m_phy/apb/grf/s_phy (idx 36-39) |
| pd 0 | gpu (idx 3 = 0x0c) |
| pd 1 | vop + dsi0 (idx 4 = 0x18) |

## Build

```bash
make all BID=aarch64/sysoul_x3300-dual
# device trees:
make -C platform/aarch64/sysoul_x3300-dual/image/dts
```

## Deploy & boot (tftp, u-boot)

Files (deploy with a `202609-` prefix next to the existing `202605-` ones):

- `hvisor.bin` (BID sysoul_x3300-dual)
- `sysoul_iron.dtb` (u-boot board dts) — unchanged from the scmi flow
- `zone0.dtb` + Linux 6.1 `Image` (root zone; rootfs partition on the SD
card, u-boot configures the eMMC/SD layout)
- zone1: `202605-Image` (linux SDK Image) + `zone1-linux-npu.dtb` +
`202605-rootfs.img` (virtio-blk)
- zone2: `202609-android-Image` + `202609-android-ramdisk` (extracted from
boot.img) + `zone2-android.dtb`

```bash
setenv ipaddr 192.168.255.2; setenv netmask 255.255.255.0; setenv serverip 192.168.255.1
setenv board_dtb_addr 0x00400000; setenv hvisor_addr 0x00500000
setenv root_linux_dtb_addr 0x20000000; setenv kernel_addr 0x20400000
tftp ${board_dtb_addr} 202605-sysoul_iron.dtb; tftp ${hvisor_addr} 202609-hvisor.bin; \
tftp ${root_linux_dtb_addr} 202609-sysoul_x3300_zone0.dtb; tftp ${kernel_addr} 202605-Image; \
bootm ${hvisor_addr} - ${board_dtb_addr}
```

On root-linux:

```bash
./hvisor zone start ./zone1-linux-npu.json
./hvisor zone start ./zone2-android.json
```

(zone kernel/dtb/ramdisk paths are relative to the hvisor-tool working
directory; adjust to the deployed file names.)

## Prerequisites / known work items (outside this repo)

1. **Android kernel 5.10** (rockchip_android13_sdk): no
`CONFIG_ARM_SCMI_TRANSPORT_VIRTIO` in 5.10 — the virtio SCMI transport
(present in the 6.1 SDK kernel) must be backported, or the zone2 clock
consumers will defer. `CONFIG_VIRTIO_CONSOLE=y`, `CONFIG_VIRTIO_NET=y`,
`CONFIG_VIRTIO_MMIO=y` are already enabled.
2. **zone2 android dts source of truth**: the shipped `zone2-android.dtb`
is self-contained; if you regenerate from the SDK, the *effective* board
dts is `rk3588-evb7-lp4-v10-test.dts` (not `xiuos_rk3588*.dts`).
3. eMMC remains a full passthrough device: android boots with
`androidboot.boot_devices=fe2e0000.mmc` exactly as before; no
virtio-blk / init by-name changes are needed.
4. Android has no physical uart (console=hvc0, no earlycon): kernel early
output before hvc0 registration is invisible by design.
5. Root zone console moved from uart3/ttyFIQ0 to plain uart2 (ttyS2) —
both are `0xfeb50000`/`0xfeb60000` respectively; uart2 is the physical
debug uart shared with hvisor's own early logs.

## Verification

- Zone 1: `rknpu` probed in the guest; rknn workload (e.g.
rknn-toolkit-lite, MobileNet) at the numbers previously reached on
sysoul_x3300-scmi.
- Zone 2: android boots to launcher on the DSI panel; console via
`hvisor`'s virtio console (attach to the printed pts); `adb` over
virtio-net; eMMC storage works with zero android init changes.
- Root: serial on uart2, rootfs on SD, ssh over gmac.
118 changes: 82 additions & 36 deletions platform/aarch64/sysoul_x3300/board.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ pub const BOARD_PHYSMEM_LIST: &[(u64, u64, MemoryType)] = &[
(0x4_f000_0000, 0x5_0000_0000, MemoryType::Normal),
];

pub const ROOT_ZONE_DTB_ADDR: u64 = 0x1000_0000;
pub const ROOT_ZONE_KERNEL_ADDR: u64 = 0x1040_0000;
pub const ROOT_ZONE_ENTRY: u64 = 0x1040_0000;
pub const ROOT_ZONE_DTB_ADDR: u64 = 0x2000_0000;
pub const ROOT_ZONE_KERNEL_ADDR: u64 = 0x2040_0000;
pub const ROOT_ZONE_ENTRY: u64 = 0x2040_0000;
pub const ROOT_ZONE_CPUS: u64 = (1 << 2) - 1;

pub const ROOT_ZONE_NAME: &str = "root-linux";
Expand Down Expand Up @@ -98,15 +98,18 @@ pub const ROOT_ZONE_MEMORY_REGIONS: &[HvConfigMemoryRegion] = &[
mem_type: MEM_TYPE_RAM,
physical_start: 0x2000_0000,
virtual_start: 0x2000_0000,
size: 0x8000_0000,
}, // this is a gap allocated for android modules
size: 0x2000_0000,
}, // zone0 kernel/dtb area
// Root RAM 0x4000_0000..0xf000_0000; the 0x5800_0000..0xd800_0000
// sub-range belongs to zone2 (android) and is no-map reserved in zone0.dts.
HvConfigMemoryRegion {
mem_type: MEM_TYPE_RAM,
physical_start: 0xa000_0000,
virtual_start: 0xa000_0000,
size: 0x5000_0000,
physical_start: 0x4000_0000,
virtual_start: 0x4000_0000,
size: 0xb000_0000,
},
// memory allocated to android
// Root high RAM; the 0x1_0000_0000..0x2_fc00_0000 sub-range belongs to
// zone1 (npu) and is no-map reserved in zone0.dts.
HvConfigMemoryRegion {
mem_type: MEM_TYPE_RAM,
physical_start: 0x1_0000_0000,
Expand All @@ -133,17 +136,44 @@ pub const ROOT_ZONE_MEMORY_REGIONS: &[HvConfigMemoryRegion] = &[
size: 0x000f_0000,
},
// /proc/iomem Devices I/O
// GPU region (0xfb00_0000-0xfb20_0000) moved to zone2 (android)
// HvConfigMemoryRegion {
// mem_type: MEM_TYPE_IO,
// physical_start: 0xfb00_0000,
// virtual_start: 0xfb00_0000,
// size: 0x0020_0000,
// },
HvConfigMemoryRegion {
mem_type: MEM_TYPE_IO,
physical_start: 0xfb00_0000,
virtual_start: 0xfb00_0000,
size: 0x0020_0000,
physical_start: 0xfc00_0000,
virtual_start: 0xfc00_0000,
size: 0x15a_4000, // fc000000..fd5a4000
},
// VOP-GRF: keep in root zone for DDR MCU access
HvConfigMemoryRegion {
mem_type: MEM_TYPE_IO,
physical_start: 0xfc00_0000,
virtual_start: 0xfc00_0000,
size: 0x0200_0000,
physical_start: 0xfd5a_4000,
virtual_start: 0xfd5a_4000,
size: 0x2000, // fd5a4000..fd5a6000
},
HvConfigMemoryRegion {
mem_type: MEM_TYPE_IO,
physical_start: 0xfd5a_6000,
virtual_start: 0xfd5a_6000,
size: 0x7ea_000, // fd5a6000..fdd90000
},
// VOP: keep in root zone for DDR MCU line-flag synchronization
HvConfigMemoryRegion {
mem_type: MEM_TYPE_IO,
physical_start: 0xfdd9_0000,
virtual_start: 0xfdd9_0000,
size: 0x8000, // fdd90000..fdd98000
},
HvConfigMemoryRegion {
mem_type: MEM_TYPE_IO,
physical_start: 0xfdd9_8000,
virtual_start: 0xfdd9_8000,
size: 0x26_8000, // fdd98000..fe000000
},
HvConfigMemoryRegion {
mem_type: MEM_TYPE_IO,
Expand Down Expand Up @@ -178,34 +208,51 @@ pub const ROOT_ZONE_MEMORY_REGIONS: &[HvConfigMemoryRegion] = &[
virtual_start: 0x0010_0000,
size: 0xf000,
},
// Unknown Region, maybe we should ask vendor for help
HvConfigMemoryRegion {
mem_type: MEM_TYPE_IO,
physical_start: 0xa_0000_0000,
virtual_start: 0xa_0000_0000,
size: 0x1_0000_0000,
},
];

pub const ROOT_ZONE_IRQS_BITMAP: &[BitmapWord] = &get_irqs_bitmap(&[
0x27, // arm_pmu
// core / platform
0x27, // arm-pmu
0x29, // gic
0x2a, 0x2b, 0x2d, 0x2e, // timer
0x40, // hvisor
0x2a, 0x2b, 0x2d, 0x2e, // arch timer
0x40, // hvisor_virtio_device
0x69, // dmc
0xeb, // sdmmc
0x103, 0x102, // gmac0
0x10a, 0x109, // gmac1
0x135, // gpio0
0x136, // gpio1
0x137, // gpio2
0x138, // gpio3
0x139, // gpio4
0x141, // rktimer
0x15d, // i2c0
0x15e, // i2c1
0x166, // spi0
0x168, // spi2
0x16e, // uart3
0x1ad, // tsadc
0x1b0, // rng
0x76, 0x77, 0x78, 0x79, // dma-controller@fea10000/fea30000
0x7a, 0x7b, // dma-controller@fed10000
0xeb, // sdmmc@fe2c0000 (root SD rootfs)
0x109, 0x10a, // ethernet@fe1c0000 (gmac1, root network)
0x135, // gpio@fd8a0000 (gpio0: SD vmmc enable, rk806 int etc.)
// 0x137, // gpio2 -> zone2 (android panel reset/enable)
0x138, // gpio@fec40000 (gpio3)
0x139, // gpio@fec50000 (gpio4)
0x141, // timer@feae0000 (rktimer)
0x15d, // i2c@fd880000 (i2c0: rk860/pmic aux)
0x163, // i2c@fec80000 (i2c6: rtc hym8563)
0x168, // spi@feb20000 (spi2: rk806 PMIC)
0x16d, // serial@feb50000 (uart2: root console ttyS2)
0x1ad, // tsadc@fec00000
0x1c7, // fiq-debugger (uart2 console ttyFIQ0, irq-mode)
0x1ae, // saradc@fec10000
0x1b0, // rng@fe378000
// usb: only usbdrd3_1 (usb@fc400000) + its usb2phy stay in root;
// usb@fc000000/fcd00000 dwc3, ehci/ohci pairs, usb2phy0-2 and the
// usb iommus moved to zone2 (android), see zone2-android.dts/json.
0xfd, // usb@fc400000 dwc3 (usbdrd3_1)
0x1aa, // usb2phy1 (usb2-phy@4000, root usbdrd3_1 companion)
// Everything else (camera/mpp/audio/pcie/sata/touch/extra uart/i2c/spi/
// mailbox/display chains) is disabled in zone0.dts &{...} overrides or
// passed through to zone1/zone2 - see image/dts/zone0.dts.
]);

pub const ROOT_ARCH_ZONE_CONFIG: HvArchZoneConfig = HvArchZoneConfig {
is_aarch32: 0,
uefi_config: UefiConfig::NoUefi,
gic_config: GicConfig::Gicv3(Gicv3Config {
gicd_base: 0xfe60_0000,
gicd_size: 0x0001_0000,
Expand All @@ -214,7 +261,6 @@ pub const ROOT_ARCH_ZONE_CONFIG: HvArchZoneConfig = HvArchZoneConfig {
gits_base: 0x0,
gits_size: 0x0,
}),
uefi_config: UefiConfig::NoUefi
};

pub const ROOT_ZONE_IVC_CONFIG: [HvIvcConfig; 0] = [];
Expand Down
44 changes: 0 additions & 44 deletions platform/aarch64/sysoul_x3300/configs/zone1-android-virtio.json

This file was deleted.

Loading
Loading