From patchwork Wed Jun 4 14:35:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 31365 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f197.google.com (mail-ob0-f197.google.com [209.85.214.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2E31D208CF for ; Wed, 4 Jun 2014 14:40:35 +0000 (UTC) Received: by mail-ob0-f197.google.com with SMTP id vb8sf42678848obc.0 for ; Wed, 04 Jun 2014 07:40:34 -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=OV0Cq09kQU7qfh9TQElK+no/e/AHh9uJd/r7ejQBx4g=; b=QSujhgnLOnDkbO28Rr6yplWxOEYgfSb8Le3TqaUP8rw7B9BMqzS2gTltakM81LPYiC SsqV73v3ct8NfbjHmzpa0FMVF45g8/CKzejlX88V6TWWaMl3KSlSgyH1xFBAW15+OoA3 tNQDS/aR3VfTgNgEUDy7TwPV3IA1VQ4A7Ox68L4REaE/ewqV83xCGle9in0f2qPPkw0K dlA1w+z1Dy+N2juek2ALdPmRRnuzJWp3soKB94KJ1I08r64pVVwm7GOLi0OV5mvRnMb6 CQ8K4yHOyN869NasaSjtvwCn+C4Gv76waKPmhYIf3BnbADA/P/pHpIuNtBXyPAQojWFm 9OrQ== X-Gm-Message-State: ALoCoQm9DAG1hxETR13yYJHLyb1Lpre/SjI6/tchoR8XxigWxkAiU6CPkzoF3QTQuJGy6KdyqqLJ X-Received: by 10.182.29.98 with SMTP id j2mr20233666obh.23.1401892834718; Wed, 04 Jun 2014 07:40:34 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.85.40 with SMTP id m37ls3136211qgd.18.gmail; Wed, 04 Jun 2014 07:40:34 -0700 (PDT) X-Received: by 10.58.46.141 with SMTP id v13mr2262553vem.18.1401892834577; Wed, 04 Jun 2014 07:40:34 -0700 (PDT) Received: from mail-ve0-f179.google.com (mail-ve0-f179.google.com [209.85.128.179]) by mx.google.com with ESMTPS id yl10si1745962veb.92.2014.06.04.07.40.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 04 Jun 2014 07:40:34 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.179 as permitted sender) client-ip=209.85.128.179; Received: by mail-ve0-f179.google.com with SMTP id oy12so8981301veb.10 for ; Wed, 04 Jun 2014 07:40:34 -0700 (PDT) X-Received: by 10.58.216.163 with SMTP id or3mr1911231vec.80.1401892834370; Wed, 04 Jun 2014 07:40:34 -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.221.54.6 with SMTP id vs6csp50579vcb; Wed, 4 Jun 2014 07:40:34 -0700 (PDT) X-Received: by 10.221.7.71 with SMTP id on7mr44229489vcb.18.1401892833970; Wed, 04 Jun 2014 07:40:33 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id q9si5789746icz.15.2014.06.04.07.40.33 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 04 Jun 2014 07:40:33 -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 1WsCKX-00081x-58; Wed, 04 Jun 2014 14:38:17 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WsCKV-00081p-Mx for xen-devel@lists.xensource.com; Wed, 04 Jun 2014 14:38:15 +0000 Received: from [85.158.143.35:5343] by server-3.bemta-4.messagelabs.com id B8/DB-13602-75F2F835; Wed, 04 Jun 2014 14:38:15 +0000 X-Env-Sender: Stefano.Stabellini@citrix.com X-Msg-Ref: server-10.tower-21.messagelabs.com!1401892693!9243345!1 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 13545 invoked from network); 4 Jun 2014 14:38:14 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-10.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 4 Jun 2014 14:38:14 -0000 X-IronPort-AV: E=Sophos;i="4.98,973,1392163200"; d="scan'208";a="139508777" Received: from accessns.citrite.net (HELO FTLPEX01CL01.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 04 Jun 2014 14:36:11 +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.3.181.6; Wed, 4 Jun 2014 10:36:10 -0400 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1WsCIP-0006QB-Nd; Wed, 04 Jun 2014 15:36:05 +0100 From: Stefano Stabellini To: Date: Wed, 4 Jun 2014 15:35:53 +0100 Message-ID: <1401892553-20150-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: MIA2 Cc: julien.grall@citrix.com, Ian.Campbell@citrix.com, Stefano Stabellini Subject: [Xen-devel] [PATCH v3 2/2] xen/arm: support irq delivery to vcpu > 0 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.179 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: Export vgic_get_target_vcpu. Use vgic_get_target_vcpu to retrieve the target vcpu from do_IRQ. Route guest irqs to vcpu0 initially. Remove in-code comments about missing implementation of SGI delivery to vcpus other than 0. Signed-off-by: Stefano Stabellini --- xen/arch/arm/gic.c | 3 +-- xen/arch/arm/irq.c | 7 +++---- xen/arch/arm/vgic.c | 2 +- xen/include/asm-arm/gic.h | 2 ++ 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index 08ae23b..125ff36 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -287,8 +287,7 @@ void gic_route_irq_to_guest(struct domain *d, struct irq_desc *desc, gic_set_irq_properties(desc->irq, level, cpumask_of(smp_processor_id()), GIC_PRI_IRQ); - /* TODO: do not assume delivery to vcpu0 */ - p = irq_to_pending(d->vcpu[0], desc->irq); + p = irq_to_pending(d->vcpu[cpumask_first(cpu_mask)], desc->irq); p->desc = desc; } diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c index a33c797..f886155 100644 --- a/xen/arch/arm/irq.c +++ b/xen/arch/arm/irq.c @@ -175,8 +175,7 @@ void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq) desc->status |= IRQ_INPROGRESS; desc->arch.eoi_cpu = smp_processor_id(); - /* XXX: inject irq into all guest vcpus */ - vgic_vcpu_inject_irq(d->vcpu[0], irq); + vgic_vcpu_inject_irq(vgic_get_target_vcpu(d->vcpu[0], irq), irq); goto out_no_end; } @@ -342,8 +341,8 @@ int route_dt_irq_to_guest(struct domain *d, const struct dt_irq *irq, goto out; level = dt_irq_is_level_triggered(irq); - gic_route_irq_to_guest(d, desc, level, cpumask_of(smp_processor_id()), - GIC_PRI_IRQ); + /* route to vcpu0 initially */ + gic_route_irq_to_guest(d, desc, level, cpumask_of(0), GIC_PRI_IRQ); spin_unlock_irqrestore(&desc->lock, flags); return 0; diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c index 7614c2f..6a9c7f0 100644 --- a/xen/arch/arm/vgic.c +++ b/xen/arch/arm/vgic.c @@ -377,7 +377,7 @@ read_as_zero: return 1; } -static struct vcpu *vgic_get_target_vcpu(struct vcpu *v, unsigned int irq) +struct vcpu *vgic_get_target_vcpu(struct vcpu *v, unsigned int irq) { int target; struct vgic_irq_rank *rank; diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h index bf6fb1e..bd40628 100644 --- a/xen/include/asm-arm/gic.h +++ b/xen/include/asm-arm/gic.h @@ -227,6 +227,8 @@ int gic_irq_xlate(const u32 *intspec, unsigned int intsize, unsigned int *out_hwirq, unsigned int *out_type); void gic_clear_lrs(struct vcpu *v); +struct vcpu *vgic_get_target_vcpu(struct vcpu *v, unsigned int irq); + #endif /* __ASSEMBLY__ */ #endif