From patchwork Tue Oct 30 22:11:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 10661681 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3DA0713A4 for ; Tue, 30 Oct 2018 22:11:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2DE792AA6A for ; Tue, 30 Oct 2018 22:11:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 21F532AA7D; Tue, 30 Oct 2018 22:11:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C445C2AA6A for ; Tue, 30 Oct 2018 22:11:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4fEITU6oyciI6Xv1Lx3wW/azWrk+2DqMfurLeRg7G/w=; b=BX3CHab3p59DmC JXvxdzrbeVwRPNeQgHTVU3QtH9XTt1oNKHbMQd5KV1Wm6hEBinzHPncPPBg5mc+VFw1d0kYd3foKh QXGfoG7eP3SVJ3s/of3eIqw98UiKCDvLZakCxLPoLUqbBlhbO+7lUC/SD+jgVw43Y1ZriuuCx2z45 i8MgSRVBHNH94QdFHDQ0K2uhpjcgb81RA9pRWU4KDO+becThaVA+DkjISSEn+Tzla4GC9kzDmCTyA Tf3r0NpDDlkLYwTsVmhuG+g7HEaUUZ0/4NeMIIE2m4UJQLceU4C1FLsK/66pY8pHJOQ7K0H3rXfC/ 4if/EmEkyDqALMqMstQg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gHcEs-00079g-WC; Tue, 30 Oct 2018 22:11:55 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gHcEq-00078D-GM for linux-arm-kernel@lists.infradead.org; Tue, 30 Oct 2018 22:11:53 +0000 Received: by mail-pl1-x643.google.com with SMTP id b5-v6so5615728pla.6 for ; Tue, 30 Oct 2018 15:11:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=456uG5PlWBnfGUDyET8jKISVXeQZt6ggTh3gygckLP0=; b=BOyMZrSf0rDdTl6nQ87KKVm4mipKJOEpXnTSeLRqAacNT8A+mGPuzJT5RlQ5KEma86 vCK7u5ZxaOWf+wT+U99ktUD7wkcogFKmkbQizZ5GSvhJOG8ld1pAAT0a1u6T1wPrdvpu TK9gy3tPlJKCKO6mY0nvyBrhY4xHwsECJABTw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=456uG5PlWBnfGUDyET8jKISVXeQZt6ggTh3gygckLP0=; b=OmyyDSJoNEjFSugAXwapw4UaIMIfuzkgT7f8p0sF4ZFhKdDLWRNplJiLhuSe6R6buo JosidjhFDda6hktM7IaSJ4HWpc3sQWwBuAy/v9ThiEFmbOxvkhgjb4mmVj86WR+2TeBK 1//pekzUe5CxiZJFy6uPS31XzheIb7CgJPQ5UNrP/veoFYzI3ldxViDyTIYjTHhFXvwq PcVS28vttgl4CQJjx1jOmB7GmSmn3iXKQ7ZZpJw9GKLhRnH8cNnql8xk9Hkwr0ByxRIK lcUG03CoQYSQ2XsOVAWMpZeOBjAi/ULOqwXfbQ9tpHZDE9ibaq234Cxzb54Hmg5zzHId DXVQ== X-Gm-Message-State: AGRZ1gJpN13yp17ciJYwV2R4wD14oQDq+t44VE+yRezYOnBGK9+D4uYw gEM2ntldIRXiAZWzlAq3OJrlng== X-Google-Smtp-Source: AJdET5dNw5dl4KoW1C3gIRAymO5X3IH4UK1BUJscMzsym9F+sRJkSiHYwKcLxq0iCeAQ8NRIcQ6Sqw== X-Received: by 2002:a17:902:47:: with SMTP id 65-v6mr545840pla.112.1540937502633; Tue, 30 Oct 2018 15:11:42 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:1:c8e0:70d7:4be7:a36]) by smtp.gmail.com with ESMTPSA id b11-v6sm12844491pgi.10.2018.10.30.15.11.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Oct 2018 15:11:41 -0700 (PDT) From: Douglas Anderson To: Greg Kroah-Hartman , Jiri Slaby Subject: [PATCH v2 1/5] serial: qcom_geni_serial: Finish supporting sysrq Date: Tue, 30 Oct 2018 15:11:03 -0700 Message-Id: <20181030221107.79758-2-dianders@chromium.org> X-Mailer: git-send-email 2.19.1.568.g152ad8e336-goog In-Reply-To: <20181030221107.79758-1-dianders@chromium.org> References: <20181030221107.79758-1-dianders@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181030_151152_561577_5FF8113B X-CRM114-Status: GOOD ( 12.59 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dan.carpenter@oracle.com, vigneshr@ti.com, linux-aspeed@lists.ozlabs.org, andrew@aj.id.au, linux-arm-msm@vger.kernel.org, Douglas Anderson , tony@atomide.com, joel@jms.id.au, linux-serial@vger.kernel.org, andriy.shevchenko@linux.intel.com, linux-arm-kernel@lists.infradead.org, jk@ozlabs.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The geni serial driver already had some sysrq code in it, but since SUPPORT_SYSRQ wasn't defined the code didn't do anything useful. Let's make it useful by adding that define using the same formula found in other serial drivers. In order to prevent deadlock, we'll take a page from the 'msm_serial.c' where the spinlock is released around uart_handle_sysrq_char(). This seemed better than copying from '8250_port.c' where we skip locking in the console_write function since the '8250_port.c' method can cause lockdep warnings when dropping into kgdb. Signed-off-by: Douglas Anderson --- drivers/tty/serial/qcom_geni_serial.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 1515074e18fb..b83e3554bced 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -1,6 +1,10 @@ // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2017-2018, The Linux foundation. All rights reserved. +#if defined(CONFIG_SERIAL_QCOM_GENI_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) +# define SUPPORT_SYSRQ +#endif + #include #include #include @@ -495,7 +499,10 @@ static int handle_rx_console(struct uart_port *uport, u32 bytes, bool drop) continue; } + spin_unlock(&uport->lock); sysrq = uart_handle_sysrq_char(uport, buf[c]); + spin_lock(&uport->lock); + if (!sysrq) tty_insert_flip_char(tport, buf[c], TTY_NORMAL); }