Commit 9044adca authored by Michael Ellerman's avatar Michael Ellerman
Browse files

Merge branch 'topic/ppc-kvm' into next

Merge our ppc-kvm topic branch to bring in the Ultravisor support
patches.
parents 07aa1e78 68e0aa8e
Loading
Loading
Loading
Loading
+42 −0
Original line number Diff line number Diff line
==========================
ELF Note PowerPC Namespace
==========================

The PowerPC namespace in an ELF Note of the kernel binary is used to store
capabilities and information which can be used by a bootloader or userland.

Types and Descriptors
---------------------

The types to be used with the "PowerPC" namesapce are defined in the
include/uapi/asm/elfnote.h

	1) PPC_ELFNOTE_CAPABILITIES

Define the capabilities supported/required by the kernel. This type uses a
bitmap as "descriptor" field. Each bit is described below:

- Ultravisor-capable bit (PowerNV only).

	#define PPCCAP_ULTRAVISOR_BIT (1 << 0)

	Indicate that the powerpc kernel binary knows how to run in an
	ultravisor-enabled system.

	In an ultravisor-enabled system, some machine resources are now controlled
	by the ultravisor. If the kernel is not ultravisor-capable, but it ends up
	being run on a machine with ultravisor, the kernel will probably crash
	trying to access ultravisor resources. For instance, it may crash in early
	boot trying to set the partition table entry 0.

	In an ultravisor-enabled system, a bootloader could warn the user or prevent
   	the kernel from being run if the PowerPC ultravisor capability doesn't exist
	or the Ultravisor-capable bit is not set.

References
----------

arch/powerpc/include/asm/elfnote.h
arch/powerpc/kernel/note.S

+1057 −0

File added.

Preview size limit exceeded, changes collapsed.

+11 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
#include <asm/epapr_hcalls.h>
#include <asm/dcr.h>
#include <asm/mmu_context.h>
#include <asm/ultravisor-api.h>

#include <uapi/asm/ucontext.h>

@@ -34,6 +35,16 @@ extern struct static_key hcall_tracepoint_key;
void __trace_hcall_entry(unsigned long opcode, unsigned long *args);
void __trace_hcall_exit(long opcode, long retval, unsigned long *retbuf);

/* Ultravisor */
#ifdef CONFIG_PPC_POWERNV
long ucall_norets(unsigned long opcode, ...);
#else
static inline long ucall_norets(unsigned long opcode, ...)
{
	return U_NOT_AVAILABLE;
}
#endif

/* OPAL */
int64_t __opal_call(int64_t a0, int64_t a1, int64_t a2, int64_t a3,
		    int64_t a4, int64_t a5, int64_t a6, int64_t a7,
+24 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * PowerPC ELF notes.
 *
 * Copyright 2019, IBM Corporation
 */

#ifndef __ASM_POWERPC_ELFNOTE_H__
#define __ASM_POWERPC_ELFNOTE_H__

/*
 * These note types should live in a SHT_NOTE segment and have
 * "PowerPC" in the name field.
 */

/*
 * The capabilities supported/required by this kernel (bitmap).
 *
 * This type uses a bitmap as "desc" field. Each bit is described
 * in arch/powerpc/kernel/note.S
 */
#define PPC_ELFNOTE_CAPABILITIES 1

#endif /* __ASM_POWERPC_ELFNOTE_H__ */
+3 −2
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@
#define FW_FEATURE_DRC_INFO	ASM_CONST(0x0000000800000000)
#define FW_FEATURE_BLOCK_REMOVE ASM_CONST(0x0000001000000000)
#define FW_FEATURE_PAPR_SCM 	ASM_CONST(0x0000002000000000)
#define FW_FEATURE_ULTRAVISOR	ASM_CONST(0x0000004000000000)

#ifndef __ASSEMBLY__

@@ -68,9 +69,9 @@ enum {
		FW_FEATURE_TYPE1_AFFINITY | FW_FEATURE_PRRN |
		FW_FEATURE_HPT_RESIZE | FW_FEATURE_DRMEM_V2 |
		FW_FEATURE_DRC_INFO | FW_FEATURE_BLOCK_REMOVE |
		FW_FEATURE_PAPR_SCM,
		FW_FEATURE_PAPR_SCM | FW_FEATURE_ULTRAVISOR,
	FW_FEATURE_PSERIES_ALWAYS = 0,
	FW_FEATURE_POWERNV_POSSIBLE = FW_FEATURE_OPAL,
	FW_FEATURE_POWERNV_POSSIBLE = FW_FEATURE_OPAL | FW_FEATURE_ULTRAVISOR,
	FW_FEATURE_POWERNV_ALWAYS = 0,
	FW_FEATURE_PS3_POSSIBLE = FW_FEATURE_LPAR | FW_FEATURE_PS3_LV1,
	FW_FEATURE_PS3_ALWAYS = FW_FEATURE_LPAR | FW_FEATURE_PS3_LV1,
Loading