File makedumpfile-ppc64-VA-range-SUSE.patch of Package makedumpfile

From: Petr Tesarik <ptesarik@suse.cz>
Subject: Use correct l3 index size with SLE15-SP1 ppc64le kernels
References: bsc#1123015
Upstream: never, SUSE-specific

SLE 15 SP1 backported commit c2b4d8b7417a ("powerpc/mm/hash64: Increase
the VA range"), to Linux 4.12, so let's check SUSE_PRODUCT_CODE.

Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
 arch/ppc64.c   |    3 ++-
 makedumpfile.c |    4 ++++
 makedumpfile.h |    3 +++
 3 files changed, 9 insertions(+), 1 deletion(-)
Index: makedumpfile-1.7.1/arch/ppc64.c
===================================================================
--- makedumpfile-1.7.1.orig/arch/ppc64.c
+++ makedumpfile-1.7.1/arch/ppc64.c
@@ -248,7 +248,9 @@ ppc64_vmalloc_init(void)
 
 			if (info->kernel_version >= KERNEL_VERSION(4, 12, 0)) {
 				info->l2_index_size = PMD_INDEX_SIZE_L4_64K_4_12;
-				if (info->kernel_version >= KERNEL_VERSION(4, 17, 0))
+				if (info->kernel_version >= KERNEL_VERSION(4, 17, 0) ||
+				    ((NUMBER(SUSE_PRODUCT_CODE) & ~0xffL) == 0x010f0100) ||
+				    ((NUMBER(SUSE_PRODUCT_CODE) & ~0xffL) == 0x010c0500))
 					info->l3_index_size = PUD_INDEX_SIZE_L4_64K_4_17;
 				else
 					info->l3_index_size = PUD_INDEX_SIZE_L4_64K_4_12;
Index: makedumpfile-1.7.1/makedumpfile.c
===================================================================
--- makedumpfile-1.7.1.orig/makedumpfile.c
+++ makedumpfile-1.7.1/makedumpfile.c
@@ -2491,6 +2491,8 @@ write_vmcoreinfo_data(void)
 	WRITE_NUMBER_UNSIGNED("kimage_voffset", kimage_voffset);
 #endif
 
+	WRITE_NUMBER("SUSE_PRODUCT_CODE", SUSE_PRODUCT_CODE);
+
 	if (info->phys_base)
 		fprintf(info->file_vmcoreinfo, "%s%lu\n", STR_NUMBER("phys_base"),
 			info->phys_base);
@@ -2939,6 +2941,8 @@ read_vmcoreinfo(void)
 
 	READ_NUMBER("HUGETLB_PAGE_DTOR", HUGETLB_PAGE_DTOR);
 
+	READ_NUMBER("SUSE_PRODUCT_CODE", SUSE_PRODUCT_CODE);
+
 	return TRUE;
 }
 
Index: makedumpfile-1.7.1/makedumpfile.h
===================================================================
--- makedumpfile-1.7.1.orig/makedumpfile.h
+++ makedumpfile-1.7.1/makedumpfile.h
@@ -2069,6 +2069,9 @@ struct number_table {
 	unsigned long kernel_link_addr;
 	unsigned long va_kernel_pa_offset;
 #endif
+
+	/* Distro-specific */
+	long	SUSE_PRODUCT_CODE;
 };
 
 struct srcfile_table {
openSUSE Build Service is sponsored by