From patchwork Thu May 22 12:32:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 30621 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6807920369 for ; Thu, 22 May 2014 12:35:02 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id i4sf15698933oah.5 for ; Thu, 22 May 2014 05:35:02 -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=0qjrAUbwPy+IgqqyDzPGJxAbuSnrSYqVPhF7WspXnVc=; b=Cl7iRhwOGfrswW6OAmLN/aRO7oREKsBgHs2VO9oIzPRfWP02LhQA4gCS/bZZ9Ln8Nr KylCGbyDfH+YKHnu+RHHCuB4TbkAZP5E6AyosdMMLkKe5Cgz05YMoo6OJL9bTrygkPHC DJAWs7wQ0qX93el0mmy2uW2YTakMZv7P4MFWWxg8H/RNdxu2MJ3WEkMnKC6rAWP1QZX5 qPF4XmZodH8cAvWqo4ujimxYvshIZs5ivizEnuIlUMhWyVLf8K5POd7TkzVhJPBJF6t0 dRXWR+z/tckvbrV5c9eDB6vf8zYwKKenFsQX4UtpgW8rY8ABDDlqI1IMx5sbkjFEUdp+ tb7g== X-Gm-Message-State: ALoCoQmf67nmkbteLIPVdcdEYPMB690O2djJ/J7q9f3WnMFnIQmw1gdCoa5kpT+wvT7TkqA+Cv/N X-Received: by 10.42.236.68 with SMTP id kj4mr22280356icb.6.1400762101998; Thu, 22 May 2014 05:35:01 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.48.145 with SMTP id o17ls595665qga.37.gmail; Thu, 22 May 2014 05:35:01 -0700 (PDT) X-Received: by 10.58.29.76 with SMTP id i12mr138790veh.67.1400762101888; Thu, 22 May 2014 05:35:01 -0700 (PDT) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by mx.google.com with ESMTPS id hu4si3038063vdb.74.2014.05.22.05.35.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 22 May 2014 05:35:01 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.181 as permitted sender) client-ip=209.85.128.181; Received: by mail-ve0-f181.google.com with SMTP id pa12so4302209veb.12 for ; Thu, 22 May 2014 05:35:01 -0700 (PDT) X-Received: by 10.58.85.65 with SMTP id f1mr49956472vez.20.1400762101814; Thu, 22 May 2014 05:35:01 -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.221.72 with SMTP id ib8csp194987vcb; Thu, 22 May 2014 05:35:01 -0700 (PDT) X-Received: by 10.50.153.8 with SMTP id vc8mr21768888igb.16.1400762101247; Thu, 22 May 2014 05:35:01 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id fm7si160314igb.35.2014.05.22.05.35.00 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 22 May 2014 05:35:01 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) 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 1WnSBV-0004M8-DP; Thu, 22 May 2014 12:33:21 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WnSBS-0004IV-S8 for xen-devel@lists.xensource.com; Thu, 22 May 2014 12:33:19 +0000 Received: from [85.158.143.35:50060] by server-3.bemta-4.messagelabs.com id 76/6F-13602-E8EED735; Thu, 22 May 2014 12:33:18 +0000 X-Env-Sender: Stefano.Stabellini@citrix.com X-Msg-Ref: server-14.tower-21.messagelabs.com!1400761994!6613018!4 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.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 29615 invoked from network); 22 May 2014 12:33:17 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-14.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 22 May 2014 12:33:17 -0000 X-IronPort-AV: E=Sophos;i="4.98,887,1392163200"; d="scan'208";a="134537194" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 22 May 2014 12:33:13 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.79) with Microsoft SMTP Server id 14.3.181.6; Thu, 22 May 2014 08:33:13 -0400 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1WnSBI-0003tn-4n; Thu, 22 May 2014 13:33:08 +0100 From: Stefano Stabellini To: Date: Thu, 22 May 2014 13:32:20 +0100 Message-ID: <1400761950-25035-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 v8 03/13] 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=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.181 as permitted sender) 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 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index 6d917a0..6b21945 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -55,6 +55,7 @@ static struct { 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 @@ -655,6 +656,13 @@ 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; + } static void do_sgi(struct cpu_user_regs *regs, int othercpu, enum gic_sgi sgi)