From patchwork Tue Mar 7 15:32:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 65636 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:570d:b0:a1:2e52:cf23 with SMTP id h13csp1968745dyk; Tue, 7 Mar 2023 07:38:49 -0800 (PST) X-Google-Smtp-Source: AK7set+e0PqM2dBOv5lKrPF9HSmoLDIMrYlkCEyU53X9IqwbEHCGqgqSrOE65TNQQt/y8MRim1Lb X-Received: by 2002:a05:6a20:144c:b0:cd:272:fd3f with SMTP id a12-20020a056a20144c00b000cd0272fd3fmr17368737pzi.25.1678203529308; Tue, 07 Mar 2023 07:38:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678203529; cv=none; d=google.com; s=arc-20160816; b=IMLJ5fCAj1xEj0npxUG6imoTmSLvClEvFS14SVuucyg3+30FKa/mkVcGx+w/gXPEBV 2jpEXvZ3Skl4v9VxAnucVBAYJG95MMzUBYvW/Y5HlhH6UZ7OR08o91xG4rbQyc1o/Jmi IgCSZc4YkkTFU5z4dAwl9QUk4YahtfOwlpm/VFUC03jynbD+Snn9PjfG34LnqhkDUWMg y29/ovmd585tuMg+apabHGMuOk2MT40dtBw60HJ7mQS+dPXoanzotiW9tL2YumdgKnFA 4F1J1Js21PXZWernrGUoDmJKJF6DyuAByD2lo63QHH2lVm7dfJZfF2w/uhXz6m/c/zsM OjSQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=c3oD+VWh6vfXWKl1YinwYukVpyEX7O+ZCt88fiLI0g4=; b=natrN9yJwI2nC3q9XtcU5by/pcEz055efz3DJrwYP+HR/XzQdegVUAfOkS9wnBnD/n Ewpey+8U/UmV6ieueNf366OsaRnsBQw3ErQzSZOTg0aQt9YwlnRHX5FOXCxoG9jAa47Q MHmrozS/YTOVJba4etGJ72ykb7adMiapObJY+pAYRE4zfvbx1ldIKvroaExwjDiWhu/X YNz3dwwILucYDBFoBUpc3bohUj0VH/3o5A8RQRVddg2VTt2uKPpALcU8YNNPpdfDmc6m S7K8KALCxcHu30tOUcSE38dCtloFuIiGP/t6C3X+AL7LSz8gdY5jorYZmmWmH2oGbxJP jVCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=RKiWq7kI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i14-20020a63220e000000b004e30cc4a2f5si11312313pgi.507.2023.03.07.07.38.34; Tue, 07 Mar 2023 07:38:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=RKiWq7kI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231322AbjCGPdJ (ORCPT + 99 others); Tue, 7 Mar 2023 10:33:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230405AbjCGPc7 (ORCPT ); Tue, 7 Mar 2023 10:32:59 -0500 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AD887BA25 for ; Tue, 7 Mar 2023 07:32:48 -0800 (PST) Received: by mail-pl1-x629.google.com with SMTP id x11so9955348pln.12 for ; Tue, 07 Mar 2023 07:32:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1678203168; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=c3oD+VWh6vfXWKl1YinwYukVpyEX7O+ZCt88fiLI0g4=; b=RKiWq7kI7n6XmLArIWP1AnEyouczbA5z2QjZxwSdk9/YWDVGfDjQfkhiJtdsvXIhHZ 31v5iScnAoLMLvPeOkkr7apGnVHUR3f/0qXKPKEJr1wFwS3r/nEQ0mv/BloFixdhp1XV z+ULops+ColVZDGxpN+z2x9m6T0yFpAE42FHA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678203168; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=c3oD+VWh6vfXWKl1YinwYukVpyEX7O+ZCt88fiLI0g4=; b=VXCOnRWRe8Lb82pSN/zMVpFhS0dkZRP8QInLOK0bktjhLOZcAGmRxwJhmMb/u7L/T7 Pdrj1cJCTD4I7+V/ZyvEXbUpxzskL7r8TmdvoNfb74Huh3CKbL1CsYtc1YzmecXBVmUy WfNyvBZxcCRmMhBkT+JdxXuce/zITN06sfKYwqSXBsEqK3Nbs513QMdpyMKGEoA5F7r5 3snJuCfmfdlVLiSdmcjV5mY7Sju8gAoNpoL9cqPaL8K0MsqVafcicVPJp/+U36BrSSD1 CoY3PYuQ5OyVEVqncl7VPo0SqPT0N9HPlkmFS7SIJY2X61Ojke94MKHN3HDsL63qsv4m RG8Q== X-Gm-Message-State: AO0yUKVAcL2kSErShbowhNALwnSfuHkZ9qL6yu6FPy7delpVzt3hXBDJ s0diaudDxJ6R0aST6qU2wGPgSA== X-Received: by 2002:a17:902:e748:b0:19e:82d5:634c with SMTP id p8-20020a170902e74800b0019e82d5634cmr16558648plf.53.1678203167946; Tue, 07 Mar 2023 07:32:47 -0800 (PST) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:2023:7dda:98bb:96dd]) by smtp.gmail.com with ESMTPSA id jy16-20020a17090342d000b0019719f752c5sm8586843plb.59.2023.03.07.07.32.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 07:32:47 -0800 (PST) From: Douglas Anderson To: Bjorn Andersson , Greg Kroah-Hartman Cc: Jiri Slaby , Bartosz Golaszewski , Daniel Thompson , linux-serial@vger.kernel.org, linux-arm-msm@vger.kernel.org, kgdb-bugreport@lists.sourceforge.net, Konrad Dybcio , Douglas Anderson , Andy Gross , linux-kernel@vger.kernel.org Subject: [PATCH 1/3] tty: serial: qcom-geni-serial: Fix kdb/kgdb after port shutdown (again) Date: Tue, 7 Mar 2023 07:32:11 -0800 Message-Id: <20230307073155.1.Iaab0159b8d268060a0e131ebb27125af4750ef99@changeid> X-Mailer: git-send-email 2.40.0.rc0.216.gc4246ad0f0-goog MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759723943868513569?= X-GMAIL-MSGID: =?utf-8?q?1759723943868513569?= Commit d8aca2f96813 ("tty: serial: qcom-geni-serial: stop operations in progress at shutdown") was basically a straight revert of the commit it claims to fix without any explanation of why the problems talked about in the original patch were no longer relevant. Indeed, commit d8aca2f96813 ("tty: serial: qcom-geni-serial: stop operations in progress at shutdown") re-introduces the same problem that commit e83766334f96 ("tty: serial: qcom_geni_serial: No need to stop tx/rx on UART shutdown") fixed. The problems are very easy to see by simply doing this on a sc7180-based Chromebook: 1. Boot in developer mode with serial console enabled and kdb setup on the serial console. 2. via ssh: stop console-ttyMSM0; echo g > /proc/sysrq-trigger When you do the above you'll see the "kdb" prompt printed on the serial console but be unable to interact with it. Let's fix the problem again by noting that the console port is never configured in DMA mode and thus we don't need to stop things for the console. Fixes: d8aca2f96813 ("tty: serial: qcom-geni-serial: stop operations in progress at shutdown") Signed-off-by: Douglas Anderson Reviewed-by: Bartosz Golaszewski Tested-by: Bartosz Golaszewski Reviewed-by: Johan Hovold --- drivers/tty/serial/qcom_geni_serial.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index d69592e5e2ec..74a0e074c2de 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -1070,8 +1070,10 @@ static int setup_fifos(struct qcom_geni_serial_port *port) static void qcom_geni_serial_shutdown(struct uart_port *uport) { disable_irq(uport->irq); - qcom_geni_serial_stop_tx(uport); - qcom_geni_serial_stop_rx(uport); + if (!uart_console(uport)) { + qcom_geni_serial_stop_tx(uport); + qcom_geni_serial_stop_rx(uport); + } } static int qcom_geni_serial_port_setup(struct uart_port *uport)