Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp1522888lqo; Sun, 12 May 2024 06:27:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUl5FxVYn2ZWGFBDXte21nf4ekngAMbrr2jUV61L0EStsbh/ezMyAgcteMCBtKtmPVbmLL/VBepaCWQu/6MvXVxIU6Fr/FOa9PPKunXgA== X-Google-Smtp-Source: AGHT+IGOOTTBqJZgjhTs/taT6pmBf8JQuXaCtMukH7YsES6CrcbD+6/sKOEmdCnjqFvUU7c0SrRm X-Received: by 2002:a05:6a20:2d09:b0:1af:c677:4adc with SMTP id adf61e73a8af0-1afde0a8dd2mr9172563637.13.1715520438011; Sun, 12 May 2024 06:27:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715520437; cv=pass; d=google.com; s=arc-20160816; b=GqcY1zjcEj6tATOMyWH7bS4aE+WUrS9zWi7kK/TPyX7Hm9O/PGLLH57lATcM0zu5DI xfFTzWaSX6N9c0zwJlYWMigZjQXktQ8jjE5i5jXgiSiZ/QBFZi90gagPQAyp1jU+y+YI 6BhyPkfdl2XYhZkJeThOCLS3xcGJXPDNM69SVlNA/nDmr0mTXNNwRqmczxinTjfDBGCO ZICjjwmyV3xVNUwLViDytXB7hOYfUxlgg6QdkgwzZ/Gwz8iHchwIZpLNBQlToS7mZaPw IziUpnyELk3ZwdykjzuaghayvJ5UgdFFQ+ai10Kq6jsbemS2CadhhdC2d5YyDLuHYBLT mvFQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=BVMmxV0x3lE9AAJXo4i0SZvZEcFwdqyDwVz0Ae897gs=; fh=LhwJpm4EOTN1OaFvTswRDlXSw3h2ksNBQzLUQRyFUNk=; b=Wc8IT2sZCHKQq+cAgFJTwbul2p8D3aFDxrtCKihA5y37KSiZjh/p4y5oUlyhJ1pCLG 1SVz2aioQWZk1zuQJzDr1e/KGoJ7KL1k0R//E1Mc3PI9uUErTWMFVnnCMKeh0U4H1CgB G13Wu8GBBAglyRTDW7lTUUMK4vpcxOr6Yhpb8ZriZEdnsOofhj714BTvTLPelv+2Pyqn hSqAEhmJ8wL6RmyZi2sHchiRgF49nj42rIVenoWJCt4buJ+zRfYC5u/Zk/khvpFK/csP 4rerdXcrOCKNs18Ufxn02T6ruszxw1LUIC/g4JyKnOzTpWW/+Wu2DUlTco3P2nDBN9qj 8XdA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=N29LfkAs; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-176889-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176889-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-63412a4dd4fsi5422627a12.728.2024.05.12.06.27.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 May 2024 06:27:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-176889-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=N29LfkAs; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-176889-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176889-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 91137B21A54 for ; Sun, 12 May 2024 13:26:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0036F224FA; Sun, 12 May 2024 13:25:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="N29LfkAs" Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6ED4B383A9; Sun, 12 May 2024 13:25:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715520332; cv=none; b=luiZU7+6+CIuxgLXm5JU/KyGuqE++0XSjlPvKDu2vVlwmYzZz0BAMkUiy08CaE9DQAjwFGRtYeqVCUlGx6LpkEh8r6HS++aqiGppnI0nulbqLs+Yoo00w1gEM8j5YxH+jgiySjY8qD0hmbv29rx6Hu/NgsZ5rZKpuUQlQUA/MGk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715520332; c=relaxed/simple; bh=J+g8IFFwy/vjVlcPhULbDtQ2VliUzl+7eSs2atsxppo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aBDECtxzE4A7Lqe9aKvLOC7RgS0UL9h828Cw7jJQXfuxULvpYroIQBjlMgULXPzWmI0+elJjDRHVn0OLgoVCWn1O3d+gvmhiaPSJHaVSHaEek660YBJsSh5GA9wkH78CDp8GX5KZ1CK4xBilHpqyEAsr4pQJeO/rv185SWZHivo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=N29LfkAs; arc=none smtp.client-ip=209.85.221.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-34da4d6f543so2474888f8f.3; Sun, 12 May 2024 06:25:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715520329; x=1716125129; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BVMmxV0x3lE9AAJXo4i0SZvZEcFwdqyDwVz0Ae897gs=; b=N29LfkAsr/kAgpVCsgMQ7dMoFKgENWriyGYCSxUIWoRkyahowO9gnJqf2V/HuJstH6 /1xnaEZ2IDJ4eLp1a5PKUmPoX42MLwxUET1hvP/KIO5W4HJVFnm+uCqPmxml9XuASWGl wCOx4aeRfBzDvJhnKfLyYwc8Md/y6Z25ftaBeCinc9KWLv0fbSYPzQvU/F/8+2zHXFkn 1srgbp2FvsyK5J9qPkWrm2n+bmhEZTynlEoF1W0LDcC/TquHM3iHRwmkd0O9G/OnVjLa 4I8ebT1lLNLPRWYoUgKkbtJ85C3JwwbspblA5UwhBtHmWxcbMWmq4Mv/mHFLw/21VGtx sZoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715520329; x=1716125129; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BVMmxV0x3lE9AAJXo4i0SZvZEcFwdqyDwVz0Ae897gs=; b=teKfkUNBtMOWYYLK/a4SHwbkcybFmQ17LsZDGrQPRIHX+50TGWZpvIiZ3Jtamky7Tn K+pZ2XOW2iKGYdx7H3lVf507wYsOX4Zgfn1g7WmPqFyiav3a3N3HuuSb+RbfFgXYyPmp sKwSCu5Dsfobs1TBKpa3Vo4oEEgGEd+T9tuZ4WKCQgD2DefSXGAcvOzi9OjffV7Vd7+B iDPosJpMh4wQo5zvTNSmTfuXjzgcEnIeslfzbppDKEZaD7mW7QvRpaRo425Q+YRG4vrO B0RvKVataEhot1yvcJqhldqTJuYo3poVsA4uMMhTVb6y3ztKQ6ROFzoethyOvzhUhMhh kIRg== X-Forwarded-Encrypted: i=1; AJvYcCX1PIDf54oKbuFex7hwmcOSiNzMbij543ZhHTLtaRUOtus4LSXxmHJeh/lClbS9GZFwIMbzMzUcbukAloViJ+Tv2nMzqzKgNPtS1Bp9B+Uw+wLGPzNf2C5mDvmEcVKYiC/AlIMIWPuQoG5J0eBiRa3dHnxgWiWVEdZvewrKDPB1OliimGc= X-Gm-Message-State: AOJu0Yz6JBG+63mReXg2mWty4IC2OHBYU5GcMVcDy+BOGDLVGAGqrTyW /qEQAeCIOCBnyvAyyCy/0UUPiKx/DteLRxcolnqHoHE2CO+eqjsm X-Received: by 2002:a05:6000:12d0:b0:34d:bbaf:27cf with SMTP id ffacd0b85a97d-3504a96a4b7mr5028390f8f.51.1715520328598; Sun, 12 May 2024 06:25:28 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-3502b79bd09sm8822468f8f.14.2024.05.12.06.25.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 May 2024 06:25:28 -0700 (PDT) From: Christian Marangi To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Thomas Bogendoerfer , Saravana Kannan , Arnd Bergmann , Helge Deller , Javier Martinez Canillas , Baoquan He , Thomas Gleixner , Jiaxun Yang , David Bauer , Liviu Dudau , Serge Semin , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org Cc: Christian Marangi Subject: [PATCH 4/4] MIPS: add bootargs-override property Date: Sun, 12 May 2024 15:25:11 +0200 Message-ID: <20240512132513.2831-5-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240512132513.2831-1-ansuelsmth@gmail.com> References: <20240512132513.2831-1-ansuelsmth@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: David Bauer Add support for the bootargs-override and bootargs-append property to the chosen node similar to the one used on ipq806x or mpc85xx. This is necessary, as the U-Boot used on some boards, notably the Ubiquiti UniFi 6 Lite, overwrite the bootargs property of the chosen node leading to a kernel panic on kernel loading (hardcoded root path or other not compatible thing). Signed-off-by: David Bauer [ rework and simplify implementation, add support for bootargs-append ] Signed-off-by: Christian Marangi --- arch/mips/kernel/setup.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index 12a1a4ffb602..725e3f19f342 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c @@ -538,11 +538,23 @@ static int __init bootcmdline_scan_chosen(unsigned long node, const char *uname, (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0)) return 0; - p = of_get_flat_dt_prop(node, "bootargs", &l); + /* + * Retrieve command line + * bootargs might be hardcoded and overwrite by bootloader on + * kernel load. + * Check if alternative bootargs-override is present instead + * first. + */ + p = of_get_flat_dt_prop(node, "bootargs-override", &l); + if (p == NULL || l == 0) + p = of_get_flat_dt_prop(node, "bootargs", &l); if (p != NULL && l > 0) { bootcmdline_append(p, min(l, COMMAND_LINE_SIZE)); *dt_bootargs = true; } + p = of_get_flat_dt_prop(node, "bootargs-append", &l); + if (p != NULL && l > 0) + bootcmdline_append(p, min_t(int, strlen(boot_command_line) + l, COMMAND_LINE_SIZE)); return 1; } -- 2.43.0