qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: izumi.taku@jp.fujitsu.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [RFC v7 05/11] vfio: do hot bus reset when do virtual secondary bus reset
Date: Wed, 20 May 2015 17:59:21 +0800	[thread overview]
Message-ID: <555C5AF9.4010104@cn.fujitsu.com> (raw)
In-Reply-To: <1432064074.11375.247.camel@redhat.com>


On 05/20/2015 03:34 AM, Alex Williamson wrote:
> On Tue, 2015-05-19 at 12:42 +0800, Chen Fan wrote:
>> when do virtual secondary bus reset, the vfio device under
>> this bus need to do host bus reset to reset the device.
>> so add this case.
>>
>> Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
>> ---
>>   hw/vfio/pci.c                 | 12 +++++++++++-
>>   include/hw/vfio/vfio-common.h |  1 -
>>   2 files changed, 11 insertions(+), 2 deletions(-)
>>
>> diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
>> index ff639db..cc169ea 100644
>> --- a/hw/vfio/pci.c
>> +++ b/hw/vfio/pci.c
>> @@ -169,6 +169,7 @@ typedef struct VFIOPCIDevice {
>>       bool has_flr;
>>       bool has_pm_reset;
>>       bool has_bus_reset;
>> +    bool needs_bus_reset;
>>       bool rom_read_failed;
>>   } VFIOPCIDevice;
>>   
>> @@ -3531,7 +3532,8 @@ static void vfio_pci_host_needs_bus_reset(Notifier *n, void *opaque)
>>       VFIOPCIDevice *vdev = container_of(n, VFIOPCIDevice, sec_bus_reset_notifier);
>>       VFIODevice *vbasedev = &vdev->vbasedev;
>>   
>> -    vbasedev->needs_bus_reset = true;
>> +    vdev->needs_bus_reset = true;
>> +    vbasedev->needs_reset = true;
> The above should have happened in patch 03.
>
>>   }
>>   
>>   static void vfio_check_host_bus_reset(VFIODevice *vbasedev)
>> @@ -3807,6 +3809,14 @@ static void vfio_pci_reset(DeviceState *dev)
>>   
>>       trace_vfio_pci_reset(vdev->vbasedev.name);
>>   
>> +    if (vdev->has_bus_reset && vdev->needs_bus_reset) {
>> +        vdev->needs_bus_reset = false;
>> +        if (vdev->vbasedev.needs_reset) {
>> +            vfio_pci_hot_reset(vdev, false);
> So we're not even going to check to see whether that worked?  How can we
> know that the configuration is still the same as after machine init?  An
> affected device could have been hot-unplugged an now in use by the host
> (in which case this function would fail).  An affected device could have
> been hot unplugged and added back to the VM under a different bus, now
> we have an arbitrary second device affected by the bus reset from the VM
> perspective.
Due to we may have the arbitrary configuration manner after hotplug
/unplug vfio-pci devices, the enabled aer feature probably became to
disabled. so shall we consider not to expose the aer feature to user,
and enable/disable it automatically?

Thanks,
Chen



>
>> +        }
>> +        return;
>> +    }
>> +
>>       vfio_pci_pre_reset(vdev);
>>   
>>       if (vdev->resetfn && !vdev->resetfn(vdev)) {
>> diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h
>> index 5f5691a..0d1fb80 100644
>> --- a/include/hw/vfio/vfio-common.h
>> +++ b/include/hw/vfio/vfio-common.h
>> @@ -102,7 +102,6 @@ typedef struct VFIODevice {
>>       bool reset_works;
>>       bool needs_reset;
>>       bool allow_mmap;
>> -    bool needs_bus_reset;
>>       VFIODeviceOps *ops;
>>       unsigned int num_irqs;
>>       unsigned int num_regions;
>
>
> .
>

  reply	other threads:[~2015-05-20 10:01 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-19  4:42 [Qemu-devel] [RFC v7 00/11] vfio-pci: pass the aer error to guest Chen Fan
2015-05-19  4:42 ` [Qemu-devel] [RFC v7 01/11] vfio: extract vfio_get_hot_reset_info as a single function Chen Fan
2015-05-19 19:34   ` Alex Williamson
2015-05-19  4:42 ` [Qemu-devel] [RFC v7 02/11] vfio: squeeze out vfio_pci_do_hot_reset for support bus reset Chen Fan
2015-05-19  4:42 ` [Qemu-devel] [RFC v7 03/11] qdev: add bus reset_notifiers callbacks for host " Chen Fan
2015-05-19 19:34   ` Alex Williamson
2015-05-19  4:42 ` [Qemu-devel] [RFC v7 04/11] vfio: add check host bus reset is support or not Chen Fan
2015-05-19 19:34   ` Alex Williamson
2015-05-20  7:24     ` Chen Fan
2015-05-20 18:47       ` Alex Williamson
2015-05-19  4:42 ` [Qemu-devel] [RFC v7 05/11] vfio: do hot bus reset when do virtual secondary bus reset Chen Fan
2015-05-19 19:34   ` Alex Williamson
2015-05-20  9:59     ` Chen Fan [this message]
2015-05-20 18:47       ` Alex Williamson
2015-05-19  4:42 ` [Qemu-devel] [RFC v7 06/11] vfio: add pcie extanded capability support Chen Fan
2015-05-19  4:42 ` [Qemu-devel] [RFC v7 07/11] aer: impove pcie_aer_init to support vfio device Chen Fan
2015-05-19  4:42 ` [Qemu-devel] [RFC v7 08/11] vfio: add aer support for " Chen Fan
2015-05-19  4:42 ` [Qemu-devel] [RFC v7 09/11] pcie_aer: expose pcie_aer_msg() interface Chen Fan
2015-05-19  4:42 ` [Qemu-devel] [RFC v7 10/11] vfio-pci: pass the aer error to guest Chen Fan
2015-05-19  4:42 ` [Qemu-devel] [RFC v7 11/11] vfio: add 'aer' property to expose aercap Chen Fan
2015-05-19 19:34   ` Alex Williamson
2015-05-20  3:43     ` Chen Fan
2015-05-20 18:47       ` Alex Williamson
2015-05-21  1:53         ` Chen Fan

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=555C5AF9.4010104@cn.fujitsu.com \
    --to=chen.fan.fnst@cn.fujitsu.com \
    --cc=alex.williamson@redhat.com \
    --cc=izumi.taku@jp.fujitsu.com \
    --cc=qemu-devel@nongnu.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 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).