From patchwork Tue Mar 10 12:39:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 229675 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 8ACCFC18E5A for ; Tue, 10 Mar 2020 13:05:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 60670246A1 for ; Tue, 10 Mar 2020 13:05:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583845523; bh=hN6a469Tivn8u3TsieBjrDtp/aqNDl1Fq/Mz22z/h+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=dO9cyrTrz6V0/9qDn9vQ02pvoTn9wNvnPWdOc0Yh9sakZDNg0y2pMzp5Syoj8Tn2q g3LkB3hvS1KKtoIjSMW7W3O8XEDar2IV2YWdnjgaVQRbzYtoYCQzX+QJMqN1pP3Tr4 EgtqNGvwpnQggKhipaWZSs+EHnPFOBUV9VFIyX/I= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730515AbgCJNDF (ORCPT ); Tue, 10 Mar 2020 09:03:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:47458 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730512AbgCJNDF (ORCPT ); Tue, 10 Mar 2020 09:03:05 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 454EA208E4; Tue, 10 Mar 2020 13:03:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583845384; bh=hN6a469Tivn8u3TsieBjrDtp/aqNDl1Fq/Mz22z/h+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1zSDjb9jnGVLHKAyvG0QgnBWcxsflbxsotpCJAfN5l8XkWRxNkHjpcGcq1YyJsM1r OiGpdSWf2aEtM/BNU6pXpTxELToxzmGHXBbd+Y+H2u8KVENXi7JjxnS+rGfPVp7CCB cwFe5JwIyBeAH2WOAhnE+2iPN1qcy/s2mK5NMX1Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Fuzzey , Fabio Estevam , Vinod Koul Subject: [PATCH 5.5 114/189] dmaengine: imx-sdma: fix context cache Date: Tue, 10 Mar 2020 13:39:11 +0100 Message-Id: <20200310123651.275455469@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200310123639.608886314@linuxfoundation.org> References: <20200310123639.608886314@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Martin Fuzzey commit d288bddd8374e0a043ac9dde64a1ae6a09411d74 upstream. There is a DMA problem with the serial ports on i.MX6. When the following sequence is performed: 1) Open a port 2) Write some data 3) Close the port 4) Open a *different* port 5) Write some data 6) Close the port The second write sends nothing and the second close hangs. If the first close() is omitted it works. Adding logs to the the UART driver shows that the DMA is being setup but the callback is never invoked for the second write. This used to work in 4.19. Git bisect leads to: ad0d92d: "dmaengine: imx-sdma: refine to load context only once" This commit adds a "context_loaded" flag used to avoid unnecessary context setups. However the flag is only reset in sdma_channel_terminate_work(), which is only invoked in a worker triggered by sdma_terminate_all() IF there is an active descriptor. So, if no active descriptor remains when the channel is terminated, the flag is not reset and, when the channel is later reused the old context is used. Fix the problem by always resetting the flag in sdma_free_chan_resources(). Cc: stable@vger.kernel.org Signed-off-by: Martin Fuzzey Fixes: ad0d92d7ba6a ("dmaengine: imx-sdma: refine to load context only once") Reviewed-by: Fabio Estevam Link: https://lore.kernel.org/r/1580305274-27274-1-git-send-email-martin.fuzzey@flowbird.group Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman --- drivers/dma/imx-sdma.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -1335,6 +1335,7 @@ static void sdma_free_chan_resources(str sdmac->event_id0 = 0; sdmac->event_id1 = 0; + sdmac->context_loaded = false; sdma_set_channel_priority(sdmac, 0);