From patchwork Sat Nov 26 21:36:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 13056583 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE08CC4167B for ; Sat, 26 Nov 2022 21:36:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229495AbiKZVgd (ORCPT ); Sat, 26 Nov 2022 16:36:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229453AbiKZVgb (ORCPT ); Sat, 26 Nov 2022 16:36:31 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A335140E3 for ; Sat, 26 Nov 2022 13:36:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1669498588; bh=jrPp0gIJ2x+WB0WgiAjQUuQ2jToHP3y/7vYHioJTKlA=; h=X-UI-Sender-Class:From:To:Subject:Date; b=B/yz9DZVGtgL6zgKCePvY9DfyRPHigUkUNJL/WIZOFtS1ZWjyXs3zzgB12VHZg2pn opnNO6mmmX7oPcFDcQ1eo6j5937lfu1jSsQzrhfaT72zQBx1b0GHyf663qSeTCBjGx cNR7lzABmhQLprrfomii/6Q6Tw7OnHpXZKLl9kwJw4lTWTjjUVTH89e3cQkrg9Gd3Q DxdUctOHW4llJkfefy6N5CCu/9+watAefCRjgGv95bnKzKGYIDPJ5qIEWkcCAKoElG Q9r9SPwaJu+upkuGpP93izeQJdF3wmkaPckHdDoqN5COtP+h3eP7GmWX3jwD3kbF0H tFNtDUyAU9WaA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from p100.fritz.box ([92.116.155.181]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1Mof5H-1ofRcD1o41-00p1TH for ; Sat, 26 Nov 2022 22:36:28 +0100 From: Helge Deller To: linux-parisc@vger.kernel.org Subject: [PATCH 1/4] parisc: Fix locking in pdc_iodc_print() firmware call Date: Sat, 26 Nov 2022 22:36:18 +0100 Message-Id: <20221126213621.363838-1-deller@gmx.de> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-Provags-ID: V03:K1:dI9tissJqtjT4vbcVphXoQEIbEv1sczxmmkp67QajDW+W9Xi1VF Fta01FFvbnp027MEINhPRURjzyC8McAMFmPN2+zJD4u/P4hGtfCzJOG9mlIElFxUZ5yG39U cmKgiZ4zfH35UU1RPLCAi8jfYi/luTT5Bk2HMbmz90jfeFURo1GzkUXx29MsAvMtnteOHdQ kaUVaxMnHP1cCcKFikQbQ== UI-OutboundReport: notjunk:1;M01:P0:k7RbQ66cxu8=;fuOEJaPwHqbgOVYwWtpC8QB3fID 7PHHKipm43YV0eJZmIt6UQmMdYARflsOP+B+0Zqq/5FgWm6lbtctVu+1btVgY7cWX/qqKOdtL fZKGrZUXRBrS/DZ18r7ZX0cRrpIUdQJbk2zvLP7m+fMXjrx9kY14QxjYG+xlx67zZaDqcRBES Z8V5VxezG1AuYJtB7iKIlpmwzARKe6vLGXODaAkSY94QcqIWAsbmB97+qYpriRqtNmvIcrcIN ETsM8Oy2NPFPj9KgYQH1/aJFWgNScXcfP7E86J7ohr0WGvE7cTXF2TejNwaEvJAtQc1GcTzE+ BEqQnkfrQuRCtBv45xJVB1ObIEPnbTlTRP9Pwa/SnX02V4RqP5N8a90gwrzLtWJeHfAYrqwTu kKgpZxodGibsqEfTKX4mnhCcXnQH4ZM2uDB/MwSk+CFoqKSKzSUzl5Z7GHCal83aKl8/HBO7l 091UUyAY8xGFoYozOdnf5chJBZZMEAz2KLK1uf0Tyx9Nt9Z6kMWicm+9Fph2qEXrJbfGP9hYK jaP5StX1qs2Q3fvcytVkG3WG69mS//cz5D2P0WYfefAR8n+5qb9LV1PCkORlDNuVl7Z1SxgoN nCAFiu+iRqG1BIMUxUC4OBNzyVzJrA8JaAYm/8T0Hp8Ki2h+RQvZNSr2eAjp74XboOnu9hWrJ BLq53cfOICDYLJgOS31yWD1UluDS5goreXXGkZTz5TsL+fFGIGp71T9VAAFLX7dTdlSBwsePW oXOTffg3jhmaPaqiMeD45DVsVJNn7p0gWCVe2TemoRUIBxKqP1pv8F71N7lFPv/E0GMWtWKke LjFV/zV4ei5R2Jn0IRMq+X0vnrB5pf4BkfW2iFBSuLA03Zg0C9F+z9xSieOvX2DfJwkykMyeo c4wRYD0WMHmgJsduV/MkySNNmyovrO24lg4xmUK/X7NbHjumly5PBkK7xBOIWlGYncV8faQCw 74ro1jkA3ctj+h6ozqUJ8DrkRrI= Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org Utilize pdc_lock spinlock to protect parallel modifications of the iodc_dbuf[] buffer, check length to prevent buffer overflow of iodc_dbuf[], drop the iodc_retbuf[] buffer and fix some wrong indentings. Signed-off-by: Helge Deller --- arch/parisc/kernel/firmware.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) -- 2.38.1 diff --git a/arch/parisc/kernel/firmware.c b/arch/parisc/kernel/firmware.c index 6a7e315bcc2e..c19506fc4e4e 100644 --- a/arch/parisc/kernel/firmware.c +++ b/arch/parisc/kernel/firmware.c @@ -1288,9 +1288,8 @@ void pdc_io_reset_devices(void) #endif /* defined(BOOTLOADER) */ -/* locked by pdc_console_lock */ -static int __attribute__((aligned(8))) iodc_retbuf[32]; -static char __attribute__((aligned(64))) iodc_dbuf[4096]; +/* locked by pdc_lock */ +char iodc_dbuf[2*4096] __page_aligned_bss; /** * pdc_iodc_print - Console print using IODC. @@ -1307,6 +1306,9 @@ int pdc_iodc_print(const unsigned char *str, unsigned count) unsigned int i; unsigned long flags; + count = min(count, sizeof(iodc_dbuf)); + + spin_lock_irqsave(&pdc_lock, flags); for (i = 0; i < count;) { switch(str[i]) { case '\n': @@ -1322,12 +1324,11 @@ int pdc_iodc_print(const unsigned char *str, unsigned count) } print: - spin_lock_irqsave(&pdc_lock, flags); - real32_call(PAGE0->mem_cons.iodc_io, - (unsigned long)PAGE0->mem_cons.hpa, ENTRY_IO_COUT, - PAGE0->mem_cons.spa, __pa(PAGE0->mem_cons.dp.layers), - __pa(iodc_retbuf), 0, __pa(iodc_dbuf), i, 0); - spin_unlock_irqrestore(&pdc_lock, flags); + real32_call(PAGE0->mem_cons.iodc_io, + (unsigned long)PAGE0->mem_cons.hpa, ENTRY_IO_COUT, + PAGE0->mem_cons.spa, __pa(PAGE0->mem_cons.dp.layers), + __pa(pdc_result), 0, __pa(iodc_dbuf), i, 0); + spin_unlock_irqrestore(&pdc_lock, flags); return i; } @@ -1354,10 +1355,10 @@ int pdc_iodc_getc(void) real32_call(PAGE0->mem_kbd.iodc_io, (unsigned long)PAGE0->mem_kbd.hpa, ENTRY_IO_CIN, PAGE0->mem_kbd.spa, __pa(PAGE0->mem_kbd.dp.layers), - __pa(iodc_retbuf), 0, __pa(iodc_dbuf), 1, 0); + __pa(pdc_result), 0, __pa(iodc_dbuf), 1, 0); ch = *iodc_dbuf; - status = *iodc_retbuf; + status = *pdc_result; spin_unlock_irqrestore(&pdc_lock, flags); if (status == 0) From patchwork Sat Nov 26 21:36:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 13056584 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCAF0C43217 for ; Sat, 26 Nov 2022 21:36:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229502AbiKZVgc (ORCPT ); Sat, 26 Nov 2022 16:36:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229495AbiKZVgb (ORCPT ); Sat, 26 Nov 2022 16:36:31 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4179815A31 for ; Sat, 26 Nov 2022 13:36:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1669498588; bh=8Pqz5GZcASWHUgvyzpvmBnO9u2bFvDs+KHbSHJPd0Gs=; h=X-UI-Sender-Class:From:To:Subject:Date:In-Reply-To:References; b=hmgho+D6BICPkViER7x8f2oh+KG3+9PV74Xamf8bWqoiry522/q1SsAdexffIw2S0 FhaCmTcLGJsRHhQXUg4g613IRrU4vRp9F+kyT/I1t6zGB9m9MuHOrC2PKwvwfSCuXI 9GRJU2EQ+O4hpLuFv04nu/eHrdCF14Zoc3CPFgb8rePIT1/gJ0jVSktXzU6xQcY7t3 +On5ZpsEoXElul9atCWCsvrPF0eMsQa3U/IWpRoL5f07RZQ0ayZMVJEjIovj1EVNA3 82T3ODE9RezFXv0AIdFEwbNA2OG/ln+5aSNpa2aYuEotUXVqpRsHIFpkWNnvLC6Nbq 7qvbQqNxLhi6Q== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from p100.fritz.box ([92.116.155.181]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MHGCo-1pCIOa284e-00DCcE for ; Sat, 26 Nov 2022 22:36:28 +0100 From: Helge Deller To: linux-parisc@vger.kernel.org Subject: [PATCH 2/4] parisc: Merge hpmc_iodc_buf and iodc_dbuf buffers Date: Sat, 26 Nov 2022 22:36:19 +0100 Message-Id: <20221126213621.363838-2-deller@gmx.de> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221126213621.363838-1-deller@gmx.de> References: <20221126213621.363838-1-deller@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:bOp/mAqyyCf00Pe/LmW2+zJgAr44pBGeHgXmBmQo0qgUkvDk6TP zQYQRR7MuKlVE4noS6mOTaGBpKW8O93Yl6QfNhxnm6H6uyH6cYyUBofC50ZE/LLS6LLVncI Jb9Ctf96J7U6XG50K9UOVR4oSrHSps6brX/z/PH3sM+mwpJy/V21ls2/kl6oFJJRRWlxE6V OOr4QTdqpp0Bm2eunyOKQ== UI-OutboundReport: notjunk:1;M01:P0:IdDRobh6pgA=;gZaWQx+LMhlNlOFhg97gLpEqkXx pYrfC0muUN+hruMwlwxF6pwxz1KTGu8dfInNRtp945C2Z/QM1V1DKV3nJRM7RbzSYbpQK0WnH RDVmPXFf3C4mfFO/OEr3EjGbNwFS3AFP7vy1wiysgmgdHoITFpuNqjsv6bOybL/IMOvfXlwWM Mt7b/2KDack+A3oWTGMToiheZqC6LSaDTqA4ZSPA1Xh5sbwTeGdop37xEEGU/jTf7j0tPZUpm 19IVzzCNdkoyP+PM3viGC7lnprv2MEtSRIBN5lUwMhiF8EYAh2Hqx8js4B9T7nP9BHXWKW5RQ 60PNpGPvys5JfuQndcqqu/C9LF1f5b2unguPHw9fv0qQ2P8RFzKbmp+Lhm191c4eMFcDJj85H 2QyVjIQ332jP7sWzSxMdX0xXHT5ES9oAuZNXJnZGqzuQapzpdyx84pT4vqk3ww9ioymaIE7l6 aj/PWCtLC6+kwdT4yHYURh8BMSIAsyVKCFKknWro+HYFQokajat98lyj79nyTLCJE9RTq2tbG CzNu5wZvyFmZraxNG7c0U2yrUcMRuijvW8Ta4ytP5G7rTfI1IBX1DNFHuuGGovhgt4tmUL/a6 fv83xEkWUjvADH0pwu8jDIs/nG1CwYzglZyb6M13pFMinbmQio4zEdBXoaZ++2U/U050z2jEB AMJrhDExNq7AN74AVIfXXbY7zp+LfIuGFsXJ8xclVw4+FZtWS5FE8KtzRIfN/IVV5qAoR1Zyy t5l5HPyRFNZ2/ha63apsbAp/gwLY0CkFQuOxI5ombAlz1IxuQf9FBlGHDHuEp83WAapKOtNLX neCtR0fj/y6HghvQ46H9YmvViW77k7zk8ogZK6ICPh/i4iRrum71KZ3KMN9nSRLWx4eK9wwd3 EpMwu6NFSjbES4Uer/P1SKCFzxHxU5px6vJTcrBsIZ6H6kvs8n/ZUuLqFpdN2iP3Z/HEaSyBP Os2qJSeEQ6uHP49KFNFWjK6PeVI= Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org The HPMC handler can share the IODC buffer with the various firmware calls. Signed-off-by: Helge Deller --- arch/parisc/kernel/hpmc.S | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) -- 2.38.1 diff --git a/arch/parisc/kernel/hpmc.S b/arch/parisc/kernel/hpmc.S index eb2e4bd67035..1dc85e963a17 100644 --- a/arch/parisc/kernel/hpmc.S +++ b/arch/parisc/kernel/hpmc.S @@ -44,15 +44,11 @@ */ .import toc_stack,data + .import iodc_dbuf,data #define hpmc_stack toc_stack /* re-use the TOC stack */ - +#define hpmc_iodc_buf iodc_dbuf /* re-use IODC buffer from firmware.c */ #define HPMC_IODC_BUF_SIZE 0x8000 - __PAGE_ALIGNED_BSS - .align 4096 -hpmc_iodc_buf: - .block HPMC_IODC_BUF_SIZE - .section .bss .align 8 hpmc_raddr: From patchwork Sat Nov 26 21:36:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 13056586 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9727FC47088 for ; Sat, 26 Nov 2022 21:36:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229453AbiKZVgd (ORCPT ); Sat, 26 Nov 2022 16:36:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229500AbiKZVgc (ORCPT ); Sat, 26 Nov 2022 16:36:32 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F7B015A35 for ; Sat, 26 Nov 2022 13:36:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1669498588; bh=qBosl0qnGdS7MiRdl5lH9+kvm6szht8PS1NyKeQS9LI=; h=X-UI-Sender-Class:From:To:Subject:Date:In-Reply-To:References; b=ixvZ6ing2TBelQIYhGiiOPe97DH2ast3aJporCESIIb+AT/bhQMxv4ficj4B96vBv Y5zMi4HkjA/FAqm18yvfWboNU5RleQmQY003pH8x7jpcEJlhQG1r2+bUj4Sn+Qjj/k NuMKHcdo58m5W1Po9buA3R06wt9fifwPZRFChbXVYxuibOIr9CYuRaeUappneOAVds qxcKKPmHpAQ9WkItDPmdUJz4d6Pof2C1oHLD6nj9edFtN9lSX8aMusrHLvT0C7jYpV R15JeMPNGNyWfJ6n8EofNzMD+aXjPQA0o9MJuFJl4AsQWdjTbPHt+ZSrtj6EqFYSH6 eowL9X6dCOy5g== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from p100.fritz.box ([92.116.155.181]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1Mqs0R-1odEh32S5R-00moY7 for ; Sat, 26 Nov 2022 22:36:28 +0100 From: Helge Deller To: linux-parisc@vger.kernel.org Subject: [PATCH 3/4] parisc: Drop duplicate kgdb_pdc console in pdc_cons.c Date: Sat, 26 Nov 2022 22:36:20 +0100 Message-Id: <20221126213621.363838-3-deller@gmx.de> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221126213621.363838-1-deller@gmx.de> References: <20221126213621.363838-1-deller@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:wpeq5+fuuutHRRW/xpY/jBIaXOW8x62jJz/Qgyygyk9bvYe7eW7 C5DBaKVHc7wWFlhZXC80kA2fM5CXMlTM2iBe+qNRzWTCYT6JnuQjnpv8ZnqvEgJq/ZZtnn6 P26J0rgaHbPCrMJiLbQefWtfdNEPerNOrehRrLOyB7pOzN80AqXOT88V698RB+/0hPKOETA XoSdnCAbODsETsgf5dV/A== UI-OutboundReport: notjunk:1;M01:P0:tkntjkuTdV0=;xXbqgoxymyh/pQoxqObD7+tV/0a H6FiGiHpKiRq0fNY83TCErNsr5UDvnuGLj6tm8dQLw8A42+KYYNgkT7897ORwFsv7omri5UTv fasgVrMMj8+DXNFyBSco+5ET6RkHqjNa4wq2+bQahDPJ5ipOOirb8ywTUl+dSueSdyV2hFicG fWcnGoYmyAXA7Sc1GR+oC/pBnnPsj+z0LaYTJ0eyGsVBbkhbBLvDS7GOkUXs19bWihZ/hqVud 5ExxYdkvxwtG547GFWeNF58vC+eqE7F9Id7aHt/zDKa9DQlpA0J2FWWo+1zabrWkA3C9Zf8d5 8cmIAln2kqfQXIVOjbQ+uZwzrIgY/gpHPdU1CRh21nOaKpdGGziCWcuSnIUpWgIm7lQLTIKCz BVacymuN3kxakBhXsxefYLzZ60mKez/10MRZZ4/epswFrmPDUSUtDNcymYwOcRmNEJueyZH4G XgNXO3/lLq1y47cRjAHbA3yxX/IFtv7cPvPFIwfpUeNMha+26X2Y+OwGRTTQ4S3wHg/XPgu40 DX5xiVCyaoYJ5b00IAYq5+laK7NrxRX+IAGR6e5NRMDJyJVs6L3wDAcZDLVuVswXpEBf9QCde M54LD8JO85JJmSOXrYap6rmQHZ5lX6HqNSMvGX/g19s6IJquy5dppq2FL4cb92d5KCxGNrhLC 4KSvNndZe3eVAJ+mCbtiNYGrE78R631STgKfECAJG/ka9TRF+wQleldwlcP0MT5k0pr8JXRbk bSmVER1X/AK0PC7oxBZmfHnkoFSbBlRJTUKlok0ursG6CUUjInUMKALNB1MO+rVoENsGvtpAq pdX4P+SfYrFRBnCwmB+zok4JaaUaisKxICrvLTQz2uxg4yCUXmp+pc/7zWibvOJmVKy7OKqrp E1r9BO2XoJ0n4xlXHc3y8pRWPg6P5+rTpBbYObmcsgo5ZTYNpTNJW/2i4W7QIBCsOy4ZuVrrj f5XsUQ== Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org The kgdb console is already registered in kgdb.c, so the duplicate code can be dropped. Signed-off-by: Helge Deller --- arch/parisc/kernel/pdc_cons.c | 36 ----------------------------------- 1 file changed, 36 deletions(-) -- 2.38.1 diff --git a/arch/parisc/kernel/pdc_cons.c b/arch/parisc/kernel/pdc_cons.c index 7d0989f523d0..eebfc3e3d94c 100644 --- a/arch/parisc/kernel/pdc_cons.c +++ b/arch/parisc/kernel/pdc_cons.c @@ -8,50 +8,18 @@ #include #include #include -#include #include /* for PAGE0 */ #include /* for iodc_call() proto and friends */ -static DEFINE_SPINLOCK(pdc_console_lock); - static void pdc_console_write(struct console *co, const char *s, unsigned count) { int i = 0; - unsigned long flags; - spin_lock_irqsave(&pdc_console_lock, flags); do { i += pdc_iodc_print(s + i, count - i); } while (i < count); - spin_unlock_irqrestore(&pdc_console_lock, flags); -} - -#ifdef CONFIG_KGDB -static int kgdb_pdc_read_char(void) -{ - int c; - unsigned long flags; - - spin_lock_irqsave(&pdc_console_lock, flags); - c = pdc_iodc_getc(); - spin_unlock_irqrestore(&pdc_console_lock, flags); - - return (c <= 0) ? NO_POLL_CHAR : c; } -static void kgdb_pdc_write_char(u8 chr) -{ - if (PAGE0->mem_cons.cl_class != CL_DUPLEX) - pdc_console_write(NULL, &chr, 1); -} - -static struct kgdb_io kgdb_pdc_io_ops = { - .name = "kgdb_pdc", - .read_char = kgdb_pdc_read_char, - .write_char = kgdb_pdc_write_char, -}; -#endif - static int __init pdc_earlycon_setup(struct earlycon_device *device, const char *opt) { @@ -65,10 +33,6 @@ static int __init pdc_earlycon_setup(struct earlycon_device *device, earlycon_console->write = pdc_console_write; device->port.iotype = UPIO_MEM32BE; -#ifdef CONFIG_KGDB - kgdb_register_io_module(&kgdb_pdc_io_ops); -#endif - return 0; } From patchwork Sat Nov 26 21:36:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 13056585 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3510C46467 for ; Sat, 26 Nov 2022 21:36:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229500AbiKZVge (ORCPT ); Sat, 26 Nov 2022 16:36:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229496AbiKZVgc (ORCPT ); Sat, 26 Nov 2022 16:36:32 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A9E815A3B for ; Sat, 26 Nov 2022 13:36:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1669498588; bh=ID/MTKP3PPqJPgKAHGtKRaXgMrF1EMooZyza4l+OCrw=; h=X-UI-Sender-Class:From:To:Subject:Date:In-Reply-To:References; b=H58Xw/giHhTXE5Fr0ZDLKX/rmwNCRiU/mNIOtkg/bX+ZI842o8t9XhNiPoIv2bIv+ lQecWIpsh8YBTXiGF09jemcTYkelPt0psBNSB9h8KMIzR1AwsBfQg9s5gxAPPW+bZn aKq113eJbm2mKsF6GuAAfTBYMocgWqQTOnupYH1e7lOOSnaYN76iKG/C3oK9OUrh7T 7pikLl3YhuK04ESf6LQLLUnq9NdX+Zk5uoKko+OlT8en9OrbKbcXMNOCOPKG4f+4Qd Spcpm3s5WhzC9Jqv2Pa1jOlTwFUwazByFth16YASOcgitzQJmc5mb8FrnlFbl1cs2M suri8p+pllI2A== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from p100.fritz.box ([92.116.155.181]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MwQT9-1oikRt2mTF-00sQkZ for ; Sat, 26 Nov 2022 22:36:28 +0100 From: Helge Deller To: linux-parisc@vger.kernel.org Subject: [PATCH 4/4] parisc: Fix kgdb_pdc console read/write funtions Date: Sat, 26 Nov 2022 22:36:21 +0100 Message-Id: <20221126213621.363838-4-deller@gmx.de> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221126213621.363838-1-deller@gmx.de> References: <20221126213621.363838-1-deller@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:JWVzsGw3mJKorsI80wU6yxHNIFvhSK/A0zTViH0C7KesI811jAS zrzicGHxNUqQza5ObTjzVZAL8FQxCVpNsZek/DYQswH1jxxA53McyoHCnk8A/jG5mlQrpuU WTGt5NHWs1E7/+XizfKp7dtHTKftjCIbdTE00Dw/E8qH/lxHYQkJB41f0geVwvkbQvpXVRc csdxLLDEXRbF5kJsJvAzA== UI-OutboundReport: notjunk:1;M01:P0:MP4aYXSajH8=;Yr0wC/dNoK4Wf7rCpZoigXMKThf uqlqpUnOluc4rhpa6polKI+qoNq8YsD4b7C8C17lgcDifNMHZE5jn8dtZUBqG6vem/4yu8hxJ 5yQFXmGFsUk8Lx9pElRH/6Cu5wnqy17xZqZM9hW9t5P8PzZ9lTsBGT1QffqDIx96UKSE5wOzu 6LFPZGyXrresJWDzPW//AoAeiJu0iuIu/LtrIlMayM87CX+kvIlAatY4IEraYG0MtxMjw5myA bDGVI1sb9pY4EJtUdC8RYLicz13U0UzhZf0gb9gH/cCS5zxmvqFQmcxeWvEsscSVsmX/lItPY Ftc1MIiSyU4ilEtDyCNky7TMlyAoBO0j5y9iabxbgryeTSNMFVus71rA7rsfFkLt5GeqiLJWr xxeBFuHvXoxfcKPFUwIEy7CvAt4C44DQ+E59ZlDIElXCE/2X2ICYL+lonZ+USCl0okSibtiot nISzQEwMXENQ6gaMCw4SfJSUifNCP6A1gvUzvOADssXB+1Z1bddpXarr7k5FpwZbzznwr+En8 BSKqWcCYLvpAjTP0jp1cpSUUAzvCZe8y7q5ZvcGl2VgtA7Bte8nvn12SF6TKleJH2tW0/5Jpf XmmcE2EaVaOCpdKtRA361fTYllT+n3+2QhOHyo1lsM+M6GHgTxx/C7hpSk4oeXDHxEjejbpds 9wb5GAhEbcE8v75Uc/bscS7hODNEecbE152S/bl8Ca1l9QfMnEha7SE2FrHHM1q/bqmNIxvUc Ub7LfetmKpcT24qdCloJ/zU1FeDBW9hNGMKYGh+PVy3dRxvujKzLjLKHQfle/zXCAumWeUpJV wgjyuMZJmF/Q8F4DjB9A0oVAmmm2lLh+vt+AZ1VvDCM8SV5V0U+T8a0CsEZ4jiIejhzuq1QjC i8CfDAcKnzS1DrGcg2HY8rQz0PNztL2oeOq0H1ItvwkAqdGEExMAJQHQRP8WRZ3aIQYYEqvW2 bQWbYBZCAmRPCELbREJjWnkW8Z4= Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org Allow the kgdb debugger to read chars from PDC firmware console (keyboard or serial port), and fix output to only show up on monitors since the output to serial ports is already happens in the kgdb serial driver. Signed-off-by: Helge Deller --- arch/parisc/kernel/kgdb.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) -- 2.38.1 diff --git a/arch/parisc/kernel/kgdb.c b/arch/parisc/kernel/kgdb.c index ab7620f695be..586046d52712 100644 --- a/arch/parisc/kernel/kgdb.c +++ b/arch/parisc/kernel/kgdb.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -211,14 +212,22 @@ int kgdb_arch_handle_exception(int trap, int signo, /* KGDB console driver which uses PDC to read chars from keyboard */ +static int kgdb_pdc_read_char(void) +{ + int c = pdc_iodc_getc(); + + return (c <= 0) ? NO_POLL_CHAR : c; +} + static void kgdb_pdc_write_char(u8 chr) { - /* no need to print char. kgdb will do it. */ + if (PAGE0->mem_cons.cl_class != CL_DUPLEX) + pdc_iodc_print(&chr, 1); } static struct kgdb_io kgdb_pdc_io_ops = { .name = "kgdb_pdc", - .read_char = pdc_iodc_getc, + .read_char = kgdb_pdc_read_char, .write_char = kgdb_pdc_write_char, };