From patchwork Mon Mar 27 14:41:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 75504 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1567376vqo; Mon, 27 Mar 2023 07:49:54 -0700 (PDT) X-Google-Smtp-Source: AKy350bdC9fRJbu12hLNhbwXaFiak+DWPXfEQkCIt34JUfP8qjqYNMz8wtHAg1tAZSWRJ9sE85NW X-Received: by 2002:a17:906:8559:b0:931:9cd2:c214 with SMTP id h25-20020a170906855900b009319cd2c214mr12255698ejy.66.1679928594305; Mon, 27 Mar 2023 07:49:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679928594; cv=none; d=google.com; s=arc-20160816; b=zKSnVDBAdDZe5x7cq17uZTWrH5GFSYENSsaiIykhEPjBKdQTlC9BDDXmXHL8uZCvq4 vPxriHvLeUwXAim9wD3ucPpWXzocHK4Gp+LtJiRWv4FBPp2j0x3/QCp2wSTJaZ/++bTN W54Dj3AHCP09kbZPMtspj7MP28I82HIr+mI/YvulSNnVqOUFsH4lkXIjXTq0B1DVs+Eo 4wv/DYvGqL6Dap/ihO4+OUGddvcf8xfXLZcgP3StUsOniuGhGB3pczSg56eMparJZ3xv gUXLmu0cNkA2zx+njs+7/7KB89edDSKREm+rgCQKS0p3TBrwqdYM9kGv6Iyr71we3vsp K3UA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BNtdJXJ3kB/+rUHxTz/r6t3HER8y8mIRr6a8CGUEPKs=; b=lncDeW+/u+fjkzWEQCeTnHBe8Lj85pdcSI8kosoGO6zjaVGTb8PMH5WZruaxrt4F5y an4sr2n8UTOQT8hA8oZe6QVdD1qMX5srL060J7mWYB6CX0xtZTZPlSlMeCHP6MOhZrKA huyyDdBLHCHOMzA93u6+X18JzdjhRtDUScVZdjePW8kw6U7UMPmXf0nWvYU2XvNdCuRz GSY3kcCzS5fL4Bj6TzIxV4WCQWBZyIDYvwDSj5wRrRNWFwvJJnGmwBWg0rwxQLoSnoqI rPmdRPy5/x/XQ3kroDVi0ezhXl7SjxNxjKIAV9NQZddkFYvucSFKS2GDybEXEp0KZoId eGMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Ylmiil+3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z1-20020aa7c641000000b004fd2aaa62d0si27826126edr.242.2023.03.27.07.49.30; Mon, 27 Mar 2023 07:49:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Ylmiil+3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232752AbjC0OmG (ORCPT + 99 others); Mon, 27 Mar 2023 10:42:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232235AbjC0OmE (ORCPT ); Mon, 27 Mar 2023 10:42:04 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 311D819AC; Mon, 27 Mar 2023 07:42:03 -0700 (PDT) Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32RD0ZmP006772; Mon, 27 Mar 2023 14:42:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=BNtdJXJ3kB/+rUHxTz/r6t3HER8y8mIRr6a8CGUEPKs=; b=Ylmiil+3wI1Fz0D6kIa/ozBqD2nMq/RUTIMsMSHkaQJMRMobUNiUMTKcE7EvrloEEWrc EyuLeAcK7bZNhj5ZFfRyXkE3Uu5JqAX/QKebSoSb4idJq5pZEM3XMMSKkGIcGUjotce7 mnuRgcBxJ/8WsPphngdZZaQyqYA4C7sSz+yJLRAKXOELSxIA8GCLWKycbr9RgNtq8FIJ WbL04nYUbmZ6XD8KiXa4ILMO3Pjvaez1de3DOFkUFE+DrJ0q/8bTOnITOo2rtqXag3dn 2phE6E2HVldhxX7xbWMz7PAXVL86mf81u16JkNcrpWPgY6/TP4K5ga5mAqVoHiZrZu3U ew== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3pkbmyr7gx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 27 Mar 2023 14:42:00 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 32REfxcs027002 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 27 Mar 2023 14:41:59 GMT Received: from hu-bjorande-lv.qualcomm.com (10.49.16.6) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 27 Mar 2023 07:41:59 -0700 From: Bjorn Andersson To: Bjorn Andersson , Mathieu Poirier , Chris Lew CC: , , Subject: [PATCH 1/2] rpmsg: glink: Propagate TX failures in intentless mode as well Date: Mon, 27 Mar 2023 07:41:52 -0700 Message-ID: <20230327144153.3133425-2-quic_bjorande@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230327144153.3133425-1-quic_bjorande@quicinc.com> References: <20230327144153.3133425-1-quic_bjorande@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01c.na.qualcomm.com (10.47.97.35) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: kav-ocxqdqX7aIcw15z5Sk4_EoUD3JIP X-Proofpoint-GUID: kav-ocxqdqX7aIcw15z5Sk4_EoUD3JIP X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-24_11,2023-03-27_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 spamscore=0 adultscore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 phishscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2303270116 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761532805521865666?= X-GMAIL-MSGID: =?utf-8?q?1761532805521865666?= As support for splitting transmision over several messages using TX_DATA_CONT was introduced it does not immediately return the return value of qcom_glink_tx(). The result is that in the intentless case (i.e. intent == NULL), the code will continue to send all additional chunks. This is wasteful, and it's possible that the send operation could incorrectly indicate success, if the last chunk fits in the TX fifo. Fix the condition. Fixes: 8956927faed3 ("rpmsg: glink: Add TX_DATA_CONT command while sending") Signed-off-by: Bjorn Andersson Reviewed-by: Chris Lew --- drivers/rpmsg/qcom_glink_native.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c index 01d2805fe30f..62634d020d13 100644 --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c @@ -1356,8 +1356,9 @@ static int __qcom_glink_send(struct glink_channel *channel, ret = qcom_glink_tx(glink, &req, sizeof(req), data, chunk_size, wait); /* Mark intent available if we failed */ - if (ret && intent) { - intent->in_use = false; + if (ret) { + if (intent) + intent->in_use = false; return ret; } @@ -1378,8 +1379,9 @@ static int __qcom_glink_send(struct glink_channel *channel, chunk_size, wait); /* Mark intent available if we failed */ - if (ret && intent) { - intent->in_use = false; + if (ret) { + if (intent) + intent->in_use = false; break; } } From patchwork Mon Mar 27 14:46:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 75506 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1567805vqo; Mon, 27 Mar 2023 07:50:32 -0700 (PDT) X-Google-Smtp-Source: AK7set9jWHc0KFhCOToAGxi0Y48rUCsnfaYxiM9LFUCTKR2L5y17UYEf9rEOfY3J/9n1MtuatrHC X-Received: by 2002:a05:6a20:2927:b0:d3:45f8:256 with SMTP id t39-20020a056a20292700b000d345f80256mr10240426pzf.60.1679928632383; Mon, 27 Mar 2023 07:50:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679928632; cv=none; d=google.com; s=arc-20160816; b=Er40klw5Qy+vu5Ok6NpVhkdZ7RGWy3i0Hfgc5EqWNxcDY2kZkaZD61Y333IougaDQ5 tlttKaMPTKyjcd8CLCsdkvpLmYiQdWJ0vnTxj7Agl+4Zv2lvgYIH87xNoHx3qTUBL0GR wiLvZzJFhwCZQvq6fNo3VbY3Gnj6WCtz0reesMQckvSdP5aqZf5xe+nqqpl671ehZVlk nZAk0eXCXBBdB3Mo/9e4C9ByHIgvIikZKE+7BpgO04kG0FLOmxMlm+ZcpOE1latqO3VT n1xdglh6VXxzbnyj3Mvi8jbmsJZ/fuxIZMpft96HyKB1VyoxMJfn1v4MhhJvA+pvQy5C WqQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Vkj+E/rQa+jSFrNsC1JhMXlaXuA4XMqJZFoCbosbPB4=; b=ifaLzImMCM4xvdw3CE0t2SVgalJgbDYCuCPe+Vcvve4VK48o7bYrNZo+slDMA59uoq kwLUGGT6GtYKbReDZYlnPJGMM04ZJyf3JTddy9HCyyue7bOIHnPB6QlhhTBkFI2cfelT QVQHkR2XT7zWjIfuHU03oGmfqnu9M3KGHxzpEyXtfA7PyY1nMEHJiHsr9Jx4JqeColKF xTyPZQSJSsFUjNnxw8PsMJ/1/tJWG9gLeuODmnsQS6JYs4OH1gts8GM2Anyyv2AIdfGJ UWjebVK/w3QJ40XxG69A0NiiujwiertBjE1oOcy5FpV9h5v5yqCfKDznuHai7yEOUHh7 YhPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=GhOEwdnC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h9-20020a631209000000b0050bfa82c24asi26273169pgl.647.2023.03.27.07.50.17; Mon, 27 Mar 2023 07:50:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=GhOEwdnC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232724AbjC0Oqg (ORCPT + 99 others); Mon, 27 Mar 2023 10:46:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232712AbjC0Oqa (ORCPT ); Mon, 27 Mar 2023 10:46:30 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5104035AA; Mon, 27 Mar 2023 07:46:27 -0700 (PDT) Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32RD0ILr006606; Mon, 27 Mar 2023 14:46:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=Vkj+E/rQa+jSFrNsC1JhMXlaXuA4XMqJZFoCbosbPB4=; b=GhOEwdnCClJPZxpzxGygpDCM3TDmtdvmLdRyurWOEuPU0slM5RrDcHXQYawExqC7qSLj rjnMz5Mz0AyW/PWdocd9iLNAyR/j4ePekxLg8zsBOxswLgd83QkH/pmNhQetYRGqfwhE 4XOoCVGWw6HYWK6e/EhmyiAUKZWlP9XG6RufbTWOGzUWU7upPiCOa2RPBCrFM0wyevND 1eyJWwKEC9qoAcxGd8CcZGuT9WHQD8ydbkc44E511kAvraF429++j2BUAaDOrlhFelPU O803vg2mgLRB6Yzs+qxewOBQaO7iMCnmteASwYfvagjCrlN2NdXVxMqO1ppCC7IKQ2PB og== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3pkbmyr80r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 27 Mar 2023 14:46:24 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 32REkNep031496 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 27 Mar 2023 14:46:23 GMT Received: from hu-bjorande-lv.qualcomm.com (10.49.16.6) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 27 Mar 2023 07:46:23 -0700 From: Bjorn Andersson To: Bjorn Andersson , Mathieu Poirier , Chris Lew CC: , , Subject: [PATCH 2/2] rpmsg: glink: Wait for intent, not just request ack Date: Mon, 27 Mar 2023 07:46:17 -0700 Message-ID: <20230327144617.3134175-3-quic_bjorande@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230327144617.3134175-1-quic_bjorande@quicinc.com> References: <20230327144617.3134175-1-quic_bjorande@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01c.na.qualcomm.com (10.47.97.35) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: ZOzYgBpIjOH3qPsHxAvZJVdyTp2OAb6B X-Proofpoint-GUID: ZOzYgBpIjOH3qPsHxAvZJVdyTp2OAb6B X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-24_11,2023-03-27_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 spamscore=0 adultscore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 phishscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2303270117 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761532845834871381?= X-GMAIL-MSGID: =?utf-8?q?1761532845834871381?= In some implementations of the remote firmware, an intent request acknowledgement is sent when it's determined if the intent allocation will be fulfilled, but then the intent is queued after the acknowledgement. The result is that upon receving a granted allocation request, the search for the newly allocated intent will fail and an additional request will be made. This will at best waste memory, but if the second request is rejected the transaction will be incorrectly rejected. Take the incoming intent into account in the wait to mitigate this problem. The above scenario can still happen, in the case that, on that same channel, an unrelated intent is delivered prior to the request acknowledgement and a separate process enters the send path and picks up the intent. Given that there's no relationship between the acknowledgement and the delivered (or to be delivered intent), there doesn't seem to be a solution to this problem. Signed-off-by: Bjorn Andersson --- drivers/rpmsg/qcom_glink_native.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c index e3494de7dce8..3055e0a473e8 100644 --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c @@ -146,6 +146,7 @@ enum { * @open_req: completed once open-request has been received * @intent_req_lock: Synchronises multiple intent requests * @intent_req_result: Result of intent request + * @intent_received: flag indicating that an intent has been received * @intent_req_wq: wait queue for intent_req signalling */ struct glink_channel { @@ -177,6 +178,7 @@ struct glink_channel { struct mutex intent_req_lock; int intent_req_result; + bool intent_received; wait_queue_head_t intent_req_wq; }; @@ -420,13 +422,13 @@ static void qcom_glink_handle_intent_req_ack(struct qcom_glink *glink, return; } - channel->intent_req_result = granted; + WRITE_ONCE(channel->intent_req_result, granted); wake_up_all(&channel->intent_req_wq); } static void qcom_glink_intent_req_abort(struct glink_channel *channel) { - channel->intent_req_result = 0; + WRITE_ONCE(channel->intent_req_result, 0); wake_up_all(&channel->intent_req_wq); } @@ -757,6 +759,11 @@ static void qcom_glink_handle_rx_done(struct qcom_glink *glink, kfree(intent); } spin_unlock_irqrestore(&channel->intent_lock, flags); + + if (reuse) { + WRITE_ONCE(channel->intent_received, true); + wake_up_all(&channel->intent_req_wq); + } } /** @@ -994,6 +1001,9 @@ static void qcom_glink_handle_intent(struct qcom_glink *glink, dev_err(glink->dev, "failed to store remote intent\n"); } + WRITE_ONCE(channel->intent_received, true); + wake_up_all(&channel->intent_req_wq); + kfree(msg); qcom_glink_rx_advance(glink, ALIGN(msglen, 8)); } @@ -1273,6 +1283,7 @@ static int qcom_glink_request_intent(struct qcom_glink *glink, mutex_lock(&channel->intent_req_lock); WRITE_ONCE(channel->intent_req_result, -1); + WRITE_ONCE(channel->intent_received, false); cmd.id = GLINK_CMD_RX_INTENT_REQ; cmd.cid = channel->lcid; @@ -1283,7 +1294,8 @@ static int qcom_glink_request_intent(struct qcom_glink *glink, goto unlock; ret = wait_event_timeout(channel->intent_req_wq, - READ_ONCE(channel->intent_req_result) >= 0, + READ_ONCE(channel->intent_req_result) >= 0 && + READ_ONCE(channel->intent_received), 10 * HZ); if (!ret) { dev_err(glink->dev, "intent request timed out\n");