Lines Matching refs:vmci_host_dev

84 struct vmci_host_dev {  struct
116 struct vmci_host_dev *vmci_host_dev; in vmci_host_open() local
118 vmci_host_dev = kzalloc(sizeof(struct vmci_host_dev), GFP_KERNEL); in vmci_host_open()
119 if (vmci_host_dev == NULL) in vmci_host_open()
122 vmci_host_dev->ct_type = VMCIOBJ_NOT_SET; in vmci_host_open()
123 mutex_init(&vmci_host_dev->lock); in vmci_host_open()
124 filp->private_data = vmci_host_dev; in vmci_host_open()
135 struct vmci_host_dev *vmci_host_dev = filp->private_data; in vmci_host_close() local
137 if (vmci_host_dev->ct_type == VMCIOBJ_CONTEXT) { in vmci_host_close()
138 vmci_ctx_destroy(vmci_host_dev->context); in vmci_host_close()
139 vmci_host_dev->context = NULL; in vmci_host_close()
149 vmci_host_dev->ct_type = VMCIOBJ_NOT_SET; in vmci_host_close()
151 kfree(vmci_host_dev); in vmci_host_close()
162 struct vmci_host_dev *vmci_host_dev = filp->private_data; in vmci_host_poll() local
163 struct vmci_ctx *context = vmci_host_dev->context; in vmci_host_poll()
166 if (vmci_host_dev->ct_type == VMCIOBJ_CONTEXT) { in vmci_host_poll()
252 static int vmci_host_get_version(struct vmci_host_dev *vmci_host_dev, in vmci_host_get_version() argument
257 if (get_user(vmci_host_dev->user_version, vptr)) in vmci_host_get_version()
275 if (vmci_host_dev->user_version > 0 && in vmci_host_get_version()
276 vmci_host_dev->user_version < VMCI_VERSION_HOSTQP) { in vmci_host_get_version()
277 return vmci_host_dev->user_version; in vmci_host_get_version()
286 static int vmci_host_do_init_context(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_init_context() argument
299 mutex_lock(&vmci_host_dev->lock); in vmci_host_do_init_context()
301 if (vmci_host_dev->ct_type != VMCIOBJ_NOT_SET) { in vmci_host_do_init_context()
314 vmci_host_dev->context = vmci_ctx_create(init_block.cid, in vmci_host_do_init_context()
316 vmci_host_dev->user_version, in vmci_host_do_init_context()
319 if (IS_ERR(vmci_host_dev->context)) { in vmci_host_do_init_context()
320 retval = PTR_ERR(vmci_host_dev->context); in vmci_host_do_init_context()
329 init_block.cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_init_context()
331 vmci_ctx_destroy(vmci_host_dev->context); in vmci_host_do_init_context()
332 vmci_host_dev->context = NULL; in vmci_host_do_init_context()
338 vmci_host_dev->ct_type = VMCIOBJ_CONTEXT; in vmci_host_do_init_context()
344 mutex_unlock(&vmci_host_dev->lock); in vmci_host_do_init_context()
348 static int vmci_host_do_send_datagram(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_send_datagram() argument
356 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_send_datagram()
396 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_send_datagram()
403 static int vmci_host_do_receive_datagram(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_receive_datagram() argument
412 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_receive_datagram()
421 recv_info.result = vmci_ctx_dequeue_datagram(vmci_host_dev->context, in vmci_host_do_receive_datagram()
435 static int vmci_host_do_alloc_queuepair(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_alloc_queuepair() argument
443 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_alloc_queuepair()
448 if (vmci_host_dev->user_version < VMCI_VERSION_NOVMVM) { in vmci_host_do_alloc_queuepair()
465 vmci_host_dev->context); in vmci_host_do_alloc_queuepair()
490 vmci_host_dev->context); in vmci_host_do_alloc_queuepair()
496 vmci_host_dev->context); in vmci_host_do_alloc_queuepair()
504 static int vmci_host_do_queuepair_setva(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_queuepair_setva() argument
512 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_queuepair_setva()
517 if (vmci_host_dev->user_version < VMCI_VERSION_NOVMVM) { in vmci_host_do_queuepair_setva()
531 vmci_host_dev->context, in vmci_host_do_queuepair_setva()
539 vmci_host_dev->context, 0); in vmci_host_do_queuepair_setva()
545 static int vmci_host_do_queuepair_setpf(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_queuepair_setpf() argument
553 if (vmci_host_dev->user_version < VMCI_VERSION_HOSTQP || in vmci_host_do_queuepair_setpf()
554 vmci_host_dev->user_version >= VMCI_VERSION_NOVMVM) { in vmci_host_do_queuepair_setpf()
556 vmci_host_dev->user_version); in vmci_host_do_queuepair_setpf()
560 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_queuepair_setpf()
596 vmci_host_dev->context); in vmci_host_do_queuepair_setpf()
623 static int vmci_host_do_qp_detach(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_qp_detach() argument
631 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_qp_detach()
640 vmci_host_dev->context); in vmci_host_do_qp_detach()
642 vmci_host_dev->user_version < VMCI_VERSION_NOVMVM) { in vmci_host_do_qp_detach()
649 static int vmci_host_do_ctx_add_notify(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_ctx_add_notify() argument
658 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_ctx_add_notify()
666 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_ctx_add_notify()
672 static int vmci_host_do_ctx_remove_notify(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_ctx_remove_notify() argument
681 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_ctx_remove_notify()
689 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_ctx_remove_notify()
696 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
705 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_ctx_get_cpt_state()
713 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_ctx_get_cpt_state()
728 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
737 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_ctx_set_cpt_state()
750 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_ctx_set_cpt_state()
760 static int vmci_host_do_get_context_id(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_get_context_id() argument
769 static int vmci_host_do_set_notify(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_set_notify() argument
775 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_set_notify()
785 vmci_host_setup_notify(vmci_host_dev->context, in vmci_host_do_set_notify()
788 vmci_ctx_unset_notify(vmci_host_dev->context); in vmci_host_do_set_notify()
796 static int vmci_host_do_notify_resource(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_notify_resource() argument
803 if (vmci_host_dev->user_version < VMCI_VERSION_NOTIFY) { in vmci_host_do_notify_resource()
808 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_notify_resource()
816 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_notify_resource()
846 static int vmci_host_do_recv_notifications(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_recv_notifications() argument
857 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_recv_notifications()
862 if (vmci_host_dev->user_version < VMCI_VERSION_NOTIFY) { in vmci_host_do_recv_notifications()
875 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_recv_notifications()
908 vmci_host_dev, name, uptr); \ in vmci_host_unlocked_ioctl()
911 struct vmci_host_dev *vmci_host_dev = filp->private_data; in vmci_host_unlocked_ioctl() local
948 return vmci_host_get_version(vmci_host_dev, iocmd, uptr); in vmci_host_unlocked_ioctl()