[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] xhci: Fix some DMA host endian bugs
From: |
David Gibson |
Subject: |
Re: [Qemu-devel] [PATCH] xhci: Fix some DMA host endian bugs |
Date: |
Fri, 2 Nov 2012 19:43:03 +1100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Fri, Nov 02, 2012 at 08:31:23AM +0100, Gerd Hoffmann wrote:
> 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.
Yeah, I wondered about that. I did check that the side-effect doesn't
matter in any of the existing callers, so I left it that way to avoid
the extra copies. But you're right, it's a pretty subtle constraint
that could easily be broken by future changes.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
- [Qemu-devel] [PATCH] xhci: Fix some DMA host endian bugs, David Gibson, 2012/11/01
- Re: [Qemu-devel] [PATCH] xhci: Fix some DMA host endian bugs, Gerd Hoffmann, 2012/11/02
- Re: [Qemu-devel] [PATCH] xhci: Fix some DMA host endian bugs,
David Gibson <=
- Re: [Qemu-devel] [PATCH] xhci: Fix some DMA host endian bugs, David Gibson, 2012/11/04
- Re: [Qemu-devel] [PATCH] xhci: Fix some DMA host endian bugs, Gerd Hoffmann, 2012/11/05
- [Qemu-devel] xhci and ehci qemu emulation performance, Stefano Panella, 2012/11/08
- Re: [Qemu-devel] xhci and ehci qemu emulation performance, Gerd Hoffmann, 2012/11/08
- Re: [Qemu-devel] xhci and ehci qemu emulation performance, Stefano Panella, 2012/11/08
- Re: [Qemu-devel] xhci and ehci qemu emulation performance, Gerd Hoffmann, 2012/11/08