On 8/31/26 17:43, Thomas Weißschuh wrote:
On 2026-08-31 12:48:08+0200, Michal Simek wrote:
On 8/4/26 07:32, Thomas Weißschuh wrote:
Add a basic configuration to run kunit tests on microblaze.

Signed-off-by: Thomas Weißschuh <[email protected]>
---
   tools/testing/kunit/qemu_configs/microblaze.py | 17 +++++++++++++++++
   1 file changed, 17 insertions(+)

diff --git a/tools/testing/kunit/qemu_configs/microblaze.py 
b/tools/testing/kunit/qemu_configs/microblaze.py
new file mode 100644
index 000000000000..ff012095e77d
--- /dev/null
+++ b/tools/testing/kunit/qemu_configs/microblaze.py
@@ -0,0 +1,17 @@
+# SPDX-License-Identifier: GPL-2.0-only
+from ..qemu_config import QemuArchParams
+
+QEMU_ARCH = QemuArchParams(linux_arch='microblaze',
+                                                  kconfig='''
+CONFIG_CPU_BIG_ENDIAN=y

Big endian is quite old and I am even surprised that it is working.

Oh ok. This was the only configuration that I got working.

+CONFIG_SERIAL_UARTLITE=y
+CONFIG_SERIAL_UARTLITE_CONSOLE=y

I think it is just pure luck that this worked for you because you didn't
rewrite the most important parts of config.

You should define at least these values

CONFIG_KERNEL_BASE_ADDR=0x90000000
CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR=1
CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTR=1
CONFIG_XILINX_MICROBLAZE0_USE_BARREL=1
CONFIG_XILINX_MICROBLAZE0_USE_DIV=0
CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL=1
CONFIG_XILINX_MICROBLAZE0_USE_FPU=0

to be aligned with s3adsp1800

Will do.

It will solve these two issues too.
ERROR: Microblaze BARREL, MSR, PCMP or DIV-different for kernel and DTS
ERROR: Microblaze HW_MUL-different for kernel and DTS

+CONFIG_MB_POWER_OFF_THROUGH_UNALIGNED_PC=y
+''',
+                                                  qemu_arch='microblaze',
+                                                  
kernel_path='arch/microblaze/boot/linux.bin',
+                                                  
kernel_command_line='kunit_shutdown=poweroff',
+                                                  extra_qemu_params=[
+                                                       '-M', 
'petalogix-s3adsp1800',
+                                                  ],
+)


That's bring us to different topic. When qemu runs I see these 2 issues

qemu-system-microblaze: -accel kvm: invalid accelerator kvm
qemu-system-microblaze: -accel hvf: invalid accelerator hvf

That is an artifact on how KUnit starts qemu. It should not matter.

I don't have any issue if you want to wire big-endian version but would be
more useful to wire little endian version.

Understood. Let's try to have both.

If there is an issue with memmove implementation I can't see any issue to
disable that options to let it pass from the beginning and solve it
separately.

Ack. Could you take care of this? I have next to no idea about microblaze.

On little endian this is passing. I can add it to my todo list but big endian is very very old and likely none is using it anymore.



This should be fragment for Little endian.

Thanks, unfortunately this hangs for me with my distros QEMU 11.1.0.
No output, 100% CPU usage during boot. I am using qemu-system-microblaze
instead of qemu-system-microblazel, as the latter is not available
anymore, but the former is documented to also handle little endian
automatically.


I built the latest qemu like this

../qemu/configure --target-list=microblaze-softmmu,microblaze-linux-user,microblazeel-linux-user --enable-gcrypt --disable-docs

/mnt/projects/xilinx-new-git/qemu.org/build-microblaze/qemu-system-microblaze --version
QEMU emulator version 11.1.50 (v11.1.0-779-gd2e570cc0f97)

And can't see any issue.

Thanks,
Michal


/mnt/projects/xilinx-new-git/qemu.org/build-microblaze/qemu-system-microblaze -nodefaults -m 1024 -kernel .kunit/arch/microblaze/boot/linux.bin -append 'kunit.enable=1 kunit_shutdown=poweroff' -no-reboot -nographic -accel kvm -accel hvf -accel tcg -serial stdio -M petalogix-ml605
qemu-system-microblaze: -accel kvm: invalid accelerator kvm
qemu-system-microblaze: -accel hvf: invalid accelerator hvf
qemu-system-microblaze: falling back to tcg
qemu-system-microblaze: warning: nic xlnx.axi-ethernet.0 has no peer
random: crng init done
Ramdisk addr 0x00000000,
FDT at 0x5058e528
Linux version 7.3.0-rc1-00023-g5a713478d535 (monstr@monstr-desktop3) (microblazeel-amd-linux-gcc.real (GCC) 13.4.0, GNU ld (GNU Binutils) 2.42.0.20240723) #11 Tue Sep 1 15:18:11 CEST 2026
setup_memory: min_low_pfn: 0x50000
setup_memory: max_low_pfn: 0x60000
setup_memory: max_pfn: 0x60000
OF: reserved mem: Reserved memory: No reserved-memory node in the DT
setup_cpuinfo: initialising
setup_cpuinfo: No PVR support. Using static CPU info from FDT
wb_msr
WB won't work properly
Zone ranges:
  DMA      [mem 0x0000000050000000-0x000000005fffffff]
  Normal   empty
Movable zone start for each node
Early memory node ranges
  node   0: [mem 0x0000000050000000-0x000000005fffffff]
Initmem setup node 0 [mem 0x0000000050000000-0x000000005fffffff]
pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
pcpu-alloc: [0] 0
Kernel command line: kunit.enable=1 kunit_shutdown=poweroff
printk: log buffer data + meta data: 131072 + 409600 = 540672 bytes
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
Built 1 zonelists, mobility grouping on.  Total pages: 65536
mem auto-init: stack:all(zero), heap alloc:off, heap free:off
SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
irq-xilinx: /axi/interrupt-controller@81800000: num_irq=6, edge=0x4
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
ERROR: CPU CCF input clock not found
/axi/system-timer@83c00000: irq=2
ERROR: timer CCF input clock not found
clocksource: xilinx_clocksource: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604467 ns
xilinx_timer_shutdown
xilinx_timer_set_periodic
sched_clock: 32 bits at 100MHz, resolution 10ns, wraps every 21474836475ns
Console: colour dummy device 80x25
printk: legacy console [tty0] enabled
Calibrating delay loop... 1945.60 BogoMIPS (lpj=3891200)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
VFS: Finished mounting rootfs on nullfs
Memory: 253204K/262144K available (4023K kernel code, 596K rwdata, 832K rodata, 161K init, 192K bss, 8436K reserved, 0K cma-reserved)
posixtimers hash table entries: 512 (order: 0, 2048 bytes, linear)
futex hash table entries: 256 (3072 bytes on 1 NUMA nodes, total 3 KiB, linear).
DMA: preallocated 128 KiB GFP_KERNEL|GFP_DMA pool for atomic allocations
clocksource: Switched to clocksource xilinx_clocksource
workingset: timestamp_bits=30 (anon: 25) max_order=16 bucket_order=0 (anon: 0)
io scheduler mq-deadline registered
io scheduler kyber registered
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
83e00000.serial: ttyS0 MMIO:0x83e01000 (irq = 5, base_baud = 6250000) is a 
16550A
printk: console [ttyS0] enabled
clk: Disabling unused clocks
KTAP version 1
1..118
    KTAP version 1
    # Subtest: example_init
    # module: kunit_example_test
    # is_init: true
    1..1
    ok 1 example_init_test
ok 1 example_init
    # miscdev_init: found misc device minor 15 available
    # miscdev_init: found misc device minor 128 available
    # miscdev_init: found misc device minor 0 available
    # miscdev_init: found misc device minor 254 available
    KTAP version 1
    # Subtest: miscdev_init
    # module: misc_minor_kunit
    # is_init: true
    1..7
        KTAP version 1
        # Subtest: miscdev_test_static_basic
        ok 1 lower static range, top



Reply via email to