All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: "Kevin Wolf" <kwolf@redhat.com>,
	"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	Qemu-block <qemu-block@nongnu.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"QEMU Trivial" <qemu-trivial@nongnu.org>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	"Max Reitz" <mreitz@redhat.com>,
	"Max Filippov" <jcmvbkbc@gmail.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Aurelien Jarno" <aurelien@aurel32.net>
Subject: Re: [PATCH 0/4] hw/block/pflash_cfi01: Remove pflash_cfi01_get_memory()
Date: Tue, 7 Sep 2021 16:06:08 +0100	[thread overview]
Message-ID: <CAFEAcA-6+S1Ugh56wac02AnUdnbHftq0aYozHs5Yyq0vkX-usA@mail.gmail.com> (raw)
In-Reply-To: <db4abdf8-bbc7-ae63-a7a7-8496a4ed8dbd@amsat.org>

On Tue, 7 Sept 2021 at 15:45, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> The problems I see:
>
> - pflash_cfi01_get_memory() doesn't really document what it returns,
>   simply an internal MemoryRegion* in pflash device. Neither we
>   document this is a ROMD device providing a RAM buffer initialized
>   by qemu_ram_alloc().
>
> - to update the flash content, we get the internal buffer via
>   memory_region_get_ram_ptr(). If the pflash implementation is
>   changed (.i.e. reworked to expose a MR container) we break
>   everything.
>
> - memory_region_get_ram_ptr() doesn't do any check on the MR type,
>   it simply calls qemu_map_ram_ptr(mr->ram_block, offset).

Using memory_region_get_ram_ptr() is tricky to get right, too --
if you're writing directly to the underlying ram while the system is
running you need to use memory_region_flush_rom_device() to make
sure it's marked dirty. I think the current users of this on the
pflash devices get away with it because they do it during initial
machine init.

-- PMM


      reply	other threads:[~2021-09-07 15:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-07 22:26 [PATCH 0/4] hw/block/pflash_cfi01: Remove pflash_cfi01_get_memory() Philippe Mathieu-Daudé
2021-03-07 22:26 ` [PATCH 1/4] hw/i386/pc: Get pflash MemoryRegion with sysbus_mmio_get_region() Philippe Mathieu-Daudé
2021-03-09 11:01   ` Philippe Mathieu-Daudé
2021-03-07 22:26 ` [PATCH 2/4] hw/mips/malta: " Philippe Mathieu-Daudé
2021-03-07 22:26 ` [PATCH 3/4] hw/xtensa/xtfpga: " Philippe Mathieu-Daudé
2021-03-08  8:20   ` Max Filippov
2021-03-07 22:26 ` [PATCH 4/4] hw/block/pflash_cfi01: Remove pflash_cfi01_get_memory() Philippe Mathieu-Daudé
2021-03-15 11:30 ` [PATCH 0/4] " Paolo Bonzini
2021-03-15 12:08   ` Peter Maydell
2021-09-07 14:44     ` Philippe Mathieu-Daudé
2021-09-07 15:06       ` Peter Maydell [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=CAFEAcA-6+S1Ugh56wac02AnUdnbHftq0aYozHs5Yyq0vkX-usA@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=aleksandar.rikalo@syrmia.com \
    --cc=aurelien@aurel32.net \
    --cc=ehabkost@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=jcmvbkbc@gmail.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=richard.henderson@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.