On Tue, Mar 09, 2021 at 11:43:13PM +0100, Laurent Vivier wrote: > read[wl]()/write[wl] already access memory in little-endian mode. But then they convert it to CPU right? We just convert it back ... > No need to convert the value with cpu_to_leXX()/leXX_to_cpu() > > Signed-off-by: Laurent Vivier <laurent@xxxxxxxxx> > --- > drivers/virtio/virtio_mmio.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c > index a286d22b6551..3f6a5588f77d 100644 > --- a/drivers/virtio/virtio_mmio.c > +++ b/drivers/virtio/virtio_mmio.c > @@ -168,17 +168,17 @@ static void vm_get(struct virtio_device *vdev, unsigned offset, > memcpy(buf, &b, sizeof b); > break; > case 2: > - w = cpu_to_le16(readw(base + offset)); > + w = readw(base + offset); > memcpy(buf, &w, sizeof w); > break; > case 4: > - l = cpu_to_le32(readl(base + offset)); > + l = readl(base + offset); > memcpy(buf, &l, sizeof l); > break; > case 8: > - l = cpu_to_le32(readl(base + offset)); > + l = readl(base + offset); > memcpy(buf, &l, sizeof l); > - l = cpu_to_le32(ioread32(base + offset + sizeof l)); > + l = ioread32(base + offset + sizeof l); > memcpy(buf + sizeof l, &l, sizeof l); > break; > default: > @@ -212,17 +212,17 @@ static void vm_set(struct virtio_device *vdev, unsigned offset, > break; > case 2: > memcpy(&w, buf, sizeof w); > - writew(le16_to_cpu(w), base + offset); > + writew(w, base + offset); > break; > case 4: > memcpy(&l, buf, sizeof l); > - writel(le32_to_cpu(l), base + offset); > + writel(l, base + offset); > break; > case 8: > memcpy(&l, buf, sizeof l); > - writel(le32_to_cpu(l), base + offset); > + writel(l, base + offset); > memcpy(&l, buf + sizeof l, sizeof l); > - writel(le32_to_cpu(l), base + offset + sizeof l); > + writel(l, base + offset + sizeof l); > break; > default: > BUG(); > -- > 2.29.2 _______________________________________________ Virtualization mailing list Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linuxfoundation.org/mailman/listinfo/virtualization