From patchwork Fri Jul 25 05:51:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bharat Bhushan X-Patchwork-Id: 4621431 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0F093C0338 for ; Fri, 25 Jul 2014 05:53:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 346FD201E4 for ; Fri, 25 Jul 2014 05:53:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 22B65201DD for ; Fri, 25 Jul 2014 05:53:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751227AbaGYFx0 (ORCPT ); Fri, 25 Jul 2014 01:53:26 -0400 Received: from mail-bn1lp0139.outbound.protection.outlook.com ([207.46.163.139]:18502 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750916AbaGYFxZ (ORCPT ); Fri, 25 Jul 2014 01:53:25 -0400 Received: from BN3PR0301CA0019.namprd03.prod.outlook.com (25.160.180.157) by DM2PR0301MB0751.namprd03.prod.outlook.com (25.160.97.147) with Microsoft SMTP Server (TLS) id 15.0.985.8; Fri, 25 Jul 2014 05:53:21 +0000 Received: from BY2FFO11FD017.protection.gbl (2a01:111:f400:7c0c::162) by BN3PR0301CA0019.outlook.office365.com (2a01:111:e400:4000::29) with Microsoft SMTP Server (TLS) id 15.0.995.14 via Frontend Transport; Fri, 25 Jul 2014 05:53:21 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BY2FFO11FD017.mail.protection.outlook.com (10.1.14.105) with Microsoft SMTP Server (TLS) id 15.0.980.11 via Frontend Transport; Fri, 25 Jul 2014 05:53:20 +0000 Received: from kvm.ap.freescale.net (kvm.ap.freescale.net [10.232.14.24]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id s6P5rFsO031181; Thu, 24 Jul 2014 22:53:17 -0700 From: Bharat Bhushan To: , CC: , , , Bharat Bhushan Subject: [PATCH] KVM: PPC: Booke-hv: Add one reg interface for SPRG9 Date: Fri, 25 Jul 2014 11:21:08 +0530 Message-ID: <1406267468-18635-1-git-send-email-Bharat.Bhushan@freescale.com> X-Mailer: git-send-email 1.9.3 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:CAL; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(6009001)(199002)(189002)(80022001)(85306003)(99396002)(46102001)(21056001)(50466002)(19580405001)(106466001)(68736004)(76482001)(104016003)(84676001)(64706001)(62966002)(36756003)(81542001)(47776003)(102836001)(26826002)(74502001)(83322001)(50986999)(93916002)(105606002)(4396001)(86362001)(6806004)(95666004)(575784001)(92726001)(83072002)(97736001)(31966008)(87286001)(81342001)(229853001)(20776003)(44976005)(85852003)(89996001)(50226001)(104166001)(92566001)(77982001)(19580395003)(48376002)(88136002)(79102001)(107046002)(74662001)(77156001)(87936001); DIR:OUT; SFP:; SCL:1; SRVR:DM2PR0301MB0751; H:tx30smr01.am.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: 02830F0362 Received-SPF: Fail (: domain of freescale.com does not designate 192.88.168.50 as permitted sender) receiver=; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=Bharat.Bhushan@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, 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 We now support SPRG9 for guest, so also add a one reg interface for same Note: Changes are in bookehv code only as we do not have SPRG9 on booke-pr. Signed-off-by: Bharat Bhushan --- arch/powerpc/include/uapi/asm/kvm.h | 1 + arch/powerpc/kvm/e500mc.c | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/uapi/asm/kvm.h b/arch/powerpc/include/uapi/asm/kvm.h index 2bc4a94..0e56d9e 100644 --- a/arch/powerpc/include/uapi/asm/kvm.h +++ b/arch/powerpc/include/uapi/asm/kvm.h @@ -555,6 +555,7 @@ struct kvm_get_htab_header { #define KVM_REG_PPC_DABRX (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb8) #define KVM_REG_PPC_WORT (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb9) +#define KVM_REG_PPC_SPRG9 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xba) /* Transactional Memory checkpointed state: * This is all GPRs, all VSX regs and a subset of SPRs diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c index bd0a2bd..000cf82 100644 --- a/arch/powerpc/kvm/e500mc.c +++ b/arch/powerpc/kvm/e500mc.c @@ -267,14 +267,32 @@ static int kvmppc_core_set_sregs_e500mc(struct kvm_vcpu *vcpu, static int kvmppc_get_one_reg_e500mc(struct kvm_vcpu *vcpu, u64 id, union kvmppc_one_reg *val) { - int r = kvmppc_get_one_reg_e500_tlb(vcpu, id, val); + int r = 0; + + switch (id) { + case KVM_REG_PPC_SPRG9: + *val = get_reg_val(id, vcpu->arch.sprg9); + break; + default: + r = kvmppc_get_one_reg_e500_tlb(vcpu, id, val); + } + return r; } static int kvmppc_set_one_reg_e500mc(struct kvm_vcpu *vcpu, u64 id, union kvmppc_one_reg *val) { - int r = kvmppc_set_one_reg_e500_tlb(vcpu, id, val); + int r = 0; + + switch (id) { + case KVM_REG_PPC_SPRG9: + vcpu->arch.sprg9 = set_reg_val(id, *val); + break; + default: + r = kvmppc_set_one_reg_e500_tlb(vcpu, id, val); + } + return r; }