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 >

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 v4 3/9] x86_iommu/amd: remove V=1 check from amdvi_validate_dte()

2018-09-28 Thread Singh, Brijesh
On 9/28/18 12:46 AM, Peter Xu wrote: > On Thu, Sep 27, 2018 at 04:45:55PM +0000, Singh, Brijesh wrote: >> Currently, the amdvi_validate_dte() assumes that a valid DTE will >> always have V=1. This is not true. The V=1 means that bit[127:1] are >> valid. A valid DTE can h

[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 5/9] x86_iommu/amd: Prepare for interrupt remap support

2018-10-01 Thread Singh, Brijesh
Register the interrupt remapping callback and read/write ops for the amd-iommu-ir memory region. amd-iommu-ir is set to higher priority to ensure that this region won't be masked out by other memory regions. Signed-off-by: Brijesh Singh Cc: Peter Xu Cc: "Michael S. Tsirkin" Cc: Paolo Bonzini

[Qemu-devel] [PATCH v5 3/9] x86_iommu/amd: remove V=1 check from amdvi_validate_dte()

2018-10-01 Thread Singh, Brijesh
Currently, the amdvi_validate_dte() assumes that a valid DTE will always have V=1. This is not true. The V=1 means that bit[127:1] are valid. A valid DTE can have IV=1 and V=0 (i.e address translation disabled and interrupt remapping enabled) Remove the V=1 check from amdvi_validate_dte(), make

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

2018-10-01 Thread Singh, Brijesh
This series adds the interrupt remapping support for amd-iommu device. IOMMU spec is available at: https://support.amd.com/TechDocs/48882_IOMMU.pdf To enable the interrupt remap use below qemu cli # $QEMU \ -device amd-iommu,intremap=on I have tested FC-28 and Ubuntu 18.04 guest. Linux

[Qemu-devel] [PATCH v5 4/9] x86_iommu/amd: make the address space naming consistent with intel-iommu

2018-10-01 Thread Singh, Brijesh
To be consistent with intel-iommu: - rename the address space to use '_' instead of '-' - update the memory region relationships 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

[Qemu-devel] [PATCH v5 6/9] x86_iommu/amd: Add interrupt remap support when VAPIC is not enabled

2018-10-01 Thread Singh, Brijesh
Emulate the interrupt remapping support when guest virtual APIC is not enabled. For more info Refer: AMD IOMMU spec Rev 3.0 - section 2.2.5.1 When VAPIC is not enabled, it uses interrupt remapping as defined in Table 20 and Figure 15 from IOMMU spec. Signed-off-by: Brijesh Singh Cc: Peter Xu

[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

[Qemu-devel] [PATCH v5 7/9] i386: acpi: add IVHD device entry for IOAPIC

2018-10-01 Thread Singh, Brijesh
When interrupt remapping is enabled, add a special IVHD device (type IOAPIC). Signed-off-by: Brijesh Singh Acked-by: Peter Xu Cc: Peter Xu Cc: "Michael S. Tsirkin" Cc: Paolo Bonzini Cc: Richard Henderson Cc: Eduardo Habkost Cc: Marcel Apfelbaum Cc: Tom Lendacky Cc: Suravee Suthikulpanit

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

2018-09-21 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

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

2018-09-21 Thread Singh, Brijesh
This series adds the interrupt remapping support for amd-iommu device. IOMMU spec is available at: https://support.amd.com/TechDocs/48882_IOMMU.pdf To enable the interrupt remap use below qemu cli # $QEMU \ -device amd-iommu,intremap=on I have tested FC-28 and Ubuntu 18.04 guest. Linux

[Qemu-devel] [PATCH v3 4/9] x86_iommu/amd: make the address space naming consistent with intel-iommu

2018-09-21 Thread Singh, Brijesh
To be consistent with intel-iommu: - rename the address space to use '_' instead of '-' - update the memory region relationships Signed-off-by: Brijesh Singh Cc: Peter Xu Cc: "Michael S. Tsirkin" Cc: Paolo Bonzini Cc: Richard Henderson Cc: Eduardo Habkost Cc: Marcel Apfelbaum Cc: Tom

[Qemu-devel] [PATCH v3 7/9] i386: acpi: add IVHD device entry for IOAPIC

2018-09-21 Thread Singh, Brijesh
When interrupt remapping is enabled, add a special IVHD device (type IOAPIC). Signed-off-by: Brijesh Singh Cc: Peter Xu Cc: "Michael S. Tsirkin" Cc: Paolo Bonzini Cc: Richard Henderson Cc: Eduardo Habkost Cc: Marcel Apfelbaum Cc: Tom Lendacky Cc: Suravee Suthikulpanit ---

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

2018-09-21 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 v3 2/9] x86_iommu: move vtd_generate_msi_message in common file

2018-09-21 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 v3 3/9] x86_iommu/amd: remove V=1 check from amdvi_validate_dte()

2018-09-21 Thread Singh, Brijesh
Currently, the amdvi_validate_dte() assumes that a valid DTE will always have V=1. This is not true. The V=1 means that bit[127:1] are valid. A valid DTE can have IV=1 and V=0 (i.e address translation disabled and interrupt remapping enabled) Remove the V=1 check from amdvi_validate_dte(), make

[Qemu-devel] [PATCH v3 6/9] x86_iommu/amd: Add interrupt remap support when VAPIC is not enabled

2018-09-21 Thread Singh, Brijesh
Emulate the interrupt remapping support when guest virtual APIC is not enabled. For more info Refer: AMD IOMMU spec Rev 3.0 - section 2.2.5.1 When VAPIC is not enabled, it uses interrupt remapping as defined in Table 20 and Figure 15 from IOMMU spec. Signed-off-by: Brijesh Singh Cc: Peter Xu

[Qemu-devel] [PATCH v3 5/9] x86_iommu/amd: Prepare for interrupt remap support

2018-09-21 Thread Singh, Brijesh
Register the interrupt remapping callback and read/write ops for the amd-iommu-ir memory region. amd-iommu-ir is set to higher priority to ensure that this region won't be masked out by other memory regions. Signed-off-by: Brijesh Singh Cc: Peter Xu Cc: "Michael S. Tsirkin" Cc: Paolo Bonzini

Re: [Qemu-devel] [PATCH v3 3/9] x86_iommu/amd: remove V=1 check from amdvi_validate_dte()

2018-09-27 Thread Singh, Brijesh
On 9/25/18 1:17 AM, Peter Xu wrote: > On Fri, Sep 21, 2018 at 02:25:37PM +0000, Singh, Brijesh wrote: >> Currently, the amdvi_validate_dte() assumes that a valid DTE will >> always have V=1. This is not true. The V=1 means that bit[127:1] are >> valid. A valid DTE can h

Re: [Qemu-devel] [PATCH v3 6/9] x86_iommu/amd: Add interrupt remap support when VAPIC is not enabled

2018-09-27 Thread Singh, Brijesh
On 9/25/18 1:36 AM, Peter Xu wrote: > On Fri, Sep 21, 2018 at 02:25:40PM +0000, Singh, Brijesh wrote: >> Emulate the interrupt remapping support when guest virtual APIC is >> not enabled. >> >> For more info Refer: AMD IOMMU spec Rev 3.0 - section 2.2.5.1 >> >

Re: [Qemu-devel] [PATCH v3 8/9] x86_iommu/amd: Add interrupt remap support when VAPIC is enabled

2018-09-27 Thread Singh, Brijesh
On 9/25/18 1:57 AM, Peter Xu wrote: > On Fri, Sep 21, 2018 at 02:25:42PM +0000, Singh, Brijesh wrote: > > [...] > >> +static int amdvi_int_remap_ga(AMDVIState *iommu, >> + MSIMessage *origin, >> +

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

2018-09-27 Thread Singh, Brijesh
This series adds the interrupt remapping support for amd-iommu device. IOMMU spec is available at: https://support.amd.com/TechDocs/48882_IOMMU.pdf To enable the interrupt remap use below qemu cli # $QEMU \ -device amd-iommu,intremap=on I have tested FC-28 and Ubuntu 18.04 guest. Linux

[Qemu-devel] [PATCH v4 7/9] i386: acpi: add IVHD device entry for IOAPIC

2018-09-27 Thread Singh, Brijesh
When interrupt remapping is enabled, add a special IVHD device (type IOAPIC). Signed-off-by: Brijesh Singh Cc: Peter Xu Cc: "Michael S. Tsirkin" Cc: Paolo Bonzini Cc: Richard Henderson Cc: Eduardo Habkost Cc: Marcel Apfelbaum Cc: Tom Lendacky Cc: Suravee Suthikulpanit ---

[Qemu-devel] [PATCH v4 3/9] x86_iommu/amd: remove V=1 check from amdvi_validate_dte()

2018-09-27 Thread Singh, Brijesh
Currently, the amdvi_validate_dte() assumes that a valid DTE will always have V=1. This is not true. The V=1 means that bit[127:1] are valid. A valid DTE can have IV=1 and V=0 (i.e address translation disabled and interrupt remapping enabled) Remove the V=1 check from amdvi_validate_dte(), make

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

2018-09-27 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 v4 1/9] x86_iommu: move the kernel-irqchip check in common code

2018-09-27 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

[Qemu-devel] [PATCH v4 4/9] x86_iommu/amd: make the address space naming consistent with intel-iommu

2018-09-27 Thread Singh, Brijesh
To be consistent with intel-iommu: - rename the address space to use '_' instead of '-' - update the memory region relationships Signed-off-by: Brijesh Singh Cc: Peter Xu Cc: "Michael S. Tsirkin" Cc: Paolo Bonzini Cc: Richard Henderson Cc: Eduardo Habkost Cc: Marcel Apfelbaum Cc: Tom

[Qemu-devel] [PATCH v4 5/9] x86_iommu/amd: Prepare for interrupt remap support

2018-09-27 Thread Singh, Brijesh
Register the interrupt remapping callback and read/write ops for the amd-iommu-ir memory region. amd-iommu-ir is set to higher priority to ensure that this region won't be masked out by other memory regions. Signed-off-by: Brijesh Singh Cc: Peter Xu Cc: "Michael S. Tsirkin" Cc: Paolo Bonzini

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

2018-09-27 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 v4 6/9] x86_iommu/amd: Add interrupt remap support when VAPIC is not enabled

2018-09-27 Thread Singh, Brijesh
Emulate the interrupt remapping support when guest virtual APIC is not enabled. For more info Refer: AMD IOMMU spec Rev 3.0 - section 2.2.5.1 When VAPIC is not enabled, it uses interrupt remapping as defined in Table 20 and Figure 15 from IOMMU spec. Signed-off-by: Brijesh Singh Cc: Peter Xu

Re: [Qemu-devel] [PATCH v4 6/9] x86_iommu/amd: Add interrupt remap support when VAPIC is not enabled

2018-09-28 Thread Singh, Brijesh
On 9/28/18 1:08 AM, Peter Xu wrote: > On Thu, Sep 27, 2018 at 04:45:59PM +0000, Singh, Brijesh wrote: > > [...] > >> +/* validate that we are configure with intremap=on */ >> +if (!X86_IOMMU_DEVICE(iommu)->intr_supported) { >> +error_repor

[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(+),

[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 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

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

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] [PATCH v2 5/8] x86_iommu/amd: Add interrupt remap support when VAPIC is not enabled

2018-09-18 Thread Singh, Brijesh
On 09/17/2018 10:53 PM, Peter Xu wrote: [...] >> IMHO we should not be using error_report_once() here. It's possible that >> guest OS have DTE[IV]=1 but has not programmed the interrupt >> remapping entries or have deactivated the remapping. I see that Linux >> OS does it all the time and in

Re: [Qemu-devel] [PATCH v2 5/8] x86_iommu/amd: Add interrupt remap support when VAPIC is not enabled

2018-09-18 Thread Singh, Brijesh
Small correction On 09/18/2018 03:27 PM, Singh, Brijesh wrote:> > So far non of the guests were enabling the interrupt remap features > even when it was available. As I explained in previous patches (see > patch 6), Linux guest looks for a special IOAPIC device in IVHD befor

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] [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

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] 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 >

[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 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] [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

[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: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] [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

[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 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 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 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 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

[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 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 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 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 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 ---

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

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 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 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] [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

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

[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 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 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 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

[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 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 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

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 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 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 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 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 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] [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 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] [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

  1   2   >