From patchwork Fri Jan 22 10:50:31 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Yu-B13201 X-Patchwork-Id: 74599 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o0MAxJit021891 for ; Fri, 22 Jan 2010 10:59:19 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754010Ab0AVK7Q (ORCPT ); Fri, 22 Jan 2010 05:59:16 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753011Ab0AVK7P (ORCPT ); Fri, 22 Jan 2010 05:59:15 -0500 Received: from az33egw02.freescale.net ([192.88.158.103]:36940 "EHLO az33egw02.freescale.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753421Ab0AVK7L (ORCPT ); Fri, 22 Jan 2010 05:59:11 -0500 Received: from de01smr02.am.mot.com (de01smr02.freescale.net [10.208.0.151]) by az33egw02.freescale.net (8.14.3/az33egw02) with ESMTP id o0MAx5ix015623; Fri, 22 Jan 2010 03:59:05 -0700 (MST) Received: from zch01exm26.fsl.freescale.net (zch01exm26.ap.freescale.net [10.192.129.221]) by de01smr02.am.mot.com (8.13.1/8.13.0) with ESMTP id o0MB5c4H021801; Fri, 22 Jan 2010 05:05:44 -0600 (CST) Received: from localhost ([10.193.20.106]) by zch01exm26.fsl.freescale.net with Microsoft SMTPSVC(6.0.3790.3959); Fri, 22 Jan 2010 18:58:58 +0800 From: Liu Yu To: kvm-ppc@vger.kernel.org, agraf@suse.de, kvm@vger.kernel.org Cc: Liu Yu Subject: [PATCH v2 3/3] kvmppc/e500: fix tlbcfg emulation Date: Fri, 22 Jan 2010 18:50:31 +0800 Message-Id: <1264157431-16396-4-git-send-email-yu.liu@freescale.com> X-Mailer: git-send-email 1.6.4 In-Reply-To: <1264157431-16396-3-git-send-email-yu.liu@freescale.com> References: <1264157431-16396-1-git-send-email-yu.liu@freescale.com> <1264157431-16396-2-git-send-email-yu.liu@freescale.com> <1264157431-16396-3-git-send-email-yu.liu@freescale.com> X-OriginalArrivalTime: 22 Jan 2010 10:58:58.0321 (UTC) FILETIME=[E5C7C010:01CA9B51] Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/arch/powerpc/include/asm/kvm_e500.h b/arch/powerpc/include/asm/kvm_e500.h index 569dfd3..7fea26f 100644 --- a/arch/powerpc/include/asm/kvm_e500.h +++ b/arch/powerpc/include/asm/kvm_e500.h @@ -56,6 +56,8 @@ struct kvmppc_vcpu_e500 { u32 l1csr1; u32 hid0; u32 hid1; + u32 tlb0cfg; + u32 tlb1cfg; struct kvm_vcpu vcpu; }; diff --git a/arch/powerpc/kvm/e500_emulate.c b/arch/powerpc/kvm/e500_emulate.c index 95f8ec8..8e3edfb 100644 --- a/arch/powerpc/kvm/e500_emulate.c +++ b/arch/powerpc/kvm/e500_emulate.c @@ -164,25 +164,9 @@ int kvmppc_core_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, int rt) kvmppc_set_gpr(vcpu, rt, vcpu_e500->mas7); break; case SPRN_TLB0CFG: - { - ulong tmp = SPRN_TLB0CFG; - - tmp &= ~0xfffUL; - tmp |= vcpu_e500->guest_tlb_size[0]; - kvmppc_set_gpr(vcpu, rt, tmp); - break; - } - + kvmppc_set_gpr(vcpu, rt, vcpu_e500->tlb0cfg); break; case SPRN_TLB1CFG: - { - ulong tmp = SPRN_TLB1CFG; - - tmp &= ~0xfffUL; - tmp |= vcpu_e500->guest_tlb_size[1]; - kvmppc_set_gpr(vcpu, rt, tmp); - break; - } - + kvmppc_set_gpr(vcpu, rt, vcpu_e500->tlb1cfg); break; case SPRN_L1CSR0: kvmppc_set_gpr(vcpu, rt, vcpu_e500->l1csr0); break; case SPRN_L1CSR1: diff --git a/arch/powerpc/kvm/e500_tlb.c b/arch/powerpc/kvm/e500_tlb.c index 99a830b..7db158e 100644 --- a/arch/powerpc/kvm/e500_tlb.c +++ b/arch/powerpc/kvm/e500_tlb.c @@ -731,6 +731,12 @@ int kvmppc_e500_tlb_init(struct kvmppc_vcpu_e500 *vcpu_e500) if (vcpu_e500->shadow_pages[1] == NULL) goto err_out_page0; + /* Init TLB configuration register */ + vcpu_e500->tlb0cfg = mfspr(SPRN_TLB0CFG) & ~0xfffUL; + vcpu_e500->tlb0cfg |= vcpu_e500->guest_tlb_size[0]; + vcpu_e500->tlb1cfg = mfspr(SPRN_TLB1CFG) & ~0xfffUL; + vcpu_e500->tlb1cfg |= vcpu_e500->guest_tlb_size[1]; + return 0; err_out_page0: