All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] xhci: Fix some DMA host endian bugs
Date: Fri, 02 Nov 2012 08:31:23 +0100	[thread overview]
Message-ID: <509376CB.8000905@redhat.com> (raw)
In-Reply-To: <1351823524-7149-1-git-send-email-david@gibson.dropbear.id.au>

  Hi,

> +static inline void xhci_dma_write_u32s(XHCIState *xhci, dma_addr_t addr,
> +                                       uint32_t *buf, size_t len)
> +{
> +    int i;
> +
> +    for (i = 0; i < (len / sizeof(uint32_t)); i++) {
> +        buf[i] = cpu_to_le32(buf[i]);
> +    }
> +    pci_dma_write(&xhci->pci_dev, addr, buf, len);
> +}

I think we should use a temporary buffer here, otherwise you leave the
values byteswapped in buf which likely has unwanted side effects.

cheers,
  Gerd

  reply	other threads:[~2012-11-02  7:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-02  2:32 [Qemu-devel] [PATCH] xhci: Fix some DMA host endian bugs David Gibson
2012-11-02  7:31 ` Gerd Hoffmann [this message]
2012-11-02  8:43   ` David Gibson
2012-11-05  4:20   ` David Gibson
2012-11-05 10:20     ` Gerd Hoffmann
2012-11-08 15:08       ` [Qemu-devel] xhci and ehci qemu emulation performance Stefano Panella
2012-11-08 15:20         ` Gerd Hoffmann
2012-11-08 15:32           ` Stefano Panella
2012-11-08 18:26             ` Gerd Hoffmann

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=509376CB.8000905@redhat.com \
    --to=kraxel@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=qemu-devel@nongnu.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.