Skip to contentSkip to conversation

drm/vmwgfx: Don't use screen objects when SEV is active

PATCH In review Zack Rusin 3 participants 3 messages Dec 1, 2022

Subsystems (3)
lore
Share & tools
lore

Zack Rusin

author
#0 lore raw

PATCH 1/1 drm/vmwgfx: Don't use screen objects when SEV is active

From: Zack Rusin <[email protected]>

When SEV is enabled gmr's and mob's are explicitly disabled because the encrypted system memory can not be used by the hypervisor.

The driver was disabling GMR's but the presentation code, which depends on GMR's, wasn't honoring it which lead to black screen on hosts with SEV enabled.

Make sure screen objects presentation is not used when guest memory regions have been disabled to fix presentation on SEV enabled hosts.

Fixes 3b0d6458c705 ("drm/vmwgfx: Refuse DMA operation when SEV encryption is active")
Cc <[email protected]> # v5.7+
---
 drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c +4 -0
index 8db61c541a80..e1f36a09c59c 100644
@@ -926,6 +926,10 @@ int vmw_kms_sou_init_display(struct vmw_private *dev_priv)
 	struct drm_device *dev = &dev_priv->drm;
 	int i;
 
+	/* Screen objects won't work if GMR's aren't available */
+	if (!dev_priv->has_gmr)
+		return -ENOSYS;
+
 	if (!(dev_priv->capabilities & SVGA_CAP_SCREEN_OBJECT_2)) {
 		return -ENOSYS;
 	}
Signature · 1 line
2.37.2
Reviewed-by Martin Krastev on v1 1/1
#1 lore raw

From: Martin Krastev <[email protected]>

LGTM!

Regards,

Martin

Quoted 35 lines · Zack Rusin

From: Zack Rusin <[email protected]>

When SEV is enabled gmr's and mob's are explicitly disabled because the encrypted system memory can not be used by the hypervisor.

The driver was disabling GMR's but the presentation code, which depends on GMR's, wasn't honoring it which lead to black screen on hosts with SEV enabled.

Make sure screen objects presentation is not used when guest memory regions have been disabled to fix presentation on SEV enabled hosts.

Fixes 3b0d6458c705 ("drm/vmwgfx: Refuse DMA operation when SEV encryption is active")
Cc <[email protected]> # v5.7+
---
  drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c +4 -0
index 8db61c541a80..e1f36a09c59c 100644
@@ -926,6 +926,10 @@ int vmw_kms_sou_init_display(struct vmw_private *dev_priv)
  	struct drm_device *dev = &dev_priv->drm;
  	int i;
 
+	/* Screen objects won't work if GMR's aren't available */
+	if (!dev_priv->has_gmr)
+		return -ENOSYS;
+
  	if (!(dev_priv->capabilities & SVGA_CAP_SCREEN_OBJECT_2)) {
  		return -ENOSYS;
  	}
#2 lore raw
In reply to Zack Rusin
Quoted 25 lines · Zack Rusin

From: Zack Rusin <[email protected]>

When SEV is enabled gmr's and mob's are explicitly disabled because the encrypted system memory can not be used by the hypervisor.

The driver was disabling GMR's but the presentation code, which depends on GMR's, wasn't honoring it which lead to black screen on hosts with SEV enabled.

Make sure screen objects presentation is not used when guest memory regions have been disabled to fix presentation on SEV enabled hosts.

Fixes 3b0d6458c705 ("drm/vmwgfx: Refuse DMA operation when SEV encryption is active")
Cc <[email protected]> # v5.7+
---
 drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c +0 -0
index 8db61c541a80..e1f36a09c59c 100644

drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c int vmw_kms_sou_init_display(struct vmw_private *dev_priv) · line 935

Quoted 10 lines
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c +4 -0
@@ -926,6 +926,10 @@ int vmw_kms_sou_init_display(struct vmw_private *dev_priv)
 	struct drm_device *dev = &dev_priv->drm;
 	int i;
 
+	/* Screen objects won't work if GMR's aren't available */
+	if (!dev_priv->has_gmr)
+		return -ENOSYS;
+
 	if (!(dev_priv->capabilities & SVGA_CAP_SCREEN_OBJECT_2)) {
 		return -ENOSYS;
 	}

LGTM

Signature · 1 line
Maaz Mombasawala (VMware) <[email protected]>