Lines Matching refs:vmci_host_dev

84 struct vmci_host_dev {  struct
121 struct vmci_host_dev *vmci_host_dev; in vmci_host_open() local
123 vmci_host_dev = kzalloc(sizeof(struct vmci_host_dev), GFP_KERNEL); in vmci_host_open()
124 if (vmci_host_dev == NULL) in vmci_host_open()
127 vmci_host_dev->ct_type = VMCIOBJ_NOT_SET; in vmci_host_open()
128 mutex_init(&vmci_host_dev->lock); in vmci_host_open()
129 filp->private_data = vmci_host_dev; in vmci_host_open()
140 struct vmci_host_dev *vmci_host_dev = filp->private_data; in vmci_host_close() local
142 if (vmci_host_dev->ct_type == VMCIOBJ_CONTEXT) { in vmci_host_close()
143 vmci_ctx_destroy(vmci_host_dev->context); in vmci_host_close()
144 vmci_host_dev->context = NULL; in vmci_host_close()
154 vmci_host_dev->ct_type = VMCIOBJ_NOT_SET; in vmci_host_close()
156 kfree(vmci_host_dev); in vmci_host_close()
167 struct vmci_host_dev *vmci_host_dev = filp->private_data; in vmci_host_poll() local
171 if (vmci_host_dev->ct_type == VMCIOBJ_CONTEXT) { in vmci_host_poll()
176 context = vmci_host_dev->context; in vmci_host_poll()
263 static int vmci_host_get_version(struct vmci_host_dev *vmci_host_dev, in vmci_host_get_version() argument
268 if (get_user(vmci_host_dev->user_version, vptr)) in vmci_host_get_version()
286 if (vmci_host_dev->user_version > 0 && in vmci_host_get_version()
287 vmci_host_dev->user_version < VMCI_VERSION_HOSTQP) { in vmci_host_get_version()
288 return vmci_host_dev->user_version; in vmci_host_get_version()
297 static int vmci_host_do_init_context(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_init_context() argument
310 mutex_lock(&vmci_host_dev->lock); in vmci_host_do_init_context()
312 if (vmci_host_dev->ct_type != VMCIOBJ_NOT_SET) { in vmci_host_do_init_context()
325 vmci_host_dev->context = vmci_ctx_create(init_block.cid, in vmci_host_do_init_context()
327 vmci_host_dev->user_version, in vmci_host_do_init_context()
330 if (IS_ERR(vmci_host_dev->context)) { in vmci_host_do_init_context()
331 retval = PTR_ERR(vmci_host_dev->context); in vmci_host_do_init_context()
340 init_block.cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_init_context()
342 vmci_ctx_destroy(vmci_host_dev->context); in vmci_host_do_init_context()
343 vmci_host_dev->context = NULL; in vmci_host_do_init_context()
349 vmci_host_dev->ct_type = VMCIOBJ_CONTEXT; in vmci_host_do_init_context()
357 mutex_unlock(&vmci_host_dev->lock); in vmci_host_do_init_context()
361 static int vmci_host_do_send_datagram(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_send_datagram() argument
369 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_send_datagram()
409 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_send_datagram()
416 static int vmci_host_do_receive_datagram(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_receive_datagram() argument
425 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_receive_datagram()
434 recv_info.result = vmci_ctx_dequeue_datagram(vmci_host_dev->context, in vmci_host_do_receive_datagram()
448 static int vmci_host_do_alloc_queuepair(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_alloc_queuepair() argument
456 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_alloc_queuepair()
461 if (vmci_host_dev->user_version < VMCI_VERSION_NOVMVM) { in vmci_host_do_alloc_queuepair()
478 vmci_host_dev->context); in vmci_host_do_alloc_queuepair()
503 vmci_host_dev->context); in vmci_host_do_alloc_queuepair()
509 vmci_host_dev->context); in vmci_host_do_alloc_queuepair()
517 static int vmci_host_do_queuepair_setva(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_queuepair_setva() argument
525 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_queuepair_setva()
530 if (vmci_host_dev->user_version < VMCI_VERSION_NOVMVM) { in vmci_host_do_queuepair_setva()
544 vmci_host_dev->context, in vmci_host_do_queuepair_setva()
552 vmci_host_dev->context, 0); in vmci_host_do_queuepair_setva()
558 static int vmci_host_do_queuepair_setpf(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_queuepair_setpf() argument
566 if (vmci_host_dev->user_version < VMCI_VERSION_HOSTQP || in vmci_host_do_queuepair_setpf()
567 vmci_host_dev->user_version >= VMCI_VERSION_NOVMVM) { in vmci_host_do_queuepair_setpf()
569 vmci_host_dev->user_version); in vmci_host_do_queuepair_setpf()
573 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_queuepair_setpf()
609 vmci_host_dev->context); in vmci_host_do_queuepair_setpf()
636 static int vmci_host_do_qp_detach(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_qp_detach() argument
644 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_qp_detach()
653 vmci_host_dev->context); in vmci_host_do_qp_detach()
655 vmci_host_dev->user_version < VMCI_VERSION_NOVMVM) { in vmci_host_do_qp_detach()
662 static int vmci_host_do_ctx_add_notify(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_ctx_add_notify() argument
671 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_ctx_add_notify()
679 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_ctx_add_notify()
685 static int vmci_host_do_ctx_remove_notify(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_ctx_remove_notify() argument
694 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_ctx_remove_notify()
702 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_ctx_remove_notify()
709 static int vmci_host_do_ctx_get_cpt_state(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_ctx_get_cpt_state() argument
718 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_ctx_get_cpt_state()
726 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_ctx_get_cpt_state()
741 static int vmci_host_do_ctx_set_cpt_state(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_ctx_set_cpt_state() argument
750 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_ctx_set_cpt_state()
763 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_ctx_set_cpt_state()
773 static int vmci_host_do_get_context_id(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_get_context_id() argument
782 static int vmci_host_do_set_notify(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_set_notify() argument
788 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_set_notify()
798 vmci_host_setup_notify(vmci_host_dev->context, in vmci_host_do_set_notify()
801 vmci_ctx_unset_notify(vmci_host_dev->context); in vmci_host_do_set_notify()
809 static int vmci_host_do_notify_resource(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_notify_resource() argument
816 if (vmci_host_dev->user_version < VMCI_VERSION_NOTIFY) { in vmci_host_do_notify_resource()
821 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_notify_resource()
829 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_notify_resource()
859 static int vmci_host_do_recv_notifications(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_recv_notifications() argument
870 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_recv_notifications()
875 if (vmci_host_dev->user_version < VMCI_VERSION_NOTIFY) { in vmci_host_do_recv_notifications()
888 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_recv_notifications()
921 vmci_host_dev, name, uptr); \ in vmci_host_unlocked_ioctl()
924 struct vmci_host_dev *vmci_host_dev = filp->private_data; in vmci_host_unlocked_ioctl() local
961 return vmci_host_get_version(vmci_host_dev, iocmd, uptr); in vmci_host_unlocked_ioctl()