From patchwork Fri Feb 7 18:56:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 24313 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f200.google.com (mail-pd0-f200.google.com [209.85.192.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6CAE52096A for ; Fri, 7 Feb 2014 18:58:27 +0000 (UTC) Received: by mail-pd0-f200.google.com with SMTP id y10sf6178840pdj.7 for ; Fri, 07 Feb 2014 10:58:26 -0800 (PST) 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=lnJMt4vJWQte+MmD85ZTnjTIMq36XVhjI1TMlxpZytU=; b=fyOBiqgCRb0tM7SGF+AQUgtBZ8xCxoWjr1HxGpGaRYlpooZMqiM5MFTS8qk5hpRjfJ 0WIQA1LjDSxkPzpFywCErNcv6MDsKcRqBKFJTEeX077qL5Z+DSeFPgj9aiIxuPS4VjHf +isxDhhHGwHLrqSFVvFHqx+CYg3Y9k2de1fma3QCKz0zIkKf94SNq4ZrmZ2SQbA13cTc 9ZjXG7Sdyk0qpvb8ROw8y+SGy6W101n+48GfGNAs/Scr5/lw6BNM9lna+mVDDlL3gR+1 SZ7U+hq9898qXQ8Aoqq/dgpYCrNlc9OsWUWo93K8Q6P+jxI3iF4Lk7GpA0Hs+nMahmNV Hc8g== X-Gm-Message-State: ALoCoQkpUbPCOSYRJqjAfowFHI3k/icgHrMrQSUr5glv7+0ZRaEe4cQprr9spiPzicWm8bLGuAah X-Received: by 10.66.137.8 with SMTP id qe8mr3245235pab.46.1391799506381; Fri, 07 Feb 2014 10:58:26 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.44.102 with SMTP id f93ls1146204qga.75.gmail; Fri, 07 Feb 2014 10:58:26 -0800 (PST) X-Received: by 10.53.1.166 with SMTP id bh6mr231883vdd.64.1391799506255; Fri, 07 Feb 2014 10:58:26 -0800 (PST) Received: from mail-vb0-f44.google.com (mail-vb0-f44.google.com [209.85.212.44]) by mx.google.com with ESMTPS id sx1si504356vdc.62.2014.02.07.10.58.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 07 Feb 2014 10:58:26 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.44 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.44; Received: by mail-vb0-f44.google.com with SMTP id f12so2990280vbg.3 for ; Fri, 07 Feb 2014 10:58:26 -0800 (PST) X-Received: by 10.58.24.196 with SMTP id w4mr288981vef.48.1391799506168; Fri, 07 Feb 2014 10:58:26 -0800 (PST) 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.174.196 with SMTP id u4csp128275vcz; Fri, 7 Feb 2014 10:58:25 -0800 (PST) X-Received: by 10.52.79.102 with SMTP id i6mr256906vdx.51.1391799505664; Fri, 07 Feb 2014 10:58:25 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id z15si1613349vce.147.2014.02.07.10.58.25 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 07 Feb 2014 10:58:25 -0800 (PST) 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 1WBqbV-000225-3H; Fri, 07 Feb 2014 18:56:45 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WBqbT-0001zb-0i for xen-devel@lists.xensource.com; Fri, 07 Feb 2014 18:56:43 +0000 Received: from [85.158.137.68:64474] by server-10.bemta-3.messagelabs.com id DB/BF-07302-A6C25F25; Fri, 07 Feb 2014 18:56:42 +0000 X-Env-Sender: Stefano.Stabellini@citrix.com X-Msg-Ref: server-8.tower-31.messagelabs.com!1391799398!403618!3 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.9.16; banners=-,-,- X-VirusChecked: Checked Received: (qmail 2622 invoked from network); 7 Feb 2014 18:56:41 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-8.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 7 Feb 2014 18:56:41 -0000 X-IronPort-AV: E=Sophos;i="4.95,802,1384300800"; d="scan'208";a="100916615" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 07 Feb 2014 18:56:38 +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.2.342.4; Fri, 7 Feb 2014 13:56:37 -0500 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1WBqbI-0000vD-Fq; Fri, 07 Feb 2014 18:56:32 +0000 From: Stefano Stabellini To: Date: Fri, 7 Feb 2014 18:56:16 +0000 Message-ID: <1391799378-31664-2-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-4.5 2/4] xen/arm: support HW interrupts in gic_set_lr 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.212.44 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: If the irq to be injected is an hardware irq (p->desc != NULL), set GICH_LR_HW. Also add a struct vcpu* parameter to gic_set_lr. Signed-off-by: Stefano Stabellini --- xen/arch/arm/gic.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index acf7195..215b679 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -618,20 +618,24 @@ int __init setup_dt_irq(const struct dt_irq *irq, struct irqaction *new) return rc; } -static inline void gic_set_lr(int lr, unsigned int virtual_irq, +static inline void gic_set_lr(struct vcpu *v, int lr, unsigned int irq, unsigned int state, unsigned int priority) { - int maintenance_int = GICH_LR_MAINTENANCE_IRQ; - struct pending_irq *p = irq_to_pending(current, virtual_irq); + struct pending_irq *p = irq_to_pending(v, irq); BUG_ON(lr >= nr_lrs); BUG_ON(lr < 0); BUG_ON(state & ~(GICH_LR_STATE_MASK<> 3) << GICH_LR_PRIORITY_SHIFT) | - ((virtual_irq & GICH_LR_VIRTUAL_MASK) << GICH_LR_VIRTUAL_SHIFT); + if ( p->desc != NULL ) + GICH[GICH_LR + lr] = GICH_LR_HW | state | GICH_LR_MAINTENANCE_IRQ | + ((priority >> 3) << GICH_LR_PRIORITY_SHIFT) | + ((irq & GICH_LR_PHYSICAL_MASK) << GICH_LR_PHYSICAL_SHIFT) | + ((irq & GICH_LR_VIRTUAL_MASK) << GICH_LR_VIRTUAL_SHIFT); + else + GICH[GICH_LR + lr] = state | GICH_LR_MAINTENANCE_IRQ | + ((priority >> 3) << GICH_LR_PRIORITY_SHIFT) | + ((irq & GICH_LR_VIRTUAL_MASK) << GICH_LR_VIRTUAL_SHIFT); set_bit(GIC_IRQ_GUEST_VISIBLE, &p->status); clear_bit(GIC_IRQ_GUEST_PENDING, &p->status); @@ -666,7 +670,7 @@ void gic_remove_from_queues(struct vcpu *v, unsigned int virtual_irq) spin_unlock(&gic.lock); } -void gic_set_guest_irq(struct vcpu *v, unsigned int virtual_irq, +void gic_set_guest_irq(struct vcpu *v, unsigned int irq, unsigned int state, unsigned int priority) { int i; @@ -679,12 +683,12 @@ void gic_set_guest_irq(struct vcpu *v, unsigned int virtual_irq, i = find_first_zero_bit(&this_cpu(lr_mask), nr_lrs); if (i < nr_lrs) { set_bit(i, &this_cpu(lr_mask)); - gic_set_lr(i, virtual_irq, state, priority); + gic_set_lr(v, i, irq, state, priority); goto out; } } - gic_add_to_lr_pending(v, virtual_irq, priority); + gic_add_to_lr_pending(v, irq, priority); out: spin_unlock_irqrestore(&gic.lock, flags); @@ -703,7 +707,7 @@ static void gic_restore_pending_irqs(struct vcpu *v) if ( i >= nr_lrs ) return; spin_lock_irqsave(&gic.lock, flags); - gic_set_lr(i, p->irq, GICH_LR_PENDING, p->priority); + gic_set_lr(v, i, p->irq, GICH_LR_PENDING, p->priority); list_del_init(&p->lr_queue); set_bit(i, &this_cpu(lr_mask)); spin_unlock_irqrestore(&gic.lock, flags); @@ -950,7 +954,7 @@ static void maintenance_interrupt(int irq, void *dev_id, struct cpu_user_regs *r if ( !list_empty(&v->arch.vgic.lr_pending) ) { p2 = list_entry(v->arch.vgic.lr_pending.next, typeof(*p2), lr_queue); - gic_set_lr(i, p2->irq, GICH_LR_PENDING, p2->priority); + gic_set_lr(v, i, p2->irq, GICH_LR_PENDING, p2->priority); list_del_init(&p2->lr_queue); set_bit(i, &this_cpu(lr_mask)); }