setup.c 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308
  1. /*
  2. * Copyright (C) 1995 Linus Torvalds
  3. *
  4. * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
  5. *
  6. * Memory region support
  7. * David Parsons <orc@pell.chi.il.us>, July-August 1999
  8. *
  9. * Added E820 sanitization routine (removes overlapping memory regions);
  10. * Brian Moyle <bmoyle@mvista.com>, February 2001
  11. *
  12. * Moved CPU detection code to cpu/${cpu}.c
  13. * Patrick Mochel <mochel@osdl.org>, March 2002
  14. *
  15. * Provisions for empty E820 memory regions (reported by certain BIOSes).
  16. * Alex Achenbach <xela@slit.de>, December 2002.
  17. *
  18. */
  19. /*
  20. * This file handles the architecture-dependent parts of initialization
  21. */
  22. #include <linux/sched.h>
  23. #include <linux/mm.h>
  24. #include <linux/mmzone.h>
  25. #include <linux/screen_info.h>
  26. #include <linux/ioport.h>
  27. #include <linux/acpi.h>
  28. #include <linux/sfi.h>
  29. #include <linux/apm_bios.h>
  30. #include <linux/initrd.h>
  31. #include <linux/bootmem.h>
  32. #include <linux/memblock.h>
  33. #include <linux/seq_file.h>
  34. #include <linux/console.h>
  35. #include <linux/root_dev.h>
  36. #include <linux/highmem.h>
  37. #include <linux/export.h>
  38. #include <linux/efi.h>
  39. #include <linux/init.h>
  40. #include <linux/edd.h>
  41. #include <linux/iscsi_ibft.h>
  42. #include <linux/nodemask.h>
  43. #include <linux/kexec.h>
  44. #include <linux/dmi.h>
  45. #include <linux/pfn.h>
  46. #include <linux/pci.h>
  47. #include <asm/pci-direct.h>
  48. #include <linux/init_ohci1394_dma.h>
  49. #include <linux/kvm_para.h>
  50. #include <linux/dma-contiguous.h>
  51. #include <xen/xen.h>
  52. #include <linux/errno.h>
  53. #include <linux/kernel.h>
  54. #include <linux/stddef.h>
  55. #include <linux/unistd.h>
  56. #include <linux/ptrace.h>
  57. #include <linux/user.h>
  58. #include <linux/delay.h>
  59. #include <linux/kallsyms.h>
  60. #include <linux/cpufreq.h>
  61. #include <linux/dma-mapping.h>
  62. #include <linux/ctype.h>
  63. #include <linux/uaccess.h>
  64. #include <linux/percpu.h>
  65. #include <linux/crash_dump.h>
  66. #include <linux/tboot.h>
  67. #include <linux/jiffies.h>
  68. #include <linux/mem_encrypt.h>
  69. #include <linux/usb/xhci-dbgp.h>
  70. #include <video/edid.h>
  71. #include <asm/mtrr.h>
  72. #include <asm/apic.h>
  73. #include <asm/realmode.h>
  74. #include <asm/e820/api.h>
  75. #include <asm/mpspec.h>
  76. #include <asm/setup.h>
  77. #include <asm/efi.h>
  78. #include <asm/timer.h>
  79. #include <asm/i8259.h>
  80. #include <asm/sections.h>
  81. #include <asm/io_apic.h>
  82. #include <asm/ist.h>
  83. #include <asm/setup_arch.h>
  84. #include <asm/bios_ebda.h>
  85. #include <asm/cacheflush.h>
  86. #include <asm/processor.h>
  87. #include <asm/bugs.h>
  88. #include <asm/kasan.h>
  89. #include <asm/vsyscall.h>
  90. #include <asm/cpu.h>
  91. #include <asm/desc.h>
  92. #include <asm/dma.h>
  93. #include <asm/iommu.h>
  94. #include <asm/gart.h>
  95. #include <asm/mmu_context.h>
  96. #include <asm/proto.h>
  97. #include <asm/paravirt.h>
  98. #include <asm/hypervisor.h>
  99. #include <asm/olpc_ofw.h>
  100. #include <asm/percpu.h>
  101. #include <asm/topology.h>
  102. #include <asm/apicdef.h>
  103. #include <asm/amd_nb.h>
  104. #include <asm/mce.h>
  105. #include <asm/alternative.h>
  106. #include <asm/prom.h>
  107. #include <asm/microcode.h>
  108. #include <asm/kaslr.h>
  109. #include <asm/unwind.h>
  110. /*
  111. * max_low_pfn_mapped: highest direct mapped pfn under 4GB
  112. * max_pfn_mapped: highest direct mapped pfn over 4GB
  113. *
  114. * The direct mapping only covers E820_TYPE_RAM regions, so the ranges and gaps are
  115. * represented by pfn_mapped
  116. */
  117. unsigned long max_low_pfn_mapped;
  118. unsigned long max_pfn_mapped;
  119. #ifdef CONFIG_DMI
  120. RESERVE_BRK(dmi_alloc, 65536);
  121. #endif
  122. static __initdata unsigned long _brk_start = (unsigned long)__brk_base;
  123. unsigned long _brk_end = (unsigned long)__brk_base;
  124. struct boot_params boot_params;
  125. /*
  126. * Machine setup..
  127. */
  128. static struct resource data_resource = {
  129. .name = "Kernel data",
  130. .start = 0,
  131. .end = 0,
  132. .flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM
  133. };
  134. static struct resource code_resource = {
  135. .name = "Kernel code",
  136. .start = 0,
  137. .end = 0,
  138. .flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM
  139. };
  140. static struct resource bss_resource = {
  141. .name = "Kernel bss",
  142. .start = 0,
  143. .end = 0,
  144. .flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM
  145. };
  146. #ifdef CONFIG_X86_32
  147. /* cpu data as detected by the assembly code in head_32.S */
  148. struct cpuinfo_x86 new_cpu_data;
  149. /* common cpu data for all cpus */
  150. struct cpuinfo_x86 boot_cpu_data __read_mostly;
  151. EXPORT_SYMBOL(boot_cpu_data);
  152. unsigned int def_to_bigsmp;
  153. /* for MCA, but anyone else can use it if they want */
  154. unsigned int machine_id;
  155. unsigned int machine_submodel_id;
  156. unsigned int BIOS_revision;
  157. struct apm_info apm_info;
  158. EXPORT_SYMBOL(apm_info);
  159. #if defined(CONFIG_X86_SPEEDSTEP_SMI) || \
  160. defined(CONFIG_X86_SPEEDSTEP_SMI_MODULE)
  161. struct ist_info ist_info;
  162. EXPORT_SYMBOL(ist_info);
  163. #else
  164. struct ist_info ist_info;
  165. #endif
  166. #else
  167. struct cpuinfo_x86 boot_cpu_data __read_mostly;
  168. EXPORT_SYMBOL(boot_cpu_data);
  169. #endif
  170. #if !defined(CONFIG_X86_PAE) || defined(CONFIG_X86_64)
  171. __visible unsigned long mmu_cr4_features __ro_after_init;
  172. #else
  173. __visible unsigned long mmu_cr4_features __ro_after_init = X86_CR4_PAE;
  174. #endif
  175. /* Boot loader ID and version as integers, for the benefit of proc_dointvec */
  176. int bootloader_type, bootloader_version;
  177. /*
  178. * Setup options
  179. */
  180. struct screen_info screen_info;
  181. EXPORT_SYMBOL(screen_info);
  182. struct edid_info edid_info;
  183. EXPORT_SYMBOL_GPL(edid_info);
  184. extern int root_mountflags;
  185. unsigned long saved_video_mode;
  186. #define RAMDISK_IMAGE_START_MASK 0x07FF
  187. #define RAMDISK_PROMPT_FLAG 0x8000
  188. #define RAMDISK_LOAD_FLAG 0x4000
  189. static char __initdata command_line[COMMAND_LINE_SIZE];
  190. #ifdef CONFIG_CMDLINE_BOOL
  191. static char __initdata builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE;
  192. #endif
  193. #if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
  194. struct edd edd;
  195. #ifdef CONFIG_EDD_MODULE
  196. EXPORT_SYMBOL(edd);
  197. #endif
  198. /**
  199. * copy_edd() - Copy the BIOS EDD information
  200. * from boot_params into a safe place.
  201. *
  202. */
  203. static inline void __init copy_edd(void)
  204. {
  205. memcpy(edd.mbr_signature, boot_params.edd_mbr_sig_buffer,
  206. sizeof(edd.mbr_signature));
  207. memcpy(edd.edd_info, boot_params.eddbuf, sizeof(edd.edd_info));
  208. edd.mbr_signature_nr = boot_params.edd_mbr_sig_buf_entries;
  209. edd.edd_info_nr = boot_params.eddbuf_entries;
  210. }
  211. #else
  212. static inline void __init copy_edd(void)
  213. {
  214. }
  215. #endif
  216. void * __init extend_brk(size_t size, size_t align)
  217. {
  218. size_t mask = align - 1;
  219. void *ret;
  220. BUG_ON(_brk_start == 0);
  221. BUG_ON(align & mask);
  222. _brk_end = (_brk_end + mask) & ~mask;
  223. BUG_ON((char *)(_brk_end + size) > __brk_limit);
  224. ret = (void *)_brk_end;
  225. _brk_end += size;
  226. memset(ret, 0, size);
  227. return ret;
  228. }
  229. #ifdef CONFIG_X86_32
  230. static void __init cleanup_highmap(void)
  231. {
  232. }
  233. #endif
  234. static void __init reserve_brk(void)
  235. {
  236. if (_brk_end > _brk_start)
  237. memblock_reserve(__pa_symbol(_brk_start),
  238. _brk_end - _brk_start);
  239. /* Mark brk area as locked down and no longer taking any
  240. new allocations */
  241. _brk_start = 0;
  242. }
  243. u64 relocated_ramdisk;
  244. #ifdef CONFIG_BLK_DEV_INITRD
  245. static u64 __init get_ramdisk_image(void)
  246. {
  247. u64 ramdisk_image = boot_params.hdr.ramdisk_image;
  248. ramdisk_image |= (u64)boot_params.ext_ramdisk_image << 32;
  249. return ramdisk_image;
  250. }
  251. static u64 __init get_ramdisk_size(void)
  252. {
  253. u64 ramdisk_size = boot_params.hdr.ramdisk_size;
  254. ramdisk_size |= (u64)boot_params.ext_ramdisk_size << 32;
  255. return ramdisk_size;
  256. }
  257. static void __init relocate_initrd(void)
  258. {
  259. /* Assume only end is not page aligned */
  260. u64 ramdisk_image = get_ramdisk_image();
  261. u64 ramdisk_size = get_ramdisk_size();
  262. u64 area_size = PAGE_ALIGN(ramdisk_size);
  263. /* We need to move the initrd down into directly mapped mem */
  264. relocated_ramdisk = memblock_find_in_range(0, PFN_PHYS(max_pfn_mapped),
  265. area_size, PAGE_SIZE);
  266. if (!relocated_ramdisk)
  267. panic("Cannot find place for new RAMDISK of size %lld\n",
  268. ramdisk_size);
  269. /* Note: this includes all the mem currently occupied by
  270. the initrd, we rely on that fact to keep the data intact. */
  271. memblock_reserve(relocated_ramdisk, area_size);
  272. initrd_start = relocated_ramdisk + PAGE_OFFSET;
  273. initrd_end = initrd_start + ramdisk_size;
  274. printk(KERN_INFO "Allocated new RAMDISK: [mem %#010llx-%#010llx]\n",
  275. relocated_ramdisk, relocated_ramdisk + ramdisk_size - 1);
  276. copy_from_early_mem((void *)initrd_start, ramdisk_image, ramdisk_size);
  277. printk(KERN_INFO "Move RAMDISK from [mem %#010llx-%#010llx] to"
  278. " [mem %#010llx-%#010llx]\n",
  279. ramdisk_image, ramdisk_image + ramdisk_size - 1,
  280. relocated_ramdisk, relocated_ramdisk + ramdisk_size - 1);
  281. }
  282. static void __init early_reserve_initrd(void)
  283. {
  284. /* Assume only end is not page aligned */
  285. u64 ramdisk_image = get_ramdisk_image();
  286. u64 ramdisk_size = get_ramdisk_size();
  287. u64 ramdisk_end = PAGE_ALIGN(ramdisk_image + ramdisk_size);
  288. if (!boot_params.hdr.type_of_loader ||
  289. !ramdisk_image || !ramdisk_size)
  290. return; /* No initrd provided by bootloader */
  291. memblock_reserve(ramdisk_image, ramdisk_end - ramdisk_image);
  292. }
  293. static void __init reserve_initrd(void)
  294. {
  295. /* Assume only end is not page aligned */
  296. u64 ramdisk_image = get_ramdisk_image();
  297. u64 ramdisk_size = get_ramdisk_size();
  298. u64 ramdisk_end = PAGE_ALIGN(ramdisk_image + ramdisk_size);
  299. u64 mapped_size;
  300. if (!boot_params.hdr.type_of_loader ||
  301. !ramdisk_image || !ramdisk_size)
  302. return; /* No initrd provided by bootloader */
  303. initrd_start = 0;
  304. mapped_size = memblock_mem_size(max_pfn_mapped);
  305. if (ramdisk_size >= (mapped_size>>1))
  306. panic("initrd too large to handle, "
  307. "disabling initrd (%lld needed, %lld available)\n",
  308. ramdisk_size, mapped_size>>1);
  309. printk(KERN_INFO "RAMDISK: [mem %#010llx-%#010llx]\n", ramdisk_image,
  310. ramdisk_end - 1);
  311. if (pfn_range_is_mapped(PFN_DOWN(ramdisk_image),
  312. PFN_DOWN(ramdisk_end))) {
  313. /* All are mapped, easy case */
  314. initrd_start = ramdisk_image + PAGE_OFFSET;
  315. initrd_end = initrd_start + ramdisk_size;
  316. return;
  317. }
  318. relocate_initrd();
  319. memblock_free(ramdisk_image, ramdisk_end - ramdisk_image);
  320. }
  321. #else
  322. static void __init early_reserve_initrd(void)
  323. {
  324. }
  325. static void __init reserve_initrd(void)
  326. {
  327. }
  328. #endif /* CONFIG_BLK_DEV_INITRD */
  329. static void __init parse_setup_data(void)
  330. {
  331. struct setup_data *data;
  332. u64 pa_data, pa_next;
  333. pa_data = boot_params.hdr.setup_data;
  334. while (pa_data) {
  335. u32 data_len, data_type;
  336. data = early_memremap(pa_data, sizeof(*data));
  337. data_len = data->len + sizeof(struct setup_data);
  338. data_type = data->type;
  339. pa_next = data->next;
  340. early_memunmap(data, sizeof(*data));
  341. switch (data_type) {
  342. case SETUP_E820_EXT:
  343. e820__memory_setup_extended(pa_data, data_len);
  344. break;
  345. case SETUP_DTB:
  346. add_dtb(pa_data);
  347. break;
  348. case SETUP_EFI:
  349. parse_efi_setup(pa_data, data_len);
  350. break;
  351. default:
  352. break;
  353. }
  354. pa_data = pa_next;
  355. }
  356. }
  357. static void __init memblock_x86_reserve_range_setup_data(void)
  358. {
  359. struct setup_data *data;
  360. u64 pa_data;
  361. pa_data = boot_params.hdr.setup_data;
  362. while (pa_data) {
  363. data = early_memremap(pa_data, sizeof(*data));
  364. memblock_reserve(pa_data, sizeof(*data) + data->len);
  365. pa_data = data->next;
  366. early_memunmap(data, sizeof(*data));
  367. }
  368. }
  369. /*
  370. * --------- Crashkernel reservation ------------------------------
  371. */
  372. #ifdef CONFIG_KEXEC_CORE
  373. /* 16M alignment for crash kernel regions */
  374. #define CRASH_ALIGN (16 << 20)
  375. /*
  376. * Keep the crash kernel below this limit. On 32 bits earlier kernels
  377. * would limit the kernel to the low 512 MiB due to mapping restrictions.
  378. * On 64bit, old kexec-tools need to under 896MiB.
  379. */
  380. #ifdef CONFIG_X86_32
  381. # define CRASH_ADDR_LOW_MAX (512 << 20)
  382. # define CRASH_ADDR_HIGH_MAX (512 << 20)
  383. #else
  384. # define CRASH_ADDR_LOW_MAX (896UL << 20)
  385. # define CRASH_ADDR_HIGH_MAX MAXMEM
  386. #endif
  387. static int __init reserve_crashkernel_low(void)
  388. {
  389. #ifdef CONFIG_X86_64
  390. unsigned long long base, low_base = 0, low_size = 0;
  391. unsigned long total_low_mem;
  392. int ret;
  393. total_low_mem = memblock_mem_size(1UL << (32 - PAGE_SHIFT));
  394. /* crashkernel=Y,low */
  395. ret = parse_crashkernel_low(boot_command_line, total_low_mem, &low_size, &base);
  396. if (ret) {
  397. /*
  398. * two parts from lib/swiotlb.c:
  399. * -swiotlb size: user-specified with swiotlb= or default.
  400. *
  401. * -swiotlb overflow buffer: now hardcoded to 32k. We round it
  402. * to 8M for other buffers that may need to stay low too. Also
  403. * make sure we allocate enough extra low memory so that we
  404. * don't run out of DMA buffers for 32-bit devices.
  405. */
  406. low_size = max(swiotlb_size_or_default() + (8UL << 20), 256UL << 20);
  407. } else {
  408. /* passed with crashkernel=0,low ? */
  409. if (!low_size)
  410. return 0;
  411. }
  412. low_base = memblock_find_in_range(0, 1ULL << 32, low_size, CRASH_ALIGN);
  413. if (!low_base) {
  414. pr_err("Cannot reserve %ldMB crashkernel low memory, please try smaller size.\n",
  415. (unsigned long)(low_size >> 20));
  416. return -ENOMEM;
  417. }
  418. ret = memblock_reserve(low_base, low_size);
  419. if (ret) {
  420. pr_err("%s: Error reserving crashkernel low memblock.\n", __func__);
  421. return ret;
  422. }
  423. pr_info("Reserving %ldMB of low memory at %ldMB for crashkernel (System low RAM: %ldMB)\n",
  424. (unsigned long)(low_size >> 20),
  425. (unsigned long)(low_base >> 20),
  426. (unsigned long)(total_low_mem >> 20));
  427. crashk_low_res.start = low_base;
  428. crashk_low_res.end = low_base + low_size - 1;
  429. insert_resource(&iomem_resource, &crashk_low_res);
  430. #endif
  431. return 0;
  432. }
  433. static void __init reserve_crashkernel(void)
  434. {
  435. unsigned long long crash_size, crash_base, total_mem;
  436. bool high = false;
  437. int ret;
  438. total_mem = memblock_phys_mem_size();
  439. /* crashkernel=XM */
  440. ret = parse_crashkernel(boot_command_line, total_mem, &crash_size, &crash_base);
  441. if (ret != 0 || crash_size <= 0) {
  442. /* crashkernel=X,high */
  443. ret = parse_crashkernel_high(boot_command_line, total_mem,
  444. &crash_size, &crash_base);
  445. if (ret != 0 || crash_size <= 0)
  446. return;
  447. high = true;
  448. }
  449. if (xen_pv_domain()) {
  450. pr_info("Ignoring crashkernel for a Xen PV domain\n");
  451. return;
  452. }
  453. /* 0 means: find the address automatically */
  454. if (crash_base <= 0) {
  455. /*
  456. * Set CRASH_ADDR_LOW_MAX upper bound for crash memory,
  457. * as old kexec-tools loads bzImage below that, unless
  458. * "crashkernel=size[KMG],high" is specified.
  459. */
  460. crash_base = memblock_find_in_range(CRASH_ALIGN,
  461. high ? CRASH_ADDR_HIGH_MAX
  462. : CRASH_ADDR_LOW_MAX,
  463. crash_size, CRASH_ALIGN);
  464. if (!crash_base) {
  465. pr_info("crashkernel reservation failed - No suitable area found.\n");
  466. return;
  467. }
  468. } else {
  469. unsigned long long start;
  470. start = memblock_find_in_range(crash_base,
  471. crash_base + crash_size,
  472. crash_size, 1 << 20);
  473. if (start != crash_base) {
  474. pr_info("crashkernel reservation failed - memory is in use.\n");
  475. return;
  476. }
  477. }
  478. ret = memblock_reserve(crash_base, crash_size);
  479. if (ret) {
  480. pr_err("%s: Error reserving crashkernel memblock.\n", __func__);
  481. return;
  482. }
  483. if (crash_base >= (1ULL << 32) && reserve_crashkernel_low()) {
  484. memblock_free(crash_base, crash_size);
  485. return;
  486. }
  487. pr_info("Reserving %ldMB of memory at %ldMB for crashkernel (System RAM: %ldMB)\n",
  488. (unsigned long)(crash_size >> 20),
  489. (unsigned long)(crash_base >> 20),
  490. (unsigned long)(total_mem >> 20));
  491. crashk_res.start = crash_base;
  492. crashk_res.end = crash_base + crash_size - 1;
  493. insert_resource(&iomem_resource, &crashk_res);
  494. }
  495. #else
  496. static void __init reserve_crashkernel(void)
  497. {
  498. }
  499. #endif
  500. static struct resource standard_io_resources[] = {
  501. { .name = "dma1", .start = 0x00, .end = 0x1f,
  502. .flags = IORESOURCE_BUSY | IORESOURCE_IO },
  503. { .name = "pic1", .start = 0x20, .end = 0x21,
  504. .flags = IORESOURCE_BUSY | IORESOURCE_IO },
  505. { .name = "timer0", .start = 0x40, .end = 0x43,
  506. .flags = IORESOURCE_BUSY | IORESOURCE_IO },
  507. { .name = "timer1", .start = 0x50, .end = 0x53,
  508. .flags = IORESOURCE_BUSY | IORESOURCE_IO },
  509. { .name = "keyboard", .start = 0x60, .end = 0x60,
  510. .flags = IORESOURCE_BUSY | IORESOURCE_IO },
  511. { .name = "keyboard", .start = 0x64, .end = 0x64,
  512. .flags = IORESOURCE_BUSY | IORESOURCE_IO },
  513. { .name = "dma page reg", .start = 0x80, .end = 0x8f,
  514. .flags = IORESOURCE_BUSY | IORESOURCE_IO },
  515. { .name = "pic2", .start = 0xa0, .end = 0xa1,
  516. .flags = IORESOURCE_BUSY | IORESOURCE_IO },
  517. { .name = "dma2", .start = 0xc0, .end = 0xdf,
  518. .flags = IORESOURCE_BUSY | IORESOURCE_IO },
  519. { .name = "fpu", .start = 0xf0, .end = 0xff,
  520. .flags = IORESOURCE_BUSY | IORESOURCE_IO }
  521. };
  522. void __init reserve_standard_io_resources(void)
  523. {
  524. int i;
  525. /* request I/O space for devices used on all i[345]86 PCs */
  526. for (i = 0; i < ARRAY_SIZE(standard_io_resources); i++)
  527. request_resource(&ioport_resource, &standard_io_resources[i]);
  528. }
  529. static __init void reserve_ibft_region(void)
  530. {
  531. unsigned long addr, size = 0;
  532. addr = find_ibft_region(&size);
  533. if (size)
  534. memblock_reserve(addr, size);
  535. }
  536. static bool __init snb_gfx_workaround_needed(void)
  537. {
  538. #ifdef CONFIG_PCI
  539. int i;
  540. u16 vendor, devid;
  541. static const __initconst u16 snb_ids[] = {
  542. 0x0102,
  543. 0x0112,
  544. 0x0122,
  545. 0x0106,
  546. 0x0116,
  547. 0x0126,
  548. 0x010a,
  549. };
  550. /* Assume no if something weird is going on with PCI */
  551. if (!early_pci_allowed())
  552. return false;
  553. vendor = read_pci_config_16(0, 2, 0, PCI_VENDOR_ID);
  554. if (vendor != 0x8086)
  555. return false;
  556. devid = read_pci_config_16(0, 2, 0, PCI_DEVICE_ID);
  557. for (i = 0; i < ARRAY_SIZE(snb_ids); i++)
  558. if (devid == snb_ids[i])
  559. return true;
  560. #endif
  561. return false;
  562. }
  563. /*
  564. * Sandy Bridge graphics has trouble with certain ranges, exclude
  565. * them from allocation.
  566. */
  567. static void __init trim_snb_memory(void)
  568. {
  569. static const __initconst unsigned long bad_pages[] = {
  570. 0x20050000,
  571. 0x20110000,
  572. 0x20130000,
  573. 0x20138000,
  574. 0x40004000,
  575. };
  576. int i;
  577. if (!snb_gfx_workaround_needed())
  578. return;
  579. printk(KERN_DEBUG "reserving inaccessible SNB gfx pages\n");
  580. /*
  581. * Reserve all memory below the 1 MB mark that has not
  582. * already been reserved.
  583. */
  584. memblock_reserve(0, 1<<20);
  585. for (i = 0; i < ARRAY_SIZE(bad_pages); i++) {
  586. if (memblock_reserve(bad_pages[i], PAGE_SIZE))
  587. printk(KERN_WARNING "failed to reserve 0x%08lx\n",
  588. bad_pages[i]);
  589. }
  590. }
  591. /*
  592. * Here we put platform-specific memory range workarounds, i.e.
  593. * memory known to be corrupt or otherwise in need to be reserved on
  594. * specific platforms.
  595. *
  596. * If this gets used more widely it could use a real dispatch mechanism.
  597. */
  598. static void __init trim_platform_memory_ranges(void)
  599. {
  600. trim_snb_memory();
  601. }
  602. static void __init trim_bios_range(void)
  603. {
  604. /*
  605. * A special case is the first 4Kb of memory;
  606. * This is a BIOS owned area, not kernel ram, but generally
  607. * not listed as such in the E820 table.
  608. *
  609. * This typically reserves additional memory (64KiB by default)
  610. * since some BIOSes are known to corrupt low memory. See the
  611. * Kconfig help text for X86_RESERVE_LOW.
  612. */
  613. e820__range_update(0, PAGE_SIZE, E820_TYPE_RAM, E820_TYPE_RESERVED);
  614. /*
  615. * special case: Some BIOSen report the PC BIOS
  616. * area (640->1Mb) as ram even though it is not.
  617. * take them out.
  618. */
  619. e820__range_remove(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_TYPE_RAM, 1);
  620. e820__update_table(e820_table);
  621. }
  622. /* called before trim_bios_range() to spare extra sanitize */
  623. static void __init e820_add_kernel_range(void)
  624. {
  625. u64 start = __pa_symbol(_text);
  626. u64 size = __pa_symbol(_end) - start;
  627. /*
  628. * Complain if .text .data and .bss are not marked as E820_TYPE_RAM and
  629. * attempt to fix it by adding the range. We may have a confused BIOS,
  630. * or the user may have used memmap=exactmap or memmap=xxM$yyM to
  631. * exclude kernel range. If we really are running on top non-RAM,
  632. * we will crash later anyways.
  633. */
  634. if (e820__mapped_all(start, start + size, E820_TYPE_RAM))
  635. return;
  636. pr_warn(".text .data .bss are not marked as E820_TYPE_RAM!\n");
  637. e820__range_remove(start, size, E820_TYPE_RAM, 0);
  638. e820__range_add(start, size, E820_TYPE_RAM);
  639. }
  640. static unsigned reserve_low = CONFIG_X86_RESERVE_LOW << 10;
  641. static int __init parse_reservelow(char *p)
  642. {
  643. unsigned long long size;
  644. if (!p)
  645. return -EINVAL;
  646. size = memparse(p, &p);
  647. if (size < 4096)
  648. size = 4096;
  649. if (size > 640*1024)
  650. size = 640*1024;
  651. reserve_low = size;
  652. return 0;
  653. }
  654. early_param("reservelow", parse_reservelow);
  655. static void __init trim_low_memory_range(void)
  656. {
  657. memblock_reserve(0, ALIGN(reserve_low, PAGE_SIZE));
  658. }
  659. /*
  660. * Dump out kernel offset information on panic.
  661. */
  662. static int
  663. dump_kernel_offset(struct notifier_block *self, unsigned long v, void *p)
  664. {
  665. if (kaslr_enabled()) {
  666. pr_emerg("Kernel Offset: 0x%lx from 0x%lx (relocation range: 0x%lx-0x%lx)\n",
  667. kaslr_offset(),
  668. __START_KERNEL,
  669. __START_KERNEL_map,
  670. MODULES_VADDR-1);
  671. } else {
  672. pr_emerg("Kernel Offset: disabled\n");
  673. }
  674. return 0;
  675. }
  676. /*
  677. * Determine if we were loaded by an EFI loader. If so, then we have also been
  678. * passed the efi memmap, systab, etc., so we should use these data structures
  679. * for initialization. Note, the efi init code path is determined by the
  680. * global efi_enabled. This allows the same kernel image to be used on existing
  681. * systems (with a traditional BIOS) as well as on EFI systems.
  682. */
  683. /*
  684. * setup_arch - architecture-specific boot-time initializations
  685. *
  686. * Note: On x86_64, fixmaps are ready for use even before this is called.
  687. */
  688. void __init setup_arch(char **cmdline_p)
  689. {
  690. memblock_reserve(__pa_symbol(_text),
  691. (unsigned long)__bss_stop - (unsigned long)_text);
  692. /*
  693. * Make sure page 0 is always reserved because on systems with
  694. * L1TF its contents can be leaked to user processes.
  695. */
  696. memblock_reserve(0, PAGE_SIZE);
  697. early_reserve_initrd();
  698. /*
  699. * At this point everything still needed from the boot loader
  700. * or BIOS or kernel text should be early reserved or marked not
  701. * RAM in e820. All other memory is free game.
  702. */
  703. #ifdef CONFIG_X86_32
  704. memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data));
  705. /*
  706. * copy kernel address range established so far and switch
  707. * to the proper swapper page table
  708. */
  709. clone_pgd_range(swapper_pg_dir + KERNEL_PGD_BOUNDARY,
  710. initial_page_table + KERNEL_PGD_BOUNDARY,
  711. KERNEL_PGD_PTRS);
  712. load_cr3(swapper_pg_dir);
  713. /*
  714. * Note: Quark X1000 CPUs advertise PGE incorrectly and require
  715. * a cr3 based tlb flush, so the following __flush_tlb_all()
  716. * will not flush anything because the cpu quirk which clears
  717. * X86_FEATURE_PGE has not been invoked yet. Though due to the
  718. * load_cr3() above the TLB has been flushed already. The
  719. * quirk is invoked before subsequent calls to __flush_tlb_all()
  720. * so proper operation is guaranteed.
  721. */
  722. __flush_tlb_all();
  723. #else
  724. printk(KERN_INFO "Command line: %s\n", boot_command_line);
  725. boot_cpu_data.x86_phys_bits = MAX_PHYSMEM_BITS;
  726. #endif
  727. /*
  728. * If we have OLPC OFW, we might end up relocating the fixmap due to
  729. * reserve_top(), so do this before touching the ioremap area.
  730. */
  731. olpc_ofw_detect();
  732. idt_setup_early_traps();
  733. early_cpu_init();
  734. arch_init_ideal_nops();
  735. jump_label_init();
  736. early_ioremap_init();
  737. setup_olpc_ofw_pgd();
  738. ROOT_DEV = old_decode_dev(boot_params.hdr.root_dev);
  739. screen_info = boot_params.screen_info;
  740. edid_info = boot_params.edid_info;
  741. #ifdef CONFIG_X86_32
  742. apm_info.bios = boot_params.apm_bios_info;
  743. ist_info = boot_params.ist_info;
  744. #endif
  745. saved_video_mode = boot_params.hdr.vid_mode;
  746. bootloader_type = boot_params.hdr.type_of_loader;
  747. if ((bootloader_type >> 4) == 0xe) {
  748. bootloader_type &= 0xf;
  749. bootloader_type |= (boot_params.hdr.ext_loader_type+0x10) << 4;
  750. }
  751. bootloader_version = bootloader_type & 0xf;
  752. bootloader_version |= boot_params.hdr.ext_loader_ver << 4;
  753. #ifdef CONFIG_BLK_DEV_RAM
  754. rd_image_start = boot_params.hdr.ram_size & RAMDISK_IMAGE_START_MASK;
  755. rd_prompt = ((boot_params.hdr.ram_size & RAMDISK_PROMPT_FLAG) != 0);
  756. rd_doload = ((boot_params.hdr.ram_size & RAMDISK_LOAD_FLAG) != 0);
  757. #endif
  758. #ifdef CONFIG_EFI
  759. if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
  760. EFI32_LOADER_SIGNATURE, 4)) {
  761. set_bit(EFI_BOOT, &efi.flags);
  762. } else if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
  763. EFI64_LOADER_SIGNATURE, 4)) {
  764. set_bit(EFI_BOOT, &efi.flags);
  765. set_bit(EFI_64BIT, &efi.flags);
  766. }
  767. #endif
  768. x86_init.oem.arch_setup();
  769. iomem_resource.end = (1ULL << boot_cpu_data.x86_phys_bits) - 1;
  770. e820__memory_setup();
  771. parse_setup_data();
  772. copy_edd();
  773. if (!boot_params.hdr.root_flags)
  774. root_mountflags &= ~MS_RDONLY;
  775. init_mm.start_code = (unsigned long) _text;
  776. init_mm.end_code = (unsigned long) _etext;
  777. init_mm.end_data = (unsigned long) _edata;
  778. init_mm.brk = _brk_end;
  779. mpx_mm_init(&init_mm);
  780. code_resource.start = __pa_symbol(_text);
  781. code_resource.end = __pa_symbol(_etext)-1;
  782. data_resource.start = __pa_symbol(_etext);
  783. data_resource.end = __pa_symbol(_edata)-1;
  784. bss_resource.start = __pa_symbol(__bss_start);
  785. bss_resource.end = __pa_symbol(__bss_stop)-1;
  786. #ifdef CONFIG_CMDLINE_BOOL
  787. #ifdef CONFIG_CMDLINE_OVERRIDE
  788. strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
  789. #else
  790. if (builtin_cmdline[0]) {
  791. /* append boot loader cmdline to builtin */
  792. strlcat(builtin_cmdline, " ", COMMAND_LINE_SIZE);
  793. strlcat(builtin_cmdline, boot_command_line, COMMAND_LINE_SIZE);
  794. strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
  795. }
  796. #endif
  797. #endif
  798. strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
  799. *cmdline_p = command_line;
  800. /*
  801. * x86_configure_nx() is called before parse_early_param() to detect
  802. * whether hardware doesn't support NX (so that the early EHCI debug
  803. * console setup can safely call set_fixmap()). It may then be called
  804. * again from within noexec_setup() during parsing early parameters
  805. * to honor the respective command line option.
  806. */
  807. x86_configure_nx();
  808. parse_early_param();
  809. if (efi_enabled(EFI_BOOT))
  810. efi_memblock_x86_reserve_range();
  811. #ifdef CONFIG_MEMORY_HOTPLUG
  812. /*
  813. * Memory used by the kernel cannot be hot-removed because Linux
  814. * cannot migrate the kernel pages. When memory hotplug is
  815. * enabled, we should prevent memblock from allocating memory
  816. * for the kernel.
  817. *
  818. * ACPI SRAT records all hotpluggable memory ranges. But before
  819. * SRAT is parsed, we don't know about it.
  820. *
  821. * The kernel image is loaded into memory at very early time. We
  822. * cannot prevent this anyway. So on NUMA system, we set any
  823. * node the kernel resides in as un-hotpluggable.
  824. *
  825. * Since on modern servers, one node could have double-digit
  826. * gigabytes memory, we can assume the memory around the kernel
  827. * image is also un-hotpluggable. So before SRAT is parsed, just
  828. * allocate memory near the kernel image to try the best to keep
  829. * the kernel away from hotpluggable memory.
  830. */
  831. if (movable_node_is_enabled())
  832. memblock_set_bottom_up(true);
  833. #endif
  834. x86_report_nx();
  835. /* after early param, so could get panic from serial */
  836. memblock_x86_reserve_range_setup_data();
  837. if (acpi_mps_check()) {
  838. #ifdef CONFIG_X86_LOCAL_APIC
  839. disable_apic = 1;
  840. #endif
  841. setup_clear_cpu_cap(X86_FEATURE_APIC);
  842. }
  843. e820__reserve_setup_data();
  844. e820__finish_early_params();
  845. if (efi_enabled(EFI_BOOT))
  846. efi_init();
  847. dmi_scan_machine();
  848. dmi_memdev_walk();
  849. dmi_set_dump_stack_arch_desc();
  850. /*
  851. * VMware detection requires dmi to be available, so this
  852. * needs to be done after dmi_scan_machine(), for the boot CPU.
  853. */
  854. init_hypervisor_platform();
  855. tsc_early_init();
  856. x86_init.resources.probe_roms();
  857. /* after parse_early_param, so could debug it */
  858. insert_resource(&iomem_resource, &code_resource);
  859. insert_resource(&iomem_resource, &data_resource);
  860. insert_resource(&iomem_resource, &bss_resource);
  861. e820_add_kernel_range();
  862. trim_bios_range();
  863. #ifdef CONFIG_X86_32
  864. if (ppro_with_ram_bug()) {
  865. e820__range_update(0x70000000ULL, 0x40000ULL, E820_TYPE_RAM,
  866. E820_TYPE_RESERVED);
  867. e820__update_table(e820_table);
  868. printk(KERN_INFO "fixed physical RAM map:\n");
  869. e820__print_table("bad_ppro");
  870. }
  871. #else
  872. early_gart_iommu_check();
  873. #endif
  874. /*
  875. * partially used pages are not usable - thus
  876. * we are rounding upwards:
  877. */
  878. max_pfn = e820__end_of_ram_pfn();
  879. /* update e820 for memory not covered by WB MTRRs */
  880. mtrr_bp_init();
  881. if (mtrr_trim_uncached_memory(max_pfn))
  882. max_pfn = e820__end_of_ram_pfn();
  883. max_possible_pfn = max_pfn;
  884. /*
  885. * This call is required when the CPU does not support PAT. If
  886. * mtrr_bp_init() invoked it already via pat_init() the call has no
  887. * effect.
  888. */
  889. init_cache_modes();
  890. /*
  891. * Define random base addresses for memory sections after max_pfn is
  892. * defined and before each memory section base is used.
  893. */
  894. kernel_randomize_memory();
  895. #ifdef CONFIG_X86_32
  896. /* max_low_pfn get updated here */
  897. find_low_pfn_range();
  898. #else
  899. check_x2apic();
  900. /* How many end-of-memory variables you have, grandma! */
  901. /* need this before calling reserve_initrd */
  902. if (max_pfn > (1UL<<(32 - PAGE_SHIFT)))
  903. max_low_pfn = e820__end_of_low_ram_pfn();
  904. else
  905. max_low_pfn = max_pfn;
  906. high_memory = (void *)__va(max_pfn * PAGE_SIZE - 1) + 1;
  907. #endif
  908. /*
  909. * Find and reserve possible boot-time SMP configuration:
  910. */
  911. find_smp_config();
  912. reserve_ibft_region();
  913. early_alloc_pgt_buf();
  914. /*
  915. * Need to conclude brk, before e820__memblock_setup()
  916. * it could use memblock_find_in_range, could overlap with
  917. * brk area.
  918. */
  919. reserve_brk();
  920. cleanup_highmap();
  921. memblock_set_current_limit(ISA_END_ADDRESS);
  922. e820__memblock_setup();
  923. reserve_bios_regions();
  924. if (efi_enabled(EFI_MEMMAP)) {
  925. efi_fake_memmap();
  926. efi_find_mirror();
  927. efi_esrt_init();
  928. /*
  929. * The EFI specification says that boot service code won't be
  930. * called after ExitBootServices(). This is, in fact, a lie.
  931. */
  932. efi_reserve_boot_services();
  933. }
  934. /* preallocate 4k for mptable mpc */
  935. e820__memblock_alloc_reserved_mpc_new();
  936. #ifdef CONFIG_X86_CHECK_BIOS_CORRUPTION
  937. setup_bios_corruption_check();
  938. #endif
  939. #ifdef CONFIG_X86_32
  940. printk(KERN_DEBUG "initial memory mapped: [mem 0x00000000-%#010lx]\n",
  941. (max_pfn_mapped<<PAGE_SHIFT) - 1);
  942. #endif
  943. reserve_real_mode();
  944. trim_platform_memory_ranges();
  945. trim_low_memory_range();
  946. init_mem_mapping();
  947. idt_setup_early_pf();
  948. /*
  949. * Update mmu_cr4_features (and, indirectly, trampoline_cr4_features)
  950. * with the current CR4 value. This may not be necessary, but
  951. * auditing all the early-boot CR4 manipulation would be needed to
  952. * rule it out.
  953. *
  954. * Mask off features that don't work outside long mode (just
  955. * PCIDE for now).
  956. */
  957. mmu_cr4_features = __read_cr4() & ~X86_CR4_PCIDE;
  958. memblock_set_current_limit(get_max_mapped());
  959. /*
  960. * NOTE: On x86-32, only from this point on, fixmaps are ready for use.
  961. */
  962. #ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT
  963. if (init_ohci1394_dma_early)
  964. init_ohci1394_dma_on_all_controllers();
  965. #endif
  966. /* Allocate bigger log buffer */
  967. setup_log_buf(1);
  968. if (efi_enabled(EFI_BOOT)) {
  969. switch (boot_params.secure_boot) {
  970. case efi_secureboot_mode_disabled:
  971. pr_info("Secure boot disabled\n");
  972. break;
  973. case efi_secureboot_mode_enabled:
  974. pr_info("Secure boot enabled\n");
  975. break;
  976. default:
  977. pr_info("Secure boot could not be determined\n");
  978. break;
  979. }
  980. }
  981. reserve_initrd();
  982. acpi_table_upgrade();
  983. /* Look for ACPI tables and reserve memory occupied by them. */
  984. acpi_boot_table_init();
  985. vsmp_init();
  986. io_delay_init();
  987. early_platform_quirks();
  988. early_acpi_boot_init();
  989. initmem_init();
  990. dma_contiguous_reserve(max_pfn_mapped << PAGE_SHIFT);
  991. /*
  992. * Reserve memory for crash kernel after SRAT is parsed so that it
  993. * won't consume hotpluggable memory.
  994. */
  995. reserve_crashkernel();
  996. memblock_find_dma_reserve();
  997. if (!early_xdbc_setup_hardware())
  998. early_xdbc_register_console();
  999. x86_init.paging.pagetable_init();
  1000. kasan_init();
  1001. /*
  1002. * Sync back kernel address range.
  1003. *
  1004. * FIXME: Can the later sync in setup_cpu_entry_areas() replace
  1005. * this call?
  1006. */
  1007. sync_initial_page_table();
  1008. tboot_probe();
  1009. map_vsyscall();
  1010. generic_apic_probe();
  1011. early_quirks();
  1012. /*
  1013. * Read APIC and some other early information from ACPI tables.
  1014. */
  1015. acpi_boot_init();
  1016. sfi_init();
  1017. x86_dtb_init();
  1018. /*
  1019. * get boot-time SMP configuration:
  1020. */
  1021. get_smp_config();
  1022. /*
  1023. * Systems w/o ACPI and mptables might not have it mapped the local
  1024. * APIC yet, but prefill_possible_map() might need to access it.
  1025. */
  1026. init_apic_mappings();
  1027. prefill_possible_map();
  1028. init_cpu_to_node();
  1029. io_apic_init_mappings();
  1030. x86_init.hyper.guest_late_init();
  1031. e820__reserve_resources();
  1032. e820__register_nosave_regions(max_pfn);
  1033. x86_init.resources.reserve_resources();
  1034. e820__setup_pci_gap();
  1035. #ifdef CONFIG_VT
  1036. #if defined(CONFIG_VGA_CONSOLE)
  1037. if (!efi_enabled(EFI_BOOT) || (efi_mem_type(0xa0000) != EFI_CONVENTIONAL_MEMORY))
  1038. conswitchp = &vga_con;
  1039. #elif defined(CONFIG_DUMMY_CONSOLE)
  1040. conswitchp = &dummy_con;
  1041. #endif
  1042. #endif
  1043. x86_init.oem.banner();
  1044. x86_init.timers.wallclock_init();
  1045. mcheck_init();
  1046. register_refined_jiffies(CLOCK_TICK_RATE);
  1047. #ifdef CONFIG_EFI
  1048. if (efi_enabled(EFI_BOOT))
  1049. efi_apply_memmap_quirks();
  1050. #endif
  1051. unwind_init();
  1052. }
  1053. #ifdef CONFIG_X86_32
  1054. static struct resource video_ram_resource = {
  1055. .name = "Video RAM area",
  1056. .start = 0xa0000,
  1057. .end = 0xbffff,
  1058. .flags = IORESOURCE_BUSY | IORESOURCE_MEM
  1059. };
  1060. void __init i386_reserve_resources(void)
  1061. {
  1062. request_resource(&iomem_resource, &video_ram_resource);
  1063. reserve_standard_io_resources();
  1064. }
  1065. #endif /* CONFIG_X86_32 */
  1066. static struct notifier_block kernel_offset_notifier = {
  1067. .notifier_call = dump_kernel_offset
  1068. };
  1069. static int __init register_kernel_offset_dumper(void)
  1070. {
  1071. atomic_notifier_chain_register(&panic_notifier_list,
  1072. &kernel_offset_notifier);
  1073. return 0;
  1074. }
  1075. __initcall(register_kernel_offset_dumper);