qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Sunil V L <sunilvl@ventanamicro.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
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>
Subject: Re: [PATCH v4 2/3] riscv/virt: Support using pflash via -blockdev option
Date: Fri, 26 May 2023 15:50:22 +0530	[thread overview]
Message-ID: <ZHCH5mouRT5KdMt5@sunil-laptop> (raw)
In-Reply-To: <dbfd6f2a-1ff4-7baf-8ff4-0d47a97f5ff4@linaro.org>

On Fri, May 26, 2023 at 11:53:18AM +0200, Philippe Mathieu-Daudé wrote:
> On 25/5/23 18:48, Sunil V L wrote:
> > Currently, pflash devices can be configured only via -pflash
> > or if=pflash options. This is the legacy way and the
> > better way is to use -blockdev as in other architectures.
> > libvirt also has moved to -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>
> > ---
> >   hw/riscv/virt.c | 15 +++++++++------
> >   1 file changed, 9 insertions(+), 6 deletions(-)
> 
> 
> > @@ -1265,21 +1267,22 @@ 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) {
> > +        flash_mem = pflash_cfi01_get_memory(s->flash[0]);
> >           if (machine->firmware && !strcmp(machine->firmware, "none")) {
> >               /*
> >                * Pflash was supplied but bios is none, let's overwrite the
> >                * address we jump to after reset to the base of the flash.
> >                */
> > -            start_addr = virt_memmap[VIRT_FLASH].base;
> > +            start_addr = flash_mem->addr;
> 
> I don't understand this change. Besides you access MemoryRegion::addr
> which is an internal API field.
> 
Thanks Philip. This is not really required. I was trying to avoid
depending on memmap base addresses and dividing the memmap
range by 2 to get the second flash memory base etc. Since we have
created MemoryRegion already which has the actual base address for each
pflash, I was thinking to avoid this hardcoding. But I didn't realize I
am accessing the internal field.

Let me revert this particular change.

Thanks,
Sunil


  reply	other threads:[~2023-05-26 10:21 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-25 16:48 [PATCH v4 0/3] hw/riscv/virt: pflash improvements Sunil V L
2023-05-25 16:48 ` [PATCH v4 1/3] hw/riscv: virt: Assume M-mode FW in pflash0 only when "-bios none" Sunil V L
2023-05-25 16:48 ` [PATCH v4 2/3] riscv/virt: Support using pflash via -blockdev option Sunil V L
2023-05-26  9:53   ` Philippe Mathieu-Daudé
2023-05-26 10:20     ` Sunil V L [this message]
2023-05-25 16:48 ` [PATCH v4 3/3] docs/system: riscv: Add pflash usage details Sunil V L
2023-05-26  9:48   ` Philippe Mathieu-Daudé
2023-05-25 18:03 ` [PATCH v4 0/3] hw/riscv/virt: pflash improvements Andrea Bolognani
2023-05-26  6:39   ` Andrew Jones
2023-05-26  7:49     ` Andrea Bolognani
2023-05-26  8:19       ` Sunil V L
2023-05-26  8:34       ` Andrew Jones
2023-05-26  8:42         ` Andrea Bolognani
2023-05-26  9:10           ` Andrew Jones
2023-11-20 14:29             ` Andrea Bolognani
2023-11-20 14:36               ` Sunil V L
2024-05-30 11:37                 ` Andrea Bolognani
2024-05-31 13:18                   ` Sunil V L

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=ZHCH5mouRT5KdMt5@sunil-laptop \
    --to=sunilvl@ventanamicro.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=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).