From patchwork Thu Mar 27 15:13:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 27200 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f200.google.com (mail-ob0-f200.google.com [209.85.214.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D2BBA202FA for ; Thu, 27 Mar 2014 15:16:53 +0000 (UTC) Received: by mail-ob0-f200.google.com with SMTP id gq1sf13092718obb.7 for ; Thu, 27 Mar 2014 08:16:53 -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=dfvNHeYqWA2x5+uWaYEzwCNwl+VqzN+Bd8P9Z6Ikrav5QGcUtZXFeBv8KKapyWwnQk zt1OWq8znyrlApUwrb+6pe55xHSMyUG0kdgnTKT+lUxn3mJkX0y8gwmn4KJCfNHF/xoz 009ifuPF3elvZ0a8zP5uBBsQ9n0rN97ZMeVKG9g7MHGBF2mJxevgbuHjVXmaLAj1uvCt K0LECNzAcc+nOiD38Fuk0xe5KMkAF9SrAORF210gnztWwODjbphiO++XlCsLpisqVYv+ W1ka99irEFRd6hKnI1WUDsyoGNkadvv/Yat7Pex/bOcuiMN8llegoE7T7sPpN18OkSRv mA5g== X-Gm-Message-State: ALoCoQnVJgyRANzn5OYuOFlGm4B0mg6xUBygA5+eg48yGsPKMuaoze5zHeZwmDETHaatE6NLhmbN X-Received: by 10.182.85.65 with SMTP id f1mr873311obz.33.1395933413351; Thu, 27 Mar 2014 08:16:53 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.30.202 with SMTP id d68ls1117185qgd.44.gmail; Thu, 27 Mar 2014 08:16:53 -0700 (PDT) X-Received: by 10.58.34.67 with SMTP id x3mr608445vei.37.1395933413105; Thu, 27 Mar 2014 08:16:53 -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 dq1si508705vcb.149.2014.03.27.08.16.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 27 Mar 2014 08:16:53 -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 oz11so4226341veb.34 for ; Thu, 27 Mar 2014 08:16:53 -0700 (PDT) X-Received: by 10.58.91.101 with SMTP id cd5mr1885923veb.5.1395933413009; Thu, 27 Mar 2014 08:16:53 -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 i9csp36057vck; Thu, 27 Mar 2014 08:16:52 -0700 (PDT) X-Received: by 10.58.195.202 with SMTP id ig10mr1097784vec.33.1395933412527; Thu, 27 Mar 2014 08:16:52 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id f9si508384vck.145.2014.03.27.08.16.52 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 27 Mar 2014 08:16:52 -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 1WTC0x-0003xF-KZ; Thu, 27 Mar 2014 15:14:43 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WTC0v-0003wQ-5Z for xen-devel@lists.xensource.com; Thu, 27 Mar 2014 15:14:41 +0000 Received: from [85.158.139.211:6736] by server-5.bemta-5.messagelabs.com id A0/D1-06049-06044335; Thu, 27 Mar 2014 15:14:40 +0000 X-Env-Sender: Stefano.Stabellini@citrix.com X-Msg-Ref: server-2.tower-206.messagelabs.com!1395933277!3778274!2 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n X-StarScan-Received: X-StarScan-Version: 6.11.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 31659 invoked from network); 27 Mar 2014 15:14:39 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-2.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 27 Mar 2014 15:14:39 -0000 X-IronPort-AV: E=Sophos;i="4.97,743,1389744000"; d="scan'208";a="115483900" Received: from accessns.citrite.net (HELO FTLPEX01CL01.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 27 Mar 2014 15:14:20 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.78) with Microsoft SMTP Server id 14.2.342.4; Thu, 27 Mar 2014 11:14:19 -0400 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1WTC0U-0004xQ-AO; Thu, 27 Mar 2014 15:14:14 +0000 From: Stefano Stabellini To: Date: Thu, 27 Mar 2014 15:13:32 +0000 Message-ID: <1395933219-18495-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: MIA2 Cc: julien.grall@citrix.com, Ian.Campbell@citrix.com, Stefano Stabellini Subject: [Xen-devel] [PATCH v6 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.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 --- 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,