note.S 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * PowerPC ELF notes.
  4. *
  5. * Copyright 2019, IBM Corporation
  6. */
  7. #include <linux/elfnote.h>
  8. #include <asm/elfnote.h>
  9. /*
  10. * Ultravisor-capable bit (PowerNV only).
  11. *
  12. * Bit 0 indicates that the powerpc kernel binary knows how to run in an
  13. * ultravisor-enabled system.
  14. *
  15. * In an ultravisor-enabled system, some machine resources are now controlled
  16. * by the ultravisor. If the kernel is not ultravisor-capable, but it ends up
  17. * being run on a machine with ultravisor, the kernel will probably crash
  18. * trying to access ultravisor resources. For instance, it may crash in early
  19. * boot trying to set the partition table entry 0.
  20. *
  21. * In an ultravisor-enabled system, a bootloader could warn the user or prevent
  22. * the kernel from being run if the PowerPC ultravisor capability doesn't exist
  23. * or the Ultravisor-capable bit is not set.
  24. */
  25. #ifdef CONFIG_PPC_POWERNV
  26. #define PPCCAP_ULTRAVISOR_BIT (1 << 0)
  27. #else
  28. #define PPCCAP_ULTRAVISOR_BIT 0
  29. #endif
  30. /*
  31. * Add the PowerPC Capabilities in the binary ELF note. It is a bitmap that
  32. * can be used to advertise kernel capabilities to userland.
  33. */
  34. #define PPC_CAPABILITIES_BITMAP (PPCCAP_ULTRAVISOR_BIT)
  35. ELFNOTE(PowerPC, PPC_ELFNOTE_CAPABILITIES,
  36. .long PPC_CAPABILITIES_BITMAP)