mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Gupta, Pankaj" <pankaj.gupta@amd.com>
To: Kevin Loughlin <kevinloughlin@google.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Vishal Verma <vishal.l.verma@intel.com>,
	Dave Jiang <dave.jiang@intel.com>,
	nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: changyuanl@google.com, pgonda@google.com, sidtelang@google.com,
	tytso@mit.edu, pasha.tatashin@soleen.com,
	thomas.lendacky@amd.com
Subject: Re: [PATCH] device-dax: map dax memory as decrypted in CoCo guests
Date: Fri, 23 Aug 2024 14:09:10 +0200	[thread overview]
Message-ID: <0bae453d-b4a8-3132-9fd0-bca0eece6a74@amd.com> (raw)
In-Reply-To: <20240814205303.2619373-1-kevinloughlin@google.com>

> 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.

Overall patch seems OK to me.

How can I test this? Can I test it with virtio-pmem device?

Thanks,
Pankaj
> 
> Signed-off-by: Kevin Loughlin <kevinloughlin@google.co > ---
>   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;
>   }
>   


  reply	other threads:[~2024-08-23 12:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-14 20:53 Kevin Loughlin
2024-08-23 12:09 ` Gupta, Pankaj [this message]
2024-08-26 21:35   ` Kevin Loughlin
2024-09-10 13:00     ` Gupta, Pankaj
2024-09-10 13:07       ` Gupta, Pankaj

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0bae453d-b4a8-3132-9fd0-bca0eece6a74@amd.com \
    --to=pankaj.gupta@amd.com \
    --cc=changyuanl@google.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=kevinloughlin@google.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nvdimm@lists.linux.dev \
    --cc=pasha.tatashin@soleen.com \
    --cc=pgonda@google.com \
    --cc=sidtelang@google.com \
    --cc=thomas.lendacky@amd.com \
    --cc=tytso@mit.edu \
    --cc=vishal.l.verma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®