From: Alistair Francis <alistair23@gmail.com>
To: Sunil V L <sunilvl@ventanamicro.com>
Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Alistair Francis" <alistair.francis@wdc.com>,
"Bin Meng" <bin.meng@windriver.com>,
"Weiwei Li" <liweiwei@iscas.ac.cn>,
"Daniel Henrique Barboza" <dbarboza@ventanamicro.com>,
"Liu Zhiwei" <zhiwei_liu@linux.alibaba.com>,
"Andrea Bolognani" <abologna@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: Re: [PATCH v7 2/3] riscv/virt: Support using pflash via -blockdev option
Date: Thu, 1 Jun 2023 15:33:45 +1000 [thread overview]
Message-ID: <CAKmqyKNKDhYhAmkdB5PkOAD-goANOka78XbnALktxbdPkqqHYg@mail.gmail.com> (raw)
In-Reply-To: <20230601045910.18646-3-sunilvl@ventanamicro.com>
On Thu, Jun 1, 2023 at 3:01 PM Sunil V L <sunilvl@ventanamicro.com> wrote:
>
> Currently, pflash devices can be configured only via -pflash
> or -drive options. This is the legacy way and the
> better way is to use -blockdev as in other architectures.
> libvirt also has moved to use -blockdev method.
>
> To support -blockdev option, pflash devices need to be
> created in instance_init itself. So, update the code to
> move the virt_flash_create() to instance_init. Also, use
> standard interfaces to detect whether pflash0 is
> configured or not.
>
> Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
> Reported-by: Andrea Bolognani <abologna@redhat.com>
> Tested-by: Andrea Bolognani <abologna@redhat.com>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
> hw/riscv/virt.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
> index 3e5dc649c3..76c7a3ba3b 100644
> --- a/hw/riscv/virt.c
> +++ b/hw/riscv/virt.c
> @@ -1246,6 +1246,7 @@ static void virt_machine_done(Notifier *notifier, void *data)
> const char *firmware_name = riscv_default_firmware_name(&s->soc[0]);
> uint32_t fdt_load_addr;
> uint64_t kernel_entry = 0;
> + BlockBackend *pflash_blk0;
>
> /*
> * Only direct boot kernel is currently supported for KVM VM,
> @@ -1266,7 +1267,8 @@ static void virt_machine_done(Notifier *notifier, void *data)
> firmware_end_addr = riscv_find_and_load_firmware(machine, firmware_name,
> start_addr, NULL);
>
> - if (drive_get(IF_PFLASH, 0, 0)) {
> + pflash_blk0 = pflash_cfi01_get_blk(s->flash[0]);
> + if (pflash_blk0) {
> if (machine->firmware && !strcmp(machine->firmware, "none") &&
> !kvm_enabled()) {
> /*
> @@ -1499,8 +1501,6 @@ static void virt_machine_init(MachineState *machine)
> sysbus_create_simple("goldfish_rtc", memmap[VIRT_RTC].base,
> qdev_get_gpio_in(DEVICE(mmio_irqchip), RTC_IRQ));
>
> - virt_flash_create(s);
> -
> for (i = 0; i < ARRAY_SIZE(s->flash); i++) {
> /* Map legacy -drive if=pflash to machine properties */
> pflash_cfi01_legacy_drive(s->flash[i],
> @@ -1527,6 +1527,8 @@ static void virt_machine_instance_init(Object *obj)
> {
> RISCVVirtState *s = RISCV_VIRT_MACHINE(obj);
>
> + virt_flash_create(s);
> +
> s->oem_id = g_strndup(ACPI_BUILD_APPNAME6, 6);
> s->oem_table_id = g_strndup(ACPI_BUILD_APPNAME8, 8);
> s->acpi = ON_OFF_AUTO_AUTO;
> --
> 2.34.1
>
>
next prev parent reply other threads:[~2023-06-01 5:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-01 4:59 [PATCH v7 0/3] hw/riscv/virt: pflash improvements Sunil V L
2023-06-01 4:59 ` [PATCH v7 1/3] hw/riscv: virt: Assume M-mode FW in pflash0 only when "-bios none" Sunil V L
2023-06-01 4:59 ` [PATCH v7 2/3] riscv/virt: Support using pflash via -blockdev option Sunil V L
2023-06-01 5:33 ` Alistair Francis [this message]
2023-06-01 4:59 ` [PATCH v7 3/3] docs/system: riscv: Add pflash usage details Sunil V L
2023-06-01 5:33 ` Alistair Francis
2023-06-02 2:11 ` [PATCH v7 0/3] hw/riscv/virt: pflash improvements Alistair Francis
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=CAKmqyKNKDhYhAmkdB5PkOAD-goANOka78XbnALktxbdPkqqHYg@mail.gmail.com \
--to=alistair23@gmail.com \
--cc=abologna@redhat.com \
--cc=alistair.francis@wdc.com \
--cc=bin.meng@windriver.com \
--cc=dbarboza@ventanamicro.com \
--cc=liweiwei@iscas.ac.cn \
--cc=palmer@dabbelt.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=sunilvl@ventanamicro.com \
--cc=zhiwei_liu@linux.alibaba.com \
/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).