Received: from eggs.gnu.org ([2001:4830:134:3::10]:43788) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWiW6-0002b1-SQ for qemu-devel@nongnu.org; Fri, 19 Feb 2016 05:42:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aWiW2-0002Tu-2P for qemu-devel@nongnu.org; Fri, 19 Feb 2016 05:42:30 -0500 Received: from [59.151.112.132] (port=13260 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWiW1-0002Pr-J5 for qemu-devel@nongnu.org; Fri, 19 Feb 2016 05:42:25 -0500 From: Cao jin Date: Fri, 19 Feb 2016 18:42:36 +0800 Message-ID: <1455878558-4672-8-git-send-email-caoj.fnst@cn.fujitsu.com> In-Reply-To: <1455878558-4672-1-git-send-email-caoj.fnst@cn.fujitsu.com> References: <1455878558-4672-1-git-send-email-caoj.fnst@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH v2 07/11] vfio: add check aer functionality for hotplug device List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: chen.fan.fnst@cn.fujitsu.com, izumi.taku@jp.fujitsu.com, alex.williamson@redhat.com, mst@redhat.com From: Chen Fan Signed-off-by: Chen Fan --- hw/vfio/pci.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 0898e34..24848c9 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -3034,6 +3034,20 @@ post_reset: vfio_pci_post_reset(vdev); } +static void vfio_pci_is_valid(PCIDevice *dev, Error **errp) +{ + VFIOPCIDevice *vdev = DO_UPCAST(VFIOPCIDevice, pdev, dev); + Error *local_err = NULL; + + if (DEVICE(dev)->hotplugged && + (vdev->features & VFIO_FEATURE_ENABLE_AER)) { + vfio_check_host_bus_reset(vdev, &local_err); + if (local_err) { + error_propagate(errp, local_err); + } + } +} + static void vfio_instance_init(Object *obj) { PCIDevice *pci_dev = PCI_DEVICE(obj); @@ -3087,6 +3101,7 @@ static void vfio_pci_dev_class_init(ObjectClass *klass, void *data) set_bit(DEVICE_CATEGORY_MISC, dc->categories); pdc->init = vfio_initfn; pdc->exit = vfio_exitfn; + pdc->is_valid_func = vfio_pci_is_valid; pdc->config_read = vfio_pci_read_config; pdc->config_write = vfio_pci_write_config; pdc->is_express = 1; /* We might be */ -- 1.9.3