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