From patchwork Wed Apr 25 11:54:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Guo X-Patchwork-Id: 904183 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40WJbf1tJ2z9rxs for ; Wed, 25 Apr 2018 21:57:34 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="TmuZkINV"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40WJbf0Mf1zF256 for ; Wed, 25 Apr 2018 21:57:34 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="TmuZkINV"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c00::244; helo=mail-pf0-x244.google.com; envelope-from=wei.guo.simon@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="TmuZkINV"; dkim-atps=neutral Received: from mail-pf0-x244.google.com (mail-pf0-x244.google.com [IPv6:2607:f8b0:400e:c00::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40WJXr00ZMzDrDT for ; Wed, 25 Apr 2018 21:55:03 +1000 (AEST) Received: by mail-pf0-x244.google.com with SMTP id o16so15004343pfk.9 for ; Wed, 25 Apr 2018 04:55:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=hGT0sQ0qilTO+osM8FcAg0/4cvh1+SisYVxaANX/w5k=; b=TmuZkINVhqq6qj6Tb2bRVS12M5D11eh+xr1JNBgQrhiusR2qxizisFVg1uBjHu7cEI FiqW2hxnMDf1zFtcBhciRxqpIH1dg+dhsBOGfjQC5L6+Is2OQivyB73nU5YoPDzwqsb1 4C4iecU2vtV6BdpPWaEQq28YeoP/Uz9s0PfNeygqx1irFNUxxVi7BvRX1bUmioLcNsdH oO0ViqbF3ij2KJG+qWud4Kg2jVo2LAxi/786MXwyyEy0ylRYv/9pLgWYotsydNKpL6Lj dXcepwvCYIwmPnPb03DgLbY+2/xeptJ4lHqRGjTzNqYmMsDRELwpjn5aGhmhrwGTwYF+ 80Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=hGT0sQ0qilTO+osM8FcAg0/4cvh1+SisYVxaANX/w5k=; b=UFl2ws80CHliu64s2tZsLxh1Vff9FgHDR2z8jKQQiUNQkQkQgNysGvlv7onH+h8a9U RGG7Msm+/95c3lvEInouWoYq+1A3cwNul5GEeQzs4KJN42JFreUTyD3dD/xNzbxzzK7s +U84F3kIN3DKq8EyTL1GNb4sDwuclIp1rFbtmTGzZg/4uXUZz/svig1XW568rQGRx5f1 yKtV6MMV72/30KQntVUy++5n8FbasCVkzOSiMiT/G0p5Q0bA2zAOOm2Nhbxvkt/DQvim IfB0vPoRESG62GP6E+k2Tzv4LwD2/V0BjMFB469S9MPUzSiSjBlq7CUH+59FGL9VHFuA COFQ== X-Gm-Message-State: ALQs6tC2Eu+AvAVxJwRK9Zo63boNqGsUelfmiH/I4LtiaHg5TaStkgUB je9V6tGFM+9ZEy/dZv/Bq+ztzQ== X-Google-Smtp-Source: AIpwx48L8dc8xSSKw4Csmo/RyGM0nTvTPdg3/Kxzp3cij5jwDcteRJEVspiTzLWZvmegKvjbW/TrMw== X-Received: by 10.99.174.73 with SMTP id e9mr22999142pgp.38.1524657301444; Wed, 25 Apr 2018 04:55:01 -0700 (PDT) Received: from simonLocalRHEL7.cn.ibm.com ([112.73.0.87]) by smtp.gmail.com with ESMTPSA id j1sm30912934pgn.69.2018.04.25.04.54.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Apr 2018 04:55:00 -0700 (PDT) From: wei.guo.simon@gmail.com To: kvm-ppc@vger.kernel.org Subject: [PATCH 00/11] KVM: PPC: reconstruct mmio emulation with analyse_instr() Date: Wed, 25 Apr 2018 19:54:33 +0800 Message-Id: <1524657284-16706-1-git-send-email-wei.guo.simon@gmail.com> X-Mailer: git-send-email 1.8.3.1 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Simon Guo , linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" From: Simon Guo We already have analyse_instr() which analyzes instructions for the instruction type, size, addtional flags, etc. What kvmppc_emulate_loadstore() did is somehow duplicated and it will be good to utilize analyse_instr() to reconstruct the code. The advantage is that the code logic will be shared and more clean to be maintained. This patch series reconstructs kvmppc_emulate_loadstore() for various load/store instructions. The testcase locates at: https://github.com/justdoitqd/publicFiles/blob/master/test_mmio.c - Tested at both PR/HV KVM. - Also tested with little endian host & big endian guest. Tested instruction list: lbz lbzu lbzx ld ldbrx ldu ldx lfd lfdu lfdx lfiwax lfiwzx lfs lfsu lfsx lha lhau lhax lhbrx lhz lhzu lhzx lvx lwax lwbrx lwz lwzu lwzx lxsdx lxsiwax lxsiwzx lxsspx lxvd2x lxvdsx lxvw4x stb stbu stbx std stdbrx stdu stdx stfd stfdu stfdx stfiwx stfs stfsx sth sthbrx sthu sthx stvx stw stwbrx stwu stwx stxsdx stxsiwx stxsspx stxvd2x stxvw4x Simon Guo (11): KVM: PPC: add pt_regs into kvm_vcpu_arch and move vcpu->arch.gpr[] into it KVM: PPC: mov nip/ctr/lr/xer registers to pt_regs in kvm_vcpu_arch KVM: PPC: Fix a mmio_host_swabbed uninitialized usage issue when VMX store KVM: PPC: fix incorrect element_size for stxsiwx in analyse_instr KVM: PPC: add GPR RA update skeleton for MMIO emulation KVM: PPC: add KVMPPC_VSX_COPY_WORD_LOAD_DUMP type support for mmio emulation KVM: PPC: reconstruct non-SIMD LOAD/STORE instruction mmio emulation with analyse_intr() input KVM: PPC: add giveup_ext() hook for PPC KVM ops KVM: PPC: reconstruct LOAD_FP/STORE_FP instruction mmio emulation with analyse_intr() input KVM: PPC: reconstruct LOAD_VMX/STORE_VMX instruction mmio emulation with analyse_intr() input KVM: PPC: reconstruct LOAD_VSX/STORE_VSX instruction mmio emulation with analyse_intr() input arch/powerpc/include/asm/kvm_book3s.h | 20 +- arch/powerpc/include/asm/kvm_book3s_64.h | 20 +- arch/powerpc/include/asm/kvm_booke.h | 20 +- arch/powerpc/include/asm/kvm_host.h | 9 +- arch/powerpc/include/asm/kvm_ppc.h | 2 + arch/powerpc/include/asm/sstep.h | 2 +- arch/powerpc/kernel/asm-offsets.c | 22 +- arch/powerpc/kvm/book3s_32_mmu.c | 2 +- arch/powerpc/kvm/book3s_64_vio_hv.c | 2 +- arch/powerpc/kvm/book3s_hv.c | 11 +- arch/powerpc/kvm/book3s_hv_builtin.c | 6 +- arch/powerpc/kvm/book3s_hv_rm_mmu.c | 15 +- arch/powerpc/kvm/book3s_hv_rm_xics.c | 2 +- arch/powerpc/kvm/book3s_hv_tm.c | 10 +- arch/powerpc/kvm/book3s_hv_tm_builtin.c | 10 +- arch/powerpc/kvm/book3s_pr.c | 73 +-- arch/powerpc/kvm/book3s_xive_template.c | 4 +- arch/powerpc/kvm/booke.c | 41 +- arch/powerpc/kvm/booke_emulate.c | 6 +- arch/powerpc/kvm/e500_emulate.c | 6 +- arch/powerpc/kvm/e500_mmu.c | 2 +- arch/powerpc/kvm/emulate_loadstore.c | 734 +++++++++---------------------- arch/powerpc/kvm/powerpc.c | 53 ++- arch/powerpc/lib/sstep.c | 2 +- 24 files changed, 407 insertions(+), 667 deletions(-)