From patchwork Thu Feb 25 15:15:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lan,Tianyu" X-Patchwork-Id: 8424631 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id ED636C0553 for ; Thu, 25 Feb 2016 15:31:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2E1852034C for ; Thu, 25 Feb 2016 15:31:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4E82120173 for ; Thu, 25 Feb 2016 15:31:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760422AbcBYPa5 (ORCPT ); Thu, 25 Feb 2016 10:30:57 -0500 Received: from mga01.intel.com ([192.55.52.88]:12626 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760249AbcBYPa4 (ORCPT ); Thu, 25 Feb 2016 10:30:56 -0500 Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP; 25 Feb 2016 07:30:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,498,1449561600"; d="scan'208";a="54669261" Received: from lantianyu-ws.sh.intel.com (HELO localhost) ([10.239.159.159]) by fmsmga004.fm.intel.com with ESMTP; 25 Feb 2016 07:30:53 -0800 From: Lan Tianyu To: afaerber@suse.de, pbonzini@redhat.com, rth@twiddle.net, ehabkost@redhat.com, jan.kiszka@web.de Cc: Lan Tianyu , qemu-devel@nongnu.org, kvm@vger.kernel.org Subject: [PATCH] Qemu/KVM: Remove x2apic feature from CPU model when kernel_irqchip is off Date: Thu, 25 Feb 2016 23:15:12 +0800 Message-Id: <1456413312-24063-1-git-send-email-tianyu.lan@intel.com> X-Mailer: git-send-email 1.7.9.5 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP x2apic feature is in the kvm_default_props and automatically added to all CPU models when KVM is enabled. But userspace devices don't support x2apic which can't be enabled without the in-kernel irqchip. It will trigger warning of "host doesn't support requested feature: CPUID.01H:ECX.x2apic [bit 21]" when kernel_irqchip is off. This patch is to fix it via removing x2apic feature when kernel_irqchip is off. Signed-off-by: Lan Tianyu Acked-by: Paolo Bonzini Reviewed-by: Eduardo Habkost --- target-i386/cpu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index c78f824..298fb62 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -2125,6 +2125,10 @@ static void x86_cpu_load_def(X86CPU *cpu, X86CPUDefinition *def, Error **errp) /* Special cases not set in the X86CPUDefinition structs: */ if (kvm_enabled()) { + if (!kvm_irqchip_in_kernel()) { + x86_cpu_change_kvm_default("x2apic", "off"); + } + x86_cpu_apply_props(cpu, kvm_default_props); }