Lines Matching refs:vmci_host_dev

92 struct vmci_host_dev {  struct
124 struct vmci_host_dev *vmci_host_dev; in vmci_host_open() local
126 vmci_host_dev = kzalloc(sizeof(struct vmci_host_dev), GFP_KERNEL); in vmci_host_open()
127 if (vmci_host_dev == NULL) in vmci_host_open()
130 vmci_host_dev->ct_type = VMCIOBJ_NOT_SET; in vmci_host_open()
131 mutex_init(&vmci_host_dev->lock); in vmci_host_open()
132 filp->private_data = vmci_host_dev; in vmci_host_open()
143 struct vmci_host_dev *vmci_host_dev = filp->private_data; in vmci_host_close() local
145 if (vmci_host_dev->ct_type == VMCIOBJ_CONTEXT) { in vmci_host_close()
146 vmci_ctx_destroy(vmci_host_dev->context); in vmci_host_close()
147 vmci_host_dev->context = NULL; in vmci_host_close()
157 vmci_host_dev->ct_type = VMCIOBJ_NOT_SET; in vmci_host_close()
159 kfree(vmci_host_dev); in vmci_host_close()
170 struct vmci_host_dev *vmci_host_dev = filp->private_data; in vmci_host_poll() local
171 struct vmci_ctx *context = vmci_host_dev->context; in vmci_host_poll()
174 if (vmci_host_dev->ct_type == VMCIOBJ_CONTEXT) { in vmci_host_poll()
260 static int vmci_host_get_version(struct vmci_host_dev *vmci_host_dev, in vmci_host_get_version() argument
265 if (get_user(vmci_host_dev->user_version, vptr)) in vmci_host_get_version()
283 if (vmci_host_dev->user_version > 0 && in vmci_host_get_version()
284 vmci_host_dev->user_version < VMCI_VERSION_HOSTQP) { in vmci_host_get_version()
285 return vmci_host_dev->user_version; in vmci_host_get_version()
294 static int vmci_host_do_init_context(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_init_context() argument
307 mutex_lock(&vmci_host_dev->lock); in vmci_host_do_init_context()
309 if (vmci_host_dev->ct_type != VMCIOBJ_NOT_SET) { in vmci_host_do_init_context()
322 vmci_host_dev->context = vmci_ctx_create(init_block.cid, in vmci_host_do_init_context()
324 vmci_host_dev->user_version, in vmci_host_do_init_context()
327 if (IS_ERR(vmci_host_dev->context)) { in vmci_host_do_init_context()
328 retval = PTR_ERR(vmci_host_dev->context); in vmci_host_do_init_context()
337 init_block.cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_init_context()
339 vmci_ctx_destroy(vmci_host_dev->context); in vmci_host_do_init_context()
340 vmci_host_dev->context = NULL; in vmci_host_do_init_context()
346 vmci_host_dev->ct_type = VMCIOBJ_CONTEXT; in vmci_host_do_init_context()
352 mutex_unlock(&vmci_host_dev->lock); in vmci_host_do_init_context()
356 static int vmci_host_do_send_datagram(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_send_datagram() argument
364 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_send_datagram()
410 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_send_datagram()
417 static int vmci_host_do_receive_datagram(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_receive_datagram() argument
426 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_receive_datagram()
435 recv_info.result = vmci_ctx_dequeue_datagram(vmci_host_dev->context, in vmci_host_do_receive_datagram()
449 static int vmci_host_do_alloc_queuepair(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_alloc_queuepair() argument
458 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_alloc_queuepair()
463 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_alloc_queuepair()
465 if (vmci_host_dev->user_version < VMCI_VERSION_NOVMVM) { in vmci_host_do_alloc_queuepair()
482 vmci_host_dev->context); in vmci_host_do_alloc_queuepair()
507 vmci_host_dev->context); in vmci_host_do_alloc_queuepair()
513 vmci_host_dev->context); in vmci_host_do_alloc_queuepair()
521 static int vmci_host_do_queuepair_setva(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_queuepair_setva() argument
529 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_queuepair_setva()
534 if (vmci_host_dev->user_version < VMCI_VERSION_NOVMVM) { in vmci_host_do_queuepair_setva()
548 vmci_host_dev->context, in vmci_host_do_queuepair_setva()
556 vmci_host_dev->context, 0); in vmci_host_do_queuepair_setva()
562 static int vmci_host_do_queuepair_setpf(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_queuepair_setpf() argument
570 if (vmci_host_dev->user_version < VMCI_VERSION_HOSTQP || in vmci_host_do_queuepair_setpf()
571 vmci_host_dev->user_version >= VMCI_VERSION_NOVMVM) { in vmci_host_do_queuepair_setpf()
573 vmci_host_dev->user_version); in vmci_host_do_queuepair_setpf()
577 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_queuepair_setpf()
613 vmci_host_dev->context); in vmci_host_do_queuepair_setpf()
640 static int vmci_host_do_qp_detach(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_qp_detach() argument
648 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_qp_detach()
657 vmci_host_dev->context); in vmci_host_do_qp_detach()
659 vmci_host_dev->user_version < VMCI_VERSION_NOVMVM) { in vmci_host_do_qp_detach()
666 static int vmci_host_do_ctx_add_notify(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_ctx_add_notify() argument
675 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_ctx_add_notify()
683 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_ctx_add_notify()
689 static int vmci_host_do_ctx_remove_notify(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_ctx_remove_notify() argument
698 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_ctx_remove_notify()
706 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_ctx_remove_notify()
713 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
722 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_ctx_get_cpt_state()
730 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_ctx_get_cpt_state()
745 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
754 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_ctx_set_cpt_state()
776 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_ctx_set_cpt_state()
787 static int vmci_host_do_get_context_id(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_get_context_id() argument
796 static int vmci_host_do_set_notify(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_set_notify() argument
802 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_set_notify()
812 vmci_host_setup_notify(vmci_host_dev->context, in vmci_host_do_set_notify()
815 vmci_ctx_unset_notify(vmci_host_dev->context); in vmci_host_do_set_notify()
823 static int vmci_host_do_notify_resource(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_notify_resource() argument
830 if (vmci_host_dev->user_version < VMCI_VERSION_NOTIFY) { in vmci_host_do_notify_resource()
835 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_notify_resource()
843 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_notify_resource()
873 static int vmci_host_do_recv_notifications(struct vmci_host_dev *vmci_host_dev, in vmci_host_do_recv_notifications() argument
884 if (vmci_host_dev->ct_type != VMCIOBJ_CONTEXT) { in vmci_host_do_recv_notifications()
889 if (vmci_host_dev->user_version < VMCI_VERSION_NOTIFY) { in vmci_host_do_recv_notifications()
902 cid = vmci_ctx_get_id(vmci_host_dev->context); in vmci_host_do_recv_notifications()
935 vmci_host_dev, name, uptr); \ in vmci_host_unlocked_ioctl()
938 struct vmci_host_dev *vmci_host_dev = filp->private_data; in vmci_host_unlocked_ioctl() local
975 return vmci_host_get_version(vmci_host_dev, iocmd, uptr); in vmci_host_unlocked_ioctl()