[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210406163716.zdf4vgcltj6a3tqt@box.shutemov.name>
Date: Tue, 6 Apr 2021 19:37:16 +0300
From: "Kirill A. Shutemov" <kirill@...temov.name>
To: Dave Hansen <dave.hansen@...el.com>
Cc: Kuppuswamy Sathyanarayanan
<sathyanarayanan.kuppuswamy@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
Andy Lutomirski <luto@...nel.org>,
Andi Kleen <ak@...ux.intel.com>,
Kirill Shutemov <kirill.shutemov@...ux.intel.com>,
Kuppuswamy Sathyanarayanan <knsathya@...nel.org>,
Dan Williams <dan.j.williams@...el.com>,
Raj Ashok <ashok.raj@...el.com>,
Sean Christopherson <seanjc@...gle.com>,
linux-kernel@...r.kernel.org
Subject: Re: [RFC v1 21/26] x86/mm: Move force_dma_unencrypted() to common
code
On Tue, Apr 06, 2021 at 09:11:25AM -0700, Dave Hansen wrote:
> On 4/6/21 8:37 AM, Kirill A. Shutemov wrote:
> > On Thu, Apr 01, 2021 at 01:06:29PM -0700, Dave Hansen wrote:
> >> On 2/5/21 3:38 PM, Kuppuswamy Sathyanarayanan wrote:
> >>> From: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
> >>>
> >>> Intel TDX doesn't allow VMM to access guest memory. Any memory that is
> >>> required for communication with VMM suppose to be shared explicitly by
> >>
> >> s/suppose to/must/
> >
> > Right.
> >
> >>> setting the bit in page table entry. The shared memory is similar to
> >>> unencrypted memory in AMD SME/SEV terminology.
> >>
> >> In addition to setting the page table bit, there's also a dance to go
> >> through to convert the memory. Please mention the procedure here at
> >> least. It's very different from SME.
> >
> > "
> > After setting the shared bit, the conversion must be completed with
> > MapGPA TDVMALL. The call informs VMM about the conversion and makes it
> > remove the GPA from the S-EPT mapping.
> > "
>
> Where does the TDX module fit in here?
VMM must go through TLB Tracking Sequence which involves bunch of
SEAMCALLs. See 3.3.1.2 "Dynamic Page Removal (Private to Shared
Conversion)" of TDX Module spec.
>
> >>> force_dma_unencrypted() has to return true for TDX guest. Move it out of
> >>> AMD SME code.
> >>
> >> You lost me here. What does force_dma_unencrypted() have to do with
> >> host/guest shared memory?
> >
> > "
> > AMD SEV makes force_dma_unencrypted() return true which triggers
> > set_memory_decrypted() calls on all DMA allocations. TDX will use the
> > same code path to make DMA allocations shared.
> > "
>
> SEV assumes that I/O devices can only do DMA to "decrypted" physical
> addresses without the C-bit set. In order for the CPU to interact with
> this memory, the CPU needs a decrypted mapping.
>
> TDX is similar. TDX architecturally prevents access to private guest
> memory by anything other than the guest itself. This means that any DMA
> buffers must be shared.
>
> Right?
Yes.
--
Kirill A. Shutemov
Powered by blists - more mailing lists