[PATCH v3 16/19] i386: use global kvm_state in hyperv_enabled() check

2021-01-07 Thread Vitaly Kuznetsov
There is no need to use vCPU-specific kvm state in hyperv_enabled() check and we need to do that when feature expansion happens early, before vCPU specific KVM state is created. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions

[PATCH v3 12/19] i386: move eVMCS enablement to hyperv_init_vcpu()

2021-01-07 Thread Vitaly Kuznetsov
hyperv_expand_features() will be called before we create vCPU so evmcs enablement should go away. hyperv_init_vcpu() looks like the right place. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 60 ++- 1 file changed, 37 insertions(+), 23

[PATCH v3 10/19] i386: introduce hv_cpuid_cache

2021-01-07 Thread Vitaly Kuznetsov
ote, hv_cpuid_get_fw() is converted to using hv_cpuid_get_host() just to be removed later with Hyper-V specific feature words. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 109 ++ 1 file changed, 56 insertions(+), 53 deletions(-) diff --git a/target/i386/

[PATCH v3 18/19] i386: provide simple 'hv-default=on' option

2021-01-07 Thread Vitaly Kuznetsov
tion. Introduce a simple 'hv-default=on' CPU flag enabling all currently supported Hyper-V enlightenments. Later, when new enlightenments get implemented, compat_props mechanism will be used to disable them for legacy machine types, this will keep 'hv-default=on' configurations

[PATCH v3 17/19] i386: expand Hyper-V features during CPU feature expansion time

2021-01-07 Thread Vitaly Kuznetsov
can't use kvm_arch_get_supported_cpuid() as Hyper-V specific CPUID leaves intersect with KVM's. Note, early expansion will only happen when KVM supports system wide KVM_GET_SUPPORTED_HV_CPUID ioctl (KVM_CAP_SYS_HYPERV_CPUID). Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.c

[PATCH v3 11/19] i386: split hyperv_handle_properties() into hyperv_expand_features()/hyperv_fill_cpuids()

2021-01-07 Thread Vitaly Kuznetsov
The intention is to call hyperv_expand_features() early, before vCPUs are created and use the acquired data later when we set guest visible CPUID data. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 34 -- 1 file changed, 24 insertions(+), 10

[PATCH v3 15/19] i386: prefer system KVM_GET_SUPPORTED_HV_CPUID ioctl over vCPU's one

2021-01-07 Thread Vitaly Kuznetsov
KVM_GET_SUPPORTED_HV_CPUID was made a system wide ioctl which can be called prior to creating vCPUs and we are going to use that to expand Hyper-V cpu features early. Use it when it is supported by KVM. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 17 + 1 file

[PATCH v3 19/19] qtest/hyperv: Introduce a simple hyper-v test

2021-01-07 Thread Vitaly Kuznetsov
For the beginning, just test 'hv-default', 'hv-passthrough' and a couple of custom Hyper-V enlightenments configurations through QMP. Later, it would be great to complement this by checking CPUID values from within the guest. Signed-off-by: Vitaly Kuznetsov --- MAINTAINERS

[Qemu-devel] [PATCH 8/8] i386/kvm: add support for Direct Mode for Hyper-V synthetic timers

2019-03-29 Thread Vitaly Kuznetsov
Hyper-V on KVM can only use Synthetic timers with Direct Mode (opting for an interrupt instead of VMBus message). This new capability is only announced in KVM_GET_SUPPORTED_HV_CPUID. Signed-off-by: Vitaly Kuznetsov --- docs/hyperv.txt| 10 ++ target/i386/cpu.c | 1

[Qemu-devel] [PATCH 0/8] i386/kvm/hyper-v: refactor and implement 'hv-stimer-direct' and 'hv-all' enlightenments

2019-03-29 Thread Vitaly Kuznetsov
r-V synthetic timers enlightenment is only exposed through KVM_GET_SUPPORTED_HV_CPUID ioctl. Take the opportunity and re-implement the way we handle Hyper-V enlightenments in QEMU, add support for hv-stimer-direct and 'hv-all' pass-through mode, add missing dependencies between enlightenments. Vitaly

[Qemu-devel] [PATCH 6/8] i386/kvm: hv-stimer requires hv-time and hv-synic

2019-03-29 Thread Vitaly Kuznetsov
Synthetic timers operate in hv-time time and Windows won't use these without SynIC. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 9edf76e473..524ee28e9c 100644 --- a/target/i386/

[Qemu-devel] [PATCH 1/8] i386/kvm: add support for KVM_GET_SUPPORTED_HV_CPUID

2019-03-29 Thread Vitaly Kuznetsov
properties structure defining Hyper-V features, get_supported_hv_cpuid()/ get_supported_hv_cpuid_legacy() returning the supported CPUID set and a bit over-engineered hv_cpuid_check_and_set() which we will also be used to set cpu->hyperv_* properties for 'hv-all' mode. Signed-off-by: Vitaly

[Qemu-devel] [PATCH 3/8] i386/kvm: document existing Hyper-V enlightenments

2019-03-29 Thread Vitaly Kuznetsov
Currently, there is no doc describing hv-* CPU flags, people are encouraged to get the information from Microsoft Hyper-V Top Level Functional specification (TLFS). There is, however, a bit of QEMU specifics. Signed-off-by: Vitaly Kuznetsov --- docs/hyperv.txt | 180

[Qemu-devel] [PATCH 4/8] i386/kvm: implement 'hv-all' pass-through mode

2019-03-29 Thread Vitaly Kuznetsov
want to check them later (and we actually do for hv_runtime, hv_synic,...). 'hv-all' is a development only feature, a migration blocker is added to prevent issues while migrating between hosts with different feature sets. Signed-off-by: Vitaly Kuznetsov --- docs/hyperv.txt | 10

[Qemu-devel] [PATCH 5/8] i386/kvm: hv-evmcs requires hv-vapic

2019-03-29 Thread Vitaly Kuznetsov
Enlightened VMCS is enabled by writing to a field in VP assist page and these require virtual APIC. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index af45241adb..9edf76e473

[Qemu-devel] [PATCH 7/8] i386/kvm: hv-tlbflush/ipi require hv-vpindex

2019-03-29 Thread Vitaly Kuznetsov
The corresponding hypercalls require using VP indexes. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 524ee28e9c..976c1d570f 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c

[Qemu-devel] [PATCH 2/8] i386/kvm: move Hyper-V CPUID filling to hyperv_handle_properties()

2019-03-29 Thread Vitaly Kuznetsov
Let's consolidate Hyper-V features handling in hyperv_handle_properties(). The change is necessary to support pass-through 'hv-all' mode as we'll be just copying CPUIDs from KVM instead of filling them in. Signed-off-by: Vitaly Kuznetsov --- tar

Re: [Qemu-devel] [PATCH 4/8] i386/kvm: implement 'hv-all' pass-through mode

2019-03-29 Thread Vitaly Kuznetsov
"Dr. David Alan Gilbert" writes: > Yep, that's probably safest; although if you recorded the features used > in the migration stream you could check for those on the destination and > if they mismatch complain then. > There is no clear use-case for hv-all other than development at this moment; a

[Qemu-devel] [PATCH] ioapic: allow buggy guests mishandling level-triggered interrupts to make progress

2019-04-01 Thread Vitaly Kuznetsov
y irq delivery duringeoi broadcast") which describes a very similar issue. Steal the idea from the above mentioned commit for IOAPIC implementation in QEMU. SUCCESSIVE_IRQ_MAX_COUNT, delay and the comment are borrowed as well. Signed-off-by: Vitaly Kuznetsov --- hw/intc/ioapic.c

Re: [Qemu-devel] [PATCH] ioapic: allow buggy guests mishandling level-triggered interrupts to make progress

2019-04-01 Thread Vitaly Kuznetsov
Paolo Bonzini writes: > On 01/04/19 15:36, Vitaly Kuznetsov wrote: ... >> static void ioapic_set_irq(void *opaque, int vector, int level) >> { >> IOAPICCommonState *s = opaque; >> @@ -227,7 +236,28 @@ void ioapic_eoi_broadcast(int vector) >>

Re: [Qemu-devel] [PATCH] ioapic: allow buggy guests mishandling level-triggered interrupts to make progress

2019-04-01 Thread Vitaly Kuznetsov
Liran Alon writes: >> On 1 Apr 2019, at 16:36, Vitaly Kuznetsov wrote: >> >> It was found that Hyper-V 2016 on KVM in some configurations (q35 machine + >> piix4-usb-uhci) hangs on boot. Trace analysis led us to the conclusion that >> it is mishandling level-trig

Re: [Qemu-devel] [PATCH] ioapic: allow buggy guests mishandling level-triggered interrupts to make progress

2019-04-01 Thread Vitaly Kuznetsov
Liran Alon writes: >> On 1 Apr 2019, at 18:58, Vitaly Kuznetsov wrote: >> >> Liran Alon writes: >> >>>> On 1 Apr 2019, at 16:36, Vitaly Kuznetsov wrote: >>>> >>>> It was found that Hyper-V 2016 on KVM in some configurations (q35

[Qemu-devel] [PATCH v2] ioapic: allow buggy guests mishandling level-triggered interrupts to make progress

2019-04-02 Thread Vitaly Kuznetsov
ngeoi broadcast") which describes a very similar issue. Steal the idea from the above mentioned commit for IOAPIC implementation in QEMU. SUCCESSIVE_IRQ_MAX_COUNT, delay and the comment are borrowed as well. Signed-off-by: Vitaly Kuznetsov --- Changes since v1: - timer_mod() -> timer_m

Re: [Qemu-devel] [PATCH 3/8] i386/kvm: document existing Hyper-V enlightenments

2019-04-05 Thread Vitaly Kuznetsov
Roman Kagan writes: > On Fri, Mar 29, 2019 at 03:18:27PM +0100, Vitaly Kuznetsov wrote: >> Currently, there is no doc describing hv-* CPU flags, people are >> encouraged to get the information from Microsoft Hyper-V Top Level >> Functional specification (TLFS). There is, h

Re: [Qemu-devel] [PATCH 4/8] i386/kvm: implement 'hv-all' pass-through mode

2019-04-05 Thread Vitaly Kuznetsov
Roman Kagan writes: > On Fri, Mar 29, 2019 at 03:18:28PM +0100, Vitaly Kuznetsov wrote: >> In many case we just want to give Windows guests all currently supported >> Hyper-V enlightenments and that's where this new mode may come handy. We >> pass th

Re: [Qemu-devel] [PATCH v2 2/9] i386/kvm: add support for KVM_GET_SUPPORTED_HV_CPUID

2019-05-27 Thread Vitaly Kuznetsov
Roman Kagan writes: > On Fri, May 17, 2019 at 04:19:17PM +0200, Vitaly Kuznetsov wrote: >> KVM now supports reporting supported Hyper-V features through CPUID >> (KVM_GET_SUPPORTED_HV_CPUID ioctl). Going forward, this is going to be >> the only way to announce new funct

Re: [Qemu-devel] [PATCH v2 2/9] i386/kvm: add support for KVM_GET_SUPPORTED_HV_CPUID

2019-05-31 Thread Vitaly Kuznetsov
Roman Kagan writes: > On Mon, May 27, 2019 at 06:39:53PM +0200, Vitaly Kuznetsov wrote: >> Roman Kagan writes: >> > On Fri, May 17, 2019 at 04:19:17PM +0200, Vitaly Kuznetsov wrote: >> >> +static struct kvm_cpuid2 *try_get_hv_cpuid(CPUState *cs, int max) >>

[Qemu-devel] [Bug 1813165] Re: KVM internal error. Suberror: 1 emulation failure

2019-02-20 Thread Vitaly Kuznetsov
Thomas, Albert, David, I'm having hard times trying to reproduce the issue in my environment; could you please provide your qemu command lines for both L0 and L1? It would also be great if you could try to come up with some 'minimal' configuration (my guess is that in L1 having just "qemu-system-x

[Qemu-devel] [Bug 1813165] Re: KVM internal error. Suberror: 1 emulation failure

2019-02-20 Thread Vitaly Kuznetsov
Thank you David, I see the issue now. -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1813165 Title: KVM internal error. Suberror: 1 emulation failure Status in QEMU: New Bug description: Hello

[Qemu-devel] [Bug 1813165] Re: KVM internal error. Suberror: 1 emulation failure

2019-02-22 Thread Vitaly Kuznetsov
I sent a patch which is supposed to fix the issue: https://marc.info/?l=kvm&m=155085391830663&w=2 it would be great if someone could give it a spin! -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1813

Re: [Qemu-devel] [PATCH RFC 0/8] i386/kvm/hyper-v: refactor and implement 'hv-stimer-direct' and 'hv-all' enlightenments

2019-02-02 Thread Vitaly Kuznetsov
no-re...@patchew.org writes: > === OUTPUT BEGIN === > 1/8 Checking commit 345a0718e21e (Update linux headers (5.0-rc2)) > WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? > #1646: > new file mode 100644 > > ERROR: code indent should never use tabs > #3980: FILE: scripts/u

[Qemu-devel] [PATCH v2 6/9] i386/kvm: hv-stimer requires hv-time and hv-synic

2019-05-17 Thread Vitaly Kuznetsov
Synthetic timers operate in hv-time time and Windows won't use these without SynIC. Add .dependencies field to kvm_hyperv_properties[] and a generic mechanism to check dependencies between features. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm.c | 23 +++ 1

[Qemu-devel] [PATCH v2 0/9] i386/kvm/hyper-v: refactor and implement 'hv-stimer-direct' and 'hv-passthrough' enlightenments

2019-05-17 Thread Vitaly Kuznetsov
oduced Direct Mode for Hyper-V synthetic timers enlightenment is only exposed through KVM_GET_SUPPORTED_HV_CPUID ioctl. Take the opportunity and re-implement the way we handle Hyper-V enlightenments in QEMU, add support for hv-stimer-direct and 'hv-all' pass-through mode, add missing depe

[Qemu-devel] [PATCH v2 7/9] i386/kvm: hv-tlbflush/ipi require hv-vpindex

2019-05-17 Thread Vitaly Kuznetsov
The corresponding hypercalls require using VP indexes. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index d8b83031a5..7fc97b749e 100644 --- a/target/i386/kvm.c +++ b/target

[Qemu-devel] [PATCH v2 3/9] i386/kvm: move Hyper-V CPUID filling to hyperv_handle_properties()

2019-05-17 Thread Vitaly Kuznetsov
Let's consolidate Hyper-V features handling in hyperv_handle_properties(). The change is necessary to support 'hv-passthrough' mode as we'll be just copying CPUIDs from KVM instead of filling them in. Signed-off-by: Vitaly Kuznetsov --- tar

[Qemu-devel] [PATCH v2 2/9] i386/kvm: add support for KVM_GET_SUPPORTED_HV_CPUID

2019-05-17 Thread Vitaly Kuznetsov
properties structure defining Hyper-V features, get_supported_hv_cpuid()/ get_supported_hv_cpuid_legacy() returning the supported CPUID set and a bit over-engineered hv_cpuid_check_and_set() which we will also be used to set cpu->hyperv_* properties for 'hv-all' mode. Signed-off-by: Vitaly

[Qemu-devel] [PATCH v2 1/9] i386/kvm: convert hyperv enlightenments properties from bools to bits

2019-05-17 Thread Vitaly Kuznetsov
Representing Hyper-V properties as bits will allow us to check features and dependencies between them in a natural way. Suggested-by: Roman Kagan Signed-off-by: Vitaly Kuznetsov --- hw/i386/pc.c | 3 +- target/i386/cpu.c | 44 +++ target/i386/cpu.h | 37

[Qemu-devel] [PATCH v2 5/9] i386/kvm: implement 'hv-passthrough' mode

2019-05-17 Thread Vitaly Kuznetsov
want to check them later (and we actually do for hv_runtime, hv_synic,...). 'hv-passthrough' is a development only feature, a migration blocker is added to prevent issues while migrating between hosts with different feature sets. Signed-off-by: Vitaly Kuznetsov --- docs/hyperv.txt |

[Qemu-devel] [PATCH v2 8/9] i386/kvm: hv-evmcs requires hv-vapic

2019-05-17 Thread Vitaly Kuznetsov
Enlightened VMCS is enabled by writing to a field in VP assist page and these require virtual APIC. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 7fc97b749e..7ae2f63f72

[Qemu-devel] [PATCH v2 4/9] i386/kvm: document existing Hyper-V enlightenments

2019-05-17 Thread Vitaly Kuznetsov
Currently, there is no doc describing hv-* CPU flags, people are encouraged to get the information from Microsoft Hyper-V Top Level Functional specification (TLFS). There is, however, a bit of QEMU specifics. Signed-off-by: Vitaly Kuznetsov --- docs/hyperv.txt | 181

[Qemu-devel] [PATCH v2 9/9] i386/kvm: add support for Direct Mode for Hyper-V synthetic timers

2019-05-17 Thread Vitaly Kuznetsov
Hyper-V on KVM can only use Synthetic timers with Direct Mode (opting for an interrupt instead of VMBus message). This new capability is only announced in KVM_GET_SUPPORTED_HV_CPUID. Signed-off-by: Vitaly Kuznetsov --- docs/hyperv.txt| 10 ++ target/i386/cpu.c | 2

[Qemu-devel] [PATCH v2] i386: Enable NPT and NRIPSAVE for AMD CPUs

2019-01-21 Thread Vitaly Kuznetsov
5 and EPYC/EPYC-IBPB cpu models. Signed-off-by: Vitaly Kuznetsov --- Changes since v1: - add npt=off,nrip-save=off to pc_compat_3_1 [Eduardo Habkost] --- hw/i386/pc.c | 8 target/i386/cpu.c | 8 2 files changed, 16 insertions(+) diff --git a/hw/i386/pc.c b/hw/i386/pc.c

[Qemu-devel] [PATCH RFC 1/8] Update linux headers (5.0-rc2)

2019-01-25 Thread Vitaly Kuznetsov
Signed-off-by: Vitaly Kuznetsov --- include/standard-headers/drm/drm_fourcc.h | 63 + include/standard-headers/linux/ethtool.h | 19 +- .../linux/input-event-codes.h | 19 + include/standard-headers/linux/pci_regs.h |1 + .../standard-headers/linux

[Qemu-devel] [PATCH RFC 4/8] i386/kvm: Implement 'hv-all' pass-through mode

2019-01-25 Thread Vitaly Kuznetsov
want to check them later (and we actually do for hv_runtime, hv_synic,...). Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.c | 1 + target/i386/cpu.h | 1 + target/i386/kvm.c | 133 -- 3 files changed, 107 insertions(+), 28 deletions(-) diff

[Qemu-devel] [PATCH RFC 7/8] i386/kvm: hv-tlbflush/ipi require hv-vpindex

2019-01-25 Thread Vitaly Kuznetsov
The corresponding hypercalls require using VP indexes. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 7461bf05dd..14d74ca9c7 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c

[Qemu-devel] [PATCH RFC 6/8] i386/kvm: hv-stimer requires hv-time and hv-synic

2019-01-25 Thread Vitaly Kuznetsov
Synthetic timers operate in hv-time time and Windows won't use these without SynIC. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 674c5dc185..7461bf05dd 100644 --- a/target/i386/

[Qemu-devel] [PATCH RFC 0/8] i386/kvm/hyper-v: refactor and implement 'hv-stimer-direct' and 'hv-all' enlightenments

2019-01-25 Thread Vitaly Kuznetsov
could've kept QEMU filling in signature, vendor,... but we take CPUIDs passed by KVM 'as-is'. Vitaly Kuznetsov (8): Update linux headers (5.0-rc2) i386/kvm: add support for KVM_GET_SUPPORTED_HV_CPUID i386/kvm: move Hyper-V CPUID filling to hyperv_handle_properties() i386/kvm: Im

[Qemu-devel] [PATCH RFC 2/8] i386/kvm: add support for KVM_GET_SUPPORTED_HV_CPUID

2019-01-25 Thread Vitaly Kuznetsov
properties structure defining Hyper-V features, get_supported_hv_cpuid()/ get_supported_hv_cpuid_legacy() returning the supported CPUID set and a bit over-engineered hv_cpuid_check_and_set() which we will also be used to set cpu->hyperv_* properties for 'hv-all' mode. Signed-off-by: Vitaly

[Qemu-devel] [PATCH RFC 3/8] i386/kvm: move Hyper-V CPUID filling to hyperv_handle_properties()

2019-01-25 Thread Vitaly Kuznetsov
Let's consolidate Hyper-V features handling in hyperv_handle_properties(). The change is necessary to support pass-through 'hv-all' mode as we'll be just copying CPUIDs from KVM instead of filling them in. Signed-off-by: Vitaly Kuznetsov --- tar

[Qemu-devel] [PATCH RFC 5/8] i386/kvm: hv-evmcs requires hv-vapic

2019-01-25 Thread Vitaly Kuznetsov
Enlightened VMCS is enabled by writing to a field in VP assist page and these require virtual APIC. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index b373b4ac06..674c5dc185

[Qemu-devel] [PATCH RFC 8/8] i386/kvm: add support for Direct Mode for Hyper-V synthetic timers

2019-01-25 Thread Vitaly Kuznetsov
Hyper-V on KVM can only use Synthetic timers with Direct Mode (opting for an interrupt instead of VMBus message). This new capability is only announced in KVM_GET_SUPPORTED_HV_CPUID. Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.c | 1 + target/i386/cpu.h | 1 + target

Re: [Qemu-devel] [PATCH RFC 4/8] i386/kvm: Implement 'hv-all' pass-through mode

2019-01-25 Thread Vitaly Kuznetsov
Roman Kagan writes: > On Fri, Jan 25, 2019 at 12:41:51PM +0100, Vitaly Kuznetsov wrote: >> In many case we just want to give Windows guests all currently supported >> Hyper-V enlightenments and that's where this new mode may come handy. We >> pass th

Re: [Qemu-devel] [PATCH RFC 4/8] i386/kvm: Implement 'hv-all' pass-through mode

2019-01-28 Thread Vitaly Kuznetsov
Roman Kagan writes: > On Fri, Jan 25, 2019 at 02:46:42PM +0100, Vitaly Kuznetsov wrote: >> Roman Kagan writes: >> >> > On Fri, Jan 25, 2019 at 12:41:51PM +0100, Vitaly Kuznetsov wrote: >> >> In many case we just want to give Windows guests all currently su

Re: [Qemu-devel] [PATCH RFC 4/8] i386/kvm: Implement 'hv-all' pass-through mode

2019-01-29 Thread Vitaly Kuznetsov
Eduardo Habkost writes: > > If libvirt is involved, it's much simpler and safer to use > something like , which generates a > migration-safe CPU configuration based on the current host. Live > migration support with "-cpu host" is only useful for experiments > and carefully controlled environmen

Re: [Qemu-devel] [PATCH RFC 4/8] i386/kvm: Implement 'hv-all' pass-through mode

2019-01-29 Thread Vitaly Kuznetsov
"Dr. David Alan Gilbert" writes: > I'm not sure what the equivalent bear traps are in the Hyper-V world, > but I'd be surprised if there weren't any; for example what happens > when someone upgrades one of their hosts to some minor version that > adds/removes a feature? Here we're talking about

[PATCH] target/i386: support KVM_FEATURE_ASYNC_PF_INT

2020-09-08 Thread Vitaly Kuznetsov
"KVM: x86: Switch KVM guest to using interrupts for page ready APF delivery"). The feature has a new KVM_FEATURE_ASYNC_PF_INT bit assigned and the interrupt vector is set in MSR_KVM_ASYNC_PF_INT MSR. Support this in QEMU. Signed-off-by: Vitaly Kuznetsov --- - Note, Linux-5.9-rc4 is curre

Re: [PATCH] target/i386: support KVM_FEATURE_ASYNC_PF_INT

2020-09-29 Thread Vitaly Kuznetsov
Paolo Bonzini writes: > On 12/09/20 08:02, Paolo Bonzini wrote: >> @@ -4209,6 +4209,7 @@ static PropValue kvm_default_props[] = { >> { "kvmclock", "on" }, >> { "kvm-nopiodelay", "on" }, >> { "kvm-asyncpf", "on" }, >> +{ "kvm-asyncpf-int", "on" }, >> { "kvm-steal-time", "on

Re: [BUG] Migration hv_time rollback

2020-09-16 Thread Vitaly Kuznetsov
"Dr. David Alan Gilbert" writes: > cc'ing in Vitaly who knows about the hv stuff. > cc'ing Marcelo who knows about clocksources :-) > * Antoine Damhet (antoine.dam...@blade-group.com) wrote: >> Hi, >> >> We are experiencing timestamp rollbacks during live-migration of >> Windows 10 guests Are

Re: [BUG] Migration hv_time rollback

2020-09-16 Thread Vitaly Kuznetsov
Antoine Damhet writes: > On Wed, Sep 16, 2020 at 12:29:56PM +0100, Dr. David Alan Gilbert wrote: >> cc'ing in Vitaly who knows about the hv stuff. > > Thanks > >> >> * Antoine Damhet (antoine.dam...@blade-group.com) wrote: >> > Hi, >> > >> > We are experiencing timestamp rollbacks during live-m

Re: [BUG] Migration hv_time rollback

2020-09-16 Thread Vitaly Kuznetsov
Vitaly Kuznetsov writes: > Antoine Damhet writes: > >> On Wed, Sep 16, 2020 at 12:29:56PM +0100, Dr. David Alan Gilbert wrote: >>> cc'ing in Vitaly who knows about the hv stuff. >> >> Thanks >> >>> >>> * Antoine Damhet (antoin

Re: [BUG] Migration hv_time rollback

2020-09-16 Thread Vitaly Kuznetsov
Paolo Bonzini writes: > On 16/09/20 13:29, Dr. David Alan Gilbert wrote: >>> I have tracked the bug to the fact that `kvmclock` is not exposed and >>> disabled from qemu PoV but is in fact used by `hv-time` (in KVM). >>> >>> I think we should enable the `kvmclock` (qemu device) if `hv-time` is >>

[PATCH] target/i386: Fix VM migration when interrupt based APF is enabled

2020-09-17 Thread Vitaly Kuznetsov
before MSR_KVM_ASYNC_PF_INT is set and this violates the check in KVM. Re-order MSR_KVM_ASYNC_PF_EN/MSR_KVM_ASYNC_PF_INT setting (and kvm_get_msrs() for consistency) and fix the typo. Signed-off-by: Vitaly Kuznetsov --- This fixes queued but not yet pushed to git commit "target/i386: su

[PATCH] target/i386: always create kvmclock device

2020-09-17 Thread Vitaly Kuznetsov
eck instead of CPUID feature bits. Reported-by: Antoine Damhet Suggested-by: Paolo Bonzini Signed-off-by: Vitaly Kuznetsov --- hw/i386/kvm/clock.c| 6 +- target/i386/kvm.c | 5 + target/i386/kvm_i386.h | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/hw/i386/k

Re: [PATCH] target/i386: always create kvmclock device

2020-09-17 Thread Vitaly Kuznetsov
no-re...@patchew.org writes: > Patchew URL: > https://patchew.org/QEMU/20200917111306.819263-1-vkuzn...@redhat.com/ > > > > Hi, > > This series seems to have some coding style problems. See output below for > more information: > > N/A. Internal error while reading log file error: copy-fd: write

Re: [PATCH] target/i386: always create kvmclock device

2020-09-17 Thread Vitaly Kuznetsov
Antoine Damhet writes: > On Thu, Sep 17, 2020 at 01:13:06PM +0200, Vitaly Kuznetsov wrote: >> QEMU's kvmclock device is only created when KVM PV feature bits for >> kvmclock (KVM_FEATURE_CLOCKSOURCE/KVM_FEATURE_CLOCKSOURCE2) are >> exposed to the guest. With 'kvm=

Re: [PATCH] target/i386: always create kvmclock device

2020-09-17 Thread Vitaly Kuznetsov
"Dr. David Alan Gilbert" writes: > * Vitaly Kuznetsov (vkuzn...@redhat.com) wrote: >> Antoine Damhet writes: >> >> > On Thu, Sep 17, 2020 at 01:13:06PM +0200, Vitaly Kuznetsov wrote: >> >> QEMU's kvmclock device is only

Re: [PATCH RFC 03/22] i386: move hyperv_vendor_id initialization to x86_cpu_realizefn()

2020-09-22 Thread Vitaly Kuznetsov
Eduardo Habkost writes: > On Fri, Sep 04, 2020 at 04:54:12PM +0200, Vitaly Kuznetsov wrote: >> As a preparation to expanding Hyper-V CPU features early, move >> hyperv_vendor_id initialization to x86_cpu_realizefn(). >> >> Signed-off-by: Vitaly Kuznetsov >&g

Re: [PATCH RFC 09/22] i386: add reserved FEAT_HYPERV_ECX CPUID leaf

2020-09-22 Thread Vitaly Kuznetsov
Eduardo Habkost writes: > On Fri, Sep 04, 2020 at 04:54:18PM +0200, Vitaly Kuznetsov wrote: >> As a preparation to expanding Hyper-V CPU features early, add >> reserved FEAT_HYPERV_ECX CPUID leaf. >> >> Signed-off-by: Vitaly Kuznetsov >> --- >> targ

Re: [PATCH RFC 12/22] i386: always fill Hyper-V CPUID feature leaves from X86CPU data

2020-09-22 Thread Vitaly Kuznetsov
Eduardo Habkost writes: > On Fri, Sep 04, 2020 at 04:54:21PM +0200, Vitaly Kuznetsov wrote: >> We have all the required data in X86CPU already and as we are about to >> split hyperv_handle_properties() into hyperv_expand_features()/ >> hyperv_fill_cpuids() we can remov

Re: [PATCH RFC 22/22] i386: expand Hyper-V features early

2020-09-22 Thread Vitaly Kuznetsov
Eduardo Habkost writes: > On Fri, Sep 04, 2020 at 04:54:31PM +0200, Vitaly Kuznetsov wrote: >> To make Hyper-V features appear in e.g. QMP query-cpu-model-expansion we >> need to expand and set the corresponding CPUID leaves early. Modify >> x86_cpu_get_supported_feature

Re: [PATCH RFC 22/22] i386: expand Hyper-V features early

2020-09-22 Thread Vitaly Kuznetsov
Eduardo Habkost writes: > On Fri, Sep 04, 2020 at 04:54:31PM +0200, Vitaly Kuznetsov wrote: >> To make Hyper-V features appear in e.g. QMP query-cpu-model-expansion we >> need to expand and set the corresponding CPUID leaves early. Modify >> x86_cpu_get_supported_feature

Re: [PATCH] target/i386: always create kvmclock device

2020-09-22 Thread Vitaly Kuznetsov
"Dr. David Alan Gilbert" writes: > * Antoine Damhet (antoine.dam...@blade-group.com) wrote: >> On Thu, Sep 17, 2020 at 06:44:10PM +0100, Dr. David Alan Gilbert wrote: >> >> [...] >> >> > > >> > >> > > >> > Shouldn't the old check used when machine type <= 5.1 in order to >> > > >> > avoid >> >

[PATCH v2] target/i386: always create kvmclock device

2020-09-22 Thread Vitaly Kuznetsov
eck instead of CPUID feature bits. Reported-by: Antoine Damhet Suggested-by: Paolo Bonzini Signed-off-by: Vitaly Kuznetsov --- hw/i386/kvm/clock.c| 7 +-- hw/i386/microvm.c | 2 +- hw/i386/pc.c | 1 + hw/i386/pc_piix.c | 7 +-- hw/i386/pc_q35.c | 5 -

Re: [PATCH] i386: Don't try to set MSR_KVM_ASYNC_PF_EN if kernel-irqchip=off

2020-09-22 Thread Vitaly Kuznetsov
Eduardo Habkost writes: > This addresses the following crash when running Linux v5.8 > with kernel-irqchip=off: > > qemu-system-x86_64: error: failed to set MSR 0x4b564d02 to 0x0 > qemu-system-x86_64: ../target/i386/kvm.c:2714: kvm_buf_set_msrs: Assertion > `ret == cpu->kvm_msr_buf->nmsrs' f

[Bug 1896263] Re: [PATCH] i386: Don't try to set MSR_KVM_ASYNC_PF_EN if kernel-irqchip=off

2020-09-22 Thread Vitaly Kuznetsov
Eduardo Habkost writes: > On Tue, Sep 22, 2020 at 05:38:12PM +0200, Vitaly Kuznetsov wrote: >> Eduardo Habkost writes: >> >> > This addresses the following crash when running Linux v5.8 >> > with kernel-irqchip=off: >> > >> > qemu-system

Re: [PATCH RFC] memory: pause all vCPUs for the duration of memory transactions

2020-11-03 Thread Vitaly Kuznetsov
Peter Xu writes: > Vitaly, > > On Mon, Oct 26, 2020 at 09:49:16AM +0100, Vitaly Kuznetsov wrote: >> Currently, KVM doesn't provide an API to make atomic updates to memmap when >> the change touches more than one memory slot, e.g. in case we'd like to >

Re: [PATCH RFC] memory: pause all vCPUs for the duration of memory transactions

2020-11-05 Thread Vitaly Kuznetsov
Peter Xu writes: > On Wed, Nov 04, 2020 at 07:09:02PM +0100, Laszlo Ersek wrote: >> On 11/03/20 17:37, Peter Xu wrote: >> > On Tue, Nov 03, 2020 at 02:07:09PM +0100, Vitaly Kuznetsov wrote: >> >> In case it is a normal access from the guest, yes, but AFAIR here &g

[PATCH RFC v2 00/19] i386: KVM: expand Hyper-V features early

2020-09-30 Thread Vitaly Kuznetsov
ctl as the existing vCPU version can't be used that early. This is what KVM part does. With that done, we can make early Hyper-V feature expansion (this series). Vitaly Kuznetsov (19): WIP: update linux/headers i386: fill in FEAT_HYPERV_EDX from edx instead of eax i386: drop x86_cp

[PATCH RFC v2 01/19] WIP: update linux/headers

2020-09-30 Thread Vitaly Kuznetsov
KVM_CAP_SYS_HYPERV_CPUID definition is needed for this series. Signed-off-by: Vitaly Kuznetsov --- linux-headers/asm-x86/kvm.h | 20 linux-headers/linux/kvm.h | 27 --- 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/linux-headers

[PATCH RFC v2 02/19] i386: fill in FEAT_HYPERV_EDX from edx instead of eax

2020-09-30 Thread Vitaly Kuznetsov
There was a typo which went unnoticed. Fixes: e48ddcc6ce13 ("i386/kvm: implement 'hv-passthrough' mode") Signed-off-by: Vitaly Kuznetsov --- - Similar fix h

[PATCH RFC v2 03/19] i386: drop x86_cpu_get_supported_feature_word() forward declaration

2020-09-30 Thread Vitaly Kuznetsov
We only use x86_cpu_get_supported_feature_word() after its implementation, no forward declaration needed. Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 3ffd877dd51f..ca713bef5eaf 100644

[PATCH RFC v2 08/19] i386: keep hyperv_vendor string up-to-date

2020-09-30 Thread Vitaly Kuznetsov
7;s query-cpu-model-expansion output is incorrect. Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.c | 20 ++-- target/i386/kvm.c | 4 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index d657590ab55d..8ec0af0a6d

[PATCH RFC v2 05/19] i386: move hyperv_interface_id initialization to x86_cpu_realizefn()

2020-09-30 Thread Vitaly Kuznetsov
As a preparation to expanding Hyper-V CPU features early, move hyperv_interface_id initialization to x86_cpu_realizefn(). Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.c | 6 ++ target/i386/cpu.h | 1 + target/i386/kvm.c | 18 -- 3 files changed, 19 insertions(+), 6

[PATCH RFC v2 04/19] i386: move hyperv_vendor_id initialization to x86_cpu_realizefn()

2020-09-30 Thread Vitaly Kuznetsov
As a preparation to expanding Hyper-V CPU features early, move hyperv_vendor_id initialization to x86_cpu_realizefn(). Introduce x86_cpu_hyperv_realize() to not not pollute x86_cpu_realizefn() itself. Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.c | 23 ++- target

[PATCH RFC v2 11/19] i386: introduce hv_cpuid_cache

2020-09-30 Thread Vitaly Kuznetsov
ote, hv_cpuid_get_fw() is converted to using hv_cpuid_get_host() just to be removed later with Hyper-V specific feature words. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm.c | 213 +++--- 1 file changed, 106 insertions(+), 107 deletions(-) diff --git a/target/i

[PATCH RFC v2 10/19] i386: always fill Hyper-V CPUID feature leaves from X86CPU data

2020-09-30 Thread Vitaly Kuznetsov
guest but arguably this is a good change. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm.c | 9 - 1 file changed, 9 deletions(-) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 94e2195acb36..a9823d4af7cb 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -1221,9 +1221,6

[PATCH RFC v2 12/19] i386: drop FEAT_HYPERV feature leaves

2020-09-30 Thread Vitaly Kuznetsov
converted to using raw CPUID func/reg pairs for features, this allows us to get rid of hv_cpuid_get_fw() conversion. Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.c | 90 +-- target/i386/cpu.h | 6 +- target/i386/kvm.c | 181 ++---

[PATCH RFC v2 06/19] i386: move hyperv_version_id initialization to x86_cpu_realizefn()

2020-09-30 Thread Vitaly Kuznetsov
As a preparation to expanding Hyper-V CPU features early, move hyperv_version_id initialization to x86_cpu_realizefn(). Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.c | 4 target/i386/cpu.h | 1 + target/i386/kvm.c | 14 -- 3 files changed, 17 insertions(+), 2

[PATCH RFC v2 14/19] i386: move eVMCS enablement to hyperv_init_vcpu()

2020-09-30 Thread Vitaly Kuznetsov
hyperv_expand_features() will be called before we create vCPU so evmcs enablement should go away. hyperv_init_vcpu() looks like the right place. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm.c | 60 +-- 1 file changed, 37 insertions(+), 23

[PATCH RFC v2 09/19] i386: invert hyperv_spinlock_attempts setting logic with hv_passthrough

2020-09-30 Thread Vitaly Kuznetsov
There is no need to have this special case: like all other Hyper-V enlightenments we can just use kernel's supplied value in hv_passthrough mode. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/target/i386/kv

[PATCH RFC v2 16/19] i386: adjust the expected KVM_GET_SUPPORTED_HV_CPUID array size

2020-09-30 Thread Vitaly Kuznetsov
SYNDBG leaves were recently (Linux-5.8) added to KVM but we haven't updated the expected size of KVM_GET_SUPPORTED_HV_CPUID output in KVM so we now make serveral tries before succeeding. Update the default. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm.c | 3 ++- 1 file chang

[PATCH RFC v2 07/19] i386: move hyperv_limits initialization to x86_cpu_realizefn()

2020-09-30 Thread Vitaly Kuznetsov
As a preparation to expanding Hyper-V CPU features early, move hyperv_limits initialization to x86_cpu_realizefn(). Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.c | 5 + target/i386/cpu.h | 1 + target/i386/kvm.c | 13 - 3 files changed, 18 insertions(+), 1 deletion

[PATCH RFC v2 19/19] i386: expand Hyper-V features during CPU feature expansion time

2020-09-30 Thread Vitaly Kuznetsov
can't use kvm_arch_get_supported_cpuid() as Hyper-V specific CPUID leaves intersect with KVM's. Note, early expansion will only happen when KVM supports system wide KVM_GET_SUPPORTED_HV_CPUID ioctl (KVM_CAP_SYS_HYPERV_CPUID). Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.c

[PATCH RFC v2 15/19] i386: switch hyperv_expand_features() to using error_setg()

2020-09-30 Thread Vitaly Kuznetsov
Use standard error_setg() mechanism in hyperv_expand_features(). Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm.c | 101 -- 1 file changed, 61 insertions(+), 40 deletions(-) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 181e034da701

[PATCH RFC v2 13/19] i386: split hyperv_handle_properties() into hyperv_expand_features()/hyperv_fill_cpuids()

2020-09-30 Thread Vitaly Kuznetsov
The intention is to call hyperv_expand_features() early, before vCPUs are created and use the acquired data later when we set guest visible CPUID data. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm.c | 34 -- 1 file changed, 24 insertions(+), 10 deletions

[PATCH RFC v2 17/19] i386: prefer system KVM_GET_SUPPORTED_HV_CPUID ioctl over vCPU's one

2020-09-30 Thread Vitaly Kuznetsov
KVM_GET_SUPPORTED_HV_CPUID was made a system wide ioctl which can be called prior to creating vCPUs and we are going to use that to expand Hyper-V cpu features early. Use it when it is supported by KVM. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm.c | 17 + 1 file changed

[PATCH RFC v2 18/19] i386: use global kvm_state in hyperv_enabled() check

2020-09-30 Thread Vitaly Kuznetsov
There is no need to use vCPU-specific kvm state in hyperv_enabled() check and we need to do that when feature expansion happens early, before vCPU specific KVM state is created. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff

Re: [PATCH RFC v2 12/19] i386: drop FEAT_HYPERV feature leaves

2020-09-30 Thread Vitaly Kuznetsov
Eduardo Habkost writes: > On Wed, Sep 30, 2020 at 03:40:20PM +0200, Vitaly Kuznetsov wrote: >> Hyper-V feature leaves are weird. We have some of them in >> feature_word_info[] array but we don't use feature_word_info >> magic to enable them. Neither do we use feature_d

Re: [PATCH RFC v3 23/23] i386: provide simple 'hyperv=on' option to x86 machine types

2020-11-19 Thread Vitaly Kuznetsov
Eduardo Habkost writes: > On Fri, Oct 09, 2020 at 02:18:42PM +0200, Vitaly Kuznetsov wrote: >> Enabling Hyper-V emulation for a Windows VM is a tiring experience as it >> requires listing all currently supported enlightenments ("hv_*" CPU >> features) explicitl

[PATCH 1/5] i386: move hyperv_vendor_id initialization to x86_cpu_realizefn()

2020-11-19 Thread Vitaly Kuznetsov
As a preparation to expanding Hyper-V CPU features early, move hyperv_vendor_id initialization to x86_cpu_realizefn(). Introduce x86_cpu_hyperv_realize() to not not pollute x86_cpu_realizefn() itself. Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.c | 23 ++- target

<    1   2   3   4   5   6   >