From patchwork Tue Apr 8 15:12:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 28012 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f198.google.com (mail-ve0-f198.google.com [209.85.128.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7DCC820447 for ; Tue, 8 Apr 2014 15:15:55 +0000 (UTC) Received: by mail-ve0-f198.google.com with SMTP id oz11sf3168147veb.9 for ; Tue, 08 Apr 2014 08:15:55 -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=jTML9CxeAO739uFRZdjcjyTTDnBs8FAwTg4Scvmfve8=; b=F48zY44qIcgEpAszR9YpDJ2ZLZ4zSWbmW59BqlVJ2+4q/JLpMdy5u6SI5j7ehLbVe4 9PQ9f5OnPoCb6fqT0amM4rN3/+g577SrkNLSi1572gW2rIhHLOP87pnFcq4Ia/+SUJQg W3TFr5pD4t3+UrCiyk9xbYBUXNiq/0/Yl8WPdm/1cxem1KjotOaSJRoRKLyycz8CuisY 4pkh+oBvnpLQSrbifcsYeGZRg0poosamxfnXpbfJkYwy3iTGeZBZnODw1Hy3rGdzfnJ0 cimIdKYW5Q6roWSt97hJCJMZiiG9rpFqPdh4tX2To3CmSr/X/LxQleYJF46PilkKh7pI yJ/g== X-Gm-Message-State: ALoCoQkx41SJ5vei0JDEOyq+2sxxmArcvz6ZIQlMIr1s6hAouPjmnF4q2P3U5SO8JutTFQ6LfQMo X-Received: by 10.236.84.141 with SMTP id s13mr1948348yhe.5.1396970155263; Tue, 08 Apr 2014 08:15:55 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.102.103 with SMTP id v94ls249566qge.0.gmail; Tue, 08 Apr 2014 08:15:55 -0700 (PDT) X-Received: by 10.52.6.162 with SMTP id c2mr3115440vda.6.1396970154876; Tue, 08 Apr 2014 08:15:54 -0700 (PDT) Received: from mail-ve0-f175.google.com (mail-ve0-f175.google.com [209.85.128.175]) by mx.google.com with ESMTPS id ph6si452561veb.53.2014.04.08.08.15.54 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 08 Apr 2014 08:15:54 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.175 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.175; Received: by mail-ve0-f175.google.com with SMTP id oz11so884771veb.6 for ; Tue, 08 Apr 2014 08:15:54 -0700 (PDT) X-Received: by 10.58.122.164 with SMTP id lt4mr3689475veb.2.1396970154803; Tue, 08 Apr 2014 08:15:54 -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.12.8 with SMTP id v8csp254100vcv; Tue, 8 Apr 2014 08:15:54 -0700 (PDT) X-Received: by 10.50.36.36 with SMTP id n4mr26206907igj.24.1396970154179; Tue, 08 Apr 2014 08:15:54 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id ce9si2360459icc.193.2014.04.08.08.15.53 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 08 Apr 2014 08:15:54 -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 1WXXie-0005Ke-TX; Tue, 08 Apr 2014 15:13:48 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WXXid-0005Jo-De for xen-devel@lists.xensource.com; Tue, 08 Apr 2014 15:13:47 +0000 Received: from [193.109.254.147:23776] by server-15.bemta-14.messagelabs.com id D8/D8-15813-A2214435; Tue, 08 Apr 2014 15:13:46 +0000 X-Env-Sender: Stefano.Stabellini@citrix.com X-Msg-Ref: server-3.tower-27.messagelabs.com!1396970024!7017602!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 12146 invoked from network); 8 Apr 2014 15:13:46 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-3.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 8 Apr 2014 15:13:46 -0000 X-IronPort-AV: E=Sophos;i="4.97,818,1389744000"; d="scan'208";a="117915005" Received: from accessns.citrite.net (HELO FTLPEX01CL03.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 08 Apr 2014 15:12:52 +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; Tue, 8 Apr 2014 11:12:51 -0400 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1WXXhj-0005Ms-R7; Tue, 08 Apr 2014 16:12:51 +0100 From: Stefano Stabellini To: Date: Tue, 8 Apr 2014 16:12:40 +0100 Message-ID: <1396969969-18973-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@eu.citrix.com Subject: [Xen-devel] [PATCH v7 03/12] 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.175 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,