<div dir="ltr">Yes. Now it works correctly. I'll write up some documentation on how to get this done and post it.<div><br></div><div>-Earlence</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jun 12, 2013 at 8:32 PM, Rusty Russell <span dir="ltr"><<a href="mailto:rusty@rustcorp.com.au" target="_blank">rusty@rustcorp.com.au</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">Earlence Fernandes <<a href="mailto:earlenceferns@gmail.com">earlenceferns@gmail.com</a>> writes:<br>


> I am trying to achieve a host->guest comm channel.<br>
> so far, I have written a device in the launcher which simply registers one<br>
> IN vq and a handler function for the interrupt.<br>
> I have a virtio driver, which on initialization (probe), kmallocs a buffer,<br>
> calls sg_init_one, places the buffer via virtqueue_add_buf and then kicks<br>
> the vq.<br>
><br>
> on the host side (launcher), my handler is called, and I can see the data I<br>
> had filled in on the guest side, however, when I try to set data into the<br>
> buffers by changing the iov[0].base to the addr of data in the host and try<br>
> a trigger_irq, my guest gets notified, but I don't see the updated data.<br>
<br>
</div></div>Your Launcher code should look a little like the rng code, eg:<br>
<br>
static void mydev_input(struct virtqueue *vq)<br>
{<br>
        unsigned int head, in_num, out_num;<br>
        struct iovec iov[vq->vring.num];<br>
<br>
        /* First we need a buffer from the Guests's virtqueue. */<br>
        head = wait_for_vq_desc(vq, iov, &out_num, &in_num);<br>
        if (out_num)<br>
                errx(1, "Output buffers in mydev?");<br>
<br>
        /*<br>
         * Just write into the first byte, to test.<br>
         */<br>
        memcpy(iov[0].iov_base, "A", 1);<br>
<br>
        /* Tell the Guest about the new input. */<br>
        add_used_and_trigger(vq, head, 1);<br>
}<br>
<br>
Cheers,<br>
Rusty.<br>
</blockquote></div><br></div>