From patchwork Mon Dec 4 18:54:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oreoluwa Babatunde X-Patchwork-Id: 173526 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp2968612vqy; Mon, 4 Dec 2023 10:57:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IF8MfKKzscFQ+dQaGHzEJ2dBnQLbdIctkLL5AqVRMuHLCLHPb5Am5KAMlIsFYcmRI4FU82E X-Received: by 2002:a05:6358:9049:b0:16e:29bd:37be with SMTP id f9-20020a056358904900b0016e29bd37bemr2726260rwf.28.1701716233721; Mon, 04 Dec 2023 10:57:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701716233; cv=none; d=google.com; s=arc-20160816; b=DtyjcBdmifZFqw1nvXPs71FN46g+ljT6jWinGx867kCSHM5vvDW57opDQz/KHCfF9W DWe5yWN1mIxJCZcGU6QNEiilpnNyian/nlHp61sgkGhvVjO8svv0VP3XWbcpzgSK7Dyr pfMZWGsfJJzUD1cRsr8KrvZ+dDP68//6Soe9RzzexpgDeBYix0VDV32TzzSkHbAUSuN1 D1GoI0DXO9xE9Ak9U6eI5owfMoOyOyYMU6fKtqmc1gcAyb97uq8sqYp6/NLpTQ8l6pAm OggQItaiSrG7oHfQAsRK4thNXNYFBh4Ng6H1SWhwOTvtRM7mxOL6XhfVlYDtqnI0lg1l uB5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=w2Yu1aSNbKM1bL03R+vVvqY0inOjKskU3INa/KEM2Nc=; fh=AfACOzYsAw2FP5vLurF8iL1ue9vq0GHYQcZwZUotW7Q=; b=dnS7+NSt0KFrqeweN/p1K033SUtlSJf6buzjIvpWVIFzba3dtM7qkHXSE8x+ukFcLJ bRXt0dFGNXOPRyHARk2TwIhZWo773RQLALlEYBrc/DdGt7jtM43h1GGrFDuEf6bBzjg9 GBDxt6zOrJNLXoBZX9WYUkv5IgP8PEQS84TUB+xJJMH5jgc4TOUdiGR4fBdN+9YQNkTI +5F44tiTMPUC8CL14U0JBwSFPVBQpgc6HLGsYQdYY2YgoWfWjTstOjdPmN5pA3RCC4B0 2BBwrq8gMsT/g5N9x6ccimmikfwm2hLarwYAWdg0PQRMCZkL0xpU9WH8heJjJkfrKXt9 5Lvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=fXDeGUG6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id r2-20020a632b02000000b005c5e24d4364si3963609pgr.428.2023.12.04.10.57.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 10:57:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=fXDeGUG6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 7425C803D5AE; Mon, 4 Dec 2023 10:57:07 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344404AbjLDS4r (ORCPT + 99 others); Mon, 4 Dec 2023 13:56:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231192AbjLDS4i (ORCPT ); Mon, 4 Dec 2023 13:56:38 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADD1ACB; Mon, 4 Dec 2023 10:56:42 -0800 (PST) Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3B4CrX4t030965; Mon, 4 Dec 2023 18:54:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=qcppdkim1; bh=w2Yu1aSNbKM1bL03R+vVvqY0inOjKskU3INa/KEM2Nc=; b=fXDeGUG6ZWX+6isB8oklzt+YY7uk0/dH+DmcAiZTpDpkFbqwR3bllCl5uFZz7Va8oe3Y X3Ls24KqT4XcYdqD46+xRloFYzPdpbE+n/SiXvDP9ZFYl3FCNJnMj5KIofJmzBLan4qS iUeCVKwC+Okv6ZX27DhP5dVBqwnNYfWQ+5PBx+MPE1PHgJimJDLayKkZQeO5Nyewf0Kk FQ3C3R/4t0WvYujnkbzTNIiphXh9k3Mo8PGtQgGTtMLmuEh7sHfyDBqTMPI9EtOJjPb0 3UOTT9HhIuNUjPncpNEkN1hdDxavOMxI7oTcB9WfjuXowq+c6Jj5KtnwBKZxTMdWjfAt eg== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3uqv6750ps-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 04 Dec 2023 18:54:51 +0000 Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3B4Iso3x026202 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 4 Dec 2023 18:54:50 GMT Received: from hu-obabatun-lv.qualcomm.com (10.49.16.6) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Mon, 4 Dec 2023 10:54:46 -0800 From: Oreoluwa Babatunde To: , , , , , , , , , , , , , , , , , , CC: , , , , , Oreoluwa Babatunde Subject: [RFC PATCH v2 6/6] of: reserved_mem: Make MAX_RESERVED_REGIONS a config option Date: Mon, 4 Dec 2023 10:54:09 -0800 Message-ID: <20231204185409.19615-7-quic_obabatun@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231204185409.19615-1-quic_obabatun@quicinc.com> References: <20231204185409.19615-1-quic_obabatun@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: MYU01A4VatwslHHXknCHGnrM5dBroguV X-Proofpoint-GUID: MYU01A4VatwslHHXknCHGnrM5dBroguV X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-04_18,2023-12-04_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 priorityscore=1501 malwarescore=0 bulkscore=0 clxscore=1015 mlxscore=0 spamscore=0 suspectscore=0 adultscore=0 mlxlogscore=957 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2312040146 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 04 Dec 2023 10:57:07 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784378801007699338 X-GMAIL-MSGID: 1784378801007699338 Make the value of MAX_RESERVED_REGIONS a config option which can be modified based on user requirements. The reserved_mem_array is required during device bootup to store the information of the dynamically-placed reserved memory regions. After paging_init(), this information is transferred to another array which is dynamically allocated and used to store all the reserved memory regions. There is currently no obvious way to free the memory for the static array after its contents are copied over to the dynamically allocated array, but since the size required for the reserved_mem_array can vary from device to device depending on the number of dynamically-placed reserved memory regions, make the size of the array configurable in an attempt to save some memory. Signed-off-by: Oreoluwa Babatunde --- drivers/of/Kconfig | 13 +++++++++++++ drivers/of/of_private.h | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig index da9826accb1b..409ce2527461 100644 --- a/drivers/of/Kconfig +++ b/drivers/of/Kconfig @@ -102,4 +102,17 @@ config OF_OVERLAY config OF_NUMA bool +config OF_MAX_RESERVED_REGIONS + int "OF resvered_mem array size" + default "64" + range 1 64 + help + The reserved_mem_array is used to store information about the dynamically + placed reserved memory regions before we are able to allocate the memory + needed to store all the reserved memory regions defined in the DT. + Because the amount of memory needed initially for this array could vary, + make the size of the reserved_mem_array configurable in an attempt to + save some memory when possible. + if unsure, leave as default value. + endif # OF diff --git a/drivers/of/of_private.h b/drivers/of/of_private.h index ef56b2ea185c..278038bce0c0 100644 --- a/drivers/of/of_private.h +++ b/drivers/of/of_private.h @@ -36,7 +36,7 @@ struct alias_prop { #endif #define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1 -#define MAX_RESERVED_REGIONS 64 +#define MAX_RESERVED_REGIONS CONFIG_OF_MAX_RESERVED_REGIONS extern struct mutex of_mutex; extern raw_spinlock_t devtree_lock;