From patchwork Thu Apr 27 10:18:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhijian Li (Fujitsu)" X-Patchwork-Id: 13225351 Received: from esa2.hc1455-7.c3s2.iphmx.com (esa2.hc1455-7.c3s2.iphmx.com [207.54.90.48]) (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 B29012572 for ; Thu, 27 Apr 2023 10:20:05 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6600,9927,10692"; a="115055341" X-IronPort-AV: E=Sophos;i="5.99,230,1677510000"; d="scan'208";a="115055341" Received: from unknown (HELO oym-r1.gw.nic.fujitsu.com) ([210.162.30.89]) by esa2.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Apr 2023 19:18:55 +0900 Received: from oym-m2.gw.nic.fujitsu.com (oym-nat-oym-m2.gw.nic.fujitsu.com [192.168.87.59]) by oym-r1.gw.nic.fujitsu.com (Postfix) with ESMTP id 6EE84EDE41 for ; Thu, 27 Apr 2023 19:18:52 +0900 (JST) Received: from kws-ab1.gw.nic.fujitsu.com (kws-ab1.gw.nic.fujitsu.com [192.51.206.11]) by oym-m2.gw.nic.fujitsu.com (Postfix) with ESMTP id 97331BF3E7 for ; Thu, 27 Apr 2023 19:18:51 +0900 (JST) Received: from FNSTPC.g08.fujitsu.local (unknown [10.167.226.45]) by kws-ab1.gw.nic.fujitsu.com (Postfix) with ESMTP id 9369C114147F; Thu, 27 Apr 2023 19:18:49 +0900 (JST) From: Li Zhijian To: x86@kernel.org, nvdimm@lists.linux.dev, kexec@lists.infradead.org Cc: linux-kernel@vger.kernel.org, y-goto@fujitsu.com, yangx.jy@fujitsu.com, ruansy.fnst@fujitsu.com, Li Zhijian , Baoquan He , Vivek Goyal , Dave Young Subject: [RFC PATCH v2 kexec-tools] kexec: Add and mark pmem region into PT_LOADs Date: Thu, 27 Apr 2023 18:18:35 +0800 Message-Id: <20230427101838.12267-5-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230427101838.12267-1-lizhijian@fujitsu.com> References: <20230427101838.12267-1-lizhijian@fujitsu.com> Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSS-9.1.0.1408-9.0.0.1002-27590.006 X-TM-AS-User-Approved-Sender: Yes X-TMASE-Version: IMSS-9.1.0.1408-9.0.1002-27590.006 X-TMASE-Result: 10--6.121700-10.000000 X-TMASE-MatchedRID: JUGAxiLh1cNSuJfEWZSQfBmCYUYerLHrwTlc9CcHMZerwqxtE531VIpb wG9fIuITIqMWro5FhUiisum7bT5AftDFhoVadDNxfUkgDiuGxn/jmgMQ17h56yS30GKAkBxWCu1 ja6drUTmG9aEScwNGm4Ay6p60ZV62yA7duzCw6dLdB/CxWTRRu25FeHtsUoHuUiwP+xLbq3AxYM d1N0VknfHRdUVXE7DT6INmePPYNPFgO21BQaodlQ== X-TMASE-SNAP-Result: 1.821001.0001-0-1-22:0,33:0,34:0-0 It does: 1. Add pmem region into PT_LOADs of vmcore 2. Mark pmem region's p_flags as PF_DEV CC: Baoquan He CC: Vivek Goyal CC: Dave Young Signed-off-by: Li Zhijian --- kexec/crashdump-elf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kexec/crashdump-elf.c b/kexec/crashdump-elf.c index b8bb686a17ca..ab257e825187 100644 --- a/kexec/crashdump-elf.c +++ b/kexec/crashdump-elf.c @@ -25,6 +25,8 @@ do { \ } while(0) #endif +#define PF_DEV (1 << 4) + /* Prepares the crash memory headers and stores in supplied buffer. */ int FUNC(struct kexec_info *info, struct crash_elf_info *elf_info, @@ -199,7 +201,7 @@ int FUNC(struct kexec_info *info, * A seprate program header for Backup Region*/ for (i = 0; i < ranges; i++, range++) { unsigned long long mstart, mend; - if (range->type != RANGE_RAM) + if (range->type != RANGE_RAM && range->type != RANGE_PMEM) continue; mstart = range->start; mend = range->end; @@ -209,6 +211,8 @@ int FUNC(struct kexec_info *info, bufp += sizeof(PHDR); phdr->p_type = PT_LOAD; phdr->p_flags = PF_R|PF_W|PF_X; + if (range->type == RANGE_PMEM) + phdr->p_flags |= PF_DEV; phdr->p_offset = mstart; if (mstart == info->backup_src_start