[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200131021204.27830-1-yan.y.zhao@intel.com>
Date: Thu, 30 Jan 2020 21:12:04 -0500
From: Yan Zhao <yan.y.zhao@...el.com>
To: alex.williamson@...hat.com
Cc: kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
cohuck@...hat.com, zhenyuw@...ux.intel.com, zhi.a.wang@...el.com,
kevin.tian@...el.com, shaopeng.he@...el.com, yi.l.liu@...el.com,
Yan Zhao <yan.y.zhao@...el.com>
Subject: [RFC PATCH v2 5/9] vfio/pci: let vfio_pci know how many vendor regions are registered
This allows a simpler VFIO_DEVICE_GET_INFO ioctl in vendor driver
Cc: Kevin Tian <kevin.tian@...el.com>
Signed-off-by: Yan Zhao <yan.y.zhao@...el.com>
---
drivers/vfio/pci/vfio_pci.c | 3 ++-
include/linux/vfio.h | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
index 1a08b7cc9246..7530cceaeaa5 100644
--- a/drivers/vfio/pci/vfio_pci.c
+++ b/drivers/vfio/pci/vfio_pci.c
@@ -719,7 +719,8 @@ long vfio_pci_ioctl(void *device_data,
if (vdev->priv->reset_works)
info.flags |= VFIO_DEVICE_FLAGS_RESET;
- info.num_regions = VFIO_PCI_NUM_REGIONS + vdev->num_regions;
+ info.num_regions = VFIO_PCI_NUM_REGIONS + vdev->num_regions +
+ vdev->num_vendor_regions;
info.num_irqs = VFIO_PCI_NUM_IRQS;
return copy_to_user((void __user *)arg, &info, minsz) ?
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index 386d1b19da3d..4bb101ac3fff 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -210,6 +210,7 @@ struct vfio_pci_device_private;
struct vfio_pci_device {
struct pci_dev *pdev;
int num_regions;
+ int num_vendor_regions;
int irq_type;
struct vfio_pci_device_private *priv;
struct vfio_pci_vendor_driver *vendor_driver;
--
2.17.1
Powered by blists - more mailing lists