8fd2518e | 06-Feb-2025 |
Peter Maydell <peter.maydell@linaro.org> |
hw: Centralize handling of -machine dumpdtb option
Currently we handle the 'dumpdtb' machine sub-option ad-hoc in every board model that has an FDT. It's up to the board code to make sure it calls
hw: Centralize handling of -machine dumpdtb option
Currently we handle the 'dumpdtb' machine sub-option ad-hoc in every board model that has an FDT. It's up to the board code to make sure it calls qemu_fdt_dumpdtb() in the right place.
This means we're inconsistent and often just ignore the user's command line argument: * if the board doesn't have an FDT at all * if the board supports FDT, but there happens not to be one present (usually because of a missing -fdt option)
This isn't very helpful because it gives the user no clue why their option was ignored.
However, in order to support the QMP/HMP dumpdtb commands we require now that every FDT machine stores a pointer to the FDT in MachineState::fdt. This means we can handle -machine dumpdtb centrally by calling the qmp_dumpdtb() function, unifying its handling with the QMP/HMP commands. All the board code calls to qemu_fdt_dumpdtb() can then be removed.
For this commit we retain the existing behaviour that if there is no FDT we silently ignore the -machine dumpdtb option.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
show more ...
|
db0dd335 | 06-Feb-2025 |
Peter Maydell <peter.maydell@linaro.org> |
hw/mips/boston: Support dumpdtb monitor commands
The boston machine doesn't set MachineState::fdt to the DTB blob that it has loaded or created, which means that the QMP/HMP dumpdtb monitor commands
hw/mips/boston: Support dumpdtb monitor commands
The boston machine doesn't set MachineState::fdt to the DTB blob that it has loaded or created, which means that the QMP/HMP dumpdtb monitor commands don't work.
Setting MachineState::fdt is easy in the non-FIT codepath: we can simply do so immediately before loading the DTB into guest memory. The FIT codepath is a bit more awkward as currently the FIT loader throws away the memory that the FDT was in after it loads it into guest memory. So we add a void *pfdt argument to load_fit() for it to store the FDT pointer into.
There is some readjustment required of the pointer handling in loader-fit.c, so that it applies 'const' only where it should (e.g. the data pointer we get back from fdt_getprop() is const, because it's into the middle of the input FDT data, but the pointer that fit_load_image_alloc() should not be const, because it's freshly allocated memory that the caller can change if it likes).
Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-id: 20250206151214.2947842-5-peter.maydell@linaro.org
show more ...
|
8970e2ea | 12-Feb-2025 |
Philippe Mathieu-Daudé <philmd@linaro.org> |
hw/mips: Mark Loonson3 Virt machine devices as little-endian
The Loonson3 Virt machine is only built as little-endian. Therefore the DEVICE_NATIVE_ENDIAN definition expand to DEVICE_LITTLE_ENDIAN (b
hw/mips: Mark Loonson3 Virt machine devices as little-endian
The Loonson3 Virt machine is only built as little-endian. Therefore the DEVICE_NATIVE_ENDIAN definition expand to DEVICE_LITTLE_ENDIAN (besides, the DEVICE_BIG_ENDIAN case isn't tested). Simplify directly using DEVICE_LITTLE_ENDIAN.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20250212113938.38692-4-philmd@linaro.org>
show more ...
|
70bc2031 | 12-Jan-2025 |
Philippe Mathieu-Daudé <philmd@linaro.org> |
hw/mips/loongson3_bootp: Move to common_ss[]
loongson3_bootp.c doesn't contain any target-specific code and can be build generically, move it to common_ss[].
Signed-off-by: Philippe Mathieu-Daudé <
hw/mips/loongson3_bootp: Move to common_ss[]
loongson3_bootp.c doesn't contain any target-specific code and can be build generically, move it to common_ss[].
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20250115232952.31166-12-philmd@linaro.org>
show more ...
|
92c63c9a | 12-Jan-2025 |
Philippe Mathieu-Daudé <philmd@linaro.org> |
hw/mips/loongson3_virt: Propagate %processor_id to init_boot_param()
Propagate %processor_id from mips_loongson3_virt_init() where we have a reference to the first vCPU, so use it instead of the &fi
hw/mips/loongson3_virt: Propagate %processor_id to init_boot_param()
Propagate %processor_id from mips_loongson3_virt_init() where we have a reference to the first vCPU, so use it instead of the &first_cpu global.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20250115232952.31166-11-philmd@linaro.org>
show more ...
|
7eb372cc | 12-Jan-2025 |
Philippe Mathieu-Daudé <philmd@linaro.org> |
hw/mips/loongson3_virt: Propagate processor_id to init_loongson_params()
Remove one &first_cpu use in hw/mips/loongson3_bootp.c.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-b
hw/mips/loongson3_virt: Propagate processor_id to init_loongson_params()
Remove one &first_cpu use in hw/mips/loongson3_bootp.c.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20250115232952.31166-10-philmd@linaro.org>
show more ...
|
18271b53 | 12-Jan-2025 |
Philippe Mathieu-Daudé <philmd@linaro.org> |
hw/mips/loongson3_bootp: Propagate processor_id to init_cpu_info()
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id:
hw/mips/loongson3_bootp: Propagate processor_id to init_cpu_info()
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20250115232952.31166-9-philmd@linaro.org>
show more ...
|
03ed671c | 12-Jan-2025 |
Philippe Mathieu-Daudé <philmd@linaro.org> |
hw/mips/loongson3_virt: Propagate cpu_count to init_boot_param()
Remove one use of the 'current_machine' global.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Hende
hw/mips/loongson3_virt: Propagate cpu_count to init_boot_param()
Remove one use of the 'current_machine' global.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20250115232952.31166-8-philmd@linaro.org>
show more ...
|
61f6e494 | 12-Jan-2025 |
Philippe Mathieu-Daudé <philmd@linaro.org> |
hw/mips/loongson3: Propagate cpu_count to init_loongson_params()
Propagate the %cpu_count from the machine file, allowing to remove the "hw/boards.h" dependency (which is machine specific) from loon
hw/mips/loongson3: Propagate cpu_count to init_loongson_params()
Propagate the %cpu_count from the machine file, allowing to remove the "hw/boards.h" dependency (which is machine specific) from loongson3_bootp.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20250115232952.31166-7-philmd@linaro.org>
show more ...
|
ce676896 | 12-Jan-2025 |
Philippe Mathieu-Daudé <philmd@linaro.org> |
hw/mips/loongson3_bootp: Include missing headers
MemMapEntry is declared in "exec/hwaddr.h", cpu_to_le32() in "qemu/bswap.h". These headers are indirectly included via "cpu.h". Include them explicit
hw/mips/loongson3_bootp: Include missing headers
MemMapEntry is declared in "exec/hwaddr.h", cpu_to_le32() in "qemu/bswap.h". These headers are indirectly included via "cpu.h". Include them explicitly in order to avoid when removing "cpu.h":
In file included from ../../hw/mips/loongson3_bootp.c:27: hw/mips/loongson3_bootp.h:234:14: error: unknown type name 'MemMapEntry' 234 | extern const MemMapEntry virt_memmap[]; | ^ hw/mips/loongson3_bootp.c:33:18: error: call to undeclared function 'cpu_to_le32'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 33 | c->cputype = cpu_to_le32(Loongson_3A); | ^
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20250115232952.31166-6-philmd@linaro.org>
show more ...
|
72a4da93 | 12-Jan-2025 |
Philippe Mathieu-Daudé <philmd@linaro.org> |
hw/mips/loongson3_virt: Pass CPU argument to get_cpu_freq_hz()
Pass the first vCPU as argument, allowing to remove another &first_cpu global use.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linar
hw/mips/loongson3_virt: Pass CPU argument to get_cpu_freq_hz()
Pass the first vCPU as argument, allowing to remove another &first_cpu global use.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20250115232952.31166-5-philmd@linaro.org>
show more ...
|
87fd8a80 | 12-Jan-2025 |
Philippe Mathieu-Daudé <philmd@linaro.org> |
hw/mips/loongson3_virt: Have fw_conf_init() access local loaderparams
'loaderparams' is declared statically. Let fw_conf_init() access its 'cpu_freq' and 'ram_size' fields.
Signed-off-by: Philippe
hw/mips/loongson3_virt: Have fw_conf_init() access local loaderparams
'loaderparams' is declared statically. Let fw_conf_init() access its 'cpu_freq' and 'ram_size' fields.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20250115232952.31166-4-philmd@linaro.org>
show more ...
|
2bf85456 | 12-Jan-2025 |
Philippe Mathieu-Daudé <philmd@linaro.org> |
hw/mips/loongson3_virt: Invert vCPU creation order to remove &first_cpu
Create vCPUs from the last one to the first one. No need to use the &first_cpu global since we already have it referenced.
Re
hw/mips/loongson3_virt: Invert vCPU creation order to remove &first_cpu
Create vCPUs from the last one to the first one. No need to use the &first_cpu global since we already have it referenced.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20250115232952.31166-3-philmd@linaro.org>
show more ...
|