From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: "Thomas Weißschuh" <thomas@t-8ch.de>, qemu-devel@nongnu.org
Cc: Xiaojuan Yang <yangxiaojuan@loongson.cn>, Song Gao <gaosong@loongson.cn>
Subject: Re: [PATCH] hw/loongarch: remove global loaderparams variable
Date: Tue, 10 Oct 2023 07:17:11 +0200 [thread overview]
Message-ID: <759ca43d-6769-4455-e8eb-abcda6c85867@linaro.org> (raw)
In-Reply-To: <20231009210018.249776-1-thomas@t-8ch.de>
Hi Thomas,
On 9/10/23 23:00, Thomas Weißschuh wrote:
> Passing the struct around explicitly makes the control-flow more
> obvious.
>
> Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
> ---
> hw/loongarch/virt.c | 50 ++++++++++++++++++++++++---------------------
> 1 file changed, 27 insertions(+), 23 deletions(-)
> -static void loongarch_direct_kernel_boot(LoongArchMachineState *lams)
> +static void loongarch_direct_kernel_boot(LoongArchMachineState *lams,
> + const struct loaderparams *loaderparams)
> {
> MachineState *machine = MACHINE(lams);
> int64_t kernel_addr = 0;
> LoongArchCPU *lacpu;
> int i;
>
> - kernel_addr = load_kernel_info();
> + kernel_addr = load_kernel_info(loaderparams);
> if (!machine->firmware) {
> for (i = 0; i < machine->smp.cpus; i++) {
> lacpu = LOONGARCH_CPU(qemu_get_cpu(i));
> @@ -793,6 +796,7 @@ static void loongarch_init(MachineState *machine)
> MachineClass *mc = MACHINE_GET_CLASS(machine);
> CPUState *cpu;
> char *ramName = NULL;
> + struct loaderparams loaderparams;
Please zero-initialize with '= { }', otherwise great!
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>
> if (!cpu_model) {
> cpu_model = LOONGARCH_CPU_TYPE_NAME("la464");
> @@ -898,9 +902,9 @@ static void loongarch_init(MachineState *machine)
> /* load the kernel. */
> if (loaderparams.kernel_filename) {
> if (lams->bios_loaded) {
> - loongarch_firmware_boot(lams);
> + loongarch_firmware_boot(lams, &loaderparams);
> } else {
> - loongarch_direct_kernel_boot(lams);
> + loongarch_direct_kernel_boot(lams, &loaderparams);
> }
> }
> fdt_add_flash_node(lams);
>
> base-commit: 2f3913f4b2ad74baeb5a6f1d36efbd9ecdf1057d
prev parent reply other threads:[~2023-10-10 5:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-09 21:00 [PATCH] hw/loongarch: remove global loaderparams variable Thomas Weißschuh
2023-10-10 5:17 ` Philippe Mathieu-Daudé [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=759ca43d-6769-4455-e8eb-abcda6c85867@linaro.org \
--to=philmd@linaro.org \
--cc=gaosong@loongson.cn \
--cc=qemu-devel@nongnu.org \
--cc=thomas@t-8ch.de \
--cc=yangxiaojuan@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).