From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bandan Das Subject: [PATCH] vfio: Set PCI_DEV_FLAGS_ASSIGNED when assigning device to guest Date: Thu, 30 Jan 2014 22:54:24 +0530 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Cc: Alex Williamson To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:58819 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753289AbaA3RYb (ORCPT ); Thu, 30 Jan 2014 12:24:31 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s0UHOUZt017067 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 30 Jan 2014 12:24:31 -0500 Sender: kvm-owner@vger.kernel.org List-ID: Some drivers such as ixgbe rely on pci_vfs_assigned() to prevent disabling sr-iov when vfs are still assigned during hotplug event or module removal. Set and unset PCI_DEV_FLAGS_ASSIGNED appropriately Signed-off-by: Bandan Das --- drivers/vfio/pci/vfio_pci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index 7ba0424..7cc7ed6 100644 --- a/drivers/vfio/pci/vfio_pci.c +++ b/drivers/vfio/pci/vfio_pci.c @@ -90,6 +90,7 @@ static int vfio_pci_enable(struct vfio_pci_device *vdev) vdev->has_vga = true; #endif + pdev->dev_flags |= PCI_DEV_FLAGS_ASSIGNED; return 0; } @@ -149,6 +150,7 @@ static void vfio_pci_disable(struct vfio_pci_device *vdev) __func__, dev_name(&pdev->dev), ret); } + pdev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED; pci_restore_state(pdev); } -- 1.8.3.1