qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] error "kvm: virtio: trying to map MMIO memory"
@ 2011-07-17 18:06 Stéphanie Ouillon
  2011-07-18 12:16 ` Stefan Hajnoczi
  0 siblings, 1 reply; 3+ messages in thread
From: Stéphanie Ouillon @ 2011-07-17 18:06 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1079 bytes --]

Hello,

I am porting virtio device drivers for DragonFly BSD for a GSoC project. [1]

I have been facing a problem for 3-4 days with my virtio network device 
driver in qemu: when I load the driver, I get the following error:
kvm: virtio: trying to map MMIO memory

And then the machine crashes immediately (I started the vm in a screen 
to see this message).

It seems to be linked with the call of a bus_space_write_2 function [2] 
inside a virtio_enqueue_commit function in virtio.c [3]. But without 
more information about this type of error message (I found some patches 
or bug reports on the net, but I am not sure they match in my case), I 
found it difficult to locate it.

Would anybody have a clue about what kind of bug would provoke this 
error in qemu ?


Thank you !


Stéphanie Ouillon


[1] http://github.com/arroway/virtio_DragonFlyBSD/tree/dev-net/net
[2] source code in DragonFly BSD 
http://fxr.watson.org/fxr/source/cpu/i386/include/bus_at386.h?v=DFBSD;im=bigexcerpts#L887
[3] at l.465: 
http://github.com/arroway/virtio_DragonFlyBSD/blob/dev-net/virtio.c


[-- Attachment #2: Type: text/html, Size: 1951 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] error "kvm: virtio: trying to map MMIO memory"
  2011-07-17 18:06 [Qemu-devel] error "kvm: virtio: trying to map MMIO memory" Stéphanie Ouillon
@ 2011-07-18 12:16 ` Stefan Hajnoczi
  2011-07-20  9:52   ` Stéphanie Ouillon
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Hajnoczi @ 2011-07-18 12:16 UTC (permalink / raw)
  To: Stéphanie Ouillon; +Cc: qemu-devel

2011/7/17 Stéphanie Ouillon <steph.ouillon@gmail.com>:
> I have been facing a problem for 3-4 days with my virtio network device
> driver in qemu: when I load the driver, I get the following error:
> kvm: virtio: trying to map MMIO memory
[...]
> Would anybody have a clue about what kind of bug would provoke this error in
> qemu ?

It means a descriptor has an addr field that is not a bus address
backed by RAM.  Instead the incorrect address is to a MMIO memory
region.  Normally all buffers that you pass via virtio are guest
physical RAM addresses, hardware mapped registers (MMIO) should not be
passed over virtio and there's usually really no reason to do that.

This suggests you are setting an incorrect address in the guest driver
or are forgetting to set the address field thereby causing a stale
value to be read by QEMU.

I suggest adding the following to qemu/hw/virtio.c:virtqueue_map_sg()
right before the if statement that checks for failed memory map:
fprintf(stderr, "addr " TARGET_FMT_plx " len " TARGET_FMT_plx "
is_write %d\n", addr[i], len, is_write);

Compare the addresses that QEMU is seeing with those you have given to
virtio in the guest kernel.

It should be possible to correlate the buffers that the guest wants to
give the host with what QEMU sees.  Let us know if you need any more
help debugging.

Stefan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] error "kvm: virtio: trying to map MMIO memory"
  2011-07-18 12:16 ` Stefan Hajnoczi
@ 2011-07-20  9:52   ` Stéphanie Ouillon
  0 siblings, 0 replies; 3+ messages in thread
From: Stéphanie Ouillon @ 2011-07-20  9:52 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-devel

Thank you for your help, I have been able to see where was the bug !
Indeed, I was losing some address values along the way in a callback 
function whereas I thought they were kept memorized.


Regards

Stéphanie

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-07-20  9:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-17 18:06 [Qemu-devel] error "kvm: virtio: trying to map MMIO memory" Stéphanie Ouillon
2011-07-18 12:16 ` Stefan Hajnoczi
2011-07-20  9:52   ` Stéphanie Ouillon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).