diff mbox

target-i386: kvm: Report kvm_pv_unhalt as unsupported w/o kernel_irqchip

Message ID 1471025672-12541-1-git-send-email-ehabkost@redhat.com
State New
Headers show

Commit Message

Eduardo Habkost Aug. 12, 2016, 6:14 p.m. UTC
The kvm_pv_unhalt feature doesn't work if kernel_irqchip is
disabled, so we need to report it as unsupported.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 target-i386/kvm.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Eduardo Habkost Aug. 12, 2016, 6:16 p.m. UTC | #1
Sorry, forgot the for-2.7 tag in the Subject. This is a bug fix I
would like to get into QEMU 2.7.

On Fri, Aug 12, 2016 at 03:14:32PM -0300, Eduardo Habkost wrote:
> The kvm_pv_unhalt feature doesn't work if kernel_irqchip is
> disabled, so we need to report it as unsupported.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
>  target-i386/kvm.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/target-i386/kvm.c b/target-i386/kvm.c
> index 0b2016a..d1a25c5 100644
> --- a/target-i386/kvm.c
> +++ b/target-i386/kvm.c
> @@ -329,6 +329,13 @@ uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function,
>           */
>          cpuid_1_edx = kvm_arch_get_supported_cpuid(s, 1, 0, R_EDX);
>          ret |= cpuid_1_edx & CPUID_EXT2_AMD_ALIASES;
> +    } else if (function == KVM_CPUID_FEATURES && reg == R_EAX) {
> +        /* kvm_pv_unhalt is reported by GET_SUPPORTED_CPUID, but it can't
> +         * be enabled without the in-kernel irqchip
> +         */
> +        if (!kvm_irqchip_in_kernel()) {
> +            ret &= ~(1U << KVM_FEATURE_PV_UNHALT);
> +        }
>      }
>  
>      /* fallback for older kernels */
> -- 
> 2.7.4
>
Andrew Jones Aug. 12, 2016, 6:24 p.m. UTC | #2
On Fri, Aug 12, 2016 at 03:14:32PM -0300, Eduardo Habkost wrote:
> The kvm_pv_unhalt feature doesn't work if kernel_irqchip is
> disabled, so we need to report it as unsupported.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
>  target-i386/kvm.c | 7 +++++++
>  1 file changed, 7 insertions(+)

Reviewed-by: Andrew Jones <drjones@redhat.com>

> 
> diff --git a/target-i386/kvm.c b/target-i386/kvm.c
> index 0b2016a..d1a25c5 100644
> --- a/target-i386/kvm.c
> +++ b/target-i386/kvm.c
> @@ -329,6 +329,13 @@ uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function,
>           */
>          cpuid_1_edx = kvm_arch_get_supported_cpuid(s, 1, 0, R_EDX);
>          ret |= cpuid_1_edx & CPUID_EXT2_AMD_ALIASES;
> +    } else if (function == KVM_CPUID_FEATURES && reg == R_EAX) {
> +        /* kvm_pv_unhalt is reported by GET_SUPPORTED_CPUID, but it can't
> +         * be enabled without the in-kernel irqchip
> +         */
> +        if (!kvm_irqchip_in_kernel()) {
> +            ret &= ~(1U << KVM_FEATURE_PV_UNHALT);
> +        }
>      }
>  
>      /* fallback for older kernels */
> -- 
> 2.7.4
> 
>
Peter Xu Aug. 15, 2016, 7:34 a.m. UTC | #3
On Fri, Aug 12, 2016 at 03:14:32PM -0300, Eduardo Habkost wrote:
> The kvm_pv_unhalt feature doesn't work if kernel_irqchip is
> disabled, so we need to report it as unsupported.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Tested-by: Peter Xu <peterx@redhat.com>

-- peterx
diff mbox

Patch

diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 0b2016a..d1a25c5 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -329,6 +329,13 @@  uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function,
          */
         cpuid_1_edx = kvm_arch_get_supported_cpuid(s, 1, 0, R_EDX);
         ret |= cpuid_1_edx & CPUID_EXT2_AMD_ALIASES;
+    } else if (function == KVM_CPUID_FEATURES && reg == R_EAX) {
+        /* kvm_pv_unhalt is reported by GET_SUPPORTED_CPUID, but it can't
+         * be enabled without the in-kernel irqchip
+         */
+        if (!kvm_irqchip_in_kernel()) {
+            ret &= ~(1U << KVM_FEATURE_PV_UNHALT);
+        }
     }
 
     /* fallback for older kernels */