Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1951783ybk; Thu, 21 May 2020 20:51:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXHw6zwwNDN4R5Z5OrGraqF/I2hoDAqRP3lytiajIC54rZ8S7GVOaU3xwhmMi9nFhKg2y9 X-Received: by 2002:a17:906:b20d:: with SMTP id p13mr6275500ejz.120.1590119460737; Thu, 21 May 2020 20:51:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590119460; cv=none; d=google.com; s=arc-20160816; b=xMR4h5BSdcJw6BwznV4i2gWImxlFHAJrUIaV9stJ8TdVGXaNWrus4K0DFMvhr3NyPM YwCIJzrgDc0L57V1w4vEGaB6wZljWtvr9/ND5719LURgSIzwOWRxl9/LoPlvmhEmV8RR 1dwptFqRhD2GfW4Cw2J9q6SeroFpSNaK9fjL9HakJFI6QhiDsAx97syzBS0KYXT4aRz0 cmOgORxZLu3lU2jl+1D5CW5o98fw6HZ+YyWFm2J4hdDUWE8WzuAAdx3HpPUbVjbJd+6p c5oJNRB+cWE7Wp7ZbyMSXis7oZHQBcKI0Ws78EgDt0aeJJb1XFnJunYa9Z/ZrEiREwtL 4z+g== 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=aIP2diEvzhm2AdN/Mxqa8HFPuNr8GL8GdM4WtK2bHt8=; b=Vl9ZBeuLwhjD3QGQ5HzjuKamp0fXuMSozoceBKhY8RPgxs9wIMJndk0X4D4ujyTegg mNGS9cPspyxIttrYr2FgT4ENmnRqiBtGF6sl44piircQCoDT/nPdZin2LC/5/9/6NYAE Lops28GPqhW8GHprfRiW+eVqil0nT892v6mtEOcfcYVjL+WCnUjOo2L6sAITIbyF996p bRbgYJaLgYAWYXC4mPMpfnitWXAPOmJryGR7YQHko7hOzeYw/FzusnvRqNTxlmERcbxN xdT0XnWEENSpq6Vh/vc4w2KqJGwtGHKzfjqS6ObzExEhxRfyUwtD2xWkJLkOTQ1SEXbQ 6QdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RP7bUKOj; 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 cm10si3765239edb.82.2020.05.21.20.50.37; Thu, 21 May 2020 20:51:00 -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=RP7bUKOj; 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 S1728181AbgEVDsu (ORCPT + 99 others); Thu, 21 May 2020 23:48:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727836AbgEVDst (ORCPT ); Thu, 21 May 2020 23:48:49 -0400 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B116CC061A0E; Thu, 21 May 2020 20:48:49 -0700 (PDT) Received: by mail-io1-xd43.google.com with SMTP id q129so848780iod.6; Thu, 21 May 2020 20:48:49 -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=aIP2diEvzhm2AdN/Mxqa8HFPuNr8GL8GdM4WtK2bHt8=; b=RP7bUKOja78unJmtL//FaC43ciXZEhEsCeSwFvs4nAHMrjEEGBzp9Q37CHRKKjX5uJ I3OYdQjlyHOeLF1/fFBpkCrH7S6p8joOnfozfqfm0fm5KjEAI+spE0kDRf9jXaOviuWA UtCICHYp+7kjypw4IWX7dw3steiHeuggnS7j1wKi9OEDrI5d2DkJ7TUZtgNMO3C2l1MG aynbN33Icim2XL/IAYnCtX+z4s9TcYksL3N16IZTuYQcKPSiBOgYNaN869be+qloyvEo WhUZAAue/metKXimkaOKFUTevbHCojnVwatT5zLvPxxwyW/sfCeH5JVsa0e8WOUlvIjl 4vUw== 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=aIP2diEvzhm2AdN/Mxqa8HFPuNr8GL8GdM4WtK2bHt8=; b=tNgYCpfcbZsx3/a3tbnr+IK0QbkA1QDyrZ3rC4GJGrna58bcwv60UNmpWf2cUJ2BuL 22/2gS3MGBlD8aQzFKgb226hy9THBiR+MGg7Ed9eTTcBjGF3URPZDYSykf0m9m9rH0TS HQr1c8BGkVivMPZgI6dvpLxfvnxN3G+YV7kSaDaTqihB/GlWMdnfaTUwO/BRSb5RiunZ GTqomdS47j4h4yeLEEccRQMJB7pSI33d7UmcKQ2mrXlfe75EARTpNDXjYZ/Pa6QR9SkW bCp/QOxBtHkpfB/bNDL+StwwJJdaB5CJVNnCskv48vQsyLNOXEcVMzD9IirQjxT5wxga UqJQ== X-Gm-Message-State: AOAM530on3/zVeySYxIAIxASmp2NYvvl0gkuwESzyzOAxDjj3WVWi/At 1Vec0QMv83goEYyjXCdQAU6vchckSZSh6mAPRND5PcEB X-Received: by 2002:a5e:9807:: with SMTP id s7mr1534629ioj.27.1590119329011; Thu, 21 May 2020 20:48:49 -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: Jassi Brar Date: Thu, 21 May 2020 22:48:37 -0500 Message-ID: Subject: Re: [PATCH v4 2/2] mailbox: sprd: Add Spreadtrum mailbox driver To: Baolin Wang 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 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(). thanks.