From patchwork Mon Oct 24 18:53:54 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 121393 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 353991007D1 for ; Tue, 25 Oct 2011 05:47:29 +1100 (EST) Received: from localhost ([::1]:37937 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RIPYU-00005S-BV for incoming@patchwork.ozlabs.org; Mon, 24 Oct 2011 14:47:26 -0400 Received: from eggs.gnu.org ([140.186.70.92]:48378) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RIPYP-00005A-Cd for qemu-devel@nongnu.org; Mon, 24 Oct 2011 14:47:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RIPYO-00085h-4D for qemu-devel@nongnu.org; Mon, 24 Oct 2011 14:47:21 -0400 Received: from cantor2.suse.de ([195.135.220.15]:43218 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RIPYN-00085S-VE; Mon, 24 Oct 2011 14:47:20 -0400 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id D78F28BB22; Mon, 24 Oct 2011 20:47:18 +0200 (CEST) From: Alexander Graf To: qemu-devel@nongnu.org Date: Mon, 24 Oct 2011 20:53:54 +0200 Message-Id: <1319482434-21185-1-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.7.3.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 195.135.220.15 Cc: qemu-ppc@nongnu.org, David Gibson Subject: [Qemu-devel] [PATCH] KVM: PPC: Override host vmx/vsx/dfp only when information known X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The -cpu host feature tries to find out the host capabilities based on device tree information. However, we don't always have that available because it's an optional property in dt. So instead of force unsetting values depending on an unreliable source of information, let's just try to be clever about it and not override capabilities when we don't know the device tree pieces. This fixes altivec with -cpu host on YDL PowerStations. Signed-off-by: Alexander Graf --- target-ppc/kvm.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c index a090d79..f3d0861 100644 --- a/target-ppc/kvm.c +++ b/target-ppc/kvm.c @@ -912,9 +912,15 @@ const ppc_def_t *kvmppc_host_cpu_def(void) /* Now fix up the spec with information we can query from the host */ - alter_insns(&spec->insns_flags, PPC_ALTIVEC, vmx > 0); - alter_insns(&spec->insns_flags2, PPC2_VSX, vmx > 1); - alter_insns(&spec->insns_flags2, PPC2_DFP, dfp); + if (vmx != -1) { + /* Only override when we know what the host supports */ + alter_insns(&spec->insns_flags, PPC_ALTIVEC, vmx > 0); + alter_insns(&spec->insns_flags2, PPC2_VSX, vmx > 1); + } + if (dfp != -1) { + /* Only override when we know what the host supports */ + alter_insns(&spec->insns_flags2, PPC2_DFP, dfp); + } return spec; }