• Home
  • Raw
  • Download

Lines Matching refs:pipe

221 static int goldfish_pipe_cmd_locked(struct goldfish_pipe *pipe,  in goldfish_pipe_cmd_locked()  argument
224 pipe->command_buffer->cmd = cmd; in goldfish_pipe_cmd_locked()
226 pipe->command_buffer->status = PIPE_ERROR_INVAL; in goldfish_pipe_cmd_locked()
227 writel(pipe->id, pipe->dev->base + PIPE_REG_CMD); in goldfish_pipe_cmd_locked()
228 return pipe->command_buffer->status; in goldfish_pipe_cmd_locked()
231 static int goldfish_pipe_cmd(struct goldfish_pipe *pipe, enum PipeCmdCode cmd) in goldfish_pipe_cmd() argument
235 if (mutex_lock_interruptible(&pipe->lock)) in goldfish_pipe_cmd()
237 status = goldfish_pipe_cmd_locked(pipe, cmd); in goldfish_pipe_cmd()
238 mutex_unlock(&pipe->lock); in goldfish_pipe_cmd()
328 static int transfer_max_buffers(struct goldfish_pipe *pipe, in transfer_max_buffers() argument
342 if (mutex_lock_interruptible(&pipe->lock)) in transfer_max_buffers()
347 pipe->pages, &iter_last_page_size); in transfer_max_buffers()
349 mutex_unlock(&pipe->lock); in transfer_max_buffers()
353 populate_rw_params(pipe->pages, pages_count, address, address_end, in transfer_max_buffers()
355 pipe->command_buffer); in transfer_max_buffers()
358 *status = goldfish_pipe_cmd_locked(pipe, in transfer_max_buffers()
361 *consumed_size = pipe->command_buffer->rw_params.consumed_size; in transfer_max_buffers()
363 unpin_user_pages_dirty_lock(pipe->pages, pages_count, in transfer_max_buffers()
366 mutex_unlock(&pipe->lock); in transfer_max_buffers()
370 static int wait_for_host_signal(struct goldfish_pipe *pipe, int is_write) in wait_for_host_signal() argument
374 set_bit(wake_bit, &pipe->flags); in wait_for_host_signal()
377 goldfish_pipe_cmd(pipe, in wait_for_host_signal()
380 while (test_bit(wake_bit, &pipe->flags)) { in wait_for_host_signal()
381 if (wait_event_interruptible(pipe->wake_queue, in wait_for_host_signal()
382 !test_bit(wake_bit, &pipe->flags))) in wait_for_host_signal()
385 if (test_bit(BIT_CLOSED_ON_HOST, &pipe->flags)) in wait_for_host_signal()
397 struct goldfish_pipe *pipe = filp->private_data; in goldfish_pipe_read_write() local
403 if (unlikely(test_bit(BIT_CLOSED_ON_HOST, &pipe->flags))) in goldfish_pipe_read_write()
421 ret = transfer_max_buffers(pipe, address, address_end, is_write, in goldfish_pipe_read_write()
449 dev_err_ratelimited(pipe->dev->pdev_dev, in goldfish_pipe_read_write()
465 status = wait_for_host_signal(pipe, is_write); in goldfish_pipe_read_write()
495 struct goldfish_pipe *pipe = filp->private_data; in goldfish_pipe_poll() local
499 poll_wait(filp, &pipe->wake_queue, wait); in goldfish_pipe_poll()
501 status = goldfish_pipe_cmd(pipe, PIPE_CMD_POLL); in goldfish_pipe_poll()
511 if (test_bit(BIT_CLOSED_ON_HOST, &pipe->flags)) in goldfish_pipe_poll()
520 struct goldfish_pipe *pipe; in signalled_pipes_add_locked() local
525 pipe = dev->pipes[id]; in signalled_pipes_add_locked()
526 if (!pipe) in signalled_pipes_add_locked()
528 pipe->signalled_flags |= flags; in signalled_pipes_add_locked()
530 if (pipe->prev_signalled || pipe->next_signalled || in signalled_pipes_add_locked()
531 dev->first_signalled_pipe == pipe) in signalled_pipes_add_locked()
533 pipe->next_signalled = dev->first_signalled_pipe; in signalled_pipes_add_locked()
535 dev->first_signalled_pipe->prev_signalled = pipe; in signalled_pipes_add_locked()
536 dev->first_signalled_pipe = pipe; in signalled_pipes_add_locked()
540 struct goldfish_pipe *pipe) in signalled_pipes_remove_locked() argument
542 if (pipe->prev_signalled) in signalled_pipes_remove_locked()
543 pipe->prev_signalled->next_signalled = pipe->next_signalled; in signalled_pipes_remove_locked()
544 if (pipe->next_signalled) in signalled_pipes_remove_locked()
545 pipe->next_signalled->prev_signalled = pipe->prev_signalled; in signalled_pipes_remove_locked()
546 if (pipe == dev->first_signalled_pipe) in signalled_pipes_remove_locked()
547 dev->first_signalled_pipe = pipe->next_signalled; in signalled_pipes_remove_locked()
548 pipe->prev_signalled = NULL; in signalled_pipes_remove_locked()
549 pipe->next_signalled = NULL; in signalled_pipes_remove_locked()
555 struct goldfish_pipe *pipe; in signalled_pipes_pop_front() local
560 pipe = dev->first_signalled_pipe; in signalled_pipes_pop_front()
561 if (pipe) { in signalled_pipes_pop_front()
562 *wakes = pipe->signalled_flags; in signalled_pipes_pop_front()
563 pipe->signalled_flags = 0; in signalled_pipes_pop_front()
570 dev->first_signalled_pipe = pipe->next_signalled; in signalled_pipes_pop_front()
573 pipe->next_signalled = NULL; in signalled_pipes_pop_front()
577 return pipe; in signalled_pipes_pop_front()
584 struct goldfish_pipe *pipe; in goldfish_interrupt_task() local
587 while ((pipe = signalled_pipes_pop_front(dev, &wakes)) != NULL) { in goldfish_interrupt_task()
589 pipe->flags = 1 << BIT_CLOSED_ON_HOST; in goldfish_interrupt_task()
592 clear_bit(BIT_WAKE_ON_READ, &pipe->flags); in goldfish_interrupt_task()
594 clear_bit(BIT_WAKE_ON_WRITE, &pipe->flags); in goldfish_interrupt_task()
600 wake_up_interruptible(&pipe->wake_queue); in goldfish_interrupt_task()
706 struct goldfish_pipe *pipe = kzalloc(sizeof(*pipe), GFP_KERNEL); in goldfish_pipe_open() local
708 if (!pipe) in goldfish_pipe_open()
711 pipe->dev = dev; in goldfish_pipe_open()
712 mutex_init(&pipe->lock); in goldfish_pipe_open()
713 init_waitqueue_head(&pipe->wake_queue); in goldfish_pipe_open()
720 pipe->command_buffer = in goldfish_pipe_open()
722 if (!pipe->command_buffer) { in goldfish_pipe_open()
735 dev->pipes[id] = pipe; in goldfish_pipe_open()
736 pipe->id = id; in goldfish_pipe_open()
737 pipe->command_buffer->id = id; in goldfish_pipe_open()
743 (u64)(unsigned long)__pa(pipe->command_buffer); in goldfish_pipe_open()
744 status = goldfish_pipe_cmd_locked(pipe, PIPE_CMD_OPEN); in goldfish_pipe_open()
749 file->private_data = pipe; in goldfish_pipe_open()
757 free_page((unsigned long)pipe->command_buffer); in goldfish_pipe_open()
759 kfree(pipe); in goldfish_pipe_open()
766 struct goldfish_pipe *pipe = filp->private_data; in goldfish_pipe_release() local
767 struct goldfish_pipe_dev *dev = pipe->dev; in goldfish_pipe_release()
770 goldfish_pipe_cmd(pipe, PIPE_CMD_CLOSE); in goldfish_pipe_release()
773 dev->pipes[pipe->id] = NULL; in goldfish_pipe_release()
774 signalled_pipes_remove_locked(dev, pipe); in goldfish_pipe_release()
778 free_page((unsigned long)pipe->command_buffer); in goldfish_pipe_release()
779 kfree(pipe); in goldfish_pipe_release()