From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0B00C352A4 for ; Thu, 13 Feb 2020 02:18:57 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7F63A20848 for ; Thu, 13 Feb 2020 02:18:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="KHJaR/7z"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=sholland.org header.i=@sholland.org header.b="Rx/UwHRd"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="IM0u8gjq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7F63A20848 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tschuAXgxM/PT2pQ/19BXtxTAWYb0aSWSVgWnsq1jaY=; b=KHJaR/7zKjGg4u woHsZr65jtnUMSOutKYU8l1hZvUulI0wWTYUaqRUGpRG0Fav6sfhitRqUXDCG1T6FXoylOvojOJpF /htmR7WHI0mcGuXTyOOmEUvUoJxWh4FO+t10SVMpaiOrOr5CEEOhEAUYaO3Abo0Xli9ClGC/el9yW uIB/nQyWYxeQBKoNST/x62MvpjOs9h3oD9vX2nSrerCGjkd2BrlRNmfezOHy3SaVqrdESfeBfufrU sOM1dbvNCV6jLRC7mi1tBmuM2VLOKe3Q2EUIGmIlWf3kErdbkluEoRDrXaw6IYRkEv/25fSHMaywl e6H+HZb1W5kfOgpJo93Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j245c-0003rc-GV; Thu, 13 Feb 2020 02:18:52 +0000 Received: from new2-smtp.messagingengine.com ([66.111.4.224]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j245Y-0003qt-RY for linux-arm-kernel@lists.infradead.org; Thu, 13 Feb 2020 02:18:50 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id 0A2D878DD; Wed, 12 Feb 2020 21:18:47 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Wed, 12 Feb 2020 21:18:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=j oc0nTBS0TrHM54svde7hMgF2xPWZMi+owrnjYj7liY=; b=Rx/UwHRdOA1f9RDtl eJ8JHrcLGDopY14a4t2TS0h3umQgzyc/G7VJe51GZRrOcr4XoCFWj7VxFYwnFTqb gDQNXnxEe0UyUdAaV3zaTlycM6km+m75YxM6vB/fP6oxXkDz2gikfJ4YayCXrBhq rsobyCkqSthx2+BpE8qVLjJVcRVZ4DU4Gmesa7TL445XRheFIba6B1f6nzoMFX9R khG62mPfFdi65tjiIQ8injRarUd6K8iSi4fab/22ybBWpDZEOy4UAU15ZCxwSB27 X6+sKoKSCsRcieLPcrItvcssr0OkoO01vb3FH8iW47mvoc8vMX7DydGYQLqpiyfw ZX6KQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=joc0nTBS0TrHM54svde7hMgF2xPWZMi+owrnjYj7l iY=; b=IM0u8gjq6Nx2Kq3y6QyAmNzZALo7IqzIVcjwPX29Mu0sfZd/j+LBI5BuK NBrHQ4Kmq/nXJIxrWfdwOqwAI3vfNysKdtF/fKZyanDh0R3E7dnUp2THhxJUWxx1 g1F+AVgGBIM5WY3CkomMYpce3X+AJhKVlZKso7McGpeBqPjDfV/HY25hutiHHaLG BI8yo/CSgUSo/LTDeC51N/LHh7FwFWKSoSoo6Ms71VsFg/JYC2Qi1WD9W+p2CuKr BZFKIouEVJbfiB91ycQK1Yfv5rEUj5DbM/Dzkbnm1KFMrBk4ANAz/8gkqzt5h0Mo 6zC/9Q+Y6LvzPN63LQGP68YArlyPw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrieejgdegiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefuvfhfhffkffgfgggjtgfgsehtjeertddtfeejnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucfkph epjedtrddufeehrddugeekrdduhedunecuvehluhhsthgvrhfuihiivgeptdenucfrrghr rghmpehmrghilhhfrhhomhepshgrmhhuvghlsehshhholhhlrghnugdrohhrgh X-ME-Proxy: Received: from [192.168.50.169] (70-135-148-151.lightspeed.stlsmo.sbcglobal.net [70.135.148.151]) by mail.messagingengine.com (Postfix) with ESMTPA id 9E89130606E9; Wed, 12 Feb 2020 21:18:42 -0500 (EST) Subject: Re: [PATCH v6 2/6] mailbox: sun6i-msgbox: Add a new mailbox driver To: Jassi Brar References: <20200113051852.15996-1-samuel@sholland.org> <20200113051852.15996-3-samuel@sholland.org> From: Samuel Holland Message-ID: <72dc2074-c06d-4bdf-ca5f-b4007f492407@sholland.org> Date: Wed, 12 Feb 2020 20:18:42 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200212_181849_079743_875A67CB X-CRM114-Status: GOOD ( 16.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Ondrej Jirman , Devicetree List , linux-sunxi@googlegroups.com, Linux Kernel Mailing List , Maxime Ripard , Chen-Yu Tsai , Rob Herring , Philipp Zabel , linux-arm-kernel Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Jassi, On 2/12/20 8:02 PM, Jassi Brar wrote: > On Sun, Jan 12, 2020 at 11:18 PM Samuel Holland wrote: >> >> +static int sun6i_msgbox_send_data(struct mbox_chan *chan, void *data) >> +{ >> + struct sun6i_msgbox *mbox = to_sun6i_msgbox(chan); >> + int n = channel_number(chan); >> + uint32_t msg = *(uint32_t *)data; >> + >> + /* Using a channel backwards gets the hardware into a bad state. */ >> + if (WARN_ON_ONCE(!(readl(mbox->regs + CTRL_REG(n)) & CTRL_TX(n)))) >> + return 0; >> + >> + /* We cannot post a new message if the FIFO is full. */ >> + if (readl(mbox->regs + FIFO_STAT_REG(n)) & FIFO_STAT_MASK) { >> + mbox_dbg(mbox, "Channel %d busy sending 0x%08x\n", n, msg); >> + return -EBUSY; >> + } >> + > This check should go into sun6i_msgbox_last_tx_done(). > send_data() assumes all is clear to send next packet. sun6i_msgbox_last_tx_done() already checks that the FIFO is completely empty (as the big comment explains). So this error could only be hit in the knows_txdone == true case, if the client pipelines multiple messages by calling mbox_client_txdone() before the message is actually removed from the FIFO. >From the comments in mailbox_controller.h, this kind of usage looks to be unsupported. In that case, I could remove the check entirely. Does that sound right? > ..... >> + >> + mbox->controller.dev = dev; >> + mbox->controller.ops = &sun6i_msgbox_chan_ops; >> + mbox->controller.chans = chans; >> + mbox->controller.num_chans = NUM_CHANS; >> + mbox->controller.txdone_irq = false; >> + mbox->controller.txdone_poll = true; >> + mbox->controller.txpoll_period = 5; >> + > nit: just a single space should do too. > > Sorry, for some reason I thought I had replied to this patch, but > apparently not. My mistake. Do you want to revise this submission or > send another patch on top? For just this change, it would be simpler to send a follow-up patch. > thanks Thank you, Samuel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel