mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Antony Pavlov <antonynpavlov@gmail.com>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 1/2] virtio: ring: fix erroneous behavior on MIPS
Date: Fri, 24 Nov 2023 09:01:29 +0300	[thread overview]
Message-ID: <20231124060130.1205927-2-antonynpavlov@gmail.com> (raw)
In-Reply-To: <20231124060130.1205927-1-antonynpavlov@gmail.com>

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@gmail.com>
---
 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




  reply	other threads:[~2023-11-24  6:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-24  6:01 [PATCH 0/2] " Antony Pavlov
2023-11-24  6:01 ` Antony Pavlov [this message]
2023-11-24  6:01 ` [PATCH 2/2] MIPS: qemu-malta*_defconfig: enable virtio network driver Antony Pavlov
2023-11-27  7:21 ` [PATCH 0/2] virtio: ring: fix erroneous behavior on MIPS Sascha Hauer

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=20231124060130.1205927-2-antonynpavlov@gmail.com \
    --to=antonynpavlov@gmail.com \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.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