From patchwork Sun Jun 22 21:23:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 4396821 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 742FFBEEAA for ; Sun, 22 Jun 2014 21:25:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B4E6F2021A for ; Sun, 22 Jun 2014 21:25:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E1A8E201DE for ; Sun, 22 Jun 2014 21:25:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752635AbaFVVZ1 (ORCPT ); Sun, 22 Jun 2014 17:25:27 -0400 Received: from cantor2.suse.de ([195.135.220.15]:33358 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752221AbaFVVXo (ORCPT ); Sun, 22 Jun 2014 17:23:44 -0400 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 45D16AD6B; Sun, 22 Jun 2014 21:23:38 +0000 (UTC) From: Alexander Graf To: kvm-ppc@vger.kernel.org Cc: kvm@vger.kernel.org Subject: [PATCH 18/33] KVM: PPC: Add mfcr instruction emulation Date: Sun, 22 Jun 2014 23:23:22 +0200 Message-Id: <1403472217-22263-19-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1403472217-22263-1-git-send-email-agraf@suse.de> References: <1403472217-22263-1-git-send-email-agraf@suse.de> 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=unavailable 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 This patch adds full emulation support for the mfcr instruction. Signed-off-by: Alexander Graf --- arch/powerpc/include/asm/ppc-opcode.h | 1 + arch/powerpc/kvm/emulate.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h index 3132bb9..ce135be 100644 --- a/arch/powerpc/include/asm/ppc-opcode.h +++ b/arch/powerpc/include/asm/ppc-opcode.h @@ -86,6 +86,7 @@ #define OP_TRAP_64 2 #define OP_31_XOP_TRAP 4 +#define OP_31_XOP_MFCR 19 #define OP_31_XOP_LWZX 23 #define OP_31_XOP_DCBST 54 #define OP_31_XOP_LWZUX 55 diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c index e688d85..33a34c3 100644 --- a/arch/powerpc/kvm/emulate.c +++ b/arch/powerpc/kvm/emulate.c @@ -473,6 +473,16 @@ int kvmppc_emulate_any_instruction(struct kvm_vcpu *vcpu) emulated = kvmppc_emulate_load(vcpu, addr, &value, 4); kvmppc_set_gpr(vcpu, get_rt(inst), value); break; + case 31: + switch (get_xop(inst)) { + case OP_31_XOP_MFCR: + kvmppc_set_gpr(vcpu, get_rt(inst), kvmppc_get_cr(vcpu)); + break; + default: + emulated = EMULATE_FAIL; + break; + } + break; default: emulated = EMULATE_FAIL; break;