Message ID | 20231205073255.20562-5-tony@atomide.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp3266243vqy; Mon, 4 Dec 2023 23:36:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IG0MibP/MSDHtM79rTnqR0mA5MVVu4STNBAr2wF0k4y1M5IKJFdrZRtBkUJAoH/09I4U6aD X-Received: by 2002:a05:6a20:2214:b0:181:15:5755 with SMTP id u20-20020a056a20221400b0018100155755mr5057973pzb.56.1701761780485; Mon, 04 Dec 2023 23:36:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701761780; cv=none; d=google.com; s=arc-20160816; b=PAKHxEYtAnqblM8qLz7m7o3ZAj4XeOtfE+wCgLqCeQZJnB+UYFagaLuFj2poh/ubXQ Z6xf+vdp/Hjz3kXNYYl6Uldw7WlNabCtpVu5mIYTO+5vp/oBdFlKd3gAMNmteuWJrJKU WCP9blhsMhvhL/ZLhB6Ub2waSeNzmkBU/vRyEMbm5b5eSj1pkfQu92bf6N/xWgBWGSUU mUjRnq36JhpggIRqSsUsaz7OrP8PYRL56Ef25sFfkR+29eLJFYRsmazujAPpCI3JgHQ3 QbLaFvG35/o9pORsA1g5T3o/32GaozaJesj7S65OBiNq4/JrQlyNYgaX5B3UTseJiGhX Q0rA== 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=54xGuup/UmdGELeRKFDlzpZM5tgkUbP0ZgeeXRy3GBc=; fh=OQrZIrddo55Tm+afxTOsnGwFgD38y2NNd7tU+1OGSCE=; b=VNdIBWfltTU+2B3u4odBIScG0piTd87rUoQ2IO/wgyW0Q9S7s5DG+cIEO+3UXIXcqr PpzpElfouutZaSrtSNxltmO1Kv/v5EU7ziVV417GMppHAWQ7im4uMAdME05cVnZctIpV sLNkQphWRG9P4P7FusxFo7etONC3SMaPkryqMXPb4Z0j4eXPRpEyr2usUZsCC/5//960 CjxsPa/HbVAgDS57KQA8S5mMF59YQVlnrsHRSmjZm4sMQQvfC1CVjDnVVTUPuGxuKQhm Kya2Y27uFyAiWVgUyjTYczR4XDCSAkWqJYyqhiUai+/uk2bWHKtzoSVCgOdgnDY0SCDr flag== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@atomide.com header.s=25mailst header.b=dfOVSwKV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id ca23-20020a056a02069700b00578b487825asi4405374pgb.208.2023.12.04.23.36.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 23:36:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=fail header.i=@atomide.com header.s=25mailst header.b=dfOVSwKV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id BD4F280A281E; Mon, 4 Dec 2023 23:36:14 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344587AbjLEHgG (ORCPT <rfc822;chrisfriedt@gmail.com> + 99 others); Tue, 5 Dec 2023 02:36:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229615AbjLEHgE (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 5 Dec 2023 02:36:04 -0500 Received: from mail5.25mail.st (mail5.25mail.st [74.50.62.9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53094C9; Mon, 4 Dec 2023 23:36:11 -0800 (PST) Received: from localhost (91-158-86-216.elisa-laajakaista.fi [91.158.86.216]) by mail5.25mail.st (Postfix) with ESMTPSA id C124C60354; Tue, 5 Dec 2023 07:35:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=atomide.com; s=25mailst; t=1701761770; bh=fXSH3oMsVEjAG6Eqr9C167WFqrDgpOZtF9UGQTqSwU4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dfOVSwKV+A03I7NcIu++5eksbifygpC+AGE8AH7L/hcrmxSYUyUxqCRGQzrZuG+D9 yMWaHvnJDLDgzb+9gZbeorWy2I7T1+gHnUPr4oPy6AwZ2mJFK3U6fOFkTdhv+useMZ TIk4XA+NoO80oiaqyj59Qs6WnpiuB31TWWC+vRM+UXzgzHrfbsOisucKxIrHfQZ1T7 crXax9KkFI5IiZ/EfRYbp046VCSnvRjO+ptPcjgypTSynnohWD2AfFSyrCysJZd7b9 zpqMDOffXNue7nlh907Tedjh4LYVNPEyi6ifksOhUC0qGyUHBF8Da3Bpp4xqF3q8uk hxCt+oSeruevg== From: Tony Lindgren <tony@atomide.com> To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Jiri Slaby <jirislaby@kernel.org>, Petr Mladek <pmladek@suse.com>, Steven Rostedt <rostedt@goodmis.org>, John Ogness <john.ogness@linutronix.de>, Sergey Senozhatsky <senozhatsky@chromium.org> Cc: "David S . Miller" <davem@davemloft.net>, Andy Shevchenko <andriy.shevchenko@intel.com>, Dhruva Gole <d-gole@ti.com>, =?utf-8?q?Ilpo_J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com>, Johan Hovold <johan@kernel.org>, Sebastian Andrzej Siewior <bigeasy@linutronix.de>, Vignesh Raghavendra <vigneshr@ti.com>, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH v4 4/4] serial: 8250: Add preferred console in serial8250_isa_init_ports() Date: Tue, 5 Dec 2023 09:32:36 +0200 Message-ID: <20231205073255.20562-5-tony@atomide.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231205073255.20562-1-tony@atomide.com> References: <20231205073255.20562-1-tony@atomide.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 04 Dec 2023 23:36:15 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784426560955673919 X-GMAIL-MSGID: 1784426560955673919 |
Series |
Add support for DEVNAME:0.0 style hardware based addressing
|
|
Commit Message
Tony Lindgren
Dec. 5, 2023, 7:32 a.m. UTC
Prepare 8250 isa ports to drop kernel command line serial console
handling from console_setup().
We need to set the preferred console in serial8250_isa_init_ports().
Otherwise the console gets initialized only later on when the hardware
specific driver takes over, and console_setup() is no longer handling
the ttyS related quirks.
Note that this mostly affects x86 as this happens based on define
SERIAL_PORT_DFNS.
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
drivers/tty/serial/8250/8250_core.c | 32 +++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
Comments
On Tue, Dec 05, 2023 at 09:32:36AM +0200, Tony Lindgren wrote: > Prepare 8250 isa ports to drop kernel command line serial console ISA > handling from console_setup(). > > We need to set the preferred console in serial8250_isa_init_ports(). > Otherwise the console gets initialized only later on when the hardware > specific driver takes over, and console_setup() is no longer handling > the ttyS related quirks. > > Note that this mostly affects x86 as this happens based on define > SERIAL_PORT_DFNS. ... > +static void __init serial8250_isa_init_preferred_console(int idx) > +{ > + const char *name __free(kfree); > + int ret; > + > + name = kasprintf(GFP_KERNEL, "%s%i", serial8250_reg.dev_name, idx); No error check? > + ret = add_preferred_console_match(name, serial8250_reg.dev_name, idx); > + if (!ret || ret == -ENOENT) > + return; ret = serial_base_add_one_prefcon(...); ? > + pr_err("Could not add preferred console for %s idx %i\n", > + serial8250_reg.dev_name, idx); > +}
On Tue, Dec 05, 2023 at 06:08:37PM +0200, Andy Shevchenko wrote: > On Tue, Dec 05, 2023 at 09:32:36AM +0200, Tony Lindgren wrote: ... > > + pr_err("Could not add preferred console for %s idx %i\n", > > + serial8250_reg.dev_name, idx); And, btw, you can simply reuse name here pr_err("Could not add preferred console for %s\n", name); Would it work?
Hi Tony, kernel test robot noticed the following build errors: [auto build test ERROR on tty/tty-testing] [also build test ERROR on tty/tty-next tty/tty-linus usb/usb-testing usb/usb-next usb/usb-linus linus/master v6.7-rc4 next-20231205] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Tony-Lindgren/printk-Save-console-options-for-add_preferred_console_match/20231205-153731 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing patch link: https://lore.kernel.org/r/20231205073255.20562-5-tony%40atomide.com patch subject: [PATCH v4 4/4] serial: 8250: Add preferred console in serial8250_isa_init_ports() config: powerpc-randconfig-r081-20231205 (https://download.01.org/0day-ci/archive/20231206/202312060101.o6nb55MI-lkp@intel.com/config) compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231206/202312060101.o6nb55MI-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202312060101.o6nb55MI-lkp@intel.com/ All errors (new ones prefixed by >>): >> drivers/tty/serial/8250/8250_core.c:597:42: error: too few arguments to function call, expected 2, have 1 597 | serial8250_isa_init_preferred_console(i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ drivers/tty/serial/8250/8250_core.c:543:20: note: 'serial8250_isa_init_preferred_console' declared here 543 | static inline void serial8250_isa_init_preferred_console(struct uart_port *port, | ^ 1 error generated. vim +597 drivers/tty/serial/8250/8250_core.c 549 550 static void __init serial8250_isa_init_ports(void) 551 { 552 struct uart_8250_port *up; 553 static int first = 1; 554 int i, irqflag = 0; 555 556 if (!first) 557 return; 558 first = 0; 559 560 if (nr_uarts > UART_NR) 561 nr_uarts = UART_NR; 562 563 /* 564 * Set up initial isa ports based on nr_uart module param, or else 565 * default to CONFIG_SERIAL_8250_RUNTIME_UARTS. Note that we do not 566 * need to increase nr_uarts when setting up the initial isa ports. 567 */ 568 for (i = 0; i < nr_uarts; i++) 569 serial8250_setup_port(i); 570 571 /* chain base port ops to support Remote Supervisor Adapter */ 572 univ8250_port_ops = *base_ops; 573 univ8250_rsa_support(&univ8250_port_ops); 574 575 if (share_irqs) 576 irqflag = IRQF_SHARED; 577 578 for (i = 0, up = serial8250_ports; 579 i < ARRAY_SIZE(old_serial_port) && i < nr_uarts; 580 i++, up++) { 581 struct uart_port *port = &up->port; 582 583 port->iobase = old_serial_port[i].port; 584 port->irq = irq_canonicalize(old_serial_port[i].irq); 585 port->irqflags = 0; 586 port->uartclk = old_serial_port[i].baud_base * 16; 587 port->flags = old_serial_port[i].flags; 588 port->hub6 = 0; 589 port->membase = old_serial_port[i].iomem_base; 590 port->iotype = old_serial_port[i].io_type; 591 port->regshift = old_serial_port[i].iomem_reg_shift; 592 593 port->irqflags |= irqflag; 594 if (serial8250_isa_config != NULL) 595 serial8250_isa_config(i, &up->port, &up->capabilities); 596 > 597 serial8250_isa_init_preferred_console(i); 598 } 599 } 600
Hi Tony, kernel test robot noticed the following build errors: [auto build test ERROR on tty/tty-testing] [also build test ERROR on tty/tty-next tty/tty-linus usb/usb-testing usb/usb-next usb/usb-linus linus/master v6.7-rc4 next-20231205] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Tony-Lindgren/printk-Save-console-options-for-add_preferred_console_match/20231205-153731 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing patch link: https://lore.kernel.org/r/20231205073255.20562-5-tony%40atomide.com patch subject: [PATCH v4 4/4] serial: 8250: Add preferred console in serial8250_isa_init_ports() config: m68k-randconfig-r071-20231205 (https://download.01.org/0day-ci/archive/20231206/202312060232.s0uWr7z9-lkp@intel.com/config) compiler: m68k-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231206/202312060232.s0uWr7z9-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202312060232.s0uWr7z9-lkp@intel.com/ All error/warnings (new ones prefixed by >>): drivers/tty/serial/8250/8250_core.c: In function 'serial8250_isa_init_ports': >> drivers/tty/serial/8250/8250_core.c:597:55: warning: passing argument 1 of 'serial8250_isa_init_preferred_console' makes pointer from integer without a cast [-Wint-conversion] 597 | serial8250_isa_init_preferred_console(i); | ^ | | | int drivers/tty/serial/8250/8250_core.c:543:76: note: expected 'struct uart_port *' but argument is of type 'int' 543 | static inline void serial8250_isa_init_preferred_console(struct uart_port *port, | ~~~~~~~~~~~~~~~~~~^~~~ >> drivers/tty/serial/8250/8250_core.c:597:17: error: too few arguments to function 'serial8250_isa_init_preferred_console' 597 | serial8250_isa_init_preferred_console(i); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/tty/serial/8250/8250_core.c:543:20: note: declared here 543 | static inline void serial8250_isa_init_preferred_console(struct uart_port *port, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ vim +/serial8250_isa_init_preferred_console +597 drivers/tty/serial/8250/8250_core.c 549 550 static void __init serial8250_isa_init_ports(void) 551 { 552 struct uart_8250_port *up; 553 static int first = 1; 554 int i, irqflag = 0; 555 556 if (!first) 557 return; 558 first = 0; 559 560 if (nr_uarts > UART_NR) 561 nr_uarts = UART_NR; 562 563 /* 564 * Set up initial isa ports based on nr_uart module param, or else 565 * default to CONFIG_SERIAL_8250_RUNTIME_UARTS. Note that we do not 566 * need to increase nr_uarts when setting up the initial isa ports. 567 */ 568 for (i = 0; i < nr_uarts; i++) 569 serial8250_setup_port(i); 570 571 /* chain base port ops to support Remote Supervisor Adapter */ 572 univ8250_port_ops = *base_ops; 573 univ8250_rsa_support(&univ8250_port_ops); 574 575 if (share_irqs) 576 irqflag = IRQF_SHARED; 577 578 for (i = 0, up = serial8250_ports; 579 i < ARRAY_SIZE(old_serial_port) && i < nr_uarts; 580 i++, up++) { 581 struct uart_port *port = &up->port; 582 583 port->iobase = old_serial_port[i].port; 584 port->irq = irq_canonicalize(old_serial_port[i].irq); 585 port->irqflags = 0; 586 port->uartclk = old_serial_port[i].baud_base * 16; 587 port->flags = old_serial_port[i].flags; 588 port->hub6 = 0; 589 port->membase = old_serial_port[i].iomem_base; 590 port->iotype = old_serial_port[i].io_type; 591 port->regshift = old_serial_port[i].iomem_reg_shift; 592 593 port->irqflags |= irqflag; 594 if (serial8250_isa_config != NULL) 595 serial8250_isa_config(i, &up->port, &up->capabilities); 596 > 597 serial8250_isa_init_preferred_console(i); 598 } 599 } 600
* Andy Shevchenko <andriy.shevchenko@intel.com> [231205 16:08]: > On Tue, Dec 05, 2023 at 09:32:36AM +0200, Tony Lindgren wrote: > > + name = kasprintf(GFP_KERNEL, "%s%i", serial8250_reg.dev_name, idx); > > No error check? Oops > > + ret = add_preferred_console_match(name, serial8250_reg.dev_name, idx); > > + if (!ret || ret == -ENOENT) > > + return; > > ret = serial_base_add_one_prefcon(...); > > ? Yup that should work even before struct device. Will fix the other places too you noticed. Thanks, Tony
diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c @@ -15,6 +15,7 @@ */ #include <linux/acpi.h> +#include <linux/cleanup.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/ioport.h> @@ -517,6 +518,35 @@ static struct uart_8250_port *serial8250_setup_port(int index) return up; } +#ifdef CONFIG_SERIAL_8250_CONSOLE + +/* + * There is no struct device at this point, so let's not try to use + * serial_base_add_preferred_console(). + */ +static void __init serial8250_isa_init_preferred_console(int idx) +{ + const char *name __free(kfree); + int ret; + + name = kasprintf(GFP_KERNEL, "%s%i", serial8250_reg.dev_name, idx); + ret = add_preferred_console_match(name, serial8250_reg.dev_name, idx); + if (!ret || ret == -ENOENT) + return; + + pr_err("Could not add preferred console for %s idx %i\n", + serial8250_reg.dev_name, idx); +} + +#else + +static inline void serial8250_isa_init_preferred_console(struct uart_port *port, + int idx) +{ +} + +#endif + static void __init serial8250_isa_init_ports(void) { struct uart_8250_port *up; @@ -563,6 +593,8 @@ static void __init serial8250_isa_init_ports(void) port->irqflags |= irqflag; if (serial8250_isa_config != NULL) serial8250_isa_config(i, &up->port, &up->capabilities); + + serial8250_isa_init_preferred_console(i); } }