From patchwork Fri Jan 4 19:40:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Scott Wood X-Patchwork-Id: 1934621 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id F3F71DFABD for ; Fri, 4 Jan 2013 19:42:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754940Ab3ADTmX (ORCPT ); Fri, 4 Jan 2013 14:42:23 -0500 Received: from [213.199.154.143] ([213.199.154.143]:48932 "EHLO db3outboundpool.messaging.microsoft.com" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1754920Ab3ADTmW convert rfc822-to-8bit (ORCPT ); Fri, 4 Jan 2013 14:42:22 -0500 Received: from mail21-db3-R.bigfish.com (10.3.81.238) by DB3EHSOBE001.bigfish.com (10.3.84.21) with Microsoft SMTP Server id 14.1.225.23; Fri, 4 Jan 2013 19:41:25 +0000 Received: from mail21-db3 (localhost [127.0.0.1]) by mail21-db3-R.bigfish.com (Postfix) with ESMTP id 4DEF63E0247; Fri, 4 Jan 2013 19:41:25 +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: -4 X-BigFish: VS-4(zzbb2dI98dI9371I1432Izz1de0h1202h1e76h1d1ah1d2ahzzz2dh2a8h668h839h944hd2bhf0ah1288h12a5h12a9h12bdh137ah139eh13b6h1441h1504h1537h162dh1631h16a6h1758h1155h) Received: from mail21-db3 (localhost.localdomain [127.0.0.1]) by mail21-db3 (MessageSwitch) id 1357328477978055_5160; Fri, 4 Jan 2013 19:41:17 +0000 (UTC) Received: from DB3EHSMHS014.bigfish.com (unknown [10.3.81.250]) by mail21-db3.bigfish.com (Postfix) with ESMTP id E2F8014009B; Fri, 4 Jan 2013 19:41:17 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by DB3EHSMHS014.bigfish.com (10.3.87.114) with Microsoft SMTP Server (TLS) id 14.1.225.23; Fri, 4 Jan 2013 19:41:15 +0000 Received: from az84smr01.freescale.net (10.64.34.197) by 039-SN1MMR1-003.039d.mgd.msft.net (10.84.1.16) with Microsoft SMTP Server (TLS) id 14.2.318.3; Fri, 4 Jan 2013 19:40:51 +0000 Received: from snotra ([10.214.80.48]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id r04JeoF9017565; Fri, 4 Jan 2013 12:40:50 -0700 Date: Fri, 4 Jan 2013 13:40:50 -0600 From: Scott Wood Subject: Re: [PATCH 1/4] KVM: PPC: BookE: Allow irq deliveries to inject requests To: Alexander Graf CC: , KVM list In-Reply-To: <1357321000-31008-2-git-send-email-agraf@suse.de> (from agraf@suse.de on Fri Jan 4 11:36:37 2013) X-Mailer: Balsa 2.4.11 Message-ID: <1357328450.666.13@snotra> MIME-Version: 1.0 Content-Disposition: inline X-OriginatorOrg: freescale.com Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On 01/04/2013 11:36:37 AM, Alexander Graf wrote: > When injecting an interrupt into guest context, we usually don't need > to check for requests anymore. At least not until today. > > With the introduction of EPR, we will have to create a request when > the > guest has successfully accepted an external interrupt though. > > So we need to prepare the interrupt delivery to abort guest entry > gracefully. Otherwise we'd delay the EPR request. > > Signed-off-by: Alexander Graf > --- > arch/powerpc/kvm/booke.c | 14 ++++++++++---- > 1 files changed, 10 insertions(+), 4 deletions(-) > > diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c > index 69f1140..4ae83f9 100644 > --- a/arch/powerpc/kvm/booke.c > +++ b/arch/powerpc/kvm/booke.c > @@ -554,14 +554,16 @@ static void update_timer_ints(struct kvm_vcpu > *vcpu) > kvmppc_core_dequeue_watchdog(vcpu); > } > > -static void kvmppc_core_check_exceptions(struct kvm_vcpu *vcpu) > +static int kvmppc_core_check_exceptions(struct kvm_vcpu *vcpu) > { > unsigned long *pending = &vcpu->arch.pending_exceptions; > unsigned int priority; > + int r = 0; > > priority = __ffs(*pending); > while (priority < BOOKE_IRQPRIO_MAX) { > - if (kvmppc_booke_irqprio_deliver(vcpu, priority)) > + r = kvmppc_booke_irqprio_deliver(vcpu, priority); > + if (r) > break; > > priority = find_next_bit(pending, > @@ -571,15 +573,19 @@ static void kvmppc_core_check_exceptions(struct > kvm_vcpu *vcpu) > > /* Tell the guest about our interrupt status */ > vcpu->arch.shared->int_pending = !!*pending; > + > + return r > 1; > } It isn't until patch 3/4 that the reason for "r > 1" appears... Why not just: kvm_vcpu_block(vcpu); ...or if you really want to do it through return values, make it an enum rather than a magic "2". -Scott --- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c index 69f1140..964f447 100644 --- a/arch/powerpc/kvm/booke.c +++ b/arch/powerpc/kvm/booke.c @@ -581,6 +581,11 @@ int kvmppc_core_prepare_to_enter(struct kvm_vcpu *vcpu) kvmppc_core_check_exceptions(vcpu); + if (vcpu->requests) { + /* Exception delivery raised request; start over */ + return 1; + } + if (vcpu->arch.shared->msr & MSR_WE) { local_irq_enable();