From patchwork Thu Mar 19 19:29:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 46105 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B783521515 for ; Thu, 19 Mar 2015 19:32:45 +0000 (UTC) Received: by wivz2 with SMTP id z2sf14551628wiv.1 for ; Thu, 19 Mar 2015 12:32:45 -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:cc:subject:precedence:list-id:list-unsubscribe:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:list-archive; bh=5ButoZ7LRt/MWk52stX2b2P8R2FELm8R/AC31YIIyQA=; b=WEgS3o6qLoOtDsFdyXjf6TA15i1GJ89Wo9m9rENtstkp6prNt9UdRyyNfu6e6jyJdj HELVlIqj9SB0c4Jf47aIqwsMAsHkkAd/rHi6rqKBLNV3bsbFN9eQ7GEW3qMGUm/eCmfe iITjybueCaKyXZeiG/oUcvXvsNga4BRuwGk/Qit0PKQsA23ns+DH0WKCaCzoGdelqqxq KtvQWK1Iz+lqWDIz0HyJz7QE14+qa6v5vKiFt9xDjkEnXZnCeKVjEh0RcangT/uuMJ1y B9Lhnju4/KazqPKtqQ0xpkirG0G6SbMHcuHk8Ke7K7PYfJRTIyWGhLRjmjghCMzbG2Nb CIHw== X-Gm-Message-State: ALoCoQktGRuZI01BAL7atZgNlYMCLpDePGc6gO2/d8wqm+RyXvEDGhZKQh8kWtgCFvqPcYTFn8vA X-Received: by 10.112.130.70 with SMTP id oc6mr12702283lbb.13.1426793565004; Thu, 19 Mar 2015 12:32:45 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.135 with SMTP id t7ls324550lag.45.gmail; Thu, 19 Mar 2015 12:32:44 -0700 (PDT) X-Received: by 10.153.6.35 with SMTP id cr3mr43121502lad.79.1426793564657; Thu, 19 Mar 2015 12:32:44 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id j9si1686561lbc.32.2015.03.19.12.32.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Mar 2015 12:32:44 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by lbnq5 with SMTP id q5so32339090lbn.0 for ; Thu, 19 Mar 2015 12:32:44 -0700 (PDT) X-Received: by 10.152.28.5 with SMTP id x5mr68930604lag.112.1426793564549; Thu, 19 Mar 2015 12:32:44 -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.112.35.133 with SMTP id h5csp597743lbj; Thu, 19 Mar 2015 12:32:43 -0700 (PDT) X-Received: by 10.140.43.11 with SMTP id d11mr95219801qga.95.1426793551825; Thu, 19 Mar 2015 12:32:31 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id i90si2164690qge.83.2015.03.19.12.32.31 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 19 Mar 2015 12:32:31 -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 1YYg9V-0004Cq-RR; Thu, 19 Mar 2015 19:30:45 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YYg9U-0004CA-5x for xen-devel@lists.xenproject.org; Thu, 19 Mar 2015 19:30:44 +0000 Received: from [85.158.137.68] by server-6.bemta-3.messagelabs.com id EF/B5-05830-3E32B055; Thu, 19 Mar 2015 19:30:43 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-9.tower-31.messagelabs.com!1426793442!10091285!1 X-Originating-IP: [74.125.82.41] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.13.4; banners=-,-,- X-VirusChecked: Checked Received: (qmail 31325 invoked from network); 19 Mar 2015 19:30:42 -0000 Received: from mail-wg0-f41.google.com (HELO mail-wg0-f41.google.com) (74.125.82.41) by server-9.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 19 Mar 2015 19:30:42 -0000 Received: by wggv3 with SMTP id v3so71346346wgg.1 for ; Thu, 19 Mar 2015 12:30:42 -0700 (PDT) X-Received: by 10.180.89.163 with SMTP id bp3mr18899872wib.88.1426793442528; Thu, 19 Mar 2015 12:30:42 -0700 (PDT) Received: from chilopoda.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id hl8sm3203005wjb.38.2015.03.19.12.30.41 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Mar 2015 12:30:41 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Thu, 19 Mar 2015 19:29:30 +0000 Message-Id: <1426793399-6283-5-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1426793399-6283-1-git-send-email-julien.grall@linaro.org> References: <1426793399-6283-1-git-send-email-julien.grall@linaro.org> Cc: stefano.stabellini@citrix.com, Julien Grall , tim@xen.org, ian.campbell@citrix.com, Stefano Stabellini Subject: [Xen-devel] [PATCH v4 04/33] xen/arm: vgic: Introduce a function to initialize pending_irq 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: , MIME-Version: 1.0 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: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 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: The structure pending_irq is initialized in the same way in 2 different places. Introduce vgic_init_pending_irq to avoid code duplication. Also move the setting of the irq field into this function as we need to initialize it once rather than every time an IRQ is injected to the guest. Finally, use unsigned int for the "irq" field to be consistent with the virq variable Signed-off-by: Julien Grall Acked-by: Stefano Stabellini Acked-by: Ian Campbell --- Changes in v4: - Add Ian's ack - Typoes in the commit message Changes in v3: - Add Stefano's acked - The irq field is now unsigned int - Update commit message to speak about the int -> unsigned int change - Use "unsigned int" rather than "unsigned" Changes in v2: - Patch added --- xen/arch/arm/gic.c | 2 +- xen/arch/arm/vgic.c | 19 ++++++++++--------- xen/include/asm-arm/vgic.h | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index 8e7f24b..ba7950b 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -630,7 +630,7 @@ void gic_dump_info(struct vcpu *v) list_for_each_entry ( p, &v->arch.vgic.inflight_irqs, inflight ) { - printk("Inflight irq=%d lr=%u\n", p->irq, p->lr); + printk("Inflight irq=%u lr=%u\n", p->irq, p->lr); } list_for_each_entry( p, &v->arch.vgic.lr_pending, lr_queue ) diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c index c14d79d..0b4fa57 100644 --- a/xen/arch/arm/vgic.c +++ b/xen/arch/arm/vgic.c @@ -61,6 +61,13 @@ struct vgic_irq_rank *vgic_rank_irq(struct vcpu *v, unsigned int irq) return vgic_get_rank(v, rank); } +static void vgic_init_pending_irq(struct pending_irq *p, unsigned int virq) +{ + INIT_LIST_HEAD(&p->inflight); + INIT_LIST_HEAD(&p->lr_queue); + p->irq = virq; +} + int domain_vgic_init(struct domain *d) { int i; @@ -101,10 +108,8 @@ int domain_vgic_init(struct domain *d) return -ENOMEM; for (i=0; iarch.vgic.nr_spis; i++) - { - INIT_LIST_HEAD(&d->arch.vgic.pending_irqs[i].inflight); - INIT_LIST_HEAD(&d->arch.vgic.pending_irqs[i].lr_queue); - } + vgic_init_pending_irq(&d->arch.vgic.pending_irqs[i], i + 32); + for (i=0; iarch.vgic.shared_irqs[i].lock); @@ -148,10 +153,7 @@ int vcpu_vgic_init(struct vcpu *v) memset(&v->arch.vgic.pending_irqs, 0, sizeof(v->arch.vgic.pending_irqs)); for (i = 0; i < 32; i++) - { - INIT_LIST_HEAD(&v->arch.vgic.pending_irqs[i].inflight); - INIT_LIST_HEAD(&v->arch.vgic.pending_irqs[i].lr_queue); - } + vgic_init_pending_irq(&v->arch.vgic.pending_irqs[i], i); INIT_LIST_HEAD(&v->arch.vgic.inflight_irqs); INIT_LIST_HEAD(&v->arch.vgic.lr_pending); @@ -409,7 +411,6 @@ void vgic_vcpu_inject_irq(struct vcpu *v, unsigned int irq) goto out; } - n->irq = irq; n->priority = priority; /* the irq is enabled */ diff --git a/xen/include/asm-arm/vgic.h b/xen/include/asm-arm/vgic.h index dd93872..0d0d114 100644 --- a/xen/include/asm-arm/vgic.h +++ b/xen/include/asm-arm/vgic.h @@ -67,7 +67,7 @@ struct pending_irq #define GIC_IRQ_GUEST_MIGRATING 4 unsigned long status; struct irq_desc *desc; /* only set it the irq corresponds to a physical irq */ - int irq; + unsigned int irq; #define GIC_INVALID_LR ~(uint8_t)0 uint8_t lr; uint8_t priority;