On Tue, Sep 3, 2019 at 2:05 PM Thomas HellstrÃm (VMware)
<thomas_os@xxxxxxxxxxxx> wrote:
On 9/3/19 10:51 PM, Dave Hansen wrote:I'm still lost. You have some fancy VMA where the backing pages
On 9/3/19 1:36 PM, Thomas HellstrÃm (VMware) wrote:With SEV I think that we could possibly establish the encryption flags
So the question here should really be, can we determine already at mmapI'm not connecting the dots.
time whether backing memory will be unencrypted and adjust the *real*
vma->vm_page_prot under the mmap_sem?
Possibly, but that requires populating the buffer with memory at mmap
time rather than at first fault time.
vma->vm_page_prot is used to create a VMA's PTEs regardless of if they
are created at mmap() or fault time. If we establish a good
vma->vm_page_prot, can't we just use it forever for demand faults?
at vma creation time. But thinking of it, it would actually break with
SME where buffer content can be moved between encrypted system memory
and unencrypted graphics card PCI memory behind user-space's back. That
would imply killing all user-space encrypted PTEs and at fault time set
up new ones pointing to unencrypted PCI memory..
Or, are you concerned that if an attempt is made to demand-fault pageSEV AFAIK encrypts *all* memory except DMA memory. To do that it uses a
that's incompatible with vma->vm_page_prot that we have to SEGV?
And it still requires knowledge whether the device DMA is alwaysI may be getting mixed up on MKTME (the Intel memory encryption) and
unencrypted (or if SEV is active).
SEV. Is SEV supported on all memory types? Page cache, hugetlbfs,
anonymous? Or just anonymous?
SWIOTLB backed by unencrypted memory, and it also flips coherent DMA
memory to unencrypted (which is a very slow operation and patch 4 deals
with caching such memory).
change behind the application's back. This isn't particularly novel
-- plain old anonymous memory and plain old mapped files do this too.
Can't you all the insert_pfn APIs and call it a day? What's so
special that you need all this magic? ISTM you should be able to
allocate memory that's addressable by the device (dma_alloc_coherent()
or whatever) and then map it into user memory just like you'd map any
other page.
I feel like I'm missing something here.