bus/fslmc: reduce the debug log messages
[dpdk.git] / drivers / bus / fslmc / fslmc_vfio.c
1 /*-
2  *   BSD LICENSE
3  *
4  *   Copyright (c) 2015-2016 Freescale Semiconductor, Inc. All rights reserved.
5  *   Copyright (c) 2016 NXP. All rights reserved.
6  *
7  *   Redistribution and use in source and binary forms, with or without
8  *   modification, are permitted provided that the following conditions
9  *   are met:
10  *
11  *     * Redistributions of source code must retain the above copyright
12  *       notice, this list of conditions and the following disclaimer.
13  *     * Redistributions in binary form must reproduce the above copyright
14  *       notice, this list of conditions and the following disclaimer in
15  *       the documentation and/or other materials provided with the
16  *       distribution.
17  *     * Neither the name of Freescale Semiconductor, Inc nor the names of its
18  *       contributors may be used to endorse or promote products derived
19  *       from this software without specific prior written permission.
20  *
21  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33
34 #include <unistd.h>
35 #include <stdio.h>
36 #include <sys/types.h>
37 #include <string.h>
38 #include <stdlib.h>
39 #include <fcntl.h>
40 #include <errno.h>
41 #include <sys/ioctl.h>
42 #include <sys/stat.h>
43 #include <sys/types.h>
44 #include <sys/mman.h>
45 #include <sys/vfs.h>
46 #include <libgen.h>
47 #include <dirent.h>
48 #include <sys/eventfd.h>
49
50 #include <rte_mbuf.h>
51 #include <rte_ethdev.h>
52 #include <rte_malloc.h>
53 #include <rte_memcpy.h>
54 #include <rte_string_fns.h>
55 #include <rte_cycles.h>
56 #include <rte_kvargs.h>
57 #include <rte_dev.h>
58 #include <rte_ethdev.h>
59 #include <rte_bus.h>
60
61 #include "rte_fslmc.h"
62 #include "fslmc_vfio.h"
63
64 #include "portal/dpaa2_hw_pvt.h"
65 #include "portal/dpaa2_hw_dpio.h"
66
67 #define VFIO_MAX_CONTAINERS     1
68
69 #define FSLMC_VFIO_LOG(level, fmt, args...) \
70         RTE_LOG(level, EAL, "%s(): " fmt "\n", __func__, ##args)
71
72 /** Pathname of FSL-MC devices directory. */
73 #define SYSFS_FSL_MC_DEVICES "/sys/bus/fsl-mc/devices"
74
75 /* Number of VFIO containers & groups with in */
76 static struct fslmc_vfio_group vfio_groups[VFIO_MAX_GRP];
77 static struct fslmc_vfio_container vfio_containers[VFIO_MAX_CONTAINERS];
78 static int container_device_fd;
79 static uint32_t *msi_intr_vaddr;
80 void *(*rte_mcp_ptr_list);
81 static uint32_t mcp_id;
82 static int is_dma_done;
83
84 static int vfio_connect_container(struct fslmc_vfio_group *vfio_group)
85 {
86         struct fslmc_vfio_container *container;
87         int i, fd, ret;
88
89         /* Try connecting to vfio container if already created */
90         for (i = 0; i < VFIO_MAX_CONTAINERS; i++) {
91                 container = &vfio_containers[i];
92                 if (!ioctl(vfio_group->fd, VFIO_GROUP_SET_CONTAINER,
93                            &container->fd)) {
94                         FSLMC_VFIO_LOG(INFO,
95                             "Container pre-exists with FD[0x%x] for this group",
96                             container->fd);
97                         vfio_group->container = container;
98                         return 0;
99                 }
100         }
101
102         /* Opens main vfio file descriptor which represents the "container" */
103         fd = vfio_get_container_fd();
104         if (fd < 0) {
105                 FSLMC_VFIO_LOG(ERR, "Failed to open VFIO container");
106                 return -errno;
107         }
108
109         /* Check whether support for SMMU type IOMMU present or not */
110         if (ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_TYPE1_IOMMU)) {
111                 /* Connect group to container */
112                 ret = ioctl(vfio_group->fd, VFIO_GROUP_SET_CONTAINER, &fd);
113                 if (ret) {
114                         FSLMC_VFIO_LOG(ERR, "Failed to setup group container");
115                         close(fd);
116                         return -errno;
117                 }
118
119                 ret = ioctl(fd, VFIO_SET_IOMMU, VFIO_TYPE1_IOMMU);
120                 if (ret) {
121                         FSLMC_VFIO_LOG(ERR, "Failed to setup VFIO iommu");
122                         close(fd);
123                         return -errno;
124                 }
125         } else {
126                 FSLMC_VFIO_LOG(ERR, "No supported IOMMU available");
127                 close(fd);
128                 return -EINVAL;
129         }
130
131         container = NULL;
132         for (i = 0; i < VFIO_MAX_CONTAINERS; i++) {
133                 if (vfio_containers[i].used)
134                         continue;
135                 container = &vfio_containers[i];
136         }
137         if (!container) {
138                 FSLMC_VFIO_LOG(ERR, "No free container found");
139                 close(fd);
140                 return -ENOMEM;
141         }
142
143         container->used = 1;
144         container->fd = fd;
145         container->group_list[container->index] = vfio_group;
146         vfio_group->container = container;
147         container->index++;
148         return 0;
149 }
150
151 static int vfio_map_irq_region(struct fslmc_vfio_group *group)
152 {
153         int ret;
154         unsigned long *vaddr = NULL;
155         struct vfio_iommu_type1_dma_map map = {
156                 .argsz = sizeof(map),
157                 .flags = VFIO_DMA_MAP_FLAG_READ | VFIO_DMA_MAP_FLAG_WRITE,
158                 .vaddr = 0x6030000,
159                 .iova = 0x6030000,
160                 .size = 0x1000,
161         };
162
163         vaddr = (unsigned long *)mmap(NULL, 0x1000, PROT_WRITE |
164                 PROT_READ, MAP_SHARED, container_device_fd, 0x6030000);
165         if (vaddr == MAP_FAILED) {
166                 FSLMC_VFIO_LOG(ERR, "Unable to map region (errno = %d)", errno);
167                 return -errno;
168         }
169
170         msi_intr_vaddr = (uint32_t *)((char *)(vaddr) + 64);
171         map.vaddr = (unsigned long)vaddr;
172         ret = ioctl(group->container->fd, VFIO_IOMMU_MAP_DMA, &map);
173         if (ret == 0)
174                 return 0;
175
176         FSLMC_VFIO_LOG(ERR, "VFIO_IOMMU_MAP_DMA fails (errno = %d)", errno);
177         return -errno;
178 }
179
180 int vfio_dmamap_mem_region(uint64_t vaddr,
181                            uint64_t iova,
182                            uint64_t size)
183 {
184         struct fslmc_vfio_group *group;
185         struct vfio_iommu_type1_dma_map dma_map = {
186                 .argsz = sizeof(dma_map),
187                 .flags = VFIO_DMA_MAP_FLAG_READ | VFIO_DMA_MAP_FLAG_WRITE,
188         };
189
190         dma_map.vaddr = vaddr;
191         dma_map.size = size;
192         dma_map.iova = iova;
193
194         /* SET DMA MAP for IOMMU */
195         group = &vfio_groups[0];
196         if (ioctl(group->container->fd, VFIO_IOMMU_MAP_DMA, &dma_map)) {
197                 FSLMC_VFIO_LOG(ERR, "VFIO_IOMMU_MAP_DMA (errno = %d)", errno);
198                 return -1;
199         }
200         return 0;
201 }
202
203 int rte_fslmc_vfio_dmamap(void)
204 {
205         int ret;
206         struct fslmc_vfio_group *group;
207         struct vfio_iommu_type1_dma_map dma_map = {
208                 .argsz = sizeof(struct vfio_iommu_type1_dma_map),
209                 .flags = VFIO_DMA_MAP_FLAG_READ | VFIO_DMA_MAP_FLAG_WRITE,
210         };
211
212         int i;
213         const struct rte_memseg *memseg;
214
215         if (is_dma_done)
216                 return 0;
217         is_dma_done = 1;
218
219         for (i = 0; i < RTE_MAX_MEMSEG; i++) {
220                 memseg = rte_eal_get_physmem_layout();
221                 if (memseg == NULL) {
222                         FSLMC_VFIO_LOG(ERR, "Cannot get physical layout.");
223                         return -ENODEV;
224                 }
225
226                 if (memseg[i].addr == NULL && memseg[i].len == 0)
227                         break;
228
229                 dma_map.size = memseg[i].len;
230                 dma_map.vaddr = memseg[i].addr_64;
231 #ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA
232                 dma_map.iova = memseg[i].phys_addr;
233 #else
234                 dma_map.iova = dma_map.vaddr;
235 #endif
236
237                 /* SET DMA MAP for IOMMU */
238                 group = &vfio_groups[0];
239
240                 if (!group->container) {
241                         FSLMC_VFIO_LOG(ERR, "Container is not connected ");
242                         return -1;
243                 }
244
245                 FSLMC_VFIO_LOG(DEBUG, "-->Initial SHM Virtual ADDR %llX",
246                              dma_map.vaddr);
247                 FSLMC_VFIO_LOG(DEBUG, "-----> DMA size 0x%llX", dma_map.size);
248                 ret = ioctl(group->container->fd, VFIO_IOMMU_MAP_DMA,
249                             &dma_map);
250                 if (ret) {
251                         FSLMC_VFIO_LOG(ERR, "VFIO_IOMMU_MAP_DMA API(errno = %d)",
252                                        errno);
253                         return ret;
254                 }
255         }
256
257         /* TODO - This is a W.A. as VFIO currently does not add the mapping of
258          * the interrupt region to SMMU. This should be removed once the
259          * support is added in the Kernel.
260          */
261         vfio_map_irq_region(group);
262
263         return 0;
264 }
265
266 static int64_t vfio_map_mcp_obj(struct fslmc_vfio_group *group, char *mcp_obj)
267 {
268         int64_t v_addr = (int64_t)MAP_FAILED;
269         int32_t ret, mc_fd;
270
271         struct vfio_device_info d_info = { .argsz = sizeof(d_info) };
272         struct vfio_region_info reg_info = { .argsz = sizeof(reg_info) };
273
274         /* getting the mcp object's fd*/
275         mc_fd = ioctl(group->fd, VFIO_GROUP_GET_DEVICE_FD, mcp_obj);
276         if (mc_fd < 0) {
277                 FSLMC_VFIO_LOG(ERR, "error in VFIO get dev %s fd from group %d",
278                                mcp_obj, group->fd);
279                 return v_addr;
280         }
281
282         /* getting device info*/
283         ret = ioctl(mc_fd, VFIO_DEVICE_GET_INFO, &d_info);
284         if (ret < 0) {
285                 FSLMC_VFIO_LOG(ERR, "error in VFIO getting DEVICE_INFO");
286                 goto MC_FAILURE;
287         }
288
289         /* getting device region info*/
290         ret = ioctl(mc_fd, VFIO_DEVICE_GET_REGION_INFO, &reg_info);
291         if (ret < 0) {
292                 FSLMC_VFIO_LOG(ERR, "error in VFIO getting REGION_INFO");
293                 goto MC_FAILURE;
294         }
295
296         FSLMC_VFIO_LOG(DEBUG, "region offset = %llx  , region size = %llx",
297                        reg_info.offset, reg_info.size);
298
299         v_addr = (uint64_t)mmap(NULL, reg_info.size,
300                 PROT_WRITE | PROT_READ, MAP_SHARED,
301                 mc_fd, reg_info.offset);
302
303 MC_FAILURE:
304         close(mc_fd);
305
306         return v_addr;
307 }
308
309 static inline int
310 dpaa2_compare_dpaa2_dev(const struct rte_dpaa2_device *dev,
311                          const struct rte_dpaa2_device *dev2)
312 {
313         /*not the same family device */
314         if (dev->dev_type != DPAA2_MC_DPNI_DEVID ||
315                         dev->dev_type != DPAA2_MC_DPSECI_DEVID)
316                 return -1;
317
318         if (dev->object_id == dev2->object_id)
319                 return 0;
320         else
321                 return 1;
322 }
323
324 static void
325 fslmc_bus_add_device(struct rte_dpaa2_device *dev)
326 {
327         struct rte_fslmc_device_list *dev_l;
328
329         dev_l = &rte_fslmc_bus.device_list;
330
331         /* device is valid, add in list (sorted) */
332         if (TAILQ_EMPTY(dev_l)) {
333                 TAILQ_INSERT_TAIL(dev_l, dev, next);
334         } else {
335                 struct rte_dpaa2_device *dev2;
336                 int ret;
337
338                 TAILQ_FOREACH(dev2, dev_l, next) {
339                         ret = dpaa2_compare_dpaa2_dev(dev, dev2);
340                         if (ret <= 0)
341                                 continue;
342
343                         TAILQ_INSERT_BEFORE(dev2, dev, next);
344                         return;
345                 }
346
347                 TAILQ_INSERT_TAIL(dev_l, dev, next);
348         }
349 }
350
351 /* Following function shall fetch total available list of MC devices
352  * from VFIO container & populate private list of devices and other
353  * data structures
354  */
355 int fslmc_vfio_process_group(void)
356 {
357         struct fslmc_vfio_device *vdev;
358         struct vfio_device_info device_info = { .argsz = sizeof(device_info) };
359         char *temp_obj, *object_type, *mcp_obj, *dev_name;
360         int32_t object_id, i, dev_fd, ret;
361         DIR *d;
362         struct dirent *dir;
363         char path[PATH_MAX];
364         int64_t v_addr;
365         int ndev_count;
366         int dpio_count = 0, dpbp_count = 0;
367         struct fslmc_vfio_group *group = &vfio_groups[0];
368         static int process_once;
369
370         /* if already done once */
371         if (process_once) {
372                 FSLMC_VFIO_LOG(DEBUG,
373                                "Already scanned once - re-scan not supported");
374                 return 0;
375         }
376         process_once = 0;
377
378         sprintf(path, "/sys/kernel/iommu_groups/%d/devices", group->groupid);
379
380         d = opendir(path);
381         if (!d) {
382                 FSLMC_VFIO_LOG(ERR, "Unable to open directory %s", path);
383                 return -1;
384         }
385
386         /*Counting the number of devices in a group and getting the mcp ID*/
387         ndev_count = 0;
388         mcp_obj = NULL;
389         while ((dir = readdir(d)) != NULL) {
390                 if (dir->d_type == DT_LNK) {
391                         ndev_count++;
392                         if (!strncmp("dpmcp", dir->d_name, 5)) {
393                                 if (mcp_obj)
394                                         free(mcp_obj);
395                                 mcp_obj = malloc(sizeof(dir->d_name));
396                                 if (!mcp_obj) {
397                                         FSLMC_VFIO_LOG(ERR,
398                                                        "mcp obj:alloc failed");
399                                         closedir(d);
400                                         return -ENOMEM;
401                                 }
402                                 strcpy(mcp_obj, dir->d_name);
403                                 temp_obj = strtok(dir->d_name, ".");
404                                 temp_obj = strtok(NULL, ".");
405                                 sscanf(temp_obj, "%d", &mcp_id);
406                         }
407                 }
408         }
409         closedir(d);
410         d = NULL;
411         if (!mcp_obj) {
412                 FSLMC_VFIO_LOG(ERR, "DPAA2 MCP Object not Found");
413                 return -ENODEV;
414         }
415         RTE_LOG(INFO, EAL, "fslmc: DPRC contains = %d devices\n", ndev_count);
416
417         /* Allocate the memory depends upon number of objects in a group*/
418         group->vfio_device = (struct fslmc_vfio_device *)malloc(ndev_count *
419                              sizeof(struct fslmc_vfio_device));
420         if (!(group->vfio_device)) {
421                 FSLMC_VFIO_LOG(ERR, "vfio device: Unable to allocate memory\n");
422                 free(mcp_obj);
423                 return -ENOMEM;
424         }
425
426         /* Allocate memory for MC Portal list */
427         rte_mcp_ptr_list = malloc(sizeof(void *) * 1);
428         if (!rte_mcp_ptr_list) {
429                 FSLMC_VFIO_LOG(ERR, "portal list: Unable to allocate memory!");
430                 free(mcp_obj);
431                 goto FAILURE;
432         }
433
434         v_addr = vfio_map_mcp_obj(group, mcp_obj);
435         free(mcp_obj);
436         if (v_addr == (int64_t)MAP_FAILED) {
437                 FSLMC_VFIO_LOG(ERR, "Error mapping region (errno = %d)", errno);
438                 goto FAILURE;
439         }
440
441         rte_mcp_ptr_list[0] = (void *)v_addr;
442
443         d = opendir(path);
444         if (!d) {
445                 FSLMC_VFIO_LOG(ERR, "Unable to open %s Directory", path);
446                 goto FAILURE;
447         }
448
449         i = 0;
450         /* Parsing each object and initiating them*/
451         while ((dir = readdir(d)) != NULL) {
452                 if (dir->d_type != DT_LNK)
453                         continue;
454                 if (!strncmp("dprc", dir->d_name, 4) ||
455                     !strncmp("dpmcp", dir->d_name, 5))
456                         continue;
457                 dev_name = malloc(sizeof(dir->d_name));
458                 if (!dev_name) {
459                         FSLMC_VFIO_LOG(ERR, "name: Unable to allocate memory");
460                         goto FAILURE;
461                 }
462                 strcpy(dev_name, dir->d_name);
463                 object_type = strtok(dir->d_name, ".");
464                 temp_obj = strtok(NULL, ".");
465                 sscanf(temp_obj, "%d", &object_id);
466
467                 /* getting the device fd*/
468                 dev_fd = ioctl(group->fd, VFIO_GROUP_GET_DEVICE_FD, dev_name);
469                 if (dev_fd < 0) {
470                         FSLMC_VFIO_LOG(ERR,
471                                        "GET_DEVICE_FD error fd: %s, Group: %d",
472                                        dev_name, group->fd);
473                         free(dev_name);
474                         goto FAILURE;
475                 }
476
477                 free(dev_name);
478                 vdev = &group->vfio_device[group->object_index++];
479                 vdev->fd = dev_fd;
480                 vdev->index = i;
481                 i++;
482                 /* Get Device inofrmation */
483                 if (ioctl(vdev->fd, VFIO_DEVICE_GET_INFO, &device_info)) {
484                         FSLMC_VFIO_LOG(ERR, "DPAA2 VFIO_DEVICE_GET_INFO fail");
485                         goto FAILURE;
486                 }
487                 if (!strcmp(object_type, "dpni") ||
488                     !strcmp(object_type, "dpseci")) {
489                         struct rte_dpaa2_device *dev;
490
491                         dev = malloc(sizeof(struct rte_dpaa2_device));
492                         if (dev == NULL)
493                                 return -1;
494
495                         memset(dev, 0, sizeof(*dev));
496                         /* store hw_id of dpni/dpseci device */
497                         dev->object_id = object_id;
498                         dev->dev_type = (strcmp(object_type, "dpseci")) ?
499                                 DPAA2_MC_DPNI_DEVID : DPAA2_MC_DPSECI_DEVID;
500
501                         FSLMC_VFIO_LOG(DEBUG, "DPAA2: Added [%s-%d]",
502                                       object_type, object_id);
503
504                         fslmc_bus_add_device(dev);
505                 }
506                 if (!strcmp(object_type, "dpio")) {
507                         ret = dpaa2_create_dpio_device(vdev,
508                                                        &device_info,
509                                                        object_id);
510                         if (!ret)
511                                 dpio_count++;
512                 }
513                 if (!strcmp(object_type, "dpbp")) {
514                         ret = dpaa2_create_dpbp_device(object_id);
515                         if (!ret)
516                                 dpbp_count++;
517                 }
518         }
519         closedir(d);
520
521         ret = dpaa2_affine_qbman_swp();
522         if (ret)
523                 FSLMC_VFIO_LOG(DEBUG, "Error in affining qbman swp %d", ret);
524
525         FSLMC_VFIO_LOG(DEBUG, "DPAA2: Added dpbp_count = %d dpio_count=%d",
526                       dpbp_count, dpio_count);
527         return 0;
528
529 FAILURE:
530         if (d)
531                 closedir(d);
532         if (rte_mcp_ptr_list) {
533                 free(rte_mcp_ptr_list);
534                 rte_mcp_ptr_list = NULL;
535         }
536
537         free(group->vfio_device);
538         group->vfio_device = NULL;
539         return -1;
540 }
541
542 int fslmc_vfio_setup_group(void)
543 {
544         struct fslmc_vfio_group *group = NULL;
545         int groupid;
546         int ret, i;
547         char *container;
548         struct vfio_group_status status = { .argsz = sizeof(status) };
549
550         /* if already done once */
551         if (container_device_fd)
552                 return 0;
553
554         container = getenv("DPRC");
555
556         if (container == NULL) {
557                 FSLMC_VFIO_LOG(ERR, "VFIO container not set in env DPRC");
558                 return -EOPNOTSUPP;
559         }
560
561         /* get group number */
562         ret = vfio_get_group_no(SYSFS_FSL_MC_DEVICES, container, &groupid);
563         if (ret == 0) {
564                 RTE_LOG(WARNING, EAL, "%s not managed by VFIO, skipping\n",
565                         container);
566                 return -EOPNOTSUPP;
567         }
568
569         /* if negative, something failed */
570         if (ret < 0)
571                 return ret;
572
573         FSLMC_VFIO_LOG(DEBUG, "VFIO iommu group id = %d", groupid);
574
575         /* Check if group already exists */
576         for (i = 0; i < VFIO_MAX_GRP; i++) {
577                 group = &vfio_groups[i];
578                 if (group->groupid == groupid) {
579                         FSLMC_VFIO_LOG(ERR, "groupid already exists %d",
580                                        groupid);
581                         return 0;
582                 }
583         }
584
585         /* get the actual group fd */
586         ret = vfio_get_group_fd(groupid);
587         if (ret < 0)
588                 return ret;
589         group->fd = ret;
590
591         /*
592          * at this point, we know that this group is viable (meaning,
593          * all devices are either bound to VFIO or not bound to anything)
594          */
595
596         ret = ioctl(group->fd, VFIO_GROUP_GET_STATUS, &status);
597         if (ret) {
598                 FSLMC_VFIO_LOG(ERR, " VFIO error getting group status");
599                 close(group->fd);
600                 return ret;
601         }
602
603         if (!(status.flags & VFIO_GROUP_FLAGS_VIABLE)) {
604                 FSLMC_VFIO_LOG(ERR, "VFIO group not viable");
605                 close(group->fd);
606                 return -EPERM;
607         }
608         /* Since Group is VIABLE, Store the groupid */
609         group->groupid = groupid;
610
611         /* check if group does not have a container yet */
612         if (!(status.flags & VFIO_GROUP_FLAGS_CONTAINER_SET)) {
613                 /* Now connect this IOMMU group to given container */
614                 ret = vfio_connect_container(group);
615                 if (ret) {
616                         FSLMC_VFIO_LOG(ERR, "VFIO error connecting container"
617                                        " with groupid %d", groupid);
618                         close(group->fd);
619                         return ret;
620                 }
621         }
622
623         /* Get Device information */
624         ret = ioctl(group->fd, VFIO_GROUP_GET_DEVICE_FD, container);
625         if (ret < 0) {
626                 FSLMC_VFIO_LOG(ERR, "VFIO error getting device %s fd from"
627                                " group  %d", container, group->groupid);
628                 return ret;
629         }
630         container_device_fd = ret;
631         FSLMC_VFIO_LOG(DEBUG, "VFIO Container FD is [0x%X]",
632                      container_device_fd);
633
634         return 0;
635 }