From patchwork Wed Dec 11 02:17:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 849132 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:2c4:b0:385:e875:8a9e with SMTP id o4csp98528wry; Tue, 10 Dec 2024 18:17:22 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVPx27aa4HYaReSlEcHDIYDP+bcQHjJmxXymsY+9WpENn0FO06J6hqc4loqr0jcp59yX+uccw==@linaro.org X-Google-Smtp-Source: AGHT+IH1r5LHOzblh8+bzBmy4IRQnNd6Oj/OHNMN4N0qxNO1aHoOS2dJ6vK74nT5LXxIKF8+Eghu X-Received: by 2002:a17:906:1db1:b0:aa6:81dc:6638 with SMTP id a640c23a62f3a-aa6b1192ffdmr78436066b.16.1733883442198; Tue, 10 Dec 2024 18:17:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733883442; cv=none; d=google.com; s=arc-20240605; b=TEoRU0WEwBCgC8FO5V5a9XHAXh6MY82zazALQAtCQW4TpDGk+hMhCxeplvZ/z6Od2P DZjmf1ejPyWN+7Vyecj0rh/kR+PSH0gyvYOvhikZ0qvCJQnRz11RM1jPFi+eSzvXeJEN ioESyF41cKdljQ4/GhFqBN2lAEs0WOWUe+hZ+nzANEh43rF+NfYLKzBNpD+0wBL9VCf+ fgKphAyKMXRRP+Gl0Q1yj9uBDKTNy42R27y+xrazgsl+JYc7kXRIm25npuQ1N87ABNA0 apX/oVWdfdDaYxOfdSiurbC3Bw76XzA2CMt9+x3upTlVdisSHIzobKvtDnT7SNoFsq2R lqwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=oMTPy93NewWGtFcNDmISPBf+EnXAcOkMSCODJmeMmA8=; fh=2aj03WTU2F6kNC2bDBz41rJ509STm5mIMI+7ib48xN0=; b=CVhd2uGKUj+AUpXcuYCYGe41rl6kq0QMD71E8u31q8uwwspRLJHLF6x7LoLhTWy6no L4AJ9a260m4e6vmnXWJKfZqzUssBuOSukwsdphEqaBzkDC0nkQTFc0Bvw3qsL8TEalyo LOYGep/eqNo0Hv4vFmcNflcts1NfwKw3MsMJBvQF1ugD3niO2+o6yGUdSDKyaWK6gv0W bcbVnK5M92UyHqjocWcg3MH+hIA36OE0tKUz4kxjQE6sneNfe1lBFWgoe9zi+adY7TpP X4VSC8p0ycrYAN5RqXXrd7lOhKwYzCtezBfbJQ2E5P5RH980GR4/6MXXZRef/2mOXBsV ya4g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uhySUnsc; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id a640c23a62f3a-aa662d29880si545628066b.863.2024.12.10.18.17.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 18:17:22 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uhySUnsc; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3F1B680219; Wed, 11 Dec 2024 03:17:11 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="uhySUnsc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AF9A280207; Wed, 11 Dec 2024 03:17:09 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x32e.google.com (mail-ot1-x32e.google.com [IPv6:2607:f8b0:4864:20::32e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2FAAE801FE for ; Wed, 11 Dec 2024 03:17:05 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=semen.protsenko@linaro.org Received: by mail-ot1-x32e.google.com with SMTP id 46e09a7af769-71e1158fe3eso438429a34.1 for ; Tue, 10 Dec 2024 18:17:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733883424; x=1734488224; darn=lists.denx.de; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=oMTPy93NewWGtFcNDmISPBf+EnXAcOkMSCODJmeMmA8=; b=uhySUnscNjbot8bwo5nhXmM9/V9A0ZynA7JL2itd0UEDKTZLGhXnKwFDhIz0Mkae94 vgMJPiMWNodNFbh52WSPkQGDSGYL5JpZtuCpU72WaQMaimTylhs/eqROU7ZMw6tmiWXA 5IGl15SMP8vNIfYjc1DWOihhk5KHpE74YkTHiqBwqffih5mhIm1DtfzgoymPxByBxeoW uKSfN3fuYV1OFr5u6ekWJzFGbCyGLicBa+R9LeQ8i3GelbjjavJJZVmpSAFM6JMksE2b pt2WfV7jH6ZjlniZW61Wg+jwy2LoeL89vpbPIk5tUtLy+i1dPGqCGertSQyU5NvPqnYz xmjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733883424; x=1734488224; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=oMTPy93NewWGtFcNDmISPBf+EnXAcOkMSCODJmeMmA8=; b=u4Osj8pOBRReVDips7nRCC+DjdvDEph4x82cS9D/PAHF1MeqHYY7Aovd5BYghzDyVq D6yL0GekOFr078gzqLTqfSAVf/3knMzZJ7U3vyfm/8F/BbiHuibC63+a8N459ySlpl8j C2LORLVKerT8k3zQu0uvoWm0qspODeUGi/Hf1vYKUAKpmBD1Rsh9Q1MVGHvcsTHiCdD8 DinwrAJ9Mfk92AEH+g53D6oI7MGd6ymC21k4LJJaQG0dOhsoK3HJj9ntjZ4ZviJ/IPcp PcZxWQTRxFH0pZInVBKGcUakt8ZNcqvQEhMfkmv8Lj4UBOtc3NVqkFds/aYWHl8wf7A7 h7vw== X-Forwarded-Encrypted: i=1; AJvYcCUvb+SmzKP4zZxX6b69fexpVwMou5tQCutKfvRSd0cDAGsR6nAfWkWhrfLQkcbtuRSwHNpN178=@lists.denx.de X-Gm-Message-State: AOJu0YxdOpTCzEiKyN6hiNCNSYuSUQnin2X/7MJ2ztJrxnlWxhbwSjfv 97qmTra1mTZOLhUSlrUzPNihSMfd+jLNH3rFO6kgIbZdJceO5pYYoZCUM+cDTOVBAR/hmWKPpsN k2t8= X-Gm-Gg: ASbGncu/TQqCBHbM2StnUX8MKhi3tq2avFVwXDNn1HltT6qk7IPp0ee6w+YhJOJNGSE dyTK26xCQ4mI9D1RPJ6aUmRytlIhrYnKT4dXpQunQ2G45QOl94z7/gdJHtziOGx3heq8jaYEuIn ePRGKXPQSmjOxVl2jyRt3fnkY3fHjvJc6ObGTdgSvlCcUQCTjfc/IpZx98Xxb4QmP5Aj3iEjRiI ovO7rnPFmWQ9JUmlgjQujGWf0CTs/lMaB0mBoBJG6FJy3ecJugALACVrgs= X-Received: by 2002:a05:6830:2650:b0:717:f666:9559 with SMTP id 46e09a7af769-71e197b7e1bmr652107a34.9.1733883423876; Tue, 10 Dec 2024 18:17:03 -0800 (PST) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71e1d74575bsm23958a34.7.2024.12.10.18.17.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 18:17:03 -0800 (PST) From: Sam Protsenko To: Tom Rini Cc: Ilias Apalodimas , Sughosh Ganu , Heinrich Schuchardt , Simon Glass , Caleb Connolly , Marek Vasut , Laurent Pinchart , Patrick Delaunay , u-boot@lists.denx.de Subject: [PATCH v2 0/2] lmb: Fix reserving the same region multiple times Date: Tue, 10 Dec 2024 20:17:00 -0600 Message-Id: <20241211021703.2333-1-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 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 This series is intended to be picked up for the v2025.01 release. Since commit 1d9aa4a283da ("lmb: Fix the allocation of overlapping memory areas with !LMB_NONE") the lmb_add_region_flags() returns -1 when the caller tries to add the already existing region with !LMB_NONE flags (it was returning 0 before that patch). That causes boot_fdt_reserve_region() function to print erroneous error messages when it's called consequently more than one time. Make lmb_add_region_flags() return -EEXIST when the already added region with !LMB_NONE flags is being added, and then check that error code in boot_fdt_reserve_region() to avoid printing the misleading error messages. This series fixes all 3 found cases (discussed at [1]) for the false positive error messages. All unit tests pass in sandbox U-Boot. Changes in v2: - Split the original series by two separate series (cleanups will be sent out as a different one) - Collected all R-b and A-b tags from review - Patch #1: Removed the check for exactly the same region, and return -EEXIST in the branch handling overlapping regions instead - Reworded the commit messages slightly [1] https://lists.denx.de/pipermail/u-boot/2024-December/574123.html Sam Protsenko (2): lmb: Return -EEXIST in lmb_add_region_flags() if region already added boot: fdt: Handle already reserved memory in boot_fdt_reserve_region() boot/image-fdt.c | 2 +- lib/lmb.c | 26 +++++++++++++------------- test/lib/lmb.c | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) Tested-by: Michal Simek