diff options
| author | Mark Hatle <mark.hatle@amd.com> | 2025-02-07 16:30:20 -0700 |
|---|---|---|
| committer | Mark Hatle <mark.hatle@amd.com> | 2025-03-30 14:16:15 -0600 |
| commit | 7c00b04b3a33e0a3b44d3d489f54280a768b487b (patch) | |
| tree | 82c5866371a86fc24137d2876f12d8be32b6c630 /meta-xilinx-core | |
| parent | 68b4f18611120fb187743f53f7048f4cc07567bd (diff) | |
| download | meta-xilinx-7c00b04b3a33e0a3b44d3d489f54280a768b487b.tar.gz | |
meta-xilinx-core: qemu-multiarch-helper: Support -dtb as -hw-dtb analog for APU
To ensure it is easier to override the APU device-tree, support -dtb as an
analog for -hw-dtb to the APU. Additionally, runqemu needs to define a kernel
to pass -dtb, so ignore the -kernel parameter as it doesn't do anything in
the system emulated APU.
Also check and error if an APU DTB is not passed in, either via -dtb or -hw-dtb.
This can cause qemu to lock up, try to prevent this error.
Signed-off-by: Mark Hatle <mark.hatle@amd.com>
Diffstat (limited to 'meta-xilinx-core')
| -rw-r--r-- | meta-xilinx-core/recipes-devtools/qemu/files/qemu-system-aarch64-multiarch | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/meta-xilinx-core/recipes-devtools/qemu/files/qemu-system-aarch64-multiarch b/meta-xilinx-core/recipes-devtools/qemu/files/qemu-system-aarch64-multiarch index 4f80c7a2..cc5ac483 100644 --- a/meta-xilinx-core/recipes-devtools/qemu/files/qemu-system-aarch64-multiarch +++ b/meta-xilinx-core/recipes-devtools/qemu/files/qemu-system-aarch64-multiarch | |||
| @@ -23,6 +23,7 @@ PMU_args = [] | |||
| 23 | PLM_args = [] | 23 | PLM_args = [] |
| 24 | bootbin_arg = None | 24 | bootbin_arg = None |
| 25 | mach_path_arg = None | 25 | mach_path_arg = None |
| 26 | dtb_arg = None | ||
| 26 | 27 | ||
| 27 | if '-pmu-args' in APU_args: | 28 | if '-pmu-args' in APU_args: |
| 28 | pmu_args_idx = APU_args.index('-pmu-args') | 29 | pmu_args_idx = APU_args.index('-pmu-args') |
| @@ -44,6 +45,22 @@ if '-machine-path' in APU_args: | |||
| 44 | mach_path_arg = APU_args[mach_path_args_idx+1] | 45 | mach_path_arg = APU_args[mach_path_args_idx+1] |
| 45 | del APU_args[mach_path_args_idx:mach_path_args_idx+2] | 46 | del APU_args[mach_path_args_idx:mach_path_args_idx+2] |
| 46 | 47 | ||
| 48 | if '-dtb' in APU_args: | ||
| 49 | dtb_args_idx = APU_args.index('-dtb') | ||
| 50 | dtb_arg = APU_args[dtb_args_idx+1] | ||
| 51 | del APU_args[dtb_args_idx:dtb_args_idx+2] | ||
| 52 | |||
| 53 | # Filter this out | ||
| 54 | if '-kernel' in APU_args: | ||
| 55 | kernel_args_idx = APU_args.index('-kernel') | ||
| 56 | del APU_args[kernel_args_idx:kernel_args_idx+2] | ||
| 57 | |||
| 58 | # The APU QEMU will hang if it does get get a -hw-dtb | ||
| 59 | if dtb_arg and '-hw-dtb' in APU_args: | ||
| 60 | sys.exit(f'\nERROR: Arguments -dtb and -hw-dtb conflict, only one should be specified.') | ||
| 61 | elif not dtb_arg and not '-hw-dtb' in APU_args: | ||
| 62 | sys.exit(f'\nERROR: You must specify at least a -dtb or -hw-dtb for the APU.') | ||
| 63 | |||
| 47 | if mach_path_arg: | 64 | if mach_path_arg: |
| 48 | if not os.path.isdir(mach_path_arg): | 65 | if not os.path.isdir(mach_path_arg): |
| 49 | sys.exit(f'\nERROR: Missing machine path for qemu: {mach_path_arg}') | 66 | sys.exit(f'\nERROR: Missing machine path for qemu: {mach_path_arg}') |
| @@ -75,6 +92,8 @@ def help(status): | |||
| 75 | APU_args.append('-help') | 92 | APU_args.append('-help') |
| 76 | print(f"APU Options:\n") | 93 | print(f"APU Options:\n") |
| 77 | print(f" -bootbin <boot.bin> - Use a boot.bin instead of individual firmware, device trees and bootloader\n") | 94 | print(f" -bootbin <boot.bin> - Use a boot.bin instead of individual firmware, device trees and bootloader\n") |
| 95 | print(f" -dtb - Specify hardware dtb for the APU\n") | ||
| 96 | print(f" -kernel - option is filtered out, but is available for compatibility\n") | ||
| 78 | apu_args_s = ' '.join(APU_args) | 97 | apu_args_s = ' '.join(APU_args) |
| 79 | help_cmd = f'{binpath}/qemu-system-aarch64 {apu_args_s}' | 98 | help_cmd = f'{binpath}/qemu-system-aarch64 {apu_args_s}' |
| 80 | 99 | ||
| @@ -131,6 +150,10 @@ if bootbin_arg: | |||
| 131 | PLM_args.append(f"-device loader,file={mach_path}/plm.bin,addr={plm_load_addr},force-raw=on") | 150 | PLM_args.append(f"-device loader,file={mach_path}/plm.bin,addr={plm_load_addr},force-raw=on") |
| 132 | PLM_args.append(f"-device loader,addr={plm_load_addr},cpu-num=1") | 151 | PLM_args.append(f"-device loader,addr={plm_load_addr},cpu-num=1") |
| 133 | 152 | ||
| 153 | # We use the normal -dtb argument to specify the hw-dtb for the multiarch runner, as -dtb is not applicable. | ||
| 154 | if dtb_arg: | ||
| 155 | APU_args.append(f"-hw-dtb {dtb_arg}") | ||
| 156 | |||
| 134 | # We need to switch tcp serial arguments (if they exist, e.g. qemurunner) to get the output | 157 | # We need to switch tcp serial arguments (if they exist, e.g. qemurunner) to get the output |
| 135 | tcp_serial_ports = [i for i, s in enumerate(APU_args) if 'tcp:127.0.0.1:' in s] | 158 | tcp_serial_ports = [i for i, s in enumerate(APU_args) if 'tcp:127.0.0.1:' in s] |
| 136 | 159 | ||
