Re: [PATCHv3 08/17] x86/mm: Implement vma_is_encrypted() and vma_keyid()

2018-06-15 Thread Kirill A. Shutemov
On Wed, Jun 13, 2018 at 06:18:05PM +, Dave Hansen wrote: > On 06/12/2018 07:39 AM, Kirill A. Shutemov wrote: > > +bool vma_is_encrypted(struct vm_area_struct *vma) > > +{ > > + return pgprot_val(vma->vm_page_prot) & mktme_keyid_mask; > > +} > > + > > +int vma_keyid(struct vm_area_struct

Re: [PATCHv3 08/17] x86/mm: Implement vma_is_encrypted() and vma_keyid()

2018-06-15 Thread Kirill A. Shutemov
On Wed, Jun 13, 2018 at 06:18:05PM +, Dave Hansen wrote: > On 06/12/2018 07:39 AM, Kirill A. Shutemov wrote: > > +bool vma_is_encrypted(struct vm_area_struct *vma) > > +{ > > + return pgprot_val(vma->vm_page_prot) & mktme_keyid_mask; > > +} > > + > > +int vma_keyid(struct vm_area_struct

Re: [PATCHv3 08/17] x86/mm: Implement vma_is_encrypted() and vma_keyid()

2018-06-13 Thread Dave Hansen
On 06/12/2018 07:39 AM, Kirill A. Shutemov wrote: > +bool vma_is_encrypted(struct vm_area_struct *vma) > +{ > + return pgprot_val(vma->vm_page_prot) & mktme_keyid_mask; > +} > + > +int vma_keyid(struct vm_area_struct *vma) > +{ > + pgprotval_t prot; > + > + if (!vma_is_anonymous(vma))

Re: [PATCHv3 08/17] x86/mm: Implement vma_is_encrypted() and vma_keyid()

2018-06-13 Thread Dave Hansen
On 06/12/2018 07:39 AM, Kirill A. Shutemov wrote: > +bool vma_is_encrypted(struct vm_area_struct *vma) > +{ > + return pgprot_val(vma->vm_page_prot) & mktme_keyid_mask; > +} > + > +int vma_keyid(struct vm_area_struct *vma) > +{ > + pgprotval_t prot; > + > + if (!vma_is_anonymous(vma))

[PATCHv3 08/17] x86/mm: Implement vma_is_encrypted() and vma_keyid()

2018-06-12 Thread Kirill A. Shutemov
We store KeyID in upper bits for vm_page_prot that match position of KeyID in PTE. vma_keyid() extracts KeyID from vm_page_prot. VMA is encrypted if KeyID is non-zero. vma_is_encrypted() checks that. Signed-off-by: Kirill A. Shutemov --- arch/x86/include/asm/mktme.h | 9 +

[PATCHv3 08/17] x86/mm: Implement vma_is_encrypted() and vma_keyid()

2018-06-12 Thread Kirill A. Shutemov
We store KeyID in upper bits for vm_page_prot that match position of KeyID in PTE. vma_keyid() extracts KeyID from vm_page_prot. VMA is encrypted if KeyID is non-zero. vma_is_encrypted() checks that. Signed-off-by: Kirill A. Shutemov --- arch/x86/include/asm/mktme.h | 9 +