Skip to content

Commit

Permalink
virtio: Fix the problem of incorrect setting of virtio queue address …
Browse files Browse the repository at this point in the history
…under tags kasan

There is also a printing error due to #15043:
Configuration/Tool: rv-virt/virt_nsh
In file included from virtio/virtio-mmio.c:29:
virtio/virtio-mmio.c: In function 'virtio_mmio_init_device':
Error: virtio/virtio-mmio.c:826:14: error: format '%d' expects argument of type 'int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
  826 |       vrterr("Version %d not supported!\n", vdev->id.version);
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~~~~~~~~
      |                                                     |
      |                                                     uint32_t {aka long unsigned int}
virtio/virtio-mmio.c:826:24: note: format string is defined here
  826 |       vrterr("Version %d not supported!\n", vdev->id.version);
      |                       ~^
      |                        |
      |                        int
      |                       %ld
cc1: all warnings being treated as errors
make[1]: *** [Makefile:109: virtio-mmio.o] Error 1
make[1]: Target 'libdrivers.a' not remade because of errors.

Signed-off-by: wangmingrong1 <[email protected]>
  • Loading branch information
W-M-R authored and xiaoxiang781216 committed Dec 5, 2024
1 parent 1ab1dbc commit 75fc19d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/virtio/virtio-mmio.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <sys/param.h>

#include <nuttx/arch.h>
#include <nuttx/mm/kasan.h>
#include <nuttx/virtio/virtio.h>
#include <nuttx/virtio/virtio-mmio.h>

Expand Down Expand Up @@ -342,15 +343,15 @@ static int virtio_mmio_config_virtqueue(FAR struct metal_io_region *io,
{
metal_io_write32(io, VIRTIO_MMIO_QUEUE_NUM, vq->vq_nentries);

addr = (uint64_t)(uintptr_t)vq->vq_ring.desc;
addr = (uint64_t)kasan_reset_tag((FAR void *)vq->vq_ring.desc);
metal_io_write32(io, VIRTIO_MMIO_QUEUE_DESC_LOW, addr);
metal_io_write32(io, VIRTIO_MMIO_QUEUE_DESC_HIGH, addr >> 32);

addr = (uint64_t)(uintptr_t)vq->vq_ring.avail;
addr = (uint64_t)kasan_reset_tag((FAR void *)vq->vq_ring.avail);
metal_io_write32(io, VIRTIO_MMIO_QUEUE_AVAIL_LOW, addr);
metal_io_write32(io, VIRTIO_MMIO_QUEUE_AVAIL_HIGH, addr >> 32);

addr = (uint64_t)(uintptr_t)vq->vq_ring.used;
addr = (uint64_t)kasan_reset_tag((FAR void *)vq->vq_ring.used);
metal_io_write32(io, VIRTIO_MMIO_QUEUE_USED_LOW, addr);
metal_io_write32(io, VIRTIO_MMIO_QUEUE_USED_HIGH, addr >> 32);

Expand Down Expand Up @@ -823,7 +824,7 @@ static int virtio_mmio_init_device(FAR struct virtio_mmio_device_s *vmdev,
vdev->id.version = metal_io_read32(&vmdev->cfg_io, VIRTIO_MMIO_VERSION);
if (vdev->id.version < 1 || vdev->id.version > 2)
{
vrterr("Version %d not supported!\n", vdev->id.version);
vrterr("Version %"PRIu32" not supported!\n", vdev->id.version);
return -ENODEV;
}

Expand Down

0 comments on commit 75fc19d

Please sign in to comment.