From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 33A2F384250 for ; Wed, 27 May 2026 03:31:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779852698; cv=none; b=aXGGDNRbr2vXy5KLbJHHC3Du3uS4+Hor8hL/NJxJZCaIPVwbGAaJdshFl9uZ4+jlK67heIi7HCgF9w+8Zv7qysIVhDY5RITJTjkUV968AnwqoJ6zcl0njGgRRmz0qts/A8L8y6tgEV4CbaFDq/i0DcDmprqM31kIni+3txhO+cM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779852698; c=relaxed/simple; bh=uLOeasSEYWAvpT8ERSE9h3DlJwiheu4obyaLXpGYn9A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ScOD5/iVhuQjpSo7a9EnPawNN1hkKARyp7vgN0BPNoTUchMl/vgRXLuyRMQ+WkKJQmLUckdo/qZN2mGs/PXh+fqRTQm8uLOL9n0bMdI6jdZ/GxgT+qxJ1nR64TW8ZinB2zsM6N5qI+jIH1GSxStKecL5w4M6KNqQX8PF7TgKVBQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fjNjs3GJ; arc=none smtp.client-ip=209.85.210.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fjNjs3GJ" Received: by mail-pf1-f194.google.com with SMTP id d2e1a72fcca58-837dfccd950so5231869b3a.0 for ; Tue, 26 May 2026 20:31:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779852696; x=1780457496; darn=vger.kernel.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=HcszoUDc7316A03Dx3QXGOd8FcU7DWvjuNUEWPnVcI4=; b=fjNjs3GJAwN+lm0g8UqZB2nwneR2WiW9IpCRJYzVJIro/LNpvfEInu3+Mh3DGGEEUD iw8qodwRymampC4PR2mp3rAeLLFVZT7g6jmQVhI+4RipFPJaPAdNSJfAJkHAWIyw36kn GjG5gA3j2XprMK2vWCYbl0ObB11FcnWwyqqgYBHdJG4jfEFofEWVD76S3fkm8yyKgPCd 2VWy3vvrepSgJO49t7t05QfH7zNp/4KtzlFfFHSYp1zD+7tz4fwZhdmOZRsFIpPiO2Bw ACSVM29XXtYxunb13iTkpeSE9OUslqJGhRmWRMsPjKt+5MaAJSMLPfcSqsg/RScHsfEX oL0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779852696; x=1780457496; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=HcszoUDc7316A03Dx3QXGOd8FcU7DWvjuNUEWPnVcI4=; b=hGbK18PcquCtet1v+J32zF6hWBXwRB02gcY4cGxP8Qxd5gNxf7QjDrjsZv7Pic/XaG kAg1aAcwo6v80daNOLft3p97+TJFIEEjF9fJ7fv49Z2c/dWMdXT7AkDNgIR878hR0Yq3 OYXbqZZEURl67TPmCIPMTmt9ehHs4GOHzIdY8opmG5vE5E1+x8QEcQvdc4BnHpIHH1Zj PR4z75431ZbVGMZd3Cek3qcHlX+5n/IttPN75QbLM8HJETPcrzOBNvuow/DJooLITNKN QE7HcACCTJS04uv9mM74gNOqCnbPQPpNk7iRs9Juxf71xRF9gsil46P2/346tzjRnXTo TQZw== X-Forwarded-Encrypted: i=1; AFNElJ8bDHeH/Y4tVsJa7kYJ+8TJKXCBe0SPYdcwyDc9+VHREFwetFwFyBz0OgGohXIejOe6grYG51Bx3oLonts=@vger.kernel.org X-Gm-Message-State: AOJu0YwpsITSFPLekXjOPLH8HKPi2DhvRhJmIgRUw9YNTVOD4EI2M0bF lEYAGiXT4QsHuiLgroycpWKVBNQw1LGQrodsvlD97+s8i2hG9gB88DxR X-Gm-Gg: Acq92OHKbkKya5oq/JNUPA4x8wAPiisQ1sjk4WxtbUIu/nIgobVMVVryBezwlBwS7NV Vbd6caB18A2hZ6m3S5ZO33X1g01eyzt2AuCoHPvmt80ggsLHeO7GuNXv5NywGyijIAn5qzuJCWp nScG3Y5RZiJ3sM229UHgeaXbPXeFUbOiQ9e4Cb0ELhd+P7HIO0iqYQ47K8Kpd9lfrvwGRzhy0mf /HNwH7JXkpR3a8Wv0tCrt2ZX+J619vjLy8fisg4ZcrMz3QSWOB7jBW72z7wFVrlmlCvQ64Pmewh QuN55Sv/+3I30Ax5CfwBAo5kiPz/XMjDjbi9RzfZJe9Smktup5I1BjqNumzpZp1KMMd/LA/+Ten tMyi3e0sh6q/T99STXaw8D1GZdW6iYroE2FW67IUf0cjl4mgg3s3gYvHwjYn13yk0kJIkLyInKz pep++pp3E1upHILFJgqYwMOLwsN1EByDB69VzplRVeMv13ttQzzc5uwz5p7w== X-Received: by 2002:a05:6a00:3a0d:b0:837:8c8f:8f51 with SMTP id d2e1a72fcca58-8415f3bdb92mr20798104b3a.47.1779852696430; Tue, 26 May 2026 20:31:36 -0700 (PDT) Received: from intel.company.local ([210.184.73.204]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-841d7307596sm749688b3a.59.2026.05.26.20.31.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 May 2026 20:31:35 -0700 (PDT) From: Wandun Chen To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, kexec@lists.infradead.org, iommu@lists.linux.dev, zhaomeijing@lixiang.com Cc: catalin.marinas@arm.com, will@kernel.org, chenhuacai@kernel.org, kernel@xen0n.name, pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr, robh@kernel.org, saravanak@kernel.org, akpm@linux-foundation.org, bhe@redhat.com, rppt@kernel.org, pasha.tatashin@soleen.com, pratyush@kernel.org, ruirui.yang@linux.dev, m.szyprowski@samsung.com, robin.murphy@arm.com, quic_obabatun@quicinc.com Subject: [PATCH v3 11/11] loongarch: kdump: exclude non-dumpable reserved memory regions from vmcore Date: Wed, 27 May 2026 11:29:17 +0800 Message-ID: <20260527032917.3385849-12-chenwandun1@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260527032917.3385849-1-chenwandun1@gmail.com> References: <20260527032917.3385849-1-chenwandun1@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Wandun Chen Apply the same non-dumpable reserved memory filtering to LoongArch kdump as was done for arm64. Use of_reserved_mem_kdump_exclude() to drop flagged regions from the elfcorehdr PT_LOAD segments, and of_reserved_mem_kdump_nr_ranges() to pre-size the crash_mem array. Signed-off-by: Wandun Chen --- arch/loongarch/kernel/machine_kexec_file.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/loongarch/kernel/machine_kexec_file.c b/arch/loongarch/kernel/machine_kexec_file.c index 5584b798ba46..4b918c3d4a28 100644 --- a/arch/loongarch/kernel/machine_kexec_file.c +++ b/arch/loongarch/kernel/machine_kexec_file.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -67,6 +68,7 @@ static int prepare_elf_headers(void **addr, unsigned long *sz) nr_ranges = 2; /* for exclusion of crashkernel region */ for_each_mem_range(i, &start, &end) nr_ranges++; + nr_ranges += of_reserved_mem_kdump_nr_ranges(); cmem = kmalloc_flex(*cmem, ranges, nr_ranges); if (!cmem) @@ -91,6 +93,10 @@ static int prepare_elf_headers(void **addr, unsigned long *sz) goto out; } + ret = of_reserved_mem_kdump_exclude(cmem); + if (ret) + goto out; + ret = crash_prepare_elf64_headers(cmem, true, addr, sz); out: -- 2.43.0