From patchwork Mon Dec 30 06:04:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aneesh Kumar K.V" X-Patchwork-Id: 3417651 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 950659F374 for ; Mon, 30 Dec 2013 06:05:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B9CB520107 for ; Mon, 30 Dec 2013 06:05:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BAFBD200F3 for ; Mon, 30 Dec 2013 06:05:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751335Ab3L3GFW (ORCPT ); Mon, 30 Dec 2013 01:05:22 -0500 Received: from e23smtp02.au.ibm.com ([202.81.31.144]:59829 "EHLO e23smtp02.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751339Ab3L3GEy (ORCPT ); Mon, 30 Dec 2013 01:04:54 -0500 Received: from /spool/local by e23smtp02.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 30 Dec 2013 16:04:51 +1000 Received: from d23dlp02.au.ibm.com (202.81.31.213) by e23smtp02.au.ibm.com (202.81.31.208) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 30 Dec 2013 16:04:49 +1000 Received: from d23relay05.au.ibm.com (d23relay05.au.ibm.com [9.190.235.152]) by d23dlp02.au.ibm.com (Postfix) with ESMTP id B62022BB0053; Mon, 30 Dec 2013 17:04:47 +1100 (EST) Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138]) by d23relay05.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id rBU5jwkv1048884; Mon, 30 Dec 2013 16:46:02 +1100 Received: from d23av02.au.ibm.com (localhost [127.0.0.1]) by d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id rBU64fm9024482; Mon, 30 Dec 2013 17:04:42 +1100 Received: from skywalker.in.ibm.com ([9.79.213.208]) by d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id rBU64Whh024162; Mon, 30 Dec 2013 17:04:40 +1100 From: "Aneesh Kumar K.V" To: agraf@suse.de, benh@kernel.crashing.org, paulus@samba.org Cc: linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org, "Aneesh Kumar K.V" Subject: [PATCH -V2] POWERPC: BOOK3S: KVM: Use the saved dsisr and dar values on book3s 64 Date: Mon, 30 Dec 2013 11:34:29 +0530 Message-Id: <1388383469-6411-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> X-Mailer: git-send-email 1.8.3.2 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13123006-5490-0000-0000-000004B7392C Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 From: "Aneesh Kumar K.V" Although it's optional IBM POWER cpus always had DAR value set on alignment interrupt. So don't try to compute these values. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/kvm/book3s_emulate.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/arch/powerpc/kvm/book3s_emulate.c b/arch/powerpc/kvm/book3s_emulate.c index 502a47ac4453..d8e2d079483d 100644 --- a/arch/powerpc/kvm/book3s_emulate.c +++ b/arch/powerpc/kvm/book3s_emulate.c @@ -599,6 +599,19 @@ unprivileged: u32 kvmppc_alignment_dsisr(struct kvm_vcpu *vcpu, unsigned int inst) { +#ifdef CONFIG_PPC_BOOK3S_64 + return vcpu->arch.fault_dsisr; +#else + /* + * Mac OS X has some applications - namely the Finder - that require + * alignment interrupts to work properly. So we need to implement them. + + * But the spec for 970 and 750 also looks different. While 750 requires + * the DSISR and DAR fields to reflect some instruction bits (DSISR) and + * the fault address (DAR), the 970 declares this as an optional feature. + * So we need to reconstruct DSISR and DAR manually. + */ + u32 dsisr = 0; /* @@ -637,10 +650,24 @@ u32 kvmppc_alignment_dsisr(struct kvm_vcpu *vcpu, unsigned int inst) dsisr |= (inst >> 16) & 0x03ff; /* bits 22:31 */ return dsisr; +#endif } ulong kvmppc_alignment_dar(struct kvm_vcpu *vcpu, unsigned int inst) { +#ifdef CONFIG_PPC_BOOK3S_64 + return vcpu->arch.fault_dar; +#else + /* + * Mac OS X has some applications - namely the Finder - that require + * alignment interrupts to work properly. So we need to implement them. + + * But the spec for 970 and 750 also looks different. While 750 requires + * the DSISR and DAR fields to reflect some instruction bits (DSISR) and + * the fault address (DAR), the 970 declares this as an optional feature. + * So we need to reconstruct DSISR and DAR manually. + */ + ulong dar = 0; ulong ra = get_ra(inst); ulong rb = get_rb(inst); @@ -665,4 +692,5 @@ ulong kvmppc_alignment_dar(struct kvm_vcpu *vcpu, unsigned int inst) } return dar; +#endif }