18c2ecf20Sopenharmony_ci======================
28c2ecf20Sopenharmony_ciFirmware-Assisted Dump
38c2ecf20Sopenharmony_ci======================
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ciJuly 2011
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ciThe goal of firmware-assisted dump is to enable the dump of
88c2ecf20Sopenharmony_cia crashed system, and to do so from a fully-reset system, and
98c2ecf20Sopenharmony_cito minimize the total elapsed time until the system is back
108c2ecf20Sopenharmony_ciin production use.
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci- Firmware-Assisted Dump (FADump) infrastructure is intended to replace
138c2ecf20Sopenharmony_ci  the existing phyp assisted dump.
148c2ecf20Sopenharmony_ci- Fadump uses the same firmware interfaces and memory reservation model
158c2ecf20Sopenharmony_ci  as phyp assisted dump.
168c2ecf20Sopenharmony_ci- Unlike phyp dump, FADump exports the memory dump through /proc/vmcore
178c2ecf20Sopenharmony_ci  in the ELF format in the same way as kdump. This helps us reuse the
188c2ecf20Sopenharmony_ci  kdump infrastructure for dump capture and filtering.
198c2ecf20Sopenharmony_ci- Unlike phyp dump, userspace tool does not need to refer any sysfs
208c2ecf20Sopenharmony_ci  interface while reading /proc/vmcore.
218c2ecf20Sopenharmony_ci- Unlike phyp dump, FADump allows user to release all the memory reserved
228c2ecf20Sopenharmony_ci  for dump, with a single operation of echo 1 > /sys/kernel/fadump_release_mem.
238c2ecf20Sopenharmony_ci- Once enabled through kernel boot parameter, FADump can be
248c2ecf20Sopenharmony_ci  started/stopped through /sys/kernel/fadump_registered interface (see
258c2ecf20Sopenharmony_ci  sysfs files section below) and can be easily integrated with kdump
268c2ecf20Sopenharmony_ci  service start/stop init scripts.
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ciComparing with kdump or other strategies, firmware-assisted
298c2ecf20Sopenharmony_cidump offers several strong, practical advantages:
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci-  Unlike kdump, the system has been reset, and loaded
328c2ecf20Sopenharmony_ci   with a fresh copy of the kernel.  In particular,
338c2ecf20Sopenharmony_ci   PCI and I/O devices have been reinitialized and are
348c2ecf20Sopenharmony_ci   in a clean, consistent state.
358c2ecf20Sopenharmony_ci-  Once the dump is copied out, the memory that held the dump
368c2ecf20Sopenharmony_ci   is immediately available to the running kernel. And therefore,
378c2ecf20Sopenharmony_ci   unlike kdump, FADump doesn't need a 2nd reboot to get back
388c2ecf20Sopenharmony_ci   the system to the production configuration.
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ciThe above can only be accomplished by coordination with,
418c2ecf20Sopenharmony_ciand assistance from the Power firmware. The procedure is
428c2ecf20Sopenharmony_cias follows:
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci-  The first kernel registers the sections of memory with the
458c2ecf20Sopenharmony_ci   Power firmware for dump preservation during OS initialization.
468c2ecf20Sopenharmony_ci   These registered sections of memory are reserved by the first
478c2ecf20Sopenharmony_ci   kernel during early boot.
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci-  When system crashes, the Power firmware will copy the registered
508c2ecf20Sopenharmony_ci   low memory regions (boot memory) from source to destination area.
518c2ecf20Sopenharmony_ci   It will also save hardware PTE's.
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci   NOTE:
548c2ecf20Sopenharmony_ci         The term 'boot memory' means size of the low memory chunk
558c2ecf20Sopenharmony_ci         that is required for a kernel to boot successfully when
568c2ecf20Sopenharmony_ci         booted with restricted memory. By default, the boot memory
578c2ecf20Sopenharmony_ci         size will be the larger of 5% of system RAM or 256MB.
588c2ecf20Sopenharmony_ci         Alternatively, user can also specify boot memory size
598c2ecf20Sopenharmony_ci         through boot parameter 'crashkernel=' which will override
608c2ecf20Sopenharmony_ci         the default calculated size. Use this option if default
618c2ecf20Sopenharmony_ci         boot memory size is not sufficient for second kernel to
628c2ecf20Sopenharmony_ci         boot successfully. For syntax of crashkernel= parameter,
638c2ecf20Sopenharmony_ci         refer to Documentation/admin-guide/kdump/kdump.rst. If any
648c2ecf20Sopenharmony_ci         offset is provided in crashkernel= parameter, it will be
658c2ecf20Sopenharmony_ci         ignored as FADump uses a predefined offset to reserve memory
668c2ecf20Sopenharmony_ci         for boot memory dump preservation in case of a crash.
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci-  After the low memory (boot memory) area has been saved, the
698c2ecf20Sopenharmony_ci   firmware will reset PCI and other hardware state.  It will
708c2ecf20Sopenharmony_ci   *not* clear the RAM. It will then launch the bootloader, as
718c2ecf20Sopenharmony_ci   normal.
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci-  The freshly booted kernel will notice that there is a new node
748c2ecf20Sopenharmony_ci   (rtas/ibm,kernel-dump on pSeries or ibm,opal/dump/mpipl-boot
758c2ecf20Sopenharmony_ci   on OPAL platform) in the device tree, indicating that
768c2ecf20Sopenharmony_ci   there is crash data available from a previous boot. During
778c2ecf20Sopenharmony_ci   the early boot OS will reserve rest of the memory above
788c2ecf20Sopenharmony_ci   boot memory size effectively booting with restricted memory
798c2ecf20Sopenharmony_ci   size. This will make sure that this kernel (also, referred
808c2ecf20Sopenharmony_ci   to as second kernel or capture kernel) will not touch any
818c2ecf20Sopenharmony_ci   of the dump memory area.
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci-  User-space tools will read /proc/vmcore to obtain the contents
848c2ecf20Sopenharmony_ci   of memory, which holds the previous crashed kernel dump in ELF
858c2ecf20Sopenharmony_ci   format. The userspace tools may copy this info to disk, or
868c2ecf20Sopenharmony_ci   network, nas, san, iscsi, etc. as desired.
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci-  Once the userspace tool is done saving dump, it will echo
898c2ecf20Sopenharmony_ci   '1' to /sys/kernel/fadump_release_mem to release the reserved
908c2ecf20Sopenharmony_ci   memory back to general use, except the memory required for
918c2ecf20Sopenharmony_ci   next firmware-assisted dump registration.
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci   e.g.::
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci     # echo 1 > /sys/kernel/fadump_release_mem
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ciPlease note that the firmware-assisted dump feature
988c2ecf20Sopenharmony_ciis only available on POWER6 and above systems on pSeries
998c2ecf20Sopenharmony_ci(PowerVM) platform and POWER9 and above systems with OP940
1008c2ecf20Sopenharmony_cior later firmware versions on PowerNV (OPAL) platform.
1018c2ecf20Sopenharmony_ciNote that, OPAL firmware exports ibm,opal/dump node when
1028c2ecf20Sopenharmony_ciFADump is supported on PowerNV platform.
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ciOn OPAL based machines, system first boots into an intermittent
1058c2ecf20Sopenharmony_cikernel (referred to as petitboot kernel) before booting into the
1068c2ecf20Sopenharmony_cicapture kernel. This kernel would have minimal kernel and/or
1078c2ecf20Sopenharmony_ciuserspace support to process crash data. Such kernel needs to
1088c2ecf20Sopenharmony_cipreserve previously crash'ed kernel's memory for the subsequent
1098c2ecf20Sopenharmony_cicapture kernel boot to process this crash data. Kernel config
1108c2ecf20Sopenharmony_cioption CONFIG_PRESERVE_FA_DUMP has to be enabled on such kernel
1118c2ecf20Sopenharmony_cito ensure that crash data is preserved to process later.
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci-- On OPAL based machines (PowerNV), if the kernel is build with
1148c2ecf20Sopenharmony_ci   CONFIG_OPAL_CORE=y, OPAL memory at the time of crash is also
1158c2ecf20Sopenharmony_ci   exported as /sys/firmware/opal/mpipl/core file. This procfs file is
1168c2ecf20Sopenharmony_ci   helpful in debugging OPAL crashes with GDB. The kernel memory
1178c2ecf20Sopenharmony_ci   used for exporting this procfs file can be released by echo'ing
1188c2ecf20Sopenharmony_ci   '1' to /sys/firmware/opal/mpipl/release_core node.
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci   e.g.
1218c2ecf20Sopenharmony_ci     # echo 1 > /sys/firmware/opal/mpipl/release_core
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ciImplementation details:
1248c2ecf20Sopenharmony_ci-----------------------
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ciDuring boot, a check is made to see if firmware supports
1278c2ecf20Sopenharmony_cithis feature on that particular machine. If it does, then
1288c2ecf20Sopenharmony_ciwe check to see if an active dump is waiting for us. If yes
1298c2ecf20Sopenharmony_cithen everything but boot memory size of RAM is reserved during
1308c2ecf20Sopenharmony_ciearly boot (See Fig. 2). This area is released once we finish
1318c2ecf20Sopenharmony_cicollecting the dump from user land scripts (e.g. kdump scripts)
1328c2ecf20Sopenharmony_cithat are run. If there is dump data, then the
1338c2ecf20Sopenharmony_ci/sys/kernel/fadump_release_mem file is created, and the reserved
1348c2ecf20Sopenharmony_cimemory is held.
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ciIf there is no waiting dump data, then only the memory required to
1378c2ecf20Sopenharmony_cihold CPU state, HPTE region, boot memory dump, FADump header and
1388c2ecf20Sopenharmony_cielfcore header, is usually reserved at an offset greater than boot
1398c2ecf20Sopenharmony_cimemory size (see Fig. 1). This area is *not* released: this region
1408c2ecf20Sopenharmony_ciwill be kept permanently reserved, so that it can act as a receptacle
1418c2ecf20Sopenharmony_cifor a copy of the boot memory content in addition to CPU state and
1428c2ecf20Sopenharmony_ciHPTE region, in the case a crash does occur.
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_ciSince this reserved memory area is used only after the system crash,
1458c2ecf20Sopenharmony_cithere is no point in blocking this significant chunk of memory from
1468c2ecf20Sopenharmony_ciproduction kernel. Hence, the implementation uses the Linux kernel's
1478c2ecf20Sopenharmony_ciContiguous Memory Allocator (CMA) for memory reservation if CMA is
1488c2ecf20Sopenharmony_ciconfigured for kernel. With CMA reservation this memory will be
1498c2ecf20Sopenharmony_ciavailable for applications to use it, while kernel is prevented from
1508c2ecf20Sopenharmony_ciusing it. With this FADump will still be able to capture all of the
1518c2ecf20Sopenharmony_cikernel memory and most of the user space memory except the user pages
1528c2ecf20Sopenharmony_cithat were present in CMA region::
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_ci  o Memory Reservation during first kernel
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_ci  Low memory                                                 Top of memory
1578c2ecf20Sopenharmony_ci  0    boot memory size   |<--- Reserved dump area --->|       |
1588c2ecf20Sopenharmony_ci  |           |           |    Permanent Reservation   |       |
1598c2ecf20Sopenharmony_ci  V           V           |                            |       V
1608c2ecf20Sopenharmony_ci  +-----------+-----/ /---+---+----+-------+-----+-----+----+--+
1618c2ecf20Sopenharmony_ci  |           |           |///|////|  DUMP | HDR | ELF |////|  |
1628c2ecf20Sopenharmony_ci  +-----------+-----/ /---+---+----+-------+-----+-----+----+--+
1638c2ecf20Sopenharmony_ci        |                   ^    ^     ^      ^           ^
1648c2ecf20Sopenharmony_ci        |                   |    |     |      |           |
1658c2ecf20Sopenharmony_ci        \                  CPU  HPTE   /      |           |
1668c2ecf20Sopenharmony_ci         ------------------------------       |           |
1678c2ecf20Sopenharmony_ci      Boot memory content gets transferred    |           |
1688c2ecf20Sopenharmony_ci      to reserved area by firmware at the     |           |
1698c2ecf20Sopenharmony_ci      time of crash.                          |           |
1708c2ecf20Sopenharmony_ci                                          FADump Header   |
1718c2ecf20Sopenharmony_ci                                           (meta area)    |
1728c2ecf20Sopenharmony_ci                                                          |
1738c2ecf20Sopenharmony_ci                                                          |
1748c2ecf20Sopenharmony_ci                      Metadata: This area holds a metadata struture whose
1758c2ecf20Sopenharmony_ci                      address is registered with f/w and retrieved in the
1768c2ecf20Sopenharmony_ci                      second kernel after crash, on platforms that support
1778c2ecf20Sopenharmony_ci                      tags (OPAL). Having such structure with info needed
1788c2ecf20Sopenharmony_ci                      to process the crashdump eases dump capture process.
1798c2ecf20Sopenharmony_ci
1808c2ecf20Sopenharmony_ci                   Fig. 1
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci  o Memory Reservation during second kernel after crash
1848c2ecf20Sopenharmony_ci
1858c2ecf20Sopenharmony_ci  Low memory                                              Top of memory
1868c2ecf20Sopenharmony_ci  0      boot memory size                                      |
1878c2ecf20Sopenharmony_ci  |           |<------------ Crash preserved area ------------>|
1888c2ecf20Sopenharmony_ci  V           V           |<--- Reserved dump area --->|       |
1898c2ecf20Sopenharmony_ci  +-----------+-----/ /---+---+----+-------+-----+-----+----+--+
1908c2ecf20Sopenharmony_ci  |           |           |///|////|  DUMP | HDR | ELF |////|  |
1918c2ecf20Sopenharmony_ci  +-----------+-----/ /---+---+----+-------+-----+-----+----+--+
1928c2ecf20Sopenharmony_ci        |                                           |
1938c2ecf20Sopenharmony_ci        V                                           V
1948c2ecf20Sopenharmony_ci   Used by second                             /proc/vmcore
1958c2ecf20Sopenharmony_ci   kernel to boot
1968c2ecf20Sopenharmony_ci
1978c2ecf20Sopenharmony_ci        +---+
1988c2ecf20Sopenharmony_ci        |///| -> Regions (CPU, HPTE & Metadata) marked like this in the above
1998c2ecf20Sopenharmony_ci        +---+    figures are not always present. For example, OPAL platform
2008c2ecf20Sopenharmony_ci                 does not have CPU & HPTE regions while Metadata region is
2018c2ecf20Sopenharmony_ci                 not supported on pSeries currently.
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_ci                   Fig. 2
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_ci
2068c2ecf20Sopenharmony_ciCurrently the dump will be copied from /proc/vmcore to a new file upon
2078c2ecf20Sopenharmony_ciuser intervention. The dump data available through /proc/vmcore will be
2088c2ecf20Sopenharmony_ciin ELF format. Hence the existing kdump infrastructure (kdump scripts)
2098c2ecf20Sopenharmony_cito save the dump works fine with minor modifications. KDump scripts on
2108c2ecf20Sopenharmony_cimajor Distro releases have already been modified to work seemlessly (no
2118c2ecf20Sopenharmony_ciuser intervention in saving the dump) when FADump is used, instead of
2128c2ecf20Sopenharmony_ciKDump, as dump mechanism.
2138c2ecf20Sopenharmony_ci
2148c2ecf20Sopenharmony_ciThe tools to examine the dump will be same as the ones
2158c2ecf20Sopenharmony_ciused for kdump.
2168c2ecf20Sopenharmony_ci
2178c2ecf20Sopenharmony_ciHow to enable firmware-assisted dump (FADump):
2188c2ecf20Sopenharmony_ci----------------------------------------------
2198c2ecf20Sopenharmony_ci
2208c2ecf20Sopenharmony_ci1. Set config option CONFIG_FA_DUMP=y and build kernel.
2218c2ecf20Sopenharmony_ci2. Boot into linux kernel with 'fadump=on' kernel cmdline option.
2228c2ecf20Sopenharmony_ci   By default, FADump reserved memory will be initialized as CMA area.
2238c2ecf20Sopenharmony_ci   Alternatively, user can boot linux kernel with 'fadump=nocma' to
2248c2ecf20Sopenharmony_ci   prevent FADump to use CMA.
2258c2ecf20Sopenharmony_ci3. Optionally, user can also set 'crashkernel=' kernel cmdline
2268c2ecf20Sopenharmony_ci   to specify size of the memory to reserve for boot memory dump
2278c2ecf20Sopenharmony_ci   preservation.
2288c2ecf20Sopenharmony_ci
2298c2ecf20Sopenharmony_ciNOTE:
2308c2ecf20Sopenharmony_ci     1. 'fadump_reserve_mem=' parameter has been deprecated. Instead
2318c2ecf20Sopenharmony_ci        use 'crashkernel=' to specify size of the memory to reserve
2328c2ecf20Sopenharmony_ci        for boot memory dump preservation.
2338c2ecf20Sopenharmony_ci     2. If firmware-assisted dump fails to reserve memory then it
2348c2ecf20Sopenharmony_ci        will fallback to existing kdump mechanism if 'crashkernel='
2358c2ecf20Sopenharmony_ci        option is set at kernel cmdline.
2368c2ecf20Sopenharmony_ci     3. if user wants to capture all of user space memory and ok with
2378c2ecf20Sopenharmony_ci        reserved memory not available to production system, then
2388c2ecf20Sopenharmony_ci        'fadump=nocma' kernel parameter can be used to fallback to
2398c2ecf20Sopenharmony_ci        old behaviour.
2408c2ecf20Sopenharmony_ci
2418c2ecf20Sopenharmony_ciSysfs/debugfs files:
2428c2ecf20Sopenharmony_ci--------------------
2438c2ecf20Sopenharmony_ci
2448c2ecf20Sopenharmony_ciFirmware-assisted dump feature uses sysfs file system to hold
2458c2ecf20Sopenharmony_cithe control files and debugfs file to display memory reserved region.
2468c2ecf20Sopenharmony_ci
2478c2ecf20Sopenharmony_ciHere is the list of files under kernel sysfs:
2488c2ecf20Sopenharmony_ci
2498c2ecf20Sopenharmony_ci /sys/kernel/fadump_enabled
2508c2ecf20Sopenharmony_ci    This is used to display the FADump status.
2518c2ecf20Sopenharmony_ci
2528c2ecf20Sopenharmony_ci    - 0 = FADump is disabled
2538c2ecf20Sopenharmony_ci    - 1 = FADump is enabled
2548c2ecf20Sopenharmony_ci
2558c2ecf20Sopenharmony_ci    This interface can be used by kdump init scripts to identify if
2568c2ecf20Sopenharmony_ci    FADump is enabled in the kernel and act accordingly.
2578c2ecf20Sopenharmony_ci
2588c2ecf20Sopenharmony_ci /sys/kernel/fadump_registered
2598c2ecf20Sopenharmony_ci    This is used to display the FADump registration status as well
2608c2ecf20Sopenharmony_ci    as to control (start/stop) the FADump registration.
2618c2ecf20Sopenharmony_ci
2628c2ecf20Sopenharmony_ci    - 0 = FADump is not registered.
2638c2ecf20Sopenharmony_ci    - 1 = FADump is registered and ready to handle system crash.
2648c2ecf20Sopenharmony_ci
2658c2ecf20Sopenharmony_ci    To register FADump echo 1 > /sys/kernel/fadump_registered and
2668c2ecf20Sopenharmony_ci    echo 0 > /sys/kernel/fadump_registered for un-register and stop the
2678c2ecf20Sopenharmony_ci    FADump. Once the FADump is un-registered, the system crash will not
2688c2ecf20Sopenharmony_ci    be handled and vmcore will not be captured. This interface can be
2698c2ecf20Sopenharmony_ci    easily integrated with kdump service start/stop.
2708c2ecf20Sopenharmony_ci
2718c2ecf20Sopenharmony_ci /sys/kernel/fadump/mem_reserved
2728c2ecf20Sopenharmony_ci
2738c2ecf20Sopenharmony_ci   This is used to display the memory reserved by FADump for saving the
2748c2ecf20Sopenharmony_ci   crash dump.
2758c2ecf20Sopenharmony_ci
2768c2ecf20Sopenharmony_ci /sys/kernel/fadump_release_mem
2778c2ecf20Sopenharmony_ci    This file is available only when FADump is active during
2788c2ecf20Sopenharmony_ci    second kernel. This is used to release the reserved memory
2798c2ecf20Sopenharmony_ci    region that are held for saving crash dump. To release the
2808c2ecf20Sopenharmony_ci    reserved memory echo 1 to it::
2818c2ecf20Sopenharmony_ci
2828c2ecf20Sopenharmony_ci	echo 1  > /sys/kernel/fadump_release_mem
2838c2ecf20Sopenharmony_ci
2848c2ecf20Sopenharmony_ci    After echo 1, the content of the /sys/kernel/debug/powerpc/fadump_region
2858c2ecf20Sopenharmony_ci    file will change to reflect the new memory reservations.
2868c2ecf20Sopenharmony_ci
2878c2ecf20Sopenharmony_ci    The existing userspace tools (kdump infrastructure) can be easily
2888c2ecf20Sopenharmony_ci    enhanced to use this interface to release the memory reserved for
2898c2ecf20Sopenharmony_ci    dump and continue without 2nd reboot.
2908c2ecf20Sopenharmony_ci
2918c2ecf20Sopenharmony_ciNote: /sys/kernel/fadump_release_opalcore sysfs has moved to
2928c2ecf20Sopenharmony_ci      /sys/firmware/opal/mpipl/release_core
2938c2ecf20Sopenharmony_ci
2948c2ecf20Sopenharmony_ci /sys/firmware/opal/mpipl/release_core
2958c2ecf20Sopenharmony_ci
2968c2ecf20Sopenharmony_ci    This file is available only on OPAL based machines when FADump is
2978c2ecf20Sopenharmony_ci    active during capture kernel. This is used to release the memory
2988c2ecf20Sopenharmony_ci    used by the kernel to export /sys/firmware/opal/mpipl/core file. To
2998c2ecf20Sopenharmony_ci    release this memory, echo '1' to it:
3008c2ecf20Sopenharmony_ci
3018c2ecf20Sopenharmony_ci    echo 1  > /sys/firmware/opal/mpipl/release_core
3028c2ecf20Sopenharmony_ci
3038c2ecf20Sopenharmony_ciNote: The following FADump sysfs files are deprecated.
3048c2ecf20Sopenharmony_ci
3058c2ecf20Sopenharmony_ci+----------------------------------+--------------------------------+
3068c2ecf20Sopenharmony_ci| Deprecated                       | Alternative                    |
3078c2ecf20Sopenharmony_ci+----------------------------------+--------------------------------+
3088c2ecf20Sopenharmony_ci| /sys/kernel/fadump_enabled       | /sys/kernel/fadump/enabled     |
3098c2ecf20Sopenharmony_ci+----------------------------------+--------------------------------+
3108c2ecf20Sopenharmony_ci| /sys/kernel/fadump_registered    | /sys/kernel/fadump/registered  |
3118c2ecf20Sopenharmony_ci+----------------------------------+--------------------------------+
3128c2ecf20Sopenharmony_ci| /sys/kernel/fadump_release_mem   | /sys/kernel/fadump/release_mem |
3138c2ecf20Sopenharmony_ci+----------------------------------+--------------------------------+
3148c2ecf20Sopenharmony_ci
3158c2ecf20Sopenharmony_ciHere is the list of files under powerpc debugfs:
3168c2ecf20Sopenharmony_ci(Assuming debugfs is mounted on /sys/kernel/debug directory.)
3178c2ecf20Sopenharmony_ci
3188c2ecf20Sopenharmony_ci /sys/kernel/debug/powerpc/fadump_region
3198c2ecf20Sopenharmony_ci    This file shows the reserved memory regions if FADump is
3208c2ecf20Sopenharmony_ci    enabled otherwise this file is empty. The output format
3218c2ecf20Sopenharmony_ci    is::
3228c2ecf20Sopenharmony_ci
3238c2ecf20Sopenharmony_ci      <region>: [<start>-<end>] <reserved-size> bytes, Dumped: <dump-size>
3248c2ecf20Sopenharmony_ci
3258c2ecf20Sopenharmony_ci    and for kernel DUMP region is:
3268c2ecf20Sopenharmony_ci
3278c2ecf20Sopenharmony_ci    DUMP: Src: <src-addr>, Dest: <dest-addr>, Size: <size>, Dumped: # bytes
3288c2ecf20Sopenharmony_ci
3298c2ecf20Sopenharmony_ci    e.g.
3308c2ecf20Sopenharmony_ci    Contents when FADump is registered during first kernel::
3318c2ecf20Sopenharmony_ci
3328c2ecf20Sopenharmony_ci      # cat /sys/kernel/debug/powerpc/fadump_region
3338c2ecf20Sopenharmony_ci      CPU : [0x0000006ffb0000-0x0000006fff001f] 0x40020 bytes, Dumped: 0x0
3348c2ecf20Sopenharmony_ci      HPTE: [0x0000006fff0020-0x0000006fff101f] 0x1000 bytes, Dumped: 0x0
3358c2ecf20Sopenharmony_ci      DUMP: [0x0000006fff1020-0x0000007fff101f] 0x10000000 bytes, Dumped: 0x0
3368c2ecf20Sopenharmony_ci
3378c2ecf20Sopenharmony_ci    Contents when FADump is active during second kernel::
3388c2ecf20Sopenharmony_ci
3398c2ecf20Sopenharmony_ci      # cat /sys/kernel/debug/powerpc/fadump_region
3408c2ecf20Sopenharmony_ci      CPU : [0x0000006ffb0000-0x0000006fff001f] 0x40020 bytes, Dumped: 0x40020
3418c2ecf20Sopenharmony_ci      HPTE: [0x0000006fff0020-0x0000006fff101f] 0x1000 bytes, Dumped: 0x1000
3428c2ecf20Sopenharmony_ci      DUMP: [0x0000006fff1020-0x0000007fff101f] 0x10000000 bytes, Dumped: 0x10000000
3438c2ecf20Sopenharmony_ci          : [0x00000010000000-0x0000006ffaffff] 0x5ffb0000 bytes, Dumped: 0x5ffb0000
3448c2ecf20Sopenharmony_ci
3458c2ecf20Sopenharmony_ci
3468c2ecf20Sopenharmony_ciNOTE:
3478c2ecf20Sopenharmony_ci      Please refer to Documentation/filesystems/debugfs.rst on
3488c2ecf20Sopenharmony_ci      how to mount the debugfs filesystem.
3498c2ecf20Sopenharmony_ci
3508c2ecf20Sopenharmony_ci
3518c2ecf20Sopenharmony_ciTODO:
3528c2ecf20Sopenharmony_ci-----
3538c2ecf20Sopenharmony_ci - Need to come up with the better approach to find out more
3548c2ecf20Sopenharmony_ci   accurate boot memory size that is required for a kernel to
3558c2ecf20Sopenharmony_ci   boot successfully when booted with restricted memory.
3568c2ecf20Sopenharmony_ci - The FADump implementation introduces a FADump crash info structure
3578c2ecf20Sopenharmony_ci   in the scratch area before the ELF core header. The idea of introducing
3588c2ecf20Sopenharmony_ci   this structure is to pass some important crash info data to the second
3598c2ecf20Sopenharmony_ci   kernel which will help second kernel to populate ELF core header with
3608c2ecf20Sopenharmony_ci   correct data before it gets exported through /proc/vmcore. The current
3618c2ecf20Sopenharmony_ci   design implementation does not address a possibility of introducing
3628c2ecf20Sopenharmony_ci   additional fields (in future) to this structure without affecting
3638c2ecf20Sopenharmony_ci   compatibility. Need to come up with the better approach to address this.
3648c2ecf20Sopenharmony_ci
3658c2ecf20Sopenharmony_ci   The possible approaches are:
3668c2ecf20Sopenharmony_ci
3678c2ecf20Sopenharmony_ci	1. Introduce version field for version tracking, bump up the version
3688c2ecf20Sopenharmony_ci	whenever a new field is added to the structure in future. The version
3698c2ecf20Sopenharmony_ci	field can be used to find out what fields are valid for the current
3708c2ecf20Sopenharmony_ci	version of the structure.
3718c2ecf20Sopenharmony_ci	2. Reserve the area of predefined size (say PAGE_SIZE) for this
3728c2ecf20Sopenharmony_ci	structure and have unused area as reserved (initialized to zero)
3738c2ecf20Sopenharmony_ci	for future field additions.
3748c2ecf20Sopenharmony_ci
3758c2ecf20Sopenharmony_ci   The advantage of approach 1 over 2 is we don't need to reserve extra space.
3768c2ecf20Sopenharmony_ci
3778c2ecf20Sopenharmony_ciAuthor: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
3788c2ecf20Sopenharmony_ci
3798c2ecf20Sopenharmony_ciThis document is based on the original documentation written for phyp
3808c2ecf20Sopenharmony_ci
3818c2ecf20Sopenharmony_ciassisted dump by Linas Vepstas and Manish Ahuja.
382