[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20200311170839.3617-2-thomas_os@shipmail.org>
Date: Wed, 11 Mar 2020 18:08:39 +0100
From: Thomas Hellström (VMware)
<thomas_os@...pmail.org>
To: dri-devel@...ts.freedesktop.org
Cc: linux-kernel@...r.kernel.org, linux-graphics-maintainer@...are.com,
Thomas Hellstrom <thellstrom@...are.com>,
Brian Paul <brianp@...are.com>
Subject: [PATCH 2/2] drm/vmwgfx: Refuse DMA operation when SEV encryption is active
From: Thomas Hellstrom <thellstrom@...are.com>
TTM doesn't yet fully support mapping of DMA memory when SEV is active,
so in that case, refuse DMA operation. For guest-backed object operation
this means 3D acceleration will be disabled. For host-backed, VRAM will be
used for data transfer between the guest and the device.
Signed-off-by: Thomas Hellstrom <thellstrom@...are.com>
Reviewed-by: Brian Paul <brianp@...are.com>
---
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index f2ec3155468d..4f58364421ce 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -29,6 +29,7 @@
#include <linux/dma-mapping.h>
#include <linux/module.h>
#include <linux/pci.h>
+#include <linux/mem_encrypt.h>
#include <drm/drm_drv.h>
#include <drm/drm_ioctl.h>
@@ -575,6 +576,10 @@ static int vmw_dma_select_mode(struct vmw_private *dev_priv)
[vmw_dma_map_populate] = "Caching DMA mappings.",
[vmw_dma_map_bind] = "Giving up DMA mappings early."};
+ /* TTM currently doesn't fully support SEV encryption. */
+ if (mem_encrypt_active())
+ return -EINVAL;
+
if (vmw_force_coherent)
dev_priv->map_mode = vmw_dma_alloc_coherent;
else if (vmw_restrict_iommu)
--
2.21.1
Powered by blists - more mailing lists