aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLianbo Jiang <lijiang@redhat.com>2019-04-22 21:30:05 -0400
committerBorislav Petkov <bp@suse.de>2019-06-20 03:54:31 -0400
commitae9e13d621d6795ec1ad6bf10bd2549c6c3feca4 (patch)
tree12aab3198a336c909cd47f20205f5980532c05a0
parente1bfa87399e372446454ecbaeba2800f0a385733 (diff)
x86/e820, ioport: Add a new I/O resource descriptor IORES_DESC_RESERVED
When executing the kexec_file_load() syscall, the first kernel needs to pass the e820 reserved ranges to the second kernel because some devices (PCI, for example) need them present in the kdump kernel for proper initialization. But the kernel can not exactly match the e820 reserved ranges when walking through the iomem resources using the default IORES_DESC_NONE descriptor, because there are several types of e820 ranges which are marked IORES_DESC_NONE, see e820_type_to_iores_desc(). Therefore, add a new I/O resource descriptor called IORES_DESC_RESERVED to mark exactly those ranges. It will be used to match the reserved resource ranges when walking through iomem resources. [ bp: Massage commit message. ] Suggested-by: Borislav Petkov <bp@suse.de> Signed-off-by: Lianbo Jiang <lijiang@redhat.com> Signed-off-by: Borislav Petkov <bp@suse.de> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: bhe@redhat.com Cc: dave.hansen@linux.intel.com Cc: dyoung@redhat.com Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Huang Zijiang <huang.zijiang@zte.com.cn> Cc: Ingo Molnar <mingo@redhat.com> Cc: Joe Perches <joe@perches.com> Cc: Juergen Gross <jgross@suse.com> Cc: kexec@lists.infradead.org Cc: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com> Cc: Michal Hocko <mhocko@suse.com> Cc: Mike Rapoport <rppt@linux.ibm.com> Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: x86-ml <x86@kernel.org> Link: https://lkml.kernel.org/r/20190423013007.17838-2-lijiang@redhat.com
-rw-r--r--arch/x86/kernel/e820.c2
-rw-r--r--include/linux/ioport.h1
2 files changed, 2 insertions, 1 deletions
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 8f32e705a980..e69408bf664b 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -1063,10 +1063,10 @@ static unsigned long __init e820_type_to_iores_desc(struct e820_entry *entry)
1063 case E820_TYPE_NVS: return IORES_DESC_ACPI_NV_STORAGE; 1063 case E820_TYPE_NVS: return IORES_DESC_ACPI_NV_STORAGE;
1064 case E820_TYPE_PMEM: return IORES_DESC_PERSISTENT_MEMORY; 1064 case E820_TYPE_PMEM: return IORES_DESC_PERSISTENT_MEMORY;
1065 case E820_TYPE_PRAM: return IORES_DESC_PERSISTENT_MEMORY_LEGACY; 1065 case E820_TYPE_PRAM: return IORES_DESC_PERSISTENT_MEMORY_LEGACY;
1066 case E820_TYPE_RESERVED: return IORES_DESC_RESERVED;
1066 case E820_TYPE_RESERVED_KERN: /* Fall-through: */ 1067 case E820_TYPE_RESERVED_KERN: /* Fall-through: */
1067 case E820_TYPE_RAM: /* Fall-through: */ 1068 case E820_TYPE_RAM: /* Fall-through: */
1068 case E820_TYPE_UNUSABLE: /* Fall-through: */ 1069 case E820_TYPE_UNUSABLE: /* Fall-through: */
1069 case E820_TYPE_RESERVED: /* Fall-through: */
1070 default: return IORES_DESC_NONE; 1070 default: return IORES_DESC_NONE;
1071 } 1071 }
1072} 1072}
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index da0ebaec25f0..6ed59de48bd5 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -133,6 +133,7 @@ enum {
133 IORES_DESC_PERSISTENT_MEMORY_LEGACY = 5, 133 IORES_DESC_PERSISTENT_MEMORY_LEGACY = 5,
134 IORES_DESC_DEVICE_PRIVATE_MEMORY = 6, 134 IORES_DESC_DEVICE_PRIVATE_MEMORY = 6,
135 IORES_DESC_DEVICE_PUBLIC_MEMORY = 7, 135 IORES_DESC_DEVICE_PUBLIC_MEMORY = 7,
136 IORES_DESC_RESERVED = 8,
136}; 137};
137 138
138/* helpers to define resources */ 139/* helpers to define resources */