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_obj(struct vmci_host_dev); 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()
262 static int vmci_host_get_version(struct vmci_host_dev *vmci_host_dev, in vmci_host_get_version() argument
267 if (get_user(vmci_host_dev->user_version, vptr)) in vmci_host_get_version()
285 if (vmci_host_dev->user_version > 0 && in vmci_host_get_version()
286 vmci_host_dev->user_version < VMCI_VERSION_HOSTQP) { in vmci_host_get_version()
287 return vmci_host_dev->user_version; in vmci_host_get_version()
296 static int vmci_host_do_init_context(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_init_context() argument
309 mutex_lock(&vmci_host_dev->lock); in vmci_host_do_init_context()
311 if (vmci_host_dev->ct_type != VMCIOBJ_NOT_SET) { in vmci_host_do_init_context()
324 vmci_host_dev->context = vmci_ctx_create(init_block.cid, in vmci_host_do_init_context()
326 vmci_host_dev->user_version, in vmci_host_do_init_context()
329 if (IS_ERR(vmci_host_dev->context)) { in vmci_host_do_init_context()
330 retval = PTR_ERR(vmci_host_dev->context); in vmci_host_do_init_context()
339 init_block.cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_init_context()
341 vmci_ctx_destroy(vmci_host_dev->context); in vmci_host_do_init_context()
342 vmci_host_dev->context = NULL; in vmci_host_do_init_context()
348 vmci_host_dev->ct_type = VMCIOBJ_CONTEXT; in vmci_host_do_init_context()
356 mutex_unlock(&vmci_host_dev->lock); in vmci_host_do_init_context()
360 static int vmci_host_do_send_datagram(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_send_datagram() argument
368 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_send_datagram()
408 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_send_datagram()
415 static int vmci_host_do_receive_datagram(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_receive_datagram() argument
424 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_receive_datagram()
433 recv_info.result = vmci_ctx_dequeue_datagram(vmci_host_dev->context, in vmci_host_do_receive_datagram()
447 static int vmci_host_do_alloc_queuepair(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_alloc_queuepair() argument
455 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_alloc_queuepair()
460 if (vmci_host_dev->user_version < VMCI_VERSION_NOVMVM) { in vmci_host_do_alloc_queuepair()
477 vmci_host_dev->context); in vmci_host_do_alloc_queuepair()
502 vmci_host_dev->context); in vmci_host_do_alloc_queuepair()
508 vmci_host_dev->context); in vmci_host_do_alloc_queuepair()
516 static int vmci_host_do_queuepair_setva(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_queuepair_setva() argument
524 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_queuepair_setva()
529 if (vmci_host_dev->user_version < VMCI_VERSION_NOVMVM) { in vmci_host_do_queuepair_setva()
543 vmci_host_dev->context, in vmci_host_do_queuepair_setva()
551 vmci_host_dev->context, 0); in vmci_host_do_queuepair_setva()
557 static int vmci_host_do_queuepair_setpf(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_queuepair_setpf() argument
565 if (vmci_host_dev->user_version < VMCI_VERSION_HOSTQP || in vmci_host_do_queuepair_setpf()
566 vmci_host_dev->user_version >= VMCI_VERSION_NOVMVM) { in vmci_host_do_queuepair_setpf()
568 vmci_host_dev->user_version); in vmci_host_do_queuepair_setpf()
572 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_queuepair_setpf()
608 vmci_host_dev->context); in vmci_host_do_queuepair_setpf()
635 static int vmci_host_do_qp_detach(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_qp_detach() argument
643 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_qp_detach()
652 vmci_host_dev->context); in vmci_host_do_qp_detach()
654 vmci_host_dev->user_version < VMCI_VERSION_NOVMVM) { in vmci_host_do_qp_detach()
661 static int vmci_host_do_ctx_add_notify(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_ctx_add_notify() argument
670 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_ctx_add_notify()
678 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_ctx_add_notify()
684 static int vmci_host_do_ctx_remove_notify(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_ctx_remove_notify() argument
693 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_ctx_remove_notify()
701 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_ctx_remove_notify()
708 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
717 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_ctx_get_cpt_state()
725 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_ctx_get_cpt_state()
740 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
749 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_ctx_set_cpt_state()
762 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_ctx_set_cpt_state()
772 static int vmci_host_do_get_context_id(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_get_context_id() argument
781 static int vmci_host_do_set_notify(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_set_notify() argument
787 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_set_notify()
797 vmci_host_setup_notify(vmci_host_dev->context, in vmci_host_do_set_notify()
800 vmci_ctx_unset_notify(vmci_host_dev->context); in vmci_host_do_set_notify()
808 static int vmci_host_do_notify_resource(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_notify_resource() argument
815 if (vmci_host_dev->user_version < VMCI_VERSION_NOTIFY) { in vmci_host_do_notify_resource()
820 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_notify_resource()
828 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_notify_resource()
858 static int vmci_host_do_recv_notifications(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_recv_notifications() argument
869 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_recv_notifications()
874 if (vmci_host_dev->user_version < VMCI_VERSION_NOTIFY) { in vmci_host_do_recv_notifications()
887 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_recv_notifications()
920 vmci_host_dev, name, uptr); \ in vmci_host_unlocked_ioctl()
923 struct vmci_host_dev *vmci_host_dev = filp->private_data; in vmci_host_unlocked_ioctl() local
960 return vmci_host_get_version(vmci_host_dev, iocmd, uptr); in vmci_host_unlocked_ioctl()