MCPcopy Create free account
hub / github.com/F-Stack/f-stack / device_setup

Function device_setup

dpdk/drivers/bus/platform/platform.c:321–362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

319}
320
321static int
322device_setup(struct rte_platform_device *pdev)
323{
324 struct vfio_device_info dev_info = { .argsz = sizeof(dev_info), };
325 const char *name = pdev->name;
326 int ret;
327
328 ret = rte_vfio_setup_device(PLATFORM_BUS_DEVICES_PATH, name, &pdev->dev_fd, &dev_info);
329 if (ret) {
330 PLATFORM_LOG(ERR, "failed to setup %s\n", name);
331 return -ENODEV;
332 }
333
334 /* This is an extra check to confirm that platform device was initialized
335 * by a kernel vfio-platform driver. On kernels that predate vfio-platform
336 * driver this flag obviously does not exist. In such scenarios this
337 * check needs to be removed otherwise compilation fails.
338 *
339 * Now, on such old kernels code will never reach here because
340 * there is another check much earlier which verifies whether
341 * device has been bound to vfio-platform driver.
342 */
343#ifdef VFIO_DEVICE_FLAGS_PLATFORM
344 if (!(dev_info.flags & VFIO_DEVICE_FLAGS_PLATFORM)) {
345 PLATFORM_LOG(ERR, "device not backed by vfio-platform\n");
346 ret = -ENOTSUP;
347 goto out;
348 }
349#endif
350
351 ret = device_map_resources(pdev, dev_info.num_regions);
352 if (ret) {
353 PLATFORM_LOG(ERR, "failed to setup platform resources\n");
354 goto out;
355 }
356
357 return 0;
358out:
359 device_cleanup(pdev);
360
361 return ret;
362}
363
364static int
365driver_call_probe(struct rte_platform_driver *pdrv, struct rte_platform_device *pdev)

Callers 1

driver_probe_deviceFunction · 0.85

Calls 3

device_map_resourcesFunction · 0.85
device_cleanupFunction · 0.85
rte_vfio_setup_deviceFunction · 0.50

Tested by

no test coverage detected