From patchwork Fri Jun 27 15:22:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Hogan X-Patchwork-Id: 4436041 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 45E5EBEEAA for ; Fri, 27 Jun 2014 15:23:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6C4D0200F4 for ; Fri, 27 Jun 2014 15:23:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3B75720172 for ; Fri, 27 Jun 2014 15:23:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754523AbaF0PXG (ORCPT ); Fri, 27 Jun 2014 11:23:06 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:58531 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753275AbaF0PXD (ORCPT ); Fri, 27 Jun 2014 11:23:03 -0400 Received: from KLMAIL01.kl.imgtec.org (unknown [192.168.5.35]) by Websense Email Security Gateway with ESMTPS id 66B68A7F18554; Fri, 27 Jun 2014 16:22:57 +0100 (IST) Received: from LEMAIL01.le.imgtec.org (192.168.152.62) by KLMAIL01.kl.imgtec.org (192.168.5.35) with Microsoft SMTP Server (TLS) id 14.3.195.1; Fri, 27 Jun 2014 16:22:59 +0100 Received: from jhogan-linux.le.imgtec.org (192.168.154.101) by LEMAIL01.le.imgtec.org (192.168.152.62) with Microsoft SMTP Server (TLS) id 14.3.174.1; Fri, 27 Jun 2014 16:22:59 +0100 From: James Hogan To: CC: , Aurelien Jarno , "Paolo Bonzini" , James Hogan Subject: [PATCH v2 2/4] mips/kvm: Disable FPU on reset with KVM Date: Fri, 27 Jun 2014 16:22:42 +0100 Message-ID: <1403882562-28367-1-git-send-email-james.hogan@imgtec.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <53AD568E.7090409@redhat.com> References: <53AD568E.7090409@redhat.com> MIME-Version: 1.0 X-Originating-IP: [192.168.154.101] Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, 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 KVM doesn't yet support the MIPS FPU, or writing to the guest's Config1 register which contains the FPU implemented bit. Clear QEMU's version of that bit on reset and display a warning that the FPU has been disabled. The previous incorrect Config1 CP0 register value wasn't being passed to KVM yet, however we should ensure it is set correctly now to reduce the risk of breaking migration/loadvm to a future version of QEMU/Linux that does support it. Signed-off-by: James Hogan Cc: Aurelien Jarno Cc: Paolo Bonzini --- A slight variation this time, which should handle the case of the user setting the CPU explicitly a bit better (previously only the default Malta CPU was changed). Look reasonable? Changes in v2: - Add a warning to alert user that FPU is disabled (Aurelien Jarno). - Slightly different approach. Disable the FPU on reset from KVM code instead of only changing the default CPU for Malta. This will then happen even if the user specifies the core type explicitly (and without having to modify any CPU definitions), but it does print a message on each reset. - Rewrite (and hopefully clarify) commit message. --- target-mips/kvm.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/target-mips/kvm.c b/target-mips/kvm.c index 844e5bbe5f92..97fd51a02f5c 100644 --- a/target-mips/kvm.c +++ b/target-mips/kvm.c @@ -61,6 +61,13 @@ int kvm_arch_init_vcpu(CPUState *cs) void kvm_mips_reset_vcpu(MIPSCPU *cpu) { + CPUMIPSState *env = &cpu->env; + + if (env->CP0_Config1 & (1 << CP0C1_FP)) { + fprintf(stderr, "Warning: FPU not supported with KVM, disabling\n"); + env->CP0_Config1 &= ~(1 << CP0C1_FP); + } + DPRINTF("%s\n", __func__); }