Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp595699pxb; Tue, 5 Apr 2022 15:21:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxv+M5ci6vXIrTG+63dRU2C/s23R+zDvKGXnCW9nxE+UuXyfzUIC5m0MpDO9KZw6VrLYujA X-Received: by 2002:a63:3e4c:0:b0:398:3448:e0d1 with SMTP id l73-20020a633e4c000000b003983448e0d1mr4674861pga.336.1649197301138; Tue, 05 Apr 2022 15:21:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649197301; cv=none; d=google.com; s=arc-20160816; b=QTnWDwNPcZAlr/TwkTBpZrwnLdWm68CyYORCl3VtExR7pLUi/FU4k/o7wlgXMfmR3T NEUWFTFUeS23nH/iFVYXMCI3GayEUKTp1/BR/o13HJE3RCOyg8TvFthNt5x34AtPB81i L2ogZhJm+oEUBvfjYiTCrkqIMPU/f28Y665uLHZcJItkERGbcKH8tcCiCIKDnpiIyH3k zzbKZOapHzgGFMRNZRijKO1MBXgs1OJTDwpY1DpcTC7jpImf23sfUR4obohS30SIDgbq hZNBPP02Tb8iFjQTsTk52RAjCm2NVExVCiirJ0L+0CLmnxyFlj1w9vKTYswOQ1pckIYa On+Q== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ww4jB5AMG80S726ofvmkO2J64CUVPQm6+Uoba3Y8zII=; b=011Z2GyTwhVgJ9igf1PXr7ppkuUQufBz13Sliq7xmYTXFzYsuNJ6LvKsk5+0IbQzv/ vRnQ8xMzllnLsincSXmOfx1qJnkVh9jProFDRd+vTBciBS+T5hyrEQqnnvzEMmjOmnX2 7gDnaeETdTWEm3uxu3UvKWN3ztTuRBCjwhbJ04YTp+mnGOlVdavWa1j3GfTOncfcAJPb 5M/ozWqJ+QdHcUiyBK1JfUWbbH3tLAJP6OvclDr0YDdgC20KaChlZ28B6Ozn7J0Z8g3W ZDfACOwZ9WmDeQwzPYDiyfsyob5O8nz9/s9JORKNrQseEa2lEJdQxcKwtwv83o/L0goj Li2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EC8MsUSm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id b17-20020a170902e95100b00153bc4c0a7fsi13795106pll.593.2022.04.05.15.21.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 15:21:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EC8MsUSm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B7B0C139AC2; Tue, 5 Apr 2022 15:03:37 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385221AbiDEOiz (ORCPT + 99 others); Tue, 5 Apr 2022 10:38:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242788AbiDEJiG (ORCPT ); Tue, 5 Apr 2022 05:38:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D7DEA5EA9; Tue, 5 Apr 2022 02:24:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1E669B81C99; Tue, 5 Apr 2022 09:24:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8179DC385A4; Tue, 5 Apr 2022 09:24:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649150667; bh=7Rkrs3sSrSyd8jDFyNshJ53iysc72CbfSpCQdoARRUk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EC8MsUSmfEv1HVnjKef2HEStGV6gmuUcWc7gUeTh/xJtWuMa9bdOY582YKoBQKyz+ U19czmT/ZK2IRSJzRw7m6dQhw0vkNQclRBqYm06QPJi9GxWpEeDoHs/EvNVn9Lw/km hbzAIh/62hPiD6ZEEggCEZ96eT4UuyYUGHsWH4Yw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pekka Pessi , Jon Hunter , Thierry Reding , Jassi Brar Subject: [PATCH 5.15 138/913] mailbox: tegra-hsp: Flush whole channel Date: Tue, 5 Apr 2022 09:20:00 +0200 Message-Id: <20220405070343.968248510@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 From: Pekka Pessi commit 60de2d2dc284e0dd1c2c897d08625bde24ef3454 upstream. The txdone can re-fill the mailbox. Keep polling the mailbox during the flush until all the messages have been delivered. This fixes an issue with the Tegra Combined UART (TCU) where output can get truncated under high traffic load. Signed-off-by: Pekka Pessi Tested-by: Jon Hunter Fixes: 91b1b1c3da8a ("mailbox: tegra-hsp: Add support for shared mailboxes") Cc: stable@vger.kernel.org Signed-off-by: Thierry Reding Reviewed-by: Jon Hunter Signed-off-by: Jassi Brar Signed-off-by: Greg Kroah-Hartman --- drivers/mailbox/tegra-hsp.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/mailbox/tegra-hsp.c +++ b/drivers/mailbox/tegra-hsp.c @@ -412,6 +412,11 @@ static int tegra_hsp_mailbox_flush(struc value = tegra_hsp_channel_readl(ch, HSP_SM_SHRD_MBOX); if ((value & HSP_SM_SHRD_MBOX_FULL) == 0) { mbox_chan_txdone(chan, 0); + + /* Wait until channel is empty */ + if (chan->active_req != NULL) + continue; + return 0; }