From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F3C494CDDEF for ; Thu, 8 Oct 2026 15:24:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.118.77.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791473104; cv=none; b=UreUDzUQi5l6cdi+ZAezq9nrAAXDCl/GYiUcTVOm+gb/uSeBN1Mxuym4qZ/HxIQugoq8xT25QyuUnPq0S7lAFtRVxFc2otC+Cx5ZF9HUfZ1YdRk1EAJz5gq1/PhnVPW9hGFejYvEOs5qzV1w9R+f35QTFmxVXS9t2MNHhHlYCdk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791473104; c=relaxed/simple; bh=aEBbDkfz2X37S9VnlLxCxdVNSnJ9JzqZyJ8I85xOPkc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: References; b=PRqQH/L6lovtN+/7GrcSx5ewzAxByxs26vqBGpzAZYzw6l+2I3O+4i/5isSrGuKwoVddQhZvQnyDHbPddg3HqjRSan9QKZ8gPKQWB/umlyuHl3AkyTMfQCsobFfdm+mKubYEPhmeJfXLfvG5ueHsHXQo2gM1rnSWPOtm2t+J5Uw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=Q+cFc2Bv; arc=none smtp.client-ip=210.118.77.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="Q+cFc2Bv" Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20261008152449euoutp011843392271081a3f535f3357360e2d55~cl0iZJNS81760617606euoutp01p for ; Thu, 8 Oct 2026 15:24:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20261008152449euoutp011843392271081a3f535f3357360e2d55~cl0iZJNS81760617606euoutp01p DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1791473089; bh=axdWlSF8iVBum9thK6VZopslDZXT2NtsjnEhYF++jeE=; h=From:To:Cc:Subject:Date:References:From; b=Q+cFc2BvfAM6hq8BNBVUUGEJpLtazPQXVAyigshd+9gBPaXqou6aJyXlWskX/fV9m NbT7TK0KANRA7mvHXcTSe7avEDlvsp0umXP08TMlD+4tsO0xOd8St9ZeroU+hWmLIh t2ZpTNyQruGKU8Zfgua74G+f7qBRuzR+kiVC2Lec= Received: from eusmtip2.samsung.com (unknown [203.254.199.222]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20261008152449eucas1p29758be26c325084093c14cfa9b8b2d04~cl0iBiRnX2366123661eucas1p2o; Thu, 8 Oct 2026 15:24:49 +0000 (GMT) Received: from AMDC4653.digital.local (unknown [106.120.51.32]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20261008152448eusmtip229196db7cd15a42beeda51a2f89401c1~cl0hjR3uw3039130391eusmtip2O; Thu, 8 Oct 2026 15:24:48 +0000 (GMT) From: Marek Szyprowski To: linux-mm@kvack.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Marek Szyprowski , Mike Rapoport , Rob Herring , Saravana Kannan , Oreoluwa Babatunde , Wandun , Andrew Morton Subject: [PATCH v2 0/2] of: reserved_mem: use dynamically allocated reserved_mem array Date: Thu, 8 Oct 2026 17:23:59 +0200 Message-ID: <20261008152403.766439-1-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CMS-MailID: 20261008152449eucas1p29758be26c325084093c14cfa9b8b2d04 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20261008152449eucas1p29758be26c325084093c14cfa9b8b2d04 X-EPHeader: CA X-CMS-RootMailID: 20261008152449eucas1p29758be26c325084093c14cfa9b8b2d04 References: Mike Rapoport suggested [1] how to properly use dynamically allocated arrays during early boot. Use this approach for reserved_mem array during early scan of the reserved regions. Having all the reserved regions in a single array removes the need of the two pass initialization introduced by commit 8a6e02d0c00e ("of: reserved_mem: Restructure how the reserved memory regions are processed"), so implement it to make the code simpler, easier to understand and ready for adding proper error checking. Tested on ARM32, ARM64 and RiscV64 based boards. [1] https://lore.kernel.org/all/asc6brs_g0ky0wOM@kernel.org/ Best regards Marek Szyprowski, PhD Samsung R&D Institute Poland Changelog: v2: - removed superfluous ifdefs v1: https://lore.kernel.org/all/20261008094125.3197971-1-m.szyprowski@samsung.com/ - initial version Patch summary: Marek Szyprowski (2): of: reserved_mem: group allocation helpers together of: reserved_mem: allocate and map the reserved_mem array early drivers/of/fdt.c | 3 - drivers/of/of_private.h | 2 - drivers/of/of_reserved_mem.c | 455 +++++++++++++++-------------------- 3 files changed, 195 insertions(+), 265 deletions(-) -- 2.43.0