From patchwork Mon Mar 24 18:49:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 26951 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f69.google.com (mail-yh0-f69.google.com [209.85.213.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D262F20143 for ; Mon, 24 Mar 2014 18:52:03 +0000 (UTC) Received: by mail-yh0-f69.google.com with SMTP id b6sf16007582yha.0 for ; Mon, 24 Mar 2014 11:52:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-type:content-transfer-encoding; bh=DRO3O3WQujSf53xvtP+NWRdqNheXDzbUmFyre7LDwTs=; b=O55oUvu2yscq5i8ImWlQqIUj98Whex7m8mmRNvc0VTj/G1M/p0g1zkODDUledAODT+ 9rUsGhGLBBgqivaS4o+0P4e3fwBGzXAGZ7h8a4I+l4nWpI0hgJamjVqss5qJaOMPe4Kj eLQvV4r8c16tnsJTk2Mpxo4UG9jO6Bp9gsiBIwGny5uLidMfx2033iT87cEzuze8a+EU LgwEBmG62qeV10muaU97NRZk8Q0ep+/8I5/CPaE9MHG1eMarDnPLxCLfcmPuSkRTD6tK D/28/T3v3LGdBPqCZSAk+mQ+cqOCQUSQivdhtci+AIIkY0eKk11ElkWdjbh0pbW1xdDp m6/A== X-Gm-Message-State: ALoCoQlYO7JUMFStGeGRtQIietjjlkLyJy940bFwEagZn1HL6omxYgT75Kp5eTVKiYUorxx5AsQg X-Received: by 10.236.228.228 with SMTP id f94mr24807110yhq.43.1395687123388; Mon, 24 Mar 2014 11:52:03 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.33.203 with SMTP id j69ls1715842qgj.27.gmail; Mon, 24 Mar 2014 11:52:03 -0700 (PDT) X-Received: by 10.58.229.4 with SMTP id sm4mr52764617vec.10.1395687123283; Mon, 24 Mar 2014 11:52:03 -0700 (PDT) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by mx.google.com with ESMTPS id jb7si331956vec.89.2014.03.24.11.52.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 24 Mar 2014 11:52:03 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.174; Received: by mail-ve0-f174.google.com with SMTP id oz11so6179140veb.33 for ; Mon, 24 Mar 2014 11:52:03 -0700 (PDT) X-Received: by 10.221.4.66 with SMTP id ob2mr2001711vcb.28.1395687123209; Mon, 24 Mar 2014 11:52:03 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.78.9 with SMTP id i9csp246668vck; Mon, 24 Mar 2014 11:52:02 -0700 (PDT) X-Received: by 10.224.115.142 with SMTP id i14mr78120111qaq.9.1395687122439; Mon, 24 Mar 2014 11:52:02 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id u89si7018852qga.183.2014.03.24.11.52.01 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 24 Mar 2014 11:52:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xen.org designates 50.57.142.19 as permitted sender) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WS9ww-0007TE-9W; Mon, 24 Mar 2014 18:50:18 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WS9wu-0007SN-4Q for xen-devel@lists.xensource.com; Mon, 24 Mar 2014 18:50:16 +0000 Received: from [85.158.137.68:55838] by server-4.bemta-3.messagelabs.com id 5E/B6-17399-76E70335; Mon, 24 Mar 2014 18:50:15 +0000 X-Env-Sender: Stefano.Stabellini@citrix.com X-Msg-Ref: server-16.tower-31.messagelabs.com!1395687013!2652760!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n X-StarScan-Received: X-StarScan-Version: 6.11.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 32158 invoked from network); 24 Mar 2014 18:50:14 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-16.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 24 Mar 2014 18:50:14 -0000 X-IronPort-AV: E=Sophos;i="4.97,722,1389744000"; d="scan'208";a="113089151" Received: from accessns.citrite.net (HELO FTLPEX01CL03.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 24 Mar 2014 18:50:11 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.80) with Microsoft SMTP Server id 14.2.342.4; Mon, 24 Mar 2014 14:50:10 -0400 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1WS9wj-0005Cs-LN; Mon, 24 Mar 2014 18:50:05 +0000 From: Stefano Stabellini To: Date: Mon, 24 Mar 2014 18:49:28 +0000 Message-ID: <1395686975-12649-3-git-send-email-stefano.stabellini@eu.citrix.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 X-DLP: MIA1 Cc: julien.grall@citrix.com, Ian.Campbell@citrix.com, Stefano Stabellini Subject: [Xen-devel] [PATCH v5 03/10] xen/arm: set GICH_HCR_UIE if all the LRs are in use X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: stefano.stabellini@eu.citrix.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: On return to guest, if there are no free LRs and we still have more interrupt to inject, set GICH_HCR_UIE so that we are going to receive a maintenance interrupt when no pending interrupts are present in the LR registers. The maintenance interrupt handler won't do anything anymore, but receiving the interrupt is going to cause gic_inject to be called on return to guest that is going to clear the old LRs and inject new interrupts. Signed-off-by: Stefano Stabellini Acked-by: Julien Grall Acked-by: Ian Campbell --- Changes in v5: - introduce lr_all_full() helper. Changes in v2: - disable/enable the GICH_HCR_UIE bit in GICH_HCR; - only enable GICH_HCR_UIE if this_cpu(lr_mask) == ((1 << nr_lrs) - 1). --- xen/arch/arm/gic.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index dbba5d3..a7b29d8 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -57,6 +57,7 @@ static DEFINE_PER_CPU(irq_desc_t[NR_LOCAL_IRQS], local_irq_desc); static DEFINE_PER_CPU(uint64_t, lr_mask); static unsigned nr_lrs; +#define lr_all_full() (this_cpu(lr_mask) == ((1 << nr_lrs) - 1)) /* The GIC mapping of CPU interfaces does not necessarily match the * logical CPU numbering. Let's use mapping as returned by the GIC @@ -738,6 +739,11 @@ void gic_inject(void) vgic_vcpu_inject_irq(current, current->domain->arch.evtchn_irq); gic_restore_pending_irqs(current); + + if ( !list_empty(¤t->arch.vgic.lr_pending) && lr_all_full() ) + GICH[GICH_HCR] |= GICH_HCR_UIE; + else + GICH[GICH_HCR] &= ~GICH_HCR_UIE; } int gic_route_irq_to_guest(struct domain *d, const struct dt_irq *irq,