[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH v7 2/3] VFIO: Helper function to retrieve container fd
From: |
Gavin Shan |
Subject: |
[Qemu-ppc] [PATCH v7 2/3] VFIO: Helper function to retrieve container fd |
Date: |
Tue, 27 May 2014 18:51:09 +1000 |
The patch adds function vfio_get_container_fd_by_group_id() to retrieve
the container's fd of the specified VFIO group. The fd will be used
by subsequent patches.
Signed-off-by: Gavin Shan <address@hidden>
---
hw/misc/vfio.c | 17 +++++++++++++++++
include/hw/misc/vfio.h | 1 +
2 files changed, 18 insertions(+)
diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c
index 0796abf..424d467 100644
--- a/hw/misc/vfio.c
+++ b/hw/misc/vfio.c
@@ -4310,3 +4310,20 @@ put_group_exit:
return n;
}
+
+int vfio_get_container_fd_by_group_id(int32_t groupid)
+{
+ VFIOGroup *group;
+
+ QLIST_FOREACH(group, &group_list, next) {
+ if (group->groupid == groupid) {
+ if (group->container) {
+ return group->container->fd;
+ } else {
+ return -ENOENT;
+ }
+ }
+ }
+
+ return -ENOENT;
+}
diff --git a/include/hw/misc/vfio.h b/include/hw/misc/vfio.h
index 53ec665..a5afebd 100644
--- a/include/hw/misc/vfio.h
+++ b/include/hw/misc/vfio.h
@@ -30,4 +30,5 @@ static inline long vfio_kvm_notify(Notifier *n, unsigned
request, void *data)
return p.ret;
}
+extern int vfio_get_container_fd_by_group_id(int32_t groupid);
#endif
--
1.8.3.2
- [Qemu-ppc] [PATCH v7 0/3] EEH Support for VFIO devices on sPAPR, Gavin Shan, 2014/05/27
- [Qemu-ppc] [PATCH v7 2/3] VFIO: Helper function to retrieve container fd,
Gavin Shan <=
- Re: [Qemu-ppc] [PATCH v7 2/3] VFIO: Helper function to retrieve container fd, Alex Williamson, 2014/05/27
- Re: [Qemu-ppc] [PATCH v7 2/3] VFIO: Helper function to retrieve container fd, Gavin Shan, 2014/05/27
- Re: [Qemu-ppc] [PATCH v7 2/3] VFIO: Helper function to retrieve container fd, Alex Williamson, 2014/05/27
- Re: [Qemu-ppc] [PATCH v7 2/3] VFIO: Helper function to retrieve container fd, Benjamin Herrenschmidt, 2014/05/27
- Re: [Qemu-ppc] [Qemu-devel] [PATCH v7 2/3] VFIO: Helper function to retrieve container fd, Alex Williamson, 2014/05/27
- Re: [Qemu-ppc] [Qemu-devel] [PATCH v7 2/3] VFIO: Helper function to retrieve container fd, Benjamin Herrenschmidt, 2014/05/27
- Re: [Qemu-ppc] [PATCH v7 2/3] VFIO: Helper function to retrieve container fd, Gavin Shan, 2014/05/27
[Qemu-ppc] [PATCH v7 1/3] headers: Sync with Linux header, Gavin Shan, 2014/05/27
[Qemu-ppc] [PATCH v7 3/3] sPAPR: EEH support for VFIO PCI device, Gavin Shan, 2014/05/27