From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-23.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E681C433DB for ; Tue, 30 Mar 2021 18:31:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C51BB619CC for ; Tue, 30 Mar 2021 18:31:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232832AbhC3Sb0 (ORCPT ); Tue, 30 Mar 2021 14:31:26 -0400 Received: from alln-iport-5.cisco.com ([173.37.142.92]:36927 "EHLO alln-iport-5.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232637AbhC3Sax (ORCPT ); Tue, 30 Mar 2021 14:30:53 -0400 X-Greylist: delayed 428 seconds by postgrey-1.27 at vger.kernel.org; Tue, 30 Mar 2021 14:30:53 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=2604; q=dns/txt; s=iport; t=1617129053; x=1618338653; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=xMStwoujyvRVt+OuzbkoYXvA32+qhvWOh/uecqwPFaM=; b=b7CsenLExQDRVKThXUgDAuxYyJ3nqTLSo7bQxjzSqZLGwv27xS00z31x +6ig7mOZFRnQExUm2S8IbOnRHwe2PGzOQCf52MJmT080mwbT9SokB/O8P Rq0l4xoX9LOV1/X/3UG2QlbkS/lF8gcoSVjHh6a20z8bkJoFgOkS3NV7r Y=; X-IPAS-Result: =?us-ascii?q?A0ADAAC0a2NgmJldJa1aGgEBAQEBAQEBAQEDAQEBARIBA?= =?us-ascii?q?QEBAgIBAQEBQIE8BQEBAQELAYN2ATkxjGWJLpAIFopFgXwLAQEBDQEBNAQBA?= =?us-ascii?q?YRQAoF6AiU0CQ4CAwEBAQMCAwEBAQEBBQEBAQIBBgQUAQEBAQEBAQGGQ4ZFA?= =?us-ascii?q?QIDOj8QCxguPBsGE4JwgwirOXWBNIkLgUQigRcBjUkmHIFJQoESgm4uPoo2B?= =?us-ascii?q?IJHgQ6CMCyUAYpMmw6BFIMRgSObNjEQpEK4EgIEBgUCFoFUOIFbMxoIGxWDJ?= =?us-ascii?q?FAZDY44jk8hAy84AgYKAQEDCYZaLIIZAQE?= IronPort-HdrOrdr: A9a23:OGIYBqgWvJdablCjWRAu+Iu5lnBQXmcji2hD6mlwRA09T+Wzna mV88gz/xnylToXRTUMmcqYPrOBXHPb8vdOkOwsFJ2lWxTrv3btEZF64eLZsl/dMgD36+I178 1dWodkDtmYNzVHpOb8pDK1CtMxhOSAmZrY4dv261dIYUVUZ7p77wF/YzzrcXFeYAVdH5I2GN 69y6N8xgaIQngcYsSlCnRtZYGqzOHjr57obQULABQq8mC17Q+A0qLwEBSTw34lPQ9n/LFKyw T4uj28wLm/uPemzRKZ8Gnf4/1t6b3c4+oGItCQgc4ILTipsCKUXcBKXr2Puy1dmpDJ1GoX X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="5.81,291,1610409600"; d="scan'208";a="689174954" Received: from rcdn-core-2.cisco.com ([173.37.93.153]) by alln-iport-5.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA; 30 Mar 2021 18:23:43 +0000 Received: from zorba ([10.24.8.123]) by rcdn-core-2.cisco.com (8.15.2/8.15.2) with ESMTPS id 12UINdP0017615 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 30 Mar 2021 18:23:41 GMT Date: Tue, 30 Mar 2021 11:23:39 -0700 From: Daniel Walker To: "H. Nikolaus Schaller" Cc: Christophe Leroy , will@kernel.org, Rob Herring , daniel@gimpelevich.san-francisco.ca.us, linux-arch@vger.kernel.org, devicetree , linuxppc-dev@lists.ozlabs.org, Linux Kernel Mailing List , linux-arm-kernel , microblaze , linux-mips , nios2 , openrisc@lists.librecores.org, linux-hexagon@vger.kernel.org, linux-riscv@lists.infradead.org, x86@kernel.org, linux-xtensa@linux-xtensa.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org Subject: Re: [PATCH v3 01/17] cmdline: Add generic function to build command line. Message-ID: <20210330182339.GU109100@zorba> References: <878228ad88df38f8914c7aa25dede3ed05c50f48.1616765869.git.christophe.leroy@csgroup.eu> <20210330172714.GR109100@zorba> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Outbound-SMTP-Client: 10.24.8.123, [10.24.8.123] X-Outbound-Node: rcdn-core-2.cisco.com Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org On Tue, Mar 30, 2021 at 08:07:30PM +0200, H. Nikolaus Schaller wrote: > > > Am 30.03.2021 um 19:27 schrieb Daniel Walker : > > > > On Fri, Mar 26, 2021 at 01:44:48PM +0000, Christophe Leroy wrote: > >> This code provides architectures with a way to build command line > >> based on what is built in the kernel and what is handed over by the > >> bootloader, based on selected compile-time options. > >> > >> Signed-off-by: Christophe Leroy > >> --- > >> v3: > >> - Addressed comments from Will > >> - Added capability to have src == dst > >> --- > >> include/linux/cmdline.h | 57 +++++++++++++++++++++++++++++++++++++++++ > >> 1 file changed, 57 insertions(+) > >> create mode 100644 include/linux/cmdline.h > >> > >> diff --git a/include/linux/cmdline.h b/include/linux/cmdline.h > >> new file mode 100644 > >> index 000000000000..dea87edd41be > >> --- /dev/null > >> +++ b/include/linux/cmdline.h > >> @@ -0,0 +1,57 @@ > >> +/* SPDX-License-Identifier: GPL-2.0 */ > >> +#ifndef _LINUX_CMDLINE_H > >> +#define _LINUX_CMDLINE_H > >> + > >> +#include > >> + > >> +/* Allow architectures to override strlcat, powerpc can't use strings so early */ > >> +#ifndef cmdline_strlcat > >> +#define cmdline_strlcat strlcat > >> +#endif > >> + > >> +/* > >> + * This function will append or prepend a builtin command line to the command > >> + * line provided by the bootloader. Kconfig options can be used to alter > >> + * the behavior of this builtin command line. > >> + * @dst: The destination of the final appended/prepended string. > >> + * @src: The starting string or NULL if there isn't one. > >> + * @len: the length of dest buffer. > >> + */ > > > > Append or prepend ? Cisco requires both at the same time. This is why my > > implementation provides both. I can't use this with both at once. > > Just an idea: what about defining CMDLINE as a pattern where e.g. "$$" or "%%" > is replaced by the boot loader command line? > > Then you can formulate replace, prepend, append, prepend+append with a single > CONFIG setting. > > It may be a little more complex in code (scanning for the pattern and replacing > it and take care to temporary memory) but IMHO it could be worth to consider. In some cases this code could be used extremely early in boot up. For example in the prom_init.c powerpc code, or in efi changes. The flexibility to find and replace like that is not always an option due to the nature of the environment. It's not impossible of course. Daniel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-23.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIMWL_WL_MED,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C99AC433DB for ; Tue, 30 Mar 2021 18:24:10 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0642861983 for ; Tue, 30 Mar 2021 18:24:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0642861983 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=cisco.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=DelIj1RYMg/TsK3adox4RP6yJYEo6r+9+ue1tK5rgMA=; b=PI+aHA/dE69kHMFzG+ENCCM9g q6r+0vIvJnmMtDuGsx9RtOU2B+R3hYEbPiU3YZqDN7UvqFvxJdMOwW1jI7jo67z613dacH/IiP8Zf PHUDaYgqCPZkm4UOumos2puMUZnjgR+4LlbKhFC8yIxhnGv6LFuFu92ciN9CNFOLy1IwalWwhfXUw illdDrYqhVPB7n/joK+b/LbqG9WPKxby4EVKvQRmlg3m4LtyH0FU03VozaU0O7NQCTt1/kOibaaMF O8YFBd12DWLApK2U/+YGxG2gbYoD7Vm70TO0oONlB2ehoVGk0kjv2Iwthd65M5f/DgRhtFXiYynb+ zroVreNUg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lRJ1u-004b9a-R8; Tue, 30 Mar 2021 18:23:55 +0000 Received: from alln-iport-5.cisco.com ([173.37.142.92]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lRJ1l-004b7W-JG; Tue, 30 Mar 2021 18:23:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=2604; q=dns/txt; s=iport; t=1617128625; x=1618338225; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=xMStwoujyvRVt+OuzbkoYXvA32+qhvWOh/uecqwPFaM=; b=HOKvwhRGp1THDDrVjcq0hqrsPhQf9jhzOj6t2M25Zty6l28YVrQm/gpt yEjqgSvQ1fHwc6HMYoJ8rWqfIz1F4I/3xbaSxUEGMuMTZViAfhyEPNDEs sX/53oxhy3KC+CbX1f4inK0aPjnmsHsBhVaQsNHEjsybZUlVbG6IzTgc6 U=; X-IPAS-Result: =?us-ascii?q?A0ADAAC0a2NgmJldJa1aGgEBAQEBAQEBAQEDAQEBARIBA?= =?us-ascii?q?QEBAgIBAQEBQIE8BQEBAQELAYN2ATkxjGWJLpAIFopFgXwLAQEBDQEBNAQBA?= =?us-ascii?q?YRQAoF6AiU0CQ4CAwEBAQMCAwEBAQEBBQEBAQIBBgQUAQEBAQEBAQGGQ4ZFA?= =?us-ascii?q?QIDOj8QCxguPBsGE4JwgwirOXWBNIkLgUQigRcBjUkmHIFJQoESgm4uPoo2B?= =?us-ascii?q?IJHgQ6CMCyUAYpMmw6BFIMRgSObNjEQpEK4EgIEBgUCFoFUOIFbMxoIGxWDJ?= =?us-ascii?q?FAZDY44jk8hAy84AgYKAQEDCYZaLIIZAQE?= IronPort-HdrOrdr: A9a23:OGIYBqgWvJdablCjWRAu+Iu5lnBQXmcji2hD6mlwRA09T+Wzna mV88gz/xnylToXRTUMmcqYPrOBXHPb8vdOkOwsFJ2lWxTrv3btEZF64eLZsl/dMgD36+I178 1dWodkDtmYNzVHpOb8pDK1CtMxhOSAmZrY4dv261dIYUVUZ7p77wF/YzzrcXFeYAVdH5I2GN 69y6N8xgaIQngcYsSlCnRtZYGqzOHjr57obQULABQq8mC17Q+A0qLwEBSTw34lPQ9n/LFKyw T4uj28wLm/uPemzRKZ8Gnf4/1t6b3c4+oGItCQgc4ILTipsCKUXcBKXr2Puy1dmpDJ1GoX X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="5.81,291,1610409600"; d="scan'208";a="689174954" Received: from rcdn-core-2.cisco.com ([173.37.93.153]) by alln-iport-5.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA; 30 Mar 2021 18:23:43 +0000 Received: from zorba ([10.24.8.123]) by rcdn-core-2.cisco.com (8.15.2/8.15.2) with ESMTPS id 12UINdP0017615 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 30 Mar 2021 18:23:41 GMT Date: Tue, 30 Mar 2021 11:23:39 -0700 From: Daniel Walker To: "H. Nikolaus Schaller" Cc: Christophe Leroy , will@kernel.org, Rob Herring , daniel@gimpelevich.san-francisco.ca.us, linux-arch@vger.kernel.org, devicetree , linuxppc-dev@lists.ozlabs.org, Linux Kernel Mailing List , linux-arm-kernel , microblaze , linux-mips , nios2 , openrisc@lists.librecores.org, linux-hexagon@vger.kernel.org, linux-riscv@lists.infradead.org, x86@kernel.org, linux-xtensa@linux-xtensa.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org Subject: Re: [PATCH v3 01/17] cmdline: Add generic function to build command line. Message-ID: <20210330182339.GU109100@zorba> References: <878228ad88df38f8914c7aa25dede3ed05c50f48.1616765869.git.christophe.leroy@csgroup.eu> <20210330172714.GR109100@zorba> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Outbound-SMTP-Client: 10.24.8.123, [10.24.8.123] X-Outbound-Node: rcdn-core-2.cisco.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210330_192346_839178_9D78103E X-CRM114-Status: GOOD ( 30.69 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Tue, Mar 30, 2021 at 08:07:30PM +0200, H. Nikolaus Schaller wrote: > > > Am 30.03.2021 um 19:27 schrieb Daniel Walker : > > > > On Fri, Mar 26, 2021 at 01:44:48PM +0000, Christophe Leroy wrote: > >> This code provides architectures with a way to build command line > >> based on what is built in the kernel and what is handed over by the > >> bootloader, based on selected compile-time options. > >> > >> Signed-off-by: Christophe Leroy > >> --- > >> v3: > >> - Addressed comments from Will > >> - Added capability to have src == dst > >> --- > >> include/linux/cmdline.h | 57 +++++++++++++++++++++++++++++++++++++++++ > >> 1 file changed, 57 insertions(+) > >> create mode 100644 include/linux/cmdline.h > >> > >> diff --git a/include/linux/cmdline.h b/include/linux/cmdline.h > >> new file mode 100644 > >> index 000000000000..dea87edd41be > >> --- /dev/null > >> +++ b/include/linux/cmdline.h > >> @@ -0,0 +1,57 @@ > >> +/* SPDX-License-Identifier: GPL-2.0 */ > >> +#ifndef _LINUX_CMDLINE_H > >> +#define _LINUX_CMDLINE_H > >> + > >> +#include > >> + > >> +/* Allow architectures to override strlcat, powerpc can't use strings so early */ > >> +#ifndef cmdline_strlcat > >> +#define cmdline_strlcat strlcat > >> +#endif > >> + > >> +/* > >> + * This function will append or prepend a builtin command line to the command > >> + * line provided by the bootloader. Kconfig options can be used to alter > >> + * the behavior of this builtin command line. > >> + * @dst: The destination of the final appended/prepended string. > >> + * @src: The starting string or NULL if there isn't one. > >> + * @len: the length of dest buffer. > >> + */ > > > > Append or prepend ? Cisco requires both at the same time. This is why my > > implementation provides both. I can't use this with both at once. > > Just an idea: what about defining CMDLINE as a pattern where e.g. "$$" or "%%" > is replaced by the boot loader command line? > > Then you can formulate replace, prepend, append, prepend+append with a single > CONFIG setting. > > It may be a little more complex in code (scanning for the pattern and replacing > it and take care to temporary memory) but IMHO it could be worth to consider. In some cases this code could be used extremely early in boot up. For example in the prom_init.c powerpc code, or in efi changes. The flexibility to find and replace like that is not always an option due to the nature of the environment. It's not impossible of course. Daniel _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57229C433C1 for ; Tue, 30 Mar 2021 18:24:18 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 551BA619AA for ; Tue, 30 Mar 2021 18:24:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 551BA619AA Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=cisco.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4F8yWz3hjYz3c7g for ; Wed, 31 Mar 2021 05:24:15 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=cisco.com header.i=@cisco.com header.a=rsa-sha256 header.s=iport header.b=cjOi9tmU; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=cisco.com (client-ip=173.37.142.92; helo=alln-iport-5.cisco.com; envelope-from=danielwa@cisco.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=cisco.com header.i=@cisco.com header.a=rsa-sha256 header.s=iport header.b=cjOi9tmU; dkim-atps=neutral Received: from alln-iport-5.cisco.com (alln-iport-5.cisco.com [173.37.142.92]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4F8yWT2FMHz3br4 for ; Wed, 31 Mar 2021 05:23:46 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=2604; q=dns/txt; s=iport; t=1617128629; x=1618338229; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=xMStwoujyvRVt+OuzbkoYXvA32+qhvWOh/uecqwPFaM=; b=cjOi9tmUjIPuykkAOS2iZpDynzGKpVG8Pj9NiY0OE+OliKBDfUIZF9O4 zQNvxSIRJqusrFzTpPF6cgzLH2AluMlAUVEzWYCQsjGwHLmK1ZM/sQEKY D+IFsckQiUl7ZmdBhxOkxgUUUiJ0y8NiBmEhK/gysVAlKqj1ecg0PkeIi w=; X-IPAS-Result: =?us-ascii?q?A0ADAAC0a2NgmJldJa1aGgEBAQEBAQEBAQEDAQEBARIBA?= =?us-ascii?q?QEBAgIBAQEBQIE8BQEBAQELAYN2ATkxjGWJLpAIFopFgXwLAQEBDQEBNAQBA?= =?us-ascii?q?YRQAoF6AiU0CQ4CAwEBAQMCAwEBAQEBBQEBAQIBBgQUAQEBAQEBAQGGQ4ZFA?= =?us-ascii?q?QIDOj8QCxguPBsGE4JwgwirOXWBNIkLgUQigRcBjUkmHIFJQoESgm4uPoo2B?= =?us-ascii?q?IJHgQ6CMCyUAYpMmw6BFIMRgSObNjEQpEK4EgIEBgUCFoFUOIFbMxoIGxWDJ?= =?us-ascii?q?FAZDY44jk8hAy84AgYKAQEDCYZaLIIZAQE?= IronPort-HdrOrdr: A9a23:OGIYBqgWvJdablCjWRAu+Iu5lnBQXmcji2hD6mlwRA09T+Wzna mV88gz/xnylToXRTUMmcqYPrOBXHPb8vdOkOwsFJ2lWxTrv3btEZF64eLZsl/dMgD36+I178 1dWodkDtmYNzVHpOb8pDK1CtMxhOSAmZrY4dv261dIYUVUZ7p77wF/YzzrcXFeYAVdH5I2GN 69y6N8xgaIQngcYsSlCnRtZYGqzOHjr57obQULABQq8mC17Q+A0qLwEBSTw34lPQ9n/LFKyw T4uj28wLm/uPemzRKZ8Gnf4/1t6b3c4+oGItCQgc4ILTipsCKUXcBKXr2Puy1dmpDJ1GoX X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="5.81,291,1610409600"; d="scan'208";a="689174954" Received: from rcdn-core-2.cisco.com ([173.37.93.153]) by alln-iport-5.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA; 30 Mar 2021 18:23:43 +0000 Received: from zorba ([10.24.8.123]) by rcdn-core-2.cisco.com (8.15.2/8.15.2) with ESMTPS id 12UINdP0017615 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 30 Mar 2021 18:23:41 GMT Date: Tue, 30 Mar 2021 11:23:39 -0700 From: Daniel Walker To: "H. Nikolaus Schaller" Subject: Re: [PATCH v3 01/17] cmdline: Add generic function to build command line. Message-ID: <20210330182339.GU109100@zorba> References: <878228ad88df38f8914c7aa25dede3ed05c50f48.1616765869.git.christophe.leroy@csgroup.eu> <20210330172714.GR109100@zorba> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Outbound-SMTP-Client: 10.24.8.123, [10.24.8.123] X-Outbound-Node: rcdn-core-2.cisco.com X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, Rob Herring , microblaze , daniel@gimpelevich.san-francisco.ca.us, devicetree , linux-sh@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-xtensa@linux-xtensa.org, x86@kernel.org, Linux Kernel Mailing List , linux-mips , openrisc@lists.librecores.org, nios2 , linux-hexagon@vger.kernel.org, sparclinux@vger.kernel.org, linux-riscv@lists.infradead.org, will@kernel.org, linux-arm-kernel Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Tue, Mar 30, 2021 at 08:07:30PM +0200, H. Nikolaus Schaller wrote: > > > Am 30.03.2021 um 19:27 schrieb Daniel Walker : > > > > On Fri, Mar 26, 2021 at 01:44:48PM +0000, Christophe Leroy wrote: > >> This code provides architectures with a way to build command line > >> based on what is built in the kernel and what is handed over by the > >> bootloader, based on selected compile-time options. > >> > >> Signed-off-by: Christophe Leroy > >> --- > >> v3: > >> - Addressed comments from Will > >> - Added capability to have src == dst > >> --- > >> include/linux/cmdline.h | 57 +++++++++++++++++++++++++++++++++++++++++ > >> 1 file changed, 57 insertions(+) > >> create mode 100644 include/linux/cmdline.h > >> > >> diff --git a/include/linux/cmdline.h b/include/linux/cmdline.h > >> new file mode 100644 > >> index 000000000000..dea87edd41be > >> --- /dev/null > >> +++ b/include/linux/cmdline.h > >> @@ -0,0 +1,57 @@ > >> +/* SPDX-License-Identifier: GPL-2.0 */ > >> +#ifndef _LINUX_CMDLINE_H > >> +#define _LINUX_CMDLINE_H > >> + > >> +#include > >> + > >> +/* Allow architectures to override strlcat, powerpc can't use strings so early */ > >> +#ifndef cmdline_strlcat > >> +#define cmdline_strlcat strlcat > >> +#endif > >> + > >> +/* > >> + * This function will append or prepend a builtin command line to the command > >> + * line provided by the bootloader. Kconfig options can be used to alter > >> + * the behavior of this builtin command line. > >> + * @dst: The destination of the final appended/prepended string. > >> + * @src: The starting string or NULL if there isn't one. > >> + * @len: the length of dest buffer. > >> + */ > > > > Append or prepend ? Cisco requires both at the same time. This is why my > > implementation provides both. I can't use this with both at once. > > Just an idea: what about defining CMDLINE as a pattern where e.g. "$$" or "%%" > is replaced by the boot loader command line? > > Then you can formulate replace, prepend, append, prepend+append with a single > CONFIG setting. > > It may be a little more complex in code (scanning for the pattern and replacing > it and take care to temporary memory) but IMHO it could be worth to consider. In some cases this code could be used extremely early in boot up. For example in the prom_init.c powerpc code, or in efi changes. The flexibility to find and replace like that is not always an option due to the nature of the environment. It's not impossible of course. Daniel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-23.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIMWL_WL_MED,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42D91C433C1 for ; Tue, 30 Mar 2021 18:25:39 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A2E99619AA for ; Tue, 30 Mar 2021 18:25:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A2E99619AA Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=cisco.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=OcR5OWcU3Buf7myHz+53UEavdrhWyBPC796x8oF01VY=; b=VHdi+16/razWtLXuLGnIxwdb5 B+7mJCqv8UroxudSHh6+Ow3ME9qhWnQz2h9DgQhaeN0VaPDcH/CCefPcfLsSBJl/+nOZD98zTcotl FwZvlfpsp93ZxJkjfoNbaqUktGu7JG5+YYuvsSg++fs0q+PZjcVcCRa/E9MH5VPz5kPPOgIjmBDlk oZriILs+0igWRZUz7DqILoFj6cLw798/FIHLbljbYG4avJoHYt99yy3882+yj1Cb3pkJOfjy4iJ0j rgFYwL9w1yrGFlayZgBty4M2faYR0bNxnpZEAH5QBeZ93G3uKObT/2vRFpWkx+2ygxQm5uBuGkPAj uy6ZCbAgg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lRJ1x-004bA7-9a; Tue, 30 Mar 2021 18:23:57 +0000 Received: from alln-iport-5.cisco.com ([173.37.142.92]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lRJ1l-004b7W-JG; Tue, 30 Mar 2021 18:23:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=2604; q=dns/txt; s=iport; t=1617128625; x=1618338225; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=xMStwoujyvRVt+OuzbkoYXvA32+qhvWOh/uecqwPFaM=; b=HOKvwhRGp1THDDrVjcq0hqrsPhQf9jhzOj6t2M25Zty6l28YVrQm/gpt yEjqgSvQ1fHwc6HMYoJ8rWqfIz1F4I/3xbaSxUEGMuMTZViAfhyEPNDEs sX/53oxhy3KC+CbX1f4inK0aPjnmsHsBhVaQsNHEjsybZUlVbG6IzTgc6 U=; X-IPAS-Result: =?us-ascii?q?A0ADAAC0a2NgmJldJa1aGgEBAQEBAQEBAQEDAQEBARIBA?= =?us-ascii?q?QEBAgIBAQEBQIE8BQEBAQELAYN2ATkxjGWJLpAIFopFgXwLAQEBDQEBNAQBA?= =?us-ascii?q?YRQAoF6AiU0CQ4CAwEBAQMCAwEBAQEBBQEBAQIBBgQUAQEBAQEBAQGGQ4ZFA?= =?us-ascii?q?QIDOj8QCxguPBsGE4JwgwirOXWBNIkLgUQigRcBjUkmHIFJQoESgm4uPoo2B?= =?us-ascii?q?IJHgQ6CMCyUAYpMmw6BFIMRgSObNjEQpEK4EgIEBgUCFoFUOIFbMxoIGxWDJ?= =?us-ascii?q?FAZDY44jk8hAy84AgYKAQEDCYZaLIIZAQE?= IronPort-HdrOrdr: A9a23:OGIYBqgWvJdablCjWRAu+Iu5lnBQXmcji2hD6mlwRA09T+Wzna mV88gz/xnylToXRTUMmcqYPrOBXHPb8vdOkOwsFJ2lWxTrv3btEZF64eLZsl/dMgD36+I178 1dWodkDtmYNzVHpOb8pDK1CtMxhOSAmZrY4dv261dIYUVUZ7p77wF/YzzrcXFeYAVdH5I2GN 69y6N8xgaIQngcYsSlCnRtZYGqzOHjr57obQULABQq8mC17Q+A0qLwEBSTw34lPQ9n/LFKyw T4uj28wLm/uPemzRKZ8Gnf4/1t6b3c4+oGItCQgc4ILTipsCKUXcBKXr2Puy1dmpDJ1GoX X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="5.81,291,1610409600"; d="scan'208";a="689174954" Received: from rcdn-core-2.cisco.com ([173.37.93.153]) by alln-iport-5.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA; 30 Mar 2021 18:23:43 +0000 Received: from zorba ([10.24.8.123]) by rcdn-core-2.cisco.com (8.15.2/8.15.2) with ESMTPS id 12UINdP0017615 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 30 Mar 2021 18:23:41 GMT Date: Tue, 30 Mar 2021 11:23:39 -0700 From: Daniel Walker To: "H. Nikolaus Schaller" Cc: Christophe Leroy , will@kernel.org, Rob Herring , daniel@gimpelevich.san-francisco.ca.us, linux-arch@vger.kernel.org, devicetree , linuxppc-dev@lists.ozlabs.org, Linux Kernel Mailing List , linux-arm-kernel , microblaze , linux-mips , nios2 , openrisc@lists.librecores.org, linux-hexagon@vger.kernel.org, linux-riscv@lists.infradead.org, x86@kernel.org, linux-xtensa@linux-xtensa.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org Subject: Re: [PATCH v3 01/17] cmdline: Add generic function to build command line. Message-ID: <20210330182339.GU109100@zorba> References: <878228ad88df38f8914c7aa25dede3ed05c50f48.1616765869.git.christophe.leroy@csgroup.eu> <20210330172714.GR109100@zorba> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Outbound-SMTP-Client: 10.24.8.123, [10.24.8.123] X-Outbound-Node: rcdn-core-2.cisco.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210330_192346_839178_9D78103E X-CRM114-Status: GOOD ( 30.69 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Mar 30, 2021 at 08:07:30PM +0200, H. Nikolaus Schaller wrote: > > > Am 30.03.2021 um 19:27 schrieb Daniel Walker : > > > > On Fri, Mar 26, 2021 at 01:44:48PM +0000, Christophe Leroy wrote: > >> This code provides architectures with a way to build command line > >> based on what is built in the kernel and what is handed over by the > >> bootloader, based on selected compile-time options. > >> > >> Signed-off-by: Christophe Leroy > >> --- > >> v3: > >> - Addressed comments from Will > >> - Added capability to have src == dst > >> --- > >> include/linux/cmdline.h | 57 +++++++++++++++++++++++++++++++++++++++++ > >> 1 file changed, 57 insertions(+) > >> create mode 100644 include/linux/cmdline.h > >> > >> diff --git a/include/linux/cmdline.h b/include/linux/cmdline.h > >> new file mode 100644 > >> index 000000000000..dea87edd41be > >> --- /dev/null > >> +++ b/include/linux/cmdline.h > >> @@ -0,0 +1,57 @@ > >> +/* SPDX-License-Identifier: GPL-2.0 */ > >> +#ifndef _LINUX_CMDLINE_H > >> +#define _LINUX_CMDLINE_H > >> + > >> +#include > >> + > >> +/* Allow architectures to override strlcat, powerpc can't use strings so early */ > >> +#ifndef cmdline_strlcat > >> +#define cmdline_strlcat strlcat > >> +#endif > >> + > >> +/* > >> + * This function will append or prepend a builtin command line to the command > >> + * line provided by the bootloader. Kconfig options can be used to alter > >> + * the behavior of this builtin command line. > >> + * @dst: The destination of the final appended/prepended string. > >> + * @src: The starting string or NULL if there isn't one. > >> + * @len: the length of dest buffer. > >> + */ > > > > Append or prepend ? Cisco requires both at the same time. This is why my > > implementation provides both. I can't use this with both at once. > > Just an idea: what about defining CMDLINE as a pattern where e.g. "$$" or "%%" > is replaced by the boot loader command line? > > Then you can formulate replace, prepend, append, prepend+append with a single > CONFIG setting. > > It may be a little more complex in code (scanning for the pattern and replacing > it and take care to temporary memory) but IMHO it could be worth to consider. In some cases this code could be used extremely early in boot up. For example in the prom_init.c powerpc code, or in efi changes. The flexibility to find and replace like that is not always an option due to the nature of the environment. It's not impossible of course. Daniel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Walker Date: Tue, 30 Mar 2021 11:23:39 -0700 Subject: [OpenRISC] [PATCH v3 01/17] cmdline: Add generic function to build command line. In-Reply-To: References: <878228ad88df38f8914c7aa25dede3ed05c50f48.1616765869.git.christophe.leroy@csgroup.eu> <20210330172714.GR109100@zorba> Message-ID: <20210330182339.GU109100@zorba> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: openrisc@lists.librecores.org On Tue, Mar 30, 2021 at 08:07:30PM +0200, H. Nikolaus Schaller wrote: > > > Am 30.03.2021 um 19:27 schrieb Daniel Walker : > > > > On Fri, Mar 26, 2021 at 01:44:48PM +0000, Christophe Leroy wrote: > >> This code provides architectures with a way to build command line > >> based on what is built in the kernel and what is handed over by the > >> bootloader, based on selected compile-time options. > >> > >> Signed-off-by: Christophe Leroy > >> --- > >> v3: > >> - Addressed comments from Will > >> - Added capability to have src == dst > >> --- > >> include/linux/cmdline.h | 57 +++++++++++++++++++++++++++++++++++++++++ > >> 1 file changed, 57 insertions(+) > >> create mode 100644 include/linux/cmdline.h > >> > >> diff --git a/include/linux/cmdline.h b/include/linux/cmdline.h > >> new file mode 100644 > >> index 000000000000..dea87edd41be > >> --- /dev/null > >> +++ b/include/linux/cmdline.h > >> @@ -0,0 +1,57 @@ > >> +/* SPDX-License-Identifier: GPL-2.0 */ > >> +#ifndef _LINUX_CMDLINE_H > >> +#define _LINUX_CMDLINE_H > >> + > >> +#include > >> + > >> +/* Allow architectures to override strlcat, powerpc can't use strings so early */ > >> +#ifndef cmdline_strlcat > >> +#define cmdline_strlcat strlcat > >> +#endif > >> + > >> +/* > >> + * This function will append or prepend a builtin command line to the command > >> + * line provided by the bootloader. Kconfig options can be used to alter > >> + * the behavior of this builtin command line. > >> + * @dst: The destination of the final appended/prepended string. > >> + * @src: The starting string or NULL if there isn't one. > >> + * @len: the length of dest buffer. > >> + */ > > > > Append or prepend ? Cisco requires both at the same time. This is why my > > implementation provides both. I can't use this with both at once. > > Just an idea: what about defining CMDLINE as a pattern where e.g. "$$" or "%%" > is replaced by the boot loader command line? > > Then you can formulate replace, prepend, append, prepend+append with a single > CONFIG setting. > > It may be a little more complex in code (scanning for the pattern and replacing > it and take care to temporary memory) but IMHO it could be worth to consider. In some cases this code could be used extremely early in boot up. For example in the prom_init.c powerpc code, or in efi changes. The flexibility to find and replace like that is not always an option due to the nature of the environment. It's not impossible of course. Daniel