From patchwork Fri Oct 11 07:23:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ritesh Harjani (IBM)" X-Patchwork-Id: 13832169 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CA40CEDDBD for ; Fri, 11 Oct 2024 07:23:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DC41C6B009B; Fri, 11 Oct 2024 03:23:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D4A776B009C; Fri, 11 Oct 2024 03:23:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BC40B6B009D; Fri, 11 Oct 2024 03:23:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 979B46B009B for ; Fri, 11 Oct 2024 03:23:40 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 7315C80E65 for ; Fri, 11 Oct 2024 07:23:36 +0000 (UTC) X-FDA: 82660481316.17.B99EDA6 Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by imf08.hostedemail.com (Postfix) with ESMTP id 89DC4160017 for ; Fri, 11 Oct 2024 07:23:36 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=hXLj4LOG; spf=pass (imf08.hostedemail.com: domain of ritesh.list@gmail.com designates 209.85.210.178 as permitted sender) smtp.mailfrom=ritesh.list@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728631281; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=e0XcJo9JGEctgbuPEWvt7vh5Yz6kEP61gEF6kN7DKNI=; b=wBVt8kT2fMj7JH/Vu5c3P1iA9P8X6ty/idYXk66p9EKc4mgMdixvNrRvvo2XXnxC2tALE6 K8hDmcB0Vh/qHCMFQrpveyxUurwB1H18iceC7IZtrHYpfrFOlpFn/fpS65K/s3PXhPcst8 /GfGKsuc4DKPJiWWcI39ReM6uRtRwdA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728631281; a=rsa-sha256; cv=none; b=puSvftnn8bCjQur+OFHUSwEjAKRp4R9NXxKlMwrK9mwru5UFuT/bl+F6ySNoL2UqAEQ4d/ uZ7Fg+ravuaUS+BOsyUvqSNFtG2bTJguUo3EWvWmL3n4r7X2hDuX77/+bCZA7SPyyE4v/j lghjWd6/aFSVyG+B7HGQS02yO4CHr2s= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=hXLj4LOG; spf=pass (imf08.hostedemail.com: domain of ritesh.list@gmail.com designates 209.85.210.178 as permitted sender) smtp.mailfrom=ritesh.list@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-71dec1cf48fso1511813b3a.0 for ; Fri, 11 Oct 2024 00:23:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728631417; x=1729236217; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=e0XcJo9JGEctgbuPEWvt7vh5Yz6kEP61gEF6kN7DKNI=; b=hXLj4LOG69YxaYnJMtyH7nlRvdMz3LizPLrUT5VaZ1ORqA0s8braICJjjSCQyeOLLc a/MkqTWzyGpJYc8f7sJpXlRt1tXFAA6+DG1Nt/RQdtwJ9/fZgiqwBLt8As+aKR/rmvyK 9SQzjFDsUOpR++2f021mq+DAJb2hwSbC13C1mVv6h42z8BZfuyeVINyttEXCEHmxueaZ i4z5hjmy3yaAvHyLqolIejYFigd7Id1Mr9FtJHRSS5R6cB12iZssXbWp1KEaxY+fQ3kG ZUs5znNROrtd7kn/HKk7GYsoJUBjcwBPX7zinz+uArQP72sY4MGvdPGBFDFkgbL/UcHi xfWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728631417; x=1729236217; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e0XcJo9JGEctgbuPEWvt7vh5Yz6kEP61gEF6kN7DKNI=; b=BvpdDRya+P/dGUhC8t4QxL4NcL0rgZpg/ZwfI+p+KElj/VFNsvV6aMDejX3T5P8yxn QkjX8uT+ZSUvTiKFSAg0zV8bdWIzhNoDJCD/IVGqaYt8F5gE11bvaPBUXxaAH5gb0dIK TDwX2vsMDtAJVsGYQVsQ2LoMANqaj8LOHw57w87C4jkliZ5VM9ZayssBbOsxxDX4U0+p kwWk7hLhMNbILNrICnxoKb6nu+qc68ujr6m9i9gC1r/wkJWCq6C9TxwsXx0S0tvKycNZ fTYmf9KGFYA4USIfnyEPHQxGmcsGvkn/5p+q0OD+BpfaTra3fdumU20oKZUmL/u+T+eZ K2ZA== X-Gm-Message-State: AOJu0YwmUhJoP2vNgHZgrWI3ThUpzFTErVwICj5/DGF3DZMAIr9UL//4 VtpWyaWoDB8lSRk8GssiARf0jDcpr0R+07j5sPSQcmKPDnpygkZR X-Google-Smtp-Source: AGHT+IFVJLbjrihstm+z1iQykRd1RHjrMq1OggwLcM33etRABky007jtDtqG43IWWvWSUwC4nwqrng== X-Received: by 2002:a05:6a21:6b0a:b0:1d6:de67:91ca with SMTP id adf61e73a8af0-1d8bcefd51bmr2327071637.4.1728631416985; Fri, 11 Oct 2024 00:23:36 -0700 (PDT) Received: from dw-tp.ibmuc.com ([49.205.218.89]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c8bad335dsm18825155ad.50.2024.10.11.00.23.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 00:23:36 -0700 (PDT) From: "Ritesh Harjani (IBM)" To: linuxppc-dev@lists.ozlabs.org Cc: linux-mm@kvack.org, Sourabh Jain , Hari Bathini , Zi Yan , David Hildenbrand , "Kirill A . Shutemov" , Mahesh J Salgaonkar , Michael Ellerman , Madhavan Srinivasan , "Aneesh Kumar K . V" , Donet Tom , LKML , Sachin P Bappalige , "Ritesh Harjani (IBM)" Subject: [RFC v2 2/4] fadump: Refactor and prepare fadump_cma_init for late init Date: Fri, 11 Oct 2024 12:53:10 +0530 Message-ID: <079e98d7db3b63bc8a568f4e8c03f2976878ae23.1728585512.git.ritesh.list@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Queue-Id: 89DC4160017 X-Stat-Signature: 71biq6oaqafnu7njiymkyu6sfeax7a4w X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1728631416-323873 X-HE-Meta: U2FsdGVkX1/cQktO0acGNVIAq6J9ndVz0DFxQN1cOyXNbDaDjxrYhCKdSyoPPL0PmOc+BpkhoyX5ZIvn8uvUm+eryUMAxmmwPUt/ii6esvL9B+fvpIq7ZV176kKQ0X3iqlYAuA3RXOExtiCpSLjtrvdlwwxj4AjujhEX00l9DjXeesD2CAtkYgHTgTvi7+gLs+dYWN9Spfl6aJ+7xd0kHOUXqWMkVXtgh8RlMeJAiyINsJ4K3R8N5M1hTG9fvXXoGhfmHLZPhXUkZ3SAod4IFNF67YHf/I6qMS8KnvBJpqhvob9fBbnm9vU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NWKfMExbFa0yZBjus1C4ZVp+tooSVaYRbe/mM4Xp7jCoongRSSSwZDjIi/jJ85SVx5KoomPEKdyx4qZ6MciV8892V+Symkn2oZokR4FTN3CU3u8jtitcVCaJ2d96SBpVgyPCcy0YRerhllFGK68OAtw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: We anyway don't use any return values from fadump_cma_init(). Since fadump_reserve_mem() from where fadump_cma_init() gets called today, already has the required checks. This patch makes this function return type as void. Let's also handle extra cases like return if fadump_supported is false or dump_active, so that in later patches we can call fadump_cma_init() separately from setup_arch(). Signed-off-by: Ritesh Harjani (IBM) --- arch/powerpc/kernel/fadump.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c index a612e7513a4f..162327d66982 100644 --- a/arch/powerpc/kernel/fadump.c +++ b/arch/powerpc/kernel/fadump.c @@ -78,27 +78,23 @@ static struct cma *fadump_cma; * But for some reason even if it fails we still have the memory reservation * with us and we can still continue doing fadump. */ -static int __init fadump_cma_init(void) +static void __init fadump_cma_init(void) { unsigned long long base, size; int rc; - if (!fw_dump.fadump_enabled) - return 0; - + if (!fw_dump.fadump_supported || !fw_dump.fadump_enabled || + fw_dump.dump_active) + return; /* * Do not use CMA if user has provided fadump=nocma kernel parameter. - * Return 1 to continue with fadump old behaviour. */ - if (fw_dump.nocma) - return 1; + if (fw_dump.nocma || !fw_dump.boot_memory_size) + return; base = fw_dump.reserve_dump_area_start; size = fw_dump.boot_memory_size; - if (!size) - return 0; - rc = cma_init_reserved_mem(base, size, 0, "fadump_cma", &fadump_cma); if (rc) { pr_err("Failed to init cma area for firmware-assisted dump,%d\n", rc); @@ -108,7 +104,7 @@ static int __init fadump_cma_init(void) * blocked from production system usage. Hence return 1, * so that we can continue with fadump. */ - return 1; + return; } /* @@ -125,10 +121,9 @@ static int __init fadump_cma_init(void) cma_get_size(fadump_cma), (unsigned long)cma_get_base(fadump_cma) >> 20, fw_dump.reserve_dump_area_size); - return 1; } #else -static int __init fadump_cma_init(void) { return 1; } +static void __init fadump_cma_init(void) { } #endif /* CONFIG_CMA */ /* @@ -638,7 +633,7 @@ int __init fadump_reserve_mem(void) pr_info("Reserved %lldMB of memory at %#016llx (System RAM: %lldMB)\n", (size >> 20), base, (memblock_phys_mem_size() >> 20)); - ret = fadump_cma_init(); + fadump_cma_init(); } return ret;