qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, qemu-devel@nongnu.org
Cc: figlesia@xilinx.com, peter.maydell@linaro.org,
	sstabellini@kernel.org, edgar.iglesias@xilinx.com,
	sai.pavan.boddu@xilinx.com, frasse.iglesias@gmail.com,
	alistair@alistair23.me, richard.henderson@linaro.org,
	frederic.konrad@adacore.com, qemu-arm@nongnu.org,
	luc.michel@greensocs.com
Subject: Re: [PATCH v1 1/2] dma/xlnx-zdma: Fix descriptor loading (MEM) wrt endianness
Date: Tue, 7 Apr 2020 13:12:27 +0200	[thread overview]
Message-ID: <e447464e-eeb9-3024-fc52-6e03dcb79a17@redhat.com> (raw)
In-Reply-To: <20200404122718.25111-2-edgar.iglesias@gmail.com>

On 4/4/20 2:27 PM, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> 
> Fix descriptor loading from memory wrt host endianness.
> 
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> ---
>   hw/dma/xlnx-zdma.c | 11 +++++++----
>   1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/dma/xlnx-zdma.c b/hw/dma/xlnx-zdma.c
> index 1c45367f3c..5f4775f663 100644
> --- a/hw/dma/xlnx-zdma.c
> +++ b/hw/dma/xlnx-zdma.c
> @@ -299,19 +299,22 @@ static void zdma_put_regaddr64(XlnxZDMA *s, unsigned int basereg, uint64_t addr)
>       s->regs[basereg + 1] = addr >> 32;
>   }
>   
> -static bool zdma_load_descriptor(XlnxZDMA *s, uint64_t addr, void *buf)
> +static bool zdma_load_descriptor(XlnxZDMA *s, uint64_t addr,
> +                                 XlnxZDMADescr *descr)
>   {
>       /* ZDMA descriptors must be aligned to their own size.  */
>       if (addr % sizeof(XlnxZDMADescr)) {
>           qemu_log_mask(LOG_GUEST_ERROR,
>                         "zdma: unaligned descriptor at %" PRIx64,
>                         addr);
> -        memset(buf, 0x0, sizeof(XlnxZDMADescr));
> +        memset(descr, 0x0, sizeof(XlnxZDMADescr));
>           s->error = true;
>           return false;
>       }
>   
> -    address_space_read(s->dma_as, addr, s->attr, buf, sizeof(XlnxZDMADescr));
> +    descr->addr = address_space_ldq_le(s->dma_as, addr, s->attr, NULL);
> +    descr->size = address_space_ldl_le(s->dma_as, addr + 8, s->attr, NULL);
> +    descr->attr = address_space_ldl_le(s->dma_as, addr + 12, s->attr, NULL);

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

>       return true;
>   }
>   
> @@ -344,7 +347,7 @@ static void zdma_update_descr_addr(XlnxZDMA *s, bool type,
>       } else {
>           addr = zdma_get_regaddr64(s, basereg);
>           addr += sizeof(s->dsc_dst);
> -        address_space_read(s->dma_as, addr, s->attr, (void *) &next, 8);
> +        next = address_space_ldq_le(s->dma_as, addr, s->attr, NULL);
>       }
>   
>       zdma_put_regaddr64(s, basereg, next);
> 



  parent reply	other threads:[~2020-04-07 11:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-04 12:27 [PATCH v1 0/2] dma/xlnx-zdma: Fix descriptor loading wrt host endianness Edgar E. Iglesias
2020-04-04 12:27 ` [PATCH v1 1/2] dma/xlnx-zdma: Fix descriptor loading (MEM) wrt endianness Edgar E. Iglesias
2020-04-06 10:01   ` Francisco Iglesias
2020-04-07 11:12   ` Philippe Mathieu-Daudé [this message]
2020-04-04 12:27 ` [PATCH v1 2/2] dma/xlnx-zdma: Fix descriptor loading (REG) " Edgar E. Iglesias
2020-04-06  9:53   ` Francisco Iglesias
2020-04-16 16:42 ` [PATCH v1 0/2] dma/xlnx-zdma: Fix descriptor loading wrt host endianness Peter Maydell

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=e447464e-eeb9-3024-fc52-6e03dcb79a17@redhat.com \
    --to=philmd@redhat.com \
    --cc=alistair@alistair23.me \
    --cc=edgar.iglesias@gmail.com \
    --cc=edgar.iglesias@xilinx.com \
    --cc=figlesia@xilinx.com \
    --cc=frasse.iglesias@gmail.com \
    --cc=frederic.konrad@adacore.com \
    --cc=luc.michel@greensocs.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=sai.pavan.boddu@xilinx.com \
    --cc=sstabellini@kernel.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).