lkml.org 
[lkml]   [2020]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 2/9] KVM: X86: Introduce KVM_HC_PAGE_ENC_STATUS hypercall
From
Date
On 02/12/20 22:22, Ashish Kalra wrote:
> Hello Dave,
>
> On Wed, Dec 02, 2020 at 04:54:20PM +0000, Dr. David Alan Gilbert wrote:
>> * Ashish Kalra (Ashish.Kalra@amd.com) wrote:
>>> From: Brijesh Singh <brijesh.singh@amd.com>
>>>
>>> This hypercall is used by the SEV guest to notify a change in the page
>>> encryption status to the hypervisor. The hypercall should be invoked
>>> only when the encryption attribute is changed from encrypted -> decrypted
>>> and vice versa. By default all guest pages are considered encrypted.
>>
>> Is it defined whether these are supposed to be called before or after
>> the the page type has been changed; is it change the type and then
>> notify or the other way around?

It doesn't matter. However, you have do it before writing to the page,
and the content of the page is unspecified between the hypercall and the
write to the page.

So you cannot for example encrypt a page in place (using the same PFN
but different settings of the C bit), you need to do:

hypercall(); /* mark enc_data as encrypted */
/*
* The contents of enc_data is now undefined as it can change
* across migration.
*/
memset(enc_data, unenc_data, PAGE_SIZE);

Paolo

\
 
 \ /
  Last update: 2020-12-06 11:28    [W:0.060 / U:0.728 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site