Skip to contentSkip to conversation

KVM: PPC: Ultravisor: UV_RESTRICTED_SPR_READ ucall

PATCH In review Ram Pai 1 participant 1 message Jan 22, 2019 PowerPC

lore
Share & tools
lore

Ram Pai

author
#0 lore raw

PATCH 7/13 KVM: PPC: Ultravisor: UV_RESTRICTED_SPR_READ ucall

Introduce UV_RESTRICTED_SPR_READ. Hypervisor loses previlege to access some registers when Ultravisor is enabled. Hypervisor can request read access to those registers using UV_RESTRICTED_SPR_READ ucall.

---
 arch/powerpc/include/asm/ucall-api.h        | 11 +++++++++++
 arch/powerpc/include/uapi/asm/uapi_uvcall.h |  1 +
 2 files changed, 12 insertions(+)
arch/powerpc/include/asm/ucall-api.h +11 -0
index 7723b4e..ffafd9e 100644
@@ -37,5 +37,16 @@ static inline int uv_restricted_spr_write(u64 reg, u64 val)
 
 	return plpar_ucall(UV_RESTRICTED_SPR_WRITE, retbuf, reg, val);
 }
+static inline int uv_restricted_spr_read(u64 reg, u64 *val)
+{
+	long rc;
+	unsigned long retbuf[PLPAR_UCALL_BUFSIZE];
+
+	rc = plpar_ucall(UV_RESTRICTED_SPR_READ, retbuf, reg);
+
+	*val = retbuf[0];
+	return rc;
+}
+
 #endif /* __ASSEMBLY__ */
 #endif	/* _ASM_POWERPC_UCALL_API_H */
arch/powerpc/include/uapi/asm/uapi_uvcall.h +1 -0
index d76dd1f..bbcd026 100644
@@ -10,4 +10,5 @@
 
 #define UV_WRITE_PATE 	0xf104
 #define UV_RESTRICTED_SPR_WRITE 0xf108
+#define UV_RESTRICTED_SPR_READ 0xf10C
 #endif /* #ifndef UAPI_UC_H */
Signature · 1 line
1.8.3.1