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