From patchwork Mon Dec 4 04:13:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oreoluwa Babatunde X-Patchwork-Id: 173063 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp2541844vqy; Sun, 3 Dec 2023 20:14:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IEotif09mU4dEt0AO01Jh+oG5ylBnjv3yIKnIAyJzawSGOXEI2oqaXQz926mOtU6ZBGWA3O X-Received: by 2002:a05:6870:499a:b0:1fa:d852:43f9 with SMTP id ho26-20020a056870499a00b001fad85243f9mr4879772oab.28.1701663291603; Sun, 03 Dec 2023 20:14:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701663291; cv=none; d=google.com; s=arc-20160816; b=pfkulON8ZPNeAvoEZau5a2hkqIAKKy/orgb/hQg2A9tam1nuJvMqXAyfNh4bWoN92z MDak4pirZA8r+b7ToragouvJr8Zlt8qmfPFwpGc2L4O2i7Tk4C72ycEcDXuO6BbI6ZdU yLgla1kzJGJmJ6Jg/DGEnbaoEM4Wxqsfj3zZiDM3C93LNTK7tDQLIVD0HfxIQH6MJytX u/Tano3yRPaJ6YKiAbUkbU+gZ5x9BxaLSZhnvnMG+IWfWqlItpgaXAzhwmxpYHz7o96E +0Yo44J2eGiajKG7LV9UqAff2b4XEDO4e/bv6UkQSnIFf8TM7u8uMhxM20UJjWoxVdjU YmpQ== 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=JCb6YaKmbUpp/1fFgtqOrlyOUwhehZd1rxGbEgdh7vM=; b=Hb4U8a4yXaZFIBldJBFIjXsmjstfloKbRYGJl11OAo7+44iQ216fAHVIn9+R0mEMTn e+AOZwYI4SpbhWENuh5ww+TnlLoYlsoWw0L8drH1SeC9XlSBd0ywwJ+UJnq02NcNu4tw MGpRKMWxl3z4xOrXzpFHfhhs7W5zYQQhOOCNwxdB+AXDJhj44x/Nj6+RIrdGRRLlZSmu bPx+JKjqL1mfxtgvk4mobOU58Xj/6mfjtfi5Scu84N9C9/rc/LJj/xd0HG3dqth4GQ0u RbNmi261+WXNtnmymlOJVBDcf7E+sswATiS4F9YgO1NA7rW83ZuSwuVGBoZ30bXXBI8Q 5GOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=FpkpnZSi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id f10-20020a63de0a000000b005c65bbc794asi3465241pgg.53.2023.12.03.20.14.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 20:14:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=FpkpnZSi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 107EC806086A; Sun, 3 Dec 2023 20:14:44 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234433AbjLDEOW (ORCPT + 99 others); Sun, 3 Dec 2023 23:14:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229839AbjLDEOU (ORCPT ); Sun, 3 Dec 2023 23:14:20 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D87F5D7; Sun, 3 Dec 2023 20:14:25 -0800 (PST) Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3B42kqko020227; Mon, 4 Dec 2023 04:14:08 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=FpkpnZSiHCf7GfCUTSgpN3SGQ/bEaqtqBSnxYo4vwU3gwMSk5kbz/EELMPGlFbsoLN/x 8LCdRBAAqhO/bHWBIT0tS1xq9xmwd4yoTk6kgkhOSpbknsC/a4LM7mQUx5oZI/ZOuogi AfuBW2/et1sRkofR1IHIqAI0Lz78jZzLN5387Zevgs+7QFtWb1e7LNi0aMKcbwXDpOsN wnsINpHION2o1yBEfMURL2zH447jgQuLxpVdPodchvoxUitTkQxJl9Wunv5vIQU/Bo5P 2W9b+9WOk86ZL5HgKcqNk+R/QHOgradurLhrk8rwFl5W4IkE2VuSGsILEdNud4GCIo+z xw== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3uqvyetuts-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 04 Dec 2023 04:14:07 +0000 Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3B44E6fu026363 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 4 Dec 2023 04:14:06 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; Sun, 3 Dec 2023 20:14:03 -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: Sun, 3 Dec 2023 20:13:39 -0800 Message-ID: <20231204041339.9902-7-quic_obabatun@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231204041339.9902-1-quic_obabatun@quicinc.com> References: <20231204041339.9902-1-quic_obabatun@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01b.na.qualcomm.com (10.47.209.197) 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: UFkQnKkOX_ktNu2ii40nuqy9eFgNGJYe X-Proofpoint-GUID: UFkQnKkOX_ktNu2ii40nuqy9eFgNGJYe 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_01,2023-11-30_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 impostorscore=0 mlxlogscore=907 bulkscore=0 suspectscore=0 clxscore=1015 spamscore=0 mlxscore=0 malwarescore=0 lowpriorityscore=0 priorityscore=1501 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2312040029 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 agentk.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 (agentk.vger.email [0.0.0.0]); Sun, 03 Dec 2023 20:14:44 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784323287435700537 X-GMAIL-MSGID: 1784323287435700537 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;