Re: [Qemu-devel] [PATCH v3 03/14] migration.json: add AMD SEV specific migration parameters

2019-08-09 Thread Singh, Brijesh
On 8/8/19 5:48 AM, Dr. David Alan Gilbert wrote: > * Singh, Brijesh (brijesh.si...@amd.com) wrote: >> On 8/7/19 6:06 AM, Dr. David Alan Gilbert wrote: >>> * Singh, Brijesh (brijesh.si...@amd.com) wrote: >>>> AMD SEV migration flow requires that target machine's publi

Re: [Qemu-devel] [PATCH v3 05/14] hw/machine: add helper to query the memory encryption state

2019-08-07 Thread Singh, Brijesh
On 8/7/19 11:14 AM, Dr. David Alan Gilbert wrote: > * Singh, Brijesh (brijesh.si...@amd.com) wrote: >> To enable a memory encryption inside a VM, user must pass the object >> name used for the encryption in command line parameter as shown below. >> >> # $(QEMU) \ >

Re: [Qemu-devel] [PATCH v3 03/14] migration.json: add AMD SEV specific migration parameters

2019-08-07 Thread Singh, Brijesh
On 8/7/19 6:06 AM, Dr. David Alan Gilbert wrote: > * Singh, Brijesh (brijesh.si...@amd.com) wrote: >> AMD SEV migration flow requires that target machine's public Diffie-Hellman >> key (PDH) and certificate chain must be passed before initiating the guest >> migration. User

[Qemu-devel] [PATCH v3 12/14] kvm: add support to sync the page encryption state bitmap

2019-08-06 Thread Singh, Brijesh
The SEV VMs have concept of private and shared memory. The private memory is encrypted with guest-specific key, while shared memory may be encrypted with hyperivosr key. The KVM_GET_PAGE_ENC_BITMAP can be used to get a bitmap indicating whether the guest page is private or shared. A private page

[Qemu-devel] [PATCH v3 14/14] target/i386: sev: remove migration blocker

2019-08-06 Thread Singh, Brijesh
Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Brijesh Singh --- target/i386/sev.c | 12 1 file changed, 12 deletions(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index 9d643e720c..72b841a458 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -34,7 +34,6 @@

[Qemu-devel] [PATCH v3 13/14] migration/ram: add support to send encrypted pages

2019-08-06 Thread Singh, Brijesh
When memory encryption is enabled, the guest memory will be encrypted with the guest specific key. The patch introduces RAM_SAVE_FLAG_ENCRYPTED_PAGE flag to distinguish the encrypted data from plaintext. Encrypted pages may need special handling. The kvm_memcrypt_save_outgoing_page() is used by

[Qemu-devel] [PATCH v3 06/14] hw/machine: introduce MachineMemoryEncryptionOps for encrypted VMs

2019-08-06 Thread Singh, Brijesh
When memory encryption is enabled in VM, the guest RAM will be encrypted with the guest-specific key, to protect the confidentiality of data while in transit we need to platform specific hooks to save or migrate the guest RAM. The MemoryEncryptionOps introduced in this patch will be later used by

[Qemu-devel] [PATCH v3 09/14] target/i386: sev: add support to encrypt the outgoing page

2019-08-06 Thread Singh, Brijesh
The sev_save_outgoing_page() provide the implementation to encrypt the guest private pages during the transit. The routines uses the SEND_START command to create the outgoing encryption context on the first call then uses the SEND_UPDATE_DATA command to encrypt the data before writing it to the

[Qemu-devel] [PATCH v3 03/14] migration.json: add AMD SEV specific migration parameters

2019-08-06 Thread Singh, Brijesh
AMD SEV migration flow requires that target machine's public Diffie-Hellman key (PDH) and certificate chain must be passed before initiating the guest migration. User can use QMP 'migrate-set-parameters' to pass the certificate chain. The certificate chain will be used while creating the outgoing

[Qemu-devel] [PATCH v3 11/14] migration: add support to migrate page encryption bitmap

2019-08-06 Thread Singh, Brijesh
When memory encryption is enabled, the hypervisor maintains a page encryption bitmap which is referred by hypervisor during migratoin to check if page is private or shared. The bitmap is built during the VM bootup and must be migrated to the target host so that hypervisor on target host can use it

[Qemu-devel] [PATCH v3 10/14] target/i386: sev: add support to load incoming encrypted page

2019-08-06 Thread Singh, Brijesh
The sev_load_incoming_page() provide the implementation to read the incoming guest private pages from the socket and load it into the guest memory. The routines uses the RECEIVE_START command to create the incoming encryption context on the first call then uses the RECEIEVE_UPDATE_DATA command to

[Qemu-devel] [PATCH v3 08/14] target/i386: sev: do not create launch context for an incoming guest

2019-08-06 Thread Singh, Brijesh
The LAUNCH_START is used for creating an encryption context to encrypt newly created guest, for an incoming guest the RECEIVE_START should be used. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Brijesh Singh --- target/i386/sev.c | 14 ++ 1 file changed, 10 insertions(+), 4

[Qemu-devel] [PATCH v3 07/14] target/i386: sev: provide callback to setup outgoing context

2019-08-06 Thread Singh, Brijesh
The user provides the target machine's Platform Diffie-Hellman key (PDH) and certificate chain before starting the SEV guest migration. Cache the certificate chain as we need them while creating the outgoing context. Signed-off-by: Brijesh Singh --- accel/kvm/kvm-all.c| 12 +++

[Qemu-devel] [PATCH v3 04/14] linux-headers: update kernel header to include SEV migration commands

2019-08-06 Thread Singh, Brijesh
Signed-off-by: Brijesh Singh --- linux-headers/linux/kvm.h | 53 +++ 1 file changed, 53 insertions(+) diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h index c8423e760c..2b0a2a97b8 100644 --- a/linux-headers/linux/kvm.h +++

[Qemu-devel] [PATCH v3 01/14] doc: update AMD SEV API spec web link

2019-08-06 Thread Singh, Brijesh
Signed-off-by: Brijesh Singh --- docs/amd-memory-encryption.txt | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/amd-memory-encryption.txt b/docs/amd-memory-encryption.txt index 43bf3ee6a5..8822cadda1 100644 --- a/docs/amd-memory-encryption.txt +++

[Qemu-devel] [PATCH v3 02/14] doc: update AMD SEV to include Live migration flow

2019-08-06 Thread Singh, Brijesh
Signed-off-by: Brijesh Singh --- docs/amd-memory-encryption.txt | 40 +- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/docs/amd-memory-encryption.txt b/docs/amd-memory-encryption.txt index 8822cadda1..01d95089a8 100644 ---

[Qemu-devel] [PATCH v3 05/14] hw/machine: add helper to query the memory encryption state

2019-08-06 Thread Singh, Brijesh
To enable a memory encryption inside a VM, user must pass the object name used for the encryption in command line parameter as shown below. # $(QEMU) \ -machine memory-encryption= Add a helper machine_memory_encryption_enabled() which will return a bool indicating whether the encryption object

[Qemu-devel] [PATCH v3 00/14] Add SEV guest live migration support

2019-08-06 Thread Singh, Brijesh
AMD SEV encrypts the memory of VMs and because this encryption is done using an address tweak, the hypervisor will not be able to simply copy ciphertext between machines to migrate a VM. Instead the AMD SEV Key Management API provides a set of functions which the hypervisor can use to package a

Re: [Qemu-devel] [RFC PATCH] pci: Use PCI aliases when determining device IOMMU address space

2019-07-25 Thread Singh, Brijesh
On 7/24/19 2:42 PM, Alex Williamson wrote: > On Wed, 24 Jul 2019 08:43:55 -0600 > Alex Williamson wrote: > >> On Wed, 24 Jul 2019 18:03:31 +0800 >> Peter Xu wrote: >> >>> On Wed, Jul 24, 2019 at 05:39:22AM -0400, Michael S. Tsirkin wrote: On Wed, Jul 24, 2019 at 03:14:39PM +0800, Peter

Re: [Qemu-devel] [PATCH v2 04/13] kvm: add support to sync the page encryption state bitmap

2019-07-16 Thread Singh, Brijesh
On 7/16/19 6:44 AM, Dr. David Alan Gilbert wrote: > * Singh, Brijesh (brijesh.si...@amd.com) wrote: >> >> >> On 7/11/19 2:05 PM, Dr. David Alan Gilbert wrote: >>> * Singh, Brijesh (brijesh.si...@amd.com) wrote: >>>> The SEV VMs have concept of pri

Re: [Qemu-devel] [PATCH for-4.1] target/i386: sev: Do not unpin ram device memory region

2019-07-15 Thread Singh, Brijesh
On 7/15/19 9:28 AM, Alex Williamson wrote: > The commit referenced below skipped pinning ram device memory when > ram blocks are added, we need to do the same when they're removed. > > Cc: Brijesh Singh > Cc: Paolo Bonzini > Fixes: cedc0ad539af ("target/i386: sev: Do not pin the ram device

Re: [Qemu-devel] [PATCH v2 03/13] migration/ram: add support to send encrypted pages

2019-07-12 Thread Singh, Brijesh
On 7/12/19 4:27 AM, Dr. David Alan Gilbert wrote: [snip] >>> >>> OK, that's our very last usable flag! Use it wisely! >>> >> >> Hmm, maybe then I missed something. I thought the flag is 64-bit and >> we have more room. Did I miss something ? > > The 64bit value written in the stream is >

Re: [Qemu-devel] [PATCH v2 12/13] migration: add support to migrate page encryption bitmap

2019-07-12 Thread Singh, Brijesh
On 7/12/19 6:30 AM, Dr. David Alan Gilbert wrote: > * Singh, Brijesh (brijesh.si...@amd.com) wrote: >> When memory encryption is enabled, the hypervisor maintains a page >> encryption bitmap which is referred by hypervisor during migratoin to check >> if page is private

Re: [Qemu-devel] [PATCH v2 10/13] target/i386: sev: add support to load incoming encrypted page

2019-07-12 Thread Singh, Brijesh
On 7/12/19 6:02 AM, Dr. David Alan Gilbert wrote: > * Singh, Brijesh (brijesh.si...@amd.com) wrote: >> The sev_load_incoming_page() provide the implementation to read the >> incoming guest private pages from the socket and load it into the guest >> memory. The routines u

Re: [Qemu-devel] [PATCH v2 09/13] target/i386: sev: add support to encrypt the outgoing page

2019-07-12 Thread Singh, Brijesh
On 7/12/19 5:43 AM, Dr. David Alan Gilbert wrote: > * Singh, Brijesh (brijesh.si...@amd.com) wrote: >> The sev_save_outgoing_page() provide the implementation to encrypt the >> guest private pages during the transit. The routines uses the SEND_START >> command to create th

Re: [Qemu-devel] [PATCH v2 08/13] misc.json: add migrate-set-sev-info command

2019-07-12 Thread Singh, Brijesh
On 7/12/19 5:09 AM, Daniel P. Berrangé wrote: > On Fri, Jul 12, 2019 at 11:00:22AM +0100, Dr. David Alan Gilbert wrote: >> * Singh, Brijesh (brijesh.si...@amd.com) wrote: >>> The command can be used by the hypervisor to specify the target Platform >>> Diffie-Hellma

Re: [Qemu-devel] [PATCH v2 04/13] kvm: add support to sync the page encryption state bitmap

2019-07-12 Thread Singh, Brijesh
On 7/11/19 2:05 PM, Dr. David Alan Gilbert wrote: > * Singh, Brijesh (brijesh.si...@amd.com) wrote: >> The SEV VMs have concept of private and shared memory. The private memory >> is encrypted with guest-specific key, while shared memory may be encrypted >>

Re: [Qemu-devel] [PATCH v2 05/13] doc: update AMD SEV API spec web link

2019-07-12 Thread Singh, Brijesh
On 7/11/19 1:06 PM, Dr. David Alan Gilbert wrote: > * Singh, Brijesh (brijesh.si...@amd.com) wrote: >> Signed-off-by: Brijesh Singh >> --- >> docs/amd-memory-encryption.txt | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/do

Re: [Qemu-devel] [PATCH v2 02/13] kvm: introduce high-level API to support encrypted page migration

2019-07-11 Thread Singh, Brijesh
On 7/11/19 12:47 PM, Dr. David Alan Gilbert wrote: > * Singh, Brijesh (brijesh.si...@amd.com) wrote: >> When memory encryption is enabled in VM, the guest pages will be >> encrypted with the guest-specific key, to protect the confidentiality >> of data in transit. To suppo

Re: [Qemu-devel] [PATCH v2 00/13] Add SEV guest live migration support

2019-07-11 Thread Singh, Brijesh
On 7/11/19 4:59 AM, Dr. David Alan Gilbert wrote: > * Singh, Brijesh (brijesh.si...@amd.com) wrote: >> AMD SEV encrypts the memory of VMs and because this encryption is done using >> an address tweak, the hypervisor will not be able to simply copy ciphertext >> between mac

Re: [Qemu-devel] [PATCH v2 03/13] migration/ram: add support to send encrypted pages

2019-07-11 Thread Singh, Brijesh
On 7/11/19 12:34 PM, Dr. David Alan Gilbert wrote: > * Singh, Brijesh (brijesh.si...@amd.com) wrote: >> When memory encryption is enabled, the guest memory will be encrypted with >> the guest specific key. The patch introduces RAM_SAVE_FLAG_ENCRYPTED_PAGE >> flag to dist

[Qemu-devel] [PATCH v2 12/13] migration: add support to migrate page encryption bitmap

2019-07-10 Thread Singh, Brijesh
When memory encryption is enabled, the hypervisor maintains a page encryption bitmap which is referred by hypervisor during migratoin to check if page is private or shared. The bitmap is built during the VM bootup and must be migrated to the target host so that hypervisor on target host can use it

[Qemu-devel] [PATCH v2 11/13] kvm: introduce high-level API to migrate the page encryption bitmap

2019-07-10 Thread Singh, Brijesh
Encrypted VMs have concept of private and shared memory. The private memory is encrypted with the guest-specific key, while shared memory may be encrypted with hyperivosr key. The guest OS uses a hypercall to notify the page encryption state to the hypervisor. The hypervisor maintain a bitmap of

[Qemu-devel] [PATCH v2 10/13] target/i386: sev: add support to load incoming encrypted page

2019-07-10 Thread Singh, Brijesh
The sev_load_incoming_page() provide the implementation to read the incoming guest private pages from the socket and load it into the guest memory. The routines uses the RECEIVE_START command to create the incoming encryption context on the first call then uses the RECEIEVE_UPDATE_DATA command to

[Qemu-devel] [PATCH v2 08/13] misc.json: add migrate-set-sev-info command

2019-07-10 Thread Singh, Brijesh
The command can be used by the hypervisor to specify the target Platform Diffie-Hellman key (PDH) and certificate chain before starting the SEV guest migration. The values passed through the command will be used while creating the outgoing encryption context. Signed-off-by: Brijesh Singh ---

[Qemu-devel] [PATCH v2 04/13] kvm: add support to sync the page encryption state bitmap

2019-07-10 Thread Singh, Brijesh
The SEV VMs have concept of private and shared memory. The private memory is encrypted with guest-specific key, while shared memory may be encrypted with hyperivosr key. The KVM_GET_PAGE_ENC_BITMAP can be used to get a bitmap indicating whether the guest page is private or shared. A private page

[Qemu-devel] [PATCH v2 05/13] doc: update AMD SEV API spec web link

2019-07-10 Thread Singh, Brijesh
Signed-off-by: Brijesh Singh --- docs/amd-memory-encryption.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/amd-memory-encryption.txt b/docs/amd-memory-encryption.txt index 43bf3ee6a5..abb9a976f5 100644 --- a/docs/amd-memory-encryption.txt +++

[Qemu-devel] [PATCH v2 06/13] doc: update AMD SEV to include Live migration flow

2019-07-10 Thread Singh, Brijesh
Signed-off-by: Brijesh Singh --- docs/amd-memory-encryption.txt | 42 +- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/docs/amd-memory-encryption.txt b/docs/amd-memory-encryption.txt index abb9a976f5..374f4b0a94 100644 ---

[Qemu-devel] [PATCH v2 13/13] target/i386: sev: remove migration blocker

2019-07-10 Thread Singh, Brijesh
Signed-off-by: Brijesh Singh --- target/i386/sev.c | 12 1 file changed, 12 deletions(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index 93c6a90806..48336515a2 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -34,7 +34,6 @@ #define DEFAULT_SEV_DEVICE

[Qemu-devel] [PATCH v2 09/13] target/i386: sev: add support to encrypt the outgoing page

2019-07-10 Thread Singh, Brijesh
The sev_save_outgoing_page() provide the implementation to encrypt the guest private pages during the transit. The routines uses the SEND_START command to create the outgoing encryption context on the first call then uses the SEND_UPDATE_DATA command to encrypt the data before writing it to the

[Qemu-devel] [PATCH v2 01/13] linux-headers: update kernel header to include SEV migration commands

2019-07-10 Thread Singh, Brijesh
Signed-off-by: Brijesh Singh --- linux-headers/linux/kvm.h | 53 +++ 1 file changed, 53 insertions(+) diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h index c8423e760c..2b0a2a97b8 100644 --- a/linux-headers/linux/kvm.h +++

[Qemu-devel] [PATCH v2 07/13] target/i386: sev: do not create launch context for an incoming guest

2019-07-10 Thread Singh, Brijesh
The LAUNCH_START is used for creating an encryption context to encrypt newly created guest, for an incoming guest the RECEIVE_START should be used. Signed-off-by: Brijesh Singh --- target/i386/sev.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git

[Qemu-devel] [PATCH v2 03/13] migration/ram: add support to send encrypted pages

2019-07-10 Thread Singh, Brijesh
When memory encryption is enabled, the guest memory will be encrypted with the guest specific key. The patch introduces RAM_SAVE_FLAG_ENCRYPTED_PAGE flag to distinguish the encrypted data from plaintext. Encrypted pages may need special handling. The kvm_memcrypt_save_outgoing_page() is used by

[Qemu-devel] [PATCH v2 02/13] kvm: introduce high-level API to support encrypted page migration

2019-07-10 Thread Singh, Brijesh
When memory encryption is enabled in VM, the guest pages will be encrypted with the guest-specific key, to protect the confidentiality of data in transit. To support the live migration we need to use platform specific hooks to access the guest memory. The kvm_memcrypt_save_outgoing_page() can be

[Qemu-devel] [PATCH v2 00/13] Add SEV guest live migration support

2019-07-10 Thread Singh, Brijesh
AMD SEV encrypts the memory of VMs and because this encryption is done using an address tweak, the hypervisor will not be able to simply copy ciphertext between machines to migrate a VM. Instead the AMD SEV Key Management API provides a set of functions which the hypervisor can use to package a

Re: [Qemu-devel] [RFC PATCH v1 08/12] target.json: add migrate-set-sev-info command

2019-06-20 Thread Singh, Brijesh
On 6/20/19 2:13 PM, Eric Blake wrote: > On 6/20/19 1:03 PM, Singh, Brijesh wrote: >> The command can be used by the hypervisor to specify the target Platform >> Diffie-Hellman key (PDH) and certificate chain before starting the SEV >> guest migration. The values passe

[Qemu-devel] [RFC PATCH v1 10/12] target/i386: sev: add support to load incoming encrypted page

2019-06-20 Thread Singh, Brijesh
The sev_load_incoming_page() provide the implementation to read the incoming guest private pages from the socket and load it into the guest memory. The routines uses the RECEIVE_START command to create the incoming encryption context on the first call then uses the RECEIEVE_UPDATE_DATA command to

[Qemu-devel] [RFC PATCH v1 03/12] migration/ram: add support to send encrypted pages

2019-06-20 Thread Singh, Brijesh
When memory encryption is enabled, the guest memory will be encrypted with the guest specific key. The patch introduces RAM_SAVE_FLAG_ENCRYPTED_PAGE flag to distinguish the encrypted data from plaintext. Encrypted pages may need special handling. The kvm_memcrypt_save_outgoing_page() is used by

[Qemu-devel] [RFC PATCH v1 01/12] linux-headers: update kernel header to include SEV migration commands

2019-06-20 Thread Singh, Brijesh
Signed-off-by: Brijesh Singh --- linux-headers/linux/kvm.h | 53 +++ 1 file changed, 53 insertions(+) diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h index c8423e760c..2bdd6a908e 100644 --- a/linux-headers/linux/kvm.h +++

[Qemu-devel] [RFC PATCH v1 09/12] target/i386: sev: add support to encrypt the outgoing page

2019-06-20 Thread Singh, Brijesh
The sev_save_outgoing_page() provide the implementation to encrypt the guest private pages during the transit. The routines uses the SEND_START command to create the outgoing encryption context on the first call then uses the SEND_UPDATE_DATA command to encrypt the data before writing it to the

[Qemu-devel] [RFC PATCH v1 06/12] doc: update AMD SEV to include Live migration flow

2019-06-20 Thread Singh, Brijesh
Signed-off-by: Brijesh Singh --- docs/amd-memory-encryption.txt | 44 +- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/docs/amd-memory-encryption.txt b/docs/amd-memory-encryption.txt index abb9a976f5..757e0d931a 100644 ---

[Qemu-devel] [RFC PATCH v1 02/12] kvm: introduce high-level API to support encrypted guest migration

2019-06-20 Thread Singh, Brijesh
When memory encryption is enabled in VM, the guest pages will be encrypted with the guest-specific key, to protect the confidentiality of data in transit. To support the live migration we need to use platform specific hooks to access the guest memory. The kvm_memcrypt_save_outgoing_page() can be

[Qemu-devel] [RFC PATCH v1 12/12] target/i386: sev: remove migration blocker

2019-06-20 Thread Singh, Brijesh
Signed-off-by: Brijesh Singh --- target/i386/sev.c | 12 1 file changed, 12 deletions(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index dc1e974d93..095ef4c729 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -34,7 +34,6 @@ #define DEFAULT_SEV_DEVICE

[Qemu-devel] [RFC PATCH v1 00/12] Add SEV guest live migration support

2019-06-20 Thread Singh, Brijesh
AMD SEV encrypts the memory of VMs and because this encryption is done using an address tweak, the hypervisor will not be able to simply copy ciphertext between machines to migrate a VM. Instead the AMD SEV Key Management API provides a set of functions which the hypervisor can use to package a

[Qemu-devel] [RFC PATCH v1 11/12] migration: add support to migrate page encryption bitmap

2019-06-20 Thread Singh, Brijesh
When memory encryption is enabled, the hypervisor maintains a page encryption bitmap which is referred by hypervisor during migratoin to check if page is private or shared. The bitmap is built during the VM bootup and must be migrated to the target host so that hypervisor on target host can use it

[Qemu-devel] [RFC PATCH v1 08/12] target.json: add migrate-set-sev-info command

2019-06-20 Thread Singh, Brijesh
The command can be used by the hypervisor to specify the target Platform Diffie-Hellman key (PDH) and certificate chain before starting the SEV guest migration. The values passed through the command will be used while creating the outgoing encryption context. Signed-off-by: Brijesh Singh ---

[Qemu-devel] [RFC PATCH v1 05/12] doc: update AMD SEV API spec web link

2019-06-20 Thread Singh, Brijesh
Signed-off-by: Brijesh Singh --- docs/amd-memory-encryption.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/amd-memory-encryption.txt b/docs/amd-memory-encryption.txt index 43bf3ee6a5..abb9a976f5 100644 --- a/docs/amd-memory-encryption.txt +++

[Qemu-devel] [RFC PATCH v1 07/12] target/i386: sev: do not create launch context for an incoming guest

2019-06-20 Thread Singh, Brijesh
The LAUNCH_START is used for creating an encryption context to encrypt newly created guest, for an incoming guest the RECEIVE_START should be used. Signed-off-by: Brijesh Singh --- target/i386/sev.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git

[Qemu-devel] [RFC PATCH v1 04/12] kvm: add support to sync the page encryption state bitmap

2019-06-20 Thread Singh, Brijesh
The SEV VMs have concept of private and shared memory. The private memory is encrypted with guest-specific key, while shared memory may be encrypted with hyperivosr key. The KVM_GET_PAGE_ENC_BITMAP can be used to get a bitmap indicating whether the guest page is private or shared. A private page

Re: [Qemu-devel] [RFC PATCH v1 08/10] KVM: X86: Introduce KVM_HC_PAGE_ENC_STATUS hypercall

2019-05-03 Thread Singh, Brijesh
On 4/26/19 4:39 PM, Lendacky, Thomas wrote: > On 4/24/19 11:10 AM, Singh, Brijesh wrote: >> The hypercall can be used by the SEV guest to notify the page encryption > > This hyercall is used by the SEV guest to notify a change in the page... > >> status to the hypervis

Re: [Qemu-devel] [RFC PATCH v1 02/10] KVM: SVM: Add KVM_SEND_UPDATE_DATA command

2019-04-29 Thread Singh, Brijesh
On 4/26/19 3:31 PM, Lendacky, Thomas wrote: ... >> >> static unsigned int max_sev_asid; >> static unsigned int min_sev_asid; >> +static unsigned long me_mask; > > sev_me_mask ? > Agreed. >> static unsigned long *sev_asid_bitmap; >> #define __sme_page_pa(x)

Re: [Qemu-devel] [RFC PATCH v1 01/10] KVM: SVM: Add KVM_SEV SEND_START command

2019-04-29 Thread Singh, Brijesh
On 4/29/19 11:36 AM, Borislav Petkov wrote: > So what about this? Limiting to a sane length... Sure, we have defined a SEV_FW_BLOB_MAX_SIZE and can use it to limit the blob copy size. I will do this in next rev. thanks -Brijesh

Re: [Qemu-devel] [RFC PATCH v1 01/10] KVM: SVM: Add KVM_SEV SEND_START command

2019-04-29 Thread Singh, Brijesh
On 4/26/19 3:43 PM, Borislav Petkov wrote: > On Fri, Apr 26, 2019 at 02:29:31PM +0000, Singh, Brijesh wrote: >> Yes that's doable but I am afraid that caching the value may lead us to >> wrong path and also divergence from the SEV API spec. The spec says the >> returne

Re: [Qemu-devel] [RFC PATCH v1 01/10] KVM: SVM: Add KVM_SEV SEND_START command

2019-04-26 Thread Singh, Brijesh
On 4/26/19 9:10 AM, Borislav Petkov wrote: > On Wed, Apr 24, 2019 at 04:09:59PM +0000, Singh, Brijesh wrote: >> The command is used to create an outgoing SEV guest encryption context. >> >> Cc: Thomas Gleixner >> Cc: Ingo Molnar >> Cc: "H. Peter Anvin

Re: [Qemu-devel] [RFC PATCH v1 00/10] Add AMD SEV guest live migration support

2019-04-24 Thread Singh, Brijesh
On 4/24/19 7:18 PM, Steve Rutherford wrote: > Do you mean MiB/s, MB/s or Mb/s? Since you are talking about network > speeds, sometimes these get conflated. It's megabits/sec. The QMP query-migration command shows the throughput in Mbits/s. It includes PSP command execution and the network write.

Re: [Qemu-devel] [RFC PATCH v1 00/10] Add AMD SEV guest live migration support

2019-04-24 Thread Singh, Brijesh
On 4/24/19 2:15 PM, Steve Rutherford wrote: > On Wed, Apr 24, 2019 at 9:10 AM Singh, Brijesh wrote: >> >> The series add support for AMD SEV guest live migration commands. To protect >> the >> confidentiality of an SEV protected guest memory while in transit we need

[Qemu-devel] [RFC PATCH v1 06/10] KVM: SVM: Add KVM_SEV_RECEIVE_FINISH command

2019-04-24 Thread Singh, Brijesh
The command finalize the guest receiving process and make the SEV guest ready for the execution. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: Paolo Bonzini Cc: "Radim Krčmář" Cc: Joerg Roedel Cc: Borislav Petkov Cc: Tom Lendacky Cc: x...@kernel.org Cc: k...@vger.kernel.org

[Qemu-devel] [RFC PATCH v1 03/10] KVM: SVM: Add KVM_SEV_SEND_FINISH command

2019-04-24 Thread Singh, Brijesh
The command is used to finailize the encryption context created with KVM_SEV_SEND_START command. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: Paolo Bonzini Cc: "Radim Krčmář" Cc: Joerg Roedel Cc: Borislav Petkov Cc: Tom Lendacky Cc: x...@kernel.org Cc: k...@vger.kernel.org

[Qemu-devel] [RFC PATCH v1 08/10] KVM: X86: Introduce KVM_HC_PAGE_ENC_STATUS hypercall

2019-04-24 Thread Singh, Brijesh
The hypercall can be used by the SEV guest to notify 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 the guest pages should be considered encrypted. Cc: Thomas

[Qemu-devel] [RFC PATCH v1 09/10] KVM: x86: Introduce KVM_GET_PAGE_ENC_BITMAP ioctl

2019-04-24 Thread Singh, Brijesh
The ioctl can be used to retrieve page encryption bitmap for a given kvm memory slot. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: Paolo Bonzini Cc: "Radim Krčmář" Cc: Joerg Roedel Cc: Borislav Petkov Cc: Tom Lendacky Cc: x...@kernel.org Cc: k...@vger.kernel.org Cc:

[Qemu-devel] [RFC PATCH v1 07/10] KVM: x86: Add AMD SEV specific Hypercall3

2019-04-24 Thread Singh, Brijesh
KVM hypercall framework relies on alternative framework to patch the VMCALL -> VMMCALL on AMD platform. If a hypercall is made before apply_alternative() is called then it defaults to VMCALL. The approach works fine on non SEV guest. A VMCALL would causes #UD, and hypervisor will be able to decode

[Qemu-devel] [RFC PATCH v1 05/10] KVM: SVM: Add KVM_SEV_RECEIVE_UPDATE_DATA command

2019-04-24 Thread Singh, Brijesh
The command is used for copying the incoming buffer into the SEV guest memory space. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: Paolo Bonzini Cc: "Radim Krčmář" Cc: Joerg Roedel Cc: Borislav Petkov Cc: Tom Lendacky Cc: x...@kernel.org Cc: k...@vger.kernel.org Cc:

[Qemu-devel] [RFC PATCH v1 01/10] KVM: SVM: Add KVM_SEV SEND_START command

2019-04-24 Thread Singh, Brijesh
The command is used to create an outgoing SEV guest encryption context. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: Paolo Bonzini Cc: "Radim Krčmář" Cc: Joerg Roedel Cc: Borislav Petkov Cc: Tom Lendacky Cc: x...@kernel.org Cc: k...@vger.kernel.org Cc:

[Qemu-devel] [RFC PATCH v1 10/10] mm: x86: Invoke hypercall when page encryption status is changed

2019-04-24 Thread Singh, Brijesh
Invoke a hypercall when a memory region is changed from encrypted -> decrypted and vice versa. Hypervisor need to know the page encryption status during the guest migration. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: Paolo Bonzini Cc: "Radim Krčmář" Cc: Joerg Roedel Cc:

[Qemu-devel] [RFC PATCH v1 04/10] KVM: SVM: Add support for KVM_SEV_RECEIVE_START command

2019-04-24 Thread Singh, Brijesh
The command is used to create encryption context for the incoming SEV guest. The encryption context can be later unused by the hypervisor to import the incoming data into the SEV guest memory space. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: Paolo Bonzini Cc: "Radim Krčmář"

[Qemu-devel] [RFC PATCH v1 02/10] KVM: SVM: Add KVM_SEND_UPDATE_DATA command

2019-04-24 Thread Singh, Brijesh
The command is used for encrypting the guest memory region using the encryption context created with KVM_SEV_SEND_START. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: Paolo Bonzini Cc: "Radim Krčmář" Cc: Joerg Roedel Cc: Borislav Petkov Cc: Tom Lendacky Cc: x...@kernel.org

[Qemu-devel] [RFC PATCH v1 00/10] Add AMD SEV guest live migration support

2019-04-24 Thread Singh, Brijesh
The series add support for AMD SEV guest live migration commands. To protect the confidentiality of an SEV protected guest memory while in transit we need to use the SEV commands defined in SEV API spec [1]. SEV guest VMs have the concept of private and shared memory. Private memory is encrypted

[Qemu-devel] [PATCH v2] target/i386: sev: add 'sev-max-guests' field to 'query-sev-capabilities'

2019-04-11 Thread Singh, Brijesh
There are limited numbers of the SEV guests that can be run concurrently. A management applications may need to know this limit so that it can place SEV VMs on hosts which have suitable resources available. Currently, this limit is not exposed to the application. Add a new 'sev-max-guest' field

Re: [Qemu-devel] [PATCH] target/i386: sev: add 'sev-max-guests' field to 'query-sev-capabilities'

2019-04-11 Thread Singh, Brijesh
On 4/11/19 1:10 PM, Laszlo Ersek wrote: > On 04/11/19 19:59, Singh, Brijesh wrote: >> There are limited numbers of the SEV guests that can be run concurrently. >> A management applications may need to know this limit so that it can place >> SEV VMs on hosts which ha

Re: [Qemu-devel] [PATCH] target/i386: sev: add 'sev-max-guests' field to 'query-sev-capabilities'

2019-04-11 Thread Singh, Brijesh
On 4/11/19 1:05 PM, Daniel P. Berrangé wrote: > On Thu, Apr 11, 2019 at 05:59:50PM +0000, Singh, Brijesh wrote: >> There are limited numbers of the SEV guests that can be run concurrently. >> A management applications may need to know this limit so that it can place >> S

[Qemu-devel] [PATCH] target/i386: sev: add 'sev-max-guests' field to 'query-sev-capabilities'

2019-04-11 Thread Singh, Brijesh
There are limited numbers of the SEV guests that can be run concurrently. A management applications may need to know this limit so that it can place SEV VMs on hosts which have suitable resources available. Currently, this limit is not exposed to the application. Add a new 'sev-max-guest' field

Re: [Qemu-devel] [RFC PATCH] pci: Use PCI aliases when determining device IOMMU address space

2019-04-01 Thread Singh, Brijesh
Thanks for adding Alex. Adding Suravee. On 3/29/19 11:49 AM, Alex Williamson wrote: > [Cc +Brijesh] > > Hi Brijesh, will the change below require the IVRS to be updated to > include aliases for all BDF ranges behind a conventional bridge? I > think the Linux code handles this regardless of

Re: [Qemu-devel] AMD SEV's /dev/sev permissions and probing QEMU for capabilities

2019-03-15 Thread Singh, Brijesh
Hi Daniel, On 3/15/19 7:18 AM, Daniel P. Berrangé wrote: > On Fri, Jan 18, 2019 at 12:51:50PM +0000, Singh, Brijesh wrote: >> >> On 1/18/19 3:39 AM, Erik Skultety wrote: >>> I proceeded with cloning [1] to systemd and creating an udev rule that I >>> pla

Re: [Qemu-devel] [PATCH v2 0/2] Fix SEV VM device assignment

2019-03-01 Thread Singh, Brijesh
Hi Paolo, Any comment on this series. Currently, device pass-through is broken for the SEV guests. I am wondering if we can queue the patches. thanks Brijesh On 2/4/19 4:23 PM, Singh, Brijesh wrote: > Fix: https://bugzilla.redhat.com/show_bug.cgi?id=1667249 > > Since v1: > * che

[Qemu-devel] [PATCH v2 1/2] memory: Fix the memory region type assignment order

2019-02-04 Thread Singh, Brijesh
Currently, a callback registered through the RAMBlock notifier is not able to get the memory region type (i.e callback is not able to use memory_region_is_ram_device function). This is because mr->ram assignment happens _after_ the memory is allocated whereas the callback is executed during

[Qemu-devel] [PATCH v2 0/2] Fix SEV VM device assignment

2019-02-04 Thread Singh, Brijesh
Fix: https://bugzilla.redhat.com/show_bug.cgi?id=1667249 Since v1: * check the error code from memory_region_from_host() before accessing the mr. Brijesh Singh (2): memory: Fix the memory region type assignment order target/i386: sev: Do not pin the ram device memory region memory.c

[Qemu-devel] [PATCH v2 2/2] target/i386: sev: Do not pin the ram device memory region

2019-02-04 Thread Singh, Brijesh
The RAM device presents a memory region that should be handled as an IO region and should not be pinned. In the case of the vfio-pci, RAM device represents a MMIO BAR and the memory region is not backed by pages hence KVM_MEMORY_ENCRYPT_REG_REGION fails to lock the memory range. Fixes:

Re: [Qemu-devel] [PATCH 2/2] target/i386: sev: Do not pin the ram device memory region

2019-02-04 Thread Singh, Brijesh
On 2/4/19 11:59 AM, Alex Williamson wrote: > On Thu, 17 Jan 2019 21:53:16 + > "Singh, Brijesh" wrote: > >> The RAM device presents a memory region that should be handled >> as an IO region and should not be pinned. >> >> In the case of the

Re: [Qemu-devel] [PATCH 0/2] Fix SEV VM device assignment

2019-02-04 Thread Singh, Brijesh
Hi Alex and Paolo, Any comments on the patch. thanks On 1/17/19 3:53 PM, Singh, Brijesh wrote: > Fix: https://bugzilla.redhat.com/show_bug.cgi?id=1667249 > > Brijesh Singh (2): >memory: Fix the memory region type assignment order >target/i386: sev: Do not pin the ra

Re: [Qemu-devel] AMD SEV's /dev/sev permissions and probing QEMU for capabilities

2019-01-30 Thread Singh, Brijesh
On 1/30/19 7:39 AM, Erik Skultety wrote: though, we need a #ifdef check for existance of PR_CAP_AMBIENT > An alternative question I've been playing ever since we exchanged the > last few > emails is that can't we wait until the ioctls are compared against >

Re: [Qemu-devel] AMD SEV's /dev/sev permissions and probing QEMU for capabilities

2019-01-23 Thread Singh, Brijesh
n 23, 2019 at 01:10:42PM +, Daniel P. Berrangé wrote: >>>>> On Wed, Jan 23, 2019 at 01:55:06PM +0100, Erik Skultety wrote: >>>>>> On Fri, Jan 18, 2019 at 12:51:50PM +, Singh, Brijesh wrote: >>>>>>> >>>>>>> On 1/18/

Re: [Qemu-devel] AMD SEV's /dev/sev permissions and probing QEMU for capabilities

2019-01-18 Thread Singh, Brijesh
On 1/18/19 3:39 AM, Erik Skultety wrote: > Hi, > this is a summary of a private discussion I've had with guys CC'd on this > email > about finding a solution to [1] - basically, the default permissions on > /dev/sev (below) make it impossible to query for SEV platform capabilities, > since by

[Qemu-devel] [PATCH 1/2] memory: Fix the memory region type assignment order

2019-01-17 Thread Singh, Brijesh
Currently, a callback registered through the RAMBlock notifier is not able to get the memory region type (i.e callback is not able to use memory_region_is_ram_device function). This is because mr->ram assignment happens _after_ the memory is allocated whereas the callback is executed during

[Qemu-devel] [PATCH 2/2] target/i386: sev: Do not pin the ram device memory region

2019-01-17 Thread Singh, Brijesh
The RAM device presents a memory region that should be handled as an IO region and should not be pinned. In the case of the vfio-pci, RAM device represents a MMIO BAR and the memory region is not backed by pages hence KVM_MEMORY_ENCRYPT_REG_REGION fails to lock the memory range. Fixes:

[Qemu-devel] [PATCH 0/2] Fix SEV VM device assignment

2019-01-17 Thread Singh, Brijesh
Fix: https://bugzilla.redhat.com/show_bug.cgi?id=1667249 Brijesh Singh (2): memory: Fix the memory region type assignment order target/i386: sev: Do not pin the ram device memory region memory.c | 9 - target/i386/sev.c | 11 +++ 2 files changed, 19 insertions(+),

Re: [Qemu-devel] [PULL v2 00/28] pci, pc, virtio: fixes, features

2018-10-26 Thread Singh, Brijesh
On 10/25/2018 07:59 PM, Michael S. Tsirkin wrote: > On Thu, Oct 25, 2018 at 08:16:44PM +0100, Peter Maydell wrote: >> On 25 October 2018 at 01:52, Michael S. Tsirkin wrote: >>> The following changes since commit 13399aad4fa87b2878c49d02a5d3bafa6c966ba3: >>> >>>Merge remote-tracking branch

Re: [Qemu-devel] [PATCH v5 0/9] x86_iommu/amd: add interrupt remap support

2018-10-19 Thread Singh, Brijesh
Hi Michael, Paolo and Eduardo, Any thoughts on the series ? Thanks Brijesh On 10/1/18 12:44 PM, Singh, Brijesh wrote: > This series adds the interrupt remapping support for amd-iommu device. > > IOMMU spec is available at: https://support.amd.com/TechDocs/48882_IOMMU.pdf >

[Qemu-devel] [PATCH v5 2/9] x86_iommu: move vtd_generate_msi_message in common file

2018-10-01 Thread Singh, Brijesh
The vtd_generate_msi_message() in intel-iommu is used to construct a MSI Message from IRQ. A similar function will be needed when we add interrupt remapping support in amd-iommu. Moving the function in common file to avoid the code duplication. Rename it to x86_iommu_irq_to_msi_message(). There is

[Qemu-devel] [PATCH v5 9/9] x86_iommu/amd: Enable Guest virtual APIC support

2018-10-01 Thread Singh, Brijesh
Now that amd-iommu support interrupt remapping, enable the GASup in IVRS table and GASup in extended feature register to indicate that IOMMU support guest virtual APIC mode. GASup provides option to guest OS to make use of 128-bit IRTE. Note that the GAMSup is set to zero to indicate that

[Qemu-devel] [PATCH v5 1/9] x86_iommu: move the kernel-irqchip check in common code

2018-10-01 Thread Singh, Brijesh
Interrupt remapping needs kernel-irqchip={off|split} on both Intel and AMD platforms. Move the check in common place. Signed-off-by: Brijesh Singh Reviewed-by: Peter Xu Cc: Peter Xu Cc: "Michael S. Tsirkin" Cc: Paolo Bonzini Cc: Richard Henderson Cc: Eduardo Habkost Cc: Marcel Apfelbaum

  1   2   >