All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shannon Zhao <zhaoshenglong@huawei.com>
To: Fam Zheng <famz@redhat.com>
Cc: peter.maydell@linaro.org, hangaohuai@huawei.com,
	yingshiuan.pan@gmail.com, mst@redhat.com, john.liuli@huawei.com,
	qemu-devel@nongnu.org, n.nikolaev@virtualopensystems.com,
	peter.huangpeng@huawei.com
Subject: Re: [Qemu-devel] [PATCH 1/4] virtio-mmio: introduce set_host_notifier()
Date: Thu, 20 Nov 2014 20:41:13 +0800	[thread overview]
Message-ID: <546DE169.30309@huawei.com> (raw)
In-Reply-To: <20141119074752.GA19148@fam-t430.nay.redhat.com>

On 2014/11/19 15:47, Fam Zheng wrote:
> On Tue, 11/04 20:47, Shannon Zhao wrote:
>> set_host_notifier() is introduced into virtio-mmio now. Most of codes came
>> from virtio-pci.
>>
>> Signed-off-by: Ying-Shiuan Pan <yingshiuan.pan@gmail.com>
>> Signed-off-by: Li Liu <john.liuli@huawei.com>
>> Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
>> ---
>>  hw/virtio/virtio-mmio.c |   70 +++++++++++++++++++++++++++++++++++++++++++++++
>>  1 files changed, 70 insertions(+), 0 deletions(-)
>>
>> diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c
>> index 2450c13..d8ec2d1 100644
>> --- a/hw/virtio/virtio-mmio.c
>> +++ b/hw/virtio/virtio-mmio.c
>> @@ -23,6 +23,7 @@
>>  #include "hw/virtio/virtio.h"
>>  #include "qemu/host-utils.h"
>>  #include "hw/virtio/virtio-bus.h"
>> +#include "qemu/error-report.h"
>>  
>>  /* #define DEBUG_VIRTIO_MMIO */
>>  
>> @@ -87,8 +88,58 @@ typedef struct {
>>      uint32_t guest_page_shift;
>>      /* virtio-bus */
>>      VirtioBusState bus;
>> +    bool ioeventfd_disabled;
>> +    bool ioeventfd_started;
>>  } VirtIOMMIOProxy;
>>  
>> +static int virtio_mmio_set_host_notifier_internal(VirtIOMMIOProxy *proxy,
>> +                                                 int n, bool assign, bool set_handler)
> 
> I didn't review the code, but checkpatch.pl noticed this line and one more
> below [*] is too long (over 80 columes).
> 
>> +{
>> +    VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
>> +    VirtQueue *vq = virtio_get_queue(vdev, n);
>> +    EventNotifier *notifier = virtio_queue_get_host_notifier(vq);
>> +    int r = 0;
>> +
>> +    if (assign) {
>> +        r = event_notifier_init(notifier, 1);
>> +        if (r < 0) {
>> +            error_report("%s: unable to init event notifier: %d",
>> +                         __func__, r);
>> +            return r;
>> +        }
>> +        virtio_queue_set_host_notifier_fd_handler(vq, true, set_handler);
>> +        memory_region_add_eventfd(&proxy->iomem, VIRTIO_MMIO_QUEUENOTIFY, 4,
>> +                                  true, n, notifier);
>> +    } else {
>> +        memory_region_del_eventfd(&proxy->iomem, VIRTIO_MMIO_QUEUENOTIFY, 4,
>> +                                  true, n, notifier);
>> +        virtio_queue_set_host_notifier_fd_handler(vq, false, false);
>> +        event_notifier_cleanup(notifier);
>> +    }
>> +    return r;
>> +}
>> +
>> +static void virtio_mmio_stop_ioeventfd(VirtIOMMIOProxy *proxy)
>> +{
>> +    int r;
>> +    int n;
>> +    VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
>> +
>> +    if (!proxy->ioeventfd_started) {
>> +        return;
>> +    }
>> +
>> +    for (n = 0; n < VIRTIO_PCI_QUEUE_MAX; n++) {
>> +        if (!virtio_queue_get_num(vdev, n)) {
>> +            continue;
>> +        }
>> +
>> +        r = virtio_mmio_set_host_notifier_internal(proxy, n, false, false);
>> +        assert(r >= 0);
>> +    }
>> +    proxy->ioeventfd_started = false;
>> +}
>> +
>>  static uint64_t virtio_mmio_read(void *opaque, hwaddr offset, unsigned size)
>>  {
>>      VirtIOMMIOProxy *proxy = (VirtIOMMIOProxy *)opaque;
>> @@ -342,6 +393,24 @@ static void virtio_mmio_reset(DeviceState *d)
>>      proxy->guest_page_shift = 0;
>>  }
>>  
>> +static int virtio_mmio_set_host_notifier(DeviceState *opaque, int n, bool assign)
> 
> [*]
> 
> No need to respin yet just for this. Please wait for a serious review.
> 

Ok,thanks,
Shannon

> Thanks,
> 
> Fam
> 
> .
> 


-- 
Shannon

  reply	other threads:[~2014-11-20 12:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-04 12:47 [Qemu-devel] [PATCH 0/4] ioeventfd support for virtio-mmio Shannon Zhao
2014-11-04 12:47 ` [Qemu-devel] [PATCH 1/4] virtio-mmio: introduce set_host_notifier() Shannon Zhao
2014-11-19  7:47   ` Fam Zheng
2014-11-20 12:41     ` Shannon Zhao [this message]
2014-11-04 12:47 ` [Qemu-devel] [PATCH 2/4] virtio-mmio: introduce set_guest_notifiers Shannon Zhao
2014-11-04 12:47 ` [Qemu-devel] [PATCH 3/4] virtio-mmio: start ioeventfd when status gets DRIVER_OK Shannon Zhao
2014-11-04 12:47 ` [Qemu-devel] [PATCH 4/4] virtio-mmio: add a new property for ioeventfd Shannon Zhao
2014-11-05  9:33 ` [Qemu-devel] [PATCH 0/4] ioeventfd support for virtio-mmio Shannon Zhao
2015-01-22  7:47 ` Paolo Bonzini
  -- strict thread matches above, loose matches on Subject: below --
2015-05-06  7:52 [Qemu-devel] [PATCH 1/4] virtio-mmio: introduce set_host_notifier() Pavel Fedin
2015-05-06 14:52 ` Eric Blake
2014-02-05 17:03 [Qemu-devel] [PATCH 0/4] ioeventfd support for virtio-mmio Ying-Shiuan Pan
2014-02-05 17:03 ` [Qemu-devel] [PATCH 1/4] virtio-mmio: introduce set_host_notifier() Ying-Shiuan Pan

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=546DE169.30309@huawei.com \
    --to=zhaoshenglong@huawei.com \
    --cc=famz@redhat.com \
    --cc=hangaohuai@huawei.com \
    --cc=john.liuli@huawei.com \
    --cc=mst@redhat.com \
    --cc=n.nikolaev@virtualopensystems.com \
    --cc=peter.huangpeng@huawei.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=yingshiuan.pan@gmail.com \
    /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.