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
168 struct vmci_ctx *context = vmci_host_dev->context; in vmci_host_poll()
171 if (vmci_host_dev->ct_type == VMCIOBJ_CONTEXT) { in vmci_host_poll()
255 static int vmci_host_get_version(struct vmci_host_dev *vmci_host_dev, in vmci_host_get_version() argument
260 if (get_user(vmci_host_dev->user_version, vptr)) in vmci_host_get_version()
278 if (vmci_host_dev->user_version > 0 && in vmci_host_get_version()
279 vmci_host_dev->user_version < VMCI_VERSION_HOSTQP) { in vmci_host_get_version()
280 return vmci_host_dev->user_version; in vmci_host_get_version()
289 static int vmci_host_do_init_context(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_init_context() argument
302 mutex_lock(&vmci_host_dev->lock); in vmci_host_do_init_context()
304 if (vmci_host_dev->ct_type != VMCIOBJ_NOT_SET) { in vmci_host_do_init_context()
317 vmci_host_dev->context = vmci_ctx_create(init_block.cid, in vmci_host_do_init_context()
319 vmci_host_dev->user_version, in vmci_host_do_init_context()
322 if (IS_ERR(vmci_host_dev->context)) { in vmci_host_do_init_context()
323 retval = PTR_ERR(vmci_host_dev->context); in vmci_host_do_init_context()
332 init_block.cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_init_context()
334 vmci_ctx_destroy(vmci_host_dev->context); in vmci_host_do_init_context()
335 vmci_host_dev->context = NULL; in vmci_host_do_init_context()
341 vmci_host_dev->ct_type = VMCIOBJ_CONTEXT; in vmci_host_do_init_context()
349 mutex_unlock(&vmci_host_dev->lock); in vmci_host_do_init_context()
353 static int vmci_host_do_send_datagram(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_send_datagram() argument
361 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_send_datagram()
401 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_send_datagram()
408 static int vmci_host_do_receive_datagram(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_receive_datagram() argument
417 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_receive_datagram()
426 recv_info.result = vmci_ctx_dequeue_datagram(vmci_host_dev->context, in vmci_host_do_receive_datagram()
440 static int vmci_host_do_alloc_queuepair(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_alloc_queuepair() argument
448 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_alloc_queuepair()
453 if (vmci_host_dev->user_version < VMCI_VERSION_NOVMVM) { in vmci_host_do_alloc_queuepair()
470 vmci_host_dev->context); in vmci_host_do_alloc_queuepair()
495 vmci_host_dev->context); in vmci_host_do_alloc_queuepair()
501 vmci_host_dev->context); in vmci_host_do_alloc_queuepair()
509 static int vmci_host_do_queuepair_setva(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_queuepair_setva() argument
517 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_queuepair_setva()
522 if (vmci_host_dev->user_version < VMCI_VERSION_NOVMVM) { in vmci_host_do_queuepair_setva()
536 vmci_host_dev->context, in vmci_host_do_queuepair_setva()
544 vmci_host_dev->context, 0); in vmci_host_do_queuepair_setva()
550 static int vmci_host_do_queuepair_setpf(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_queuepair_setpf() argument
558 if (vmci_host_dev->user_version < VMCI_VERSION_HOSTQP || in vmci_host_do_queuepair_setpf()
559 vmci_host_dev->user_version >= VMCI_VERSION_NOVMVM) { in vmci_host_do_queuepair_setpf()
561 vmci_host_dev->user_version); in vmci_host_do_queuepair_setpf()
565 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_queuepair_setpf()
601 vmci_host_dev->context); in vmci_host_do_queuepair_setpf()
628 static int vmci_host_do_qp_detach(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_qp_detach() argument
636 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_qp_detach()
645 vmci_host_dev->context); in vmci_host_do_qp_detach()
647 vmci_host_dev->user_version < VMCI_VERSION_NOVMVM) { in vmci_host_do_qp_detach()
654 static int vmci_host_do_ctx_add_notify(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_ctx_add_notify() argument
663 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_ctx_add_notify()
671 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_ctx_add_notify()
677 static int vmci_host_do_ctx_remove_notify(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_ctx_remove_notify() argument
686 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_ctx_remove_notify()
694 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_ctx_remove_notify()
701 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
710 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_ctx_get_cpt_state()
718 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_ctx_get_cpt_state()
733 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
742 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_ctx_set_cpt_state()
755 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_ctx_set_cpt_state()
765 static int vmci_host_do_get_context_id(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_get_context_id() argument
774 static int vmci_host_do_set_notify(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_set_notify() argument
780 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_set_notify()
790 vmci_host_setup_notify(vmci_host_dev->context, in vmci_host_do_set_notify()
793 vmci_ctx_unset_notify(vmci_host_dev->context); in vmci_host_do_set_notify()
801 static int vmci_host_do_notify_resource(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_notify_resource() argument
808 if (vmci_host_dev->user_version < VMCI_VERSION_NOTIFY) { in vmci_host_do_notify_resource()
813 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_notify_resource()
821 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_notify_resource()
851 static int vmci_host_do_recv_notifications(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_recv_notifications() argument
862 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_recv_notifications()
867 if (vmci_host_dev->user_version < VMCI_VERSION_NOTIFY) { in vmci_host_do_recv_notifications()
880 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_recv_notifications()
913 vmci_host_dev, name, uptr); \ in vmci_host_unlocked_ioctl()
916 struct vmci_host_dev *vmci_host_dev = filp->private_data; in vmci_host_unlocked_ioctl() local
953 return vmci_host_get_version(vmci_host_dev, iocmd, uptr); in vmci_host_unlocked_ioctl()