Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2264000imm; Fri, 7 Sep 2018 13:30:47 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZcQkRRYpB4YRbZaqoEj4T2lEA3tzlbld0qo9yANPjNlBLkTGGBfwXZ1C0mfiFRnJUkqNQO X-Received: by 2002:a63:706:: with SMTP id 6-v6mr9933383pgh.137.1536352247359; Fri, 07 Sep 2018 13:30:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536352247; cv=none; d=google.com; s=arc-20160816; b=k9xIJWqYYqMY3tnULX6UN37KUt+V1hvt4G92XakWshW6BQA4WB5Z4Jvf2sxc+lEbta epCJLZSNgr3MRK6Yb9mV+u9hZXl8xJDnXFpkVrde4Lal37gl0UO2FMM18nICNIhlrwxF /qku+NTYP3R5T+6VO76bEHyQWCMW+Fkma/ur7TDhHT4XrkFA5Jnqvwgc2mCA7RIhG0U4 hCUkKND9Jbq5Rt8BAZFOazw+madoqctrD14NT4MLHzwByRLnwTbMyewXJrT31vHSHpy9 mBnJY4NiUqaQHfUe+6ENCQf5IyBxGW8ePV9Dh9x7KZ/06pGZamD75Ivd8KxPEUoyBhO5 w4kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=qaTN1sLAoeF2hUo9r8Pc8zfcetm74aPR5ccLPi03ij0=; b=EU2seiim8hJJXkK3wh98Rb796fDNwbeyj4xUbEzAEQM+RyYHsBBoVhz/PEGOAv4qr2 3ImH6+RT8pFfErxno/GT/rO396uSC+10Ud7FaRtoMIQdiG4TQNSe8ncRLMWfNQPsI8pz XtYaKUX/dFQMW7Kr8FGZdkhz5WVw/C3cMpOJY/Zyh5vocRAle9dFHb+6sBryOBAOFxIQ Lq24g6mhynxGVqVMeZhFHa8O+GDUEIgiS5EihjZ3PN5D/3gJ2e1x4EiK/3Jv9ix2Tj11 +95/x/2CkWp0TY0oaPzX4XopNOH9BWzwv3upPQc0Sn9JAAUo8LPkaIzpS/Pkp0kn9T5D 39dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0SUTw9D9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p21-v6si9317790pgd.56.2018.09.07.13.30.31; Fri, 07 Sep 2018 13:30:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0SUTw9D9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727636AbeIHBLx (ORCPT + 99 others); Fri, 7 Sep 2018 21:11:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:55910 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726125AbeIHBLw (ORCPT ); Fri, 7 Sep 2018 21:11:52 -0400 Received: from mail-qt0-f181.google.com (mail-qt0-f181.google.com [209.85.216.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EC8B220879; Fri, 7 Sep 2018 20:29:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1536352156; bh=qaTN1sLAoeF2hUo9r8Pc8zfcetm74aPR5ccLPi03ij0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=0SUTw9D9BeFNMT5o0w5IOq9Qq4GPH8asGBAGCSdLD+82/wgI21oSiel29VgRO7o9r TFsXjXPpeSVNZrPUwwtffzR4uEBF6N0e3nhzggKjy3fb8AcNX6hRW8HnqH2TTyaKpG TuG9BaZggjEc1PCQ62qDD99KtyTZXb6C7kT18FJg= Received: by mail-qt0-f181.google.com with SMTP id g44-v6so17556776qtb.12; Fri, 07 Sep 2018 13:29:15 -0700 (PDT) X-Gm-Message-State: APzg51BB2CPqYNI69FvNjicNMdBlrAAc8hgHBvBCJbP8zHVCcNwv0c7R CZP/MB1I9OECtTcNQ4zAt9BUh2AaSbas2M5Qbw== X-Received: by 2002:a0c:db87:: with SMTP id m7-v6mr7110948qvk.90.1536352155200; Fri, 07 Sep 2018 13:29:15 -0700 (PDT) MIME-Version: 1.0 References: <20180907185414.2630-1-paul.burton@mips.com> In-Reply-To: <20180907185414.2630-1-paul.burton@mips.com> From: Rob Herring Date: Fri, 7 Sep 2018 15:29:03 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] of/fdt: Allow architectures to override CONFIG_CMDLINE logic To: Paul Burton Cc: Linux-MIPS , "linux-kernel@vger.kernel.org" , devicetree@vger.kernel.org, Frank Rowand , Jaedon Shin , Mathieu Malaterre , stable Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 7, 2018 at 1:55 PM Paul Burton wrote: > > The CONFIG_CMDLINE-related logic in early_init_dt_scan_chosen() falls > back to copying CONFIG_CMDLINE into boot_command_line/data if the DT has > a /chosen node but that node has no bootargs property or a bootargs > property of length zero. The Risc-V guys found a similar issue if chosen is missing[1]. I started a patch[2] to address that, but then looking at the different arches wasn't sure if I'd break something. I don't recall for sure, but it may have been MIPS that worried me. > This is problematic for the MIPS architecture because we support > concatenating arguments from either the DT or the bootloader with those > from CONFIG_CMDLINE, but the behaviour of early_init_dt_scan_chosen() > gives us no way of knowing whether boot_command_line contains arguments > from DT or already contains CONFIG_CMDLINE. This can lead to us > concatenating CONFIG_CMDLINE with itself, duplicating command line > arguments which can be problematic (eg. for earlycon which will attempt > to register the same console twice & warn about it). If CONFIG_CMDLINE_EXTEND is set, you know it contains CONFIG_CMDLINE. But I guess part of the problem is MIPS using its own kconfig options. > Move the CONFIG_CMDLINE-related logic to a weak function that > architectures can provide their own version of, such that we continue to > use the existing logic for architectures where it's suitable but also > allow MIPS to override this behaviour such that the architecture code > knows when CONFIG_CMDLINE is used. More arch specific functions is not what I want. Really, all the cmdline manipulating logic doesn't belong in DT code, but it shouldn't be in the arch specific code either IMO. Really it should be some common kernel function which calls into the DT code to retrieve the DT bootargs and that's it. Then you can skip calling that kernel function if you really need non-standard handling. Perhaps you should consider filling DT bootargs with the cmdline from bootloader. IOW, make the legacy case look like the non-legacy case early, and then the kernel doesn't have to deal with both cases later on. Rob [1] https://lkml.org/lkml/2018/3/14/701 [2] git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git dt/cmdline