Re: [PATCH RESEND v3 0/3] i386: Fix Hyper-V Gen1 guests stuck on boot with 'hv-passthrough'

2024-03-25 Thread Vitaly Kuznetsov
Vitaly Kuznetsov writes: > Changes since 'RESEND v2': > - Included 'docs/system: Add recommendations to Hyper-V enlightenments doc' > in the set as it also requires a "RESEND") Ping) > > Hyper-V Gen1 guests are getting stuck on boot when 'hv-passthrough' is >

Re: [PATCH RESEND v3 3/3] docs/system: Add recommendations to Hyper-V enlightenments doc

2024-03-07 Thread Vitaly Kuznetsov
Zhao Liu writes: > Hi Vitaly, > > On Tue, Mar 05, 2024 at 05:42:04PM +0100, Vitaly Kuznetsov wrote: >> Date: Tue, 5 Mar 2024 17:42:04 +0100 >> From: Vitaly Kuznetsov >> Subject: [PATCH RESEND v3 3/3] docs/system: Add recommendations to Hyper-V >> enlighten

[PATCH RESEND v3 2/3] i386: Exclude 'hv-syndbg' from 'hv-passthrough'

2024-03-05 Thread Vitaly Kuznetsov
res in 'hv-passthrough' mode. Note, "-cpu host,hv-passthrough,hv-syndbg" can still be used if needed. As both 'hv-passthrough' and 'hv-syndbg' are debug features, the change should not have any effect on production environments. Signed-off-by: Vitaly Kuznetsov --- docs/system/

[PATCH RESEND v3 0/3] i386: Fix Hyper-V Gen1 guests stuck on boot with 'hv-passthrough'

2024-03-05 Thread Vitaly Kuznetsov
assthrough' and don't allow to turn on 'hv-syndbg' for !CONFIG_SYNDBG builds. Vitaly Kuznetsov (3): i386: Fix conditional CONFIG_SYNDBG enablement i386: Exclude 'hv-syndbg' from 'hv-passthrough' docs/system: Add recommendations to Hyper-V enlightenments doc docs/system/i386/hyper

[PATCH RESEND v3 3/3] docs/system: Add recommendations to Hyper-V enlightenments doc

2024-03-05 Thread Vitaly Kuznetsov
While hyperv.rst already has all currently implemented Hyper-V enlightenments documented, it may be unclear what is the recommended set to achieve the best result. Add the corresponding section to the doc. Signed-off-by: Vitaly Kuznetsov --- docs/system/i386/hyperv.rst | 30

[PATCH RESEND v3 1/3] i386: Fix conditional CONFIG_SYNDBG enablement

2024-03-05 Thread Vitaly Kuznetsov
ported() making sure there are no 'holes' or improperly defined features in 'kvm_hyperv_properties'. Fixes: d8701185f40c ("hw: hyperv: Initial commit for Synthetic Debugging device") Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.c | 2 ++ target/i386/kvm/kvm.c | 11 +

Re: [PATCH] target/i386/kvm: call kvm_put_vcpu_events() before kvm_put_nested_state()

2024-01-16 Thread Vitaly Kuznetsov
ukata wrote: >> >> Hi all, appreciate any comments or feedbacks on the patch. >> >> Thanks, >> Eiichi >> >>> On Nov 1, 2023, at 23:04, Vitaly Kuznetsov wrote: >>> >>> Eiichi Tsukata writes: >>> >>>> F

[PATCH] docs/system: Add recommendations to Hyper-V enlightenments doc

2023-11-15 Thread Vitaly Kuznetsov
While hyperv.rst already has all currently implemented Hyper-V enlightenments documented, it may be unclear what is the recommended set to achieve the best result. Add the corresponding section to the doc. Signed-off-by: Vitaly Kuznetsov --- docs/system/i386/hyperv.rst | 30

[PATCH RESEND v2 2/2] i386: Exclude 'hv-syndbg' from 'hv-passthrough'

2023-11-15 Thread Vitaly Kuznetsov
res in 'hv-passthrough' mode. Note, "-cpu host,hv-passthrough,hv-syndbg" can still be used if needed. As both 'hv-passthrough' and 'hv-syndbg' are debug features, the change should not have any effect on production environments. Signed-off-by: Vitaly Kuznetsov --- docs/system/

[PATCH RESEND v2 0/2] i386: Fix Hyper-V Gen1 guests stuck on boot with 'hv-passthrough'

2023-11-15 Thread Vitaly Kuznetsov
-passthrough' enables 'hv-syndbg' and this is undesired. - 'hv-syndbg's support by KVM is detected incorrectly when !CONFIG_SYNDBG. Fix both issues; exclude 'hv-syndbg' from 'hv-passthrough' and don't allow to turn on 'hv-syndbg' for !CONFIG_SYNDBG builds. Vitaly Kuznetsov (2): i386: Fix

[PATCH RESEND v2 1/2] i386: Fix conditional CONFIG_SYNDBG enablement

2023-11-15 Thread Vitaly Kuznetsov
ported() making sure there are no 'holes' or improperly defined features in 'kvm_hyperv_properties'. Fixes: d8701185f40c ("hw: hyperv: Initial commit for Synthetic Debugging device") Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.c | 2 ++ target/i386/kvm/kvm.c | 11 +

Re: [PATCH] target/i386/kvm: call kvm_put_vcpu_events() before kvm_put_nested_state()

2023-11-01 Thread Vitaly Kuznetsov
Eiichi Tsukata writes: > FYI: The EINVAL in vmx_set_nested_state() is caused by the following > condition: > * vcpu->arch.hflags == 0 > * kvm_state->hdr.vmx.smm.flags == KVM_STATE_NESTED_SMM_VMXON This is a weird state indeed, 'vcpu->arch.hflags == 0' means we're not in SMM and not in guest

Re: [PATCH] target/i386/kvm: call kvm_put_vcpu_events() before kvm_put_nested_state()

2023-10-26 Thread Vitaly Kuznetsov
Cc'ing Max :-) At first glance the condition in vmx_set_nested_state() is correct so I guess we either have a stale KVM_STATE_NESTED_RUN_PENDING when in SMM or stale smm.flags when outside of it... Philippe Mathieu-Daudé writes: > Cc'ing Vitaly. > > On 26/10/23 07:49, Eiichi Tsukata wrote: >>

[PATCH RESEND 1/2] i386: Fix conditional CONFIG_SYNDBG enablement

2023-09-22 Thread Vitaly Kuznetsov
ported() making sure there are no 'holes' or improperly defined features in 'kvm_hyperv_properties'. Fixes: d8701185f40c ("hw: hyperv: Initial commit for Synthetic Debugging device") Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.c | 2 ++ target/i386/kvm/kvm.c | 11 +

[PATCH RESEND 0/2] i386: Fix Hyper-V Gen1 guests stuck on boot with 'hv-passthrough'

2023-09-22 Thread Vitaly Kuznetsov
' and this is undesired. - 'hv-syndbg's support by KVM is detected incorrectly when !CONFIG_SYNDBG. Fix both issues; exclude 'hv-syndbg' from 'hv-passthrough' and don't allow to turn on 'hv-syndbg' for !CONFIG_SYNDBG builds. Vitaly Kuznetsov (2): i386: Fix conditional CONFIG_SYNDBG enablement i386

[PATCH RESEND 2/2] i386: Exclude 'hv-syndbg' from 'hv-passthrough'

2023-09-22 Thread Vitaly Kuznetsov
res in 'hv-passthrough' mode. Note, "-cpu host,hv-passthrough,hv-syndbg" can still be used if needed. As both 'hv-passthrough' and 'hv-syndbg' are debug features, the change should not have any effect on production environments. Signed-off-by: Vitaly Kuznetsov --- docs/system/

Re: [PATCH 0/2] i386: Fix Hyper-V Gen1 guests stuck on boot with 'hv-passthrough'

2023-09-22 Thread Vitaly Kuznetsov
Vitaly Kuznetsov writes: > Vitaly Kuznetsov writes: > >> Vitaly Kuznetsov writes: >> >>> Hyper-V Gen1 guests are getting stuck on boot when 'hv-passthrough' is >>> used. While 'hv-passthrough' is a debug only feature, this significantly >>> limit it

Re: [PATCH 0/2] i386: Fix Hyper-V Gen1 guests stuck on boot with 'hv-passthrough'

2023-07-28 Thread Vitaly Kuznetsov
Vitaly Kuznetsov writes: > Vitaly Kuznetsov writes: > >> Hyper-V Gen1 guests are getting stuck on boot when 'hv-passthrough' is >> used. While 'hv-passthrough' is a debug only feature, this significantly >> limit its usefullness. While debugging the problem, I fou

Re: [PATCH 0/2] i386: Fix Hyper-V Gen1 guests stuck on boot with 'hv-passthrough'

2023-06-27 Thread Vitaly Kuznetsov
Vitaly Kuznetsov writes: > Hyper-V Gen1 guests are getting stuck on boot when 'hv-passthrough' is > used. While 'hv-passthrough' is a debug only feature, this significantly > limit its usefullness. While debugging the problem, I found that there are > two loosely connected iss

[PATCH 2/2] i386: Exclude 'hv-syndbg' from 'hv-passthrough'

2023-06-12 Thread Vitaly Kuznetsov
res in 'hv-passthrough' mode. Note, "-cpu host,hv-passthrough,hv-syndbg" can still be used if needed. As both 'hv-passthrough' and 'hv-syndbg' are debug features, the change should not have any effect on production environments. Signed-off-by: Vitaly Kuznetsov --- docs/system/

[PATCH 0/2] i386: Fix Hyper-V Gen1 guests stuck on boot with 'hv-passthrough'

2023-06-12 Thread Vitaly Kuznetsov
' and this is undesired. - 'hv-syndbg's support by KVM is detected incorrectly when !CONFIG_SYNDBG. Fix both issues; exclude 'hv-syndbg' from 'hv-passthrough' and don't allow to turn on 'hv-syndbg' for !CONFIG_SYNDBG builds. Vitaly Kuznetsov (2): i386: Fix conditional CONFIG_SYNDBG enablement i386

[PATCH 1/2] i386: Fix conditional CONFIG_SYNDBG enablement

2023-06-12 Thread Vitaly Kuznetsov
ported() making sure there are no 'holes' or improperly defined features in 'kvm_hyperv_properties'. Fixes: d8701185f40c ("hw: hyperv: Initial commit for Synthetic Debugging device") Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.c | 2 ++ target/i386/kvm/kvm.c | 11 +

Re: Expose support for HyperV features via QMP

2023-02-09 Thread Vitaly Kuznetsov
M_GET_SUPPORTED_HV_CPUID >> ioctl) for HyperV >> features. >> Apologies in advance if i misunderstood something. >> Thanks for Ccing me. Hyper-V features should appear in QMP since commit 071ce4b03becf9e2df6b758fde9609be8ddf56f1 Author: Vitaly Kuznetsov Date

Re: [PATCH] target/i386/cpu: disable PERFCORE for AMD when cpu.pmu is off

2022-10-31 Thread Vitaly Kuznetsov
Liang Yan writes: > With cpu.pmu=off, perfctr_core could still be seen in an AMD guest cpuid. > By further digging, I found cpu.perfctr_core did the trick. However, > considering the 'enable_pmu' in KVM could work on both Intel and AMD, > we may add AMD PMU control under 'enabe_pmu' in QEMU too.

Re: [PATCH] i386: Fix KVM_CAP_ADJUST_CLOCK capability check

2022-10-07 Thread Vitaly Kuznetsov
Paolo Bonzini writes: > Hi, a similar patch is now in. > Indeed, commit c4ef867f2949bf2a2ae18a4e27cf1a34bbc8aecb Author: Ray Zhang Date: Thu Sep 22 18:05:23 2022 +0800 target/i386/kvm: fix kvmclock_current_nsec: Assertion `time.tsc_timestamp <= migration_tsc' failed solves the

Re: [PATCH] i386: Fix KVM_CAP_ADJUST_CLOCK capability check

2022-10-07 Thread Vitaly Kuznetsov
Vitaly Kuznetsov writes: > Vitaly Kuznetsov writes: > >> KVM commit c68dc1b577ea ("KVM: x86: Report host tsc and realtime values in >> KVM_GET_CLOCK") broke migration of certain workloads, e.g. Win11 + WSL2 >> guest reboots immediately after migration. KVM, how

Re: [PATCH] i386: Fix KVM_CAP_ADJUST_CLOCK capability check

2022-09-27 Thread Vitaly Kuznetsov
Vitaly Kuznetsov writes: > KVM commit c68dc1b577ea ("KVM: x86: Report host tsc and realtime values in > KVM_GET_CLOCK") broke migration of certain workloads, e.g. Win11 + WSL2 > guest reboots immediately after migration. KVM, however, is not to > blame this time. Whe

[PATCH] i386: Fix KVM_CAP_ADJUST_CLOCK capability check

2022-09-20 Thread Vitaly Kuznetsov
ult is all supported flags (which the above mentioned KVM commit enhanced) but kvm_has_adjust_clock_stable() wants it to be KVM_CLOCK_TSC_STABLE precisely. The result is that 'clock_is_reliable' is not set in vmstate and the saved clock reading is discarded in kvmclock_vm_state_change(). Signed-off-

[PATCH v1 1/2] i386: reset KVM nested state upon CPU reset

2022-08-18 Thread Vitaly Kuznetsov
Make sure env->nested_state is cleaned up when a vCPU is reset, it may be stale after an incoming migration, kvm_arch_put_registers() may end up failing or putting vCPU in a weird state. Reviewed-by: Maxim Levitsky Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c |

[PATCH v1 0/2] i386: KVM: Fix 'system_reset' failures when vCPU is in VMX root operation

2022-08-18 Thread Vitaly Kuznetsov
()), this ensures vCPU gets kicked out of VMX root operation. Vitaly Kuznetsov (2): i386: reset KVM nested state upon CPU reset i386: do kvm_put_msr_feature_control() first thing when vCPU is reset target/i386/kvm/kvm.c | 54 +++ 1 file changed, 39 insertions

[PATCH v1 2/2] i386: do kvm_put_msr_feature_control() first thing when vCPU is reset

2022-08-18 Thread Vitaly Kuznetsov
() and not after it, especially when 'real' nested state is set. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 17 - 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 4f8dacc1d4b5..a1fd1f53791d 100644

Re: [PATCH RFC v1 2/2] i386: reorder kvm_put_sregs2() and kvm_put_nested_state() when vCPU is reset

2022-08-10 Thread Vitaly Kuznetsov
Maxim Levitsky writes: > On Wed, 2022-08-10 at 16:00 +0200, Vitaly Kuznetsov wrote: >> Setting nested state upon migration needs to happen after kvm_put_sregs2() >> to e.g. have EFER.SVME set. This, however, doesn't work for vCPU reset: >> when vCPU is in VMX root opera

[PATCH RFC v1 1/2] i386: reset KVM nested state upon CPU reset

2022-08-10 Thread Vitaly Kuznetsov
Make sure env->nested_state is cleaned up when a vCPU is reset, it may be stale after an incoming migration, kvm_arch_put_registers() may end up failing or putting vCPU in a weird state. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 37 +++-- 1 f

[PATCH RFC v1 2/2] i386: reorder kvm_put_sregs2() and kvm_put_nested_state() when vCPU is reset

2022-08-10 Thread Vitaly Kuznetsov
(kvm_arch_reset_vcpu() -> kvm_init_nested_state()), calling kvm_put_nested_state() before kvm_put_sregs2() is OK, this will ensure that vCPU is *not* in VMX root opertaion. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 20 ++-- 1 file changed, 18 insertions(+)

[PATCH RFC v1 0/2] i386: KVM: Fix 'system_reset' failures when vCPU is in VMX root operation

2022-08-10 Thread Vitaly Kuznetsov
by avoiding vmx_is_valid_cr4() check from __set_sregs2() and hoping that someone will check for the resulting inconsistency later. I don't quite like this option so I didn't explore it in depth. Vitaly Kuznetsov (2): i386: reset KVM nested state upon CPU reset i386: reorder kvm_put_sregs2

[PATCH v4 6/6] i386: docs: Convert hyperv.txt to rST

2022-05-25 Thread Vitaly Kuznetsov
rSTify docs/hyperv.txt and link it from docs/system/target-i386.rst. Signed-off-by: Vitaly Kuznetsov --- docs/hyperv.txt | 303 docs/system/i386/hyperv.rst | 288 ++ docs/system/target-i386.rst | 1 + 3 files

[PATCH v4 5/6] i386: Hyper-V Direct TLB flush hypercall

2022-05-25 Thread Vitaly Kuznetsov
Hyper-V TLFS allows for L0 and L1 hypervisors to collaborate on L2's TLB flush hypercalls handling. With the correct setup, L2's TLB flush hypercalls can be handled by L0 directly, without the need to exit to L1. Signed-off-by: Vitaly Kuznetsov --- docs/hyperv.txt| 11

[PATCH v4 3/6] i386: Hyper-V XMM fast hypercall input feature

2022-05-25 Thread Vitaly Kuznetsov
HYPERCALL_{PARAMS_XMM_AVAILABLE -> XMM_INPUT_AVAILABLE} to comply with KVM. Signed-off-by: Vitaly Kuznetsov --- docs/hyperv.txt| 6 ++ target/i386/cpu.c | 2 ++ target/i386/cpu.h | 1 + target/i386/kvm/hyperv-proto.h | 2 +- target/i386/kvm/kvm.c

[PATCH v4 0/6] i386: Enable newly introduced KVM Hyper-V enlightenments

2022-05-25 Thread Vitaly Kuznetsov
lls without the need to exit to L1 (Hyper-V). The last two features are not merged in KVM yet: https://lore.kernel.org/kvm/20220525090133.1264239-1-vkuzn...@redhat.com/ however, there's no direct dependency on the kernel part as thanks to KVM_GET_SUPPORTED_HV_CPUID no new capabilities are introduce

[PATCH v4 4/6] i386: Hyper-V Support extended GVA ranges for TLB flush hypercalls

2022-05-25 Thread Vitaly Kuznetsov
e bit wasn't exposed then. Now, as KVM gains support for fine-grained TLB flush handling, exposing this feature starts making sense. Signed-off-by: Vitaly Kuznetsov --- docs/hyperv.txt| 7 +++ target/i386/cpu.c | 2 ++ target/i386/cpu.h | 1 + ta

[PATCH v4 1/6] i386: Use hv_build_cpuid_leaf() for HV_CPUID_NESTED_FEATURES

2022-05-25 Thread Vitaly Kuznetsov
handling to hv_build_cpuid_leaf() and drop now-unneeded 'hyperv_nested'. No functional change intended. Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.h | 1 - target/i386/kvm/kvm.c | 25 +++-- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/target/i386

Re: [PATCH v3 0/5] i386: Enable newly introduced KVM Hyper-V enlightenments

2022-05-25 Thread Vitaly Kuznetsov
Vitaly Kuznetsov writes: > Paolo Bonzini writes: > >>> This series enables four new KVM Hyper-V enlightenmtes [...] >>> >>> docs/hyperv.txt| 34 ++ >> >> Queued, thanks. > > Thanks! > It seems these pa

[PATCH v4 2/6] i386: Hyper-V Enlightened MSR bitmap feature

2022-05-25 Thread Vitaly Kuznetsov
The newly introduced enlightenment allow L0 (KVM) and L1 (Hyper-V) hypervisors to collaborate to avoid unnecessary updates to L2 MSR-Bitmap upon vmexits. Signed-off-by: Vitaly Kuznetsov --- docs/hyperv.txt| 9 + target/i386/cpu.c | 2 ++ target/i386/cpu.h

Re: [PATCH] vmxcap: add tertiary execution controls

2022-05-12 Thread Vitaly Kuznetsov
; + > Control( > name = 'VM-Exit controls', > bits = { Not sure which particular CPUs are going to implement this (whould be nice to add this info to the blurb) but this matches Intel doc (https://software.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html) and "IPI virtualization support for VM" series for KVM, so Reviewed-by: Vitaly Kuznetsov -- Vitaly

[PATCH] i386: docs: Convert hyperv.txt to rST

2022-05-03 Thread Vitaly Kuznetsov
rSTify docs/hyperv.txt and link it from docs/system/target-i386.rst. Signed-off-by: Vitaly Kuznetsov --- - The patch is supposed to be applied on top of "[PATCH v3 0/5] i386: Enable newly introduced KVM Hyper-V enlightenments". --- docs/hyperv.txt

Re: [PATCH v3 0/5] i386: Enable newly introduced KVM Hyper-V enlightenments

2022-04-29 Thread Vitaly Kuznetsov
Paolo Bonzini writes: >> This series enables four new KVM Hyper-V enlightenmtes [...] >> >> docs/hyperv.txt| 34 ++ > > Queued, thanks. Thanks! > Would you please convert hyperv.txt to rST in docs/system/i386? Sure, it's on my TODO list. -- Vitaly

[PATCH v3 4/5] i386: Hyper-V Support extended GVA ranges for TLB flush hypercalls

2022-04-19 Thread Vitaly Kuznetsov
e bit wasn't exposed then. Now, as KVM gains support for fine-grained TLB flush handling, exposing this feature starts making sense. Signed-off-by: Vitaly Kuznetsov --- docs/hyperv.txt| 7 +++ target/i386/cpu.c | 2 ++ target/i386/cpu.h | 1 + ta

[PATCH v3 2/5] i386: Hyper-V Enlightened MSR bitmap feature

2022-04-19 Thread Vitaly Kuznetsov
The newly introduced enlightenment allow L0 (KVM) and L1 (Hyper-V) hypervisors to collaborate to avoid unnecessary updates to L2 MSR-Bitmap upon vmexits. Signed-off-by: Vitaly Kuznetsov --- docs/hyperv.txt| 10 ++ target/i386/cpu.c | 2 ++ target/i386/cpu.h

[PATCH v3 1/5] i386: Use hv_build_cpuid_leaf() for HV_CPUID_NESTED_FEATURES

2022-04-19 Thread Vitaly Kuznetsov
handling to hv_build_cpuid_leaf() and drop now-unneeded 'hyperv_nested'. No functional change intended. Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.h | 1 - target/i386/kvm/kvm.c | 23 +++ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/target/i386/cpu.h

[PATCH v3 0/5] i386: Enable newly introduced KVM Hyper-V enlightenments

2022-04-19 Thread Vitaly Kuznetsov
introduced. Vitaly Kuznetsov (5): i386: Use hv_build_cpuid_leaf() for HV_CPUID_NESTED_FEATURES i386: Hyper-V Enlightened MSR bitmap feature i386: Hyper-V XMM fast hypercall input feature i386: Hyper-V Support extended GVA ranges for TLB flush hypercalls i386: Hyper-V Direct TLB flush hyperc

[PATCH v3 5/5] i386: Hyper-V Direct TLB flush hypercall

2022-04-19 Thread Vitaly Kuznetsov
Hyper-V TLFS allows for L0 and L1 hypervisors to collaborate on L2's TLB flush hypercalls handling. With the correct setup, L2's TLB flush hypercalls can be handled by L0 directly, without the need to exit to L1. Signed-off-by: Vitaly Kuznetsov --- docs/hyperv.txt| 11

[PATCH v3 3/5] i386: Hyper-V XMM fast hypercall input feature

2022-04-19 Thread Vitaly Kuznetsov
HYPERCALL_{PARAMS_XMM_AVAILABLE -> XMM_INPUT_AVAILABLE} to comply with KVM. Signed-off-by: Vitaly Kuznetsov --- docs/hyperv.txt| 6 ++ target/i386/cpu.c | 2 ++ target/i386/cpu.h | 1 + target/i386/kvm/hyperv-proto.h | 2 +- target/i386/kvm/kvm.c

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

2022-04-12 Thread Vitaly Kuznetsov
Divya Garg writes: > On 12/04/22 6:18 pm, Vitaly Kuznetsov wrote: >> Divya Garg writes: >> >>> Hi Vitaly Kuznetsov ! >>> I was working on hyperv flags and saw that we introduced new >>> dependencies some >>> time back &g

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

2022-04-12 Thread Vitaly Kuznetsov
Divya Garg writes: > Hi Vitaly Kuznetsov ! > I was working on hyperv flags and saw that we introduced new > dependencies some > time back > (https://sourcegraph.com/github.com/qemu/qemu/-/commit/c686193072a47032d83cb4e131dc49ae30f9e5d7?visible=1). > After these changes,

Re: [PATCH v2 0/3] i386: Add support for Hyper-V Enlightened MSR-Bitmap and XMM fast hypercall input features

2022-03-06 Thread Vitaly Kuznetsov
Vitaly Kuznetsov writes: > 'XMM fast hypercall input feature' is supported by KVM since v5.14, > it allows for faster Hyper-V hypercall processing. > > 'Enlightened MSR-Bitmap' is a new nested specific enlightenment speeds up > L2 vmexits by avoiding unnecessary updates to L2

[PATCH 1/2] i386: Add Icelake-Server-v6 CPU model with 5-level EPT support

2022-02-21 Thread Vitaly Kuznetsov
with 'vmx-page-walk-5' enabled by default. Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.c | 8 1 file changed, 8 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index aa9e6368004c..6e25d1333971 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -3505,6 +3505,14

[PATCH 2/2] vmxcap: Add 5-level EPT bit

2022-02-21 Thread Vitaly Kuznetsov
5-level EPT is present in Icelake Server CPUs and is supported by QEMU ('vmx-page-walk-5'). Signed-off-by: Vitaly Kuznetsov --- scripts/kvm/vmxcap | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/kvm/vmxcap b/scripts/kvm/vmxcap index 6fe66d5f5753..f140040104bf 100755 --- a/scripts

[PATCH v2 3/3] i386: Hyper-V XMM fast hypercall input feature

2022-02-17 Thread Vitaly Kuznetsov
HYPERCALL_{PARAMS_XMM_AVAILABLE -> XMM_INPUT_AVAILABLE} to comply with KVM. Signed-off-by: Vitaly Kuznetsov --- docs/hyperv.txt| 6 ++ target/i386/cpu.c | 2 ++ target/i386/cpu.h | 1 + target/i386/kvm/hyperv-proto.h | 2 +- target/i386/kvm/kvm.c

[PATCH v2 2/3] i386: Hyper-V Enlightened MSR bitmap feature

2022-02-17 Thread Vitaly Kuznetsov
The newly introduced enlightenment allow L0 (KVM) and L1 (Hyper-V) hypervisors to collaborate to avoid unnecessary updates to L2 MSR-Bitmap upon vmexits. Signed-off-by: Vitaly Kuznetsov --- docs/hyperv.txt| 10 ++ target/i386/cpu.c | 2 ++ target/i386/cpu.h

[PATCH v2 0/3] i386: Add support for Hyper-V Enlightened MSR-Bitmap and XMM fast hypercall input features

2022-02-17 Thread Vitaly Kuznetsov
is coming in v5.17 and is queued for 5.18 for AMD CPUs. Vitaly Kuznetsov (3): i386: Use hv_build_cpuid_leaf() for HV_CPUID_NESTED_FEATURES i386: Hyper-V Enlightened MSR bitmap feature i386: Hyper-V XMM fast hypercall input feature docs/hyperv.txt| 16 +++ target

[PATCH v2 1/3] i386: Use hv_build_cpuid_leaf() for HV_CPUID_NESTED_FEATURES

2022-02-17 Thread Vitaly Kuznetsov
handling to hv_build_cpuid_leaf() and drop now-unneeded 'hyperv_nested'. No functional change intended. Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.h | 1 - target/i386/kvm/kvm.c | 23 +++ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/target/i386/cpu.h

Re: [PATCH 0/2] i386: Add support for Hyper-V Enlightened MSR-Bitmap feature

2022-01-27 Thread Vitaly Kuznetsov
Vitaly Kuznetsov writes: > The new nested specific enlightenment speeds up L2 vmexits by avoiding > unnecessary updates to L2 MSR-Bitmap. Support for both VMX and SVM is > coming to KVM: > https://lore.kernel.org/kvm/20211129094704.326635-1-vkuzn...@redhat.com/ > https://lore

[PATCH 1/2] i386: Use hv_build_cpuid_leaf() for HV_CPUID_NESTED_FEATURES

2022-01-05 Thread Vitaly Kuznetsov
handling to hv_build_cpuid_leaf() and drop now-unneeded 'hyperv_nested'. No functional change intended. Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.h | 1 - target/i386/kvm/kvm.c | 23 +++ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/target/i386/cpu.h

[PATCH 0/2] i386: Add support for Hyper-V Enlightened MSR-Bitmap feature

2022-01-05 Thread Vitaly Kuznetsov
...@redhat.com/ Vitaly Kuznetsov (2): i386: Use hv_build_cpuid_leaf() for HV_CPUID_NESTED_FEATURES i386: Hyper-V Enlightened MSR bitmap feature docs/hyperv.txt| 10 ++ target/i386/cpu.c | 2 ++ target/i386/cpu.h | 2 +- target/i386/kvm/hyperv-proto.h

[PATCH 2/2] i386: Hyper-V Enlightened MSR bitmap feature

2022-01-05 Thread Vitaly Kuznetsov
The newly introduced enlightenment allow L0 (KVM) and L1 (Hyper-V) hypervisors to collaborate to avoid unnecessary updates to L2 MSR-Bitmap upon vmexits. Signed-off-by: Vitaly Kuznetsov --- docs/hyperv.txt| 10 ++ target/i386/cpu.c | 2 ++ target/i386/cpu.h

Re: [PATCH v3] i386: docs: Briefly describe KVM PV features

2021-10-27 Thread Vitaly Kuznetsov
Igor Mammedov writes: > On Mon, 4 Oct 2021 16:04:45 +0200 > Vitaly Kuznetsov wrote: > Thanks for the review! As I can see, the patch already made it to 'master': commit 7f7c8d0ce3630849a4df3d627b11de354fcb3bb0 Author: Vitaly Kuznetsov Date: Mon Oct 4 16:04:45 2021 +0200 i

[PATCH v3] i386: docs: Briefly describe KVM PV features

2021-10-04 Thread Vitaly Kuznetsov
KVM PV features don't seem to be documented anywhere, in particular, the fact that some of the features are enabled by default and some are not can only be figured out from the code. Signed-off-by: Vitaly Kuznetsov --- Changes since "[PATCH v2 0/8] i386: Assorted KVM PV and Hyper-V fe

Re: [PATCH v2 0/8] i386: Assorted KVM PV and Hyper-V feature improvements

2021-09-30 Thread Vitaly Kuznetsov
Paolo Bonzini writes: > On 02/09/21 11:35, Vitaly Kuznetsov wrote: >> This is a continuation of "[PATCH 0/3] i386/kvm: Paravirtualized features >> usage >> enforcement" series, thus v2. >> >> This series implements several unrelated features but as

Re: [PATCH v2 0/8] i386: Assorted KVM PV and Hyper-V feature improvements

2021-09-17 Thread Vitaly Kuznetsov
Vitaly Kuznetsov writes: > This is a continuation of "[PATCH 0/3] i386/kvm: Paravirtualized features > usage > enforcement" series, thus v2. > > This series implements several unrelated features but as there are code > dependencies between them I'm sending it as

[PATCH v2 5/8] i386: Move HV_APIC_ACCESS_RECOMMENDED bit setting to hyperv_fill_cpuids()

2021-09-02 Thread Vitaly Kuznetsov
. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index bd0b53416315..430007c2691a 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -821,9 +821,7

[PATCH v2 0/8] i386: Assorted KVM PV and Hyper-V feature improvements

2021-09-02 Thread Vitaly Kuznetsov
he default Hyper-V version to 2016 Vitaly Kuznetsov (8): i386: Add 6.2 machine types i386: docs: Briefly describe KVM PV features i386: Support KVM_CAP_ENFORCE_PV_FEATURE_CPUID i386: Support KVM_CAP_HYPERV_ENFORCE_CPUID i386: Move HV_APIC_ACCESS_RECOMMENDED bit setting to hyperv_f

[PATCH v2 3/8] i386: Support KVM_CAP_ENFORCE_PV_FEATURE_CPUID

2021-09-02 Thread Vitaly Kuznetsov
ux >= 5.10 and is not enabled by default in QEMU. Signed-off-by: Vitaly Kuznetsov --- docs/kvm-pv.txt | 13 - target/i386/cpu.c | 2 ++ target/i386/cpu.h | 3 +++ target/i386/kvm/kvm.c | 10 ++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/docs/kvm-pv.t

[PATCH v2 8/8] i386: Change the default Hyper-V version to match WS2016

2021-09-02 Thread Vitaly Kuznetsov
machine types only. Signed-off-by: Vitaly Kuznetsov --- docs/hyperv.txt | 2 +- hw/i386/pc.c | 6 +- target/i386/cpu.c | 6 +++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/docs/hyperv.txt b/docs/hyperv.txt index 7803495468b7..5d99fd9a72b8 100644 --- a/docs/hyperv.txt

[PATCH v2 1/8] i386: Add 6.2 machine types

2021-09-02 Thread Vitaly Kuznetsov
Introduce 6.2 machine types and the required infrastructure for adding compat properties to pre-6.2 machine types. Signed-off-by: Vitaly Kuznetsov --- hw/core/machine.c| 3 +++ hw/i386/pc.c | 3 +++ hw/i386/pc_piix.c| 14 +- hw/i386/pc_q35.c | 13

[PATCH v2 4/8] i386: Support KVM_CAP_HYPERV_ENFORCE_CPUID

2021-09-02 Thread Vitaly Kuznetsov
enlightenments. The feature is supported by Linux >= 5.14 and is not enabled by default in QEMU. Signed-off-by: Vitaly Kuznetsov --- docs/hyperv.txt | 17 ++--- target/i386/cpu.c | 1 + target/i386/cpu.h | 1 + target/i386/kvm/kvm.c | 9 + 4 files changed,

[PATCH v2 7/8] i386: Make Hyper-V version id configurable

2021-09-02 Thread Vitaly Kuznetsov
-16: Major Version Bits 15-0: Minor Version ECX Service Pack EDX Bits 31-24: Service Branch Bits 23-0: Service Number Signed-off-by: Vitaly Kuznetsov --- docs/hyperv.txt | 14 ++ target/i386/cpu.c | 15 +++ target/i386/cpu.h | 7 ++- target/i386

[PATCH v2 6/8] i386: Implement pseudo 'hv-avic' ('hv-apicv') enlightenment

2021-09-02 Thread Vitaly Kuznetsov
the guest tries to use AutoEOI feature with SynIC. With 'HV_DEPRECATING_AEOI_RECOMMENDED' bit exposed, modern enough Windows/ Hyper-V versions should follow the recommendation and not use the (unwanted) feature. Signed-off-by: Vitaly Kuznetsov --- docs/hyperv.txt| 10 +- target

[PATCH v2 2/8] i386: docs: Briefly describe KVM PV features

2021-09-02 Thread Vitaly Kuznetsov
KVM PV features don't seem to be documented anywhere, in particular, the fact that some of the features are enabled by default and some are not can only be figured out from the code. Signed-off-by: Vitaly Kuznetsov --- docs/kvm-pv.txt | 92 + 1

[PATCH 1/3] docs: Briefly describe KVM PV features

2021-07-22 Thread Vitaly Kuznetsov
KVM PV features don't seem to be documented anywhere, in particular, the fact that some of the features are enabled by default and some are not can only be figured out from the code. Signed-off-by: Vitaly Kuznetsov --- docs/kvm-pv.txt | 92 + 1

[PATCH 3/3] i386: Support KVM_CAP_HYPERV_ENFORCE_CPUID

2021-07-22 Thread Vitaly Kuznetsov
enlightenments. The feature is supported by Linux >= 5.14 and is not enabled by default in QEMU. Signed-off-by: Vitaly Kuznetsov --- docs/hyperv.txt | 17 ++--- target/i386/cpu.c | 1 + target/i386/cpu.h | 1 + target/i386/kvm/kvm.c | 9 + 4 files changed,

[PATCH 2/3] i386: Support KVM_CAP_ENFORCE_PV_FEATURE_CPUID

2021-07-22 Thread Vitaly Kuznetsov
ux >= 5.10 and is not enabled by default in QEMU. Signed-off-by: Vitaly Kuznetsov --- docs/kvm-pv.txt | 13 - target/i386/cpu.c | 2 ++ target/i386/cpu.h | 3 +++ target/i386/kvm/kvm.c | 10 ++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/docs/kvm-pv.t

[PATCH 0/3] i386/kvm: Paravirtualized features usage enforcement

2021-07-22 Thread Vitaly Kuznetsov
. Vitaly Kuznetsov (3): docs: Briefly describe KVM PV features i386: Support KVM_CAP_ENFORCE_PV_FEATURE_CPUID i386: Support KVM_CAP_HYPERV_ENFORCE_CPUID docs/hyperv.txt | 17 +-- docs/kvm-pv.txt | 103 ++ target/i386/cpu.c | 3

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

2021-07-19 Thread Vitaly Kuznetsov
Andrew Jones writes: > On Fri, Jul 16, 2021 at 02:55:28PM +0200, Vitaly Kuznetsov wrote: >> For the beginning, just test 'hv-passthrough' and a couple of custom >> Hyper-V enlightenments configurations through QMP. Later, it would >> be great to complement this by check

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

2021-07-16 Thread Vitaly Kuznetsov
For the beginning, just test '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 --- - Changes since "[PATCH v8 0/9] i386

Re: [PATCH v8 9/9] qtest/hyperv: Introduce a simple hyper-v test

2021-07-16 Thread Vitaly Kuznetsov
Igor Mammedov writes: > On Thu, 8 Jul 2021 17:02:22 -0400 > Eduardo Habkost wrote: > >> On Tue, Jun 08, 2021 at 02:08:17PM +0200, Vitaly Kuznetsov wrote: >> > For the beginning, just test 'hv-passthrough' and a couple of custom >> > Hyper-V enlightenments

[PATCH 2/2] i386: Fix coding style in kvm_hyperv_expand_features()

2021-07-16 Thread Vitaly Kuznetsov
QEMU coding style requires braces around bodies of ifs. Reported-by: Peter Maydell Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index e69abe48e3f8..28ca682b1089

[PATCH 1/2] i386: assert 'cs->kvm_state' is not null

2021-07-16 Thread Vitaly Kuznetsov
ported and KVM_CAP_SYS_HYPERV_CPUID implies KVM_CAP_HYPERV_CPUID so get_supported_hv_cpuid_legacy() is never really called. Add asserts to strengthen the protection against broken KVM behavior. Coverity: CID 1458243 Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 14 ++ 1 file chang

Re: [PULL 04/11] i386: expand Hyper-V features during CPU feature expansion time

2021-07-16 Thread Vitaly Kuznetsov
Peter Maydell writes: > On Tue, 13 Jul 2021 at 17:19, Eduardo Habkost wrote: >> >> From: Vitaly Kuznetsov >> >> 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 >

Re: [PATCH v8 3/9] i386: hardcode supported eVMCS version to '1'

2021-06-16 Thread Vitaly Kuznetsov
Eduardo Habkost writes: > On Tue, Jun 08, 2021 at 02:08:11PM +0200, Vitaly Kuznetsov wrote: >> Currently, the only eVMCS version, supported by KVM (and described in TLFS) >> is '1'. When Enlightened VMCS feature is enabled, QEMU takes the supported >> eVMC

[PATCH v8 9/9] qtest/hyperv: Introduce a simple hyper-v test

2021-06-08 Thread Vitaly Kuznetsov
For the beginning, just test '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 | 1 + tests/qtest

[PATCH v8 8/9] i386: Hyper-V SynIC requires POST_MESSAGES/SIGNAL_EVENTS privileges

2021-06-08 Thread Vitaly Kuznetsov
When Hyper-V SynIC is enabled, we may need to allow Windows guests to make hypercalls (POST_MESSAGES/SIGNAL_EVENTS). No issue is currently observed because KVM is very permissive, allowing these hypercalls regarding of guest visible CPUid bits. Reviewed-by: Eduardo Habkost Signed-off-by: Vitaly

[PATCH v8 3/9] i386: hardcode supported eVMCS version to '1'

2021-06-08 Thread Vitaly Kuznetsov
-evmcs=2'). Signed-off-by: Vitaly Kuznetsov --- docs/hyperv.txt | 2 +- target/i386/kvm/kvm.c | 39 +++ 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/docs/hyperv.txt b/docs/hyperv.txt index a51953daa833..000638a2fd38 100644 --- a/docs

[PATCH v8 7/9] i386: HV_HYPERCALL_AVAILABLE privilege bit is always needed

2021-06-08 Thread Vitaly Kuznetsov
is observed. We may, however, want to tighten the checks eventually. Conforming to the spec is probably also a good idea. Enable HV_HYPERCALL_AVAILABLE bit unconditionally. Reviewed-by: Eduardo Habkost Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 10 +- 1 file changed, 5

[PATCH v8 6/9] i386: kill off hv_cpuid_check_and_set()

2021-06-08 Thread Vitaly Kuznetsov
lso, in 'passthrough' mode we don't really need to check dependencies because KVM is supposed to provide a consistent set anyway. Reviewed-by: Eduardo Habkost Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 104 +++--- 1 file changed, 36 insertions(+),

[PATCH v8 5/9] i386: expand Hyper-V features during CPU feature expansion time

2021-06-08 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). Reviewed-by: Eduardo Habkost Signed-off-by: Vitaly Kuznetsov --- target

[PATCH v8 2/9] i386: clarify 'hv-passthrough' behavior

2021-06-08 Thread Vitaly Kuznetsov
Clarify the fact that 'hv-passthrough' only enables features which are already known to QEMU and that it overrides all other 'hv-*' settings. Reviewed-by: Eduardo Habkost Signed-off-by: Vitaly Kuznetsov --- docs/hyperv.txt | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff

[PATCH v8 0/9] i386: KVM: expand Hyper-V features early

2021-06-08 Thread Vitaly Kuznetsov
s after creating KVM vCPUs and not at feature expansion time. To support the use-case we first need to make KVM_GET_SUPPORTED_HV_CPUID ioctl a system-wide ioctl 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

[PATCH v8 4/9] i386: make hyperv_expand_features() return bool

2021-06-08 Thread Vitaly Kuznetsov
Return 'false' when hyperv_expand_features() sets an error. No functional change intended. Reviewed-by: Eduardo Habkost Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 40 +--- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git

[PATCH v8 1/9] i386: avoid hardcoding '12' as 'hyperv_vendor_id' length

2021-06-08 Thread Vitaly Kuznetsov
While this is very unlikely to change, let's avoid hardcoding '12' as 'hyperv_vendor_id' length. No functional change intended. Reviewed-by: Eduardo Habkost Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git

Re: [PATCH v7 3/9] i386: hardcode supported eVMCS version to '1'

2021-06-07 Thread Vitaly Kuznetsov
Eduardo Habkost writes: > On Fri, Jun 04, 2021 at 09:28:15AM +0200, Vitaly Kuznetsov wrote: >> Eduardo Habkost writes: >> >> > On Thu, Jun 03, 2021 at 01:48:29PM +0200, Vitaly Kuznetsov wrote: >> >> Currently, the only eVMCS version, supported by KVM (and d

  1   2   3   4   5   6   >