[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 v3 18/19] i386: provide simple 'hv-default=on' option

2021-01-15 Thread Vitaly Kuznetsov
Igor Mammedov writes: > On Thu, 7 Jan 2021 16:14:49 +0100 > 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) explici

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

2021-01-20 Thread Vitaly Kuznetsov
Igor Mammedov writes: > On Fri, 15 Jan 2021 10:20:23 +0100 > Vitaly Kuznetsov wrote: > >> Igor Mammedov writes: >> >> > On Thu, 7 Jan 2021 16:14:49 +0100 >> > Vitaly Kuznetsov wrote: >> > >> >> Enabling Hyper-V emulation for a Wi

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

2021-01-21 Thread Vitaly Kuznetsov
Igor Mammedov writes: > On Wed, 20 Jan 2021 15:38:33 +0100 > Vitaly Kuznetsov wrote: > >> Igor Mammedov writes: >> >> > On Fri, 15 Jan 2021 10:20:23 +0100 >> > Vitaly Kuznetsov wrote: >> > >> >> suggestion is >> >

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

2021-01-04 Thread Vitaly Kuznetsov
Igor Mammedov writes: >> > >> > +/* Hyper-V features enabled with 'hyperv=on' */ >> > +x86mc->default_hyperv_features = BIT(HYPERV_FEAT_RELAXED) | >> > +BIT(HYPERV_FEAT_VAPIC) | BIT(HYPERV_FEAT_TIME) | >> > +BIT(HYPERV_FEAT_CRASH) | BIT(HYPERV_FEAT_RESET) | >> > +

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

2021-01-05 Thread Vitaly Kuznetsov
Igor Mammedov writes: > On Mon, 04 Jan 2021 13:54:32 +0100 > Vitaly Kuznetsov wrote: > >> Igor Mammedov writes: >> >> >> > >> >> > +/* Hyper-V features enabled with 'hyperv=on' */ >> >> > +x86m

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

2021-01-05 Thread Vitaly Kuznetsov
Eduardo Habkost writes: > On Tue, Jan 05, 2021 at 12:36:50AM +0100, Igor Mammedov wrote: >> >> documenting is good, but if it adds new semantics to how CPU features are >> handled >> users up the stack will need code it up as well and juggle with >> -machine + -cpu + -device cpu-foo >> not to

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

2021-01-05 Thread Vitaly Kuznetsov
Igor Mammedov writes: > On Tue, 05 Jan 2021 12:50:05 +0100 > > I think there is a misunderstanding, idea was: > > cpu_initfn() { > //current set > cpu->default_hyperv_cpu_features = ACD > } > > compat_props_5.1 { >cpu.default_hyperv_cpu_features = AB > } > > compat_props_5.2 { >cp

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

2021-01-05 Thread Vitaly Kuznetsov
Igor Mammedov writes: ... > > i was talking about user interface here, i.e.: > (QMP) create_machine(hyperv=on) > (QMP) device_add(cpu, hv_foo=x) > vs: > (QMP) device_add(cpu, hyperv_defaults=on,=onhv_foo=x) > > i.e. in the later case cpu specific options are consolidate within device > stanza

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

2021-01-06 Thread Vitaly Kuznetsov
Igor Mammedov writes: > On Tue, 05 Jan 2021 17:31:43 +0100 > Vitaly Kuznetsov wrote: > >> Igor Mammedov writes: >> >> > On Tue, 05 Jan 2021 12:50:05 +0100 >> > >> > I think there is a misunderstanding, idea was: >> >

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

2021-01-07 Thread Vitaly Kuznetsov
cpu host,hv-evmcs=off'). I'll send out v3 shortly and I'll include patches from "i386: KVM: expand Hyper-V features early" which were waiting for Linux-5.11 merge window. Eduardo Habkost writes: >> > On Tue, 05 Jan 2021 17:31:43 +0100 >> > Vitaly Kuzne

[PATCH v3 02/19] i386: introduce kvm_hv_evmcs_available()

2021-01-07 Thread Vitaly Kuznetsov
Enlightened VMCS feature is hardware specific, it is only supported on Intel CPUs. Introduce a simple kvm_hv_evmcs_available() helper, it will be used to filter out 'hv_evmcs' when 'hyperv=on' option is added to X86MachineClass. Signed-off-by: Vitaly Kuznetsov --- target/i38

[PATCH v3 01/19] linux-headers: update against 5.11-rc2

2021-01-07 Thread Vitaly Kuznetsov
commit e71ba9452f0b5b2e8dc8aa5445198cd9214a6a62 needs to be included as some constants were moved from . Signed-off-by: Vitaly Kuznetsov --- .../infiniband/hw/vmw_pvrdma/pvrdma_verbs.h | 2 +- include/standard-headers/drm/drm_fourcc.h | 175 +- include/standard-headers

[PATCH v3 07/19] i386: introduce hyperv_feature_supported()

2021-01-07 Thread Vitaly Kuznetsov
Clean up hv_cpuid_check_and_set() by separating hyperv_feature_supported() off it. No functional change intended. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 49 ++- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/target

[PATCH v3 00/19] i386: KVM: expand Hyper-V features early and provide simple 'hv-default=on' option

2021-01-07 Thread Vitaly Kuznetsov
v-default' option which enables (and requires from KVM) all currently supported Hyper-V enlightenments. Unlike 'hv_passthrough' mode, this is going to be migratable. Vitaly Kuznetsov (19): linux-headers: update against 5.11-rc2 i386: introduce kvm_hv_evmcs_available() i3

[PATCH v3 04/19] i386: invert hyperv_spinlock_attempts setting logic with hv_passthrough

2021-01-07 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/kvm.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/target/i38

[PATCH v3 05/19] i386: always fill Hyper-V CPUID feature leaves from X86CPU data

2021-01-07 Thread Vitaly Kuznetsov
guest but arguably this is a good change. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 9 - 1 file changed, 9 deletions(-) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index e50b9cac2494..4a85d62bdaad 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386

[PATCH v3 03/19] i386: keep hyperv_vendor string up-to-date

2021-01-07 Thread Vitaly Kuznetsov
7;s query-cpu-model-expansion output is incorrect. Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.c | 19 +-- target/i386/kvm/kvm.c | 4 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 35459a38bb1c..6064

[PATCH v3 06/19] i386: stop using env->features[] for filling Hyper-V CPUIDs

2021-01-07 Thread Vitaly Kuznetsov
As a preparatory patch to dropping Hyper-V CPUID leaves from feature_word_info[] stop using env->features[] as a temporary storage of Hyper-V CPUIDs, just build Hyper-V CPUID leaves directly from kvm_hyperv_properties[] data. Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.h |

[PATCH v3 08/19] i386: introduce hv_cpuid_get_host()

2021-01-07 Thread Vitaly Kuznetsov
As a preparation to implementing hv_cpuid_cache intro introduce hv_cpuid_get_host(). No functional change intended. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 100 +++--- 1 file changed, 56 insertions(+), 44 deletions(-) diff --git a/target

[PATCH v3 13/19] i386: switch hyperv_expand_features() to using error_setg()

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

[PATCH v3 14/19] i386: adjust the expected KVM_GET_SUPPORTED_HV_CPUID array size

2021-01-07 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/kvm.c | 3 ++- 1 file chang

[PATCH v3 09/19] i386: drop FEAT_HYPERV feature leaves

2021-01-07 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 | 5 -- target/i386/kvm/kvm.c | 108 ++---

[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

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

[PATCH 2/5] i386: move hyperv_interface_id initialization to x86_cpu_realizefn()

2020-11-19 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 3/5] i386: move hyperv_version_id initialization to x86_cpu_realizefn()

2020-11-19 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 5/5] i386: provide simple 'hyperv=on' option to x86 machine types

2020-11-19 Thread Vitaly Kuznetsov
tion. Introduce a simple 'hyperv=on' option for all x86 machine types enabling all currently supported Hyper-V enlightenments. Later, when new enlightenments get implemented, we will be adding them to newer machine types only (by disabling them for legacy machine types) thus preservin

[PATCH 0/5] i386: simplify Hyper-V enlightenments enablement

2020-11-19 Thread Vitaly Kuznetsov
27; to 'default_hyperv_features' in X86MachineClass [Eduardo] - Move x86_cpu_hyperv_realize() invocation after x86_cpu_expand_features()/ x86_cpu_filter_features() as we need to reference cpu_has_vmx(). Vitaly Kuznetsov (5): i386: move hyperv_vendor_id initialization to x86_cpu

[PATCH 4/5] i386: move hyperv_limits initialization to x86_cpu_realizefn()

2020-11-19 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

Re: [PATCH 0/5] i386: simplify Hyper-V enlightenments enablement

2020-11-19 Thread Vitaly Kuznetsov
mitting it after 5.11-rc1 kernel upstream) so we minimize the code churn. > > Ciao ciao, > > Claudio > > On 11/19/20 11:32 AM, Vitaly Kuznetsov wrote: >> This series is a part of the previously sent "[PATCH RFC v3 00/23] i386: >> KVM: expand Hyper-V features ea

[PATCH RFC 06/22] i386: move hyperv_limits initialization to x86_cpu_realizefn()

2020-09-04 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 14/22] i386: move eVMCS enablement to hyperv_init_vcpu()

2020-09-04 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 | 63 --- 1 file changed, 38 insertions(+), 25

[PATCH RFC 01/22] WIP: update linux/headers

2020-09-04 Thread Vitaly Kuznetsov
KVM_CAP_SYS_HYPERV_CPUID definition is needed for this series. Signed-off-by: Vitaly Kuznetsov --- include/standard-headers/drm/drm_fourcc.h | 140 ++ include/standard-headers/linux/ethtool.h | 87 +++ .../linux/input-event-codes.h | 3

[PATCH RFC 18/22] i386: prefer system KVM_GET_SUPPORTED_HV_CPUID ioctl over vCPU's one

2020-09-04 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 00/22] i386: KVM: expand Hyper-V features early

2020-09-04 Thread Vitaly Kuznetsov
reating 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 expansio

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

2020-09-04 Thread Vitaly Kuznetsov
As a preparation to expanding Hyper-V CPU features early, move hyperv_vendor_id initialization to x86_cpu_realizefn(). Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.c | 15 ++- target/i386/cpu.h | 3 ++- target/i386/kvm.c | 25 ++--- 3 files changed, 26

[PATCH RFC 07/22] i386: fill in FEAT_HYPERV_EDX from edx instead of eax

2020-09-04 Thread Vitaly Kuznetsov
There was a typo which went unnoticed. Fixes: e48ddcc6ce13 ("i386/kvm: implement 'hv-passthrough' mode") Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/kvm.c b/target/i386/kvm.

[PATCH RFC 21/22] i386: record if Hyper-V features were already expanded

2020-09-04 Thread Vitaly Kuznetsov
Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.h | 1 + target/i386/kvm.c | 6 ++ 2 files changed, 7 insertions(+) diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 0aad60e0c707..c72755139047 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1669,6 +1669,7 @@ str

[PATCH RFC 11/22] i386: add reserved FEAT_HV_NESTED_EBX/ECX/EDX CPUID leaves

2020-09-04 Thread Vitaly Kuznetsov
As a preparation to expanding Hyper-V CPU features early, add reserved FEAT_HV_NESTED_EBX/ECX/EDX CPUID leaves. Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.c | 15 +++ target/i386/cpu.h | 3 +++ target/i386/kvm.c | 6 ++ 3 files changed, 24 insertions(+) diff --git a

[PATCH RFC 04/22] i386: move hyperv_interface_id initialization to x86_cpu_realizefn()

2020-09-04 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 09/22] i386: add reserved FEAT_HYPERV_ECX CPUID leaf

2020-09-04 Thread Vitaly Kuznetsov
As a preparation to expanding Hyper-V CPU features early, add reserved FEAT_HYPERV_ECX CPUID leaf. Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.c | 5 + target/i386/cpu.h | 1 + target/i386/kvm.c | 2 ++ 3 files changed, 8 insertions(+) diff --git a/target/i386/cpu.c b/target/i386

[PATCH RFC 08/22] i386: invert hyperv_spinlock_attempts setting logic with hv_passthrough

2020-09-04 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 13/22] i386: split hyperv_handle_properties() into hyperv_expand_features()/hyperv_fill_cpuids()

2020-09-04 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 | 45 + 1 file changed, 29 insertions(+), 16

[PATCH RFC 10/22] i386: add reserved FEAT_HV_RECOMM_ECX/FEAT_HV_RECOMM_EDX CPUID leaves

2020-09-04 Thread Vitaly Kuznetsov
As a preparation to expanding Hyper-V CPU features early, add reserved FEAT_HV_RECOMM_ECX/FEAT_HV_RECOMM_EDX CPUID leaves. Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.c | 10 ++ target/i386/cpu.h | 2 ++ target/i386/kvm.c | 5 + 3 files changed, 17 insertions(+) diff

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

2020-09-04 Thread Vitaly Kuznetsov
Use standard error_setg() mechanism in hyperv_expand_features(). Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm.c | 96 +++ 1 file changed, 64 insertions(+), 32 deletions(-) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 2e9ceafa2421

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

2020-09-04 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 87b83a2aa2cb..b7f0e200a75f 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -1221,9 +1221,6

[PATCH RFC 05/22] i386: move hyperv_version_id initialization to x86_cpu_realizefn()

2020-09-04 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 02/22] i386: drop x86_cpu_get_supported_feature_word() forward declaration

2020-09-04 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 49d89585288d..14489def2177 100644

[PATCH RFC 17/22] i386: adjust the expected KVM_GET_SUPPORTED_HV_CPUID array size

2020-09-04 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 22/22] i386: expand Hyper-V features early

2020-09-04 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 19/22] i386: prepare hyperv_expand_features() to be called at CPU feature expansion time

2020-09-04 Thread Vitaly Kuznetsov
If hyperv_expand_features() is called before vCPU is created, cs->kvm_state is NULL. We can only do the expantion if system wide KVM_GET_SUPPORTED_HV_CPUID is supported. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm.c | 13 - 1 file changed, 12 insertions(+), 1 delet

[PATCH RFC 16/22] i386: make hyperv_expand_features() return void

2020-09-04 Thread Vitaly Kuznetsov
As hyperv_expand_features() now uses standard error_setg() mechanism we can make it return void. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm.c | 16 +--- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 760b93091fea

[PATCH RFC 20/22] i386: use global kvm_state in hyperv_enabled() check

2020-09-04 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] 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

Re: [Qemu-devel] [PATCH] i386/kvm: add support for Hyper-V TLB flush

2018-06-29 Thread Vitaly Kuznetsov
Vitaly Kuznetsov writes: > Add support for Hyper-V TLB flush which recently got added to KVM. > > Just like regular Hyper-V we announce HV_EX_PROCESSOR_MASKS_RECOMMENDED > regardless of how many vCPUs we have. Windows is 'smart' and uses less > expensive non-EX Hypercal

[Qemu-devel] [PATCH 2/2] i386/kvm: add support for Hyper-V IPI send

2018-10-08 Thread Vitaly Kuznetsov
Hyper-V PV IPI support is merged to KVM, enable the feature in Qemu. When enabled, this allows Windows guests to send IPIs to other vCPUs with a single hypercall even when there are >64 vCPUs in the request. Signed-off-by: Vitaly Kuznetsov --- target/i386/cpu.c | 1 + target/i

[Qemu-devel] [PATCH 1/2] linux-headers: update to pre-4.20 (kvm/queue)

2018-10-08 Thread Vitaly Kuznetsov
This brings us three new defines: KVM_CAP_ARM_INJECT_SERROR_ESR, KVM_CAP_MSR_PLATFORM_INFO and KVM_CAP_HYPERV_SEND_IPI. Signed-off-by: Vitaly Kuznetsov --- linux-headers/linux/kvm.h | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/linux-headers/linux/kvm.h b/linux

[Qemu-devel] [PATCH 0/2] i386/kvm: enable Hyper-V PV IPI mechanism

2018-10-08 Thread Vitaly Kuznetsov
Hyper-V PV IPI enlightenment was merged to KVM (kvm/queue currently). Support the feature enablement in Qemu. Vitaly Kuznetsov (2): linux-headers: update to pre-4.20 (kvm/queue) i386/kvm: add support for Hyper-V IPI send linux-headers/linux/kvm.h | 7 +-- target/i386/cpu.c

Re: [Qemu-devel] [PATCH 1/2] linux-headers: update to pre-4.20 (kvm/queue)

2018-10-09 Thread Vitaly Kuznetsov
Roman Kagan writes: > On Mon, Oct 08, 2018 at 01:27:25PM +0200, Vitaly Kuznetsov wrote: >> This brings us three new defines: KVM_CAP_ARM_INJECT_SERROR_ESR, >> KVM_CAP_MSR_PLATFORM_INFO and KVM_CAP_HYPERV_SEND_IPI. >> >> Signed-off-by: Vitaly Kuznetsov >> ---

[Qemu-devel] [PATCH v2 1/2] linux-headers: update to pre-4.20 (kvm/queue)

2018-10-09 Thread Vitaly Kuznetsov
This brings us three new defines: KVM_CAP_ARM_INJECT_SERROR_ESR, KVM_CAP_MSR_PLATFORM_INFO and KVM_CAP_HYPERV_SEND_IPI. Signed-off-by: Vitaly Kuznetsov --- linux-headers/linux/kvm.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h

[Qemu-devel] [PATCH v2 0/2] i386/kvm: enable Hyper-V PV IPI mechanism

2018-10-09 Thread Vitaly Kuznetsov
Hyper-V PV IPI enlightenment was merged to KVM (kvm/queue currently). Support the feature enablement in Qemu. Changes since v1 [Roman Kagan]: - Strip kvm.h with 'make headers_install' before putting to Qemu. - Add Reviewed-by: to PATCH2 Vitaly Kuznetsov (2): linux-headers: update t

[Qemu-devel] [PATCH v2 2/2] i386/kvm: add support for Hyper-V IPI send

2018-10-09 Thread Vitaly Kuznetsov
Hyper-V PV IPI support is merged to KVM, enable the feature in Qemu. When enabled, this allows Windows guests to send IPIs to other vCPUs with a single hypercall even when there are >64 vCPUs in the request. Signed-off-by: Vitaly Kuznetsov Reviewed-by: Roman Kagan --- target/i386/cp

Re: [Qemu-devel] [PATCH 1/2] linux-headers: update to pre-4.20 (kvm/queue)

2018-10-09 Thread Vitaly Kuznetsov
Roman Kagan writes: > On Tue, Oct 09, 2018 at 03:01:12PM +0200, Vitaly Kuznetsov wrote: >> Roman Kagan writes: >> >> > On Mon, Oct 08, 2018 at 01:27:25PM +0200, Vitaly Kuznetsov wrote: >> >> This brings us three new defines: KVM_CAP_ARM_INJECT_SERROR_ESR,

Re: [PATCH] target/i386/kvm: Add Hyper-V direct tlb flush support

2019-10-13 Thread Vitaly Kuznetsov
lantianyu1...@gmail.com writes: > From: Tianyu Lan > (Please also Cc: Roman on you Hyper-V related submissions to QEMU who's known to be a great reviewer) > Hyper-V direct tlb flush targets KVM on Hyper-V guest. > Enable direct TLB flush for its guests meaning that TLB > flush hypercalls are ha

Re: [PATCH] target/i386/kvm: Add Hyper-V direct tlb flush support

2019-10-14 Thread Vitaly Kuznetsov
Tianyu Lan writes: >> > --- a/linux-headers/linux/kvm.h >> > +++ b/linux-headers/linux/kvm.h >> > @@ -995,6 +995,7 @@ struct kvm_ppc_resize_hpt { >> > #define KVM_CAP_ARM_SVE 170 >> > #define KVM_CAP_ARM_PTRAUTH_ADDRESS 171 >> > #define KVM_CAP_ARM_PTRAUTH_GENERIC 172 >> > +#define KVM_CAP_HYP

Re: [PATCH V2 2/2] target/i386/kvm: Add Hyper-V direct tlb flush support

2019-10-15 Thread Vitaly Kuznetsov
lantianyu1...@gmail.com writes: > From: Tianyu Lan > > Hyper-V direct tlb flush targets KVM on Hyper-V guest. > Enable direct TLB flush for its guests meaning that TLB > flush hypercalls are handled by Level 0 hypervisor (Hyper-V) > bypassing KVM in Level 1. Due to the different ABI for hypercall

[PATCH] i386/kvm: add NoNonArchitecturalCoreSharing Hyper-V enlightenment

2019-10-18 Thread Vitaly Kuznetsov
and correct topology is exposed. As CPU pinning is done outside of QEMU the enablement decision will be made on a higher level. 'auto' - copy KVM setting. As during live migration SMT settings on the source and destination host may differ this requires us to add a migration blocker. Sig

Re: Using virtual IOMMU in guest hypervisors other than KVM and Xen?

2019-10-21 Thread Vitaly Kuznetsov
Peter Xu writes: > On Fri, Oct 18, 2019 at 11:19:55PM -0700, Jintack Lim wrote: >> On Fri, Oct 18, 2019 at 8:37 PM Peter Xu wrote: >> > >> > On Wed, Oct 16, 2019 at 03:01:22PM -0700, Jintack Lim wrote: >> > > On Mon, Oct 14, 2019 at 7:50 PM Peter Xu wrote: >> > > > >> > > > On Mon, Oct 14, 2019

Re: [PATCH] i386/kvm: add NoNonArchitecturalCoreSharing Hyper-V enlightenment

2019-10-21 Thread Vitaly Kuznetsov
Paolo Bonzini writes: > On 18/10/19 18:39, Vitaly Kuznetsov wrote: >> Hyper-V TLFS specifies this enlightenment as: >> "NoNonArchitecturalCoreSharing - Indicates that a virtual processor will >> never >> share a physical core with another virtual processor, excep

Re: [PATCH] i386/kvm: add NoNonArchitecturalCoreSharing Hyper-V enlightenment

2019-10-23 Thread Vitaly Kuznetsov
Eduardo Habkost writes: > On Mon, Oct 21, 2019 at 06:26:14PM +0200, Paolo Bonzini wrote: >> On 21/10/19 16:09, Vitaly Kuznetsov wrote: >> >>> +if (cpu->hyperv_no_nonarch_cs == ON_OFF_AUTO_ON) { >> >>> +env->features[FEAT_HV_RECOMM_EAX] |=

Re: [Qemu-devel] [PATCH] i386: Fix signedness of hyperv_spinlock_attempts

2019-06-17 Thread Vitaly Kuznetsov
gt; -int hyperv_spinlock_attempts; > +uint32_t hyperv_spinlock_attempts; > char *hyperv_vendor_id; > bool hyperv_time; > bool hyperv_crash; Reviewed-by: Vitaly Kuznetsov -- Vitaly

Re: [Qemu-devel] [PATCH] i386/kvm: expose HV_CPUID_ENLIGHTMENT_INFO.EAX and HV_CPUID_NESTED_FEATURES.EAX as feature words

2018-12-03 Thread Vitaly Kuznetsov
Eduardo Habkost writes: > On Thu, Nov 29, 2018 at 12:51:55PM +0100, Vitaly Kuznetsov wrote: >> Paolo Bonzini writes: >> >> > On 26/11/18 14:59, Vitaly Kuznetsov wrote: >> >> It was found that QMP users of QEMU (e.g. libvirt) may need

[Qemu-devel] [PATCH v2] i386/kvm: expose HV_CPUID_ENLIGHTMENT_INFO.EAX and HV_CPUID_NESTED_FEATURES.EAX as feature words

2018-12-03 Thread Vitaly Kuznetsov
eature words. Signed-off-by: Vitaly Kuznetsov Reviewed-by: Roman Kagan --- Changes since v1: - Add a comment explaining why .feat_names are currently commented out for Hyper-V feature words. [Paolo Bonzini] - Add Roman's R-b tag. --- target/i386/cpu.c | 37 + target/i

Re: [Qemu-devel] [PATCH] i386/kvm: expose HV_CPUID_ENLIGHTMENT_INFO.EAX and HV_CPUID_NESTED_FEATURES.EAX as feature words

2018-12-05 Thread Vitaly Kuznetsov
Eduardo Habkost writes: >>[...] Some time ago when merging direct mode stimers for KVM >> Paolo suggested we stop adding capabilities to KVM for each individulat >> feature and replace them with something like KVM_GET_SUPPORTED_HV_CPUID >> ioctl returning all Hyper-V related feature w

[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

<    1   2   3   4   5   6   >