forked from OERV-BSP/u-boot
Merge tag 'xilinx-for-v2025.04-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze into next
AMD/Xilinx changes for v2025.04-rc1 binman: - Separate binman description from main DT zynqmp: - Enable binman for ZynqMP platforms - DT sync with Linux v6.12 - Update usb5744 hub for SOMs common: - Drop SPL_FIT_GENERATOR support versal2 - Enable OPTEE layers ospi: - Refactor the flash reset functionality pytest: - Fix tcminit mode handling
This commit is contained in:
@@ -70,7 +70,7 @@ def ret_code(u_boot_console):
|
||||
|
||||
# Initialize tcm
|
||||
def tcminit(u_boot_console, rpu_mode):
|
||||
output = u_boot_console.run_command('zynqmp tcminit %s' % rpu_mode)
|
||||
output = u_boot_console.run_command(f'zynqmp tcminit {rpu_mode}')
|
||||
assert 'Initializing TCM overwrites TCM content' in output
|
||||
return ret_code(u_boot_console)
|
||||
|
||||
@@ -89,6 +89,13 @@ def disable_cpus(u_boot_console, cpu_nums):
|
||||
for num in cpu_nums:
|
||||
u_boot_console.run_command(f'cpu {num} disable')
|
||||
|
||||
# Get random RPU mode between string and integer
|
||||
def get_rpu_mode(rpu_mode):
|
||||
if rpu_mode == 0 or rpu_mode == 'lockstep':
|
||||
return random.choice(['lockstep', 0])
|
||||
elif rpu_mode == 1 or rpu_mode == 'split':
|
||||
return random.choice(['split', 1])
|
||||
|
||||
# Load apps on RPU cores
|
||||
def rpu_apps_load(u_boot_console, rpu_mode):
|
||||
apps, procs, cpu_nums, addrs, outputs, tftp_addrs = get_rpu_apps_env(
|
||||
@@ -98,20 +105,20 @@ def rpu_apps_load(u_boot_console, rpu_mode):
|
||||
test_net.test_net_setup_static(u_boot_console)
|
||||
|
||||
try:
|
||||
assert tcminit(u_boot_console, rpu_mode).endswith('0')
|
||||
assert tcminit(u_boot_console, get_rpu_mode(rpu_mode)).endswith('0')
|
||||
|
||||
for i in range(len(apps)):
|
||||
if rpu_mode == 'lockstep' and procs[i] != 'rpu0':
|
||||
continue
|
||||
|
||||
load_app_ddr(u_boot_console, tftp_addrs[i], apps[i])
|
||||
rel_addr = int(addrs[i] + 0x3C)
|
||||
rel_addr = hex(int(addrs[i] + 0x3C))
|
||||
|
||||
# Release cpu at app load address
|
||||
cpu_num = cpu_nums[i]
|
||||
cmd = 'cpu %d release %x %s' % (cpu_num, rel_addr, rpu_mode)
|
||||
cmd = f'cpu {cpu_num} release {rel_addr} {rpu_mode}'
|
||||
output = u_boot_console.run_command(cmd)
|
||||
exp_op = f'Using TCM jump trampoline for address {hex(rel_addr)}'
|
||||
exp_op = f'Using TCM jump trampoline for address {rel_addr}'
|
||||
assert exp_op in output
|
||||
assert f'R5 {rpu_mode} mode' in output
|
||||
u_boot_console.wait_for(outputs[i])
|
||||
@@ -133,16 +140,13 @@ def test_zynqmp_rpu_app_load_negative(u_boot_console):
|
||||
u_boot_console)
|
||||
|
||||
# Invalid commands
|
||||
u_boot_console.run_command('zynqmp tcminit mode')
|
||||
assert ret_code(u_boot_console).endswith('1')
|
||||
|
||||
rand_str = ''.join(random.choices(string.ascii_lowercase, k=4))
|
||||
u_boot_console.run_command('zynqmp tcminit %s' % rand_str)
|
||||
assert ret_code(u_boot_console).endswith('1')
|
||||
|
||||
rand_num = random.randint(2, 100)
|
||||
u_boot_console.run_command('zynqmp tcminit %d' % rand_num)
|
||||
assert ret_code(u_boot_console).endswith('1')
|
||||
inv_modes = ['mode', rand_str, rand_num, 'splittt', 'locksteppp', '00', 11]
|
||||
|
||||
for mode in inv_modes:
|
||||
u_boot_console.run_command(f'zynqmp tcminit {mode}')
|
||||
assert ret_code(u_boot_console).endswith('1')
|
||||
|
||||
test_net.test_net_dhcp(u_boot_console)
|
||||
if not test_net.net_set_up:
|
||||
@@ -150,56 +154,66 @@ def test_zynqmp_rpu_app_load_negative(u_boot_console):
|
||||
|
||||
try:
|
||||
rpu_mode = 'split'
|
||||
assert tcminit(u_boot_console, rpu_mode).endswith('0')
|
||||
assert tcminit(u_boot_console, get_rpu_mode(rpu_mode)).endswith('0')
|
||||
|
||||
inv_modes += [0, 1]
|
||||
for i in range(len(apps)):
|
||||
load_app_ddr(u_boot_console, tftp_addrs[i], apps[i])
|
||||
|
||||
# Run in split mode at different load address
|
||||
rel_addr = int(addrs[i]) + random.randint(200, 1000)
|
||||
rel_addr = hex(int(addrs[i]) + random.randint(200, 1000))
|
||||
cpu_num = cpu_nums[i]
|
||||
cmd = 'cpu %d release %x %s' % (cpu_num, rel_addr, rpu_mode)
|
||||
cmd = f'cpu {cpu_num} release {rel_addr} {rpu_mode}'
|
||||
output = u_boot_console.run_command(cmd)
|
||||
exp_op = f'Using TCM jump trampoline for address {hex(rel_addr)}'
|
||||
exp_op = f'Using TCM jump trampoline for address {rel_addr}'
|
||||
assert exp_op in output
|
||||
assert f'R5 {rpu_mode} mode' in output
|
||||
assert not outputs[i] in output
|
||||
|
||||
# Invalid rpu mode
|
||||
rand_str = ''.join(random.choices(string.ascii_lowercase, k=4))
|
||||
cmd = 'cpu %d release %x %s' % (cpu_num, rel_addr, rand_str)
|
||||
output = u_boot_console.run_command(cmd)
|
||||
assert exp_op in output
|
||||
assert f'Unsupported mode' in output
|
||||
assert not ret_code(u_boot_console).endswith('0')
|
||||
for mode in inv_modes:
|
||||
cmd = f'cpu {cpu_num} release {rel_addr} {mode}'
|
||||
output = u_boot_console.run_command(cmd)
|
||||
assert exp_op in output
|
||||
assert f'Unsupported mode' in output
|
||||
assert not ret_code(u_boot_console).endswith('0')
|
||||
|
||||
# Switch to lockstep mode, without disabling CPUs
|
||||
rpu_mode = 'lockstep'
|
||||
u_boot_console.run_command('zynqmp tcminit %s' % rpu_mode)
|
||||
assert not ret_code(u_boot_console).endswith('0')
|
||||
output = u_boot_console.run_command(
|
||||
f'zynqmp tcminit {get_rpu_mode(rpu_mode)}'
|
||||
)
|
||||
assert 'ERROR: ' in output
|
||||
|
||||
# Disable cpus
|
||||
disable_cpus(u_boot_console, cpu_nums)
|
||||
|
||||
# Switch to lockstep mode, after disabling CPUs
|
||||
output = u_boot_console.run_command('zynqmp tcminit %s' % rpu_mode)
|
||||
output = u_boot_console.run_command(
|
||||
f'zynqmp tcminit {get_rpu_mode(rpu_mode)}'
|
||||
)
|
||||
assert 'Initializing TCM overwrites TCM content' in output
|
||||
assert ret_code(u_boot_console).endswith('0')
|
||||
|
||||
# Run lockstep mode for RPU1
|
||||
# Run lockstep mode for RPU1/RPU0
|
||||
for i in range(len(apps)):
|
||||
if procs[i] == 'rpu0':
|
||||
continue
|
||||
|
||||
load_app_ddr(u_boot_console, tftp_addrs[i], apps[i])
|
||||
rel_addr = int(addrs[i] + 0x3C)
|
||||
rel_addr = hex(int(addrs[i] + 0x3C))
|
||||
cpu_num = cpu_nums[i]
|
||||
cmd = 'cpu %d release %x %s' % (cpu_num, rel_addr, rpu_mode)
|
||||
cmd = f'cpu {cpu_num} release {rel_addr} {rpu_mode}'
|
||||
output = u_boot_console.run_command(cmd)
|
||||
exp_op = f'Using TCM jump trampoline for address {hex(rel_addr)}'
|
||||
exp_op = f'Using TCM jump trampoline for address {rel_addr}'
|
||||
assert exp_op in output
|
||||
assert f'R5 {rpu_mode} mode' in output
|
||||
assert u_boot_console.p.expect([outputs[i]])
|
||||
|
||||
if procs[i] == 'rpu1':
|
||||
assert 'Lockstep mode should run on ZYNQMP_CORE_RPU0' in output
|
||||
assert not ret_code(u_boot_console).endswith('0')
|
||||
elif procs[i] == 'rpu0':
|
||||
assert f'R5 {rpu_mode} mode' in output
|
||||
u_boot_console.wait_for(outputs[i])
|
||||
assert ret_code(u_boot_console).endswith('0')
|
||||
else:
|
||||
assert False, 'ERROR: Invalid processor!'
|
||||
finally:
|
||||
disable_cpus(u_boot_console, cpu_nums)
|
||||
# This forces the console object to be shutdown, so any subsequent test
|
||||
|
||||
Reference in New Issue
Block a user