From patchwork Fri Jul 4 08:17:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mihai Caraman X-Patchwork-Id: 4478751 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 860CF9F26C for ; Fri, 4 Jul 2014 08:17:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A4DEF2040F for ; Fri, 4 Jul 2014 08:17:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BFB5E203F1 for ; Fri, 4 Jul 2014 08:17:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753893AbaGDIRl (ORCPT ); Fri, 4 Jul 2014 04:17:41 -0400 Received: from mail-bn1blp0183.outbound.protection.outlook.com ([207.46.163.183]:45233 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751412AbaGDIRi (ORCPT ); Fri, 4 Jul 2014 04:17:38 -0400 Received: from BLUPR03CA034.namprd03.prod.outlook.com (10.141.30.27) by BY2PR03MB506.namprd03.prod.outlook.com (10.141.143.18) with Microsoft SMTP Server (TLS) id 15.0.974.11; Fri, 4 Jul 2014 08:17:36 +0000 Received: from BY2FFO11FD046.protection.gbl (2a01:111:f400:7c0c::120) by BLUPR03CA034.outlook.office365.com (2a01:111:e400:879::27) with Microsoft SMTP Server (TLS) id 15.0.985.8 via Frontend Transport; Fri, 4 Jul 2014 08:17:34 +0000 Received: from az84smr01.freescale.net (192.88.158.2) by BY2FFO11FD046.mail.protection.outlook.com (10.1.15.170) with Microsoft SMTP Server (TLS) id 15.0.969.12 via Frontend Transport; Fri, 4 Jul 2014 08:17:34 +0000 Received: from fsr-fed1764-012.ea.freescale.net (fsr-fed1764-012-010171073213.ea.freescale.net [10.171.73.213]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id s648HTL2021584; Fri, 4 Jul 2014 01:17:30 -0700 From: Mihai Caraman To: CC: , , Mihai Caraman Subject: [PATCH v2] KVM: PPC: e500: Emulate power management control SPR Date: Fri, 4 Jul 2014 11:17:28 +0300 Message-ID: <1404461848-31999-1-git-send-email-mihai.caraman@freescale.com> X-Mailer: git-send-email 1.7.11.7 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:CAL; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(6009001)(189002)(199002)(83072002)(21056001)(50466002)(229853001)(86362001)(92566001)(31966008)(2351001)(85852003)(87936001)(26826002)(33646001)(99396002)(20776003)(81156004)(102836001)(47776003)(107046002)(575784001)(74662001)(48376002)(74502001)(44976005)(88136002)(92726001)(93916002)(62966002)(110136001)(87286001)(81342001)(89996001)(85306003)(97736001)(36756003)(104166001)(83322001)(104016002)(81542001)(77156001)(80022001)(4396001)(19580395003)(69596002)(105606002)(106466001)(64706001)(84676001)(50226001)(19580405001)(6806004)(77982001)(50986999)(68736004)(95666004)(76482001)(79102001)(46102001); DIR:OUT; SFP:; SCL:1; SRVR:BY2PR03MB506; H:az84smr01.freescale.net; FPR:; MLV:ovrnspm; PTR:InfoDomainNonexistent; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID: X-Forefront-PRVS: 02622CEF0A Received-SPF: Fail (: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=mihai.caraman@freescale.com; X-OriginatorOrg: freescale.com 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=ham 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 For FSL e6500 core the kernel uses power management SPR register (PWRMGTCR0) to enable idle power down for cores and devices by setting up the idle count period at boot time. With the host already controlling the power management configuration the guest could simply benefit from it, so emulate guest request as a general store. Signed-off-by: Mihai Caraman --- v2: - treat the operation as a general store arch/powerpc/include/asm/kvm_host.h | 1 + arch/powerpc/kvm/e500_emulate.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h index 62b2cee..faf2f0e 100644 --- a/arch/powerpc/include/asm/kvm_host.h +++ b/arch/powerpc/include/asm/kvm_host.h @@ -584,6 +584,7 @@ struct kvm_vcpu_arch { u32 mmucfg; u32 eptcfg; u32 epr; + u32 pwrmgtcr0; u32 crit_save; /* guest debug registers*/ struct debug_reg dbg_reg; diff --git a/arch/powerpc/kvm/e500_emulate.c b/arch/powerpc/kvm/e500_emulate.c index 002d517..c99c40e 100644 --- a/arch/powerpc/kvm/e500_emulate.c +++ b/arch/powerpc/kvm/e500_emulate.c @@ -250,6 +250,14 @@ int kvmppc_core_emulate_mtspr_e500(struct kvm_vcpu *vcpu, int sprn, ulong spr_va spr_val); break; + case SPRN_PWRMGTCR0: + /* + * Guest relies on host power management configurations + * Treat the request as a general store + */ + vcpu->arch.pwrmgtcr0 = spr_val; + break; + /* extra exceptions */ case SPRN_IVOR32: vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_UNAVAIL] = spr_val; @@ -368,6 +376,10 @@ int kvmppc_core_emulate_mfspr_e500(struct kvm_vcpu *vcpu, int sprn, ulong *spr_v *spr_val = vcpu->arch.eptcfg; break; + case SPRN_PWRMGTCR0: + *spr_val = vcpu->arch.pwrmgtcr0; + break; + /* extra exceptions */ case SPRN_IVOR32: *spr_val = vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_UNAVAIL];