From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754875AbbE1Upo (ORCPT ); Thu, 28 May 2015 16:45:44 -0400 Received: from avon.wwwdotorg.org ([70.85.31.133]:56616 "EHLO avon.wwwdotorg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754485AbbE1Upg (ORCPT ); Thu, 28 May 2015 16:45:36 -0400 Message-ID: <55677E6F.7070504@wwwdotorg.org> Date: Thu, 28 May 2015 14:45:35 -0600 From: Stephen Warren User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Eric Anholt CC: linux-kernel@vger.kernel.org, Jassi Brar , linux-rpi-kernel@lists.infradead.org Subject: Re: [PATCH] mailbox/bcm2835: Fix mailbox full detection. References: <1431547832-32430-1-git-send-email-eric@anholt.net> In-Reply-To: <1431547832-32430-1-git-send-email-eric@anholt.net> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/13/2015 02:10 PM, Eric Anholt wrote: > With the VC reader blocked and the ARM writing, MAIL0_STA reads empty > permanently while MAIL1_STA goes from empty (0x40000000) to non-empty > (0x00000001-0x00000007) to full (0x80000008). > > This bug ended up having no effect on us, because all of our > transactions in the client driver were synchronous and under a mutex. If you could get someone at the RPi Foundation or Broadcom to update the register descriptions and example code at the following URLs, that would be rather useful. Otherwise, this code will appear incorrect when compared against the documentation: https://github.com/raspberrypi/firmware/wiki/Mailboxes ("Mailbox registers" at the bottom) https://github.com/raspberrypi/firmware/wiki/Accessing-mailboxes ("Sample code") > diff --git a/drivers/mailbox/bcm2835-mailbox.c b/drivers/mailbox/bcm2835-mailbox.c > @@ -117,7 +118,7 @@ static bool bcm2835_last_tx_done(struct mbox_chan *link) > bool ret; > > spin_lock(&mbox->lock); > - ret = !(readl(mbox->regs + MAIL0_STA) & ARM_MS_FULL); > + ret = !(readl(mbox->regs + MAIL1_STA) & ARM_MS_FULL); What does "tx done" mean semantically? If "tx done" means "remote side received all our messages", then surely this should check MAIL1_STA for emptiness, which is different to the "not full" check implemented here? If "tx done" means "there's space to transmit more messages", then consider this: Acked-by: Stephen Warren ... and I guess I'll need to fix U-Boot for the same issue.