From patchwork Thu Jul 10 18:13:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 33453 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f200.google.com (mail-vc0-f200.google.com [209.85.220.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4D2B121140 for ; Thu, 10 Jul 2014 18:16:30 +0000 (UTC) Received: by mail-vc0-f200.google.com with SMTP id id10sf30233945vcb.3 for ; Thu, 10 Jul 2014 11:16:30 -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=H9L97br6x24Odwa0u7sgjFplZK1W7S2VpD98MnGYYj4=; b=UB1mlzz3r5KkULeJNfmxv1t2B4/03dzktY/alWa9SwV5lPH3kGu4a7ZLYZgKed4e6Q BBNjuOEPPzTXE/gL239uEletEvFgfNsArWPo43p01mcM8ExM/D7TkDvSDdzqS7+kdTve OHVgwjKJVWiRrsVzmLSt+k98vokdoEuuwiToq51px7Hvdpa/TTGpvJJpc0l+VoE/CvTS ueFizOTEyMwNx7rN5MblFRKX0Fu/IdoilaNoYKgUWY40xLl0xlX7bYQ3BctRC4jPabDt r5LEq7hCU+/KkiQUsn81sG6m4Me1O8YGBB5tCO5REINNKL4sUjsFDSP2eOLdIdDzCOO6 H7XQ== X-Gm-Message-State: ALoCoQm/91s7PhH1PMBq6jEGkrdg5tipFmUJTMf+nBDdrDTYJ5UYSiQEUtBv/gnslOZqzKhizDiz X-Received: by 10.58.99.38 with SMTP id en6mr4742212veb.19.1405016190086; Thu, 10 Jul 2014 11:16:30 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.46.99 with SMTP id j90ls147078qga.49.gmail; Thu, 10 Jul 2014 11:16:30 -0700 (PDT) X-Received: by 10.58.182.234 with SMTP id eh10mr1811833vec.41.1405016189993; Thu, 10 Jul 2014 11:16:29 -0700 (PDT) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id gm6si23375562vec.75.2014.07.10.11.16.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 10 Jul 2014 11:16:29 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.181 as permitted sender) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id hu12so108955vcb.12 for ; Thu, 10 Jul 2014 11:16:29 -0700 (PDT) X-Received: by 10.220.252.198 with SMTP id mx6mr29739482vcb.15.1405016189907; Thu, 10 Jul 2014 11:16:29 -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.37.5 with SMTP id tc5csp156669vcb; Thu, 10 Jul 2014 11:16:29 -0700 (PDT) X-Received: by 10.58.134.81 with SMTP id pi17mr22836306veb.14.1405016189472; Thu, 10 Jul 2014 11:16:29 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id gt8si6423304vdc.53.2014.07.10.11.16.29 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 10 Jul 2014 11:16:29 -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 1X5IrW-0008PB-UT; Thu, 10 Jul 2014 18:14:30 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1X5IrU-0008Nc-TD for xen-devel@lists.xensource.com; Thu, 10 Jul 2014 18:14:29 +0000 Received: from [85.158.139.211:5331] by server-10.bemta-5.messagelabs.com id 1E/78-10247-408DEB35; Thu, 10 Jul 2014 18:14:28 +0000 X-Env-Sender: Stefano.Stabellini@citrix.com X-Msg-Ref: server-12.tower-206.messagelabs.com!1405016065!14834761!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 27573 invoked from network); 10 Jul 2014 18:14:27 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-12.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 10 Jul 2014 18:14:27 -0000 X-IronPort-AV: E=Sophos;i="5.01,639,1400025600"; d="scan'208";a="151781392" Received: from accessns.citrite.net (HELO FTLPEX01CL01.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 10 Jul 2014 18:14:25 +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; Thu, 10 Jul 2014 14:14:24 -0400 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1X5IrK-00037s-Sf; Thu, 10 Jul 2014 19:14:18 +0100 From: Stefano Stabellini To: Date: Thu, 10 Jul 2014 19:13:17 +0100 Message-ID: <1405016003-19131-4-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 04/10] 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.220.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: Use vgic_get_target_vcpu to retrieve the target vcpu from do_IRQ. Remove in-code comments about missing implementation of SGI delivery to vcpus other than 0. Signed-off-by: Stefano Stabellini Acked-by: Julien Grall Acked-by: Ian Campbell --- Changes in v7: - improve in-code comment; - use gic_number_lines in assert. Changes in v6: - add in-code comments; - assert that the guest irq is an SPI. Changes in v4: - the mask in gic_route_irq_to_guest is a physical cpu mask, treat it as such; - export vgic_get_target_vcpu in a previous patch. --- xen/arch/arm/gic.c | 3 ++- xen/arch/arm/irq.c | 5 +++-- xen/arch/arm/vgic.c | 11 +++++++++++ xen/include/asm-arm/vgic.h | 1 + 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index a0252f9..884661c 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -137,7 +137,8 @@ void gic_route_irq_to_guest(struct domain *d, struct irq_desc *desc, gic_set_irq_properties(desc, cpumask_of(smp_processor_id()), GIC_PRI_IRQ); - /* TODO: do not assume delivery to vcpu0 */ + /* Use vcpu0 to retrieve the pending_irq struct. Given that we only + * route SPIs to guests, it doesn't make any difference. */ p = irq_to_pending(d->vcpu[0], desc->irq); p->desc = desc; } diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c index 3a8acbf..49ca467 100644 --- a/xen/arch/arm/irq.c +++ b/xen/arch/arm/irq.c @@ -198,8 +198,9 @@ 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); + /* the irq cannot be a PPI, we only support delivery of SPIs to + * guests */ + vgic_vcpu_inject_spi(d, irq); goto out_no_end; } diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c index fbe3293..5445a7b 100644 --- a/xen/arch/arm/vgic.c +++ b/xen/arch/arm/vgic.c @@ -434,6 +434,17 @@ out: smp_send_event_check_mask(cpumask_of(v->processor)); } +void vgic_vcpu_inject_spi(struct domain *d, unsigned int irq) +{ + struct vcpu *v; + + /* the IRQ needs to be an SPI */ + ASSERT(irq >= 32 && irq <= gic_number_lines()); + + v = vgic_get_target_vcpu(d->vcpu[0], irq); + vgic_vcpu_inject_irq(v, irq); +} + /* * Local variables: * mode: C diff --git a/xen/include/asm-arm/vgic.h b/xen/include/asm-arm/vgic.h index c66578b..e961780 100644 --- a/xen/include/asm-arm/vgic.h +++ b/xen/include/asm-arm/vgic.h @@ -159,6 +159,7 @@ extern int domain_vgic_init(struct domain *d); extern void domain_vgic_free(struct domain *d); extern int vcpu_vgic_init(struct vcpu *v); extern void vgic_vcpu_inject_irq(struct vcpu *v, unsigned int irq); +extern void vgic_vcpu_inject_spi(struct domain *d, unsigned int irq); extern void vgic_clear_pending_irqs(struct vcpu *v); extern struct pending_irq *irq_to_pending(struct vcpu *v, unsigned int irq); extern struct vgic_irq_rank *vgic_rank_offset(struct vcpu *v, int b, int n, int s);