Lines Matching refs:mc_dev

26 	struct fsl_mc_device *mc_dev = vdev->mc_dev;  in vfio_fsl_mc_open_device()  local
27 int count = mc_dev->obj_desc.region_count; in vfio_fsl_mc_open_device()
36 struct resource *res = &mc_dev->regions[i]; in vfio_fsl_mc_open_device()
37 int no_mmap = is_fsl_mc_bus_dprc(mc_dev); in vfio_fsl_mc_open_device()
41 vdev->regions[i].type = mc_dev->regions[i].flags & IORESOURCE_BITS; in vfio_fsl_mc_open_device()
51 if (!(mc_dev->regions[i].flags & IORESOURCE_READONLY)) in vfio_fsl_mc_open_device()
60 struct fsl_mc_device *mc_dev = vdev->mc_dev; in vfio_fsl_mc_regions_cleanup() local
63 for (i = 0; i < mc_dev->obj_desc.region_count; i++) in vfio_fsl_mc_regions_cleanup()
70 struct fsl_mc_device *mc_dev = vdev->mc_dev; in vfio_fsl_mc_reset_device() local
73 if (is_fsl_mc_bus_dprc(vdev->mc_dev)) { in vfio_fsl_mc_reset_device()
74 return dprc_reset_container(mc_dev->mc_io, 0, in vfio_fsl_mc_reset_device()
75 mc_dev->mc_handle, in vfio_fsl_mc_reset_device()
76 mc_dev->obj_desc.id, in vfio_fsl_mc_reset_device()
81 ret = fsl_mc_obj_open(mc_dev->mc_io, 0, mc_dev->obj_desc.id, in vfio_fsl_mc_reset_device()
82 mc_dev->obj_desc.type, in vfio_fsl_mc_reset_device()
86 ret = fsl_mc_obj_reset(mc_dev->mc_io, 0, token); in vfio_fsl_mc_reset_device()
88 fsl_mc_obj_close(mc_dev->mc_io, 0, token); in vfio_fsl_mc_reset_device()
91 ret = fsl_mc_obj_close(mc_dev->mc_io, 0, token); in vfio_fsl_mc_reset_device()
101 struct fsl_mc_device *mc_dev = vdev->mc_dev; in vfio_fsl_mc_close_device() local
102 struct device *cont_dev = fsl_mc_cont_dev(&mc_dev->dev); in vfio_fsl_mc_close_device()
126 struct fsl_mc_device *mc_dev = vdev->mc_dev; in vfio_fsl_mc_ioctl() local
143 if (is_fsl_mc_bus_dprc(mc_dev)) in vfio_fsl_mc_ioctl()
146 info.num_regions = mc_dev->obj_desc.region_count; in vfio_fsl_mc_ioctl()
147 info.num_irqs = mc_dev->obj_desc.irq_count; in vfio_fsl_mc_ioctl()
164 if (info.index >= mc_dev->obj_desc.region_count) in vfio_fsl_mc_ioctl()
187 if (info.index >= mc_dev->obj_desc.irq_count) in vfio_fsl_mc_ioctl()
209 ret = vfio_set_irqs_validate_and_prepare(&hdr, mc_dev->obj_desc.irq_count, in vfio_fsl_mc_ioctl()
210 mc_dev->obj_desc.irq_count, &data_size); in vfio_fsl_mc_ioctl()
247 struct fsl_mc_device *mc_dev = vdev->mc_dev; in vfio_fsl_mc_read() local
252 if (index >= mc_dev->obj_desc.region_count) in vfio_fsl_mc_read()
326 struct fsl_mc_device *mc_dev = vdev->mc_dev; in vfio_fsl_mc_write() local
331 if (index >= mc_dev->obj_desc.region_count) in vfio_fsl_mc_write()
389 struct fsl_mc_device *mc_dev = vdev->mc_dev; in vfio_fsl_mc_mmap() local
402 if (index >= mc_dev->obj_desc.region_count) in vfio_fsl_mc_mmap()
416 vma->vm_private_data = mc_dev; in vfio_fsl_mc_mmap()
428 struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev); in vfio_fsl_mc_bus_notifier() local
429 struct fsl_mc_device *mc_cont = to_fsl_mc_device(mc_dev->dev.parent); in vfio_fsl_mc_bus_notifier()
432 vdev->mc_dev == mc_cont) { in vfio_fsl_mc_bus_notifier()
433 mc_dev->driver_override = kasprintf(GFP_KERNEL, "%s", in vfio_fsl_mc_bus_notifier()
435 if (!mc_dev->driver_override) in vfio_fsl_mc_bus_notifier()
442 vdev->mc_dev == mc_cont) { in vfio_fsl_mc_bus_notifier()
455 struct fsl_mc_device *mc_dev = vdev->mc_dev; in vfio_fsl_mc_init_device() local
459 if (!is_fsl_mc_bus_dprc(mc_dev)) { in vfio_fsl_mc_init_device()
460 struct fsl_mc_device *mc_cont = to_fsl_mc_device(mc_dev->dev.parent); in vfio_fsl_mc_init_device()
462 mc_dev->mc_io = mc_cont->mc_io; in vfio_fsl_mc_init_device()
472 ret = dprc_setup(mc_dev); in vfio_fsl_mc_init_device()
474 dev_err(&mc_dev->dev, "VFIO_FSL_MC: Failed to setup DPRC (%d)\n", ret); in vfio_fsl_mc_init_device()
484 static int vfio_fsl_mc_scan_container(struct fsl_mc_device *mc_dev) in vfio_fsl_mc_scan_container() argument
489 if (!is_fsl_mc_bus_dprc(mc_dev)) in vfio_fsl_mc_scan_container()
491 ret = dprc_scan_container(mc_dev, false); in vfio_fsl_mc_scan_container()
493 dev_err(&mc_dev->dev, in vfio_fsl_mc_scan_container()
495 dprc_remove_devices(mc_dev, NULL, 0); in vfio_fsl_mc_scan_container()
503 struct fsl_mc_device *mc_dev = vdev->mc_dev; in vfio_fsl_uninit_device() local
505 if (!is_fsl_mc_bus_dprc(mc_dev)) in vfio_fsl_uninit_device()
508 dprc_cleanup(mc_dev); in vfio_fsl_uninit_device()
516 struct fsl_mc_device *mc_dev = to_fsl_mc_device(core_vdev->dev); in vfio_fsl_mc_init_dev() local
519 vdev->mc_dev = mc_dev; in vfio_fsl_mc_init_dev()
522 if (is_fsl_mc_bus_dprc(mc_dev)) in vfio_fsl_mc_init_dev()
523 ret = vfio_assign_device_set(core_vdev, &mc_dev->dev); in vfio_fsl_mc_init_dev()
525 ret = vfio_assign_device_set(core_vdev, mc_dev->dev.parent); in vfio_fsl_mc_init_dev()
534 static int vfio_fsl_mc_probe(struct fsl_mc_device *mc_dev) in vfio_fsl_mc_probe() argument
537 struct device *dev = &mc_dev->dev; in vfio_fsl_mc_probe()
551 ret = vfio_fsl_mc_scan_container(mc_dev); in vfio_fsl_mc_probe()
573 static void vfio_fsl_mc_remove(struct fsl_mc_device *mc_dev) in vfio_fsl_mc_remove() argument
575 struct device *dev = &mc_dev->dev; in vfio_fsl_mc_remove()
579 dprc_remove_devices(mc_dev, NULL, 0); in vfio_fsl_mc_remove()