From patchwork Thu Mar 16 20:20:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 70967 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp691458wrt; Thu, 16 Mar 2023 13:34:41 -0700 (PDT) X-Google-Smtp-Source: AK7set+FfuPt94D2ujxslCcXzgOM7QZdV9rlY/exh/Nxes85fX8rJqTkZbZyvKfaxxJ7+lJNAFst X-Received: by 2002:a17:902:d2c9:b0:19e:2e6b:1448 with SMTP id n9-20020a170902d2c900b0019e2e6b1448mr5430395plc.2.1678998880917; Thu, 16 Mar 2023 13:34:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678998880; cv=none; d=google.com; s=arc-20160816; b=lbkId73UeptUwT1HAKfhWfE8ZDhMQhL0D6GwJlZ13Hd0ZqA7oks2SYx/d9366QhE3G N6TR3UU3fgHaeuJ5HY2+2e1evCoR7+slBK3XPd6JfUePZpspgN82rC8rkVg8wV0YiNwQ vRxoCgebPwf8ayyvSnlHjb4QA+GLTZbgg6M8UDhgy6iruwvg+M6DDyjgW961y3ld0XuD aaKRfw0x8uKbTnavnTQtQ4UVxULZOUJXutuRU0wPszN0C0uoFy+iDnPyAYEotJSHZ0r/ Cu4L6h2Z+UoOl0CYxQIUw2guQIg9ysHqqt5YeUZ83tkF2RI9lTm7og8W2TAtujxUd5V/ smZw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=g57LqyNVPd4QtvwDpadq5p0zhAPNVIWZbBGClF8fQN4=; b=AyEv5asfRl+gRxoiCavHXUNUlHrvCAKcMQtp+SBf+mRwApDsEgMx24qzRIaaE1+wxP 3YtdGJmmphScCIF/wiG1G3jjvJggTanVx7l5Vh/Opp8N2DyU5L2C/9JBHtPwYUIxJ4Z4 1r6x99WealB0LtVc9/dw31IH4rpGkyPLl+SoDxgfpZ25+CWJfeTnoG6+xhQt+4FtX6Gp K9Zha+1235NcDtwf9VCRDyVSO6kYJiEZ/20gbMYY9lu9X7IOt2DlRAPF2CTHh0/velM5 lmjTxguiX6tHnV/vToU3qzovfKwdpCqfr49nlGo1FfPexLPNlxduWwK2+4pNX5XpcXPO /tRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=TibbCxby; 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 jj13-20020a170903048d00b0019d2142ffffsi116853plb.295.2023.03.16.13.34.03; Thu, 16 Mar 2023 13:34:40 -0700 (PDT) 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=TibbCxby; 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 S230304AbjCPUV1 (ORCPT + 99 others); Thu, 16 Mar 2023 16:21:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230202AbjCPUVX (ORCPT ); Thu, 16 Mar 2023 16:21:23 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 640E5900A9 for ; Thu, 16 Mar 2023 13:21:21 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id f6-20020a17090ac28600b0023b9bf9eb63so2781422pjt.5 for ; Thu, 16 Mar 2023 13:21:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1678998081; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=g57LqyNVPd4QtvwDpadq5p0zhAPNVIWZbBGClF8fQN4=; b=TibbCxbyBEZEYx/uzkmczi2osDWuyysnFNb7UXs3hCFZQtiCLHPDBLo+h0TaUIqtSS LXN+A7+bVvfxR3164Co4ZTPPvbcvJHJD6RwZamz7cg69L8SZXrOluqktWQwOCjLyhsL1 VmUKIBoqTGOaQ3RiLfTTD6lsheEfjtiptn5bo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678998081; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=g57LqyNVPd4QtvwDpadq5p0zhAPNVIWZbBGClF8fQN4=; b=NRl+gP5omCpQyb+HWo9SKqxMxfJmuM6mb5Yg5633wuHci4sH2We/Duk5UwTa4cJk7Q t2FeXbF/Qo+eSk6bjYTHxCm9VtCWLjkUk93gDlrow/OGWXgcTs7AdpC5aH0y+Hx2/ba7 auMClDJxMPZdLHnKPzqMk+Vai6lJmdjokq0jGRgi9Q6PsKWQm9H5hGPQvaD1yXOqjasy hcEvbRdIFj/D8InRZUNcliFAiYKskFxmH/iOx/897GRP07SqAY04GkC8cGU8KxaMc2Mx YWR9fihB/cnzmV9U4Og3MVzS9t2NR+eR7ESb7rNN2jJQ2Lby7CB6X6Rc8nI957/d7Wfp BJeA== X-Gm-Message-State: AO0yUKX4hpCnCjmX/cRj2OMrLwBH1cfPwQBKtYKOIGbqcDaVTlx5Se1Q lxip0G8mKkPUhcnZ7tZDUcHQZQ== X-Received: by 2002:a17:90a:1903:b0:233:76bd:9faa with SMTP id 3-20020a17090a190300b0023376bd9faamr5352705pjg.47.1678998080936; Thu, 16 Mar 2023 13:21:20 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:4db6:6f23:6ad2:998d]) by smtp.gmail.com with ESMTPSA id b4-20020a17090a5a0400b0023acdac248dsm24114pjd.15.2023.03.16.13.21.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Mar 2023 13:21:20 -0700 (PDT) From: Douglas Anderson To: Bjorn Andersson , Greg Kroah-Hartman Cc: linux-arm-msm@vger.kernel.org, Jiri Slaby , Bartosz Golaszewski , Daniel Thompson , kgdb-bugreport@lists.sourceforge.net, Konrad Dybcio , linux-serial@vger.kernel.org, Douglas Anderson , linux-kernel@vger.kernel.org Subject: [RESEND PATCH 1/2] serial: uart_poll_init() should power on the UART Date: Thu, 16 Mar 2023 13:20:56 -0700 Message-Id: <20230316132027.RESEND.1.I106c39498d8094c6f5e7ada42c7db17aa5c64e48@changeid> X-Mailer: git-send-email 2.40.0.rc1.284.g88254d51c5-goog In-Reply-To: <20230316202057.4070382-1-dianders@chromium.org> References: <20230316202057.4070382-1-dianders@chromium.org> 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 autolearn=unavailable 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?1760557930804157951?= X-GMAIL-MSGID: =?utf-8?q?1760557930804157951?= On Qualcomm devices which use the "geni" serial driver, kdb/kgdb won't be very happy if you use it but the resources of the port haven't been powered on. Today kdb/kgdb rely on someone else powering the port on. This could be the normal kernel console or an agetty running. Let's fix this to explicitly power things on when setting up a polling driver. Signed-off-by: Douglas Anderson --- drivers/tty/serial/serial_core.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 2bd32c8ece39..b14b5ed6fff4 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -2593,6 +2593,7 @@ static int uart_poll_init(struct tty_driver *driver, int line, char *options) { struct uart_driver *drv = driver->driver_state; struct uart_state *state = drv->state + line; + enum uart_pm_state pm_state; struct tty_port *tport; struct uart_port *port; int baud = 9600; @@ -2610,6 +2611,9 @@ static int uart_poll_init(struct tty_driver *driver, int line, char *options) goto out; } + pm_state = state->pm_state; + uart_change_pm(state, UART_PM_STATE_ON); + if (port->ops->poll_init) { /* * We don't set initialized as we only initialized the hw, @@ -2626,6 +2630,8 @@ static int uart_poll_init(struct tty_driver *driver, int line, char *options) console_list_unlock(); } out: + if (ret) + uart_change_pm(state, pm_state); mutex_unlock(&tport->mutex); return ret; } From patchwork Thu Mar 16 20:20:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 70968 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp691842wrt; Thu, 16 Mar 2023 13:35:35 -0700 (PDT) X-Google-Smtp-Source: AK7set8J68F3qc5oQGR9omyEoW6PWSLMa+q2JkxfQzjU8n3dLwH376aKWj5sJugnJUMW0knawMhG X-Received: by 2002:a05:6a20:429a:b0:c2:fb92:3029 with SMTP id o26-20020a056a20429a00b000c2fb923029mr6233313pzj.33.1678998935026; Thu, 16 Mar 2023 13:35:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678998935; cv=none; d=google.com; s=arc-20160816; b=iUUzntIsWarwhe0ogRfeSZO/MLUFvf9BrZejOKXd6mqEqzjRrkm9/XC2IYJuYnCtaJ tAPJ/7yFyExiI/vA9w0id1fvi1YtwY4258ggl1c2HVm3jGR0WFqX+ovOXmDJp4vLsOY6 iSebZziPABK2VPn3Es98nDexf3Nehm2ozIIiqzyJYMYCFi2wSAoGxdHw3iILdYF01liB nT+EgOPfJ7/2fZ3e9HDnZOUTAtbBa3FarZFU38tU5P95XJFGRGl7WHcRGeXyLD37qkMP 814QtWMcZgREngLD2ff0C+zmOLNpcs5NT663M2lHawfcbs37f5xo9z1GRIoc2T51ltPq qlSA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=R7uYBq/r2MM26gN/T+YojigH2qsAcwEwpy934F/qkEQ=; b=eS5vj7SH+zzjDWYdwefinpfVC7sThPCKQvPygvK6kBbfrbxFrU2Sh+qcencrmhxpdM ZmDhDCacmY0TGo8y/IdEDa489BLUNEzA1v9I59vquevBRUqVf6gPdq/3oh/shrZqLvvw wRSULV7IDewDy6IIGK5zgU9zD0Ryivvwt1v+HlBE79YYqEIlmETnhLg8LJOqAY+ObgUj 5NbmTk+SpGNfku2fpKWRExAkjGEwXDX70cVS7ULbcne1HsuMKfGxvX/8wf/Amb8Bv6go IIZjAk1aWDjdfXHqanQR4MV9CQO7QYF/drRnQZWyGDAS5qLEuYRRuFFBOebqVOImRQK+ rHNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=BJIzhXdI; 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 y37-20020a634965000000b0050b1994efafsi130437pgk.877.2023.03.16.13.35.22; Thu, 16 Mar 2023 13:35:35 -0700 (PDT) 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=BJIzhXdI; 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 S230318AbjCPUVa (ORCPT + 99 others); Thu, 16 Mar 2023 16:21:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230268AbjCPUVY (ORCPT ); Thu, 16 Mar 2023 16:21:24 -0400 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 4781D6F4B1 for ; Thu, 16 Mar 2023 13:21:23 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id k2so3038298pll.8 for ; Thu, 16 Mar 2023 13:21:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1678998083; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=R7uYBq/r2MM26gN/T+YojigH2qsAcwEwpy934F/qkEQ=; b=BJIzhXdI1s5gzEG0m+7jSYgDrDB2Cv3jwayVk4kqbzV9tbFk9R3GGCEwVuyfc6mlrD KpM3I806ejLxxNf4tfemT2g38pET3WVqkOcawWyOrA/AXqin5PDGFZ6+htFTWvwHtO6Y KS6NTWUEKJ8Gpx1hurGHVnAHy/QsDGjxzy9CM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678998083; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=R7uYBq/r2MM26gN/T+YojigH2qsAcwEwpy934F/qkEQ=; b=AFP/4B5F7kWSK576FcD+cyeSlZxyUQ/SwB5Thb38NlShW9yiWWY22h5+jDZfLvbN/t yU3I1+VJO8kImsXai1ot6Sud35lOLojgtaoHrN+Uj7rgxQCdsDVF9+nUAu4HxCARv/z7 CGmw3hFHL+CQVGrdm7mS74X9LOE01Qhox+G5iE9Z3r6Xds58JdKJXiQeXn5ZX54jEVJ6 gGEqHy1i/RZucCJFIAqRug1bJMcbQGcIGEAGXx6MYniNMQj+h5VpR2RIpIOIBdwzn2u6 hoGt1bzp2y6yLYCBfGiugyzMfA4q6pb1Xm9B+jM7UFbWzfcOAQfPqQlxsJS+AKoOe3+2 4qnQ== X-Gm-Message-State: AO0yUKU/xlw8J5XSLqkxJoLgeeD+M1BgWbgh/pv7UsifXQfVAvu9DcCn 22+A2RQcRfNsKiTlIpZfJV0uZAphQJP4pDgaHSA= X-Received: by 2002:a17:90b:3850:b0:234:118d:b1b1 with SMTP id nl16-20020a17090b385000b00234118db1b1mr4760801pjb.48.1678998082769; Thu, 16 Mar 2023 13:21:22 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:4db6:6f23:6ad2:998d]) by smtp.gmail.com with ESMTPSA id b4-20020a17090a5a0400b0023acdac248dsm24114pjd.15.2023.03.16.13.21.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Mar 2023 13:21:22 -0700 (PDT) From: Douglas Anderson To: Bjorn Andersson , Greg Kroah-Hartman Cc: linux-arm-msm@vger.kernel.org, Jiri Slaby , Bartosz Golaszewski , Daniel Thompson , kgdb-bugreport@lists.sourceforge.net, Konrad Dybcio , linux-serial@vger.kernel.org, Douglas Anderson , Andy Gross , linux-kernel@vger.kernel.org Subject: [RESEND PATCH 2/2] tty: serial: qcom-geni-serial: Add a poll_init() function Date: Thu, 16 Mar 2023 13:20:57 -0700 Message-Id: <20230316132027.RESEND.2.Ie678853bb101091afe78cc8c22344bf3ff3aed74@changeid> X-Mailer: git-send-email 2.40.0.rc1.284.g88254d51c5-goog In-Reply-To: <20230316202057.4070382-1-dianders@chromium.org> References: <20230316202057.4070382-1-dianders@chromium.org> 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 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?1760557986979325291?= X-GMAIL-MSGID: =?utf-8?q?1760557986979325291?= On sc7180 Chromebooks, I did the following: * Didn't enable earlycon in the kernel command line. * Didn't enable serial console in the kernel command line. * Didn't enable an agetty or any other client of "/dev/ttyMSM0". * Added "kgdboc=ttyMSM0" to the kernel command line. After I did that, I tried to enter kdb with this command over an ssh session: echo g > /proc/sysrq-trigger When I did that the system just hung. Although I thought I'd tested this scenario before, I couldn't go back and find a time when it was working. Previous testing must have relied on either the UART acting as the kernel console or an agetty running. It turns out to be pretty easy to fix: we can just use qcom_geni_serial_port_setup() as the .poll_init() function. This, together with the patch ("serial: uart_poll_init() should power on the UART"), allows the debugger to work even if there are no other users of the serial port. Signed-off-by: Douglas Anderson --- drivers/tty/serial/qcom_geni_serial.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index d69592e5e2ec..7fdb3e12846d 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -1532,6 +1532,7 @@ static const struct uart_ops qcom_geni_console_pops = { #ifdef CONFIG_CONSOLE_POLL .poll_get_char = qcom_geni_serial_get_char, .poll_put_char = qcom_geni_serial_poll_put_char, + .poll_init = qcom_geni_serial_port_setup, #endif .pm = qcom_geni_serial_pm, };