From patchwork Sat Feb 10 00:29:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oreoluwa Babatunde X-Patchwork-Id: 199169 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1217653dyd; Fri, 9 Feb 2024 16:33:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IGqu2m7GMHxe/vR9jMMnJziBsh+bqOjRXKSVkbQ3zSQwkg8Qo3GNDpFVbQhdPDTPxdT2tYc X-Received: by 2002:a05:6808:3086:b0:3bf:f4b4:cc28 with SMTP id bl6-20020a056808308600b003bff4b4cc28mr752149oib.48.1707525191438; Fri, 09 Feb 2024 16:33:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707525191; cv=pass; d=google.com; s=arc-20160816; b=wAQDeznYv+3H/QjFnPd95uZcryHE7XLepQZF9gnV0wtJUiRWej/w0LgedWa1rJnVNr oZfm0FM9TLBYcLlEz02S5IFyAoTLANja5f3RkqYdBy8yM1PimvUI3p81s7gWX41N7cy1 2TgyFgiMYDiNtMey4JwV3dX4koTlHSKzUmmrV2OMCowbXdjmZgqgLkdeJsD6PfkpRVxZ kyCs+kfjSzYnZi9QQon2VRLYI9CPHiNr87nmzev0aJqwUb/EPjq7pov+zcU3UhCbsBU5 m/KrlX271EHvta6dph41jPfY8/naIwDMKUiUEyBLJQQv93XfE/cnWl7rCUMXikS+7h7I WfCg== 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=e286i0IykEAFU41r707YXUMX3M7ZIYdFhpid21aIVz0=; fh=v2m+zdXnjqzCdr9PWQaXgUamZDYirWIEKoXCGhIJNVg=; b=xGJ3rkHOobTESQ/+Bw7lXh+RUdQK2isTL01aWGo/ppHuk4yyNfSqzee4ESq8t0Atrd JSWATGb3VeWZO+61PPRt53GQ9pWTbx14rq7NI7ED6f8+uYNYAfkL5GctgZ7NkAQxaWQa bldC31N6cYSo4SRHRnD91pAibcmxmgW+S51WkH7AZ0nnqYowuGaK71f7UnjDzz/Rc65p 5TM2j3WflWKz/E86iYPq6qhEhcwS8/+DeaRV58dzQAjEy9y//zX6WbuNCTnIoBVWLuB8 8T8vWX65O66+045j/N9cgJh/DBAWpMtkZmEnkkp+4ruyXAVT1e5xLAkSQEBnqZKR30T/ lJjA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=QdoyaOhv; 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-60190-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60190-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com X-Forwarded-Encrypted: i=2; AJvYcCXY7zImDlPf6NBRvZ/ZM9UZfRbqYoXAnfRJUlmhEFKvmFomR0kYOaYNW8yNZkn5yt8I4z2M79tZwwaeaOFV+kXSEiuukQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id ay18-20020a05620a179200b0078538a992ccsi818737qkb.24.2024.02.09.16.33.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 16:33:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60190-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=QdoyaOhv; 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-60190-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60190-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 347A61C22B43 for ; Sat, 10 Feb 2024 00:33:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D1DDF6D39; Sat, 10 Feb 2024 00:32:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="QdoyaOhv" Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 B4EBE1FC4; Sat, 10 Feb 2024 00:32:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707525146; cv=none; b=k1gtPhubAhxWQ9g2udyhp/5o8E31MI+kduE+nlRDDhvUOcReqo9faKUBxGcoiBIB3akf4JoOSvuwOylpmfIzZoZWYMBBgHtA7eQ13cxby+NjCB8jqQyNMPlSO+/FXYyKoKXOE2jSRm3WU2h/iPFnJ+CmNZVrjahuqcsMjCZAQsc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707525146; c=relaxed/simple; bh=S2uxyVIX+2DXgeJoXOSia6BmZqQD1L2X+CX/Og66v7o=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=q6n+YKDcNFz0Ob+jFSrpy+9iOoPlDOEfnjzwfs0aN8bYLbtV9qz2P66olMpBbPzF0JEQYyi34pW8iQ5Qt/K9HFLpPQR1men8BooRow6O9dTxRrI75quVU78T4OFa1CDHuGuYz4Tij6CYaCHKv/Lp50Jm7TQts9gJpC6DpN1WgkU= 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=QdoyaOhv; arc=none smtp.client-ip=205.220.168.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 (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 419NbBKU022924; Sat, 10 Feb 2024 00:29:49 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=e286i0IykEAFU41r707Y XUMX3M7ZIYdFhpid21aIVz0=; b=QdoyaOhvQ9B7TTBWUlTXI7ZTyofr0fzAOTLO G7w+IsCoNXpYNZpdz4KEfHF8LCESm9aSVswEO+iSUkO9tvPDDFJ4YhSGxqPtHX8d /YL/OV5cPVac8g+8dtTN5DPZ+k8kW4E0SAna/cNtwA2pgarOA1luQfGemEPW0U+6 1AOxgHU03i8xNVYicbFC8SO5wXJKaNMKztMywpTJfetvsMR4MyrTom8t6/ff4jP3 IW4B4hVlWw1M0e2SDm+h/udCiEDrs/8tikpPu+VgkbIYTKpdLi0vC2MbxmmB1Bn9 ryq6Vcg5hdcVJTg7MJREhcPfLuAjDt6MX4fi4hGt0vQvDgRvcQ== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3w5u4brcd8-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 41A0Tmrv025927 (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 1/3] loongarch: Call arch_mem_init() before platform_init() in the init sequence Date: Fri, 9 Feb 2024 16:29:29 -0800 Message-ID: <1707524971-146908-2-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 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: 9KmMJXSg3bjc8OdQ-nRggXQomCevukaI X-Proofpoint-GUID: 9KmMJXSg3bjc8OdQ-nRggXQomCevukaI 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 spamscore=0 suspectscore=0 priorityscore=1501 malwarescore=0 bulkscore=0 mlxscore=0 mlxlogscore=834 lowpriorityscore=0 impostorscore=0 phishscore=0 adultscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401310000 definitions=main-2402100002 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790469935181899795 X-GMAIL-MSGID: 1790469935181899795 The platform_init() function which is called during device bootup contains a few calls to memblock_alloc(). This is an issue because these allocations are done before reserved memory regions are set aside in arch_mem_init(). This means that there is a possibility for memblock to allocate memory from any of the reserved memory regions. Hence, move the call to arch_mem_init() to be earlier in the init sequence so that all reserved memory is set aside before any allocations are made with memblock. Signed-off-by: Oreoluwa Babatunde --- arch/loongarch/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- diff --git a/arch/loongarch/kernel/setup.c b/arch/loongarch/kernel/setup.c index edf2bba..66c307c 100644 --- a/arch/loongarch/kernel/setup.c +++ b/arch/loongarch/kernel/setup.c @@ -597,8 +597,8 @@ void __init setup_arch(char **cmdline_p) parse_early_param(); reserve_initrd_mem(); - platform_init(); arch_mem_init(cmdline_p); + platform_init(); resource_init(); #ifdef CONFIG_SMP From patchwork Sat Feb 10 00:29:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oreoluwa Babatunde X-Patchwork-Id: 199170 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1218588dyd; Fri, 9 Feb 2024 16:35:52 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUhMrIHXdJK4mvgxlBQx0T5KARxkSlxq+ff/5EtB53/IK9EWGRelbNCUx/nBOLjtRkPsbieS2LqBNVRbCsz8Vf5aanaYw== X-Google-Smtp-Source: AGHT+IHnm1X3T0/8MEshmDbGlXiZjW8nq2c644GaXMrHo13OionNmsPOHvcaeJ+Y3hHgCVoURxy0 X-Received: by 2002:a05:6a21:6816:b0:19c:890e:7ea3 with SMTP id wr22-20020a056a21681600b0019c890e7ea3mr920159pzb.20.1707525352046; Fri, 09 Feb 2024 16:35:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707525352; cv=pass; d=google.com; s=arc-20160816; b=GBddHPboA6kak6Sk92aciLQqirxj2spkEOXuglO/hxyDM730NMi8PyVovY7P6aQZej q1VjSJ9pbeY0PussO3kTjmLyPe7rzRxcn7O8bFttQCfMS+I9D4Mm1URUmfqPhOJveTV/ Fh7OjE4BSv6aWyEPUF5Di2WSHw7qicqqHKCdNF2o22z58nzAuv4J7xLqM+0OFRI7JDia SK+HhtzsS1ctKq2WKdJRuZzJ+07DIDg1fyOwd98LdMjK2jH0bW7CeoSoFKkgzSoz1F1G 7Hp54lzGy+eZHK9JYr1kgtNsaFi8cHrVzc9c2avWAdAuoAFtOpFu6MN8ryTfdrtJzmIL koVw== 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=zkOVB/xmCKwyIao4ag0E8GlwbKbdkV5auX42b+8qIII=; b=xk5TkfJ8axB6x4m7hXzaG2usjkzl2WUW9vmPJGZFcyTwkidnPU/ZFPa5ZrI4cjcYDs kJOfAc3lr3T9tepBljj+bmi1NzIQnbRwX2gAwDJ1RDUHQg7rgWorXO78pCVi05xJAmFF I5AFCswb5f1AcY3GGsDWbnI+wxPD/Br8SJP6eQ0w4ZrhE92VSx2zz+qPmG7OTM+SdNqO TTSUKnWZtzNLb8DFHak3Qlhhizn4e9q+dx7Rut2TUC3Pez5zpzIG6ZTZmim+mG3YIDAz RT3U9sqRwxDbSVwTSiquSG0IKZXN0BgVcc7kJg4D3j/6cii7a1OdX6Yo2ERA4FjVyaaV nZeQ==; 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-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60191-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com X-Forwarded-Encrypted: i=2; AJvYcCUzfIwwqmopo7mT0U9pTAmt0dwyxQjShWGVhNW/HsG5H4Z9TmgQKMHtPcO1uZeb7ehYfqYgsVvYZ6Ls5HJRXxyy3BKQKg== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id u5-20020a056a00124500b006e04c0b981fsi1169348pfi.57.2024.02.09.16.35.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 16:35:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60191-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; 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-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60191-ouuuleilei=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id DD6CBB26331 for ; Sat, 10 Feb 2024 00:33:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 56B3CC158; Sat, 10 Feb 2024 00:32:29 +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 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790470103787090139 X-GMAIL-MSGID: 1790470103787090139 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(); From patchwork Sat Feb 10 00:29:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oreoluwa Babatunde X-Patchwork-Id: 199171 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1219854dyd; Fri, 9 Feb 2024 16:39:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IHZrJblFweEf+apttaNrShYC6tZqHn9V2Ku4manCVka4PXv5oppB+EeRW2EU8ePjm1jgC31 X-Received: by 2002:a05:6a21:31c8:b0:19e:c3aa:7c33 with SMTP id zb8-20020a056a2131c800b0019ec3aa7c33mr155415pzb.36.1707525550182; Fri, 09 Feb 2024 16:39:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707525550; cv=pass; d=google.com; s=arc-20160816; b=tngav9ZtgpVNxYna35xtHn6C+xa+lXen1rnRZu1qfcHFnf1cCZGSiM0TM2iQaKUcOL ot+OwUoINrH5epUmAPRD/Tr2fov7ZvP31c+1nF+LggABwmIFiFe6YJIxxyaPdTjC3Mo0 zDJ6no4vLn562LJLGCFV76KB3den3czjuKWRBN73fMShOCn26XISxuzjivMQpT6lh3vb F3+47Wgp3W78ATL+p/TzoXE9eqi1cqoISvcAX36X5d4x3v/xe1xbMuN9cFfd/BdPUTFa bBd+N3v8laYAjZRK3I0VqpfRhzg83fyW5M89tfWEzPpyUU4vxEcgF96eu8DOhluj+Jqm A2rg== 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=d6dqZepJKO2rTUXSkKqDA+q3/xHQWCJswgErNvcSL/I=; fh=+VzvsTcVKvEx7Tm2Nrt3A6bC1PrRy8y1u92FsjDlbiM=; b=dYm6t6mN5GfHXKUXpgfPLVqzMIGhj5x12oz/P6AGCiGyinFRAkfyIohcfa4n+l3rSj LEQoQdZQ8va4nRQwBnn1AUyrxVg8kS+HniP28wxbuedpkvHFt7zIuwgyZXZdcF+4o6XL T/4dBVLl56c2qCe0mi00kpThJxMiwkaXtOSSZ6QHvT+FY03O/VNUoQsQMLXl6mIzn4vn RTsTLgSa0VBr0U0ShEKkA6/SdbBkh63if3nMQMudzbetrpIRE0eYtKETtRWwZJVK4+DF rBD8dYvsA44XotaDLLrGeEZPl8kiVQ9aw6c5QGeRzSQit3/tuOB7pAt96LwTP/cmjbsa w93Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="i1e/u8ml"; 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-60192-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60192-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com X-Forwarded-Encrypted: i=2; AJvYcCUuqh0XeaGZUklG6al+UqQ51HKj87rFiIsLjPiw3SmRn/gMZH8nYHFvaHvaarXLazsRlk7XbeOLyu/HWZbkwwnjPPTwwQ== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id nu7-20020a17090b1b0700b0029006dc5d23si2528821pjb.58.2024.02.09.16.39.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 16:39:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60192-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="i1e/u8ml"; 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-60192-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60192-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 53307284588 for ; Sat, 10 Feb 2024 00:33:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 464ABF51A; Sat, 10 Feb 2024 00:32:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="i1e/u8ml" 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 1428D364; 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=1707525147; cv=none; b=fQYwDf4Snc5hcQa0tNk0B0MefTb7vgBRB3BJFTDF5QqclOMRcypNJeJQv994leCJpeGLYWcEMYAF4Sw9p2+lFRzR43NweFmIHSOWo8zm2hR3SftxgO7fuNLwrWUd5UqDl2f1qqEXqQI0stMUpOJJjQKvg8hWimwh1VevBU/cAWo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707525147; c=relaxed/simple; bh=tWs/RdzKNSpeNzDiKFrH3scRraIzvGSczheN43Mzbmk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ghC+ZCEEqMREE8kll4PVffpUUWi/ZomsAV1lS93tuRKKbs0Kb9rmkMeiFSIAu7JVDeFmKvCe5S2zZIBDnoPNoa7xU2/5lTQYLmZWrYbsk+bz3VWhAUKulHu/tJBdgchiNVBpcD/QH1NwdQB1IpHxOAN9utiEEYp0OAV4il7HbUw= 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=i1e/u8ml; 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 (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41A0A2jM028423; Sat, 10 Feb 2024 00:29: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=d6dqZepJKO2rTUXSkKqD A+q3/xHQWCJswgErNvcSL/I=; b=i1e/u8mlsbL3zHlvANP1b06qPEQG4XpUsU1O RI6JisAzcGzNtLCMDbMsp5OsDe50MEK/uvAtV+yzh/DrMduN74hmxR/HpCK+qx6L afGn63vRw53qHV68rhtzeDkFFTeYZJvs8NujfaZGtVZnee7nweGGZjqyYYhae48z 72I2pr0FNfd8G9uAM19fBdwUKX6ezo7/Bk5qxBl3MT3pQg0vJMVf+fpDBH77cqhb SGSk4FqX2kNc6ANjKZ8VVRtuOTVr5+xeWfVoK2yLm8Lx8hESxF/9MfvqNHPUKFAX x5PMpFyZRXT/3/UgA5R8e1iBiUmooHsN4geJyi76pULcA09b4A== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3w5m159bts-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 10 Feb 2024 00:29:50 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 41A0Tn2A011721 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 10 Feb 2024 00:29:49 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:46 -0800 From: Oreoluwa Babatunde To: , , , , , , , , CC: , , , , , , Oreoluwa Babatunde Subject: [PATCH 3/3] sh: Call paging_init() earlier in the init sequence Date: Fri, 9 Feb 2024 16:29:31 -0800 Message-ID: <1707524971-146908-4-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 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-GUID: Ayi3Q_Ob1ob7P-VVfjTiuXJiq6E1gt_K X-Proofpoint-ORIG-GUID: Ayi3Q_Ob1ob7P-VVfjTiuXJiq6E1gt_K 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 mlxscore=0 suspectscore=0 bulkscore=0 mlxlogscore=862 lowpriorityscore=0 clxscore=1015 spamscore=0 priorityscore=1501 adultscore=0 malwarescore=0 impostorscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401310000 definitions=main-2402100002 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790470311683678235 X-GMAIL-MSGID: 1790470311683678235 The unflatten_device_tree() function contains a call to memblock_alloc(). This is a problem because this allocation is done before any of the reserved memory is set aside in paging_init(). This means that there is a possibility for memblock to allocate from any of the memory regions that are supposed to be set aside as reserved. Hence, move the call to paging_init() 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/sh/kernel/setup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c index d3175f0..ea40798 100644 --- a/arch/sh/kernel/setup.c +++ b/arch/sh/kernel/setup.c @@ -322,6 +322,8 @@ void __init setup_arch(char **cmdline_p) /* Let earlyprintk output early console messages */ sh_early_platform_driver_probe("earlyprintk", 1, 1); + paging_init(); + #ifdef CONFIG_OF_EARLY_FLATTREE #ifdef CONFIG_USE_BUILTIN_DTB unflatten_and_copy_device_tree(); @@ -330,8 +332,6 @@ void __init setup_arch(char **cmdline_p) #endif #endif - paging_init(); - /* Perform the machine specific initialisation */ if (likely(sh_mv.mv_setup)) sh_mv.mv_setup(cmdline_p);