[PATCH 1/2] virtio: ring: fix erroneous behavior on MIPS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



How to reproduce the crash on the 64-bit malta board:

    export ARCH=mips
    export CROSS_COMPILE=mips-linux-gnu-
    make qemu-malta64el_defconfig
    sed -i "s/# \(CONFIG_DRIVER_NET_VIRTIO\).*$/\1=y/" .config
    make oldconfig
    make
    ...
    qemu-system-mips64el -m 256 -M malta -cpu MIPS64R2-generic \
        -bios ./images/barebox-qemu-malta.img.swapped \
        -nodefaults -nographic \
        -serial mon:stdio \
        -net nic,model=virtio-net-pci -net user
    ...
    barebox@qemu malta:/ dhcp
    WARNING: eth0: No MAC address set. Using random address 9e:85:56:74:55:bb

    Ooops, TLB miss on load or ifetch!

    $ 0   : 0000000000000000 0000000000000004 000000000000000c 0000000000000001
    $ 4   : ffffffffafb7fee8 000000000fb7402c 000000000000024e 0000000000000020
    $ 8   : 0000000000000001 0000000000000001 0000000000000110 ffffffffafba6df0
    $12   : 0000000000000008 ffffffffaffc9584 0000000000000001 646e617220676e69
    $16   : ffffffffafb7fee8 ffffffffafb6fee8 00000000b2d05e00 ffffffffaffeb090
    $20   : ffffffffafb800c0 0000000000000100 0000000000000122 ffffffffafb800f0
    $24   : 0000000000000006 ffffffffaff93974
    $28   : 0000000000000000 ffffffffafb5f9f0 ffffffffafff0000 ffffffffaff7a6e4
    Hi    : 0000000000000000
    Lo    : 000235e8a8000000
    epc   : ffffffffaffb5db0
    ra    : ffffffffaff7a6e4
    Status: 00000082
    Cause : 00000408
    Config: 80004482
    BadVA : 000000000fb74039

Signed-off-by: Antony Pavlov <antonynpavlov@xxxxxxxxx>
---
 drivers/virtio/virtio_ring.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index fd21d3adcdb..0efe1e00250 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -256,8 +256,8 @@ void *virtqueue_get_buf(struct virtqueue *vq, unsigned int *len)
 		virtio_store_mb(&vring_used_event(&vq->vring),
 				cpu_to_virtio16(vq->vdev, vq->last_used_idx));
 
-	return (void *)(uintptr_t)virtio64_to_cpu(vq->vdev,
-						  vq->vring.desc[i].addr);
+	return IOMEM((uintptr_t)virtio64_to_cpu(vq->vdev,
+						  vq->vring.desc[i].addr));
 }
 
 static struct virtqueue *__vring_new_virtqueue(unsigned int index,
-- 
2.39.0





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux