Re: [Qemu-devel] [QEMU] [PATCH v5 5/8] bootdevice: Gather LCHS from all relevant devices

2019-08-25 Thread Sam Eiderman via Qemu-devel
> Only scsi-hd has the lchs properties, though, so what’s the purpose of > defining the unrealize function for all other classes? > > Max - shmuel.eider...@oracle.com + sam...@google.com The only purpose is to already have them mapped to the correct existing function, in case it will be used late

Re: [Qemu-devel] [QEMU] [PATCH v5 4/8] scsi: Propagate unrealize() callback to scsi-hd

2019-08-25 Thread Sam Eiderman via Qemu-devel
> @@ -213,11 +221,18 @@ static void scsi_qdev_realize(DeviceState *qdev, Error > **errp) > static void scsi_qdev_unrealize(DeviceState *qdev, Error **errp) > { > SCSIDevice *dev = SCSI_DEVICE(qdev); > +Error *local_err = NULL; > > if (dev->vmsentry) { > qemu_del_vm_change_

Re: [Qemu-devel] [QEMU] [PATCH v5 3/8] bootdevice: Add interface to gather LCHS

2019-08-22 Thread Sam Eiderman via Qemu-devel
> I’ve got a couple of “undelivered mail returned to sender” mails for Sam > recently, but anyway... - shmuel.eider...@oracle.com + sam...@google.com > It doesn’t look like any caller actually passes a NULL @dev, so why not > drop the @suffix part? Just copied it from the bootindex implementatio

Re: [Qemu-devel] [QEMU] [PATCH v5 0/8] Add Qemu to SeaBIOS LCHS interface

2019-08-13 Thread Max Reitz
On 26.06.19 14:39, Sam Eiderman wrote: > v1: > > Non-standard logical geometries break under QEMU. > > A virtual disk which contains an operating system which depends on > logical geometries (consistent values being reported from BIOS INT13 > AH=08) will most likely break under QEMU/SeaBIOS if it

Re: [Qemu-devel] [QEMU] [PATCH v5 4/8] scsi: Propagate unrealize() callback to scsi-hd

2019-08-13 Thread Max Reitz
On 26.06.19 14:39, Sam Eiderman wrote: > We will need to add LCHS removal logic to scsi-hd's unrealize() in the > next commit. > > Reviewed-by: Karl Heubaum > Reviewed-by: Arbel Moshe > Signed-off-by: Sam Eiderman > --- > hw/scsi/scsi-bus.c | 15 +++ > include/hw/scsi/scsi.h |

Re: [Qemu-devel] [QEMU] [PATCH v5 5/8] bootdevice: Gather LCHS from all relevant devices

2019-08-13 Thread Max Reitz
On 26.06.19 14:39, Sam Eiderman wrote: > Relevant devices are: > * ide-hd (and ide-cd, ide-drive) > * scsi-hd (and scsi-cd, scsi-disk, scsi-block) > * virtio-blk-pci > > We do not call del_boot_device_lchs() for ide-* since we don't need to - > IDE block devices do not support unpluggi

Re: [Qemu-devel] [QEMU] [PATCH v5 3/8] bootdevice: Add interface to gather LCHS

2019-08-13 Thread Max Reitz
On 26.06.19 14:39, Sam Eiderman wrote: > Add an interface to provide direct logical CHS values for boot devices. > We will use this interface in the next commits. > > Reviewed-by: Karl Heubaum > Reviewed-by: Arbel Moshe > Signed-off-by: Sam Eiderman > --- > bootdevice.c| 55 >

Re: [Qemu-devel] [QEMU] [PATCH v5 0/8] Add Qemu to SeaBIOS LCHS interface

2019-07-19 Thread Sam Eiderman
Well, this patch introduces 3 command line parameters (“lcyls”, “lheads”, “lsecs”) to “scsi-hd” “ide-hd” and “virtio-pci-blk” so this somehow has something to do with block. This patch also adds fw_cfg interface to send these parameters to SeaBIOS. "scripts/get_maintainer.pl -f hw/nvram/fw_cfg.

Re: [Qemu-devel] [QEMU] [PATCH v5 0/8] Add Qemu to SeaBIOS LCHS interface

2019-07-17 Thread Kevin Wolf
Am 17.07.2019 um 21:03 hat Sam Eiderman geschrieben: > Gentle ping. Through which tree is this supposed to go? I feel this is more firmware interface related than block layer stuff. Kevin > > On 8 Jul 2019, at 20:30, Sam Eiderman wrote: > > > > Thanks Gerd, > > > > Gentle ping on this. > > >

Re: [Qemu-devel] [QEMU] [PATCH v5 0/8] Add Qemu to SeaBIOS LCHS interface

2019-07-17 Thread Sam Eiderman
Gentle ping. Sam > On 8 Jul 2019, at 20:30, Sam Eiderman wrote: > > Thanks Gerd, > > Gentle ping on this. > > Sam > >> On 1 Jul 2019, at 10:41, Gerd Hoffmann wrote: >> >> On Wed, Jun 26, 2019 at 03:39:40PM +0300, Sam Eiderman wrote: >>> v1: >>> >>> Non-standard logical geometries break un

Re: [Qemu-devel] [QEMU] [PATCH v5 0/8] Add Qemu to SeaBIOS LCHS interface

2019-07-08 Thread Sam Eiderman
Thanks Gerd, Gentle ping on this. Sam > On 1 Jul 2019, at 10:41, Gerd Hoffmann wrote: > > On Wed, Jun 26, 2019 at 03:39:40PM +0300, Sam Eiderman wrote: >> v1: >> >> Non-standard logical geometries break under QEMU. >> >> A virtual disk which contains an operating system which depends on >> l

Re: [Qemu-devel] [QEMU] [PATCH v5 0/8] Add Qemu to SeaBIOS LCHS interface

2019-07-01 Thread Gerd Hoffmann
On Wed, Jun 26, 2019 at 03:39:40PM +0300, Sam Eiderman wrote: > v1: > > Non-standard logical geometries break under QEMU. > > A virtual disk which contains an operating system which depends on > logical geometries (consistent values being reported from BIOS INT13 > AH=08) will most likely break u

[Qemu-devel] [QEMU] [PATCH v5 8/8] hd-geo-test: Add tests for lchs override

2019-06-26 Thread Sam Eiderman
Add QTest tests to check the logical geometry override option. The tests in hd-geo-test are out of date - they only test IDE and do not test interesting MBRs. I added a few helper functions which will make adding more tests easier. QTest's fw_cfg helper functions support only legacy fw_cfg, so I

[Qemu-devel] [QEMU] [PATCH v5 7/8] bootdevice: FW_CFG interface for LCHS values

2019-06-26 Thread Sam Eiderman
Using fw_cfg, supply logical CHS values directly from QEMU to the BIOS. Non-standard logical geometries break under QEMU. A virtual disk which contains an operating system which depends on logical geometries (consistent values being reported from BIOS INT13 AH=08) will most likely break under QEM

[Qemu-devel] [QEMU] [PATCH v5 5/8] bootdevice: Gather LCHS from all relevant devices

2019-06-26 Thread Sam Eiderman
Relevant devices are: * ide-hd (and ide-cd, ide-drive) * scsi-hd (and scsi-cd, scsi-disk, scsi-block) * virtio-blk-pci We do not call del_boot_device_lchs() for ide-* since we don't need to - IDE block devices do not support unplugging. Reviewed-by: Karl Heubaum Reviewed-by: Arbel Mo

[Qemu-devel] [QEMU] [PATCH v5 2/8] block: Support providing LCHS from user

2019-06-26 Thread Sam Eiderman
Add logical geometry variables to BlockConf. A user can now supply "lcyls", "lheads" & "lsecs" for any HD device that supports CHS ("cyls", "heads", "secs"). These devices include: * ide-hd * scsi-hd * virtio-blk-pci In future commits we will use the provided LCHS and pass it to the

[Qemu-devel] [QEMU] [PATCH v5 6/8] bootdevice: Refactor get_boot_devices_list

2019-06-26 Thread Sam Eiderman
Move device name construction to a separate function. We will reuse this function in the following commit to pass logical CHS parameters through fw_cfg much like we currently pass bootindex. Reviewed-by: Karl Heubaum Reviewed-by: Arbel Moshe Signed-off-by: Sam Eiderman --- bootdevice.c | 61 +

[Qemu-devel] [QEMU] [PATCH v5 0/8] Add Qemu to SeaBIOS LCHS interface

2019-06-26 Thread Sam Eiderman
v1: Non-standard logical geometries break under QEMU. A virtual disk which contains an operating system which depends on logical geometries (consistent values being reported from BIOS INT13 AH=08) will most likely break under QEMU/SeaBIOS if it has non-standard logical geometries - for example 56

[Qemu-devel] [QEMU] [PATCH v5 4/8] scsi: Propagate unrealize() callback to scsi-hd

2019-06-26 Thread Sam Eiderman
We will need to add LCHS removal logic to scsi-hd's unrealize() in the next commit. Reviewed-by: Karl Heubaum Reviewed-by: Arbel Moshe Signed-off-by: Sam Eiderman --- hw/scsi/scsi-bus.c | 15 +++ include/hw/scsi/scsi.h | 1 + 2 files changed, 16 insertions(+) diff --git a/hw/

[Qemu-devel] [QEMU] [PATCH v5 3/8] bootdevice: Add interface to gather LCHS

2019-06-26 Thread Sam Eiderman
Add an interface to provide direct logical CHS values for boot devices. We will use this interface in the next commits. Reviewed-by: Karl Heubaum Reviewed-by: Arbel Moshe Signed-off-by: Sam Eiderman --- bootdevice.c| 55 + include/sys

[Qemu-devel] [QEMU] [PATCH v5 1/8] block: Refactor macros - fix tabbing

2019-06-26 Thread Sam Eiderman
Fixing tabbing in block related macros. Reviewed-by: Karl Heubaum Reviewed-by: Arbel Moshe Signed-off-by: Sam Eiderman --- hw/ide/qdev.c| 2 +- include/hw/block/block.h | 16 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/hw/ide/qdev.c b/hw/ide/qde

Re: [Qemu-devel] [QEMU PATCH v4 0/10]: target/i386: kvm: Add support for save and restore of nested state

2019-06-20 Thread Liran Alon
> On 20 Jun 2019, at 15:38, Paolo Bonzini wrote: > > On 19/06/19 18:21, Liran Alon wrote: >> Hi, >> >> This series aims to add support for QEMU to be able to migrate VMs that >> are running nested hypervisors. In order to do so, it utilizes the new >> IOCTLs introduced in KVM commit 8fcc4b592

Re: [Qemu-devel] [QEMU PATCH v4 0/10]: target/i386: kvm: Add support for save and restore of nested state

2019-06-20 Thread Liran Alon
> On 20 Jun 2019, at 16:28, Liran Alon wrote: > > > >> On 20 Jun 2019, at 15:38, Paolo Bonzini wrote: >> >> On 19/06/19 18:21, Liran Alon wrote: >>> Hi, >>> >>> This series aims to add support for QEMU to be able to migrate VMs that >>> are running nested hypervisors. In order to do so, i

Re: [Qemu-devel] [QEMU PATCH v4 0/10]: target/i386: kvm: Add support for save and restore of nested state

2019-06-20 Thread Paolo Bonzini
On 19/06/19 18:21, Liran Alon wrote: > Hi, > > This series aims to add support for QEMU to be able to migrate VMs that > are running nested hypervisors. In order to do so, it utilizes the new > IOCTLs introduced in KVM commit 8fcc4b5923af ("kvm: nVMX: Introduce > KVM_CAP_NESTED_STATE") which was c

Re: [Qemu-devel] [QEMU] [PATCH v4 7/8] bootdevice: FW_CFG interface for LCHS values

2019-06-19 Thread Gerd Hoffmann
On Wed, Jun 19, 2019 at 12:29:04PM +0300, Sam Eiderman wrote: > Using fw_cfg, supply logical CHS values directly from QEMU to the BIOS. > > Non-standard logical geometries break under QEMU. > > A virtual disk which contains an operating system which depends on > logical geometries (consistent val

Re: [Qemu-devel] [QEMU PATCH v4 10/10] target/i386: kvm: Add nested migration blocker only when kernel lacks required capabilities

2019-06-19 Thread Maran Wilson
On 6/19/2019 9:21 AM, Liran Alon wrote: Previous commits have added support for migration of nested virtualization workloads. This was done by utilising two new KVM capabilities: KVM_CAP_NESTED_STATE and KVM_CAP_EXCEPTION_PAYLOAD. Both which are required in order to correctly migrate such workloa

Re: [Qemu-devel] [QEMU PATCH v4 06/10] linux-headers: i386: Modify struct kvm_nested_state to have explicit fields for data

2019-06-19 Thread Maran Wilson
On 6/19/2019 9:21 AM, Liran Alon wrote: Improve the KVM_{GET,SET}_NESTED_STATE structs by detailing the format of VMX nested state data in a struct. In order to avoid changing the ioctl values of KVM_{GET,SET}_NESTED_STATE, there is a need to preserve sizeof(struct kvm_nested_state). This is don

Re: [Qemu-devel] [QEMU PATCH v4 01/10] target/i386: kvm: Delete VMX migration blocker on vCPU init failure

2019-06-19 Thread Maran Wilson
On 6/19/2019 1:33 PM, Liran Alon wrote: On 19 Jun 2019, at 23:30, Maran Wilson wrote: On 6/19/2019 9:21 AM, Liran Alon wrote: Commit d98f26073beb ("target/i386: kvm: add VMX migration blocker") added migration blocker for vCPU exposed with Intel VMX because QEMU doesn't yet contain code to sup

Re: [Qemu-devel] [QEMU PATCH v4 01/10] target/i386: kvm: Delete VMX migration blocker on vCPU init failure

2019-06-19 Thread Liran Alon
> On 19 Jun 2019, at 23:30, Maran Wilson wrote: > > On 6/19/2019 9:21 AM, Liran Alon wrote: >> Commit d98f26073beb ("target/i386: kvm: add VMX migration blocker") >> added migration blocker for vCPU exposed with Intel VMX because QEMU >> doesn't yet contain code to support migration of nested

Re: [Qemu-devel] [QEMU PATCH v4 01/10] target/i386: kvm: Delete VMX migration blocker on vCPU init failure

2019-06-19 Thread Maran Wilson
On 6/19/2019 9:21 AM, Liran Alon wrote: Commit d98f26073beb ("target/i386: kvm: add VMX migration blocker") added migration blocker for vCPU exposed with Intel VMX because QEMU doesn't yet contain code to support migration of nested virtualization workloads. However, that commit missed adding de

Re: [Qemu-devel] [QEMU PATCH v4 07/10] vmstate: Add support for kernel integer types

2019-06-19 Thread Dr. David Alan Gilbert
* Liran Alon (liran.a...@oracle.com) wrote: > Reviewed-by: Nikita Leshenko > Reviewed-by: Maran Wilson > Signed-off-by: Liran Alon > --- > include/migration/vmstate.h | 26 ++ > 1 file changed, 26 insertions(+) > > diff --git a/include/migration/vmstate.h b/include/migr

[Qemu-devel] [QEMU PATCH v4 10/10] target/i386: kvm: Add nested migration blocker only when kernel lacks required capabilities

2019-06-19 Thread Liran Alon
Previous commits have added support for migration of nested virtualization workloads. This was done by utilising two new KVM capabilities: KVM_CAP_NESTED_STATE and KVM_CAP_EXCEPTION_PAYLOAD. Both which are required in order to correctly migrate such workloads. Therefore, change code to add a migra

[Qemu-devel] [QEMU PATCH v4 02/10] KVM: Introduce kvm_arch_destroy_vcpu()

2019-06-19 Thread Liran Alon
Simiar to how kvm_init_vcpu() calls kvm_arch_init_vcpu() to perform arch-dependent initialisation, introduce kvm_arch_destroy_vcpu() to be called from kvm_destroy_vcpu() to perform arch-dependent destruction. This was added because some architectures (Such as i386) currently do not free memory tha

[Qemu-devel] [QEMU PATCH v4 09/10] target/i386: kvm: Add support for KVM_CAP_EXCEPTION_PAYLOAD

2019-06-19 Thread Liran Alon
Kernel commit c4f55198c7c2 ("kvm: x86: Introduce KVM_CAP_EXCEPTION_PAYLOAD") introduced a new KVM capability which allows userspace to correctly distinguish between pending and injected exceptions. This distinguish is important in case of nested virtualization scenarios because a L2 pending except

[Qemu-devel] [QEMU PATCH v4 05/10] target/i386: kvm: Block migration for vCPUs exposed with nested virtualization

2019-06-19 Thread Liran Alon
Commit d98f26073beb ("target/i386: kvm: add VMX migration blocker") added a migration blocker for vCPU exposed with Intel VMX. However, migration should also be blocked for vCPU exposed with AMD SVM. Both cases should be blocked because QEMU should extract additional vCPU state from KVM that shoul

[Qemu-devel] [QEMU PATCH v4 08/10] target/i386: kvm: Add support for save and restore nested state

2019-06-19 Thread Liran Alon
Kernel commit 8fcc4b5923af ("kvm: nVMX: Introduce KVM_CAP_NESTED_STATE") introduced new IOCTLs to extract and restore vCPU state related to Intel VMX & AMD SVM. Utilize these IOCTLs to add support for migration of VMs which are running nested hypervisors. Reviewed-by: Nikita Leshenko Reviewed-by

[Qemu-devel] [QEMU PATCH v4 03/10] target/i386: kvm: Use symbolic constant for #DB/#BP exception constants

2019-06-19 Thread Liran Alon
Reviewed-by: Nikita Leshenko Reviewed-by: Krish Sadhukhan Signed-off-by: Liran Alon --- target/i386/kvm.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index efbecfc9d7f0..7b3b80833fdd 100644 --- a/target/i386/kvm.c +++ b/targe

[Qemu-devel] [QEMU PATCH v4 04/10] target/i386: kvm: Re-inject #DB to guest with updated DR6

2019-06-19 Thread Liran Alon
If userspace (QEMU) debug guest, when #DB is raised in guest and intercepted by KVM, KVM forwards information on #DB to userspace instead of injecting #DB to guest. While doing so, KVM don't update vCPU DR6 but instead report the #DB DR6 value to userspace for further handling. See KVM's handle_exc

[Qemu-devel] [QEMU PATCH v4 07/10] vmstate: Add support for kernel integer types

2019-06-19 Thread Liran Alon
Reviewed-by: Nikita Leshenko Reviewed-by: Maran Wilson Signed-off-by: Liran Alon --- include/migration/vmstate.h | 26 ++ 1 file changed, 26 insertions(+) diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index 9224370ed59a..ca68584eba4d 100644 ---

[Qemu-devel] [QEMU PATCH v4 01/10] target/i386: kvm: Delete VMX migration blocker on vCPU init failure

2019-06-19 Thread Liran Alon
Commit d98f26073beb ("target/i386: kvm: add VMX migration blocker") added migration blocker for vCPU exposed with Intel VMX because QEMU doesn't yet contain code to support migration of nested virtualization workloads. However, that commit missed adding deletion of the migration blocker in case in

[Qemu-devel] [QEMU PATCH v4 06/10] linux-headers: i386: Modify struct kvm_nested_state to have explicit fields for data

2019-06-19 Thread Liran Alon
Improve the KVM_{GET,SET}_NESTED_STATE structs by detailing the format of VMX nested state data in a struct. In order to avoid changing the ioctl values of KVM_{GET,SET}_NESTED_STATE, there is a need to preserve sizeof(struct kvm_nested_state). This is done by defining the data struct as "data.vmx

[Qemu-devel] [QEMU PATCH v4 0/10]: target/i386: kvm: Add support for save and restore of nested state

2019-06-19 Thread Liran Alon
Hi, This series aims to add support for QEMU to be able to migrate VMs that are running nested hypervisors. In order to do so, it utilizes the new IOCTLs introduced in KVM commit 8fcc4b5923af ("kvm: nVMX: Introduce KVM_CAP_NESTED_STATE") which was created for this purpose. 1st patch add a missed

[Qemu-devel] [QEMU] [PATCH v4 0/8] Add Qemu to SeaBIOS LCHS interface

2019-06-19 Thread Sam Eiderman
v1: Non-standard logical geometries break under QEMU. A virtual disk which contains an operating system which depends on logical geometries (consistent values being reported from BIOS INT13 AH=08) will most likely break under QEMU/SeaBIOS if it has non-standard logical geometries - for example 56

[Qemu-devel] [QEMU] [PATCH v4 7/8] bootdevice: FW_CFG interface for LCHS values

2019-06-19 Thread Sam Eiderman
Using fw_cfg, supply logical CHS values directly from QEMU to the BIOS. Non-standard logical geometries break under QEMU. A virtual disk which contains an operating system which depends on logical geometries (consistent values being reported from BIOS INT13 AH=08) will most likely break under QEM

[Qemu-devel] [QEMU] [PATCH v4 4/8] scsi: Propagate unrealize() callback to scsi-hd

2019-06-19 Thread Sam Eiderman
We will need to add LCHS removal logic to scsi-hd's unrealize() in the next commit. Reviewed-by: Karl Heubaum Reviewed-by: Arbel Moshe Signed-off-by: Sam Eiderman --- hw/scsi/scsi-bus.c | 15 +++ include/hw/scsi/scsi.h | 1 + 2 files changed, 16 insertions(+) diff --git a/hw/

[Qemu-devel] [QEMU] [PATCH v4 5/8] bootdevice: Gather LCHS from all relevant devices

2019-06-19 Thread Sam Eiderman
Relevant devices are: * ide-hd (and ide-cd, ide-drive) * scsi-hd (and scsi-cd, scsi-disk, scsi-block) * virtio-blk-pci We do not call del_boot_device_lchs() for ide-* since we don't need to - IDE block devices do not support unplugging. Reviewed-by: Karl Heubaum Reviewed-by: Arbel Mo

[Qemu-devel] [QEMU] [PATCH v4 3/8] bootdevice: Add interface to gather LCHS

2019-06-19 Thread Sam Eiderman
Add an interface to provide direct logical CHS values for boot devices. We will use this interface in the next commits. Reviewed-by: Karl Heubaum Reviewed-by: Arbel Moshe Signed-off-by: Sam Eiderman --- bootdevice.c| 55 + include/sys

[Qemu-devel] [QEMU] [PATCH v4 8/8] hd-geo-test: Add tests for lchs override

2019-06-19 Thread Sam Eiderman
Add QTest tests to check the logical geometry override option. The tests in hd-geo-test are out of date - they only test IDE and do not test interesting MBRs. I added a few helper functions which will make adding more tests easier. QTest's fw_cfg helper functions support only legacy fw_cfg, so I

[Qemu-devel] [QEMU] [PATCH v4 1/8] block: Refactor macros - fix tabbing

2019-06-19 Thread Sam Eiderman
Fixing tabbing in block related macros. Reviewed-by: Karl Heubaum Reviewed-by: Arbel Moshe Signed-off-by: Sam Eiderman --- hw/ide/qdev.c| 2 +- include/hw/block/block.h | 16 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/hw/ide/qdev.c b/hw/ide/qde

[Qemu-devel] [QEMU] [PATCH v4 2/8] block: Support providing LCHS from user

2019-06-19 Thread Sam Eiderman
Add logical geometry variables to BlockConf. A user can now supply "lcyls", "lheads" & "lsecs" for any HD device that supports CHS ("cyls", "heads", "secs"). These devices include: * ide-hd * scsi-hd * virtio-blk-pci In future commits we will use the provided LCHS and pass it to the

[Qemu-devel] [QEMU] [PATCH v4 6/8] bootdevice: Refactor get_boot_devices_list

2019-06-19 Thread Sam Eiderman
Move device name construction to a separate function. We will reuse this function in the following commit to pass logical CHS parameters through fw_cfg much like we currently pass bootindex. Reviewed-by: Karl Heubaum Reviewed-by: Arbel Moshe Signed-off-by: Sam Eiderman --- bootdevice.c | 61 +

Re: [Qemu-devel] [QEMU PATCH v3 7/9] KVM: i386: Add support for save and restore nested state

2019-06-18 Thread Maran Wilson
On 6/17/2019 10:56 AM, Liran Alon wrote: Kernel commit 8fcc4b5923af ("kvm: nVMX: Introduce KVM_CAP_NESTED_STATE") introduced new IOCTLs to extract and restore vCPU state related to Intel VMX & AMD SVM. Utilize these IOCTLs to add support for migration of VMs which are running nested hypervisors.

Re: [Qemu-devel] [QEMU PATCH v3 9/9] KVM: i386: Remove VMX migration blocker

2019-06-18 Thread Maran Wilson
On 6/17/2019 10:56 AM, Liran Alon wrote: This effectively reverts d98f26073beb ("target/i386: kvm: add VMX migration blocker"). This can now be done because previous commits added support for Intel VMX migration. AMD SVM migration is still blocked. This is because kernel KVM_CAP_{GET,SET}_NEST

Re: [Qemu-devel] [QEMU PATCH v3 1/9] KVM: Introduce kvm_arch_destroy_vcpu()

2019-06-18 Thread Maran Wilson
On 6/17/2019 10:56 AM, Liran Alon wrote: Simiar to how kvm_init_vcpu() calls kvm_arch_init_vcpu() to perform arch-dependent initialisation, introduce kvm_arch_destroy_vcpu() to be called from kvm_destroy_vcpu() to perform arch-dependent destruction. This was added because some architectures (Suc

Re: [Qemu-devel] [QEMU PATCH v3 5/9] linux-headers: i386: Modify struct kvm_nested_state to have explicit fields for data

2019-06-18 Thread Maran Wilson
On 6/17/2019 10:56 AM, Liran Alon wrote: Improve the KVM_{GET,SET}_NESTED_STATE structs by detailing the format of VMX nested state data in a struct. In order to avoid changing the ioctl values of KVM_{GET,SET}_NESTED_STATE, there is a need to preserve sizeof(struct kvm_nested_state). This is do

Re: [Qemu-devel] [QEMU PATCH v3 4/9] KVM: i386: Block migration for vCPUs exposed with nested virtualization

2019-06-18 Thread Maran Wilson
On 6/17/2019 10:56 AM, Liran Alon wrote: Commit d98f26073beb ("target/i386: kvm: add VMX migration blocker") added a migration blocker for vCPU exposed with Intel VMX. However, migration should also be blocked for vCPU exposed with AMD SVM. Both cases should be blocked because QEMU should extrac

Re: [Qemu-devel] [QEMU PATCH v3 6/9] vmstate: Add support for kernel integer types

2019-06-18 Thread Paolo Bonzini
On 18/06/19 17:42, Dr. David Alan Gilbert wrote: >>> Have you checked that builds OK on a non-Linux system? >> Hmm that’s a good point. No. :P > Worth a check if you can find one lying around :-) It does not, but it's a macro so it's enough to enclose the uses in #ifdef CONFIG_LINUX or CONFIG_KVM.

Re: [Qemu-devel] [QEMU PATCH v3 7/9] KVM: i386: Add support for save and restore nested state

2019-06-18 Thread Paolo Bonzini
On 18/06/19 17:48, Dr. David Alan Gilbert wrote: >> Currently, KVM folks (including myself), haven’t decided yet to expose >> vmcs12 struct layout to userspace but instead to still leave it opaque. >> The formal size of this size is VMCS12_SIZE (defined in kernel as 0x1000). I >> was wondering if

Re: [Qemu-devel] [QEMU PATCH v3 7/9] KVM: i386: Add support for save and restore nested state

2019-06-18 Thread Liran Alon
> On 18 Jun 2019, at 18:48, Dr. David Alan Gilbert wrote: > > * Liran Alon (liran.a...@oracle.com) wrote: >> >>> On 18 Jun 2019, at 12:03, Dr. David Alan Gilbert >>> wrote: >>> >>> * Liran Alon (liran.a...@oracle.com) wrote: +static const VMStateDescription vmstate_vmx_vmcs12 =

Re: [Qemu-devel] [QEMU PATCH v3 8/9] KVM: i386: Add support for KVM_CAP_EXCEPTION_PAYLOAD

2019-06-18 Thread Liran Alon
> On 18 Jun 2019, at 12:07, Dr. David Alan Gilbert wrote: > > * Liran Alon (liran.a...@oracle.com) wrote: >> Kernel commit c4f55198c7c2 ("kvm: x86: Introduce KVM_CAP_EXCEPTION_PAYLOAD") >> introduced a new KVM capability which allows userspace to correctly >> distinguish between pending and in

Re: [Qemu-devel] [QEMU PATCH v3 6/9] vmstate: Add support for kernel integer types

2019-06-18 Thread Dr. David Alan Gilbert
* Liran Alon (liran.a...@oracle.com) wrote: > > > > On 18 Jun 2019, at 11:55, Dr. David Alan Gilbert > > wrote: > > > > * Liran Alon (liran.a...@oracle.com) wrote: > >> Reviewed-by: Nikita Leshenko > >> Reviewed-by: Maran Wilson > >> Signed-off-by: Liran Alon > >> --- > >> include/migration

Re: [Qemu-devel] [QEMU PATCH v3 7/9] KVM: i386: Add support for save and restore nested state

2019-06-18 Thread Liran Alon
> On 18 Jun 2019, at 12:03, Dr. David Alan Gilbert wrote: > > * Liran Alon (liran.a...@oracle.com) wrote: >> >> +static const VMStateDescription vmstate_vmx_vmcs12 = { >> +.name = "cpu/kvm_nested_state/vmx/vmcs12", >> +.version_id = 1, >> +.minimum_version_id = 1, >> +.needed =

Re: [Qemu-devel] [QEMU PATCH v3 6/9] vmstate: Add support for kernel integer types

2019-06-18 Thread Liran Alon
> On 18 Jun 2019, at 11:55, Dr. David Alan Gilbert wrote: > > * Liran Alon (liran.a...@oracle.com) wrote: >> Reviewed-by: Nikita Leshenko >> Reviewed-by: Maran Wilson >> Signed-off-by: Liran Alon >> --- >> include/migration/vmstate.h | 18 ++ >> 1 file changed, 18 insertions(

Re: [Qemu-devel] [QEMU PATCH v3 7/9] KVM: i386: Add support for save and restore nested state

2019-06-18 Thread Dr. David Alan Gilbert
* Liran Alon (liran.a...@oracle.com) wrote: > > > On 18 Jun 2019, at 12:03, Dr. David Alan Gilbert > > wrote: > > > > * Liran Alon (liran.a...@oracle.com) wrote: > >> > >> +static const VMStateDescription vmstate_vmx_vmcs12 = { > >> + .name = "cpu/kvm_nested_state/vmx/vmcs12", > >> + .versio

Re: [Qemu-devel] [QEMU PATCH v3 8/9] KVM: i386: Add support for KVM_CAP_EXCEPTION_PAYLOAD

2019-06-18 Thread Dr. David Alan Gilbert
* Liran Alon (liran.a...@oracle.com) wrote: > Kernel commit c4f55198c7c2 ("kvm: x86: Introduce KVM_CAP_EXCEPTION_PAYLOAD") > introduced a new KVM capability which allows userspace to correctly > distinguish between pending and injected exceptions. > > This distinguish is important in case of neste

Re: [Qemu-devel] [QEMU PATCH v3 7/9] KVM: i386: Add support for save and restore nested state

2019-06-18 Thread Dr. David Alan Gilbert
* Liran Alon (liran.a...@oracle.com) wrote: > Kernel commit 8fcc4b5923af ("kvm: nVMX: Introduce KVM_CAP_NESTED_STATE") > introduced new IOCTLs to extract and restore vCPU state related to > Intel VMX & AMD SVM. > > Utilize these IOCTLs to add support for migration of VMs which are > running nested

Re: [Qemu-devel] [QEMU PATCH v3 6/9] vmstate: Add support for kernel integer types

2019-06-18 Thread Dr. David Alan Gilbert
* Liran Alon (liran.a...@oracle.com) wrote: > Reviewed-by: Nikita Leshenko > Reviewed-by: Maran Wilson > Signed-off-by: Liran Alon > --- > include/migration/vmstate.h | 18 ++ > 1 file changed, 18 insertions(+) > > diff --git a/include/migration/vmstate.h b/include/migration/vm

Re: [Qemu-devel] [QEMU PATCH v3 4/9] KVM: i386: Block migration for vCPUs exposed with nested virtualization

2019-06-18 Thread Dr. David Alan Gilbert
* Liran Alon (liran.a...@oracle.com) wrote: > Commit d98f26073beb ("target/i386: kvm: add VMX migration blocker") > added a migration blocker for vCPU exposed with Intel VMX. > However, migration should also be blocked for vCPU exposed with > AMD SVM. > > Both cases should be blocked because QEMU

[Qemu-devel] [QEMU PATCH v3 8/9] KVM: i386: Add support for KVM_CAP_EXCEPTION_PAYLOAD

2019-06-17 Thread Liran Alon
Kernel commit c4f55198c7c2 ("kvm: x86: Introduce KVM_CAP_EXCEPTION_PAYLOAD") introduced a new KVM capability which allows userspace to correctly distinguish between pending and injected exceptions. This distinguish is important in case of nested virtualization scenarios because a L2 pending except

[Qemu-devel] [QEMU PATCH v3 9/9] KVM: i386: Remove VMX migration blocker

2019-06-17 Thread Liran Alon
This effectively reverts d98f26073beb ("target/i386: kvm: add VMX migration blocker"). This can now be done because previous commits added support for Intel VMX migration. AMD SVM migration is still blocked. This is because kernel KVM_CAP_{GET,SET}_NESTED_STATE in case of AMD SVM is not implemen

[Qemu-devel] [QEMU PATCH v3 6/9] vmstate: Add support for kernel integer types

2019-06-17 Thread Liran Alon
Reviewed-by: Nikita Leshenko Reviewed-by: Maran Wilson Signed-off-by: Liran Alon --- include/migration/vmstate.h | 18 ++ 1 file changed, 18 insertions(+) diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index 9224370ed59a..a85424fb0483 100644 --- a/includ

[Qemu-devel] [QEMU PATCH v3 3/9] KVM: i386: Re-inject #DB to guest with updated DR6

2019-06-17 Thread Liran Alon
If userspace (QEMU) debug guest, when #DB is raised in guest and intercepted by KVM, KVM forwards information on #DB to userspace instead of injecting #DB to guest. While doing so, KVM don't update vCPU DR6 but instead report the #DB DR6 value to userspace for further handling. See KVM's handle_exc

[Qemu-devel] [QEMU PATCH v3 7/9] KVM: i386: Add support for save and restore nested state

2019-06-17 Thread Liran Alon
Kernel commit 8fcc4b5923af ("kvm: nVMX: Introduce KVM_CAP_NESTED_STATE") introduced new IOCTLs to extract and restore vCPU state related to Intel VMX & AMD SVM. Utilize these IOCTLs to add support for migration of VMs which are running nested hypervisors. Reviewed-by: Nikita Leshenko Signed-off-

[Qemu-devel] [QEMU PATCH v3 5/9] linux-headers: i386: Modify struct kvm_nested_state to have explicit fields for data

2019-06-17 Thread Liran Alon
Improve the KVM_{GET,SET}_NESTED_STATE structs by detailing the format of VMX nested state data in a struct. In order to avoid changing the ioctl values of KVM_{GET,SET}_NESTED_STATE, there is a need to preserve sizeof(struct kvm_nested_state). This is done by defining the data struct as "data.vmx

[Qemu-devel] [QEMU PATCH v3 4/9] KVM: i386: Block migration for vCPUs exposed with nested virtualization

2019-06-17 Thread Liran Alon
Commit d98f26073beb ("target/i386: kvm: add VMX migration blocker") added a migration blocker for vCPU exposed with Intel VMX. However, migration should also be blocked for vCPU exposed with AMD SVM. Both cases should be blocked because QEMU should extract additional vCPU state from KVM that shoul

[Qemu-devel] [QEMU PATCH v3 2/9] KVM: i386: Use symbolic constant for #DB/#BP exception constants

2019-06-17 Thread Liran Alon
Reviewed-by: Nikita Leshenko Reviewed-by: Krish Sadhukhan Signed-off-by: Liran Alon --- target/i386/kvm.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 29889aa6b001..738dd91ff3cc 100644 --- a/target/i386/kvm.c +++ b/targe

[Qemu-devel] [QEMU PATCH v3 0/9]: KVM: i386: Add support for save and restore of nested state

2019-06-17 Thread Liran Alon
Hi, This series aims to add support for QEMU to be able to migrate VMs that are running nested hypervisors. In order to do so, it utilizes the new IOCTLs introduced in KVM commit 8fcc4b5923af ("kvm: nVMX: Introduce KVM_CAP_NESTED_STATE") which was created for this purpose. 1st patch introduce kvm

[Qemu-devel] [QEMU PATCH v3 1/9] KVM: Introduce kvm_arch_destroy_vcpu()

2019-06-17 Thread Liran Alon
Simiar to how kvm_init_vcpu() calls kvm_arch_init_vcpu() to perform arch-dependent initialisation, introduce kvm_arch_destroy_vcpu() to be called from kvm_destroy_vcpu() to perform arch-dependent destruction. This was added because some architectures (Such as i386) currently do not free memory tha

Re: [Qemu-devel] [QEMU] [PATCH v2 7/8] bootdevice: FW_CFG interface for LCHS values

2019-06-17 Thread Sam Eiderman
> On 17 Jun 2019, at 17:48, Kevin O'Connor wrote: > > On Mon, Jun 17, 2019 at 10:36:54AM +0300, Sam Eiderman wrote: >> So overall, WDYT? >> Keep it extendible for a low price of ABI + “bootdevices” name. >> Or go strict and rename to “bios-geometries”? > > If we add another qemu to firmware i

[Qemu-devel] [QEMU] [PATCH v3 7/8] bootdevice: FW_CFG interface for LCHS values

2019-06-17 Thread Sam Eiderman
Using fw_cfg, supply logical CHS values directly from QEMU to the BIOS. Non-standard logical geometries break under QEMU. A virtual disk which contains an operating system which depends on logical geometries (consistent values being reported from BIOS INT13 AH=08) will most likely break under QEM

[Qemu-devel] [QEMU] [PATCH v3 4/8] scsi: Propagate unrealize() callback to scsi-hd

2019-06-17 Thread Sam Eiderman
We will need to add LCHS removal logic to scsi-hd's unrealize() in the next commit. Reviewed-by: Karl Heubaum Reviewed-by: Arbel Moshe Signed-off-by: Sam Eiderman --- hw/scsi/scsi-bus.c | 15 +++ include/hw/scsi/scsi.h | 1 + 2 files changed, 16 insertions(+) diff --git a/hw/

[Qemu-devel] [QEMU] [PATCH v3 0/8] Add Qemu to SeaBIOS LCHS interface

2019-06-17 Thread Sam Eiderman
v1: Non-standard logical geometries break under QEMU. A virtual disk which contains an operating system which depends on logical geometries (consistent values being reported from BIOS INT13 AH=08) will most likely break under QEMU/SeaBIOS if it has non-standard logical geometries - for example 56

[Qemu-devel] [QEMU] [PATCH v3 5/8] bootdevice: Gather LCHS from all relevant devices

2019-06-17 Thread Sam Eiderman
Relevant devices are: * ide-hd (and ide-cd, ide-drive) * scsi-hd (and scsi-cd, scsi-disk, scsi-block) * virtio-blk-pci We do not call del_boot_device_lchs() for ide-* since we don't need to - IDE block devices do not support unplugging. Reviewed-by: Karl Heubaum Reviewed-by: Arbel Mo

[Qemu-devel] [QEMU] [PATCH v3 2/8] block: Support providing LCHS from user

2019-06-17 Thread Sam Eiderman
Add logical geometry variables to BlockConf. A user can now supply "lcyls", "lheads" & "lsecs" for any HD device that supports CHS ("cyls", "heads", "secs"). These devices include: * ide-hd * scsi-hd * virtio-blk-pci In future commits we will use the provided LCHS and pass it to the

[Qemu-devel] [QEMU] [PATCH v3 1/8] block: Refactor macros - fix tabbing

2019-06-17 Thread Sam Eiderman
Fixing tabbing in block related macros. Reviewed-by: Karl Heubaum Reviewed-by: Arbel Moshe Signed-off-by: Sam Eiderman --- hw/ide/qdev.c| 2 +- include/hw/block/block.h | 16 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/hw/ide/qdev.c b/hw/ide/qde

[Qemu-devel] [QEMU] [PATCH v3 8/8] hd-geo-test: Add tests for lchs override

2019-06-17 Thread Sam Eiderman
Add QTest tests to check the logical geometry override option. The tests in hd-geo-test are out of date - they only test IDE and do not test interesting MBRs. I added a few helper functions which will make adding more tests easier. QTest's fw_cfg helper functions support only legacy fw_cfg, so I

[Qemu-devel] [QEMU] [PATCH v3 6/8] bootdevice: Refactor get_boot_devices_list

2019-06-17 Thread Sam Eiderman
Move device name construction to a separate function. We will reuse this function in the following commit to pass logical CHS parameters through fw_cfg much like we currently pass bootindex. Reviewed-by: Karl Heubaum Reviewed-by: Arbel Moshe Signed-off-by: Sam Eiderman --- bootdevice.c | 61 +

[Qemu-devel] [QEMU] [PATCH v3 3/8] bootdevice: Add interface to gather LCHS

2019-06-17 Thread Sam Eiderman
Add an interface to provide direct logical CHS values for boot devices. We will use this interface in the next commits. Reviewed-by: Karl Heubaum Reviewed-by: Arbel Moshe Signed-off-by: Sam Eiderman --- bootdevice.c| 55 + include/sys

Re: [Qemu-devel] [QEMU] [PATCH v2 7/8] bootdevice: FW_CFG interface for LCHS values

2019-06-17 Thread Kevin O'Connor
On Mon, Jun 17, 2019 at 10:36:54AM +0300, Sam Eiderman wrote: > So overall, WDYT? > Keep it extendible for a low price of ABI + “bootdevices” name. > Or go strict and rename to “bios-geometries”? If we add another qemu to firmware interface I think the interface should be documented. I also think

Re: [Qemu-devel] [QEMU] [PATCH v2 7/8] bootdevice: FW_CFG interface for LCHS values

2019-06-17 Thread Sam Eiderman
Ok, I’ll resubmit this patch series in v3, as well as v2 for SeaBIOS soon enough. * Change “bootdevices” to “bios-geometry”, and remove the struct size * Add cpu_to_le32 fix as Laszlo suggested or big endian hosts * Fix last qtest commit - automatic docker tester for some reason does not have qe

Re: [Qemu-devel] [QEMU] [PATCH v2 7/8] bootdevice: FW_CFG interface for LCHS values

2019-06-17 Thread Gerd Hoffmann
Hi, > Keep it extendible for a low price of ABI + “bootdevices” name. > Or go strict and rename to “bios-geometries”? The name should reflect what is in there, so "bios-geometries" looks better to me. I'd also keep it strict, unless we have at least a vague idea what might be a useful future e

Re: [Qemu-devel] [QEMU] [PATCH v2 0/8] Add Qemu to SeaBIOS LCHS interface

2019-06-17 Thread Sam Eiderman
> On 17 Jun 2019, at 9:50, Gerd Hoffmann wrote: > > Hi, > >>> Ok, given that seabios has no setup any manual configuration needs to be >>> done via qemu. >>> >>> But why do we need a new interface for that? IDE can pass the geometry >>> to the guest. virtio-blk has support too (VIRTIO_BL

Re: [Qemu-devel] [QEMU] [PATCH v2 7/8] bootdevice: FW_CFG interface for LCHS values

2019-06-17 Thread Sam Eiderman
> On 17 Jun 2019, at 10:20, Gerd Hoffmann wrote: > > Hi, > >> We serialize this information in a similar way to the "bootorder" >> interface. >> The fw_cfg entry is "bootdevices" and it serializes a struct. > > Why "bootdevices"? I'd suggest to use "geometry" or "lchs" instead. True, if w

Re: [Qemu-devel] [QEMU] [PATCH v2 7/8] bootdevice: FW_CFG interface for LCHS values

2019-06-17 Thread Gerd Hoffmann
Hi, > We serialize this information in a similar way to the "bootorder" > interface. > The fw_cfg entry is "bootdevices" and it serializes a struct. Why "bootdevices"? I'd suggest to use "geometry" or "lchs" instead. > At the moment the struct holds the values of logical CHS values but it > c

Re: [Qemu-devel] [QEMU] [PATCH v2 0/8] Add Qemu to SeaBIOS LCHS interface

2019-06-16 Thread Gerd Hoffmann
Hi, > > Ok, given that seabios has no setup any manual configuration needs to be > > done via qemu. > > > > But why do we need a new interface for that? IDE can pass the geometry > > to the guest. virtio-blk has support too (VIRTIO_BLK_F_GEOMETRY). > > Likewise scsi (MODE_PAGE_HD_GEOMETRY).

Re: [Qemu-devel] [QEMU] [PATCH v2 0/8] Add Qemu to SeaBIOS LCHS interface

2019-06-14 Thread Sam Eiderman
> On 14 Jun 2019, at 7:43, Gerd Hoffmann wrote: > > Hi, > >> Can there be a guest that will fail the MBR in such a way? Yes. >> Look at the following MBR partition table of a Windows XP guest in our >> production >> environment: >> >> Disk size in sectors: 16777216 >> >> Binary (only one

Re: [Qemu-devel] [QEMU] [PATCH v2 0/8] Add Qemu to SeaBIOS LCHS interface

2019-06-13 Thread Gerd Hoffmann
Hi, > Can there be a guest that will fail the MBR in such a way? Yes. > Look at the following MBR partition table of a Windows XP guest in our > production > environment: > > Disk size in sectors: 16777216 > > Binary (only one partition 16 bytes): 80 01 01 00 07 fe ff ff 3f 00 00 00 d5 > ea

Re: [Qemu-devel] [QEMU] [PATCH v2 0/8] Add Qemu to SeaBIOS LCHS interface

2019-06-13 Thread Sam Eiderman
> On 13 Jun 2019, at 12:38, Gerd Hoffmann wrote: > > Hi, > >> Yes they are pretty rare. >> Windows 2000 and Windows XP guests migrated from VMware to Qemu/KVM >> would not boot due to incorrect disk geometries (some had 32/56 spt instead >> of >> 56. Also number of heads was not entirely co

Re: [Qemu-devel] [QEMU] [PATCH v2 0/8] Add Qemu to SeaBIOS LCHS interface

2019-06-13 Thread Gerd Hoffmann
Hi, > Yes they are pretty rare. > Windows 2000 and Windows XP guests migrated from VMware to Qemu/KVM > would not boot due to incorrect disk geometries (some had 32/56 spt instead of > 56. Also number of heads was not entirely correct) Ok. > > Why? Asking the user to deal with the mess is pre

Re: [Qemu-devel] [QEMU] [PATCH v2 0/8] Add Qemu to SeaBIOS LCHS interface

2019-06-13 Thread Sam Eiderman
typo: ddb.geometry.biosCylinders = “83257” * Sam > On 13 Jun 2019, at 10:41, Sam Eiderman wrote: > > > >> On 12 Jun 2019, at 22:18, Gerd Hoffmann > > wrote: >> >> On Wed, Jun 12, 2019 at 04:30:03PM +0300, Sam Eiderman wrote: >>> >>> On 12 Jun 2019, at 16:06,

  1   2   3   4   5   6   7   8   >