From: Antonios Motakis <a.motakis-lrHrjnjw1UfHK3s98zE1ajGjJy/sRE9J@public.gmane.org>
To: kvmarm-FPEHb7Xf0XXUo1n7N8X6UoWGPAHP3yOg@public.gmane.org,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
alex.williamson-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Cc: "open list:VFIO DRIVER"
<kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
eric.auger-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
marc.zyngier-5wv7dgnIgG8@public.gmane.org,
will.deacon-5wv7dgnIgG8@public.gmane.org,
open list <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Antonios Motakis
<a.motakis-lrHrjnjw1UfHK3s98zE1ajGjJy/sRE9J@public.gmane.org>,
tech-lrHrjnjw1UfHK3s98zE1ajGjJy/sRE9J@public.gmane.org,
christoffer.dall-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org
Subject: [PATCH v11 06/20] vfio/platform: return info for bound device
Date: Tue, 6 Jan 2015 11:48:41 +0100 [thread overview]
Message-ID: <1420541335-17190-7-git-send-email-a.motakis@virtualopensystems.com> (raw)
In-Reply-To: <1420541335-17190-1-git-send-email-a.motakis-lrHrjnjw1UfHK3s98zE1ajGjJy/sRE9J@public.gmane.org>
A VFIO userspace driver will start by opening the VFIO device
that corresponds to an IOMMU group, and will use the ioctl interface
to get the basic device info, such as number of memory regions and
interrupts, and their properties. This patch enables the
VFIO_DEVICE_GET_INFO ioctl call.
Signed-off-by: Antonios Motakis <a.motakis-lrHrjnjw1UfHK3s98zE1ajGjJy/sRE9J@public.gmane.org>
---
drivers/vfio/platform/vfio_platform_common.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/drivers/vfio/platform/vfio_platform_common.c b/drivers/vfio/platform/vfio_platform_common.c
index 34d023b..862b43b 100644
--- a/drivers/vfio/platform/vfio_platform_common.c
+++ b/drivers/vfio/platform/vfio_platform_common.c
@@ -38,10 +38,27 @@ static int vfio_platform_open(void *device_data)
static long vfio_platform_ioctl(void *device_data,
unsigned int cmd, unsigned long arg)
{
- if (cmd == VFIO_DEVICE_GET_INFO)
- return -EINVAL;
+ struct vfio_platform_device *vdev = device_data;
+ unsigned long minsz;
+
+ if (cmd == VFIO_DEVICE_GET_INFO) {
+ struct vfio_device_info info;
+
+ minsz = offsetofend(struct vfio_device_info, num_irqs);
+
+ if (copy_from_user(&info, (void __user *)arg, minsz))
+ return -EFAULT;
+
+ if (info.argsz < minsz)
+ return -EINVAL;
+
+ info.flags = vdev->flags;
+ info.num_regions = 0;
+ info.num_irqs = 0;
+
+ return copy_to_user((void __user *)arg, &info, minsz);
- else if (cmd == VFIO_DEVICE_GET_REGION_INFO)
+ } else if (cmd == VFIO_DEVICE_GET_REGION_INFO)
return -EINVAL;
else if (cmd == VFIO_DEVICE_GET_IRQ_INFO)
--
2.1.4
next prev parent reply other threads:[~2015-01-06 10:48 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-06 10:48 [PATCH v11 00/20] VFIO support for platform and ARM AMBA devices Antonios Motakis
2015-01-06 10:48 ` [PATCH v11 03/20] vfio: platform: add the VFIO PLATFORM module to Kconfig Antonios Motakis
2015-01-06 10:48 ` [PATCH v11 05/20] vfio: amba: add the VFIO for AMBA devices " Antonios Motakis
2015-01-06 10:48 ` [PATCH v11 07/20] vfio/platform: return info for device memory mapped IO regions Antonios Motakis
2015-01-06 10:48 ` [PATCH v11 09/20] vfio/platform: support MMAP of MMIO regions Antonios Motakis
2015-01-06 10:48 ` [PATCH v11 10/20] vfio/platform: return IRQ info Antonios Motakis
2015-01-06 10:48 ` [PATCH v11 13/20] vfio/platform: support for level sensitive interrupts Antonios Motakis
2015-01-06 10:48 ` [PATCH v11 14/20] vfio: add a vfio_ prefix to virqfd_enable and virqfd_disable and export Antonios Motakis
2015-01-06 10:48 ` [PATCH v11 15/20] vfio: virqfd: rename vfio_pci_virqfd_init and vfio_pci_virqfd_exit Antonios Motakis
2015-01-06 10:48 ` [PATCH v11 16/20] vfio: add local lock for virqfd instead of depending on VFIO PCI Antonios Motakis
2015-01-06 10:48 ` [PATCH v11 17/20] vfio: pass an opaque pointer on virqfd initialization Antonios Motakis
2015-01-06 10:48 ` [PATCH v11 20/20] vfio/platform: implement IRQ masking/unmasking via an eventfd Antonios Motakis
[not found] ` <1420541335-17190-1-git-send-email-a.motakis-lrHrjnjw1UfHK3s98zE1ajGjJy/sRE9J@public.gmane.org>
2015-01-06 10:48 ` [PATCH v11 01/20] vfio/platform: initial skeleton of VFIO support for platform devices Antonios Motakis
2015-01-06 10:48 ` [PATCH v11 02/20] vfio: platform: probe to devices on the platform bus Antonios Motakis
2015-01-06 10:48 ` [PATCH v11 04/20] vfio: amba: VFIO support for AMBA devices Antonios Motakis
2015-01-06 10:48 ` Antonios Motakis [this message]
2015-01-06 10:48 ` [PATCH v11 08/20] vfio/platform: read and write support for the device fd Antonios Motakis
2015-01-06 10:48 ` [PATCH v11 11/20] vfio/platform: initial interrupts support code Antonios Motakis
2015-01-06 10:48 ` [PATCH v11 12/20] vfio/platform: trigger an interrupt via eventfd Antonios Motakis
2015-01-06 10:48 ` [PATCH v11 18/20] vfio: move eventfd support code for VFIO_PCI to a separate file Antonios Motakis
2015-01-06 10:48 ` [PATCH v11 19/20] vfio: initialize the virqfd workqueue in VFIO generic code Antonios Motakis
2015-01-08 16:58 ` [PATCH v11 00/20] VFIO support for platform and ARM AMBA devices Eric Auger
2015-01-09 8:39 ` Eric Auger
[not found] ` <54AF93AB.9030302-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-01-09 11:33 ` Antonios Motakis
[not found] ` <CAG8rG2yc1ityUwswPiTR_w5f3tSeX_KB2g06HcPCPARXPHGvfg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-16 13:25 ` Baptiste Reynal
[not found] ` <CAN9JPjERBVnGku8_BJuesMnzJyQYUgz6rJhL_VrCOgLVQuXyuw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-19 10:17 ` Eric Auger
[not found] ` <54BCD9A6.4050501-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-01-19 12:27 ` Eric Auger
[not found] ` <54BCF846.1070906-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-01-19 17:00 ` Baptiste Reynal
[not found] ` <CAN9JPjF5sAH-UNKtBhfiHK7cQJBwNwg2UEcrj8sv9Em6MnBVxg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-19 18:09 ` Eric Auger
[not found] ` <54BD4857.3070707-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-01-20 15:10 ` Baptiste Reynal
[not found] ` <CAN9JPjEhUhjgnDAMmMGxgFoLkhqQYgvsKeZ2+oDKzWMCe+qzhw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-20 16:33 ` Eric Auger
2015-01-19 18:39 ` Alex Williamson
[not found] ` <1421692750.6130.377.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-01-21 12:54 ` Antonios Motakis
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=1420541335-17190-7-git-send-email-a.motakis@virtualopensystems.com \
--to=a.motakis-lrhrjnjw1ufhk3s98ze1ajgjjy/sre9j@public.gmane.org \
--cc=alex.williamson-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=christoffer.dall-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=eric.auger-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=kvmarm-FPEHb7Xf0XXUo1n7N8X6UoWGPAHP3yOg@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=marc.zyngier-5wv7dgnIgG8@public.gmane.org \
--cc=tech-lrHrjnjw1UfHK3s98zE1ajGjJy/sRE9J@public.gmane.org \
--cc=will.deacon-5wv7dgnIgG8@public.gmane.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