170ed86f4SClaudio Carvalho/* SPDX-License-Identifier: GPL-2.0 */ 270ed86f4SClaudio Carvalho/* 370ed86f4SClaudio Carvalho * PowerPC ELF notes. 470ed86f4SClaudio Carvalho * 570ed86f4SClaudio Carvalho * Copyright 2019, IBM Corporation 670ed86f4SClaudio Carvalho */ 770ed86f4SClaudio Carvalho 870ed86f4SClaudio Carvalho#include <linux/elfnote.h> 970ed86f4SClaudio Carvalho#include <asm/elfnote.h> 1070ed86f4SClaudio Carvalho 1170ed86f4SClaudio Carvalho/* 1270ed86f4SClaudio Carvalho * Ultravisor-capable bit (PowerNV only). 1370ed86f4SClaudio Carvalho * 1470ed86f4SClaudio Carvalho * Bit 0 indicates that the powerpc kernel binary knows how to run in an 1570ed86f4SClaudio Carvalho * ultravisor-enabled system. 1670ed86f4SClaudio Carvalho * 1770ed86f4SClaudio Carvalho * In an ultravisor-enabled system, some machine resources are now controlled 1870ed86f4SClaudio Carvalho * by the ultravisor. If the kernel is not ultravisor-capable, but it ends up 1970ed86f4SClaudio Carvalho * being run on a machine with ultravisor, the kernel will probably crash 2070ed86f4SClaudio Carvalho * trying to access ultravisor resources. For instance, it may crash in early 2170ed86f4SClaudio Carvalho * boot trying to set the partition table entry 0. 2270ed86f4SClaudio Carvalho * 2370ed86f4SClaudio Carvalho * In an ultravisor-enabled system, a bootloader could warn the user or prevent 2470ed86f4SClaudio Carvalho * the kernel from being run if the PowerPC ultravisor capability doesn't exist 2570ed86f4SClaudio Carvalho * or the Ultravisor-capable bit is not set. 2670ed86f4SClaudio Carvalho */ 2770ed86f4SClaudio Carvalho#ifdef CONFIG_PPC_POWERNV 2870ed86f4SClaudio Carvalho#define PPCCAP_ULTRAVISOR_BIT (1 << 0) 2970ed86f4SClaudio Carvalho#else 3070ed86f4SClaudio Carvalho#define PPCCAP_ULTRAVISOR_BIT 0 3170ed86f4SClaudio Carvalho#endif 3270ed86f4SClaudio Carvalho 3370ed86f4SClaudio Carvalho/* 3470ed86f4SClaudio Carvalho * Add the PowerPC Capabilities in the binary ELF note. It is a bitmap that 3570ed86f4SClaudio Carvalho * can be used to advertise kernel capabilities to userland. 3670ed86f4SClaudio Carvalho */ 3770ed86f4SClaudio Carvalho#define PPC_CAPABILITIES_BITMAP (PPCCAP_ULTRAVISOR_BIT) 3870ed86f4SClaudio Carvalho 3970ed86f4SClaudio CarvalhoELFNOTE(PowerPC, PPC_ELFNOTE_CAPABILITIES, 4070ed86f4SClaudio Carvalho .long PPC_CAPABILITIES_BITMAP) 41