From patchwork Mon Jul 9 12:55:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Varun Sethi X-Patchwork-Id: 169808 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 1BD662C0200 for ; Mon, 9 Jul 2012 22:56:56 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753347Ab2GIM4x (ORCPT ); Mon, 9 Jul 2012 08:56:53 -0400 Received: from va3ehsobe010.messaging.microsoft.com ([216.32.180.30]:9165 "EHLO va3outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753275Ab2GIM4x (ORCPT ); Mon, 9 Jul 2012 08:56:53 -0400 Received: from mail186-va3-R.bigfish.com (10.7.14.249) by VA3EHSOBE002.bigfish.com (10.7.40.22) with Microsoft SMTP Server id 14.1.225.23; Mon, 9 Jul 2012 12:54:36 +0000 Received: from mail186-va3 (localhost [127.0.0.1]) by mail186-va3-R.bigfish.com (Postfix) with ESMTP id 087B58012A for ; Mon, 9 Jul 2012 12:54:36 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275bhz2dh2a8h668h839he5bhf0ah) Received: from mail186-va3 (localhost.localdomain [127.0.0.1]) by mail186-va3 (MessageSwitch) id 1341838473924878_31768; Mon, 9 Jul 2012 12:54:33 +0000 (UTC) Received: from VA3EHSMHS030.bigfish.com (unknown [10.7.14.245]) by mail186-va3.bigfish.com (Postfix) with ESMTP id D31152E00E6 for ; Mon, 9 Jul 2012 12:54:33 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by VA3EHSMHS030.bigfish.com (10.7.99.40) with Microsoft SMTP Server (TLS) id 14.1.225.23; Mon, 9 Jul 2012 12:54:32 +0000 Received: from az84smr01.freescale.net (10.64.34.197) by 039-SN1MMR1-002.039d.mgd.msft.net (10.84.1.15) with Microsoft SMTP Server (TLS) id 14.2.298.5; Mon, 9 Jul 2012 07:56:47 -0500 Received: from nmglablinux27.zin33.ap.freescale.net ([10.213.130.145]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id q69Cuj7Y008140 for ; Mon, 9 Jul 2012 05:56:46 -0700 Received: from nmglablinux27.zin33.ap.freescale.net (localhost [127.0.0.1]) by nmglablinux27.zin33.ap.freescale.net (8.14.4/8.14.4/Debian-2ubuntu1) with ESMTP id q69CtXSc017062; Mon, 9 Jul 2012 18:25:33 +0530 Received: (from varuns@localhost) by nmglablinux27.zin33.ap.freescale.net (8.14.4/8.14.4/Submit) id q69CtXqB017060; Mon, 9 Jul 2012 18:25:33 +0530 From: Varun Sethi To: , , , , CC: Varun Sethi Subject: [PATCH 1/4] powepc/booke: Separate out E.HV check and ivor setup code. Date: Mon, 9 Jul 2012 18:25:31 +0530 Message-ID: <1341838531-17023-1-git-send-email-Varun.Sethi@freescale.com> X-Mailer: git-send-email 1.7.4.1 MIME-Version: 1.0 X-OriginatorOrg: freescale.net Sender: kvm-ppc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm-ppc@vger.kernel.org Move the E.HV check and CPU_FTR_EMB_HV flag manipulation to the cpu setup code. Create a separate routine for E.HV ivors setup. Signed-off-by: Varun Sethi --- arch/powerpc/kernel/cpu_setup_fsl_booke.S | 29 ++++++++++++++++++++++++++--- arch/powerpc/kernel/head_fsl_booke.S | 18 ++++-------------- 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/arch/powerpc/kernel/cpu_setup_fsl_booke.S b/arch/powerpc/kernel/cpu_setup_fsl_booke.S index 69fdd23..a55d028 100644 --- a/arch/powerpc/kernel/cpu_setup_fsl_booke.S +++ b/arch/powerpc/kernel/cpu_setup_fsl_booke.S @@ -16,6 +16,8 @@ #include #include #include +#include +#include _GLOBAL(__e500_icache_setup) mfspr r0, SPRN_L1CSR1 @@ -73,12 +75,33 @@ _GLOBAL(__setup_cpu_e500v2) mtlr r4 blr _GLOBAL(__setup_cpu_e500mc) - mr r5, r4 - mflr r4 + mflr r5 bl __e500_icache_setup bl __e500_dcache_setup bl __setup_e500mc_ivors - mtlr r4 + /* + * We only want to touch IVOR38-41 if we're running on hardware + * that supports category E.HV. The architectural way to determine + * this is MMUCFG[LPIDSIZE]. + */ + mfspr r3, SPRN_MMUCFG + rlwinm. r3, r3, 0, MMUCFG_LPIDSIZE + beq 1f + bl __setup_ehv_ivors + b 2f +1: + lwz r3, CPU_SPEC_FEATURES(r4) + /* We need this check as cpu_setup is also called for + * the secondary cores. So, if we have already cleared + * the feature on the primary core, avoid doing it on the + * secondary core. + */ + andis. r6, r3, CPU_FTR_EMB_HV@h + beq 2f + rlwinm r3, r3, 0, ~CPU_FTR_EMB_HV + stw r3, CPU_SPEC_FEATURES(r4) +2: + mtlr r5 blr #endif /* Right now, restore and setup are the same thing */ diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S index 1f4434a..76c84c4 100644 --- a/arch/powerpc/kernel/head_fsl_booke.S +++ b/arch/powerpc/kernel/head_fsl_booke.S @@ -906,15 +906,11 @@ _GLOBAL(__setup_e500mc_ivors) mtspr SPRN_IVOR36,r3 li r3,CriticalDoorbell@l mtspr SPRN_IVOR37,r3 + sync + blr - /* - * We only want to touch IVOR38-41 if we're running on hardware - * that supports category E.HV. The architectural way to determine - * this is MMUCFG[LPIDSIZE]. - */ - mfspr r3, SPRN_MMUCFG - andis. r3, r3, MMUCFG_LPIDSIZE@h - beq no_hv +/* setup ehv ivors for */ +_GLOBAL(__setup_ehv_ivors) li r3,GuestDoorbell@l mtspr SPRN_IVOR38,r3 li r3,CriticalGuestDoorbell@l @@ -923,14 +919,8 @@ _GLOBAL(__setup_e500mc_ivors) mtspr SPRN_IVOR40,r3 li r3,Ehvpriv@l mtspr SPRN_IVOR41,r3 -skip_hv_ivors: sync blr -no_hv: - lwz r3, CPU_SPEC_FEATURES(r5) - rlwinm r3, r3, 0, ~CPU_FTR_EMB_HV - stw r3, CPU_SPEC_FEATURES(r5) - b skip_hv_ivors #ifdef CONFIG_SPE /*