All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 0/6] Add support for DEVNAME:0.0 style hardware based addressing
@ 2024-02-13  8:45 Tony Lindgren
  2024-02-13  8:45 ` [PATCH v6 1/6] printk: Save console options for add_preferred_console_match() Tony Lindgren
                   ` (5 more replies)
  0 siblings, 6 replies; 19+ messages in thread
From: Tony Lindgren @ 2024-02-13  8:45 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Petr Mladek, Steven Rostedt,
	John Ogness, Sergey Senozhatsky
  Cc: David S . Miller, Andy Shevchenko, Dhruva Gole,
	Ilpo Järvinen, Johan Hovold, Sebastian Andrzej Siewior,
	Vignesh Raghavendra, linux-kernel, linux-serial

Hi all,

With the recent serial core changes, we can now add DEVNAME:0.0 style
addressing for the serial ports. When using DEVNAME:0.0 naming, we don't
need to care which ttyS instance number is allocated depending on HSUART
settings or if the devicetree has added aliases for all the ports.

We also prepare the serial core to handle the ttyS related quirks done
in console_setup() to prepare things for eventually dropping the parsing
from console_setup().

These patches are against tty-next, but apply with fuzz also against Linux
next with the recent printk changes.

Regards,

Tony

Changes since v5:
- Include types.h as noted by Andy

- Update patch description to use serial_base_add_one_prefcon() as noded
  by Andy

Changes since v4:
- Fix passing empty brl_opt to add_preferred_console() instead of NULL

- Fix console_setup() trying to parse a console index out of a DEVNAME:0.0
  option that can be an IO address instead of an index

- Fix issue with default console getting enabled before DEVNAME:0.0
  handling device driver calls add_preferred_console()

- Fix error check for kasprintf(), use serial_base_add_one_prefcon() and
  coding suggestions by Andy

- Fixed compile errors if console is not enabled in .config as noted
  by kernel test robot

Changes since v3:
- Fix handling of brl_options by saving them too in console_opt_save()

- Drop changes to remove console_setup() parsing, further changes to
  register_console() are still needed before can leave out the early
  parsing

- Added a patch for serial8250_isa_init_preferred_console(), otherwise
  the console gets initialized later for x86 when the console_setup()
  parsing is dropped as pointed out by Petr

- Initialize __free() variables to NULL as noted by Dan

- Return handled in console_setup() if saving console options fails

- Simplify serial_base_add_preferred_console() and add a helper for
  serial_base_add_one_prefcon() as suggested by Andy

- Header include changes to kernel/printk/conopt.c as suggested by Andy

Changes since v2:

- Console name got constified and already applied as suggested by Ilpo
  and Andy

- Add printk/conopt.c to save console command line options

- Add a patch to drop old console_setup() character device name parsing

- Use cleanup.h to simplify freeing as suggested by Andy

- Use types.h instead of kernel.h as suggested by Andy

- Use strcspn() as suggested by Andy

- Various coding improvments suggested by Andy

Changes since v1:

- Constify printk add_preferred_console() as suggested by Jiri

- Use proper kernel command line helpers for parsing console as
  suggested by Jiri

- Update description for HSUART based on Andy's comments

- Standardize on DEVNAME:0.0 style naming as suggested by Andy

- Added missing put_device() calls paired with device_find_child()

Tony Lindgren (6):
  printk: Save console options for add_preferred_console_match()
  printk: Don't try to parse DEVNAME:0.0 console options
  printk: Flag register_console() if console is set on command line
  serial: core: Add support for DEVNAME:0.0 style naming for kernel
    console
  serial: core: Handle serial console options
  serial: 8250: Add preferred console in serial8250_isa_init_ports()

 drivers/tty/serial/8250/8250_core.c  |   5 +
 drivers/tty/serial/serial_base.h     |  24 +++++
 drivers/tty/serial/serial_base_bus.c | 136 +++++++++++++++++++++++++
 drivers/tty/serial/serial_core.c     |   4 +
 include/linux/printk.h               |   3 +
 kernel/printk/Makefile               |   2 +-
 kernel/printk/conopt.c               | 143 +++++++++++++++++++++++++++
 kernel/printk/console_cmdline.h      |   6 ++
 kernel/printk/printk.c               |  23 ++++-
 9 files changed, 341 insertions(+), 5 deletions(-)
 create mode 100644 kernel/printk/conopt.c


base-commit: 6cc3028f797a549f256d593867a769ab6a8265f2
-- 
2.43.1

^ permalink raw reply	[flat|nested] 19+ messages in thread
* Re: [PATCH v6 4/6] serial: core: Add support for DEVNAME:0.0 style naming for kernel console
@ 2024-02-14  8:29 kernel test robot
  0 siblings, 0 replies; 19+ messages in thread
From: kernel test robot @ 2024-02-14  8:29 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20240213084545.40617-5-tony@atomide.com>
References: <20240213084545.40617-5-tony@atomide.com>
TO: Tony Lindgren <tony@atomide.com>
TO: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
TO: Jiri Slaby <jirislaby@kernel.org>
TO: Petr Mladek <pmladek@suse.com>
TO: Steven Rostedt <rostedt@goodmis.org>
TO: John Ogness <john.ogness@linutronix.de>
TO: Sergey Senozhatsky <senozhatsky@chromium.org>
CC: "David S . Miller" <davem@davemloft.net>
CC: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
CC: Dhruva Gole <d-gole@ti.com>
CC: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
CC: Johan Hovold <johan@kernel.org>
CC: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
CC: Vignesh Raghavendra <vigneshr@ti.com>
CC: linux-kernel@vger.kernel.org
CC: linux-serial@vger.kernel.org

Hi Tony,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 6cc3028f797a549f256d593867a769ab6a8265f2]

url:    https://github.com/intel-lab-lkp/linux/commits/Tony-Lindgren/printk-Save-console-options-for-add_preferred_console_match/20240213-171012
base:   6cc3028f797a549f256d593867a769ab6a8265f2
patch link:    https://lore.kernel.org/r/20240213084545.40617-5-tony%40atomide.com
patch subject: [PATCH v6 4/6] serial: core: Add support for DEVNAME:0.0 style naming for kernel console
:::::: branch date: 23 hours ago
:::::: commit date: 23 hours ago
config: i386-randconfig-141-20240214 (https://download.01.org/0day-ci/archive/20240214/202402141619.BqEGGzwm-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)

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>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202402141619.BqEGGzwm-lkp@intel.com/

smatch warnings:
drivers/tty/serial/serial_base_bus.c:255 serial_base_add_preferred_console() error: uninitialized symbol 'port_match'.

vim +/port_match +255 drivers/tty/serial/serial_base_bus.c

a2020a9ccacd63 Tony Lindgren 2024-02-13  233  
a2020a9ccacd63 Tony Lindgren 2024-02-13  234  /**
a2020a9ccacd63 Tony Lindgren 2024-02-13  235   * serial_base_add_preferred_console - Adds a preferred console
a2020a9ccacd63 Tony Lindgren 2024-02-13  236   * @drv: Serial port device driver
a2020a9ccacd63 Tony Lindgren 2024-02-13  237   * @port: Serial port instance
a2020a9ccacd63 Tony Lindgren 2024-02-13  238   *
a2020a9ccacd63 Tony Lindgren 2024-02-13  239   * Tries to add a preferred console for a serial port if specified in the
a2020a9ccacd63 Tony Lindgren 2024-02-13  240   * kernel command line. Supports both the traditional character device such
a2020a9ccacd63 Tony Lindgren 2024-02-13  241   * as console=ttyS0, and a hardware addressing based console=DEVNAME:0.0
a2020a9ccacd63 Tony Lindgren 2024-02-13  242   * style name.
a2020a9ccacd63 Tony Lindgren 2024-02-13  243   *
a2020a9ccacd63 Tony Lindgren 2024-02-13  244   * Translates the kernel command line option using a hardware based addressing
a2020a9ccacd63 Tony Lindgren 2024-02-13  245   * console=DEVNAME:0.0 to the serial port character device such as ttyS0.
a2020a9ccacd63 Tony Lindgren 2024-02-13  246   * Cannot be called early for ISA ports, depends on struct device.
a2020a9ccacd63 Tony Lindgren 2024-02-13  247   *
a2020a9ccacd63 Tony Lindgren 2024-02-13  248   * Note that duplicates are ignored by add_preferred_console().
a2020a9ccacd63 Tony Lindgren 2024-02-13  249   *
a2020a9ccacd63 Tony Lindgren 2024-02-13  250   * Return: 0 on success, negative error code on failure.
a2020a9ccacd63 Tony Lindgren 2024-02-13  251   */
a2020a9ccacd63 Tony Lindgren 2024-02-13  252  int serial_base_add_preferred_console(struct uart_driver *drv,
a2020a9ccacd63 Tony Lindgren 2024-02-13  253  				      struct uart_port *port)
a2020a9ccacd63 Tony Lindgren 2024-02-13  254  {
a2020a9ccacd63 Tony Lindgren 2024-02-13 @255  	const char *port_match __free(kfree);
a2020a9ccacd63 Tony Lindgren 2024-02-13  256  	int ret;
a2020a9ccacd63 Tony Lindgren 2024-02-13  257  
a2020a9ccacd63 Tony Lindgren 2024-02-13  258  	ret = serial_base_add_prefcon(drv->dev_name, port->line);
a2020a9ccacd63 Tony Lindgren 2024-02-13  259  	if (ret)
a2020a9ccacd63 Tony Lindgren 2024-02-13  260  		return ret;
a2020a9ccacd63 Tony Lindgren 2024-02-13  261  
a2020a9ccacd63 Tony Lindgren 2024-02-13  262  	port_match = kasprintf(GFP_KERNEL, "%s:%i.%i", dev_name(port->dev),
a2020a9ccacd63 Tony Lindgren 2024-02-13  263  			       port->ctrl_id, port->port_id);
a2020a9ccacd63 Tony Lindgren 2024-02-13  264  	if (!port_match)
a2020a9ccacd63 Tony Lindgren 2024-02-13  265  		return -ENOMEM;
a2020a9ccacd63 Tony Lindgren 2024-02-13  266  
a2020a9ccacd63 Tony Lindgren 2024-02-13  267  	/* Translate a hardware addressing style console=DEVNAME:0.0 */
a2020a9ccacd63 Tony Lindgren 2024-02-13  268  	return serial_base_add_one_prefcon(port_match, drv->dev_name, port->line);
a2020a9ccacd63 Tony Lindgren 2024-02-13  269  }
a2020a9ccacd63 Tony Lindgren 2024-02-13  270  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2024-02-14  9:04 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-13  8:45 [PATCH v6 0/6] Add support for DEVNAME:0.0 style hardware based addressing Tony Lindgren
2024-02-13  8:45 ` [PATCH v6 1/6] printk: Save console options for add_preferred_console_match() Tony Lindgren
2024-02-13 16:41   ` Andy Shevchenko
2024-02-14  7:59     ` Tony Lindgren
2024-02-14  8:49     ` Tony Lindgren
2024-02-14  8:51       ` Tony Lindgren
2024-02-13  8:45 ` [PATCH v6 2/6] printk: Don't try to parse DEVNAME:0.0 console options Tony Lindgren
2024-02-13  8:45 ` [PATCH v6 3/6] printk: Flag register_console() if console is set on command line Tony Lindgren
2024-02-13  8:45 ` [PATCH v6 4/6] serial: core: Add support for DEVNAME:0.0 style naming for kernel console Tony Lindgren
2024-02-13 15:53   ` Andy Shevchenko
2024-02-14  6:02     ` Tony Lindgren
2024-02-13 23:58   ` Sebastian Reichel
2024-02-14  7:08     ` Tony Lindgren
2024-02-14  9:00   ` Dan Carpenter
2024-02-14  9:03     ` Tony Lindgren
2024-02-13  8:45 ` [PATCH v6 5/6] serial: core: Handle serial console options Tony Lindgren
2024-02-13 15:56   ` Andy Shevchenko
2024-02-13  8:45 ` [PATCH v6 6/6] serial: 8250: Add preferred console in serial8250_isa_init_ports() Tony Lindgren
  -- strict thread matches above, loose matches on Subject: below --
2024-02-14  8:29 [PATCH v6 4/6] serial: core: Add support for DEVNAME:0.0 style naming for kernel console kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.