All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: dor.laor-atKUWr5tajBWk0Htik3J/w@public.gmane.org
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Subject: Re: [PATCH 2/6] virtio block driver for QEMU (v2)
Date: Sun, 11 Nov 2007 13:25:37 -0600	[thread overview]
Message-ID: <47375731.7020007@us.ibm.com> (raw)
In-Reply-To: <47373ADF.3000607-atKUWr5tajBWk0Htik3J/w@public.gmane.org>

Dor Laor wrote:
>> +
>> +    if (1) {
>> +    BlockDriverState *bs = bdrv_new("vda");
>> +    if (bdrv_open(bs, "/home/anthony/images/linux.img", 
>> BDRV_O_SNAPSHOT))
>> +        exit(1);
>>   
> Can you add a printf to the exit(1). I had to gdb the code to find why 
> my qemu is not running no more (in earlier version
> I did remember to change the path but not after the new patches.

Heh, sorry about that.

> [snip]  
>> +    virtqueue_push(vq, &elem, wlen);
>> +    virtio_notify(vdev, vq);
>> +    }
>>   
> You can move the notify out of the while loop. This way you save irqs.

I don't think it does actually.  This raises the line multiple times, 
but if the line is already raised, it's effectively a nop.  Now, with 
KVM's in-kernel APIC, it ends up generating more syscalls than is 
necessary so it's worth changing.

>> +}
>> +
>> +static void virtio_blk_update_config(VirtIODevice *vdev, uint8_t 
>> *config)
>> +{
>> +    VirtIOBlock *s = to_virtio_blk(vdev);
>> +    int64_t capacity;
>> +    uint32_t v;
>> +
>> +    bdrv_get_geometry(s->bs, &capacity);
>> +    memcpy(config + VIRTIO_CONFIG_BLK_F_CAPACITY, &capacity, 
>> sizeof(capacity));
>> +
>> +    v = VIRTQUEUE_MAX_SIZE - 2;
>> +    memcpy(config + VIRTIO_CONFIG_BLK_F_SEG_MAX, &v, sizeof(v));
>> +}
>> +
>> +static uint32_t virtio_blk_get_features(VirtIODevice *vdev)
>> +{
>> +    return (1 << VIRTIO_BLK_F_SEG_MAX);
>>   
> In general I think we need to add another feature or even version 
> number ( I know you guys hate it).
> The reason is - Let's say you dont change functionality but change the 
> irq protocol (for example the isr won't be zeroed on read), then an old
> guest driver wouldn't know it runs on a new host version and will have 
> its irq line pulled up.
> So I suggest adding a capability of VIRTIO_ISR_CLEAR_XXX or adding a 
> version number.
> Comments?

I don't think we'll actually change the ISR protocol.  I think it's the 
best that it can actually be.  However, if we do need to change the ABI 
for some reason, I think the right thing to do is just use a new device 
ID (since it's effectively a new device).

Regards,

Anthony Liguori

>> +}
>> +
>> +VirtIODevice *virtio_blk_init(PCIBus *bus, uint16_t vendor, uint16_t 
>> device,
>> +                  BlockDriverState *bs)
>> +{
>> +    VirtIOBlock *s;
>> +
>> +    s = (VirtIOBlock *)virtio_init_pci(bus, "virtio-blk", vendor, 
>> device,
>> +                       vendor, VIRTIO_ID_BLOCK,
>> +                       16, sizeof(VirtIOBlock));
>> +
>> +    s->vdev.update_config = virtio_blk_update_config;
>> +    s->vdev.get_features = virtio_blk_get_features;
>> +    s->bs = bs;
>> +
>> +    virtio_add_queue(&s->vdev, virtio_blk_handle_output);
>> +
>> +    return &s->vdev;
>> +}
>> diff --git a/qemu/vl.h b/qemu/vl.h
>> index fafcf09..249ede2 100644
>> --- a/qemu/vl.h
>> +++ b/qemu/vl.h
>> @@ -1396,6 +1396,9 @@ void vmchannel_init(CharDriverState *hd, 
>> uint32_t deviceid, uint32_t index);
>>  
>>  typedef struct VirtIODevice VirtIODevice;
>>  
>> +VirtIODevice *virtio_blk_init(PCIBus *bus, uint16_t vendor, uint16_t 
>> device,
>> +                  BlockDriverState *bs);
>> +
>>  /* buf = NULL means polling */
>>  typedef int ADBDeviceRequest(ADBDevice *d, uint8_t *buf_out,
>>                                const uint8_t *buf, int len);
>>
>>   
>


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/

  parent reply	other threads:[~2007-11-11 19:25 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-11  3:20 [PATCH 0/6] QEMU support for virtio (v2) Anthony Liguori
     [not found] ` <11947512401155-git-send-email-aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2007-11-11  3:20   ` [PATCH 1/6] Basic virtio infrastructure for QEMU (v2) Anthony Liguori
2007-11-11  3:20   ` [PATCH 2/6] virtio block driver " Anthony Liguori
     [not found]     ` <11947512432057-git-send-email-aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2007-11-11 17:24       ` Dor Laor
     [not found]         ` <47373ADF.3000607-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-11-11 19:25           ` Anthony Liguori [this message]
     [not found]             ` <47375731.7020007-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2007-11-12 12:21               ` Dor Laor
     [not found]                 ` <4738452F.8070502-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-11-12 23:25                   ` Anthony Liguori
     [not found]                     ` <4738E102.2050200-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2007-11-13  0:28                       ` Rusty Russell
     [not found]                         ` <200711131128.44492.rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>
2007-11-27  9:47                           ` Avi Kivity
2007-11-12 15:02       ` Daniel P. Berrange
     [not found]         ` <20071112150211.GA14436-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2007-11-12 15:05           ` Avi Kivity
     [not found]             ` <47386BA9.8050000-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-11-12 23:26               ` Anthony Liguori
2007-11-11  3:20   ` [PATCH 3/6] 9p virtio transport " Anthony Liguori
2007-11-11  3:20   ` [PATCH 4/6] virtio network driver " Anthony Liguori
     [not found]     ` <11947512454030-git-send-email-aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2007-11-11 17:31       ` Dor Laor
     [not found]         ` <47373C6B.7090102-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-11-11 19:29           ` Anthony Liguori
2007-11-11  3:20   ` [PATCH 5/6] Remove hypercall driver (v2) Anthony Liguori
     [not found]     ` <1194751246584-git-send-email-aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2007-11-11 17:25       ` Dor Laor
2007-11-27 12:28       ` Avi Kivity
2007-11-11  3:20   ` [PATCH 6/6] Provide a mechanism to build virtio drivers as modules (v2) Anthony Liguori
     [not found]     ` <11947512473786-git-send-email-aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2007-11-27 12:30       ` Avi Kivity

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=47375731.7020007@us.ibm.com \
    --to=aliguori-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
    --cc=avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org \
    --cc=dor.laor-atKUWr5tajBWk0Htik3J/w@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.