Lines Matching refs:vdev
37 struct virtio_device *vdev;
381 static int viommu_domain_map_identity(struct viommu_endpoint *vdev,
394 list_for_each_entry(resv, &vdev->resv_regions, list) {
465 static int viommu_add_resv_mem(struct viommu_endpoint *vdev,
488 dev_warn(vdev->dev, "unknown resv mem subtype 0x%x\n",
506 list_for_each_entry(next, &vdev->resv_regions, list) {
523 struct viommu_endpoint *vdev = dev_iommu_priv_get(dev);
554 ret = viommu_add_resv_mem(vdev, (void *)prop, len);
618 struct viommu_dev *viommu = vq->vdev->priv;
660 static int viommu_domain_finalise(struct viommu_endpoint *vdev,
665 struct viommu_dev *viommu = vdev->viommu;
670 dev_err(vdev->dev,
690 if (virtio_has_feature(viommu->vdev,
696 ret = viommu_domain_map_identity(vdev, vdomain);
726 struct viommu_endpoint *vdev = dev_iommu_priv_get(dev);
735 ret = viommu_domain_finalise(vdev, domain);
736 } else if (vdomain->viommu != vdev->viommu) {
754 * vdev->vdomain is protected by group->mutex
756 if (vdev->vdomain)
757 vdev->vdomain->nr_endpoints--;
786 vdev->vdomain = vdomain;
791 static void viommu_detach_dev(struct viommu_endpoint *vdev)
795 struct viommu_domain *vdomain = vdev->vdomain;
796 struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(vdev->dev);
808 WARN_ON(viommu_send_req_sync(vdev->viommu, &req, sizeof(req)));
811 vdev->vdomain = NULL;
918 struct viommu_endpoint *vdev = dev_iommu_priv_get(dev);
921 list_for_each_entry(entry, &vdev->resv_regions, list) {
968 struct viommu_endpoint *vdev;
979 vdev = kzalloc(sizeof(*vdev), GFP_KERNEL);
980 if (!vdev)
983 vdev->dev = dev;
984 vdev->viommu = viommu;
985 INIT_LIST_HEAD(&vdev->resv_regions);
986 dev_iommu_priv_set(dev, vdev);
998 iommu_put_resv_regions(dev, &vdev->resv_regions);
999 kfree(vdev);
1015 struct viommu_endpoint *vdev = dev_iommu_priv_get(dev);
1017 viommu_detach_dev(vdev);
1018 iommu_put_resv_regions(dev, &vdev->resv_regions);
1019 kfree(vdev);
1067 struct virtio_device *vdev = dev_to_virtio(viommu->dev);
1074 return virtio_find_vqs(vdev, VIOMMU_NR_VQS, viommu->vqs, callbacks,
1101 static int viommu_probe(struct virtio_device *vdev)
1103 struct device *parent_dev = vdev->dev.parent;
1105 struct device *dev = &vdev->dev;
1110 if (!virtio_has_feature(vdev, VIRTIO_F_VERSION_1) ||
1111 !virtio_has_feature(vdev, VIRTIO_IOMMU_F_MAP_UNMAP))
1121 viommu->vdev = vdev;
1128 virtio_cread_le(vdev, struct virtio_iommu_config, page_size_mask,
1140 virtio_cread_le_feature(vdev, VIRTIO_IOMMU_F_INPUT_RANGE,
1144 virtio_cread_le_feature(vdev, VIRTIO_IOMMU_F_INPUT_RANGE,
1148 virtio_cread_le_feature(vdev, VIRTIO_IOMMU_F_DOMAIN_RANGE,
1152 virtio_cread_le_feature(vdev, VIRTIO_IOMMU_F_DOMAIN_RANGE,
1156 virtio_cread_le_feature(vdev, VIRTIO_IOMMU_F_PROBE,
1166 if (virtio_has_feature(vdev, VIRTIO_IOMMU_F_MMIO))
1171 virtio_device_ready(vdev);
1179 virtio_bus_name(vdev));
1185 vdev->priv = viommu;
1194 vdev->config->del_vqs(vdev);
1199 static void viommu_remove(struct virtio_device *vdev)
1201 struct viommu_dev *viommu = vdev->priv;
1207 virtio_reset_device(vdev);
1208 vdev->config->del_vqs(vdev);
1210 dev_info(&vdev->dev, "device removed\n");
1213 static void viommu_config_changed(struct virtio_device *vdev)
1215 dev_warn(&vdev->dev, "config changed\n");