Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp251906ybk; Tue, 12 May 2020 22:16:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEYa5cksI+KMjQP8+uimVEa4hKljV+7p81L6zgmI2dC0LJNP+hJoLmYkxDJHmJj0VE1drX X-Received: by 2002:aa7:d787:: with SMTP id s7mr9097958edq.104.1589346981388; Tue, 12 May 2020 22:16:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589346981; cv=none; d=google.com; s=arc-20160816; b=Cr3N/oIG009MJpSYuP8ik0Kf5CREaQNXyhW6WOEKaMYDr1G6YoOTcol1OsvSn/U88k 7Mhdi56lzDw0lni67EFV/b2ZP7I5Q9MGlcu+EDuJfxbCgHKBoDaBeE4PJNyRatBQwIh5 Qo5jzuI0PogXtdUVdRF70Hb8y6UlOkPAe5ezhkMJ6zRelyLsihceWMhCfT2e7Yxo434X cLtwXHgmQK1zAnRa1fBInDpJHbyRRLQXqJClB/8DcFgATmA97xCAbw0Dh7UxCm5MH3qX FHep7ad54D5IWoAJ5uNIB/AZj8BxBe5PeoejzOp+uJ2ZOaUXAk9GAuN9mWbWf9mVIJch SVGg== 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; bh=RrFa8SIaRDpfrCkihQPsly+PYJ66MhgVAcKDnFz+fGg=; b=EOXuZZbPfR5xp35YgGgQ5FNpd+VQAiN2MP3II0I1BB1XXNYao8Tnrwb5G73lCx5O7f m53sxBUWlnXuPbrxfhQCpMSkbt+wkH4orZTK+hwepovq2E8Om9psEE0ZSxrvq1NQjNSE 5Z4yRVeI+UE9CBFvTMDHHf4Vwr0NIUSGkfrQWWjEfOa5PqdrrOLbJGtgT+5G62hjVJfB vlt4KuQMhus58R1+afm5t8P5qZO9sI0KMh5kzizbqqm26iDqNLXxuPxxNT6OVOzcD7eN LYmyqJfcLTnqYqKuVxlB/46QNE53JQ1EEgR8M/ovM1XZvBKsUnxdGASZRA+r4WmhbJix QjDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=YA+hX0yX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i12si2215510ejx.447.2020.05.12.22.15.58; Tue, 12 May 2020 22:16:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=YA+hX0yX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729057AbgEMFLl (ORCPT + 99 others); Wed, 13 May 2020 01:11:41 -0400 Received: from mail27.static.mailgun.info ([104.130.122.27]:17353 "EHLO mail27.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729041AbgEMFLk (ORCPT ); Wed, 13 May 2020 01:11:40 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1589346700; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=RrFa8SIaRDpfrCkihQPsly+PYJ66MhgVAcKDnFz+fGg=; b=YA+hX0yX6On+HulXUW85FCC+wCvBk+ZG/PYdO6hjkhZ7gQpISkzocFHBKBNXXF4Z1KmNyrFM lov/476twgnwuz1VHm1Rn6lBxUYZGxileGO+yOoLyUWzTm99GnIqHBQKQbzH/4aFZYXjtHlq WI4FTO4x2XHtHTsm1cQus81lqFM= X-Mailgun-Sending-Ip: 104.130.122.27 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5ebb818b.7f3cb3a84ae8-smtp-out-n05; Wed, 13 May 2020 05:11:39 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id A3513C433CB; Wed, 13 May 2020 05:11:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=unavailable 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) by smtp.codeaurora.org (Postfix) with ESMTPSA id B2615C43637; Wed, 13 May 2020 05:11:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org B2615C43637 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.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 V4 4/4] rpmsg: char: Add signal callback and POLLPRI support Date: Wed, 13 May 2020 10:41:11 +0530 Message-Id: <1589346671-15226-5-git-send-email-aneela@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1589346671-15226-1-git-send-email-aneela@codeaurora.org> References: <1589346671-15226-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 Register a callback to get the signal notifications from rpmsg and send POLLPRI mask to indicate the signal change in POLL system call. Signed-off-by: Arun Kumar Neelakantam --- drivers/rpmsg/rpmsg_char.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/rpmsg/rpmsg_char.c b/drivers/rpmsg/rpmsg_char.c index e2f92f3..ae15d4f 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; + + bool sig_pending; }; static int rpmsg_eptdev_destroy(struct device *dev, void *data) @@ -122,6 +125,19 @@ static int rpmsg_ept_cb(struct rpmsg_device *rpdev, void *buf, int len, return 0; } +static int rpmsg_sigs_cb(struct rpmsg_device *rpdev, void *priv, + u32 old, u32 new) +{ + struct rpmsg_eptdev *eptdev = priv; + + eptdev->sig_pending = true; + + /* wake up any blocking processes, waiting for signal notification */ + wake_up_interruptible(&eptdev->readq); + return 0; +} + + static int rpmsg_eptdev_open(struct inode *inode, struct file *filp) { struct rpmsg_eptdev *eptdev = cdev_to_eptdev(inode->i_cdev); @@ -138,6 +154,7 @@ static int rpmsg_eptdev_open(struct inode *inode, struct file *filp) return -EINVAL; } + ept->sig_cb = rpmsg_sigs_cb; eptdev->ept = ept; filp->private_data = eptdev; @@ -156,6 +173,7 @@ static int rpmsg_eptdev_release(struct inode *inode, struct file *filp) eptdev->ept = NULL; } mutex_unlock(&eptdev->ept_lock); + eptdev->sig_pending = false; /* Discard all SKBs */ skb_queue_purge(&eptdev->queue); @@ -266,6 +284,9 @@ static __poll_t rpmsg_eptdev_poll(struct file *filp, poll_table *wait) if (!skb_queue_empty(&eptdev->queue)) mask |= EPOLLIN | EPOLLRDNORM; + if (eptdev->sig_pending) + mask |= POLLPRI; + mask |= rpmsg_poll(eptdev->ept, filp, wait); return mask; @@ -309,6 +330,7 @@ static long rpmsg_eptdev_ioctl(struct file *fp, unsigned int cmd, switch (cmd) { case TIOCMGET: + eptdev->sig_pending = false; ret = rpmsg_get_signals(eptdev->ept); if (ret >= 0) ret = put_user(ret, (int __user *)arg); -- 2.7.4