[07/13] KVM: PPC: Ultravisor: UV_RESTRICTED_SPR_READ ucall

Message ID 1548172784-27414-8-git-send-email-linuxram@us.ibm.com
State Changes Requested
Headers show
Series
  • KVM: PPC: Paravirtualize KVM to support Ultravisor
Related show

Commit Message

Ram Pai Jan. 22, 2019, 3:59 p.m.
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.

Signed-off-by: Ram Pai <linuxram@us.ibm.com>
---
 arch/powerpc/include/asm/ucall-api.h        | 11 +++++++++++
 arch/powerpc/include/uapi/asm/uapi_uvcall.h |  1 +
 2 files changed, 12 insertions(+)

Patch

diff --git a/arch/powerpc/include/asm/ucall-api.h b/arch/powerpc/include/asm/ucall-api.h
index 7723b4e..ffafd9e 100644
--- a/arch/powerpc/include/asm/ucall-api.h
+++ b/arch/powerpc/include/asm/ucall-api.h
@@ -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 */
diff --git a/arch/powerpc/include/uapi/asm/uapi_uvcall.h b/arch/powerpc/include/uapi/asm/uapi_uvcall.h
index d76dd1f..bbcd026 100644
--- a/arch/powerpc/include/uapi/asm/uapi_uvcall.h
+++ b/arch/powerpc/include/uapi/asm/uapi_uvcall.h
@@ -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 */