AmpereComputing / ampere-lts-kernel---DEPRECATED

Linux 5.4 and 5.10 Longterm kernel (LTS) with Ampere patches
21 stars 18 forks source link

Patch: ACPI: Arm Generic Diagnostic Dump and Reset device #140

Open adamliyi opened 2 years ago

adamliyi commented 2 years ago

Backport finished: 5.4 kernel: 760b3b9e4dcc1 ACPI: APEI: explicit init of HEST and GHES in apci_init() 2f3c2462ad6fe ACPI: AGDI: Add driver for Arm Generic Diagnostic Dump and Reset device c57d3871f38ce ACPI: tables: Add AGDI to the list of known table signatures fd994f7ad760e ACPICA: iASL: Add suppport for AGDI table

5.10 kernel: d59dfcc8f0ef9 ACPI: APEI: explicit init of HEST and GHES in apci_init() 0a584ecb9422e ACPI: AGDI: Add driver for Arm Generic Diagnostic Dump and Reset device 1d96157e15e15 ACPI: tables: Add AGDI to the list of known table signatures a5b1a2c1c11c1 ACPICA: iASL: Add suppport for AGDI table

5.15 kernel: b8d23347e376e ACPI: APEI: explicit init of HEST and GHES in apci_init() a5d1f4186d136 ACPI: AGDI: Add driver for Arm Generic Diagnostic Dump and Reset device 3c09157cf7d25 ACPI: tables: Add AGDI to the list of known table signatures f4013f0305b91 ACPICA: iASL: Add suppport for AGDI table

Successful kdump requires a workaround patch (NOT UPSTREAM): e26e6ac22363f ACPI: AGDI: Complete sdei handler with SDEI_EVENT_COMPLETE_AND_RESUME before nmi_panic

adamliyi commented 2 years ago

The AGDI patches are merged to 5.17 kernel. We will firstly port it to 5.4 and 5.10 kernel. And create unit test cases. Upstream patch:

  1. https://github.com/torvalds/linux/commit/e86801b0ff1c5c6d1f78232f7e3b52c0b0631560, "ACPI: tables: Add AGDI to the list of known table signatures"
  2. https://github.com/torvalds/linux/commit/a2a591fb76e6f5461dfd04715b69c317e50c43a5, "ACPI: AGDI: Add driver for Arm Generic Diagnostic Dump and Reset device"

Will port to 5.15 when 5.15 test finished.

Beside above two patches, another dependent patch: https://github.com/torvalds/linux/commit/dc4e8c07e9e2f69387579c49caca26ba239f7270 .

Since AGDI driver depends on SDEI driver, sdei_init() need to be called before agdi_init().

Optional patch for ACPICA-iASL support: ACPICA: iASL: Add suppport for AGDI table, https://github.com/torvalds/linux/commit/5579649e7eb756a4e3d5784b6958374e5bfc41de

adamliyi commented 2 years ago

To test the AGDI driver:

  1. Need UEFI add AGDI support in ACPI table (or we may override ACPI table in kernel)
  2. Trigger SDEI event with ipmitool: either out-of-band:
    ipmitool -I lanplus -H <IP address> -U ADMIN -P ADMIN raw 0x3c 0x16

    or in-band (from OS)

    ipmitool raw 0x3c 0x16
  3. Kernel will panic:
    [ 72.211667] nmi_panic+0x70/0xa8
    [ 72.211675] agdi_sdei_handler+0x24/0x38
    [ 72.211685] sdei_event_handler+0x28/0x90
    [ 72.211697] do_sdei_event+0x88/0x150
    [ 72.211705] __sdei_handler+0x44/0xe0
    [ 72.211710] __sdei_asm_handler+0xbc/0x180
    [ 72.211716] __arm_smccc_smc+0x14/0x40
    [ 72.211723] __invoke_psci_fn_smc+0x48/0x78

Note: The AGDI support in acpica can be found here: https://github.com/acpica/acpica/pull/737/commits/cf36a6d658ca5aa8c329c2edfc3322c095ffd844

bobolmw commented 2 years ago

To Upgrade ACPI table via initrd:

  1. enable CONFIG_ACPI_TABLE_UPGRADE in kernel
  2. compile latest iasl tools from https://acpica.org/sites/acpica/files/acpica-unix-20211217.tar.gz (agdi.dsl depends on it)
  3. generate agdi.aml by: iasl -sa agdi.dsl
  4. generate initrd: mkdir -p kernel/firmware/acpi && cp dsdt.aml kernel/firmware/acpi/ && find kernel | cpio -H newc --create > /boot/initrd-agdi-test
  5. append current initrd to initrd-agdi-test: cat /boot/initrd-uname-r >> /boot/initrd-agdi-test
  6. edit /boot/grub/grub.cfg, point initrd to /boot/initrd-agdi-test
  7. reboot system
  8. check if /sys/firmware/acpi/tables/AGDI file exist
adamliyi commented 2 years ago

Also need to backport to 4.18 kernel.