From patchwork Sun Jun 22 21:23:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 4396741 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E5B759F383 for ; Sun, 22 Jun 2014 21:24:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2CEE22022A for ; Sun, 22 Jun 2014 21:24:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3EC822021A for ; Sun, 22 Jun 2014 21:24:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752600AbaFVVYu (ORCPT ); Sun, 22 Jun 2014 17:24:50 -0400 Received: from cantor2.suse.de ([195.135.220.15]:33355 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752251AbaFVVXo (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 6D46BAD7B; 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 31/33] KVM: PPC: Add rlwinm instruction emulation Date: Sun, 22 Jun 2014 23:23:35 +0200 Message-Id: <1403472217-22263-32-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 emulation support for the rlwinm instruction. Signed-off-by: Alexander Graf --- arch/powerpc/include/asm/ppc-opcode.h | 1 + arch/powerpc/kvm/emulate.c | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h index 569b518..fac38a8 100644 --- a/arch/powerpc/include/asm/ppc-opcode.h +++ b/arch/powerpc/include/asm/ppc-opcode.h @@ -120,6 +120,7 @@ #define OP_ADDIS 15 #define OP_BC 16 #define OP_RLWIMI 20 +#define OP_RLWINM 21 #define OP_ORI 24 #define OP_ORIS 25 #define OP_ANDI 28 diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c index c40f255..1da6691 100644 --- a/arch/powerpc/kvm/emulate.c +++ b/arch/powerpc/kvm/emulate.c @@ -601,7 +601,7 @@ int kvmppc_emulate_rld(struct kvm_vcpu *vcpu, u32 inst) return EMULATE_DONE; } -int kvmppc_emulate_rlwimi(struct kvm_vcpu *vcpu, u32 inst) +int kvmppc_emulate_rlwi(struct kvm_vcpu *vcpu, u32 inst) { int sh = (inst >> 11) & 0x1f; int mb = (inst >> 6) & 0x1f; @@ -623,7 +623,8 @@ int kvmppc_emulate_rlwimi(struct kvm_vcpu *vcpu, u32 inst) mask = ~mask; } dest &= mask; - dest |= kvmppc_get_gpr(vcpu, get_ra(inst)) & ~mask; + if (get_op(inst) == OP_RLWIMI) + dest |= kvmppc_get_gpr(vcpu, get_ra(inst)) & ~mask; kvmppc_set_gpr(vcpu, get_ra(inst), dest); if (get_rc(inst)) @@ -707,7 +708,10 @@ int kvmppc_emulate_any_instruction(struct kvm_vcpu *vcpu) emulated = kvmppc_emulate_rld(vcpu, inst); break; case OP_RLWIMI: - emulated = kvmppc_emulate_rlwimi(vcpu, inst); + emulated = kvmppc_emulate_rlwi(vcpu, inst); + break; + case OP_RLWINM: + emulated = kvmppc_emulate_rlwi(vcpu, inst); break; case 31: switch (get_xop(inst)) {