Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp1270923rdb; Fri, 9 Feb 2024 16:32:49 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVGwasB8nYfdjF+8D6LsCEJnlJX6p7FTjrYJyAcu7cTaB2umSTHB1mkqRUc/oZE9nrpMrlOSj68DBH67HPDc2UUOee0lLxVMdfmaF0/WQ== X-Google-Smtp-Source: AGHT+IGAJRW/MlP9h9LsWdDIhK3m7LsRTQNIpv9NgWZnQ1zN7uyeyNqwYDU0FFbQvhNiaC7GwZuC X-Received: by 2002:a17:906:38b:b0:a38:3ea1:874c with SMTP id b11-20020a170906038b00b00a383ea1874cmr458296eja.33.1707525169002; Fri, 09 Feb 2024 16:32:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707525168; cv=pass; d=google.com; s=arc-20160816; b=FRL1vBp5H8ty7Cx4Ta7/r6lSWIbOaYwRbc8jsBXRsDYhKzFc/xi8r3m9nkGnWyj2EB ephVT7Vick3e62PlKf1N7d2+/FcCTjTGZ8HE42U3RoCBinIPpTHEh31Bu1ogW7xiUvE5 rMs+V/TakP6/DPl/yQWHAoFuVcKjYNUc9Qwe2V6T2M0spO9gtkRSnPupSbyLdxpIl1i3 vBkU9aW97XbzZuGZbzivzRq8TCzQMKiRPvlXKsJWh6+2AvSyfZmGWbLQXGbVuybFC3xa 8xbqMfgjs4cqJTo72Iq9KVYvhfLPtZhNwJwZ/0Txg1IWqzNkQB+n5GyT9Krecl+FBmU/ C+tA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=R3fxU4dR0quW3Tgb+gZMAiK/XttMGMv+PPJvaz5MUIM=; fh=ahZQ/ZKHs5Stre5gWAsXqS4ZUBPJyerDD+TmfzIM2Bg=; b=fCWPcNWHyWmMWH8VM/T+djGqnEhfhK4r/0RnBWDXY0yIqXHiDHv1KFHAI1vCw4bO6Y 2WmCxkZC2K4Q8BXJ+Dnw68vI9xBKBP0wOAv7LFQZa9c3XkAWCTgYCEaGNezo4ZsAy9N4 6ErcWLBpm5DwMhGEZROvb4ENdTTUfm03TYLetIt/RlX+OqZRlh0tOLjlSKzGv5amfbfw qNhwdgQFUQfxRh4NXlhX3qrpAYsNxSqH5/xwVxjEXA++S83dRFV70DUL8hOAvgyOscfA ru9LDoaTUeyVxWkpOONY0W90g9uLCGtITGsDbvjQsmTXFacx2rL5bQMkQihl87CMuHk6 E5rg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="Qb/6ZPXa"; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-60191-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60191-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com X-Forwarded-Encrypted: i=2; AJvYcCWVyc1jted/jp7YeqPbthKkLoVpjq6oGCX6vX8wuC6ag/1Y1Ep/cRFh2pHEsBl63hXxmwyLRw7Bsc7bKhBhzXmvspUkn7rdz32KReqQhw== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id gt32-20020a1709072da000b00a3c31ce51d4si4894ejc.279.2024.02.09.16.32.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 16:32:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60191-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="Qb/6ZPXa"; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-60191-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60191-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id BA3D61F2593F for ; Sat, 10 Feb 2024 00:32:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7A7BE440E; Sat, 10 Feb 2024 00:32:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="Qb/6ZPXa" Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 31B0A1FC8; Sat, 10 Feb 2024 00:32:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707525146; cv=none; b=E1ec/ofJAaWAldHIXbGt7gvWwvhyJdZK+KQT+ID1v0WeWeqNA/8cbsUfyFFXXLpO2fhiO9DCxZu6grm8LABoBCsgtzoIDBROrl0IchZTkQUw8EpwqxzaNQwF+uNBgWWYnny7t6z/vvfKqr7hR0flGCp9e/5nfnrSwO1ciO4anM4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707525146; c=relaxed/simple; bh=gviCHgZurZtJbesuudoDHrM6YOM41+oHzV9o6JFXP64=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=j0phBw1fOCr7w5FZk05xNSNpm2lJA2lVedcK6BdIcYCbuGfcw1Rj6ctZ3AdPQ/PYToJhSK6/IKHr6O7N2GrllEa2KS5mIsIHS+OwljN+2/yKLnMZ5mddwb/qFFT5vTakjQnUWqRBN37NmREpiVVgDlbk/69f7mvKp7lPbdWU2fM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=Qb/6ZPXa; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 419NoS8w018298; Sat, 10 Feb 2024 00:29:50 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=R3fxU4dR0quW3Tgb+gZM AiK/XttMGMv+PPJvaz5MUIM=; b=Qb/6ZPXapSRAd2BiJA4PIpzlA7Edht2yC/ZS j2d2HrbKjZ8iOckS8krkVr/rcs2JZkzsJLa/H/z0GH/uvkmgI1AYupnqB8f5czkw 0p35M6OOUK/4VVKHMuH753Jx8zS7TRE9Df5tKkNkDqeXXldspiEk8CEPiSVttTPa ywjbZJrY6aDl7mqPnmFuGgzNXEQRL3FZXz0BEQcUQ9HladP+nV4wGcGxf0ZJR/li 7TncvSvB/OQOCXHeXZCCF5ser7L5Wirnm4dEeY8OtWGAx2G7Ri4/6djz0DqpLU1V J8MpEY8whYe1hIZFJ/u8H47N2nojlC3Ko9BCPDWqcbzRh2YYyQ== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3w5ann2ghp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 10 Feb 2024 00:29:49 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 41A0Tmrw025927 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 10 Feb 2024 00:29:48 GMT Received: from th-lint-014.qualcomm.com (10.80.80.8) 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; Fri, 9 Feb 2024 16:29:45 -0800 From: Oreoluwa Babatunde To: , , , , , , , , CC: , , , , , , Oreoluwa Babatunde Subject: [PATCH 2/3] openrisc: Call setup_memory() earlier in the init sequence Date: Fri, 9 Feb 2024 16:29:30 -0800 Message-ID: <1707524971-146908-3-git-send-email-quic_obabatun@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1707524971-146908-1-git-send-email-quic_obabatun@quicinc.com> References: <1707524971-146908-1-git-send-email-quic_obabatun@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) 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: Vzt-UTEnPBlmTmv7_OrMV4bZE7yhaKr3 X-Proofpoint-GUID: Vzt-UTEnPBlmTmv7_OrMV4bZE7yhaKr3 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-09_20,2024-02-08_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=730 priorityscore=1501 phishscore=0 clxscore=1015 impostorscore=0 bulkscore=0 malwarescore=0 suspectscore=0 mlxscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401310000 definitions=main-2402100002 The unflatten_and_copy_device_tree() function contains a call to memblock_alloc(). This means that memblock is allocating memory before any of the reserved memory regions are set aside in the setup_memory() function which calls early_init_fdt_scan_reserved_mem(). Therefore, there is a possibility for memblock to allocate from any of the reserved memory regions. Hence, move the call to setup_memory() to be earlier in the init sequence so that the reserved memory regions are set aside before any allocations are done using memblock. Signed-off-by: Oreoluwa Babatunde --- arch/openrisc/kernel/setup.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c index 9cf7fb6..be56eaa 100644 --- a/arch/openrisc/kernel/setup.c +++ b/arch/openrisc/kernel/setup.c @@ -255,6 +255,9 @@ void calibrate_delay(void) void __init setup_arch(char **cmdline_p) { + /* setup memblock allocator */ + setup_memory(); + unflatten_and_copy_device_tree(); setup_cpuinfo(); @@ -278,9 +281,6 @@ void __init setup_arch(char **cmdline_p) } #endif - /* setup memblock allocator */ - setup_memory(); - /* paging_init() sets up the MMU and marks all pages as reserved */ paging_init(); --