All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Stefano Garzarella <sgarzare@redhat.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Laurent Vivier" <laurent@vivier.eu>,
	"QEMU Developers" <qemu-devel@nongnu.org>
Subject: Re: [PATCH v2 1/2] exec/memory: Extract address_space_set() from dma_memory_set()
Date: Thu, 15 Apr 2021 12:05:07 +0100	[thread overview]
Message-ID: <CAFEAcA9=hGVPgN0bCcgkRmqGG-ouHwz09VxXHBH-eyToWugRPA@mail.gmail.com> (raw)
In-Reply-To: <20210415110047.ku3uqj5evcprs77r@steredhat>

On Thu, 15 Apr 2021 at 12:00, Stefano Garzarella <sgarzare@redhat.com> wrote:
>
> On Thu, Apr 15, 2021 at 12:04:08PM +0200, Philippe Mathieu-Daudé wrote:
> >dma_memory_set() does a DMA barrier, set the address space with
> >a constant value. The constant value filling code is not specific
> >to DMA and can be used for AddressSpace. Extract it as a new
> >helper: address_space_set().

> >
> >+MemTxResult address_space_set(AddressSpace *as, hwaddr addr,
> >+                              uint8_t c, hwaddr len, MemTxAttrs attrs)
> >+{
> >+#define FILLBUF_SIZE 512
> >+    uint8_t fillbuf[FILLBUF_SIZE];
> >+    int l;
> >+    MemTxResult error = MEMTX_OK;
> >+
> >+    memset(fillbuf, c, FILLBUF_SIZE);
> >+    while (len > 0) {
>
> What about return immediately if there is an error?
> I mean:
>      while (len > 0 && result == MEMTX_OK) {

I think that (a) we're just moving code here so we don't want to also
change semantics; (b) there's a comment in memattrs.h that says
 * A zero (MEMTX_OK) response means success; anything else is a failure
 * of some kind. The memory subsystem will bitwise-OR together results
 * if it is synthesizing an operation from multiple smaller accesses.

so in this function "keep going but merge errors" is in keeping with that
principle.

thanks
-- PMM


  reply	other threads:[~2021-04-15 11:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-15 10:04 [PATCH v2 0/2] hw/elf_ops: clear uninitialized segment space Philippe Mathieu-Daudé
2021-04-15 10:04 ` [PATCH v2 1/2] exec/memory: Extract address_space_set() from dma_memory_set() Philippe Mathieu-Daudé
2021-04-15 10:46   ` Laurent Vivier
2021-04-15 11:00   ` Stefano Garzarella
2021-04-15 11:05     ` Peter Maydell [this message]
2021-04-15 11:18       ` Stefano Garzarella
2021-04-15 22:32   ` Richard Henderson
2021-04-15 10:04 ` [PATCH v2 2/2] hw/elf_ops: clear uninitialized segment space Philippe Mathieu-Daudé
2021-04-15 11:02   ` Stefano Garzarella
2021-04-15 13:26   ` Laurent Vivier
2021-04-15 22:33   ` Richard Henderson
2021-04-17 15:36   ` Laurent Vivier

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='CAFEAcA9=hGVPgN0bCcgkRmqGG-ouHwz09VxXHBH-eyToWugRPA@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=laurent@vivier.eu \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sgarzare@redhat.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 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.