From patchwork Sun Dec 8 00:21:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 848264 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp1467557wrt; Sat, 7 Dec 2024 16:21:38 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV2GvPoCpKl/sBEgwOXDyPpJ/I/yGqUK7vUgFUxqFo/Xp+Z6H7XJ+cQQfQnRpVysfYBv6ga7A==@linaro.org X-Google-Smtp-Source: AGHT+IGf45a2inQ/YSGKe9WEbgeBvouKQDuguXV9RtHs9s5EIywFOXAfJII6vuNpO6M5RW42D+xt X-Received: by 2002:a17:907:7814:b0:aa6:29dc:11b with SMTP id a640c23a62f3a-aa63a0748a7mr626867266b.16.1733617298146; Sat, 07 Dec 2024 16:21:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733617298; cv=none; d=google.com; s=arc-20240605; b=Ra6R+MqVNw+91c32m1Ep6njLg4/717waW4f8r7IxaBdbcDrVydaa+GDDH51rj6uNoD oFhQHgwSpCPLbZiWveXH2u+MlYI+0trV7IlQbxLxo+CCjvnTEgADSAdMr9TQujr4yvTh kSGrTyKPCAk1VTApSKoz0VfKklkJNVCcdma0APIX4Kf2NlmfeCBfdXkaC9z+CVvmgWJ3 9Xn/PXJxGEQBEYMazc6N2wJamp0v8UdUifaYjVbBXMBHADoe1qJa4WeOYJ94QLrQ1Q5J lcvnJuunO82l+Yaaht5UutNGNwu2A6WjXzObfrg7nIMJnap6AAEf05lfyxBEkJtwQ1uW r0cQ== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=M67afIA+ajXVHuic4rKlvMMufy/mz8Ysw12A4/NrA5E=; fh=LhXWhrNb7OqJ0D2VpaMDaoH7vdVMD06oXldLo/Xpag0=; b=T5/LDEvDLo9pHEolE8s3JT1iyY6ojRYXID30zeuWU5JninGaF4QcfV+laHaNq11ILT J4balfEFXKtKqUhdEQU4oPmqqitMuRmxugL0zJmWTZkzedwgjcHNU4EW/HxRkGQ2E19R 8F1PjkHgJ60KqPx/hJFmmCOT7D+/AsvvJj+zBvkDfEKzFdisEIdhPPSbiGCLCLGp2hum 6ekUf4P0jqj8g+jlr8F7DkuAs2Ttk2AgqD1myf5Oq+u/iZScwo6sdpWftfEY5M4O8vKo zLAFKsI87IQRdtp828LK08j9PwLcGiglYAs5Kd97ANQ2sAfkEqdR39IybBi/zYHI1xN1 o/FQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Rg6pfSBZ; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id a640c23a62f3a-aa6260cbf0fsi477748066b.343.2024.12.07.16.21.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Dec 2024 16:21:38 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Rg6pfSBZ; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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 2EF3489405; Sun, 8 Dec 2024 01:21:31 +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="Rg6pfSBZ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5DAFA893DA; Sun, 8 Dec 2024 01:21:29 +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=unavailable autolearn_force=no version=3.4.2 Received: from mail-ot1-x332.google.com (mail-ot1-x332.google.com [IPv6:2607:f8b0:4864:20::332]) (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 B216B893DF for ; Sun, 8 Dec 2024 01:21:25 +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-x332.google.com with SMTP id 46e09a7af769-71d4ba17cd2so1533925a34.3 for ; Sat, 07 Dec 2024 16:21:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733617284; x=1734222084; darn=lists.denx.de; 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=M67afIA+ajXVHuic4rKlvMMufy/mz8Ysw12A4/NrA5E=; b=Rg6pfSBZle2BVPNE9VUGtmlpc9yF5jN7tlo1MI7ZH8dYF2lX1gqnzVKyNxqO7ukuGc vzDvn5GI9XFzOKZV95l0ZK68d/cmRNAbeUuiSYWkZx9K29rBoSO5MtcwXKuyDuHOrubZ cHqpM/m/NzGSpj2ni5zzuogyjlDZNsT6Z++gDXB2q650BLVB1sDd0A0KkkpjOiHgTta7 19cIS6hGUsleHq0PJ/hsuwn6K0PqOyzBlxpJxTyLO1gqctsDqpjN0QB866DGzDHBfuY9 VbZRMg80T2nscpan9OPZbPogsRK/LHNj2pG3r95ipfBHQoXKMf6xzJNRp0Zfl6JIG3f2 f3eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733617284; x=1734222084; 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=M67afIA+ajXVHuic4rKlvMMufy/mz8Ysw12A4/NrA5E=; b=eBj6MPuB1V88sN6tOVkc3//9F/tOPkuY/LpvXPCnmQQd5PZ/13Dwst2xmveA6zxJnv 02UyAzun5OUMg9uhk439RkTResaEWOaWlcjRmjX0fkY2ZxtM02djEADN5t19vGLh1CAI i1WRtaJ2cpKk+9sKb9Aw5qcG/RZT2tb8U+zSVOJ12ivXLQKa4sdU8y2NMyUw3HvcXWMP k9by42Bje9L1g+eY5empODTESkEIKIbFOKnODg6XLOFWjQEh0dJ65W+gSF2o0U5qX/NR EwPS2TVm4r9jgIm6AmvchE9Kw64njUWhmMAqA6QM6VWFrTyzjGNrnu8REZQkbvUqBd+D z4iA== X-Forwarded-Encrypted: i=1; AJvYcCWCngIRTCjn1jrbZ7/Whi7ZuMyXC3UF5f9IhsUs00Z3giYDgZIVr1/g0w54DMLnnGkfgpub1Kg=@lists.denx.de X-Gm-Message-State: AOJu0Ywi4vEajzcerUj1sEdM2z8IzIsUAENbhxscB5J/yLvN+eVMzZGS lK2pGNPjfdqWbBFn5ygaK/AW42FLo7mHyVTz677oX/9Xxy581DfF2/1SYiA09LsEY9ew8UkoAFE q6BE= X-Gm-Gg: ASbGncv2q/Vw75mWf79MNz+hYlii9RvFL8bhWSU8rzomSAbYHgYQO2R5PG9o7dODqJm 16h7eF4kZ0ZA1YRQGNdjVeSVqcUepJttYP9Y2T8u91kHLJdySfglW7kdXbyLxnye1A+iuNJ1U4/ OKm6iHsrnW0lfLIVhVhms4NhY5gguLJtaXp4+vJZEdCoW+7DwR4W3LqxGLm/hHjmAQmkEz/aWGc QhSAB6czH1G/7l9enuht6d1qnX7viNS9RxSOiaC9CggOqdCsMFJAcU= X-Received: by 2002:a05:6830:3101:b0:71d:4105:405e with SMTP id 46e09a7af769-71dcf4b43afmr5920685a34.1.1733617284498; Sat, 07 Dec 2024 16:21:24 -0800 (PST) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71dc493b033sm1549371a34.8.2024.12.07.16.21.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Dec 2024 16:21:23 -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 1/6] lmb: Fix flags data type in lmb_add_region_flags() Date: Sat, 7 Dec 2024 18:21:16 -0600 Message-Id: <20241208002121.31887-2-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241208002121.31887-1-semen.protsenko@linaro.org> References: <20241208002121.31887-1-semen.protsenko@linaro.org> 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 rgnflags variable in lmb_add_region_flags() has incorrect type: it's declared as phys_size_t when it should be enum lmb_flags. That copy-paste mistake was firstly introduced in commit 59c0ea5df33f ("lmb: Add support of flags for no-map properties"), and then copied further into commit ed17a33fed29 ("lmb: make LMB memory map persistent and global"). Fix it by using the correct type to match struct lmb_region field. No functional change. Fixes: ed17a33fed29 ("lmb: make LMB memory map persistent and global") Fixes: 59c0ea5df33f ("lmb: Add support of flags for no-map properties") Signed-off-by: Sam Protsenko Reviewed-by: Ilias Apalodimas Acked-by: Sughosh Ganu --- lib/lmb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/lmb.c b/lib/lmb.c index b03237bc06cb..713f072f75ee 100644 --- a/lib/lmb.c +++ b/lib/lmb.c @@ -200,7 +200,7 @@ static long lmb_add_region_flags(struct alist *lmb_rgn_lst, phys_addr_t base, for (i = 0; i < lmb_rgn_lst->count; i++) { phys_addr_t rgnbase = rgn[i].base; phys_size_t rgnsize = rgn[i].size; - phys_size_t rgnflags = rgn[i].flags; + enum lmb_flags rgnflags = rgn[i].flags; ret = lmb_addrs_adjacent(base, size, rgnbase, rgnsize); if (ret > 0) { From patchwork Sun Dec 8 00:21:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 848265 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp1467582wrt; Sat, 7 Dec 2024 16:21:46 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVJNrvkQzA1pYP0c/gpx3X/7fqRfuA2gZMxZj6bbES82mDRK41M7HwMjfrplicO+/WEkbt3Cw==@linaro.org X-Google-Smtp-Source: AGHT+IGP0zfNKhTQsxb5FbK/o2ewK0ZT4ZBWQdVl28tR65wyXw3rPBgNRF3QazErkUD6TTgJe1Yr X-Received: by 2002:a17:907:9145:b0:aa5:630d:7de0 with SMTP id a640c23a62f3a-aa63a26a7c0mr642636166b.44.1733617306335; Sat, 07 Dec 2024 16:21:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733617306; cv=none; d=google.com; s=arc-20240605; b=isCCIC3m5m4hFFsj+q4P3NdqgiWyEDWMsVVHCLCH7VWGut5ov1+/fdPqcG9g/8Fg1C YNJMmtE0mFfpfhYb8DoteFvlZu/oGkaZrmq8I8szu7/he18i+1ijmOAgaLW5ACVuIUwg q2sO81rNfSt/EOGsY29faXG0/jnO+igOBjdMxxTjIL+t1RnB6n1WigPUFOOmPa+xHybY THZLHBuH2xfucajIolIbvzfuhgghK2KwcowRlq/30PA9ZIrFEfR3yAM8ihTADLBsF2K6 92ZO/X4FOgZq+YbJZoicWx9JDOXv3cOc+3bDaJylgjpfXDtNCWJ8eAJmNgZXw/8yMfod 6eYA== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LP7WRT98dGj39h1CiHCmB/n2Zg81Ci8i+gupvmN8tSc=; fh=6WoealrJ3H1Lb9wWKsW4rhw0z6UCiKTfyvmFI6P5jyo=; b=CQgsKXtfXtYJIyN/p+qmS+1dg2p2sHWbLPXgMGcmazksxXL/ku7bJkfspbw5ggDQdW dihNiD333AGDT318tU/Dhb8m3VWBduTQOuuqFVIjRE6dw6dfe4vqrmLdqDg4+sm93K/w TKlKSjnBHU9wvRHL/oh8uxSCdsmLVkBaZsJ4Ods8buKLLXMINlxO/zWkZeWZww+HJR/Z uzPazWCv/RGB46lmACsMYftG8NtFMKPvRDMzWZW+4r7fFSLQ4K6jbgtcIZ+rIKnqONui cRLxyI1EPHDoKnXHIS1k0Lecq7S0MfgwsYp1WiUO1YuullGMmQbE7bZc9mqEnkeJrEd8 Au4A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yV1n2JLa; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id a640c23a62f3a-aa6261bef07si463403766b.708.2024.12.07.16.21.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Dec 2024 16:21:46 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yV1n2JLa; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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 8455F8946E; Sun, 8 Dec 2024 01:21:31 +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="yV1n2JLa"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E5836893E0; Sun, 8 Dec 2024 01:21:29 +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=unavailable autolearn_force=no version=3.4.2 Received: from mail-ot1-x32a.google.com (mail-ot1-x32a.google.com [IPv6:2607:f8b0:4864:20::32a]) (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 F182D893D4 for ; Sun, 8 Dec 2024 01:21:26 +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-x32a.google.com with SMTP id 46e09a7af769-71d4e043dd9so848991a34.1 for ; Sat, 07 Dec 2024 16:21:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733617286; x=1734222086; darn=lists.denx.de; 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=LP7WRT98dGj39h1CiHCmB/n2Zg81Ci8i+gupvmN8tSc=; b=yV1n2JLa1pckJTc0FG9GsWfOJ98rTNyQ/UDgwOvPadgbrUYiPrnY7Q7BQmeh8RyHiM m2CGp2+E4uF9qnULWHMo5MMkpzAmX8ZaaZmHZ7jk+rcWK6yK++fjXx/ZYLgnYutnxuCO Oksy3XyXVBOx1N+qZeCw95TvyDPzf4L7es24G8RK0cdSiq+oos4lvOkwnHojctyl3T6k sRkhZ3G0mRiPejCEyU3fCNYG0XCKN7/rBsAFAUjeaIkuHwrjlccgEurYcpzN7xgnBSKS gpJf52Z/a8UsuS5ky1KvTJttfFfnjsm1ORYvR/XWMgwCx70awWiuIe4O6ybxUB7ZizDD 8oMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733617286; x=1734222086; 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=LP7WRT98dGj39h1CiHCmB/n2Zg81Ci8i+gupvmN8tSc=; b=sOjV6oXUd01lEeO9uYmWnbo0pAIaXXXKJtbjDPIoFFe8ffjn9IKDMn5wSvpVR09oqH ntC7pYXavQwW0ZgGlHxDJQ1Zr7eJ8UNyEyYPg5oevdKq2cKu9qYHSjn6Yy02NCpE6DVH bGMv6R6RX4aHvdSAtJCmjwJ9ZvbyK1SUZRoTQyHmsR9gD+9iwTVPnDsdbyO8wgfG1vIs io25lpm5L9HawABL3grInxGrRdC/nkOkmGVoYdev5DfXBN0EK6zsK5+TmeRpW83ieWC0 5uaNUcYbzjpaSCzX6IgQoxa9zuqzvhUu1pWQQljGzM+KocW44qY0fEKcgaf6Vk95y9Z2 8Uow== X-Forwarded-Encrypted: i=1; AJvYcCVb88Ocs1rykeWcJXpPFcMTQF6gd2G1458p1635G8MrO9R+PzwwgA/1PG3Q/34Cmmr6Rm5M1NU=@lists.denx.de X-Gm-Message-State: AOJu0Yw0hCAl4ipnrKmUiaIyjLlGG2jMA3Np4PXbV+EtpWxDic9Le3H2 dUiP7M2qptVhmQ1Kz43+e+v20b94jXA1Q+X91J23HaM2paqmFaMq+LHUXpK+qtw2jjB0zWZ+rf/ 7D0w= X-Gm-Gg: ASbGnctTyeOcf0tR6MVL6Go5UIm+cY0kJMWnQqpMoNkK1i/ll3z0/xaD4lk0ZOTiE39 hmn1K9fdDQXl8Sj11rC5hIm1M/4XJ5j75+s6/8lNcLJQGQqZGLOe/72wTGGcWggeyenxawwAOGb /iAPoy7Bp3g5v0jPfJcMrCvBFNu1IkG7oX9s5EwRDntpMQUQ9UfPNnP6SRq31OSRPX7wBSNLCU+ nsKUVxuFaH/RlijXFuy2FaNCy7VhNz4ApxE7P6PkY+aKNnbxpGxYj0= X-Received: by 2002:a05:6830:25c4:b0:718:1cb6:e593 with SMTP id 46e09a7af769-71dcf5530damr3981015a34.27.1733617285725; Sat, 07 Dec 2024 16:21:25 -0800 (PST) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71dc4951cfdsm1541454a34.28.2024.12.07.16.21.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Dec 2024 16:21:25 -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 2/6] lmb: Return -EEXIST in lmb_add_region_flags() if region already added Date: Sat, 7 Dec 2024 18:21:17 -0600 Message-Id: <20241208002121.31887-3-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241208002121.31887-1-semen.protsenko@linaro.org> References: <20241208002121.31887-1-semen.protsenko@linaro.org> 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 An attempt to add the already added LMB region (with exactly the same start address, size and flags) using lmb_add_region_flags() ends up in lmb_addrs_overlap() check, which eventually leads to either returning 0 if 'flags' is LMB_NONE, or -1 otherwise. It makes it impossible for the user of this function to catch the case when the region is already added and differentiate it from regular errors. That in turn may lead to incorrect error handling in the caller code, like reporting misleading errors or interrupting the normal code path where it could be treated as the normal case. An example is boot_fdt_reserve_region() function, which might be called twice (e.g. during board startup in initr_lmb(), and then during 'booti' command booting the OS), thus trying to reserve exactly the same memory regions described in device tree twice, which produces an error message on second call. Implement the detection of cases when the already added region is trying to be added again, and return -EEXIST error code in case the region exists and it's not LMB_NONE; for LMB_NONE return 0, to conform to unit tests (specifically test_alloc_addr() in test/lib/lmb.c) and the preferred behavior described in commit 1d9aa4a283da ("lmb: Fix the allocation of overlapping memory areas with !LMB_NONE"). The change of lmb_add_region_flags() return values is described in the table below: Return case Pre-1d9 1d9 New ----------------------------------------------------------- Added successfully 0 0 0 Failed to add -1 -1 -1 Already added, flags == LMB_NONE 0 0 0 Already added, flags != LMB_NONE 0 -1 -EEXIST Rework all affected functions and their documentation. Also fix the corresponding unit test which checks reserving the same region with the same flags to account for the changed return value. No functional change is intended (by this patch itself). Fixes: 1d9aa4a283da ("lmb: Fix the allocation of overlapping memory areas with !LMB_NONE") Signed-off-by: Sam Protsenko --- lib/lmb.c | 18 ++++++++++++++---- test/lib/lmb.c | 2 +- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/lib/lmb.c b/lib/lmb.c index 713f072f75ee..ce0dc49345fb 100644 --- a/lib/lmb.c +++ b/lib/lmb.c @@ -183,8 +183,10 @@ static long lmb_resize_regions(struct alist *lmb_rgn_lst, * the function might resize an already existing region or coalesce two * adjacent regions. * - * - * Returns: 0 if the region addition successful, -1 on failure + * Return: + * * %0 - Added successfully, or it's already added (only if LMB_NONE) + * * %-EEXIST - The region is already added, and flags != LMB_NONE + * * %-1 - Failure */ static long lmb_add_region_flags(struct alist *lmb_rgn_lst, phys_addr_t base, phys_size_t size, enum lmb_flags flags) @@ -202,6 +204,14 @@ static long lmb_add_region_flags(struct alist *lmb_rgn_lst, phys_addr_t base, phys_size_t rgnsize = rgn[i].size; enum lmb_flags rgnflags = rgn[i].flags; + /* Already have this region, so we're done */ + if (base == rgnbase && size == rgnsize && flags == rgnflags) { + if (flags == LMB_NONE) + return 0; + else + return -EEXIST; + } + ret = lmb_addrs_adjacent(base, size, rgnbase, rgnsize); if (ret > 0) { if (flags != rgnflags) @@ -667,7 +677,7 @@ long lmb_add(phys_addr_t base, phys_size_t size) * * Free up a region of memory. * - * Return: 0 if successful, -1 on failure + * Return: 0 if successful, negative error code on failure */ long lmb_free_flags(phys_addr_t base, phys_size_t size, uint flags) @@ -818,7 +828,7 @@ static phys_addr_t _lmb_alloc_addr(phys_addr_t base, phys_size_t size, lmb_memory[rgn].size, base + size - 1, 1)) { /* ok, reserve the memory */ - if (lmb_reserve_flags(base, size, flags) >= 0) + if (!lmb_reserve_flags(base, size, flags)) return base; } } diff --git a/test/lib/lmb.c b/test/lib/lmb.c index 0bd29e2a4fe7..48c3c966f8f2 100644 --- a/test/lib/lmb.c +++ b/test/lib/lmb.c @@ -754,7 +754,7 @@ static int lib_test_lmb_flags(struct unit_test_state *uts) /* reserve again, same flag */ ret = lmb_reserve_flags(0x40010000, 0x10000, LMB_NOMAP); - ut_asserteq(ret, -1L); + ut_asserteq(ret, -EEXIST); ASSERT_LMB(mem_lst, used_lst, ram, ram_size, 1, 0x40010000, 0x10000, 0, 0, 0, 0); From patchwork Sun Dec 8 00:21:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 848266 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp1467618wrt; Sat, 7 Dec 2024 16:21:54 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXX/zFc5eLUz1oxOw/lLhYtKwWF1RjgttIlrlz48fE/qxO3nLLhXslASVP8FKZqzUyXG/rrnQ==@linaro.org X-Google-Smtp-Source: AGHT+IFhiRkSP/xz3pOTSYeLW/Uigql8JVO3umb2h70JGMSb2An7nQSx48XCU2Vk8AG2zrFC/5+5 X-Received: by 2002:a17:906:9c9:b0:aa6:3de7:f254 with SMTP id a640c23a62f3a-aa63de7f3b7mr653037466b.41.1733617314743; Sat, 07 Dec 2024 16:21:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733617314; cv=none; d=google.com; s=arc-20240605; b=Q0O2nZcmp6jGozmTVJyLYkzrjwPVCZW7MjgZzPDnrYSG0bPG6zFY66CGa0glWxmbvR 7SE0B9FyaFDkSmXGR7x6YwPilI2ERJJA2Lj8jDDEgMs9HFsSO2oBiVXumHt/5XW9jfZN 5R5BK5wT1e37yWSpoB5fKUgsHGlGMIRhFBD8s5Mb8BJ7NiXiGq2fz17N9Im9mzEiUWaR ObYGNZ/C7a2Ev8Xz8H33/urxdlPaysLLkz5GDn4jlTn7p3WGaWM4Fo/+BlnLBtVF7jS/ FfjhxHWefireJOSUEWzFHLGTY9BDFQlxg4tJrpQssxvqJLPq1I6mbbR7CGH+JrrMpOal cVZA== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YIqLi+LU0gMp1928vzjIFNBq6//rtBT59aOVqHfPg8M=; fh=2+wB7Lh+5VeO58IB//yN0X0Kl+yd1DdGyPRnvIl9OSc=; b=cdh+/X4EBIlKP/6gNDk8IUY8uCC8a0ZB8lQLBsH8QeLmV+kiB/bF2Y/OzidcyY1+fS 2Eg3eCWXRzBBe/ys/Jdmu6EHzPR3lxF2sGyHHRxB8C55f7x4nKm9cYHSllyZJz3hfnxR gintohPks6J7R9nHA/jHWWau12ExHg5f5v7qhPPmL4orPe9gsuQGV6XakAbRbI3Ci4g7 PsjkxuPd01iHuSKti/SF4wLQeHEyka3vyTBXo76R2laMlRqCANfcG0CnDvnZrZyKyecw DcGvdAyzEr7IGEioK776MNWUze+bcHfHf0SGNd/3lPazhFU9YIrYQTs1x6v3EmALQ5H9 w7Vg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oafd8Xnt; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id a640c23a62f3a-aa67400cecasi40691666b.422.2024.12.07.16.21.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Dec 2024 16:21:54 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oafd8Xnt; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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 DAD3089486; Sun, 8 Dec 2024 01:21:32 +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="oafd8Xnt"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 75A84893D4; Sun, 8 Dec 2024 01:21:30 +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-oi1-x22b.google.com (mail-oi1-x22b.google.com [IPv6:2607:f8b0:4864:20::22b]) (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 45D55893D2 for ; Sun, 8 Dec 2024 01:21:28 +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-oi1-x22b.google.com with SMTP id 5614622812f47-3ea32c929a3so1003188b6e.1 for ; Sat, 07 Dec 2024 16:21:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733617287; x=1734222087; darn=lists.denx.de; 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=YIqLi+LU0gMp1928vzjIFNBq6//rtBT59aOVqHfPg8M=; b=oafd8XntKIi6xkL7dJBB43DFyQBlbOn5mR7V+2WrLM1v7swT0mWwmQ0vzsBgJzdHBR 3yQJdgU5uat6TmeKtCEchVrhRcNMORemlLSBpesO4WVfZagW/VtKpmNsZRY2+W4sCsc7 xYcR08YZMw0CoTaObwA4DUwvM0Gd6F/aSxWzjR5ROh6Bu4pXPjQk44izgYH93rvElpeQ a/A4DLAIpCE1cA2Zrv4cctMQu0kcuUuJCl07ZjjMJXo2UmfQLMn8+3MlSCkNPWnQ7KP7 Id8d87SuwrTpeYMDHiiH/1wJt4UufgOwxKROqWuG+Scz6KREIsqE6aqJfAirXp1n4v11 BkoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733617287; x=1734222087; 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=YIqLi+LU0gMp1928vzjIFNBq6//rtBT59aOVqHfPg8M=; b=NBOg2qYVPbtiTLg45+rqt0dignexnt7zZb43nT3xRZSue9S3OrTM5mZ3knWN2EhYYs CX5NS658jrp3hRcUOLotosAV2BvWz2muE5ulo/B27ufomxLHaIoDlLj05OutVobXfqEj tCdnXQShE3GctKeniYbbEU8DMgL06WkYZXySdDDxdvleTu6hJjIGf5KH8lVVFqP57FcL Pq+rX8/JZ0PYdkp//0xbpv9++thn7D74/pRNgNRrYELaHpmPdHVKM9SmpowleN8hVugo zxVJ29UgduvtfKbNST50U3Jd7DdzEKdo4WL7J3ZF5m7Miwu9wt9wzh19c83NpldiAzW0 oa5g== X-Forwarded-Encrypted: i=1; AJvYcCWFrmbXKX0f5glsFuvHlDShdOF6XPuJ/Jd1QhecOOiPd19BH17C+h/F52K1DlpR5U0rYEbC0nE=@lists.denx.de X-Gm-Message-State: AOJu0YxZWJJuprYT2IDDlCIcY7y+0j9UQaziRzGg9KHzILp/tgKNY+Cv Z7jpGAFsK31r66oI9UMl0PDeLrvbXQNeEzBzbVkzPbCFbbnPg2OP3jW7VksP/LA= X-Gm-Gg: ASbGncvrnkzYpcj5+7Uwh/nAKBBV6tVOGirHJJrfDfhiAvw0OuHGH7qyvf9z8jAAMfS TjcXSX+IrCGQJp86dcenfAN95NbVhHym6Z7irHMitYMIp1YQsWp2P0uMGUkNqc++akhaQruPyz0 u3PeRj5urrpPPgnn75isfnYIURsfan5YTUnbRBueHLD/4rE+/ro6x84pPhHAfrOkGseVYtZNNao 3xRBbofzOzBm5PvCv/ZvVjxBcDdw/E02y9yq/ZV3gKxsdB5j3x4BiM= X-Received: by 2002:a05:6808:1688:b0:3e7:61f6:811a with SMTP id 5614622812f47-3eb19ed2188mr5187222b6e.35.1733617287017; Sat, 07 Dec 2024 16:21:27 -0800 (PST) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3eb40c6009esm300705b6e.28.2024.12.07.16.21.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Dec 2024 16:21:26 -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 3/6] lmb: Make const flag_str[] in lmb_print_region_flags() more const Date: Sat, 7 Dec 2024 18:21:18 -0600 Message-Id: <20241208002121.31887-4-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241208002121.31887-1-semen.protsenko@linaro.org> References: <20241208002121.31887-1-semen.protsenko@linaro.org> 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 flag_str[] is a pointer to const. Make it also a const pointer. Improve a style a bit while a it, to make this line fit 80 characters limit. No functional change. Signed-off-by: Sam Protsenko Reviewed-by: Ilias Apalodimas --- lib/lmb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/lmb.c b/lib/lmb.c index ce0dc49345fb..1642ce48bbbd 100644 --- a/lib/lmb.c +++ b/lib/lmb.c @@ -482,7 +482,8 @@ static int lmb_map_update_notify(phys_addr_t addr, phys_size_t size, u8 op, static void lmb_print_region_flags(enum lmb_flags flags) { - const char *flag_str[] = { "none", "no-map", "no-overwrite", "no-notify" }; + const char * const flag_str[] = { "none", "no-map", "no-overwrite", + "no-notify" }; unsigned int pflags = flags & (LMB_NOMAP | LMB_NOOVERWRITE | LMB_NONOTIFY); From patchwork Sun Dec 8 00:21:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 848267 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp1467655wrt; Sat, 7 Dec 2024 16:22:03 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWV5KVVL8zYxDSlawjkyS1oWSvGI9n/jPv25WW2es7/2CBKqTWKYmdpq9QzyDYkKzuM1/FwCg==@linaro.org X-Google-Smtp-Source: AGHT+IGAAdRqxbbgczIxa6pgUjwlbRrfcV+ZuYOwosETrZg+FOsbMW4NXRV+fW8U7sYN/baBJU/m X-Received: by 2002:a05:6402:3582:b0:5d0:c801:560 with SMTP id 4fb4d7f45d1cf-5d3be6a1082mr8753017a12.20.1733617323516; Sat, 07 Dec 2024 16:22:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733617323; cv=none; d=google.com; s=arc-20240605; b=Jc0lyGxLnJRiMRDuJCuCf6ns746DP0jkOmcNZ300q/fd9A4Tgqk6gDDqtmevd+4+FY 4o+CnPu0wnFhdpl6NiFPzIvrgxrCHYo8/I5jjySu/u8DjC8rt/vKdrXd9ANrlm+CudWb WIG2Y4Wi442TdfQiLQDYz1Vt+RPZErW00ToSq0ZKv+irYP3Q5QlI61XO2OYpMWEX9XxO OB5FtA5S1mU/G0iZ04vuK/g2Q585jF0Iiul02ZyjIp3Rk5lbrxsroZlQESAJFcAoqEOw oA0F5LpL//U9yfREygkW64FHrvzgGrO4M5DiX1k/nJ4hFWaVE+ohpk3V3Adz7OB+ugCL zuFg== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PNCKdtlKp7cJx6A6+2qRAeYNVZFHRjlYGRD8OJC8KOQ=; fh=u094L6RN/tmoEoENJdI3bLC47AnqclF+CCAMtUNu31Y=; b=GH89J7MaE7plocb7To2HYR4hvuB4jZTyYott5yol1SGqa/Au37eP+d6ykJsDSlSnHs 7WTWTzEWDW0mBbvZZPoAiFd3qUv9GT3B08kZ5NxXXYDYHl0oNwfY3hZA9hcVJoO2sQKH KaqCskzDx/q77ZRv5jdAy9nXOSUP8RiBlEO5vVIocc1kd0Tdzpm5HjQomLzTp2ZyFAoS w75jK7ecI4k6qpTlVbYo503Dz83qQ2SV10N8F2TzbxEUxRdyYmiVAkTr6jdJYQ22eI/X qyavwfaXqFm0GNoc0qdA3N3lC7EImrWZEiPKEjaOwZ5llGN2FbRRo2VmviuVIfXnarst AFFw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R59f8x1U; 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 4fb4d7f45d1cf-5d3d13bb497si2425806a12.375.2024.12.07.16.22.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Dec 2024 16:22:03 -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=R59f8x1U; 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 36CCB894B8; Sun, 8 Dec 2024 01:21:33 +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="R59f8x1U"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9773E8947A; Sun, 8 Dec 2024 01:21:31 +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-x329.google.com (mail-ot1-x329.google.com [IPv6:2607:f8b0:4864:20::329]) (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 5C2A4893D1 for ; Sun, 8 Dec 2024 01:21:29 +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-x329.google.com with SMTP id 46e09a7af769-71de02b24cfso268328a34.1 for ; Sat, 07 Dec 2024 16:21:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733617288; x=1734222088; darn=lists.denx.de; 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=PNCKdtlKp7cJx6A6+2qRAeYNVZFHRjlYGRD8OJC8KOQ=; b=R59f8x1UANRQCCCTYxFLALdf9q+pKFNCcBwMUl1JB4x2r0iDW67pw93XdfVm9P611E eQlaZOc7+fzltsbHmKdk+Pti0wNgt0DgFROUs3U7MDWQUllib3MB/j+4imObfQpH5USj TxqYp/1zj0qJbNESBYawowrT7+7yXw25eVDpO1eFqxTAKNYJ6+DbnOBrl4ZPssxwDTxz /wJo/t51thcINWBVhFklEzggTfm0NHCWe+2td+6kpjq2nUuD1jzw/8ypP0QmJJAgS+rz CeeFFRmFEFtuVqsjV37XvTFKzWl5am47FWKFRxALkh+ZsvjNaqrSoeYult9I3mOrldRZ icjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733617288; x=1734222088; 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=PNCKdtlKp7cJx6A6+2qRAeYNVZFHRjlYGRD8OJC8KOQ=; b=Z3gtVxrtGhWeDuS2AFcSIhN717P+/7wr3uMm4Tp70sWZ36deANDwCI6uTl6uFqqMay itKbAC2T+FRCjqjUXtAoDT3hKox8gQ9KNANiMHWkLBxAs+Vwl8KGW3H7oIED0/iatYYT ufFksLduG3SakBjLgxLZTrQtIlUl8cvgn+2GZzIsQias/5LTsh6l1NkYI51MewxBM3bO GcuhFqZuQUJdZAPtHC2kRvs2oqL2vDdumCHg8rA6ppqAaJLEcjYqn+w/L2M8WLKFxRd4 e5IHXQEd4gjJvM99ay2pde7lG8jG4YJe1RIsEOfqDdzhpXxt6MMpU2Eun6OFto+J01OO GuEA== X-Forwarded-Encrypted: i=1; AJvYcCVaMIo6krC08ZPqrcsGiZV9eZDc1+5rEdsmRvWPZ0q9CUFhiTGcAx3VDxed2CVFtFiPeXo7D7A=@lists.denx.de X-Gm-Message-State: AOJu0YygqbbjqpTdijy9fr9AJWRl7OIjV3fo1n+ZZO7E+Ud3OGNJ6DMq Mnq2Np6morftNF6/Pm1HtEEeH862vhvfKqK3FnlRjQp5uDpMF/GNXnHLYW5ObVU= X-Gm-Gg: ASbGncvLtnVURd2K8jlo93ZLmyG3c6fJKfBXgzluazVE0ZgWwX2Nm5DpuwXu2X+dY8h CbqaozihfFxSN7QKyZOnLHLchhBaJHVHzBEuW2aV8xikVt0rzYcz27xgYaIYRVGaZQT+QxxtkZA uigQaLIlyiHBhlOUcZPN/x87YavK2OSbvi2DjlZ9BibyPY880oNZ1U5Vh/CslXv5jBEsKNQDs8w kZSPQPdiVGW8hZPloqkTHzt/mcpsefhCQ+mTkcfEssPFbBV38oCxbo= X-Received: by 2002:a05:6870:d86:b0:29e:290f:7af4 with SMTP id 586e51a60fabf-29f73860dcemr3991998fac.34.1733617288252; Sat, 07 Dec 2024 16:21:28 -0800 (PST) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-29f7e411dafsm1161519fac.36.2024.12.07.16.21.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Dec 2024 16:21:27 -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 4/6] lmb: Improve coding style Date: Sat, 7 Dec 2024 18:21:19 -0600 Message-Id: <20241208002121.31887-5-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241208002121.31887-1-semen.protsenko@linaro.org> References: <20241208002121.31887-1-semen.protsenko@linaro.org> 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 Fix checkpatch warnings. No functional change. Signed-off-by: Sam Protsenko Acked-by: Ilias Apalodimas --- lib/lmb.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/lib/lmb.c b/lib/lmb.c index 1642ce48bbbd..8c1c9b0f67c8 100644 --- a/lib/lmb.c +++ b/lib/lmb.c @@ -57,7 +57,6 @@ static long lmb_regions_overlap(struct alist *lmb_rgn_lst, unsigned long r1, unsigned long r2) { struct lmb_region *rgn = lmb_rgn_lst->data; - phys_addr_t base1 = rgn[r1].base; phys_size_t size1 = rgn[r1].size; phys_addr_t base2 = rgn[r2].base; @@ -70,11 +69,11 @@ static long lmb_regions_adjacent(struct alist *lmb_rgn_lst, unsigned long r1, unsigned long r2) { struct lmb_region *rgn = lmb_rgn_lst->data; - phys_addr_t base1 = rgn[r1].base; phys_size_t size1 = rgn[r1].size; phys_addr_t base2 = rgn[r2].base; phys_size_t size2 = rgn[r2].size; + return lmb_addrs_adjacent(base1, size1, base2, size2); } @@ -235,9 +234,9 @@ static long lmb_add_region_flags(struct alist *lmb_rgn_lst, phys_addr_t base, coalesced++; break; - } else { - return -1; } + + return -1; } } @@ -288,14 +287,17 @@ static long _lmb_free(struct alist *lmb_rgn_lst, phys_addr_t base, phys_addr_t end = base + size - 1; int i; - rgnbegin = rgnend = 0; /* supress gcc warnings */ + /* Suppress GCC warnings */ + rgnbegin = 0; + rgnend = 0; + rgn = lmb_rgn_lst->data; /* Find the region where (base, size) belongs to */ for (i = 0; i < lmb_rgn_lst->count; i++) { rgnbegin = rgn[i].base; rgnend = rgnbegin + rgn[i].size - 1; - if ((rgnbegin <= base) && (end <= rgnend)) + if (rgnbegin <= base && end <= rgnend) break; } @@ -304,7 +306,7 @@ static long _lmb_free(struct alist *lmb_rgn_lst, phys_addr_t base, return -1; /* Check to see if we are removing entire region */ - if ((rgnbegin == base) && (rgnend == end)) { + if (rgnbegin == base && rgnend == end) { lmb_remove_region(lmb_rgn_lst, i); return 0; } @@ -340,6 +342,7 @@ static long lmb_overlaps_region(struct alist *lmb_rgn_lst, phys_addr_t base, for (i = 0; i < lmb_rgn_lst->count; i++) { phys_addr_t rgnbase = rgn[i].base; phys_size_t rgnsize = rgn[i].size; + if (lmb_addrs_overlap(base, size, rgnbase, rgnsize)) break; } @@ -715,7 +718,7 @@ long lmb_reserve(phys_addr_t base, phys_size_t size) } static phys_addr_t _lmb_alloc_base(phys_size_t size, ulong align, - phys_addr_t max_addr, enum lmb_flags flags) + phys_addr_t max_addr, enum lmb_flags flags) { int ret; long i, rgn; @@ -730,16 +733,18 @@ static phys_addr_t _lmb_alloc_base(phys_size_t size, ulong align, if (lmbsize < size) continue; - if (max_addr == LMB_ALLOC_ANYWHERE) + + if (max_addr == LMB_ALLOC_ANYWHERE) { base = lmb_align_down(lmbbase + lmbsize - size, align); - else if (lmbbase < max_addr) { + } else if (lmbbase < max_addr) { base = lmbbase + lmbsize; if (base < lmbbase) base = -1; base = min(base, max_addr); base = lmb_align_down(base - size, align); - } else + } else { continue; + } while (base && lmbbase <= base) { rgn = lmb_overlaps_region(&lmb.used_mem, base, size); @@ -813,7 +818,7 @@ phys_addr_t lmb_alloc_base_flags(phys_size_t size, ulong align, } static phys_addr_t _lmb_alloc_addr(phys_addr_t base, phys_size_t size, - enum lmb_flags flags) + enum lmb_flags flags) { long rgn; struct lmb_region *lmb_memory = lmb.free_mem.data; From patchwork Sun Dec 8 00:21:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 848268 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp1467700wrt; Sat, 7 Dec 2024 16:22:15 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVnlqjA68tb+UGKb/plXnSdmDUkNhtb8/n61KVcW4NxSaIts9OOePiKXHoYJrVaaPxf5xHW6g==@linaro.org X-Google-Smtp-Source: AGHT+IENZzSpt0dS1XHxy0TeLFymVG3dR92OWcB2JnY0cMNd+ZCZCIJtqSumM9nxZM42tfTyoQFd X-Received: by 2002:a05:6402:3715:b0:5d0:c9e6:30b9 with SMTP id 4fb4d7f45d1cf-5d3be65d5f6mr7271611a12.3.1733617335326; Sat, 07 Dec 2024 16:22:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733617335; cv=none; d=google.com; s=arc-20240605; b=fZL7V+q75Qp+0e9MbJguEDjrLdiao4xoymi3dzcCr77Jb6XCaZw58mxmMxlz3u+3v8 hoK5BRV7X9FQlkGPSXXA9sTRKSuTGlSqJJE973AVs/M8YdDxXDKKrXQ80fLl50+uehtm nPvktm1oWWXsOFXVKjc2Ih9JyCM91KyiWcUuuMZFu8blXoHcwLKT3d6w6cIbTmKYXmsg GshW+Ce/6vIX+4LCk2tVduJ0gsyeGeoRT2y9weE03Qsu9umAk780M0pkNiiuVh9M9KZ/ zEx6KbDKJBytnYAncyE2v4qK8ets4LDNQ8x4Us4MvrysSbuOLwH+QNmDCal2kN1lmHJB JdvA== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JhFAzQ+/yM6WDEQKu66WaKVE6rQil2zKHC0dyZ9PH3w=; fh=aSwzfFmZA8lugrJvCHTh6nFnApoUsrHwOE95gHmmtjo=; b=EscI65yh4aB64yD1FnrwPZ+dJWUJ3x/L1WZQ5of1MEWdmK/iK4Fkwxxj26glvcTFJD U5iAvGKt8FxLMyX5D+vmkFqPO/ouVS1fy76M8NFStzCAAnPdrBLQRMkA7L6gjSnQ9Vff WSx/pEBPHYbyBgK0N6SAkqw+aZnZAHtZWCQSB4JfndKoluZ+K423wM9rT9k1DfmbvClW fVegmgBXQGkYcpFweySONMoeMgG/z8246Jzo6cRUw0eTH1PKIOhJRp219RyxMLu5ZCGr ov8C0yGkhaIL6AbnvJrEu/QCyP212rqmVAbRwL7U1Zh1YnJtv/5XdJahdqh1Kliz9zG4 pWaw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xDgoHR7J; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5d3efaa967esi426886a12.248.2024.12.07.16.22.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Dec 2024 16:22:15 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xDgoHR7J; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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 98563893D2; Sun, 8 Dec 2024 01:21:35 +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="xDgoHR7J"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2C4C3893D1; Sun, 8 Dec 2024 01:21:34 +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=unavailable autolearn_force=no version=3.4.2 Received: from mail-ot1-x32b.google.com (mail-ot1-x32b.google.com [IPv6:2607:f8b0:4864:20::32b]) (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 BFDA9893D2 for ; Sun, 8 Dec 2024 01:21:30 +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-x32b.google.com with SMTP id 46e09a7af769-71d4e043dd9so848992a34.1 for ; Sat, 07 Dec 2024 16:21:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733617289; x=1734222089; darn=lists.denx.de; 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=JhFAzQ+/yM6WDEQKu66WaKVE6rQil2zKHC0dyZ9PH3w=; b=xDgoHR7JpRrM5IGDoKlWJ+sVxTM0/FyMxI3Wgu7eZaaYXjq3KJiJr+E0j/9KbwrpC8 bV/R/abW56D8XxgipRhje/9bA4Z6Y9aKBZMIvNPZP634G+ugWfxrTwpOP2Ep4glbXQkF DBQ6dxQ+dPr1D3ecOoMSmaBUBrS5jTWozsGE8xdH6kW4vDi5n0qLivKImt8helwMIL3a 0EGycsbzxvspLLlGg83x9vileWlvlFE0B6BXjBmKJzOB3uMSMSKtgCd17MTEkztFQwab fNr0Og7P3vn7YOTMybeHm1bnY6mQzUYf/dPJ9d0cZql8OU+eBusCWXHH0pKLDaqiHhPD 20Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733617289; x=1734222089; 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=JhFAzQ+/yM6WDEQKu66WaKVE6rQil2zKHC0dyZ9PH3w=; b=MLevwB4Q1fcE6FdVGD9h/ak0ZghMdw9hykfNexVVJkSvZt3eUiZt6d0qyzSv+OBIQQ cM/zL+gJ5efo1gX5eiMmhS93h5ZfOfMr14gtO22C4oXOtq5f8SZPKzPwcU2zE6fLfvvX my82Xmcpx97OvS0/Zv6VA4TUtt0n01IfXUZo3nWTmYuh59xmxBhS2jMNRkWg9tdOaLDu BkMaWM5ABGYrMf43bBaJCFi1RaTKRH0GAgrkwWFSU2fQX/ZP0Lou1msp/ZCDMtnj/0+Y 4rqHk9tT1UDO8hli7zkmHpN0cntDr7oN2JEgmc/g4zXCwkCY0X4YsoHDd8lJeoOtB4AA wqLA== X-Forwarded-Encrypted: i=1; AJvYcCXTKcVaTl9GmOvThBF14mgds5ZtrD4qSKqxDpAUwHxdBD37VMTU5ctkItoF4d3r3UEwUazfErk=@lists.denx.de X-Gm-Message-State: AOJu0Yxss0xkhQmgc5mJIMAH+lmKzjxGxOM+5j3gJsF3oujt/wMt0Tr9 Z1uiGT+TrS+8zUwrn7Fw9gS6pAe6VMfb3ykab/9eeRhIWwEbhzozhJLixqShc2U= X-Gm-Gg: ASbGncvglVgezSeKdishMTlC1KSOZ9B21mIMS0BmNwCCR0U/o6gbEwTwI3OFLTcGXS0 tTX3EA0AmEYtNK/o/9v7R3Ngq+ioXA8um8CPaJa4QTOt7/lnkiaRwPU1q+KDCYR3LEtrts0SR4m poMCwl4RJb4RMVj8+dm/YiJLQ3um/KNAT6M7mZe+0dGAUStN5xYRmhCf5ThwReQ7lUvuoqUZjpC mBYfbc77Ilhx3yHAnLxXdtIwtnnIHt/cTL5U3WYZN2tZSR9ClhzJ30= X-Received: by 2002:a9d:6a50:0:b0:71d:eb02:bae8 with SMTP id 46e09a7af769-71deb02be26mr182603a34.8.1733617289471; Sat, 07 Dec 2024 16:21:29 -0800 (PST) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71dc4a02827sm1544052a34.55.2024.12.07.16.21.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Dec 2024 16:21:28 -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 5/6] lmb: Improve kernel-doc comments Date: Sat, 7 Dec 2024 18:21:20 -0600 Message-Id: <20241208002121.31887-6-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241208002121.31887-1-semen.protsenko@linaro.org> References: <20241208002121.31887-1-semen.protsenko@linaro.org> 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 Fix warnings from kernel-doc script. Improve and unify overall style of kernel-doc comments in lmb source files. Move all kernel-doc comments for public functions into the header, as recommended in U-Boot documentation, which also takes care of existing duplication. While at it, do a bit of cosmetic cleanups as well. No functional change. Signed-off-by: Sam Protsenko Acked-by: Ilias Apalodimas --- include/lmb.h | 125 ++++++++++++++++++++++++++++++-------------------- lib/lmb.c | 55 ---------------------- 2 files changed, 74 insertions(+), 106 deletions(-) diff --git a/include/lmb.h b/include/lmb.h index f221f0cce8f7..03d5fac6aa79 100644 --- a/include/lmb.h +++ b/include/lmb.h @@ -1,6 +1,13 @@ /* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Logical memory blocks. + * + * Copyright (C) 2001 Peter Bergner, IBM Corp. + */ + #ifndef _LINUX_LMB_H #define _LINUX_LMB_H + #ifdef __KERNEL__ #include @@ -8,21 +15,15 @@ #include #include -/* - * Logical memory blocks. - * - * Copyright (C) 2001 Peter Bergner, IBM Corp. - */ - -#define LMB_ALLOC_ANYWHERE 0 -#define LMB_ALIST_INITIAL_SIZE 4 +#define LMB_ALLOC_ANYWHERE 0 +#define LMB_ALIST_INITIAL_SIZE 4 /** - * enum lmb_flags - definition of memory region attributes - * @LMB_NONE: no special request - * @LMB_NOMAP: don't add to mmu configuration - * @LMB_NOOVERWRITE: the memory region cannot be overwritten/re-reserved - * @LMB_NONOTIFY: do not notify other modules of changes to this memory region + * enum lmb_flags - Definition of memory region attributes + * @LMB_NONE: No special request + * @LMB_NOMAP: Don't add to MMU configuration + * @LMB_NOOVERWRITE: The memory region cannot be overwritten/re-reserved + * @LMB_NONOTIFY: Do not notify other modules of changes to this memory region */ enum lmb_flags { LMB_NONE = 0, @@ -32,11 +33,10 @@ enum lmb_flags { }; /** - * struct lmb_region - Description of one region. - * - * @base: Base address of the region. - * @size: Size of the region - * @flags: memory region attributes + * struct lmb_region - Description of one region + * @base: Base address of the region + * @size: Size of the region + * @flags: Memory region attributes */ struct lmb_region { phys_addr_t base; @@ -46,10 +46,9 @@ struct lmb_region { /** * struct lmb - The LMB structure - * - * @free_mem: List of free memory regions - * @used_mem: List of used/reserved memory regions - * @test: Is structure being used for LMB tests + * @free_mem: List of free memory regions + * @used_mem: List of used/reserved memory regions + * @test: Is structure being used for LMB tests */ struct lmb { struct alist free_mem; @@ -58,51 +57,77 @@ struct lmb { }; /** - * lmb_init() - Initialise the LMB module + * lmb_init() - Initialise the LMB module. + * + * Return: 0 on success, negative error code on failure. * * Initialise the LMB lists needed for keeping the memory map. There - * are two lists, in form of alloced list data structure. One for the + * are two lists, in form of allocated list data structure. One for the * available memory, and one for the used memory. Initialise the two * lists as part of board init. Add memory to the available memory * list and reserve common areas by adding them to the used memory * list. - * - * Return: 0 on success, -ve on error */ int lmb_init(void); /** - * lmb_add_memory() - Add memory range for LMB allocations + * lmb_add_memory() - Add memory range for LMB allocations. * * Add the entire available memory range to the pool of memory that * can be used by the LMB module for allocations. - * - * Return: None */ void lmb_add_memory(void); long lmb_add(phys_addr_t base, phys_size_t size); -long lmb_reserve(phys_addr_t base, phys_size_t size); + /** - * lmb_reserve_flags - Reserve one region with a specific flags bitfield. + * lmb_reserve() - Reserve a memory region (with no special flags) + * @base: Base address of the memory region + * @size: Size of the memory region * - * @base: base address of the memory region - * @size: size of the memory region - * @flags: flags for the memory region - * Return: 0 if OK, > 0 for coalesced region or a negative error code. + * Return: 0 on success, negative error code on failure. + */ +long lmb_reserve(phys_addr_t base, phys_size_t size); + +/** + * lmb_reserve_flags() - Reserve one region with a specific flags bitfield + * @base: Base address of the memory region + * @size: Size of the memory region + * @flags: Flags for the memory region + * + * Return: + * * %0 - Added successfully, or it's already added (only if LMB_NONE) + * * %-EEXIST - The region is already added, and flags != LMB_NONE + * * %-1 - Failure */ long lmb_reserve_flags(phys_addr_t base, phys_size_t size, enum lmb_flags flags); + phys_addr_t lmb_alloc(phys_size_t size, ulong align); phys_addr_t lmb_alloc_base(phys_size_t size, ulong align, phys_addr_t max_addr); phys_addr_t lmb_alloc_addr(phys_addr_t base, phys_size_t size); phys_size_t lmb_get_free_size(phys_addr_t addr); +/** + * lmb_alloc_base_flags() - Allocate specified memory region with specified + * attributes + * @size: Size of the region requested + * @align: Alignment of the memory region requested + * @max_addr: Maximum address of the requested region + * @flags: Memory region attributes to be set + * + * Allocate a region of memory with the attributes specified through the + * parameter. The max_addr parameter is used to specify the maximum address + * below which the requested region should be allocated. + * + * Return: Base address on success, 0 on error. + */ phys_addr_t lmb_alloc_base_flags(phys_size_t size, ulong align, phys_addr_t max_addr, uint flags); /** - * lmb_alloc_addr_flags() - Allocate specified memory address with specified attributes + * lmb_alloc_addr_flags() - Allocate specified memory address with specified + * attributes * @base: Base Address requested * @size: Size of the region requested * @flags: Memory region attributes to be set @@ -111,20 +136,21 @@ phys_addr_t lmb_alloc_base_flags(phys_size_t size, ulong align, * parameter. The base parameter is used to specify the base address * of the requested region. * - * Return: base address on success, 0 on error + * Return: Base address on success, 0 on error. */ phys_addr_t lmb_alloc_addr_flags(phys_addr_t base, phys_size_t size, uint flags); /** - * lmb_is_reserved_flags() - test if address is in reserved region with flag bits set + * lmb_is_reserved_flags() - Test if address is in reserved region with flag + * bits set + * @addr: Address to be tested + * @flags: Bitmap with bits to be tested * * The function checks if a reserved region comprising @addr exists which has * all flag bits set which are set in @flags. * - * @addr: address to be tested - * @flags: bitmap with bits to be tested - * Return: 1 if matching reservation exists, 0 otherwise + * Return: 1 if matching reservation exists, 0 otherwise. */ int lmb_is_reserved_flags(phys_addr_t addr, int flags); @@ -134,9 +160,7 @@ int lmb_is_reserved_flags(phys_addr_t addr, int flags); * @size: Size of the region to be freed * @flags: Memory region attributes * - * Free up a region of memory. - * - * Return: 0 if successful, -1 on failure + * Return: 0 on success, negative error code on failure. */ long lmb_free_flags(phys_addr_t base, phys_size_t size, uint flags); @@ -160,7 +184,7 @@ static inline int lmb_read_check(phys_addr_t addr, phys_size_t len) * io_lmb_setup() - Initialize LMB struct * @io_lmb: IO LMB to initialize * - * Returns: 0 on success, negative error code on failure + * Return: 0 on success, negative error code on failure. */ int io_lmb_setup(struct lmb *io_lmb); @@ -178,12 +202,13 @@ void io_lmb_teardown(struct lmb *io_lmb); * * Add the IOVA space [base, base + size] to be managed by io_lmb. * - * Returns: 0 if the region addition was successful, -1 on failure + * Return: 0 on success, negative error code on failure. */ long io_lmb_add(struct lmb *io_lmb, phys_addr_t base, phys_size_t size); /** - * io_lmb_alloc() - Allocate specified IO memory address with specified alignment + * io_lmb_alloc() - Allocate specified IO memory address with specified + * alignment * @io_lmb: LMB to alloc from * @size: Size of the region requested * @align: Required address and size alignment @@ -191,7 +216,7 @@ long io_lmb_add(struct lmb *io_lmb, phys_addr_t base, phys_size_t size); * Allocate a region of IO memory. The base parameter is used to specify the * base address of the requested region. * - * Return: base IO address on success, 0 on error + * Return: Base IO address on success, 0 on error. */ phys_addr_t io_lmb_alloc(struct lmb *io_lmb, phys_size_t size, ulong align); @@ -201,9 +226,7 @@ phys_addr_t io_lmb_alloc(struct lmb *io_lmb, phys_size_t size, ulong align); * @base: Base Address of region to be freed * @size: Size of the region to be freed * - * Free up a region of IOVA space. - * - * Return: 0 if successful, -1 on failure + * Return: 0 on success, negative error code on failure. */ long io_lmb_free(struct lmb *io_lmb, phys_addr_t base, phys_size_t size); diff --git a/lib/lmb.c b/lib/lmb.c index 8c1c9b0f67c8..eee3bd37d446 100644 --- a/lib/lmb.c +++ b/lib/lmb.c @@ -609,14 +609,6 @@ static __maybe_unused void lmb_reserve_common_spl(void) } } -/** - * lmb_add_memory() - Add memory range for LMB allocations - * - * Add the entire available memory range to the pool of memory that - * can be used by the LMB module for allocations. - * - * Return: None - */ void lmb_add_memory(void) { int i; @@ -673,16 +665,6 @@ long lmb_add(phys_addr_t base, phys_size_t size) return lmb_map_update_notify(base, size, MAP_OP_ADD, LMB_NONE); } -/** - * lmb_free_flags() - Free up a region of memory - * @base: Base Address of region to be freed - * @size: Size of the region to be freed - * @flags: Memory region attributes - * - * Free up a region of memory. - * - * Return: 0 if successful, negative error code on failure - */ long lmb_free_flags(phys_addr_t base, phys_size_t size, uint flags) { @@ -790,19 +772,6 @@ phys_addr_t lmb_alloc_base(phys_size_t size, ulong align, phys_addr_t max_addr) return alloc; } -/** - * lmb_alloc_base_flags() - Allocate specified memory region with specified attributes - * @size: Size of the region requested - * @align: Alignment of the memory region requested - * @max_addr: Maximum address of the requested region - * @flags: Memory region attributes to be set - * - * Allocate a region of memory with the attributes specified through the - * parameter. The max_addr parameter is used to specify the maximum address - * below which the requested region should be allocated. - * - * Return: base address on success, 0 on error - */ phys_addr_t lmb_alloc_base_flags(phys_size_t size, ulong align, phys_addr_t max_addr, uint flags) { @@ -851,18 +820,6 @@ phys_addr_t lmb_alloc_addr(phys_addr_t base, phys_size_t size) return _lmb_alloc_addr(base, size, LMB_NONE); } -/** - * lmb_alloc_addr_flags() - Allocate specified memory address with specified attributes - * @base: Base Address requested - * @size: Size of the region requested - * @flags: Memory region attributes to be set - * - * Allocate a region of memory with the attributes specified through the - * parameter. The base parameter is used to specify the base address - * of the requested region. - * - * Return: base address on success, 0 on error - */ phys_addr_t lmb_alloc_addr_flags(phys_addr_t base, phys_size_t size, uint flags) { @@ -935,18 +892,6 @@ static int lmb_setup(bool test) return 0; } -/** - * lmb_init() - Initialise the LMB module - * - * Initialise the LMB lists needed for keeping the memory map. There - * are two lists, in form of alloced list data structure. One for the - * available memory, and one for the used memory. Initialise the two - * lists as part of board init. Add memory to the available memory - * list and reserve common areas by adding them to the used memory - * list. - * - * Return: 0 on success, -ve on error - */ int lmb_init(void) { int ret; From patchwork Sun Dec 8 00:21:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 848269 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp1467722wrt; Sat, 7 Dec 2024 16:22:20 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXTFcuBKC8Q9dvyR95/8vCXNiPkJF84gqR5i4Zt8gO6R5X1Cd7efN9QUNfhUq3iT5T5Dv89PQ==@linaro.org X-Google-Smtp-Source: AGHT+IE1En6uSxb8WUnvJF1eEyQmYki8Ycm9MNfrnu5QEiutsVV+nEuUsT/BT7jCPg9fXtdXq3a2 X-Received: by 2002:a05:6402:3205:b0:5d0:b2c8:8d04 with SMTP id 4fb4d7f45d1cf-5d3be6e629dmr9168701a12.18.1733617340706; Sat, 07 Dec 2024 16:22:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733617340; cv=none; d=google.com; s=arc-20240605; b=BWq6R5oqUULUqHvhkjbe1tbXUyZPlxYR0pnAJYhNZrnsScDzIcTYzZZpPp9P+/BfmC /DDVTmPCmMJp8iXqUw0gtIvstRGapZ3kyflqPi9lxPqigEb7Cx1oAddhVMOkgMd6jkvu YkfykFdHKyssWmi4kHAGm1o9HNE6t3l5WT3AIZvIBlsfd+MqHZN/oOqpZ2LYBKaIr8GA ls02RJXc1CjVELFIuu+jNyZM48x6ayLHgu3SM3eyNIoRa2P4dCVbmr965e54zN386MlY MerKyJSlBFA1reFhssS5ASE9B/78vGTRdiMhXrFWgnmgGl2SGfScJU8PhnlAsZUP1RD7 bVGA== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SCeNms7zpNG0jTcbTNzWVxUF1LXhhvIVR0PAeT2Txe8=; fh=lLMxwtKpFWYwGS3WwGnGI8GgAJ7/hnvDiCNdcYSxi30=; b=FwTM48yjJkdsjrVf/BnTTkODgEraShqIXQUwpLwI6rcCH0nX45ENLRVTJgcUBaGFXk NO4q+EkmbAwHfxO14puLx+5J6GpYdDYCnXZ7+IPXeaWg/Kd/RmPQoXOGPLH1YBYVyYbC jTp4aZDb6vlhCVb+yz4t58zG7dNg2Ku1I2pKbQz06fpTg+xqFhNffbDudtOqhPjHcaqb WPWX48KkPIiV0syiKHuqNEl00tCxxyEhs5z1hbYQX0N8gmS3/qnmIw9JtLm7i6fcLKUU QZay8Uo2VSxzVul/HJuktAVzqlPXIf5raGOyQP+EeOeSLBanRhQ8wIHqMI+S5ORA7VPQ DKGg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UkzV+egO; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5d14b6078a5si4601266a12.71.2024.12.07.16.22.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Dec 2024 16:22:20 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UkzV+egO; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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 E5192893EC; Sun, 8 Dec 2024 01:21:37 +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="UkzV+egO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A8D59893D4; Sun, 8 Dec 2024 01:21:36 +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=unavailable autolearn_force=no version=3.4.2 Received: from mail-oi1-x229.google.com (mail-oi1-x229.google.com [IPv6:2607:f8b0:4864:20::229]) (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 E488489477 for ; Sun, 8 Dec 2024 01:21:31 +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-oi1-x229.google.com with SMTP id 5614622812f47-3eb38f8a178so237207b6e.0 for ; Sat, 07 Dec 2024 16:21:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733617290; x=1734222090; darn=lists.denx.de; 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=SCeNms7zpNG0jTcbTNzWVxUF1LXhhvIVR0PAeT2Txe8=; b=UkzV+egO1Wvd9INkNKvo9OJeMY9CWPkczOmv/7DI9jXB/7ZxyP2kuDs42KBhfVgCmw igYosOicjxpV+9H+ondyMTwLgduH8ZrP6rw/FuRyhtZvjjqe1olgxyoOhS18KqNYbDnM WdrsrnflW7bG/jD4imJec+QF1/rfw3uFt3A1PA4eM6JcFLBpQGUOXldr3c9WShXKyLoW 3qh/y6ScSSI1FAOqgRpgcIft1CjaxsLM7LVeUl0CXvaX/PZD9nQJY+OLKxIwKGc2JE+o RuSf2tOMOIwI9nJVLpuW31Jp5yDTZXAJ0uNs5PDHrvsdqXeHTHZJPetWip5BtCUk2Kps sJDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733617290; x=1734222090; 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=SCeNms7zpNG0jTcbTNzWVxUF1LXhhvIVR0PAeT2Txe8=; b=KCGRO+hbySDj12NuvBuLIXyOX91F6AwfvQTKnROjaznxHXqSSCjxiYk6HvcOXCEVIu qrSy45y85sN5fJxGHZ3YhZ/aERnPsWm1cKPYfynwSnSxOgW0arQXen09KlJ4+SvU9mxu jWd8a7FaIsnSDPX3pw8N7ho3aWl2gqNXc1pbjHaXcHPPROOEO1z9aimzrSzD+jBakP3n PGS9rodwh01KtI090r9e9sjCfLddK+8+Z+v/pRiN/t6EGJU/kS9TN3a+YgEnWYgfpWd4 vDcy9xBAIy94Uoefu6jt/rWBNLRj58oMB78mFX9N2C1caa0a1DGvghgF9O4wunqPnmhu N/lA== X-Forwarded-Encrypted: i=1; AJvYcCWp1ncinWivaTxXzE02rTken7XWznH9+lI4u6Po6CfNbC7TkTr9w8kAYG8MJZHPCIJCiqRpIEE=@lists.denx.de X-Gm-Message-State: AOJu0YxrpICFCKOek+rAqDXej5WCHszceybkKG/VrMXtDikJaMUi5MWa SpLQqLpE91sM5Musmtv+MtyvZeDAp8OeDcaYB5dSEkajbE9RzuYIUe3uQHwip1w= X-Gm-Gg: ASbGncvpAD6ZmFpU7LU2OeVaOM23vSqWZOMnIYJLGulpMqstebzqgWyuUkrZG3L7jhX I36mVLbGvD0lGI4JOOClu699mfRE+z32P1oafGtkynVwsK0jhn69TWX0d8n8CcgDBF4sboYye4j iZr1YTtKYHv2AsYyr7KSwNXl1IDPUw1zvYDzSkxyz6Fky5xNheXHrwHrUxTK9UX/7fXE7IQqIaW UM5OPBpa4aTaEN+mrGCh5/DnzV5LTyeYcpvmVoJunz6DzY+YS+S3Jk= X-Received: by 2002:a05:6808:f13:b0:3ea:6a8b:a40f with SMTP id 5614622812f47-3eb19d0e1b7mr3432623b6e.25.1733617290703; Sat, 07 Dec 2024 16:21:30 -0800 (PST) Received: from localhost ([136.62.192.75]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71dc493b1e3sm1547118a34.1.2024.12.07.16.21.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Dec 2024 16:21:30 -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 6/6] boot: fdt: Handle already reserved memory in boot_fdt_reserve_region() Date: Sat, 7 Dec 2024 18:21:21 -0600 Message-Id: <20241208002121.31887-7-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241208002121.31887-1-semen.protsenko@linaro.org> References: <20241208002121.31887-1-semen.protsenko@linaro.org> 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 The boot_fdt_add_mem_rsv_regions() function can be called twice, e.g. first time during the board init (as a part of LMB init), and then when booting the OS with 'booti' command: lmb_add_region_flags lmb_reserve_flags boot_fdt_reserve_region boot_fdt_add_mem_rsv_regions ^ | +-----------------------+ | (1) | (2) lmb_reserve_common image_setup_linux lmb_init ... initr_lmb do_booti board_init_r 'booti' That consequently leads to the attempt of reserving the same memory areas (described in the 'reserved-memory' dts node) in LMB. The lmb_add_region_flags() returns -EEXIST error code in such cases, but boot_fdt_reserve_region() handles all negative error codes as a failure to reserve fdt memory region, printing corresponding error messages, which are essentially harmless, but misleading. For example, this is the output of 'booti' command on E850-96 board: => booti $loadaddr - $fdtaddr ... ERROR: reserving fdt memory region failed (addr=bab00000 size=5500000 flags=2) ERROR: reserving fdt memory region failed (addr=f0000000 size=200000 flags=4) ... Starting kernel ... The mentioned false positive error messages are observed starting with commit 1d9aa4a283da ("lmb: Fix the allocation of overlapping memory areas with !LMB_NONE"), which removes the check for the already added memory regions in lmb_add_region_flags(), making it return -1 for !LMB_NONE cases. Another commit 827dee587b75 ("fdt: lmb: add reserved regions as no-overwrite") changes flags used for reserving memory in boot_fdt_add_mem_rsv_regions() from LMB_NONE to LMB_NOOVERWRITE. So together with the patch mentioned earlier, it makes lmb_add_region_flags() return -1 when called from boot_fdt_reserve_region(). Since then, the different patch was implemented, adding the check back and returning -EEXIST error code in described cases, which is: lmb: Return -EEXIST in lmb_add_region_flags() if region already added Handle -EEXIST error code as a normal (successful) case in lmb_reserve_flags() and don't print any messages. Fixes: 1d9aa4a283da ("lmb: Fix the allocation of overlapping memory areas with !LMB_NONE") Signed-off-by: Sam Protsenko Reviewed-by: Ilias Apalodimas --- boot/image-fdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot/image-fdt.c b/boot/image-fdt.c index 3d5b6f9e2dc7..73c43c30684f 100644 --- a/boot/image-fdt.c +++ b/boot/image-fdt.c @@ -77,7 +77,7 @@ static void boot_fdt_reserve_region(u64 addr, u64 size, enum lmb_flags flags) debug(" reserving fdt memory region: addr=%llx size=%llx flags=%x\n", (unsigned long long)addr, (unsigned long long)size, flags); - } else { + } else if (ret != -EEXIST) { puts("ERROR: reserving fdt memory region failed "); printf("(addr=%llx size=%llx flags=%x)\n", (unsigned long long)addr,