qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC v10 10/19] vfio: improve vfio_get_group to support add


From: Chen Fan
Subject: [Qemu-devel] [RFC v10 10/19] vfio: improve vfio_get_group to support adding as is NULL.
Date: Tue, 16 Jun 2015 16:10:54 +0800

Signed-off-by: Chen Fan <address@hidden>
---
 hw/vfio/common.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index df3171d..15f19a2 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -808,11 +808,18 @@ VFIOGroup *vfio_get_group(int groupid, AddressSpace *as)
     VFIOGroup *group;
     char path[32];
     struct vfio_group_status status = { .argsz = sizeof(status) };
+    int ret;
 
     QLIST_FOREACH(group, &vfio_group_list, next) {
         if (group->groupid == groupid) {
             /* Found it.  Now is it already in the right context? */
-            if (group->container->space->as == as) {
+            if (as && !group->container->space->as) {
+                ret = vfio_register_container_listener(group->container, as);
+                if (ret) {
+                    return NULL;
+                }
+            }
+            if (!as || group->container->space->as == as) {
                 group->ref++;
                 return group;
             } else {
-- 
1.9.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]