From patchwork Mon Jun 23 16:37:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 32382 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f199.google.com (mail-ie0-f199.google.com [209.85.223.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9B945203AC for ; Mon, 23 Jun 2014 16:40:38 +0000 (UTC) Received: by mail-ie0-f199.google.com with SMTP id rd18sf44811833iec.10 for ; Mon, 23 Jun 2014 09:40:38 -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=Ncqk4bCJLq8pn3MAhztaJLUqHoQF1YHu9XJnDsQVqGs=; b=EhRNEXTgKXK5WySUu0ZVA6prHNpvBOTtxfV71ZAF677Vks2scYLBEI5+C3G/HaeKtt lbBJ7hIjUNWwkhGVzj/43cZHVRaVYK8nbU3sPK6ylRKCryAb2Wz49Xf8PqsGoMKEAlIm HKEowIonEAWkshCiWdGmz1vZ+68aWEKKkZtXTS8SxpFXgC9BB63lLMnRNDJjJAGVGoY5 RCpPS6AoTpPwWxeSc0lUC57VvdgxKjA8RNhYo9b+M/+1mpKW5+ZD5Dtnx4bdtwlIzoAt FBnsOcr5XAjN32TxZOLbwc7J5mQTHuKejnLKWMdm8rQT23SlsNX9VEu+06R8Xg1kZJsH U1Gw== X-Gm-Message-State: ALoCoQniEVJRzxNebQmxgZmgotTziGNY4Z02bRF3h9t2ljEwk/uuSs0fxmMcGoCeHyQLygbefhlx X-Received: by 10.182.27.40 with SMTP id q8mr10407487obg.22.1403541638199; Mon, 23 Jun 2014 09:40:38 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.25.225 with SMTP id 88ls2070880qgt.85.gmail; Mon, 23 Jun 2014 09:40:38 -0700 (PDT) X-Received: by 10.221.9.72 with SMTP id ov8mr20402697vcb.27.1403541638092; Mon, 23 Jun 2014 09:40:38 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id gv1si3560159vdb.27.2014.06.23.09.40.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 23 Jun 2014 09:40:38 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.176 as permitted sender) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id ik5so6200894vcb.35 for ; Mon, 23 Jun 2014 09:40:38 -0700 (PDT) X-Received: by 10.58.24.38 with SMTP id r6mr2578614vef.41.1403541638015; Mon, 23 Jun 2014 09:40:38 -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 tc5csp144348vcb; Mon, 23 Jun 2014 09:40:37 -0700 (PDT) X-Received: by 10.58.151.68 with SMTP id uo4mr10891640veb.11.1403541637533; Mon, 23 Jun 2014 09:40:37 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id r3si7197972vew.42.2014.06.23.09.40.37 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 23 Jun 2014 09:40:37 -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 1Wz7GB-0000tx-UX; Mon, 23 Jun 2014 16:38:23 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Wz7GA-0000ta-FS for xen-devel@lists.xensource.com; Mon, 23 Jun 2014 16:38:22 +0000 Received: from [193.109.254.147:21380] by server-13.bemta-14.messagelabs.com id D3/55-23211-DF758A35; Mon, 23 Jun 2014 16:38:21 +0000 X-Env-Sender: Stefano.Stabellini@citrix.com X-Msg-Ref: server-8.tower-27.messagelabs.com!1403541499!13150252!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 15378 invoked from network); 23 Jun 2014 16:38:21 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-8.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 23 Jun 2014 16:38:21 -0000 X-IronPort-AV: E=Sophos;i="5.01,531,1400025600"; d="scan'208";a="146222540" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 23 Jun 2014 16:38:20 +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; Mon, 23 Jun 2014 12:38:19 -0400 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1Wz7G1-0000zc-Sf; Mon, 23 Jun 2014 17:38:13 +0100 From: Stefano Stabellini To: Date: Mon, 23 Jun 2014 17:37:41 +0100 Message-ID: <1403541463-23734-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: MIA2 Cc: julien.grall@citrix.com, Ian.Campbell@citrix.com, Stefano Stabellini Subject: [Xen-devel] [PATCH v6 3/5] 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.176 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 --- 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 | 2 +- xen/arch/arm/irq.c | 5 +++-- xen/arch/arm/vgic.c | 11 +++++++++++ xen/include/asm-arm/gic.h | 1 + 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index c7dda9b..54610ce 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -292,7 +292,7 @@ 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 */ + /* Route to vcpu0 by default */ 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 9c141bc..15b8edc 100644 --- a/xen/arch/arm/irq.c +++ b/xen/arch/arm/irq.c @@ -197,8 +197,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 7924629..b2f922c 100644 --- a/xen/arch/arm/vgic.c +++ b/xen/arch/arm/vgic.c @@ -884,6 +884,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 <= 1019); + + 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/gic.h b/xen/include/asm-arm/gic.h index 3950554..ba9ba9b 100644 --- a/xen/include/asm-arm/gic.h +++ b/xen/include/asm-arm/gic.h @@ -169,6 +169,7 @@ 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);