mbox series

[00/17] Implement ACPI on aarch64

Message ID 20240727071742.1735703-1-patrick.rudolph@9elements.com
Headers show
Series Implement ACPI on aarch64 | expand

Message

Patrick Rudolph July 27, 2024, 7:17 a.m. UTC
Based on the existing work done by Simon Glass this series adds
support for booting aarch64 devices using ACPI only. As target the
Raspberry Pi4 was used, which is broadly available and allows easy
testing of the proposed solution.

The series is split into ACPI cleanups and code movements, adding
Arm specific ACPI tables and finally SoC and mainboard related
changes to boot a Linux on the RPi4. Currently only the mandatory
ACPI tables are supported, allowing to boot into Linux without errors.

The changes were tested on real hardware as well on QEMU v9.0:

qemu-system-aarch64 -machine raspi4b -kernel u-boot.bin -cpu cortex-a72 \
-smp 4 -m 2G -drive file=raspbian.img,format=raw,index=0 \
-dtb bcm2711-rpi-4-b.dtb -nographic

Please note that the current implementation still requires a DTB to be
provided to U-Boot and that the DTB is used within U-Boot to load drivers,
to disable/enable certain hardware blocks in ACPI. The DTB is not passed
to the OS when using the bootefi cmd.

Tested against FWTS V24.03.00.

Known issues:
- The QEMU support is currently limited as it doesn't emulate PCI, USB or
  ethernet devices!
- The SMP bringup doesn't work on real hardware, but works in QEMU.
- PCI isn't working on real hardware since the pcie_brcmstb Linux kernel
  module doesn't support ACPI yet.

Maximilian Brune (3):
  acpi: x86: Move SPCR and DBG2 into common code
  acpi: x86: Write FADT in common code
  serial: serial_pl01x: Implement .getinfo() for PL01

Patrick Rudolph (12):
  acpi: x86: Move MADT to common code
  acpi: Fix typo
  acpi: Add define for GTDT
  arm: acpi: Add generic ACPI methods
  acpi: acpi_table: Bump revisions
  acpi: Add ACPITAB for PPTT and GTDT
  arm: mach-bcm283x: Map the ARM local MMIO as well
  arm: bcm283x: Write ACPI tables
  arm: cpu: Add ACPI parking protocol support
  arm: mach-bcm283x: Add ARMV8_MULTIENTRY support
  arm: mach-bcm283x: Enable ARMV8_MULTIENTRY
  configs: Add RPI4 ACPI defconfig

Simon Glass (2):
  arm: mach-bcm283x: Bring in some header files from tianocore
  board: raspberrypi: Add ASL files from tianocore

 arch/arm/cpu/armv8/Makefile                   |   1 +
 arch/arm/cpu/armv8/parking_protocol_v8.S      | 102 +++++
 arch/arm/cpu/armv8/start.S                    |   4 +
 arch/arm/include/asm/acpi_table.h             |  70 ++++
 arch/arm/lib/Makefile                         |   1 +
 arch/arm/lib/acpi_table.c                     | 131 ++++++
 arch/arm/mach-bcm283x/Kconfig                 |   4 +
 arch/arm/mach-bcm283x/Makefile                |   4 +
 arch/arm/mach-bcm283x/bcm2711_acpi.c          | 172 ++++++++
 .../mach-bcm283x/include/mach/acpi/bcm2711.h  | 152 +++++++
 .../mach-bcm283x/include/mach/acpi/bcm2836.h  | 127 ++++++
 .../include/mach/acpi/bcm2836_gpio.h          |  19 +
 .../include/mach/acpi/bcm2836_gpu.h           |  47 +++
 .../include/mach/acpi/bcm2836_pwm.h           |  33 ++
 .../include/mach/acpi/bcm2836_sdhost.h        |  18 +
 .../include/mach/acpi/bcm2836_sdio.h          |  21 +
 arch/arm/mach-bcm283x/init.c                  |  79 +++-
 arch/sandbox/lib/Makefile                     |   9 +-
 arch/sandbox/lib/acpi_table.c                 |   7 +
 arch/x86/cpu/apollolake/acpi.c                |  20 +-
 arch/x86/cpu/baytrail/acpi.c                  |  17 +-
 arch/x86/cpu/intel_common/acpi.c              |  20 +-
 arch/x86/cpu/quark/acpi.c                     |  19 +-
 arch/x86/cpu/tangier/acpi.c                   |  31 +-
 arch/x86/include/asm/acpi_table.h             |  26 +-
 arch/x86/lib/acpi_table.c                     | 243 +-----------
 board/raspberrypi/rpi/.gitignore              |   3 +
 board/raspberrypi/rpi/Makefile                |   2 +
 board/raspberrypi/rpi/acpitables.h            |  91 +++++
 board/raspberrypi/rpi/dsdt.asl                | 290 ++++++++++++++
 board/raspberrypi/rpi/emmc.asl                | 136 +++++++
 board/raspberrypi/rpi/gpudevs.asl             | 372 ++++++++++++++++++
 board/raspberrypi/rpi/pci.asl                 | 177 +++++++++
 board/raspberrypi/rpi/pep.asl                 |  90 +++++
 board/raspberrypi/rpi/rhpx.asl                | 195 +++++++++
 board/raspberrypi/rpi/rpi.c                   | 182 +++++++++
 board/raspberrypi/rpi/sdhc.asl                | 111 ++++++
 board/raspberrypi/rpi/uart.asl                | 208 ++++++++++
 boot/bootflow.c                               |   8 +-
 configs/rpi_4_acpi_defconfig                  |  79 ++++
 drivers/pci/pcie_brcmstb.c                    | 101 +----
 drivers/serial/serial_pl01x.c                 |  24 ++
 include/acpi/acpi_table.h                     | 107 +++--
 include/serial.h                              |   1 +
 lib/Kconfig                                   |  15 +
 lib/acpi/acpi_table.c                         | 317 ++++++++++++++-
 46 files changed, 3414 insertions(+), 472 deletions(-)
 create mode 100644 arch/arm/cpu/armv8/parking_protocol_v8.S
 create mode 100644 arch/arm/lib/acpi_table.c
 create mode 100644 arch/arm/mach-bcm283x/bcm2711_acpi.c
 create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2711.h
 create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836.h
 create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_gpio.h
 create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_gpu.h
 create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_pwm.h
 create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_sdhost.h
 create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_sdio.h
 create mode 100644 arch/sandbox/lib/acpi_table.c
 create mode 100644 board/raspberrypi/rpi/.gitignore
 create mode 100644 board/raspberrypi/rpi/acpitables.h
 create mode 100644 board/raspberrypi/rpi/dsdt.asl
 create mode 100644 board/raspberrypi/rpi/emmc.asl
 create mode 100644 board/raspberrypi/rpi/gpudevs.asl
 create mode 100644 board/raspberrypi/rpi/pci.asl
 create mode 100644 board/raspberrypi/rpi/pep.asl
 create mode 100644 board/raspberrypi/rpi/rhpx.asl
 create mode 100644 board/raspberrypi/rpi/sdhc.asl
 create mode 100644 board/raspberrypi/rpi/uart.asl
 create mode 100644 configs/rpi_4_acpi_defconfig

Comments

Simon Glass July 29, 2024, 3:28 p.m. UTC | #1
Hi Patrick,

On Sat, 27 Jul 2024 at 01:20, Patrick Rudolph
<patrick.rudolph@9elements.com> wrote:
>
> Based on the existing work done by Simon Glass this series adds
> support for booting aarch64 devices using ACPI only. As target the
> Raspberry Pi4 was used, which is broadly available and allows easy
> testing of the proposed solution.
>
> The series is split into ACPI cleanups and code movements, adding
> Arm specific ACPI tables and finally SoC and mainboard related
> changes to boot a Linux on the RPi4. Currently only the mandatory
> ACPI tables are supported, allowing to boot into Linux without errors.
>
> The changes were tested on real hardware as well on QEMU v9.0:
>
> qemu-system-aarch64 -machine raspi4b -kernel u-boot.bin -cpu cortex-a72 \
> -smp 4 -m 2G -drive file=raspbian.img,format=raw,index=0 \
> -dtb bcm2711-rpi-4-b.dtb -nographic
>
> Please note that the current implementation still requires a DTB to be
> provided to U-Boot and that the DTB is used within U-Boot to load drivers,
> to disable/enable certain hardware blocks in ACPI. The DTB is not passed
> to the OS when using the bootefi cmd.
>
> Tested against FWTS V24.03.00.
>
> Known issues:
> - The QEMU support is currently limited as it doesn't emulate PCI, USB or
>   ethernet devices!
> - The SMP bringup doesn't work on real hardware, but works in QEMU.
> - PCI isn't working on real hardware since the pcie_brcmstb Linux kernel
>   module doesn't support ACPI yet.

Thank you for picking this up!

>
> Maximilian Brune (3):
>   acpi: x86: Move SPCR and DBG2 into common code
>   acpi: x86: Write FADT in common code
>   serial: serial_pl01x: Implement .getinfo() for PL01
>
> Patrick Rudolph (12):
>   acpi: x86: Move MADT to common code
>   acpi: Fix typo
>   acpi: Add define for GTDT
>   arm: acpi: Add generic ACPI methods
>   acpi: acpi_table: Bump revisions
>   acpi: Add ACPITAB for PPTT and GTDT
>   arm: mach-bcm283x: Map the ARM local MMIO as well
>   arm: bcm283x: Write ACPI tables
>   arm: cpu: Add ACPI parking protocol support
>   arm: mach-bcm283x: Add ARMV8_MULTIENTRY support
>   arm: mach-bcm283x: Enable ARMV8_MULTIENTRY
>   configs: Add RPI4 ACPI defconfig
>
> Simon Glass (2):
>   arm: mach-bcm283x: Bring in some header files from tianocore
>   board: raspberrypi: Add ASL files from tianocore
>
>  arch/arm/cpu/armv8/Makefile                   |   1 +
>  arch/arm/cpu/armv8/parking_protocol_v8.S      | 102 +++++
>  arch/arm/cpu/armv8/start.S                    |   4 +
>  arch/arm/include/asm/acpi_table.h             |  70 ++++
>  arch/arm/lib/Makefile                         |   1 +
>  arch/arm/lib/acpi_table.c                     | 131 ++++++
>  arch/arm/mach-bcm283x/Kconfig                 |   4 +
>  arch/arm/mach-bcm283x/Makefile                |   4 +
>  arch/arm/mach-bcm283x/bcm2711_acpi.c          | 172 ++++++++
>  .../mach-bcm283x/include/mach/acpi/bcm2711.h  | 152 +++++++
>  .../mach-bcm283x/include/mach/acpi/bcm2836.h  | 127 ++++++
>  .../include/mach/acpi/bcm2836_gpio.h          |  19 +
>  .../include/mach/acpi/bcm2836_gpu.h           |  47 +++
>  .../include/mach/acpi/bcm2836_pwm.h           |  33 ++
>  .../include/mach/acpi/bcm2836_sdhost.h        |  18 +
>  .../include/mach/acpi/bcm2836_sdio.h          |  21 +
>  arch/arm/mach-bcm283x/init.c                  |  79 +++-
>  arch/sandbox/lib/Makefile                     |   9 +-
>  arch/sandbox/lib/acpi_table.c                 |   7 +
>  arch/x86/cpu/apollolake/acpi.c                |  20 +-
>  arch/x86/cpu/baytrail/acpi.c                  |  17 +-
>  arch/x86/cpu/intel_common/acpi.c              |  20 +-
>  arch/x86/cpu/quark/acpi.c                     |  19 +-
>  arch/x86/cpu/tangier/acpi.c                   |  31 +-
>  arch/x86/include/asm/acpi_table.h             |  26 +-
>  arch/x86/lib/acpi_table.c                     | 243 +-----------
>  board/raspberrypi/rpi/.gitignore              |   3 +
>  board/raspberrypi/rpi/Makefile                |   2 +
>  board/raspberrypi/rpi/acpitables.h            |  91 +++++
>  board/raspberrypi/rpi/dsdt.asl                | 290 ++++++++++++++
>  board/raspberrypi/rpi/emmc.asl                | 136 +++++++
>  board/raspberrypi/rpi/gpudevs.asl             | 372 ++++++++++++++++++
>  board/raspberrypi/rpi/pci.asl                 | 177 +++++++++
>  board/raspberrypi/rpi/pep.asl                 |  90 +++++
>  board/raspberrypi/rpi/rhpx.asl                | 195 +++++++++
>  board/raspberrypi/rpi/rpi.c                   | 182 +++++++++
>  board/raspberrypi/rpi/sdhc.asl                | 111 ++++++
>  board/raspberrypi/rpi/uart.asl                | 208 ++++++++++
>  boot/bootflow.c                               |   8 +-
>  configs/rpi_4_acpi_defconfig                  |  79 ++++
>  drivers/pci/pcie_brcmstb.c                    | 101 +----
>  drivers/serial/serial_pl01x.c                 |  24 ++
>  include/acpi/acpi_table.h                     | 107 +++--
>  include/serial.h                              |   1 +
>  lib/Kconfig                                   |  15 +
>  lib/acpi/acpi_table.c                         | 317 ++++++++++++++-
>  46 files changed, 3414 insertions(+), 472 deletions(-)
>  create mode 100644 arch/arm/cpu/armv8/parking_protocol_v8.S
>  create mode 100644 arch/arm/lib/acpi_table.c
>  create mode 100644 arch/arm/mach-bcm283x/bcm2711_acpi.c
>  create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2711.h
>  create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836.h
>  create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_gpio.h
>  create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_gpu.h
>  create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_pwm.h
>  create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_sdhost.h
>  create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_sdio.h
>  create mode 100644 arch/sandbox/lib/acpi_table.c
>  create mode 100644 board/raspberrypi/rpi/.gitignore
>  create mode 100644 board/raspberrypi/rpi/acpitables.h
>  create mode 100644 board/raspberrypi/rpi/dsdt.asl
>  create mode 100644 board/raspberrypi/rpi/emmc.asl
>  create mode 100644 board/raspberrypi/rpi/gpudevs.asl
>  create mode 100644 board/raspberrypi/rpi/pci.asl
>  create mode 100644 board/raspberrypi/rpi/pep.asl
>  create mode 100644 board/raspberrypi/rpi/rhpx.asl
>  create mode 100644 board/raspberrypi/rpi/sdhc.asl
>  create mode 100644 board/raspberrypi/rpi/uart.asl
>  create mode 100644 configs/rpi_4_acpi_defconfig
>
> --
> 2.45.2
>

Regards,
Simon
Peter Robinson July 29, 2024, 8:02 p.m. UTC | #2
Hi Patrick,

> Based on the existing work done by Simon Glass this series adds
> support for booting aarch64 devices using ACPI only. As target the
> Raspberry Pi4 was used, which is broadly available and allows easy
> testing of the proposed solution.

Rather than just RPi4 support we should add generic qemu support, as
opposed to emulated RPi4 in qemu support as qemu already supports ACPI
on aarch64 for generic SystemReady support with pci/network etc that
way the support is much easier to test in CI.

Also are the ACPI tables you use here compatible with the tianocore
raspberry pi 4 support so users don't end up with weird differences
between firmware?

> The series is split into ACPI cleanups and code movements, adding
> Arm specific ACPI tables and finally SoC and mainboard related
> changes to boot a Linux on the RPi4. Currently only the mandatory
> ACPI tables are supported, allowing to boot into Linux without errors.
>
> The changes were tested on real hardware as well on QEMU v9.0:
>
> qemu-system-aarch64 -machine raspi4b -kernel u-boot.bin -cpu cortex-a72 \
> -smp 4 -m 2G -drive file=raspbian.img,format=raw,index=0 \
> -dtb bcm2711-rpi-4-b.dtb -nographic
>
> Please note that the current implementation still requires a DTB to be
> provided to U-Boot and that the DTB is used within U-Boot to load drivers,
> to disable/enable certain hardware blocks in ACPI. The DTB is not passed
> to the OS when using the bootefi cmd.
>
> Tested against FWTS V24.03.00.
>
> Known issues:
> - The QEMU support is currently limited as it doesn't emulate PCI, USB or
>   ethernet devices!
> - The SMP bringup doesn't work on real hardware, but works in QEMU.
> - PCI isn't working on real hardware since the pcie_brcmstb Linux kernel
>   module doesn't support ACPI yet.
>
> Maximilian Brune (3):
>   acpi: x86: Move SPCR and DBG2 into common code
>   acpi: x86: Write FADT in common code
>   serial: serial_pl01x: Implement .getinfo() for PL01
>
> Patrick Rudolph (12):
>   acpi: x86: Move MADT to common code
>   acpi: Fix typo
>   acpi: Add define for GTDT
>   arm: acpi: Add generic ACPI methods
>   acpi: acpi_table: Bump revisions
>   acpi: Add ACPITAB for PPTT and GTDT
>   arm: mach-bcm283x: Map the ARM local MMIO as well
>   arm: bcm283x: Write ACPI tables
>   arm: cpu: Add ACPI parking protocol support
>   arm: mach-bcm283x: Add ARMV8_MULTIENTRY support
>   arm: mach-bcm283x: Enable ARMV8_MULTIENTRY
>   configs: Add RPI4 ACPI defconfig
>
> Simon Glass (2):
>   arm: mach-bcm283x: Bring in some header files from tianocore
>   board: raspberrypi: Add ASL files from tianocore
>
>  arch/arm/cpu/armv8/Makefile                   |   1 +
>  arch/arm/cpu/armv8/parking_protocol_v8.S      | 102 +++++
>  arch/arm/cpu/armv8/start.S                    |   4 +
>  arch/arm/include/asm/acpi_table.h             |  70 ++++
>  arch/arm/lib/Makefile                         |   1 +
>  arch/arm/lib/acpi_table.c                     | 131 ++++++
>  arch/arm/mach-bcm283x/Kconfig                 |   4 +
>  arch/arm/mach-bcm283x/Makefile                |   4 +
>  arch/arm/mach-bcm283x/bcm2711_acpi.c          | 172 ++++++++
>  .../mach-bcm283x/include/mach/acpi/bcm2711.h  | 152 +++++++
>  .../mach-bcm283x/include/mach/acpi/bcm2836.h  | 127 ++++++
>  .../include/mach/acpi/bcm2836_gpio.h          |  19 +
>  .../include/mach/acpi/bcm2836_gpu.h           |  47 +++
>  .../include/mach/acpi/bcm2836_pwm.h           |  33 ++
>  .../include/mach/acpi/bcm2836_sdhost.h        |  18 +
>  .../include/mach/acpi/bcm2836_sdio.h          |  21 +
>  arch/arm/mach-bcm283x/init.c                  |  79 +++-
>  arch/sandbox/lib/Makefile                     |   9 +-
>  arch/sandbox/lib/acpi_table.c                 |   7 +
>  arch/x86/cpu/apollolake/acpi.c                |  20 +-
>  arch/x86/cpu/baytrail/acpi.c                  |  17 +-
>  arch/x86/cpu/intel_common/acpi.c              |  20 +-
>  arch/x86/cpu/quark/acpi.c                     |  19 +-
>  arch/x86/cpu/tangier/acpi.c                   |  31 +-
>  arch/x86/include/asm/acpi_table.h             |  26 +-
>  arch/x86/lib/acpi_table.c                     | 243 +-----------
>  board/raspberrypi/rpi/.gitignore              |   3 +
>  board/raspberrypi/rpi/Makefile                |   2 +
>  board/raspberrypi/rpi/acpitables.h            |  91 +++++
>  board/raspberrypi/rpi/dsdt.asl                | 290 ++++++++++++++
>  board/raspberrypi/rpi/emmc.asl                | 136 +++++++
>  board/raspberrypi/rpi/gpudevs.asl             | 372 ++++++++++++++++++
>  board/raspberrypi/rpi/pci.asl                 | 177 +++++++++
>  board/raspberrypi/rpi/pep.asl                 |  90 +++++
>  board/raspberrypi/rpi/rhpx.asl                | 195 +++++++++
>  board/raspberrypi/rpi/rpi.c                   | 182 +++++++++
>  board/raspberrypi/rpi/sdhc.asl                | 111 ++++++
>  board/raspberrypi/rpi/uart.asl                | 208 ++++++++++
>  boot/bootflow.c                               |   8 +-
>  configs/rpi_4_acpi_defconfig                  |  79 ++++
>  drivers/pci/pcie_brcmstb.c                    | 101 +----
>  drivers/serial/serial_pl01x.c                 |  24 ++
>  include/acpi/acpi_table.h                     | 107 +++--
>  include/serial.h                              |   1 +
>  lib/Kconfig                                   |  15 +
>  lib/acpi/acpi_table.c                         | 317 ++++++++++++++-
>  46 files changed, 3414 insertions(+), 472 deletions(-)
>  create mode 100644 arch/arm/cpu/armv8/parking_protocol_v8.S
>  create mode 100644 arch/arm/lib/acpi_table.c
>  create mode 100644 arch/arm/mach-bcm283x/bcm2711_acpi.c
>  create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2711.h
>  create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836.h
>  create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_gpio.h
>  create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_gpu.h
>  create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_pwm.h
>  create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_sdhost.h
>  create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_sdio.h
>  create mode 100644 arch/sandbox/lib/acpi_table.c
>  create mode 100644 board/raspberrypi/rpi/.gitignore
>  create mode 100644 board/raspberrypi/rpi/acpitables.h
>  create mode 100644 board/raspberrypi/rpi/dsdt.asl
>  create mode 100644 board/raspberrypi/rpi/emmc.asl
>  create mode 100644 board/raspberrypi/rpi/gpudevs.asl
>  create mode 100644 board/raspberrypi/rpi/pci.asl
>  create mode 100644 board/raspberrypi/rpi/pep.asl
>  create mode 100644 board/raspberrypi/rpi/rhpx.asl
>  create mode 100644 board/raspberrypi/rpi/sdhc.asl
>  create mode 100644 board/raspberrypi/rpi/uart.asl
>  create mode 100644 configs/rpi_4_acpi_defconfig
>
> --
> 2.45.2
>
Patrick Rudolph July 30, 2024, 6:08 a.m. UTC | #3
Hi Peter,

> Rather than just RPi4 support we should add generic qemu support, as
> opposed to emulated RPi4 in qemu support as qemu already supports ACPI
> on aarch64 for generic SystemReady support with pci/network etc that
> way the support is much easier to test in CI.
>
That sounds reasonable. I'll look into that as well.

> Also are the ACPI tables you use here compatible with the tianocore
> raspberry pi 4 support so users don't end up with weird differences
> between firmware?
>
The ACPI code is identical to the tianocore one. However the U-Boot
implementation
is a bare minimum to boot a Linux OS, thus yes there are differences
between those
firmwares. EDK2 has more quirks for various boards and reads in UEFI
variables to
enable/disable certain devices or features.