mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 00:34:52 +00:00

In ultravisor enabled systems, PTCR becomes ultravisor privileged only for writing and an attempt to write to it will cause a Hypervisor Emulation Assitance interrupt. This patch uses the set_ptcr_when_no_uv() function to restrict PTCR writing to only when ultravisor is disabled. Signed-off-by: Claudio Carvalho <cclaudio@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20190822034838.27876-6-cclaudio@linux.ibm.com
34 lines
852 B
C
34 lines
852 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Ultravisor definitions
|
|
*
|
|
* Copyright 2019, IBM Corporation.
|
|
*
|
|
*/
|
|
#ifndef _ASM_POWERPC_ULTRAVISOR_H
|
|
#define _ASM_POWERPC_ULTRAVISOR_H
|
|
|
|
#include <asm/asm-prototypes.h>
|
|
#include <asm/ultravisor-api.h>
|
|
#include <asm/firmware.h>
|
|
|
|
int early_init_dt_scan_ultravisor(unsigned long node, const char *uname,
|
|
int depth, void *data);
|
|
|
|
/*
|
|
* In ultravisor enabled systems, PTCR becomes ultravisor privileged only for
|
|
* writing and an attempt to write to it will cause a Hypervisor Emulation
|
|
* Assistance interrupt.
|
|
*/
|
|
static inline void set_ptcr_when_no_uv(u64 val)
|
|
{
|
|
if (!firmware_has_feature(FW_FEATURE_ULTRAVISOR))
|
|
mtspr(SPRN_PTCR, val);
|
|
}
|
|
|
|
static inline int uv_register_pate(u64 lpid, u64 dw0, u64 dw1)
|
|
{
|
|
return ucall_norets(UV_WRITE_PATE, lpid, dw0, dw1);
|
|
}
|
|
|
|
#endif /* _ASM_POWERPC_ULTRAVISOR_H */
|