mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] device-dax: map dax memory as decrypted in CoCo guests
@ 2024-08-14 20:53 Kevin Loughlin
  2024-08-23 12:09 ` Gupta, Pankaj
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Loughlin @ 2024-08-14 20:53 UTC (permalink / raw)
  To: Dan Williams, Vishal Verma, Dave Jiang, nvdimm, linux-cxl, linux-kernel
  Cc: kevinloughlin, changyuanl, pgonda, sidtelang, tytso,
	pasha.tatashin, thomas.lendacky, pankaj.gupta

Confidential Computing (CoCo) guests encrypt private memory by default.
DAX memory regions allow a guest to bypass its own (private) page cache
and instead use host memory, which is not private to the guest.

Commit 867400af90f1 ("mm/memremap.c: map FS_DAX device memory as
decrypted") only ensures that FS_DAX memory is appropriately marked as
decrypted. As such, also mark device-dax memory as decrypted.

Signed-off-by: Kevin Loughlin <kevinloughlin@google.com>
---
 drivers/dax/device.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/dax/device.c b/drivers/dax/device.c
index 2051e4f73c8a..a284442d7ecc 100644
--- a/drivers/dax/device.c
+++ b/drivers/dax/device.c
@@ -11,6 +11,7 @@
 #include <linux/fs.h>
 #include <linux/mm.h>
 #include <linux/mman.h>
+#include <linux/cc_platform.h>
 #include "dax-private.h"
 #include "bus.h"
 
@@ -303,6 +304,8 @@ static int dax_mmap(struct file *filp, struct vm_area_struct *vma)
 
 	vma->vm_ops = &dax_vm_ops;
 	vm_flags_set(vma, VM_HUGEPAGE);
+	if (cc_platform_has(CC_ATTR_MEM_ENCRYPT))
+		vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot);
 	return 0;
 }
 
-- 
2.46.0.76.ge559c4bf1a-goog


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

end of thread, other threads:[~2024-09-10 13:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-14 20:53 [PATCH] device-dax: map dax memory as decrypted in CoCo guests Kevin Loughlin
2024-08-23 12:09 ` Gupta, Pankaj
2024-08-26 21:35   ` Kevin Loughlin
2024-09-10 13:00     ` Gupta, Pankaj
2024-09-10 13:07       ` Gupta, Pankaj

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®