Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp2757257rdb; Tue, 12 Sep 2023 11:04:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHLTe9rnR2FaQh6WROdeHBuPRGK5iLEcgN7YBbLcYgGMH4Yp/uT39WEMcnryaexskeSxKV7 X-Received: by 2002:a05:6a00:4803:b0:68f:c8b3:3077 with SMTP id di3-20020a056a00480300b0068fc8b33077mr538488pfb.1.1694541897380; Tue, 12 Sep 2023 11:04:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694541897; cv=none; d=google.com; s=arc-20160816; b=fwsJuzGR9+R/AW2LFlrcfVSCRT1mjuB0d2qfNrL0ikePJCzZ4N8Vc1KhHmzM5ZK4gG 6AUjejAQ2Sb/XDhEK0kqzcu09egO5ExWv1GxSrlwC05yPots0vU0xjOvcKZJURRFWh1J m1VJrGccCnV4VxQ6CvmkwGc3zpDkzqtwOBnCaureWw3xOv8E83oq5M5QoYAa+mfMo1s9 hNYZBhF+5Jn0GuJzq7vWh8IjRoL+V+6lJ35vaXz2O6oPLT46ruvWiDGAQ3IPMwp11uYA rtq9iVWg3CESsF6rTzNZCKQD6PhuvCOcgaXPVWyZ7XS26O7FA8kI31UqDLIHaIo3972d 1Dbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DnnDuJS+0K60REixaoJUh9q88TyjPe4JdQr41N1/YMU=; fh=/r/XfnyBdIfnMnGpPKRoqF0R3n93LLjkzols1+yexsY=; b=0Aq5Fps8NCR40Xz8qm6EoG5oDVoaCtqv+PuOiLpqDtEVkPLy9Ae7NMm72x/UEQ8Usz 2jqs4xA1ywSQJ1R8OsL9oJOzeRl7oB4qAUxLjcmWE3MPn7YS/3koHiAld8O+1CN8D7Nd ITgQ2UG/Sr9eVlJ6gsIB1DbW36ep7pLSYWzqro2r5RBTGhAa2NoUDwgjCIe9Eb6/XE31 K41/5X4xr2CbAk/V6SMVuo+s3bp8tORH7TUVAVgXdPw+IBeAuV9nX2N+VI2fOdeebnNH tQI/tIdE6c6Utct9bstfnWbdtB1aKWyNRCMZUNOF/A7U8V6fPPI1D3fjIlzduZDtHdyb hh4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="Xk/ChSZ+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id ay4-20020a056a00300400b0068a51cd6d50si8155916pfb.314.2023.09.12.11.04.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 11:04:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="Xk/ChSZ+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id DADBF8042391; Tue, 12 Sep 2023 01:30:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232753AbjILIa0 (ORCPT + 99 others); Tue, 12 Sep 2023 04:30:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232720AbjILIaS (ORCPT ); Tue, 12 Sep 2023 04:30:18 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2940510D2 for ; Tue, 12 Sep 2023 01:30:14 -0700 (PDT) Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38C8N3VK014641; Tue, 12 Sep 2023 08:30:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=DnnDuJS+0K60REixaoJUh9q88TyjPe4JdQr41N1/YMU=; b=Xk/ChSZ+d0TEf8FftB4YybefoQfJCfh4N2CWVbvz6rqHUQCO3phAByG/92IzZ6P/NfTm CpdgpMIdVKUJU/uS93qSRAgBbwiMzoN1H5hI5g+4hT1iqvofCGVSeS6oe0iwjCEVULsD MjGh1SucEmXI0m8tEUElFMSKu4xpgh+A85oVHleMO35qDdxwkSWC2F8wuFHhPevDlmgj VXGI9XoSabutJzdKehzawCSHsNJZEUUDCqz3nUNljQ24e45hnL5I8IYTOW932VGHqHcz dK/rP875vcPlmqhMISJOz7GBHjnlE6C3OiXNTIrzj12nWj2KtIKg4nqla4tb0rRxbye4 qw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3t2me1r43j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Sep 2023 08:30:03 +0000 Received: from m0360072.ppops.net (m0360072.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 38C8Ofit018900; Tue, 12 Sep 2023 08:30:03 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3t2me1r430-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Sep 2023 08:30:03 +0000 Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 38C7KEFt011980; Tue, 12 Sep 2023 08:30:02 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3t15r1s2ue-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Sep 2023 08:30:02 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 38C8TsLC2490988 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 12 Sep 2023 08:29:54 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CCB872004F; Tue, 12 Sep 2023 08:29:54 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F2BA120040; Tue, 12 Sep 2023 08:29:52 +0000 (GMT) Received: from li-bd3f974c-2712-11b2-a85c-df1cec4d728e.in.ibm.com (unknown [9.203.106.137]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 12 Sep 2023 08:29:52 +0000 (GMT) From: Hari Bathini To: lkml , linuxppc-dev , Kexec-ml Cc: Dave Young , Baoquan He , Mahesh J Salgaonkar , Sourabh Jain , Michael Ellerman Subject: [PATCH v3 2/2] powerpc/fadump: make is_kdump_kernel() return false when fadump is active Date: Tue, 12 Sep 2023 13:59:50 +0530 Message-ID: <20230912082950.856977-2-hbathini@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230912082950.856977-1-hbathini@linux.ibm.com> References: <20230912082950.856977-1-hbathini@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: UxbFGUvTXedFlQ-ChYzDpnEe2M9Mpmm9 X-Proofpoint-GUID: o_khCojcZJKu_5niZqqqK8-MDfA0OPBh X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-12_06,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 mlxlogscore=999 adultscore=0 spamscore=0 malwarescore=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 mlxscore=0 clxscore=1015 impostorscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309120068 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]); Tue, 12 Sep 2023 01:30:36 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Currently, is_kdump_kernel() returns true in crash dump capture kernel for both kdump and fadump crash dump capturing methods, as both these methods set elfcorehdr_addr. Some restrictions enforced for crash dump capture kernel, based on is_kdump_kernel(), are specifically meant for kdump case and not desirable for fadump - eg. IO queues restriction in device drivers. So, define is_kdump_kernel() to return false when f/w assisted dump is active. Signed-off-by: Hari Bathini --- arch/powerpc/include/asm/kexec.h | 8 ++++++-- arch/powerpc/kernel/crash_dump.c | 12 ++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/kexec.h b/arch/powerpc/include/asm/kexec.h index a1ddba01e7d1..e1b43aa12175 100644 --- a/arch/powerpc/include/asm/kexec.h +++ b/arch/powerpc/include/asm/kexec.h @@ -99,10 +99,14 @@ void relocate_new_kernel(unsigned long indirection_page, unsigned long reboot_co void kexec_copy_flush(struct kimage *image); -#if defined(CONFIG_CRASH_DUMP) && defined(CONFIG_PPC_RTAS) +#if defined(CONFIG_CRASH_DUMP) +bool is_kdump_kernel(void); +#define is_kdump_kernel is_kdump_kernel +#if defined(CONFIG_PPC_RTAS) void crash_free_reserved_phys_range(unsigned long begin, unsigned long end); #define crash_free_reserved_phys_range crash_free_reserved_phys_range -#endif +#endif /* CONFIG_PPC_RTAS */ +#endif /* CONFIG_CRASH_DUMP */ #ifdef CONFIG_KEXEC_FILE extern const struct kexec_file_ops kexec_elf64_ops; diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c index 9a3b85bfc83f..2086fa6cdc25 100644 --- a/arch/powerpc/kernel/crash_dump.c +++ b/arch/powerpc/kernel/crash_dump.c @@ -19,6 +19,7 @@ #include #include #include +#include #ifdef DEBUG #include @@ -92,6 +93,17 @@ ssize_t copy_oldmem_page(struct iov_iter *iter, unsigned long pfn, return csize; } +/* + * Return true only when kexec based kernel dump capturing method is used. + * This ensures all restritions applied for kdump case are not automatically + * applied for fadump case. + */ +bool is_kdump_kernel(void) +{ + return !is_fadump_active() && elfcorehdr_addr != ELFCORE_ADDR_MAX; +} +EXPORT_SYMBOL_GPL(is_kdump_kernel); + #ifdef CONFIG_PPC_RTAS /* * The crashkernel region will almost always overlap the RTAS region, so -- 2.41.0