From patchwork Mon Oct 7 22:20:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Burton X-Patchwork-Id: 11178571 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 87A0217EE for ; Mon, 7 Oct 2019 22:20:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4D6E820867 for ; Mon, 7 Oct 2019 22:20:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=wavecomp.com header.i=@wavecomp.com header.b="O1bQE97p" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728983AbfJGWUF (ORCPT ); Mon, 7 Oct 2019 18:20:05 -0400 Received: from mail-eopbgr730116.outbound.protection.outlook.com ([40.107.73.116]:58336 "EHLO NAM05-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728654AbfJGWUE (ORCPT ); Mon, 7 Oct 2019 18:20:04 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S8Hz3a/UWUyiZYagQNri9hIR/ntqY8GP9fgRV2G3h7el6kPyS4rqWXDpWI3RIEfxVqSC4AR6vbUsN19optMF1yAaIAtvxdIsndqoxlqOZTwnaSBrxGFIQLI7XqvNLALh135Ox42I96fUbupfD6612yth89EEeS3pXu7WodtJkogBKG7jwir89KIl8qEMjSKlcIvxOiIfhAcIAeDYa6OHO0n+4vfX4CGzwAtmB0MUON6uaotdnQN8I1aN6aZBQOXtvgZEPbYE+jOaO0Rpzs03p6oPR2n7aj6ghNprmN/qgNdrp0GWni124oKET7EzhZPXxgt3D+7XlBvR8vj6W0Zw1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AvuCt8fizbvf/UnFLUN+kHgLlX8D5me4RAYIFAw53H4=; b=a+us1nD4XRfQt7Y4pai2Ep4/IzxzuJ3DBgHaokFRieWHA7zktlz+SHl+XK4L40MbDa5ZvutwdFe0eQnIlYVO08P4PL3uQEjVWVdgw/DLk8lx/mTI3S84PsBvBM7/NMIGGIbvIFx1EWeUoIcj3vDOKFshDgu9CXAOFePUKXaPkzJtRFbQkImMFBQvht7uN4BsZDYOebnpZS1wuIdK2cjuCg/GFuG2Vo3cN7LCWVRM/inliqKNpBTdhoiRu+ZkHrW+Zlt4c8KFBF7hsYOaU6di5vMbSjw7cxQo6WjGvjvknYMT0/xIxv4iOntWCrOQCJZOHcoHqvAK3Dvw0MwIcXxOHw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wavecomp.com; dmarc=pass action=none header.from=mips.com; dkim=pass header.d=mips.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wavecomp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AvuCt8fizbvf/UnFLUN+kHgLlX8D5me4RAYIFAw53H4=; b=O1bQE97pGodx1ZTvBQ1PdsS5WVhSpcACxqqSp/xId5L9VQCmCfOeuv88Cp8LJUwCQIMk1cXIXEAOS63feS1RjujoOMsMB0l9XXuQxBJEMeViWJTVvqw7+UDSs7BwHcciqaLwTw2MQQhx7xWOYmTChbNZF4vZaTtlF5GfZR7jBo4= Received: from MWHPR2201MB1277.namprd22.prod.outlook.com (10.172.60.12) by MWHPR2201MB1310.namprd22.prod.outlook.com (10.174.162.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2327.24; Mon, 7 Oct 2019 22:20:01 +0000 Received: from MWHPR2201MB1277.namprd22.prod.outlook.com ([fe80::3050:9a38:9d8e:8033]) by MWHPR2201MB1277.namprd22.prod.outlook.com ([fe80::3050:9a38:9d8e:8033%5]) with mapi id 15.20.2327.025; Mon, 7 Oct 2019 22:20:01 +0000 From: Paul Burton To: "linux-mips@vger.kernel.org" CC: Paul Burton Subject: [PATCH 1/4] MIPS: cmdline: Remove CONFIG_MIPS_CMDLINE_BUILTIN_EXTEND Thread-Topic: [PATCH 1/4] MIPS: cmdline: Remove CONFIG_MIPS_CMDLINE_BUILTIN_EXTEND Thread-Index: AQHVfV1cKvTopIeE5EOEEl/ItiIYAg== Date: Mon, 7 Oct 2019 22:20:01 +0000 Message-ID: <20191007221951.1889661-1-paul.burton@mips.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR08CA0023.namprd08.prod.outlook.com (2603:10b6:a03:100::36) To MWHPR2201MB1277.namprd22.prod.outlook.com (2603:10b6:301:18::12) authentication-results: spf=none (sender IP is ) smtp.mailfrom=pburton@wavecomp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.23.0 x-originating-ip: [12.94.197.246] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5f830cd2-90bc-4707-3c9d-08d74b747eab x-ms-traffictypediagnostic: MWHPR2201MB1310: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3631; x-forefront-prvs: 01834E39B7 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(979002)(396003)(376002)(366004)(346002)(39840400004)(136003)(189003)(199004)(1076003)(4326008)(8936002)(50226002)(186003)(44832011)(99286004)(102836004)(6506007)(6916009)(107886003)(26005)(476003)(386003)(486006)(478600001)(305945005)(7736002)(25786009)(71200400001)(66556008)(2351001)(66946007)(66476007)(71190400001)(66446008)(64756008)(81156014)(8676002)(2501003)(81166006)(5660300002)(36756003)(2616005)(66066001)(3846002)(316002)(256004)(2906002)(42882007)(52116002)(6436002)(6486002)(6512007)(14454004)(5640700003)(6116002)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR2201MB1310;H:MWHPR2201MB1277.namprd22.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: wavecomp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: YMbZTD39xalDpt7b34VU7CROZ9ui0dUk13XAylaJrbltMt8DpRil/TrRu3xV3MjlNuzHKXXLuxBEF6H9hsZYNKbfTIFC7ObBdluPWTdTZXsgysMsb3VCGFr6PNgJTM7Cdu3lxalwIISaKXTfNJhWbzU6uiQWI9FUyMpxcVTvChBRl7HkwQ0AEalyK0AyyeQv6La4vNpLsBNnF+0AqReggbCYKSPimNgRN97sND3GFxIZgZaLJ19IB7tKbrOyHMq4jwzVvdeEpW2CupFrJm0AWiMAwi0va5a8YthJPRDif7pQG+8MqD1VSmOEOas4ZUJM95OzvQSPuRRsz5klXRjbyoPAlWuBLfud9T0QVV6ibFBQo0xEz066EwQVzrDMPRTKDiDdEMIFfikzDZ+7RfZx1XK+L55mC4mgVreDDW//F7s= MIME-Version: 1.0 X-OriginatorOrg: mips.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5f830cd2-90bc-4707-3c9d-08d74b747eab X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Oct 2019 22:20:01.2204 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 463607d3-1db3-40a0-8a29-970c56230104 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: GiZeWcvZ8CIYtORxqyrSOrmC9OM1pqBavEGzsvynqwrVVkI7tWzSfDGSzCS8ZfVUpcZvDqclRFryyHt8SUnExQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR2201MB1310 Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org CONFIG_MIPS_CMDLINE_BUILTIN_EXTEND is not selected by any of our defconfigs, so remove it to simplify the messy command line logic in arch_mem_init() a little. Signed-off-by: Paul Burton Reviewed-by: Philippe Mathieu-Daudé Nacked-by: Maciej W. Rozycki --- arch/mips/Kconfig | 4 ---- arch/mips/kernel/setup.c | 8 -------- 2 files changed, 12 deletions(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index a0bd9bdb5f83..ec922e6ff40b 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -3034,10 +3034,6 @@ choice config MIPS_CMDLINE_FROM_BOOTLOADER bool "Bootloader kernel arguments if available" - - config MIPS_CMDLINE_BUILTIN_EXTEND - depends on CMDLINE_BOOL - bool "Extend builtin kernel arguments with bootloader arguments" endchoice endmenu diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index 5eec13b8d222..c2a09f082d88 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c @@ -541,8 +541,6 @@ static void __init check_kernel_sections_mem(void) #define USE_PROM_CMDLINE IS_ENABLED(CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER) #define USE_DTB_CMDLINE IS_ENABLED(CONFIG_MIPS_CMDLINE_FROM_DTB) #define EXTEND_WITH_PROM IS_ENABLED(CONFIG_MIPS_CMDLINE_DTB_EXTEND) -#define BUILTIN_EXTEND_WITH_PROM \ - IS_ENABLED(CONFIG_MIPS_CMDLINE_BUILTIN_EXTEND) /* * arch_mem_init - initialize memory management subsystem @@ -602,12 +600,6 @@ static void __init arch_mem_init(char **cmdline_p) strlcat(boot_command_line, " ", COMMAND_LINE_SIZE); strlcat(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); } - - if (BUILTIN_EXTEND_WITH_PROM && arcs_cmdline[0]) { - if (boot_command_line[0]) - strlcat(boot_command_line, " ", COMMAND_LINE_SIZE); - strlcat(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE); - } #endif #endif strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); From patchwork Mon Oct 7 22:20:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Burton X-Patchwork-Id: 11178573 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5CFBA17EE for ; Mon, 7 Oct 2019 22:20:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 312B920835 for ; Mon, 7 Oct 2019 22:20:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=wavecomp.com header.i=@wavecomp.com header.b="cChb+SZR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729051AbfJGWUF (ORCPT ); Mon, 7 Oct 2019 18:20:05 -0400 Received: from mail-eopbgr730116.outbound.protection.outlook.com ([40.107.73.116]:58336 "EHLO NAM05-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728980AbfJGWUF (ORCPT ); Mon, 7 Oct 2019 18:20:05 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nkP2ifFBtO905/z2YHHSAsM48oOQVlcY8vSXVinABy1VzCcVn9t5t1tTtsaPbnQzQbh6B2L2HV38/zEHl5mCN1HyZwOB/aixNWXdibsUm/TGcAQ6EGdf7+6KTqLLkLI0ELFAlrHqXsfLeyfptDk6hfPkf719pQLjW/EOo/rvfSz7EMPLTmxD+YhNEEGtnSLwTGyYtFMF7g3Y/Ig4B4OPY3irrUfriLyeAgs++alcZcRCTJlt8v97WO57cjhA4USSAYv+KFG1UxQqXKci2DNxW2NZdaHkDD8kSI75d1XBUybf0pioNQFTYJRgIvQTx22Sa8sIZps9lti1Y4XTtZ8WPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nArTmDDpuJi6tUS6FX0jU9l2nhqYUII9699qXqJ+37U=; b=Fn8UT0tRCSUNVT/hY/3JgYbLTnCzsTik/cXbeK2o3jeN8M1+uKPkykjSN1Xc9hniOiDY/a8MqwGWCzB1UAFoHanD1BfkvJ0OMTIhJtZWFfhqDhwO7VdHP6rDUT47sbFiSveJT4J4zaoYSj3p5RAdNyda9pHijXUFXFYkGRVVnRL3R4R5P3tIziHdkDH6VN5YxL2k5XbONKqEtiktUN4IMTi4BcYsR85DKfihmB1qrzNgi2cPDMuA7wVJMxxXb0wiem4i6q5hOIoseSi6aV+DlbFcy6Cfv5XLbgFHhVMu7ud1/E8e8Tt9TkLLD7N7TsjyXSnmMOu+V1rgHlIy6p0Luw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wavecomp.com; dmarc=pass action=none header.from=mips.com; dkim=pass header.d=mips.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wavecomp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nArTmDDpuJi6tUS6FX0jU9l2nhqYUII9699qXqJ+37U=; b=cChb+SZRjmABao2/8S5j8gEMq3uCc8pQEXZDbucfFMOy/Lv/TbpsTK90lvfUcseVIl8s+ujKCA+fpeC3QR8eLnGBrA8fu1KcW9sD6TtbiwgHrT4iNjbtK4gZHfoV27CEeAtX3JNhi3jUYQZNQfbzlwQBSG9UlN4Wfd1lxghLhWY= Received: from MWHPR2201MB1277.namprd22.prod.outlook.com (10.172.60.12) by MWHPR2201MB1310.namprd22.prod.outlook.com (10.174.162.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2327.24; Mon, 7 Oct 2019 22:20:02 +0000 Received: from MWHPR2201MB1277.namprd22.prod.outlook.com ([fe80::3050:9a38:9d8e:8033]) by MWHPR2201MB1277.namprd22.prod.outlook.com ([fe80::3050:9a38:9d8e:8033%5]) with mapi id 15.20.2327.025; Mon, 7 Oct 2019 22:20:02 +0000 From: Paul Burton To: "linux-mips@vger.kernel.org" CC: Paul Burton Subject: [PATCH 2/4] MIPS: cmdline: Remove CONFIG_MIPS_CMDLINE_DTB_EXTEND Thread-Topic: [PATCH 2/4] MIPS: cmdline: Remove CONFIG_MIPS_CMDLINE_DTB_EXTEND Thread-Index: AQHVfV1cj5Q8zAUdTUq6A98d97kCng== Date: Mon, 7 Oct 2019 22:20:02 +0000 Message-ID: <20191007221951.1889661-2-paul.burton@mips.com> References: <20191007221951.1889661-1-paul.burton@mips.com> In-Reply-To: <20191007221951.1889661-1-paul.burton@mips.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR08CA0023.namprd08.prod.outlook.com (2603:10b6:a03:100::36) To MWHPR2201MB1277.namprd22.prod.outlook.com (2603:10b6:301:18::12) authentication-results: spf=none (sender IP is ) smtp.mailfrom=pburton@wavecomp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.23.0 x-originating-ip: [12.94.197.246] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 25c010e9-7d1c-43ac-a894-08d74b747f22 x-ms-traffictypediagnostic: MWHPR2201MB1310: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2887; x-forefront-prvs: 01834E39B7 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(376002)(366004)(346002)(39840400004)(136003)(189003)(199004)(1076003)(4326008)(8936002)(50226002)(186003)(44832011)(99286004)(102836004)(6506007)(6916009)(107886003)(76176011)(26005)(476003)(386003)(486006)(478600001)(305945005)(7736002)(25786009)(71200400001)(66556008)(2351001)(66946007)(66476007)(11346002)(71190400001)(66446008)(64756008)(81156014)(8676002)(2501003)(81166006)(5660300002)(446003)(36756003)(2616005)(66066001)(3846002)(316002)(256004)(2906002)(42882007)(52116002)(6436002)(6486002)(6512007)(14454004)(5640700003)(6116002);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR2201MB1310;H:MWHPR2201MB1277.namprd22.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: wavecomp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: YdAzsFmXqY8CxeqSnHNCrXE5HzJc/N0By02V0I5ajss4Juk5AojYS/anI2cdY7lNZbJ8tGrDnMYCW4OLrQVT1I8Z0o8G/Lk+mokk/45uhxc1w7qHkm8znACTfUnp9Gb+a5z0GggZtSnOzdyeqj5VWayH39CWu6rn4L6Q8IKn3aVSjSvwNklaJfcUIxDAMg562RUx/VBuptvuS8z/B1aNdN4po35x/s/BBOOsJkaR8V+CN3hBr/vct0r9s4qhXexgt/7+PCoxbrtzW0i42NZtyKl/vaP/FPWCib5tPFbhhmYUK0D+J3VzSC34BIjVXIE+ofl69B9HnfOCuCg5FTOiPe4PtBPsA9kOc/b6n+IfBewlc95IJ1tnLWLIFQ7Xjn1aZRDn4BYJbihQertLL25PEuTruETgPbrwz5593PReTUg= MIME-Version: 1.0 X-OriginatorOrg: mips.com X-MS-Exchange-CrossTenant-Network-Message-Id: 25c010e9-7d1c-43ac-a894-08d74b747f22 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Oct 2019 22:20:02.1220 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 463607d3-1db3-40a0-8a29-970c56230104 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: igZpREIvCzhupO2GMYSxu2oQ1oPmV7d4t9fhCWKyycLxVJu4gZtFAwBEEi5kmyOVMwWjC/6Urz88DXFJJR+AFQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR2201MB1310 Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org CONFIG_MIPS_CMDLINE_DTB_EXTEND is not selected by any of our defconfigs, so remove it to simplify the messy command line logic in arch_mem_init() a little. Signed-off-by: Paul Burton Reviewed-by: Philippe Mathieu-Daudé --- arch/mips/Kconfig | 4 ---- arch/mips/kernel/setup.c | 7 ------- 2 files changed, 11 deletions(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index ec922e6ff40b..736b691e7e5e 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -3028,10 +3028,6 @@ choice depends on USE_OF bool "Dtb kernel arguments if available" - config MIPS_CMDLINE_DTB_EXTEND - depends on USE_OF - bool "Extend dtb kernel arguments with bootloader arguments" - config MIPS_CMDLINE_FROM_BOOTLOADER bool "Bootloader kernel arguments if available" endchoice diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index c2a09f082d88..273b26a81935 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c @@ -540,7 +540,6 @@ static void __init check_kernel_sections_mem(void) #define USE_PROM_CMDLINE IS_ENABLED(CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER) #define USE_DTB_CMDLINE IS_ENABLED(CONFIG_MIPS_CMDLINE_FROM_DTB) -#define EXTEND_WITH_PROM IS_ENABLED(CONFIG_MIPS_CMDLINE_DTB_EXTEND) /* * arch_mem_init - initialize memory management subsystem @@ -588,12 +587,6 @@ static void __init arch_mem_init(char **cmdline_p) (USE_DTB_CMDLINE && !boot_command_line[0])) strlcpy(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE); - if (EXTEND_WITH_PROM && arcs_cmdline[0]) { - if (boot_command_line[0]) - strlcat(boot_command_line, " ", COMMAND_LINE_SIZE); - strlcat(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE); - } - #if defined(CONFIG_CMDLINE_BOOL) if (builtin_cmdline[0]) { if (boot_command_line[0]) From patchwork Mon Oct 7 22:20:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Burton X-Patchwork-Id: 11178575 X-Patchwork-Delegate: paulburton@kernel.org Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 76E1C13BD for ; Mon, 7 Oct 2019 22:20:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 54E5B20835 for ; Mon, 7 Oct 2019 22:20:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=wavecomp.com header.i=@wavecomp.com header.b="wGI2RSOp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729285AbfJGWUH (ORCPT ); Mon, 7 Oct 2019 18:20:07 -0400 Received: from mail-eopbgr730116.outbound.protection.outlook.com ([40.107.73.116]:58336 "EHLO NAM05-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728654AbfJGWUG (ORCPT ); Mon, 7 Oct 2019 18:20:06 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iitl1K3OvL7pnA4iAUB04GzNNXmJH7dFFZrCbah8Y9JA3vtNKzCG5dgFFb5rjGyqckdO5c+6D5Fr+TSngdxdpINKPB+U7jG2/FwBY8zi8NMDbOGOGTiQ+8LrNGMSIiMuynmGf1Ttb7vU5fN8+VW4iirmm5zb/ilDpOxPZkMoipqo85bfSii4qj1KVo/exrX+r+STon6xEm75Hqu2Zu/+LocoZjg57KUBmjA/KL8rWQtkyRuP8XGtaeNGwaXq5+x91P743BbsQOVdjGsTYptq2rXbDw8IizifmNsE9VQrh3TVxuf0rbJqt6CaCrD3L1AEA3ANh+O3XR3UslLwGjOfTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Rwbha+idgLkB1T5tDkxQCYVHMus56qhZWJ2fGWztFSg=; b=IGVGLl4GzRFWa8RjZ56NnoQdwCJaqI0r/eyhDWS7X51Rvnz8sakmlCG6glIUoEZFlGpOcIZElrF5awRnJelK2mN+/zLfD6wWHvkSZDtHZtM1vnKf+KjFlA1wiYZbjUA+RPycbxR1xSQ6E8GjNzbSnjMsbTAJFZw0yENpjzgpsIA3ZK/8ioBNRJusvlZcQXZkG4+m3T9OINk/fmUWALk+PF0nMneQ2CsUgH+S/lyFl5B8EVC6W960nPmIYWEs9VbtGW0vmEbWyvppjVI04Jpj+PjJaoDcE2qIzRJDeCpi0bpaDkDugj8bFdOnpqxfMPw/zGhJyuZZ6ZV1zGbgJ2pmuw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wavecomp.com; dmarc=pass action=none header.from=mips.com; dkim=pass header.d=mips.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wavecomp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Rwbha+idgLkB1T5tDkxQCYVHMus56qhZWJ2fGWztFSg=; b=wGI2RSOp1xDNx6diiiYHdVRsvd1x1P1TTwqrYW3rRAFLWjSO5KEXEavXIZzz4tItdDWDtELimp9ZtvyAzG28QVKVDIiePXgoEhMiSlcmKnwk4k8lt2zt5TSN05sF+OOg2GU4OVErR1h5N1P1Hb8z6mrM+tZ6Kmm4A0tCI9eHx1I= Received: from MWHPR2201MB1277.namprd22.prod.outlook.com (10.172.60.12) by MWHPR2201MB1310.namprd22.prod.outlook.com (10.174.162.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2327.24; Mon, 7 Oct 2019 22:20:03 +0000 Received: from MWHPR2201MB1277.namprd22.prod.outlook.com ([fe80::3050:9a38:9d8e:8033]) by MWHPR2201MB1277.namprd22.prod.outlook.com ([fe80::3050:9a38:9d8e:8033%5]) with mapi id 15.20.2327.025; Mon, 7 Oct 2019 22:20:02 +0000 From: Paul Burton To: "linux-mips@vger.kernel.org" CC: Paul Burton Subject: [PATCH 3/4] MIPS: cmdline: Remove redundant Kconfig defaults Thread-Topic: [PATCH 3/4] MIPS: cmdline: Remove redundant Kconfig defaults Thread-Index: AQHVfV1dKA/znw7xLEmQ9KKBLUDtWg== Date: Mon, 7 Oct 2019 22:20:02 +0000 Message-ID: <20191007221951.1889661-3-paul.burton@mips.com> References: <20191007221951.1889661-1-paul.burton@mips.com> In-Reply-To: <20191007221951.1889661-1-paul.burton@mips.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR08CA0023.namprd08.prod.outlook.com (2603:10b6:a03:100::36) To MWHPR2201MB1277.namprd22.prod.outlook.com (2603:10b6:301:18::12) authentication-results: spf=none (sender IP is ) smtp.mailfrom=pburton@wavecomp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.23.0 x-originating-ip: [12.94.197.246] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: be9d9ee0-cb5d-4a13-c5c0-08d74b747fab x-ms-traffictypediagnostic: MWHPR2201MB1310: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 01834E39B7 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(376002)(366004)(346002)(39840400004)(136003)(189003)(199004)(1076003)(4326008)(8936002)(50226002)(186003)(44832011)(99286004)(102836004)(6506007)(6916009)(107886003)(76176011)(26005)(476003)(386003)(486006)(478600001)(305945005)(7736002)(25786009)(71200400001)(66556008)(2351001)(66946007)(66476007)(11346002)(71190400001)(66446008)(64756008)(81156014)(8676002)(2501003)(81166006)(5660300002)(446003)(36756003)(2616005)(66066001)(3846002)(316002)(256004)(2906002)(42882007)(52116002)(6436002)(6486002)(6512007)(14454004)(5640700003)(6116002);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR2201MB1310;H:MWHPR2201MB1277.namprd22.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: wavecomp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: nChpxnjAILHGH3nPCJ6Hkfd7DAD3vRgxPdWegSanWLeJgGLGSsShEYdVVjq2VoiGv3HWjSNBteQJtp3dBDL5losbKbsxu9M0hYZFNoUri+DddVc+Fs9c8z+Qo5DgHvls9bbvaGS7aEO6vl2geaobWxJoqfJHXmXilmEpv2bOYyoGbQJa/UqmTzBBCdmtJiqCMdY72RZsglx9zmaeT0QNVndvIozty9DRdiavPAwAncLGNoKDogPRtDkFTGxudSYtSMtbPhk9HIQV5dmGQDIDz722EfyFHeR0mWhENOEDL18YCzWII7hMQyWnLfllZE5cpbUS8HJSvY2GVUY6powxZG31+hnjwdcQPfKJiKPq0kKxpCt8bPM+BdOu1EIFayTS2SenJ1E4VWfEjLk5ujtRJPxRdWOpYuQUBarzxunyrtc= MIME-Version: 1.0 X-OriginatorOrg: mips.com X-MS-Exchange-CrossTenant-Network-Message-Id: be9d9ee0-cb5d-4a13-c5c0-08d74b747fab X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Oct 2019 22:20:02.9196 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 463607d3-1db3-40a0-8a29-970c56230104 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: vlJbQ3+ZWq1D7R4EyJVabIw/tIFa2eqAdzTOJ2KvpsedfzcXnTq95NBpwtCZEVb7G7F8D+5WSrnJjoxykEbDsw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR2201MB1310 Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org CMDLINE, CMDLINE_BOOL & CMDLINE_FORCE all explicitly specify default values that are the same as the default value for their respective types anyway (ie. n for booleans, and the empty string for strings). Remove the redundant defaults. Signed-off-by: Paul Burton Reviewed-by: Philippe Mathieu-Daudé --- arch/mips/Kconfig.debug | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/mips/Kconfig.debug b/arch/mips/Kconfig.debug index 0c86b2a2adfc..93a2974d2ab7 100644 --- a/arch/mips/Kconfig.debug +++ b/arch/mips/Kconfig.debug @@ -32,7 +32,6 @@ config USE_GENERIC_EARLY_PRINTK_8250 config CMDLINE_BOOL bool "Built-in kernel command line" - default n help For most systems, it is firmware or second stage bootloader that by default specifies the kernel command line options. However, @@ -53,7 +52,6 @@ config CMDLINE_BOOL config CMDLINE string "Default kernel command string" depends on CMDLINE_BOOL - default "" help On some platforms, there is currently no way for the boot loader to pass arguments to the kernel. For these platforms, and for the cases @@ -68,7 +66,6 @@ config CMDLINE config CMDLINE_OVERRIDE bool "Built-in command line overrides firmware arguments" - default n depends on CMDLINE_BOOL help By setting this option to 'Y' you will have your kernel ignore From patchwork Mon Oct 7 22:20:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Burton X-Patchwork-Id: 11178577 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AF90D17EE for ; Mon, 7 Oct 2019 22:20:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8351420867 for ; Mon, 7 Oct 2019 22:20:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=wavecomp.com header.i=@wavecomp.com header.b="F/UUeCIJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728654AbfJGWUJ (ORCPT ); Mon, 7 Oct 2019 18:20:09 -0400 Received: from mail-eopbgr730116.outbound.protection.outlook.com ([40.107.73.116]:58336 "EHLO NAM05-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728980AbfJGWUJ (ORCPT ); Mon, 7 Oct 2019 18:20:09 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ehUdaqv7aTn8TtV+rX4vp7ixNLCVV63tdbCGfVahdIB5eL11ODnPq+jydN3W702HZLRiKNrK9phwzkiB7tZmV3aE7EmmGcVsXjz8+omuOv5AfN/Pz/Onhom4FiDhZZ7fRxLPuhJDof7IUWn2a6LQ/hIs+02ehQLg5AqBJmeh1/VgKtVJXHjxBlHh/nLr2sVJpxny9L9KuAzg9cLvjz+rLToXMSmdOVG/HCZuOeFPIEig1JX5MwsFJtoOzsbUnXMdvHmi/xe/T5ep/MauMT/QylcpdcNNeGG4jPB1JePh3PBdbwM1x98zqQT/VBuNd7hOcGJBXFGpcEKO3zMtFv6GTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JXUU+fDlHad4lkTEmYYUBb6BLpvdlmJOC53qJ8jrWnE=; b=QT99LUc6RajHWG+KbwvKbjBvLzXBLz2+OyzVDVM/puoMIj0MRfxewfomjsYRAtpyhygDgHPCf5nb+OSAEZesJiMxCtHQSbJVpDMMJIcfrk3kPOysFIF7SI7aEeCLWr98jRLh4JGBlfaEXuVkz/2WQGdOlx/0dbSAv51Myl8SI5wxsF/DJ9vh3WpSJ/a2N26hVKR+s7i7BP6jdZssSl5YX/jBbpcnOTgF+ODWPbQqlBznSqP0vfhTcmFEkADajenLZktGMiFju8V8CCZlLtLcxAQp5iaXdMjY8X5KguDwL1sV7X3k19vfCeewA6/OQ6MWx8izcot6glBF5PVRbM2DrA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wavecomp.com; dmarc=pass action=none header.from=mips.com; dkim=pass header.d=mips.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wavecomp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JXUU+fDlHad4lkTEmYYUBb6BLpvdlmJOC53qJ8jrWnE=; b=F/UUeCIJ4c2Uuk8nWXh3ZbGNhDD08/5XJZ8HPdvGVO+ZVr4MMXmMgSFqvbtV/tAezOy/038JZp7vyjc7dY/pea2eavjYW7hM4FJUfl8oAOfnRpxHhmd8UIMjDFpLXqB8W7+edGT+HPZHuJJqTvBSJo2NTqJYymQbCgPpnDGjTnA= Received: from MWHPR2201MB1277.namprd22.prod.outlook.com (10.172.60.12) by MWHPR2201MB1310.namprd22.prod.outlook.com (10.174.162.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2327.24; Mon, 7 Oct 2019 22:20:04 +0000 Received: from MWHPR2201MB1277.namprd22.prod.outlook.com ([fe80::3050:9a38:9d8e:8033]) by MWHPR2201MB1277.namprd22.prod.outlook.com ([fe80::3050:9a38:9d8e:8033%5]) with mapi id 15.20.2327.025; Mon, 7 Oct 2019 22:20:04 +0000 From: Paul Burton To: "linux-mips@vger.kernel.org" CC: Paul Burton Subject: [PATCH 4/4] MIPS: cmdline: Clean up boot_command_line initialization Thread-Topic: [PATCH 4/4] MIPS: cmdline: Clean up boot_command_line initialization Thread-Index: AQHVfV1eaofHWXwMI0K1hqDPjSCNNg== Date: Mon, 7 Oct 2019 22:20:04 +0000 Message-ID: <20191007221951.1889661-4-paul.burton@mips.com> References: <20191007221951.1889661-1-paul.burton@mips.com> In-Reply-To: <20191007221951.1889661-1-paul.burton@mips.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR08CA0023.namprd08.prod.outlook.com (2603:10b6:a03:100::36) To MWHPR2201MB1277.namprd22.prod.outlook.com (2603:10b6:301:18::12) authentication-results: spf=none (sender IP is ) smtp.mailfrom=pburton@wavecomp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.23.0 x-originating-ip: [12.94.197.246] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 6a607064-b8b7-41f8-8a2c-08d74b748065 x-ms-traffictypediagnostic: MWHPR2201MB1310: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 01834E39B7 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(376002)(366004)(346002)(39840400004)(136003)(189003)(199004)(1076003)(4326008)(8936002)(50226002)(186003)(44832011)(99286004)(102836004)(6506007)(6916009)(107886003)(76176011)(26005)(476003)(386003)(486006)(478600001)(305945005)(7736002)(25786009)(71200400001)(66556008)(2351001)(66946007)(66476007)(11346002)(71190400001)(66446008)(64756008)(81156014)(8676002)(2501003)(81166006)(5660300002)(446003)(36756003)(2616005)(66066001)(3846002)(316002)(256004)(2906002)(42882007)(52116002)(6436002)(6486002)(6512007)(14454004)(5640700003)(14444005)(6116002);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR2201MB1310;H:MWHPR2201MB1277.namprd22.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: wavecomp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 66gwQxvmQJuc+z5nkoSxZDXmDGI0fTjOIk9PRQCJwQbMnfqrZJSmIWhK/hTl1LqtGNrbeyqq2Xcq+uS9ujgo7ATlfVXozhcp7Rf9ug5rqoZs22sJzRXxZ6hASnR9BzXU6iWWRpFqkhDWr+M/iwBosemrH6ZgNbXQJx5vM00XYeSGGdzFrBq/ygju6WKY+EcrtOTa3fZeNnl6jEG7OhfmNdevHl3THyWZWtN29lLfDR24+8UzeNRXFWJMNHnq3GnkcmXq7z5IKRgn7UWuLul98vVWi0DI9lumh1lw5iJ+yr9zdt7/7m9j+fU3MBAZY46d5uVe3ta5iPbZjBgcT8lLwdR1meCcjJnXcrfcWDw9+ZAIF/KjuBr45C4+c7GgJPPaOLA3urxC3/2ZL47VwhPPBrjlhdw3w66hQ9zu5jfGtpo= MIME-Version: 1.0 X-OriginatorOrg: mips.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6a607064-b8b7-41f8-8a2c-08d74b748065 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Oct 2019 22:20:04.0501 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 463607d3-1db3-40a0-8a29-970c56230104 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: +Ykji6DXiMCYNr6sT/lmfPTxlGEeofE8UrKGflg/8IE1TZw7iJEezm7bKUlwL0PmilqgCdMuGWBbGz/rPXGNLA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR2201MB1310 Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Our current code to initialize boot_command_line is a mess. Some of this is due to the addition of too many options over the years, and some of this is due to workarounds for early_init_dt_scan_chosen() performing actions specific to options from other architectures that probably shouldn't be in generic code. Clean this up by introducing a new init_boot_cmdline() function that simplifies the initialization somewhat. The major changes are: - Because init_boot_cmdline() is a function it can return early in the CONFIG_CMDLINE_OVERRIDE case. - We clear boot_command_line rather than inheriting whatever early_init_dt_scan_chosen() may have left us. This means we no longer need to set boot_command_line to a space character in an attempt to prevent early_init_dt_scan_chosen() from copying CONFIG_CMDLINE into boot_command_line without us knowing about it. - Indirection via USE_PROM_CMDLINE & USE_DTB_CMDLINE macros is removed; they seemingly served only to obfuscate the code. - The logic is cleaner, clearer & commented. Two minor drawbacks of this approach are: 1) We call of_scan_flat_dt(), which means we scan through the DT again. The overhead is fairly minimal & shouldn't be noticeable. 2) cmdline_scan_chosen() duplicates a small amount of the logic from early_init_dt_scan_chosen(). Alternatives might be to allow the generic FDT code to keep & expose a copy of the arguments taken from the /chosen node's bootargs property, or to introduce a function like early_init_dt_scan_chosen() that retrieves them without modification to handle CONFIG_CMDLINE. Neither of these sounds particularly cleaner though, and this way we at least keep the extra work in arch/mips. Signed-off-by: Paul Burton --- arch/mips/kernel/setup.c | 87 +++++++++++++++++++++++++++------------- 1 file changed, 60 insertions(+), 27 deletions(-) diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index 273b26a81935..d3e2ae010859 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c @@ -538,8 +538,65 @@ static void __init check_kernel_sections_mem(void) } } -#define USE_PROM_CMDLINE IS_ENABLED(CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER) -#define USE_DTB_CMDLINE IS_ENABLED(CONFIG_MIPS_CMDLINE_FROM_DTB) +static int __init cmdline_scan_chosen(unsigned long node, const char *uname, + int depth, void *data) +{ + const char *p; + int l; + + if (depth != 1 || !data || + (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0)) + return 0; + + /* Retrieve command line */ + p = of_get_flat_dt_prop(node, "bootargs", &l); + if (p != NULL && l > 0) + strlcpy(data, p, min(l, COMMAND_LINE_SIZE)); + + return 1; +} + +static void __init init_boot_cmdline(char **cmdline_p) +{ + /* + * If CMDLINE_OVERRIDE is enabled then initializing the command line is + * trivial - we simply use the built-in command line unconditionally & + * unmodified. + */ + if (IS_ENABLED(CONFIG_CMDLINE_OVERRIDE)) { + strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); + return; + } + + /* + * If we're configured to take boot arguments from DT, look for those + * now. Note that we clear boot_command_line, undoing anything + * early_init_dt_scan_chosen() did to boot_command_line. + */ + boot_command_line[0] = 0; + if (IS_ENABLED(CONFIG_MIPS_CMDLINE_FROM_DTB)) + of_scan_flat_dt(cmdline_scan_chosen, boot_command_line); + + /* + * If we didn't get any arguments from DT (regardless of whether that's + * because we weren't configured to look for them, or because we looked + * & found none) then we'll take arguments from the bootloader. + * plat_mem_setup() should have filled arcs_cmdline with arguments from + * the bootloader, so we simply copy them here. + */ + if (!boot_command_line[0]) + strlcpy(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE); + + /* + * If the user specified a built-in command line, we append it to + * boot_command_line here. + */ + if (IS_ENABLED(CONFIG_CMDLINE_BOOL) && builtin_cmdline[0]) { + if (boot_command_line[0]) + strlcat(boot_command_line, " ", COMMAND_LINE_SIZE); + strlcat(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); + } +} /* * arch_mem_init - initialize memory management subsystem @@ -567,36 +624,12 @@ static void __init arch_mem_init(char **cmdline_p) { extern void plat_mem_setup(void); - /* - * Initialize boot_command_line to an innocuous but non-empty string in - * order to prevent early_init_dt_scan_chosen() from copying - * CONFIG_CMDLINE into it without our knowledge. We handle - * CONFIG_CMDLINE ourselves below & don't want to duplicate its - * content because repeating arguments can be problematic. - */ - strlcpy(boot_command_line, " ", COMMAND_LINE_SIZE); - /* call board setup routine */ plat_mem_setup(); memblock_set_bottom_up(true); -#if defined(CONFIG_CMDLINE_BOOL) && defined(CONFIG_CMDLINE_OVERRIDE) - strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); -#else - if ((USE_PROM_CMDLINE && arcs_cmdline[0]) || - (USE_DTB_CMDLINE && !boot_command_line[0])) - strlcpy(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE); - -#if defined(CONFIG_CMDLINE_BOOL) - if (builtin_cmdline[0]) { - if (boot_command_line[0]) - strlcat(boot_command_line, " ", COMMAND_LINE_SIZE); - strlcat(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); - } -#endif -#endif + init_boot_cmdline(cmdline_p); strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); - *cmdline_p = command_line; parse_early_param();