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=-15.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 478F0C48BE0 for ; Fri, 11 Jun 2021 17:24:02 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 550906124C for ; Fri, 11 Jun 2021 17:24:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 550906124C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=seco.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5E67380772; Fri, 11 Jun 2021 19:23:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=seco.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=secospa.onmicrosoft.com header.i=@secospa.onmicrosoft.com header.b="TUEK+qDe"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6738D8060C; Fri, 11 Jun 2021 19:23:57 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2062c.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e1a::62c]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8A5048060C for ; Fri, 11 Jun 2021 19:23:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=seco.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sean.anderson@seco.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dyUQX8yd1rP6gLEIXV/+XBkQFDFUcWQR4InS7hvPZOpt0jKCaOwWbCGMzoeri/zqVUZ4bVeRjU16BmjFy0H8dq2EEFP0f8UiK5YsJnIWJFCP409bY23BY/6pN72nKbNjAQ0SbqGNtABZDzAI0nJY6IugY7bNaYGumxCj5pU1c/H8LEcBS/UnZPa0Kn/Ucncxr0ZNc3+N9jeUNH2EfWiUW2VLSxiZ9nnjzGaTvMHBUKXyid7iqSXdy2YQes2JPci5CklLzm+7PrmeZedYBsWcq7qJDxUh7gg006wlBAlkovwMdL+7rZfyqipafdzOKQR7WplWY+bBVg/uydgvsEBTjg== 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=A/dYVDdUoWo/AB7RAsc1j40oNBnXbiku2JFHFLiZWjU=; b=cVm8s7ghUpmcaH4VYyXtmUuhDVvj0M5SGMR+8KsCSng+xK7xlUcWL8PrW6s/OHKs2NQYZzsvbSP2aA4LdcEcn+ALjE0+vhJAn6TJrg8g/zJ6Uhg1W/tMc1mlc63pVkEswOVVEzY1ut0gcr/xAKKFm7i9tJ3rMyPwkpmpYyO7hu6ZZ4La33nBmSGPXVtxUpv8ExsdJbNJgQYfcUtSVuk61k6meWRLLfJqkmoXYjsEkUHUADLDCgqHLnJZO5vSLgwF4qLKl/zPpkzennTLEd0gVF+mZJs4LYhHTY5TA9Qovsv1mYlFmdO1IoWcRdGf56IX4FOP3DZmHe4amefCRP1A5Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secospa.onmicrosoft.com; s=selector2-secospa-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=A/dYVDdUoWo/AB7RAsc1j40oNBnXbiku2JFHFLiZWjU=; b=TUEK+qDei4d311CFiADqRYh+Yx5ZE8umOB4cQFTfB6pq1uyhDTwXhrDWYhngN8Mg/OQ8q/I29EZ93hms04GakPW+4XEaKeoggBlHv+zvM/K4A219E+Nyb0m9hwH5kUa2L1jClLoFZnrotzzW4RcbFQBACfNUbGsveAVBqq2XOhs= Authentication-Results: lists.denx.de; dkim=none (message not signed) header.d=none;lists.denx.de; dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4523.eurprd03.prod.outlook.com (2603:10a6:10:19::27) by DB6PR0302MB2824.eurprd03.prod.outlook.com (2603:10a6:4:ad::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.29; Fri, 11 Jun 2021 17:23:53 +0000 Received: from DB7PR03MB4523.eurprd03.prod.outlook.com ([fe80::40d5:3554:c709:6b1b]) by DB7PR03MB4523.eurprd03.prod.outlook.com ([fe80::40d5:3554:c709:6b1b%5]) with mapi id 15.20.4219.022; Fri, 11 Jun 2021 17:23:53 +0000 Subject: Re: [PATCH] fdtdec: fdtdec_get_aliases_highest_id: skip aliases to disabled nodes To: Tim Harvey Cc: Simon Glass , U-Boot Mailing List References: <20210416213041.27189-1-tharvey@gateworks.com> From: Sean Anderson Message-ID: Date: Fri, 11 Jun 2021 13:23:43 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [50.195.82.171] X-ClientProxiedBy: MN2PR08CA0003.namprd08.prod.outlook.com (2603:10b6:208:239::8) To DB7PR03MB4523.eurprd03.prod.outlook.com (2603:10a6:10:19::27) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [172.27.1.65] (50.195.82.171) by MN2PR08CA0003.namprd08.prod.outlook.com (2603:10b6:208:239::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21 via Frontend Transport; Fri, 11 Jun 2021 17:23:52 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 692226f1-0358-4ff2-d53f-08d92cfdaf91 X-MS-TrafficTypeDiagnostic: DB6PR0302MB2824: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cHGU7cUYl3PiPgKSDa+OKsuFD4NS23bDoiNLaCp1ja+V+4dPJyl69WiyovMI8aKZcM9snh22A2JiiwSVlhj8ioq8soLpFRWJFYK3FJQ6RkRnIj3pLAxW8pucU16P9StQKHKAKBP3K89MrmKOHscQb+J0tz7d6eGpePYTt+4Bzll6T0ty/OsyYmuNgS3s2Pagr7UArI0Nra7SBM0hkluf55hyQJuTdvWN1pVMfIeG+ke2+wleQr8rCRNVTr3/nmkNXUruHWu9kjrp42AppqndjY7e0iNlk4biQWlxmvriDkgb+1bmNba5TnVZEWSpgTInhvorBrccw/6PJAWjYkutTHGBDqprw/BTI/zZ7+Oapu3WzOOS9w1rsU4BSIMFjLz5X2y9wB3RevblW18Bi+lXoCto7Xk2rqAZpQoq5BJYUr+UjATihd2i4tLEj+7tfjTOVEMOyi6zj/vI+cQ4WNuBRXgt+vCd/ZlgaybO/3EwYhXRHsOs6Oe6UjXq5fYsOAvb+z69Mt9LPNn1Kt8FKfK8FtqVLl6b7EQRGIJZ5gB2Ik2VqplE73/KvE2bcmHInru9VNzBgmG7aAdR5dcDF6/4AAX7YfvWj4z8DbLQrmhqDoQKt3TmsQrA3JwpRCwQnvxOA9tNOU8aGDUvu5h9qP1LupuvGvgUJVK/K//kafR8ZPYRU/yNqOXni/JqBLf/192MOMmrdZMDBTkN5PW5QZlidGjurrl4GQAO/EuMuXV9Bhjb0L/EGJp3Q18MjKQabEDm6th3FKEiMlCRd+rWErkEMw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB7PR03MB4523.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(31686004)(186003)(6916009)(44832011)(16526019)(5660300002)(8676002)(2616005)(52116002)(6486002)(66946007)(16576012)(54906003)(66476007)(66556008)(31696002)(8936002)(498600001)(86362001)(36756003)(6666004)(38100700002)(83380400001)(2906002)(956004)(26005)(38350700002)(4326008)(53546011)(43740500002)(45980500001)(473944003)(414714003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ZTQ0MlFJbVBjYTZ0cFptTzFUUXljS01ZZHhFQVViMTVROXYvY0JZbGxCci9U?= =?utf-8?B?Z1BCeWpqYjl5dHZacFJGZ1ZRVDNJQk1SRi9ZdXprWndoVk9QN3NtWklYa2x6?= =?utf-8?B?SVlDZWIzdnRTY05qSGFuNHhLZ3NHaGpPTU9GT2p5RVdCRkFtUmxvTzVFQ1hI?= =?utf-8?B?T2R1U1p6MVhTVjFJN0ExZ1VpbXZrdGIrSWJSRWpFZW13NnNBb3RxL29OVTB5?= =?utf-8?B?QjBsUmUzTmlYcGpOS2JqbWF4NW9wY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VRPTk9IWUtlTzhjMnl6ZGE2Rlg0dWZiMTBZUlV0?= =?utf-8?B?SDdQZGVkLzV2R0h2VUVtdUxoMFFiSVpKV3RxZ3Y3YXpOZ2VXWDhzTHEzTFJ4?= =?utf-8?B?dlVaWFJJQ2R2WGVyUU45eFc1bDlLazRRUzVYemdxZFl5cU15OFJFMTcyNC9l?= =?utf-8?B?aURkK2czL1VIUVYzRzQySUNWSG5IODFjODRSVG9SOWtHK1dXZHRpN1ZLeWxz?= =?utf-8?B?K3ZNcDVLaUJtc1lxQXdQc0V0dDk0UmFyZXgvaDZGQUN5eUx3bEdtbC9LT2FQ?= =?utf-8?B?dUc4TTBhWFROZWxSek5XdHB1V0trUkl0b1NSVFhjczBLcDJrMGtBcC96UEls?= =?utf-8?B?VmVzcjg5aFZiTGlCcy9pek1BR2t5WlUzUFNXOW5OakdrRE1vb280blNqaWpa?= =?utf-8?B?MEluNUZNN0RvYTAySnZ6RnBwTDVPZWVaWjNkK2NoQTVPc3dDZERNUHN3SFI0?= =?utf-8?B?MExQQjdkN0MxZGNqQ0E3aUNYejhJaEQzYkRtZitWZEFCZXRkVDFoQ0ZpcGt5?= =?utf-8?B?Zko2YUNCTTVXaUJTMTJmQmRCWldYVGdzMzZuMFZabVVRbGlVaDNlNkwzbTNY?= =?utf-8?Q?Fs0tk4J6czpIfmhUy977OARDaLUhefTVGAXwq33?= X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 692226f1-0358-4ff2-d53f-08d92cfdaf91 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4523.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jun 2021 17:23:53.4513 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: cv3y5UI0e/CijweHE/x5KH5PfmtD3AcPZj9qmaWk7Za55OENirifuDk8p7Sc4OYNUfTns9cNh7ropPNuFZcqVw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0302MB2824 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On 6/11/21 1:16 PM, Tim Harvey wrote: > On Fri, Jun 11, 2021 at 10:09 AM Sean Anderson wrote: >> >> >> >> On 6/11/21 12:32 PM, Tim Harvey wrote: >> > On Thu, Apr 29, 2021 at 9:48 AM Tim Harvey wrote: >> >> >> >> On Thu, Apr 29, 2021 at 9:10 AM Simon Glass wrote: >> >>> >> >>> Hi Tim, >> >>> >> >>> On Fri, 16 Apr 2021 at 14:30, Tim Harvey wrote: >> >>>> >> >>>> When looking for an alias with the highest id skip aliases for nodes >> >>>> that are disabled. >> >>>> >> >>>> Signed-off-by: Tim Harvey >> >>>> --- >> >>>> lib/fdtdec.c | 2 ++ >> >>>> 1 file changed, 2 insertions(+) >> >>>> >> >>>> diff --git a/lib/fdtdec.c b/lib/fdtdec.c >> >>>> index 864589193b..d47195525a 100644 >> >>>> --- a/lib/fdtdec.c >> >>>> +++ b/lib/fdtdec.c >> >>>> @@ -546,6 +546,8 @@ int fdtdec_get_alias_highest_id(const void *blob, const char *base) >> >>>> if (*prop != '/' || prop[len - 1] || >> >>>> strncmp(name, base, base_len)) >> >>>> continue; >> >>>> + if (!fdtdec_get_is_enabled(blob, fdt_path_offset(blob, prop))) >> >>>> + continue; >> >>> >> >>> We really can't do this here. It is quite an expensive operation to >> >>> locate the node for a path. >> >>> >> >>> Why is this needed? It seems odd to have an alias pointing to a disabled device. >> >>> >> >> >> >> Simon, >> >> >> >> The issue I ran into here was with an imx6 based board that does not >> >> use the FEC ethernet on the SoC. In this case imx6qdl.dtsi delcares an >> >> alias 'thernet0 = &fec' yet the fec node is not enabled. However >> >> because fdtdec_get_alias_highest_id does not skip this alias to a >> >> disabled device any enumerated ethernet devices get an index of 1 >> >> instead of 0 which is incorrect and causes the mac addresses to be >> >> misaligned. >> >> Is this due getting mac address from the OTP? As I understand it, the >> OTP mac addresses are for fec0/fec1, and not for whatever ethernet0 >> happens to be. >> > > Sean, > > No, the issue is that U-Boot thinks there is an fec device simply > because an alias points to it even though the fec node pointed to is > disabled so when U-Boot finds an ethernet device that is enumerated at > runtime (think pcie or usb based mac) those start at index 1 instead > of index 0 and end up wanting to be assigned mac's from eth1addr > instead of ethaddr. Ok, and this behavior was different in the past? E.g. it used to be that these interfaces were assigned to ethernet0, and so their mac address was stored in ethaddr. And then something changed and now they are ethernet1 and are trying to get the incorrect mac address? Do you know whether it would be possible to remove the alias at the same time you mark the fec as disabled? --Sean