Received: by 2002:a25:1104:0:0:0:0:0 with SMTP id 4csp263082ybr; Fri, 22 May 2020 06:09:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx80WgKAOaZ+nVMYC58ORhKqbioORWq4Csp5xNYh4dRUI4USYmCNJPoZTbT4OsTQ4V2/WYn X-Received: by 2002:a17:906:51a:: with SMTP id j26mr8574360eja.438.1590152990994; Fri, 22 May 2020 06:09:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590152990; cv=none; d=google.com; s=arc-20160816; b=kq9uk54Z1iB2F+euY7m/kXZf8pJC4Yy8YCSWpfe+Yzu+HvMPcpIoQgXqWJ9U9lWqYf LsbErISC51NadEprhLZ0S+eMkaoQjq+8CBOMmAHUtpAaLHTx9pgTgsgdA9ZlZJMN5Ird eiBqVttCha73Ct+PctsjDtGJuRNSuHfi5zVyanJd20GSz42ws2C3mACj2FTcBnQy0k/Q diarocGCYnjwGpa8Gz9NaPmPnyZRfvXxkx3qzuUxorReSQkZOF3yo6Zv3SRCQRyVdqnR OnyH3TxhnvnppgNN/kBj6FQwSGcdW6IOrKDUt9SNzXR1IULCH/PoypESdYYY0HVh2CHG l8vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=T3YLmShsXHzYS+SwxvGmWk40fJ/Ku1cYbc0CTeNJEyY=; b=w3cYfUP1/IYQLInSSmk7ZXW2KpaYwwNlbmu/frg8In1eR8GL3Ju6f7cdXN+J0sUT0B lUn99hgYXcrK5yWfKjH+rYXtwVYxEGCnFC9aF7ZbwtIMgq/UuA7c397ngXn4GqM0vA0Q pW2wfnFXd+zIuGKxS2LuLjiTHIcqAHhU40jYZh2deGfnRqvBi/3gnTgtxlf7WgYpXUHj LFHmfstd1/qyDIrMHo5pEsuu1OI5Ii7GKlLzLXpDHhRZUSySUBep5MeYu/Ft+6SGttUg PcsHBi/SwSq7cE1a0UOmE4fhRin/OE1nJbpjaKHOp458iL7RSxp/AwMsLvVZhHbPE920 Iqog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=SeI4ofqc; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l6si4801883ejx.387.2020.05.22.06.09.26; Fri, 22 May 2020 06:09:50 -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=pass header.i=@gmail.com header.s=20161025 header.b=SeI4ofqc; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729841AbgEVNHX (ORCPT + 99 others); Fri, 22 May 2020 09:07:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729740AbgEVNHW (ORCPT ); Fri, 22 May 2020 09:07:22 -0400 Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A01AC061A0E; Fri, 22 May 2020 06:07:22 -0700 (PDT) Received: by mail-lf1-x143.google.com with SMTP id 82so6497624lfh.2; Fri, 22 May 2020 06:07:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=T3YLmShsXHzYS+SwxvGmWk40fJ/Ku1cYbc0CTeNJEyY=; b=SeI4ofqcvKBWBQLeol3QjOhY8LDNHEE3pUkAVpZFjLvvKGYDLuroE4XLupIWS568qv D+jDVeq50I/hTYnKWdzqoflote3stbpFnMUcvJxgTpB7jNRb6utRBGuY5RZZRSD0L/4Q 5pRFMD1h/2Yv3NYjThbgZRJZgjCtqrpdWg/foPsXULhPXvxfR8+wDSfF9RDNOjRRLuiC jgRiPc/92Iu6YkOc/SvA0XK3z9GQDwJkYfc2mwXvy4xEc3ht/ZNdw60JZh3BvB4LDTK5 Qk8q6eJBMkXQMzC/KqTf6vB67GRN5ZtoOiqgHoekgcdn3C914wt9rqH8VqdiV/dta+gP Zo0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=T3YLmShsXHzYS+SwxvGmWk40fJ/Ku1cYbc0CTeNJEyY=; b=R1oQ5AWcfNfaTRn4nd+wax4o2/RZSbcMiAy0e8ZfZJJfGa54dJnPt8UKA46q5CdGaf JE1ubKhEisEeA80Xe11ymDD/VmbD32hS5proQYgEQBs6gq6XKgv/qHV6FvVt0BrA1xHr 15qdtnT9T/MTj+568rH4Jp7XhuYNoeRENRYyqaLqfKkQ77OCBPKohmBl24kODwXBi3cp 58jHUiltI9cmKze0DINHlRqSokSnxKituge82gsATr3i0O1SplTaws5k9fFilopa18yx khdpS5NDsr43zxYNFbqvkHLv2YH5lMcYoXpQmcyLG0W0Otk4D39LEZMmlMhCDS6wpO1F zGeA== X-Gm-Message-State: AOAM532Vv3aDmaFqECL9q/EbYYcNJK+CpPVG7dfaoYFljqgxE2U+o91v zSgJwc/uL4vI95DC6P2GRW4+Sp3URiPIku2Ho4/Ogw== X-Received: by 2002:a05:6512:10cd:: with SMTP id k13mr7529609lfg.153.1590152841031; Fri, 22 May 2020 06:07:21 -0700 (PDT) MIME-Version: 1.0 References: <8d29eba045ef18c5489e122b3668afc20431f15d.1588043236.git.baolin.wang7@gmail.com> <4b224e7bb703e15469e5cd79a54f7bc00a790fc5.1588043236.git.baolin.wang7@gmail.com> In-Reply-To: From: Baolin Wang Date: Fri, 22 May 2020 21:07:04 +0800 Message-ID: Subject: Re: [PATCH v4 2/2] mailbox: sprd: Add Spreadtrum mailbox driver To: Jassi Brar Cc: Rob Herring , Orson Zhai , Chunyan Zhang , Devicetree List , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 22, 2020 at 11:48 AM Jassi Brar wrote: > > On Thu, May 21, 2020 at 7:24 AM Baolin Wang wrote: > > > > Hi Jassi, > > > > On Wed, May 13, 2020 at 2:32 PM Baolin Wang wrote: > > > > > > On Wed, May 13, 2020 at 2:05 PM Jassi Brar wrote: > > > > > > > > On Tue, May 12, 2020 at 11:14 PM Baolin Wang wrote: > > > > > > > > > > Hi Jassi, > > > > > > > > > > On Thu, May 7, 2020 at 11:23 AM Baolin Wang wrote: > > > > > > > > > > > > Hi Jassi, > > > > > > > > > > > > On Thu, May 7, 2020 at 7:25 AM Jassi Brar wrote: > > > > > > > > > > > > > > On Wed, May 6, 2020 at 8:29 AM Baolin Wang wrote: > > > > > > > > > > > > > > > > Hi Jassi, > > > > > > > > > > > > > > > > On Tue, Apr 28, 2020 at 11:10 AM Baolin Wang wrote: > > > > > > > > > > > > > > > > > > From: Baolin Wang > > > > > > > > > > > > > > > > > > The Spreadtrum mailbox controller supports 8 channels to communicate > > > > > > > > > with MCUs, and it contains 2 different parts: inbox and outbox, which > > > > > > > > > are used to send and receive messages by IRQ mode. > > > > > > > > > > > > > > > > > > Signed-off-by: Baolin Wang > > > > > > > > > Signed-off-by: Baolin Wang > > > > > > > > > --- > > > > > > > > > Changes from v3: > > > > > > > > > - Save the id in mbox_chan.con_priv and remove the 'sprd_mbox_chan' > > > > > > > > > > > > > > > > > > Changes from v2: > > > > > > > > > - None. > > > > > > > > > > > > > > > > > > Changes from v1: > > > > > > > > > - None > > > > > > > > > > > > > > > > Gentle ping, do you have any other comments? Thanks. > > > > > > > > > > > > > > > Yea, I am still not sure about the error returned in send_data(). It > > > > > > > will either never hit or there will be no easy recovery from it. The > > > > > > > api expects the driver to tell it the last-tx was done only when it > > > > > > > can send the next message. (There may be case like sending depend on > > > > > > > remote, which can't be ensured before hand). > > > > > > > > > > > > Actually this is an unusual case, suppose the remote target did not > > > > > > fetch the message as soon as possile, which will cause the FIFO > > > > > > overflow, so in this case we can not send messages to the remote > > > > > > target any more, otherwise messages will be lost. Thus we can return > > > > > > errors to users to indicate that something wrong with the remote > > > > > > target need to be checked. > > > > > > > > > > > > So this validation in send_data() is mostly for debugging for this > > > > > > abnormal case and we will not trigger this issue if the remote target > > > > > > works well. So I think it is useful to keep this validation in > > > > > > send_data(). Thanks. > > > > > > > > > > Any comments? Thanks. > > > > > > > > > Same as my last post. > > > > > > I think I've explained the reason why we need add this validation in > > > my previous email, I am not sure how do you think? You still want to > > > remove this validation? > > > > Gentle ping. > > > > As I explained in previous email, this validation is for an unusual > > case, suppose the remote target did not fetch the message as soon as > > possile, which will cause the FIFO overflow, so in this case we can > > not send messages to the remote > > target any more, otherwise messages will be lost. Thus we can return > > errors to users to indicate that something wrong with the remote > > target need to be checked. > > > > So this validation in send_data() is mostly for debugging for this > > abnormal case and we will not trigger this issue if the remote target > > works well. So I think it is useful to keep this validation in > > send_data(). What do you think? Thanks. > > > I still think the same as before. > You should do this check before you call mbox_chan_txdone() and wait > if busy ... which is exactly the purpose of txdone(). > It seems harmless to be paranoid and place a block of code in > practically "if 0", but that sets bad precedence for other drivers. So > please move the check before txdone(). OK. I realized I can implement the flush() to make sure the transmission has been completed. Thanks. -- Baolin Wang