Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2475818imm; Wed, 3 Oct 2018 04:36:13 -0700 (PDT) X-Google-Smtp-Source: ACcGV60X+2EFUGaBVoVRayTr4ZZBQJz/JAM5hwSc8lXvF465QUMVLMM/JuREVy2F7X1+1pneTiua X-Received: by 2002:a63:6849:: with SMTP id d70-v6mr986233pgc.7.1538566573215; Wed, 03 Oct 2018 04:36:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538566573; cv=none; d=google.com; s=arc-20160816; b=MRChxlUAqFd5EyBPFBlLorLrK6DU71UsWwVfFcr6X81Q2Yy+kHrLHfBB2NAH7EciQY r0j+25Piv9dLw40knYHZqrmSmaLs1vMfGw+z9MmKbM8yqPlq2du/28AQm/rrzFGEiaV0 enE9z9JQBX9PoI7/+ShOQ0yAhB3FkEUNvab931SfLbJmVYxdrtW7cIakwomnpO3oJdA+ OEDm9rVoAbE1OJgQwVoTdFAeaElMjp0NJXBF+1eSjFSAf73Jr697C3yaabTvYA2ux/oh uVGkfcgXvlILOaflvhnd/omYwQnYK5UiGh0UiuArNb7tWDLiMrjpTufL+O73LUGFPILU N2TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature; bh=pg94ac5Y1MPKWEO8ehoXgYW/N43QFINATEyB9kj0aGw=; b=QfKmvDuDdGjEaJr4uDYWOKxHGcCeKgj9kskNibXnfC7w2NjKdC5oArHfU3SqP8VWWq ckzpEe+mMzQk5vTvzUsgql4bf30pkCsrGoo+AUKy6lMxfQdUhTy8wXmNyVrtdMg0YK8X UllZcX3+WZ2BE8XRz0ScM1QKkCTO6H5TaWL4Y3pw51a+soKbhK4wjPZFqc58a/CG7tgM EdqNgmbIaXat7+LQtdm/WHZRJjHQel9SY/CFtGTcYKQ6FfVMhM+TNYDCXVqy0dP8HIU5 pVee/xuZfwD0SfdeOZ4dcP+OGa58h41BDIy7G8z/vzjPtH5+ssr659xeb3/0wmn61o3n 9qRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=o4VnAVzS; dkim=pass header.i=@codeaurora.org header.s=default header.b=o4VnAVzS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h20-v6si1144175pgh.573.2018.10.03.04.35.57; Wed, 03 Oct 2018 04:36:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=o4VnAVzS; dkim=pass header.i=@codeaurora.org header.s=default header.b=o4VnAVzS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727222AbeJCSXP (ORCPT + 99 others); Wed, 3 Oct 2018 14:23:15 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:55528 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726617AbeJCSXO (ORCPT ); Wed, 3 Oct 2018 14:23:14 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id E5A5760C61; Wed, 3 Oct 2018 11:35:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1538566513; bh=gC2IG0VxUhyqhWUNmxbBuPP2lrAm8HvI5UbCxrYTbZQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o4VnAVzS5WVlr7IblzxjL3/jdOK8RFoF5M5dMCmsO+Z9Aqzb/rhoWx3LjzlK2acY8 +Hw0h0D5yJ7IHA69W1mMihJhpE4WD0nBLGWds8BlMoci/lJ+AXrhcv4x5uw5/iMWiT 9UEcOLy7OK8yrfwzq8F16l1F12O0f0y6c7TBv7VE= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from aneelaka-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: aneela@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 64562607BD; Wed, 3 Oct 2018 11:35:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1538566513; bh=gC2IG0VxUhyqhWUNmxbBuPP2lrAm8HvI5UbCxrYTbZQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o4VnAVzS5WVlr7IblzxjL3/jdOK8RFoF5M5dMCmsO+Z9Aqzb/rhoWx3LjzlK2acY8 +Hw0h0D5yJ7IHA69W1mMihJhpE4WD0nBLGWds8BlMoci/lJ+AXrhcv4x5uw5/iMWiT 9UEcOLy7OK8yrfwzq8F16l1F12O0f0y6c7TBv7VE= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 64562607BD Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=aneela@codeaurora.org From: Arun Kumar Neelakantam To: ohad@wizery.com, bjorn.andersson@linaro.org, clew@codeaurora.org, sricharan@codeaurora.org Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, Arun Kumar Neelakantam Subject: [PATCH 4/5] rpmsg: wakeup poll to notify signal update Date: Wed, 3 Oct 2018 17:04:22 +0530 Message-Id: <1538566463-24627-5-git-send-email-aneela@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1538566463-24627-1-git-send-email-aneela@codeaurora.org> References: <1538566463-24627-1-git-send-email-aneela@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support to wait on poll to get signal notifications. Send POLLPRI mask to indicate the signal change. Signed-off-by: Arun Kumar Neelakantam --- drivers/rpmsg/rpmsg_char.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/rpmsg/rpmsg_char.c b/drivers/rpmsg/rpmsg_char.c index c983d6c..aee5561 100644 --- a/drivers/rpmsg/rpmsg_char.c +++ b/drivers/rpmsg/rpmsg_char.c @@ -64,6 +64,7 @@ struct rpmsg_ctrldev { * @queue_lock: synchronization of @queue operations * @queue: incoming message queue * @readq: wait object for incoming queue + * @sig_pending:state of signal notification */ struct rpmsg_eptdev { struct device dev; @@ -78,6 +79,8 @@ struct rpmsg_eptdev { spinlock_t queue_lock; struct sk_buff_head queue; wait_queue_head_t readq; + + atomic_t sig_pending; }; static int rpmsg_eptdev_destroy(struct device *dev, void *data) @@ -125,6 +128,12 @@ static int rpmsg_ept_cb(struct rpmsg_device *rpdev, void *buf, int len, static int rpmsg_sigs_cb(struct rpmsg_device *rpdev, void *priv, u32 old, u32 new) { + struct rpmsg_eptdev *eptdev = priv; + + atomic_set(&eptdev->sig_pending, 1); + + /* wake up any blocking processes, waiting for signal notification */ + wake_up_interruptible(&eptdev->readq); return 0; } @@ -164,6 +173,7 @@ static int rpmsg_eptdev_release(struct inode *inode, struct file *filp) eptdev->ept = NULL; } mutex_unlock(&eptdev->ept_lock); + atomic_set(&eptdev->sig_pending, 0); /* Discard all SKBs */ while (!skb_queue_empty(&eptdev->queue)) { @@ -270,6 +280,9 @@ static __poll_t rpmsg_eptdev_poll(struct file *filp, poll_table *wait) if (!skb_queue_empty(&eptdev->queue)) mask |= EPOLLIN | EPOLLRDNORM; + if (atomic_read(&eptdev->sig_pending)) + mask |= POLLPRI; + mask |= rpmsg_poll(eptdev->ept, filp, wait); return mask; @@ -318,6 +331,7 @@ static long rpmsg_eptdev_ioctl(struct file *fp, unsigned int cmd, ret = rpmsg_get_sigs(eptdev->ept, &lsigs, &rsigs); if (!ret) ret = put_user(rsigs, (u32 *)arg); + atomic_set(&eptdev->sig_pending, 0); break; case TIOCMSET: case TIOCMBIS: -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project