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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 8CE76CAC5B0 for ; Mon, 29 Sep 2025 07:08:42 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 12CBF82A9E; Mon, 29 Sep 2025 09:08:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=amd.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=amd.com header.i=@amd.com header.b="l+8PEa7a"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6380983071; Mon, 29 Sep 2025 09:08:40 +0200 (CEST) Received: from CO1PR03CU002.outbound.protection.outlook.com (mail-westus2azlp170100005.outbound.protection.outlook.com [IPv6:2a01:111:f403:c005::5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 130B88206E for ; Mon, 29 Sep 2025 09:08:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=michal.simek@amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tfWv+f1/V0/XN9fZ9NIE9HsOecd6DzayumKEAMF1ru9RiJ9Bq4BypUVsBNhOoBQ/fus65DLCroPf8GfSE2shluEEc9RUBkeI4HSojROybjyMcyILUHjEshhqAZ2xR4PKVg74xHvYfsiCYnjlZaMVIq2p9YCh7Qg5XMHhZL7PdWLxr8gVSCKfT9lnAA9ffTkaqM99K06MQ3kO0vJDw0RLapFJ+SLI1B9d2EisS1Bidn8hNje02vuItOvDGiyXsVHOeBbXMPsmmpABcozdb76L+SjQ0PCFzaR6OldQVU8wyzRdhaut0NpPFp6glj1T60sul2CGjc8398zt0g88vUSGtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=V3BAuDlsJgYD6fUHpeajN4ip48ZuSNwOteTffplVZKs=; b=l9qoko+CwhHIHtJwDCMcfDqgtgMvnp8wArJ741ei/Qvtkuex2uqAcC7KH9/Hohf22r9AHeWCUnvcAnN+09qlDI2EiEUzYnWIaZpGJ4ukxT2dItMlP7M96AiBrsik603/LurZ7i+3cvuIez5WbHBgu/vDSY6v+9UN/XraS0plSmyRQuXIO/T8NVbbKElTQn+xkIuX49z7r0Bou7xvXl3nJlDLIcNMeiBSbFV5nsC81TnWdgK5FCfy3O/1tOKvTP0KPoD1zGdNLrEuAwaKIeVzqUNTaRwCeH1osuhFFXSHhQNqgYbTpthB/6e8TvK3TLl7K+rTZwwMJZC7Lf9DzLPBKQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=V3BAuDlsJgYD6fUHpeajN4ip48ZuSNwOteTffplVZKs=; b=l+8PEa7aSIycDFzg4UvJY4GjwuUU7PqAaIAzq3by8+A0Ivp9qCyNDKRMg+u+1ZTQ8peFnwnyzZcBhnPKC8PSHcAFJfLzHoeZKEVzpgDO76Q0Og4Q7kCsD5wfnsPPKU2XQZQi5Z7m42Ul7FpSwRUSWphmV5lwNBvpX09zVDtbQx4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from SJ2PR12MB8109.namprd12.prod.outlook.com (2603:10b6:a03:4f5::8) by LV8PR12MB9452.namprd12.prod.outlook.com (2603:10b6:408:200::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9137.20; Mon, 29 Sep 2025 07:08:33 +0000 Received: from SJ2PR12MB8109.namprd12.prod.outlook.com ([fe80::7f35:efe7:5e82:5e30]) by SJ2PR12MB8109.namprd12.prod.outlook.com ([fe80::7f35:efe7:5e82:5e30%4]) with mapi id 15.20.9160.008; Mon, 29 Sep 2025 07:08:32 +0000 Message-ID: <49902e34-a01d-422b-bd60-e97aef7d859e@amd.com> Date: Mon, 29 Sep 2025 09:08:19 +0200 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] env: spi: Fix gd->env_valid for the first write To: E Shattow , Marek Vasut , u-boot@lists.denx.de, git@xilinx.com, Marek Vasut , Tom Rini Cc: Casey Connolly , Ilias Apalodimas , Joe Hershberger , Marek Vasut , Simon Glass References: <7a6ffee423f45507af680c63a86cc50fb9e3a5df.1757489188.git.michal.simek@amd.com> <1684bd0d-b831-43e6-8713-95a2675957db@mailbox.org> <39f7c9df-9a8a-447d-8689-4f99676fb1e8@amd.com> <48de987c-1255-4c90-8477-964d153809d3@amd.com> <401851f4-36e7-4e11-9d2e-e85753d916bf@mailbox.org> Content-Language: en-US From: Michal Simek Autocrypt: addr=michal.simek@amd.com; keydata= xsFNBFFuvDEBEAC9Amu3nk79+J+4xBOuM5XmDmljuukOc6mKB5bBYOa4SrWJZTjeGRf52VMc howHe8Y9nSbG92obZMqsdt+d/hmRu3fgwRYiiU97YJjUkCN5paHXyBb+3IdrLNGt8I7C9R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CAAmAhsMFiEEZzUMm/XM7ptTZDVqN3x/ If49H5EFAmfyXCkFCRpGBvgACgkQN3x/If49H5GY5xAAoKWHRO/OlI7eMA8VaUgFInmphBAj fAgQbW6Zxl9ULaCcNSoJc2D0zYWXftDOJeXyVk5Gb8cMbLA1tIMSM/BgSAnT7As2KfcZDTXQ DJSZYWgYKc/YywLgUlpv4slFv5tjmoUvHK9w2DuFLW254pnUuhrdyTEaknEM+qOmPscWOs0R dR6mMTN0vBjnLUeYdy0xbaoefjT+tWBybXkVwLDd3d/+mOa9ZiAB7ynuVWu2ow/uGJx0hnRI LGfLsiPu47YQrQXu79r7RtVeAYwRh3ul7wx5LABWI6n31oEHxDH+1czVjKsiozRstEaUxuDZ jWRHq+AEIq79BTTopj2dnW+sZAsnVpQmc+nod6xR907pzt/HZL0WoWwRVkbg7hqtzKOBoju3 hftqVr0nx77oBZD6mSJsxM/QuJoaXaTX/a/QiB4Nwrja2jlM0lMUA/bGeM1tQwS7rJLaT3cT RBGSlJgyWtR8IQvX3rqHd6QrFi1poQ1/wpLummWO0adWes2U6I3GtD9vxO/cazWrWBDoQ8Da otYa9+7v0j0WOBTJaj16LFxdSRq/jZ1y/EIHs3Ysd85mUWXOB8xZ6h+WEMzqAvOt02oWJVbr ZLqxG/3ScDXZEUJ6EDJVoLAK50zMk87ece2+4GWGOKfFsiDfh7fnEMXQcykxuowBYUD0tMd2 mpwx1d8= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: VI1PR07CA0281.eurprd07.prod.outlook.com (2603:10a6:803:b4::48) To SJ2PR12MB8109.namprd12.prod.outlook.com (2603:10b6:a03:4f5::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ2PR12MB8109:EE_|LV8PR12MB9452:EE_ X-MS-Office365-Filtering-Correlation-Id: 2dc16f0a-4242-4cb8-9deb-08ddff26fff6 X-MS-Exchange-SenderADCheck: 1 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YvZjQ4?= =?utf-8?B?VkFNYzBxQThxVkNTTUZ4TE5vaHdYMk4yNUhEMHVkR3pFRnFVR3EwTkUvWWE5?= =?utf-8?B?M2lma0o4c2ZhS3IrMzcxcVF3cE5yRmlkdWdzOUQyUVJCY3V0dFVNUmNBWkY5?= =?utf-8?B?b0o2TUllcWVzZW5veG5YZHkxaUh6ZXZobStVQ2tDUmlGSmV0ZW4vR3h6ZzQ5?= =?utf-8?B?eUxwUkpZWk0zTGNWME1UVEhuRVhSRE9Qa2k0djM4b2JsWkE9PQ==?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ2PR12MB8109.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(7416014)(1800799024)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?K3krWXNFcEl6b0gvR0ZOSVVkcWp1b3BORUIyWC9XWklXU2ZVeXdiL1FwM3dN?= =?utf-8?B?OStxM3JsVlFrT25NZ0Jpcytra0R1L1hZOElwWXN2R1RGNEliR3hSQUdLb2NL?= =?utf-8?B?SloxNCtVeW92QjdsM0ZsMFI1NFc3d1Nzd202bFJIWVYyMEdET2IxN2tVSWtN?= =?utf-8?B?STZQUVNmUnRrWGQvYkZybEV0bm1oTmk4eW5VTmxvTDBQRjVHclNzVHVLU01X?= =?utf-8?B?NEhPTUJlcDdxc0xZOTZoQ2lreDVyUUJHMGRieGJDNEZnMWxPTUQ0eEEzeXFn?= =?utf-8?B?QjYza1RVTVlMVktKQzRyQ0hSMXRvR1YwWllvbjJYeVE1MjQ5WmV3TnpMNjMv?= =?utf-8?B?Q3d6S2RZRHZhQlNGeFQ0azZTbll2alR0MFJTQUFTK1BZcTFya2l0SXNOUUZo?= =?utf-8?B?K2doem1PbVY2aElTNXZxZ0c4WjFWYTNpSkRrdTVtb3A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OHZQMzNuVDJkdXNXMnNzdXF2Rmw5c0NG?= =?utf-8?B?aXIxOTdUdEZEWGl2aTU4QkVRSjhrVHR5L29wRTNWS05iN0c1VnQxMTR0M2ov?= =?utf-8?B?NS9UMytoV0VnTjJOWGpqWnJWQkJFdEZhUnlqNjlxbThIcEQrQUZhQkNRVWhN?= =?utf-8?B?SUcwT0ZqSGp2M1FWR3JiV1pRWmRmalpicmVObEpJNjIvWnNLaFV3QzJtdnBj?= =?utf-8?B?UEhrWm9tUVdaOGdsV3Bva2RLS2tQcEFQT05QY1BKMTRzQnhsZGdFLzdtc2xq?= =?utf-8?B?UC84QWhnM2ErMnR2R3ZyVG45SWNpQnRnaXpJdTFYOG1ha08yZy9YVVJMT1hT?= =?utf-8?B?MmJFSytLeFZNeXdOM1pCd1F4TDhENGxrVWFEK25Sazk5Ryt4ZHlRaEQxZUha?= =?utf-8?B?SzBZeUtsdTdqcTlsaGhNZmc1bEk1VCtYUjZXMlBiUlp4S2FJakFicTEvZzY0?= =?utf-8?B?UFZXM251blEraWNUOG13eDJRdlRnUFQreWttNjdieFNLeCtJdTRvMkgrck5Y?= =?utf-8?B?L3dyUkRzK3BnNHlSZllFd3ZlR2tOMDhqRG5qWERKWlBOYUJCOFIrUzlTTjBp?= =?utf-8?B?ak1mbnA5TENCWmFoMjdHdi8yRmcyMDMyUUF1Y3FtaVBVSDlUM0FQWUF4QTQr?= =?utf-8?B?Sk90RXlmQ2R4RWpGeGpML2NEL21jTDVwL0F6UXNaNHZuOE5iZnIrZGt4TVZm?= =?utf-8?B?TlIzRmN1Um03Q05GNG5oNWYzZ0VMSWxzTTVWSzN6UEVPcmdIOWhKRHJMUGpI?= =?utf-8?Q?3VX6XOmnjLOA/NPjF9GBXHgd/?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2dc16f0a-4242-4cb8-9deb-08ddff26fff6 X-MS-Exchange-CrossTenant-AuthSource: SJ2PR12MB8109.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2025 07:08:32.9149 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: L43XA0um3D4n2lNc7D+t+HPPfJQTtmVrsklu6gywMUmIWoV+mza+YVVotnOUK8Wa X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9452 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean On 9/23/25 23:18, E Shattow wrote: > > > On 9/22/25 07:51, Marek Vasut wrote: >> On 9/22/25 4:02 PM, Michal Simek wrote: >>> >>> >>> On 9/11/25 07:40, Michal Simek wrote: >>>> >>>> >>>> On 9/11/25 05:28, Marek Vasut wrote: >>>>> On 9/10/25 9:26 AM, Michal Simek wrote: >>>>>> In case of ENV_INVALID (uninitialized variables) the first env >>>>>> location >>>>>> should be used for storing variables. >>>>>> That's why change the logic how env_valid is setup to be aligned with >>>>>> offset calculation. >>>>>> This will also fix the print about Valid environment is showing proper >>>>>> location where variables are saved for the first time. >>>>>> And also fixes behavior where the first two writes were going to the >>>>>> first location instead of the first to the first location and >>>>>> second to >>>>>> second location. >>>>>> >>>>>> Signed-off-by: Michal Simek >>>>>> --- >>>>>> >>>>>> Changes in v2: >>>>>> - Simplify commit message >>>>>> >>>>>> Origin commit message with more technical details. >>>>>> >>>>>> When both location for variables are not valid (or empty) gd- >>>>>>> env_valid is >>>>>> 0 (ENV_INVALID) which is setup by >>>>>> env_sf_load()/env_import_redund()/env_check_redund() calls. >>>>>> >>>>>> When saveenv is called in case of SPI env_sf_save() is called which >>>>>> contains logic which describes new/old variable locations. >>>>>> >>>>>> if (gd->env_valid == ENV_VALID) { >>>>>>          env_new_offset = CONFIG_ENV_OFFSET_REDUND; >>>>>>          env_offset = CONFIG_ENV_OFFSET; >>>>>> } else { >>>>>>          env_new_offset = CONFIG_ENV_OFFSET; >>>>>>          env_offset = CONFIG_ENV_OFFSET_REDUND; >>>>>> } >>>>>> >>>>>> In case of ENV_INVALID option the first location is used (else part) >>>>>> and variables are saved with ENV_REDUND_ACTIVE flag. >>>>>> The second location flag is rewritten to ENV_REDUND_OBSOLETE. >>>>>> >>>>>> And >>>>>> gd->env_valid = gd->env_valid == ENV_REDUND ? ENV_VALID : ENV_REDUND; >>>>>> is executed. env_valid is ENV_INVALID that's why ENV_REDUND is setup >>>>>> but that's not correct because the first location has been written >>>>>> and not >>>>>> the second one. >>>>>> That is confirmed by >>>>>> printf("Valid environment: %d\n", (int)gd->env_valid); >>>>>> which is showing number 2 (ENV_REDUND). >>>>>> >>>>>> That's why change the logic how env_valid is setup to be aligned with >>>>>> offset calculation which also cover the case where initial state is >>>>>> ENV_INVALID. >>>>>> Then print about Valid environment is showing proper location where >>>>>> variables are saved for the first time. >>>>>> But also it is fixing behavior where the first two writes are going >>>>>> to the >>>>>> first location instead of the first to the first location and >>>>>> second to >>>>>> second location. Alternation is happening after it. >>>>>> >>>>>> v1: https://lore.kernel.org/ >>>>>> r/03aa59f72f47fe0ecafd1e1ca52cbb8a5a8f0446.1755613540.git.michal.simek@amd.com >>>>> Sorry for not being clear, the original commit message structure and >>>>> technical details were fine, it only needed slight rephrasing, in >>>>> the original form it was very hard to understand. Can you please >>>>> reinstate the original commit message and only clean it up slightly ? >>>> >>>> Can you exactly point me to part which wasn't clear? It has a lot of >>>> details about flow and obviously it makes sense to me that's why I >>>> would like you to point me to exact part which should be improved. >>> >>> What about this? >>> > >>> When both SPI environment locations are invalid (gd->env_valid == >>> ENV_INVALID), the first call to saveenv writes to the primary location >>> and sets the active flag. However, the logic for updating gd- >>>> env_valid incorrectly sets it to ENV_REDUND, which does not match the >>> actual location written. This causes the first two writes to target >>> the same location, and alternation only begins after the second write. > > nit, the use of word "alternation" here reads as splitting (no > duplication) the data one-by-one into multiple targets. I would give the > game analogy of 52 playing cards and alternating to deal the cards to > players, each player gets one card in a sequence of alternation; if > there is more than one player in the game then no player will get all > the cards from the action of dealing the cards. tbh before this patch I though that both copies are the same but that's not how it is implemented. It is switching from Location A to B and then to A, etc. > >>> >>> Update the logic to alternate gd->env_valid based on whether the last >>> write was to the primary or redundant location, ensuring the first >>> write sets ENV_VALID and subsequent writes alternate as expected. This >>> aligns env_valid with the actual storage location and fixes the >>> alternation sequence from the first write. >>> >>> With this change, the "Valid environment" printout correctly reflects >>> the active location after each save, and the alternation between >>> primary and redundant locations works as intended from the start. >> Yes, perfect. > > I do not understand what this description is saying because alternation > of write operations to multiple targets would not be redundant. > Alternation with the meaning of "fail-over" is similarly not redundant. How the code is written is that you have location A and B. And when you call saveenv variables are written to A. And next saveenv variables are written to B. Next to A, etc. It means unless you call saveenv twice you never get data in A and B equal. It means it is not alternation of write operations to multiple targets. It is alternation of location where one complete write is done. > > An alternative method has the meaning of "do something else, do not do > this". In the common use, an alternative may have the meaning of "do > something else if needed as fail-over from what is first being > attempted". Do you intend for the meaning of "fail-over" and "duplicate" > or "duplication" where you have written "alternate" and "alternation"? I am not a native speaker but the word alternation between A/B sounds the best for me. Feel free to suggest how to describe it better. Thanks, Michal