dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/9] drm/vmwgfx: Don't use the HB port if memory encryption is active
@ 2020-01-15 11:53 Thomas Hellström (VMware)
  2020-01-15 11:53 ` [PATCH 2/9] drm/vmwgfx: Call vmw_driver_{load, unload}() before registering device Thomas Hellström (VMware)
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Thomas Hellström (VMware) @ 2020-01-15 11:53 UTC (permalink / raw)
  To: dri-devel; +Cc: Roland Scheidegger, Thomas Hellstrom, linux-graphics-maintainer

From: Thomas Hellstrom <thellstrom@vmware.com>

With memory encryption active, the hypervisor typically can't read the
guest memory using the HB port, since it is encrypted using a key known
only to the guest. In that case fall back to processing 4 bytes at a time
using the ordinary backdoor port.
The other option would be to use unencrypted bounce buffers for the
hypervisor to read out from or write into, but given the limited message
sizes it appears more efficient to just fall back to the ordinary backdoor
port.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
index b6c5e4c2ac3c..d63441194249 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
@@ -28,6 +28,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/slab.h>
+#include <linux/mem_encrypt.h>
 
 #include <asm/hypervisor.h>
 
@@ -148,7 +149,8 @@ static unsigned long vmw_port_hb_out(struct rpc_channel *channel,
 	unsigned long si, di, eax, ebx, ecx, edx;
 	unsigned long msg_len = strlen(msg);
 
-	if (hb) {
+	/* HB port can't access encrypted memory. */
+	if (hb && !mem_encrypt_active()) {
 		unsigned long bp = channel->cookie_high;
 
 		si = (uintptr_t) msg;
@@ -202,7 +204,8 @@ static unsigned long vmw_port_hb_in(struct rpc_channel *channel, char *reply,
 {
 	unsigned long si, di, eax, ebx, ecx, edx;
 
-	if (hb) {
+	/* HB port can't access encrypted memory */
+	if (hb && !mem_encrypt_active()) {
 		unsigned long bp = channel->cookie_low;
 
 		si = channel->cookie_high;
-- 
2.21.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-01-15 11:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-15 11:53 [PATCH 1/9] drm/vmwgfx: Don't use the HB port if memory encryption is active Thomas Hellström (VMware)
2020-01-15 11:53 ` [PATCH 2/9] drm/vmwgfx: Call vmw_driver_{load, unload}() before registering device Thomas Hellström (VMware)
2020-01-15 11:53 ` [PATCH 3/9] drm/vmwgfx: Replace deprecated PTR_RET Thomas Hellström (VMware)
2020-01-15 11:53 ` [PATCH 4/9] drm/vmwgfx: move the require_exist handling together Thomas Hellström (VMware)
2020-01-15 11:53 ` [PATCH 5/9] drm/vmwgfx: check master authentication in surface_ref ioctls Thomas Hellström (VMware)
2020-01-15 11:53 ` [PATCH 6/9] drm/vmwgfx: drop DRM_AUTH for render ioctls Thomas Hellström (VMware)
2020-01-15 11:53 ` [PATCH 7/9] drm/vmwgfx: prevent memory leak in vmw_cmdbuf_res_add Thomas Hellström (VMware)
2020-01-15 11:53 ` [PATCH 8/9] drm/vmwgfx: add ioctl for messaging from/to guest userspace to/from host Thomas Hellström (VMware)
2020-01-15 11:53 ` [PATCH 9/9] drm/vmwgfx: Bump driver minor version Thomas Hellström (VMware)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).