lkml.org 
[lkml]   [2022]   [May]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v5 3/3] x86/tdx: Add Quote generation support
From
Date
On Thu, 2022-05-05 at 13:53 -0700, Sathyanarayanan Kuppuswamy wrote:
> Hi Kai,
>
> On 5/4/22 4:28 PM, Kai Huang wrote:
> > On Wed, 2022-05-04 at 15:49 -0700, Sathyanarayanan Kuppuswamy wrote:
> > > --- a/arch/x86/coco/tdx/tdx.c
> > > +++ b/arch/x86/coco/tdx/tdx.c
> > > @@ -15,6 +15,7 @@
> > >   #include <asm/idtentry.h>
> > >   #include <asm/irq_regs.h>
> > >   #include <asm/desc.h>
> > > +#include <asm/io.h>
> > >
> > >   /* TDX module Call Leaf IDs */
> > >   #define TDX_GET_INFO                   1
> > > @@ -680,8 +681,15 @@ static bool try_accept_one(phys_addr_t *start,
> > > unsigned long len,
> > >    */
> > >   static bool tdx_enc_status_changed(unsigned long vaddr, int numpages,
> > > bool enc)
> > >   {
> > > -       phys_addr_t start = __pa(vaddr);
> > > -       phys_addr_t end   = __pa(vaddr + numpages * PAGE_SIZE);
> > > +       phys_addr_t start;
> > > +       phys_addr_t end;
> > > +
> > > +       if (is_vmalloc_addr((void *)vaddr))
> > > +               start =  page_to_phys(vmalloc_to_page((void*)vaddr));
> > > +       else
> > > +               start = __pa(vaddr);
> > > +
> > > +       end = start + numpages * PAGE_SIZE;
> > >
> > >          if (!enc) {
> > >                  /* Set the shared (decrypted) bits: */
> >
> > Looks set_memory_decrypted() only works for direct-mapping, so you should not
> > use this. Instead, you can pass shared bit in 'prot' argument (using
> > pgprot_decrypted()) when you call vmap(), and explicitly call MapGPA().
>
> Is it because of the above change, or you see other direct-mapping
> dependencies in set_memory_*() functions?
>
>
>
set_memory_xx() is supposedly only for direct-mapping. Please use my
suggestion above.

--
Thanks,
-Kai


\
 
 \ /
  Last update: 2022-05-06 00:17    [W:0.148 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site