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.9 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 D68ABC67872 for ; Thu, 13 Dec 2018 18:44:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ABC7220870 for ; Thu, 13 Dec 2018 18:44:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ABC7220870 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-renesas-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726401AbeLMSos (ORCPT ); Thu, 13 Dec 2018 13:44:48 -0500 Received: from laurent.telenet-ops.be ([195.130.137.89]:55460 "EHLO laurent.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726662AbeLMSor (ORCPT ); Thu, 13 Dec 2018 13:44:47 -0500 Received: from ramsan ([84.194.111.163]) by laurent.telenet-ops.be with bizsmtp id BWkl1z00G3XaVaC01WklDb; Thu, 13 Dec 2018 19:44:46 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1gXVyX-0007qo-Da; Thu, 13 Dec 2018 19:44:45 +0100 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1gXVyX-0005i5-BX; Thu, 13 Dec 2018 19:44:45 +0100 From: Geert Uytterhoeven To: Greg Kroah-Hartman , Jiri Slaby Cc: Ulrich Hecht , Wolfram Sang , Yoshihiro Shimoda , Yoshinori Sato , linux-renesas-soc@vger.kernel.org, linux-sh@vger.kernel.org, linux-serial@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v4 0/4] serial: sh-sci: Fix fallback to PIO on DMA failure Date: Thu, 13 Dec 2018 19:44:40 +0100 Message-Id: <20181213184444.21904-1-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Hi Greg, Jiri, When submitting a DMA request fails, the sh-sci driver is supposed to fall back to PIO. However, this never really worked due to various reasons (sh-sci driver issues and dmaengine framework limitations). There are three places where DMA submission can fail, and the driver should fall back to PIO: 1. sci_dma_rx_complete(), 2. sci_submit_rx(), 3. work_fn_tx(). This patch series fixes fallback to PIO in the receive path (cases 1 and 2). Fallback to PIO in the transmit path (case 3) already seems to work fine. Changes compared to v3: - Let sci_submit_rx() return -EAGAIN instead of -1 on failure, - Check for negative error in sci_submit_rx() caller. Changes compared to v2: - Add missing definition of "u16 scr" to sci_dma_rx_complete(), - Move label handle_pio inside #ifdef to kill defined but not used compiler warning when CONFIG_SERIAL_SH_SCI_DMA=n, - Move call to dmaengine_terminate_async() in sci_dma_rx_complete() inside the spinlock, for symmetry with sci_submit_rx(), - Move the call sci_submit_rx() in sci_rx_interrupt() up, as it may fail, rendering the modification of scr unused, - Split in multiple patches, - Drop RFC status. Changes compared to v1: - Fix fallback in sci_dma_rx_complete(), - Fallback in the transmit path already works fine, - Widen audience, but keep RFC. This has been tested on r8a7791/koelsch, using SCIF1 on debug serial 1, and SCIFA3 on EXIO-B, by introducing random failures in DMA submission code. Thanks! Geert Uytterhoeven (4): serial: sh-sci: Fix locking in sci_submit_rx() serial: sh-sci: Fix crash in rx_timer_fn() on PIO fallback serial: sh-sci: Resume PIO in sci_rx_interrupt() on DMA failure serial: sh-sci: Fix fallback to PIO in sci_dma_rx_complete() drivers/tty/serial/sh-sci.c | 39 +++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) -- 2.17.1 Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds