Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3700954imu; Mon, 28 Jan 2019 09:16:17 -0800 (PST) X-Google-Smtp-Source: ALg8bN62Kl6Bg8fh0piPMVwn9YjUL+VgWxXjkRbghD2aLc1+2cDdJoTBiuOWBaPLlFbgTz+nmtoQ X-Received: by 2002:a63:8043:: with SMTP id j64mr20906067pgd.405.1548695777053; Mon, 28 Jan 2019 09:16:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548695777; cv=none; d=google.com; s=arc-20160816; b=C/prT83c8SQXgOoxT6Xvv5vxKdKgSUsec0Nmtt+de8eY7nWVxMn1hOELXPbl4mdJU1 Qs5HzHrPhkqsz6lVJr62eVd+zXScEfAVP+Y3bh39ZrnFN5j3lBQh3nUvS+AvEN+uWWET IZYpBJ1brXW2yrEhsnT0GwKGpWv2pzfiun6hZgMD0Ur8ktvXYFAGofrpklgqw4KfgYqW hRuwXEM4m8fRAurvr3Xo+uZ4xDJ/Xpc+RMIWiqwgMuUVHhSIAxxkQSshmf2q9QXsP/Px M3xBKm1IBPKCDdqgK1yvgGqDKEN5fIlmfeRZYObsKUth4I2SDfjuuI1UrTMpKtlXOvsx 31ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=630ei2gYKbM1wWVCQer2+sU9AgjMzp1ZsbcFdmvRsrs=; b=xdIcPQ1quw6AoxkuYNhj4QOlRtHJ5dm8EAt0jpG9CoKq6Ab98vk+eeMtSDRYd/acuX DaJdNHgfApM0ycz9YY7G3A9zA9VZtXbW4dbALCzBVmFwCQKtJOgjfMT0lfCdKs/9irIV YtvmqbcVj6V/rkMdD3Y9RUZHi6dpj9UVAgeiVTWJKlmBQ2+eEzVQ8/0IbSRET9G6e5Ud 13L1ktGt1udChDRkch8Le2jmQu9+yq+gv1AHmXpDye7D+NBkTuZL9O8fwSR0j/t3DqSW osfYliY88F5Wbt91nl1TaYschV/8HXQYbDEMjrUUTGIVjPS5EoEmBWJqv12VlOi+H5Rv RwQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LtDylZTc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x24si32400424plr.379.2019.01.28.09.16.00; Mon, 28 Jan 2019 09:16:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LtDylZTc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732151AbfA1QHH (ORCPT + 99 others); Mon, 28 Jan 2019 11:07:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:57070 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732135AbfA1QHE (ORCPT ); Mon, 28 Jan 2019 11:07:04 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2769F2147A; Mon, 28 Jan 2019 16:07:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691623; bh=KQCCNHWDpti/YV/x2UxKZTASc3mFD3nz+L4lgLkPRFw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LtDylZTcyqWbZnTUnE9V8PFUwKXkS0VobzwQOMfQZVdEE5BeiMAZEt2Lm2KT+Q11K NLniKedWPGHVFPcpDElrxLSDY6WEX1l32+V4XKMyOIt6OBKgWPV0dHXyh/TFQlTlOo MUIarBllqc21OZAc5BBVRSgy2ZKwG1wZ95ncizhg= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Geert Uytterhoeven , Greg Kroah-Hartman , Sasha Levin , linux-serial@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 163/258] serial: sh-sci: Resume PIO in sci_rx_interrupt() on DMA failure Date: Mon, 28 Jan 2019 10:57:49 -0500 Message-Id: <20190128155924.51521-163-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Geert Uytterhoeven [ Upstream commit 71ab1c0336c71ace5725740f200beca9667a339f ] On (H)SCIF, sci_submit_rx() is called in the receive interrupt handler. Hence if DMA submission fails, the interrupt handler should resume handling reception using PIO, else no more data is received. Make sci_submit_rx() return an error indicator, so the receive interrupt handler can act appropriately. Signed-off-by: Geert Uytterhoeven Reviewed-by: Simon Horman Acked-by: Wolfram Sang Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/sh-sci.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 5fdd7944b73b..c6e8ca2e5f7d 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -1331,7 +1331,7 @@ static void sci_tx_dma_release(struct sci_port *s) dma_release_channel(chan); } -static void sci_submit_rx(struct sci_port *s, bool port_lock_held) +static int sci_submit_rx(struct sci_port *s, bool port_lock_held) { struct dma_chan *chan = s->chan_rx; struct uart_port *port = &s->port; @@ -1359,7 +1359,7 @@ static void sci_submit_rx(struct sci_port *s, bool port_lock_held) s->active_rx = s->cookie_rx[0]; dma_async_issue_pending(chan); - return; + return 0; fail: /* Switch to PIO */ @@ -1374,6 +1374,7 @@ static void sci_submit_rx(struct sci_port *s, bool port_lock_held) sci_start_rx(port); if (!port_lock_held) spin_unlock_irqrestore(&port->lock, flags); + return -EAGAIN; } static void work_fn_tx(struct work_struct *work) @@ -1668,8 +1669,10 @@ static irqreturn_t sci_rx_interrupt(int irq, void *ptr) disable_irq_nosync(irq); scr |= SCSCR_RDRQE; } else { + if (sci_submit_rx(s, false) < 0) + goto handle_pio; + scr &= ~SCSCR_RIE; - sci_submit_rx(s, false); } serial_port_out(port, SCSCR, scr); /* Clear current interrupt */ @@ -1681,6 +1684,8 @@ static irqreturn_t sci_rx_interrupt(int irq, void *ptr) return IRQ_HANDLED; } + +handle_pio: #endif if (s->rx_trigger > 1 && s->rx_fifo_timeout > 0) { -- 2.19.1