qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Song Gao <gaosong@loongson.cn>, qemu-devel@nongnu.org
Cc: Bibo Mao <maobibo@loongson.cn>
Subject: Re: [PULL 02/17] hw/loongarch: Add load initrd
Date: Sun, 28 Apr 2024 11:59:23 -0700	[thread overview]
Message-ID: <dd6d6a05-386f-4555-a3d7-d4f769fff81b@linaro.org> (raw)
In-Reply-To: <20240428085117.2422473-3-gaosong@loongson.cn>

On 4/28/24 01:51, Song Gao wrote:
> we load initrd ramdisk after kernel_high address
> 
> Signed-off-by: Song Gao <gaosong@loongson.cn>
> Reviewed-by: Bibo Mao <maobibo@loongson.cn>
> Message-Id: <20240426091551.2397867-3-gaosong@loongson.cn>
> ---
>   hw/loongarch/boot.c | 29 ++++++++++++++++++++++++++++-
>   1 file changed, 28 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/loongarch/boot.c b/hw/loongarch/boot.c
> index 9feed17db3..a9522d6912 100644
> --- a/hw/loongarch/boot.c
> +++ b/hw/loongarch/boot.c
> @@ -22,7 +22,8 @@ static uint64_t cpu_loongarch_virt_to_phys(void *opaque, uint64_t addr)
>   
>   static int64_t load_kernel_info(struct loongarch_boot_info *info)
>   {
> -    uint64_t kernel_entry, kernel_low, kernel_high;
> +    uint64_t kernel_entry, kernel_low, kernel_high, initrd_size;
> +    ram_addr_t initrd_offset;
>       ssize_t kernel_size;
>   
>       kernel_size = load_elf(info->kernel_filename, NULL,
> @@ -37,6 +38,32 @@ static int64_t load_kernel_info(struct loongarch_boot_info *info)
>                        load_elf_strerror(kernel_size));
>           exit(1);
>       }
> +
> +    if (info->initrd_filename) {
> +        initrd_size = get_image_size(info->initrd_filename);
> +        if (initrd_size > 0) {
> +            initrd_offset = ROUND_UP(kernel_high + 4 * kernel_size, 64 * KiB);
> +
> +            if (initrd_offset + initrd_size > info->ram_size) {
> +                error_report("memory too small for initial ram disk '%s'",
> +                             info->initrd_filename);
> +                exit(1);
> +            }
> +
> +            initrd_size = load_image_targphys(info->initrd_filename, initrd_offset,
> +                                              info->ram_size - initrd_offset);
> +        }
> +
> +        if (initrd_size == (target_ulong)-1) {
> +            error_report("could not load initial ram disk '%s'",
> +                         info->initrd_filename);
> +            exit(1);
> +        }
> +    } else {
> +        error_report("Need initrd!");
> +        exit(1);
> +    }
> +
>       return kernel_entry;
>   }
>   

This doesn't simply allow initrd, it requires an initrd.
This causes make check-tcg to fail:

>   TEST    interrupt on loongarch64
> qemu-system-loongarch64: Need initrd!

https://gitlab.com/qemu-project/qemu/-/jobs/6733983794


r~


  reply	other threads:[~2024-04-28 19:00 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-28  8:51 [PULL 00/17] loongarch-to-apply queue Song Gao
2024-04-28  8:51 ` [PULL 01/17] hw/loongarch: Move boot functions to boot.c Song Gao
2024-04-28  8:51 ` [PULL 02/17] hw/loongarch: Add load initrd Song Gao
2024-04-28 18:59   ` Richard Henderson [this message]
2024-04-29  2:44     ` gaosong
2024-04-28  8:51 ` [PULL 03/17] hw/loongarch: Add slave cpu boot_code Song Gao
2024-04-28  8:51 ` [PULL 04/17] hw/loongarch: Add init_cmdline Song Gao
2024-04-28  8:51 ` [PULL 05/17] hw/loongarch: Init efi_system_table Song Gao
2024-04-28  8:51 ` [PULL 06/17] hw/loongarch: Init efi_boot_memmap table Song Gao
2024-04-28  8:51 ` [PULL 07/17] hw/loongarch: Init efi_initrd table Song Gao
2024-04-28  8:51 ` [PULL 08/17] hw/loongarch: Init efi_fdt table Song Gao
2024-04-28  8:51 ` [PULL 09/17] hw/loongarch: Fix fdt memory node wrong 'reg' Song Gao
2024-04-28  8:51 ` [PULL 10/17] hw/loongarch: fdt adds cpu interrupt controller node Song Gao
2024-04-28  8:51 ` [PULL 11/17] hw/loongarch: fdt adds Extend I/O Interrupt Controller Song Gao
2024-04-28  8:51 ` [PULL 12/17] hw/loongarch: fdt adds pch_pic Controller Song Gao
2024-04-28  8:51 ` [PULL 13/17] hw/loongarch: fdt adds pch_msi Controller Song Gao
2024-04-28  8:51 ` [PULL 14/17] hw/loongarch: fdt adds pcie irq_map node Song Gao
2024-04-28  8:51 ` [PULL 15/17] hw/loongarch: fdt remove unused irqchip node Song Gao
2024-04-28  8:51 ` [PULL 16/17] hw/loongarch: Add cells missing from uart node Song Gao
2024-04-28  8:51 ` [PULL 17/17] hw/loongarch: Add cells missing from rtc node Song Gao
  -- strict thread matches above, loose matches on Subject: below --
2024-03-07 14:51 [PULL 00/17] loongarch-to-apply queue Song Gao
2024-03-07 14:51 ` [PULL 02/17] hw/loongarch: Add load initrd Song Gao

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=dd6d6a05-386f-4555-a3d7-d4f769fff81b@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=gaosong@loongson.cn \
    --cc=maobibo@loongson.cn \
    --cc=qemu-devel@nongnu.org \
    /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).