From patchwork Thu Jan 15 20:23:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 43222 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A3C7B20D60 for ; Thu, 15 Jan 2015 20:26:19 +0000 (UTC) Received: by mail-la0-f70.google.com with SMTP id hs14sf9102773lab.1 for ; Thu, 15 Jan 2015 12:26:18 -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: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=OU3nQNgi8eTzsYe1h/xYW7MzJeBsryyxFWAzj5nT+GU=; b=U686e1DpNXxLjdAuEzZVF3rAaqtC4x2FDj6Z+2D5U++m75uAjIOZl7qkufNTsoGVb+ 1iKyhN1boWV9v4+oKl+Q+wfZCuwRdj6MfQNZlBr/ATDEIxFzSGr/BnD+k6Lu/E3EaOLs crjMVvr1Vm2LZKjmib1y5Xfrk/Upp3gvq7/xGikrA1cR3OagcQ34LSayfoboqps25Itp EkqZBXP29Co+m7utXWRwVxghfyX3UXBGbUFUGV5h0kKFHxYmU/bZh+aYc4VJ7DpFnzUP TX7ZGFPnZIyCzddw+CP3GYET+/arTUtJErm5A/m7+rEaB7fV9rOrgX4RruDL/Pr7nemF 2Tjw== X-Gm-Message-State: ALoCoQkOJG1W3EmOUNy0hcDs02Y9ek7WEtWdXmHBtkjazKboRgue7d3wuXXVnijLTbbkrWLGRkAx X-Received: by 10.112.137.70 with SMTP id qg6mr492559lbb.14.1421353578062; Thu, 15 Jan 2015 12:26:18 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.115.193 with SMTP id jq1ls270757lab.85.gmail; Thu, 15 Jan 2015 12:26:17 -0800 (PST) X-Received: by 10.152.36.100 with SMTP id p4mr8646810laj.11.1421353577852; Thu, 15 Jan 2015 12:26:17 -0800 (PST) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id ld5si1121269lbb.29.2015.01.15.12.26.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 15 Jan 2015 12:26:17 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by mail-lb0-f181.google.com with SMTP id u14so5761523lbd.12 for ; Thu, 15 Jan 2015 12:26:17 -0800 (PST) X-Received: by 10.152.18.135 with SMTP id w7mr11567972lad.47.1421353577708; Thu, 15 Jan 2015 12:26:17 -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.112.9.200 with SMTP id c8csp96803lbb; Thu, 15 Jan 2015 12:26:16 -0800 (PST) X-Received: by 10.229.35.74 with SMTP id o10mr19541273qcd.26.1421353576105; Thu, 15 Jan 2015 12:26:16 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id e34si3287645qge.99.2015.01.15.12.26.15 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 15 Jan 2015 12:26:16 -0800 (PST) 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 1YBqxp-0004MJ-Fg; Thu, 15 Jan 2015 20:24:21 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YBqxn-0004Lq-W5 for xen-devel@lists.xenproject.org; Thu, 15 Jan 2015 20:24:20 +0000 Received: from [85.158.137.68] by server-7.bemta-3.messagelabs.com id 96/20-17958-2F128B45; Thu, 15 Jan 2015 20:24:18 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-6.tower-31.messagelabs.com!1421353457!15475782!1 X-Originating-IP: [74.125.82.172] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.12.5; banners=-,-,- X-VirusChecked: Checked Received: (qmail 32513 invoked from network); 15 Jan 2015 20:24:17 -0000 Received: from mail-we0-f172.google.com (HELO mail-we0-f172.google.com) (74.125.82.172) by server-6.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 15 Jan 2015 20:24:17 -0000 Received: by mail-we0-f172.google.com with SMTP id k11so16801058wes.3 for ; Thu, 15 Jan 2015 12:24:17 -0800 (PST) X-Received: by 10.180.90.165 with SMTP id bx5mr64961090wib.15.1421353457319; Thu, 15 Jan 2015 12:24:17 -0800 (PST) Received: from chilopoda.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id o2sm353755wiy.11.2015.01.15.12.24.15 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Jan 2015 12:24:16 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Thu, 15 Jan 2015 20:23:42 +0000 Message-Id: <1421353422-13133-4-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1421353422-13133-1-git-send-email-julien.grall@linaro.org> References: <1421353422-13133-1-git-send-email-julien.grall@linaro.org> Cc: ian.campbell@citrix.com, Julien Grall , tim@xen.org, stefano.stabellini@citrix.com, parth.dixit@linaro.org, christoffer.dall@linaro.org Subject: [Xen-devel] [PATCH v2 3/3] xen/arm: Find automatically a PPI for the DOM0 event channel interrupt 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.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 the new vgic interface to know which virtual PPI is free and use it for the event channel code. At the DOM0 creation time, Xen still don't know which vIRQ will be free. All the vIRQ will be reserved when we parse the device tree. So allocate when the hypervisor node is created. It's safe to defer the allocation because no vIRQ can be injected as long as the vCPU is not online. Also correct the check in arch_domain_create to use is_hardware_domain. Signed-off-by: Julien Grall --- Changes in v2: - Correct the BUG_ON in arch_domain_create - Use if (...) BUG() rather than BUG_ON() --- xen/arch/arm/domain.c | 17 +++++++++++------ xen/arch/arm/domain_build.c | 10 ++++++++++ xen/arch/arm/platform.c | 7 ------- xen/arch/arm/platforms/xgene-storm.c | 1 - xen/include/asm-arm/platform.h | 4 ---- 5 files changed, 21 insertions(+), 18 deletions(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index d0229d1..046cc78 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -543,13 +543,18 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags) if ( (rc = domain_vtimer_init(d)) != 0 ) goto fail; - if ( d->domain_id ) + /* + * The hardware domain will get a PPI later in + * arch/arm/domain_build.c depending on the + * interrupt map of the hardware. + */ + if ( !is_hardware_domain(d) ) + { d->arch.evtchn_irq = GUEST_EVTCHN_PPI; - else - d->arch.evtchn_irq = platform_dom0_evtchn_ppi(); - - if ( !vgic_reserve_virq(d, d->arch.evtchn_irq) ) - BUG(); + /* At this stage vgic_reserve_virq should never fail */ + if ( !vgic_reserve_virq(d, GUEST_EVTCHN_PPI) ) + BUG(); + } /* * Virtual UART is only used by linux early printk and decompress code. diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 3d4f317..d5959b5 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -627,6 +627,16 @@ static int make_hypervisor_node(struct domain *d, return res; /* + * The allocation of the event channel IRQ has been deferred until + * now. At this time, all PPIs use by DOM0 has been registered + */ + res = vgic_allocate_virq(d, 0); + if ( res < 0 ) + return -FDT_ERR_XEN(ENOSPC); + + d->arch.evtchn_irq = res; + + /* * interrupts is evtchn upcall: * - Active-low level-sensitive * - All cpus diff --git a/xen/arch/arm/platform.c b/xen/arch/arm/platform.c index cb4cda8..d016797 100644 --- a/xen/arch/arm/platform.c +++ b/xen/arch/arm/platform.c @@ -160,13 +160,6 @@ bool_t platform_device_is_blacklisted(const struct dt_device_node *node) return dt_match_node(blacklist, node); } -unsigned int platform_dom0_evtchn_ppi(void) -{ - if ( platform && platform->dom0_evtchn_ppi ) - return platform->dom0_evtchn_ppi; - return GUEST_EVTCHN_PPI; -} - void platform_dom0_gnttab(paddr_t *start, paddr_t *size) { if ( platform && platform->dom0_gnttab_size ) diff --git a/xen/arch/arm/platforms/xgene-storm.c b/xen/arch/arm/platforms/xgene-storm.c index ef3ba63..eee650e 100644 --- a/xen/arch/arm/platforms/xgene-storm.c +++ b/xen/arch/arm/platforms/xgene-storm.c @@ -232,7 +232,6 @@ PLATFORM_START(xgene_storm, "APM X-GENE STORM") .quirks = xgene_storm_quirks, .specific_mapping = xgene_storm_specific_mapping, - .dom0_evtchn_ppi = 24, .dom0_gnttab_start = 0x1f800000, .dom0_gnttab_size = 0x20000, PLATFORM_END diff --git a/xen/include/asm-arm/platform.h b/xen/include/asm-arm/platform.h index eefaca6..4eba37b 100644 --- a/xen/include/asm-arm/platform.h +++ b/xen/include/asm-arm/platform.h @@ -38,10 +38,6 @@ struct platform_desc { */ const struct dt_device_match *blacklist_dev; /* - * The IRQ (PPI) to use to inject event channels to dom0. - */ - unsigned int dom0_evtchn_ppi; - /* * The location of a region of physical address space which dom0 * can use for grant table mappings. If size is zero defaults to * 0xb0000000-0xb0020000.