From patchwork Fri Dec 12 14:43:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 42185 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f72.google.com (mail-ee0-f72.google.com [74.125.83.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4575326C99 for ; Fri, 12 Dec 2014 14:45:55 +0000 (UTC) Received: by mail-ee0-f72.google.com with SMTP id e53sf5290570eek.3 for ; Fri, 12 Dec 2014 06:45:54 -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=pR0kWSVx4PUYQ53NZGx2xJkmvgURFLUslkac6YtrK7Y=; b=P/m8A1087wkhk3xf96KnLenpL2qetWJurG3XEkiaxCBXpl2jh+99dB2VvEB68Pd3pm hoGtVPfu0lwPHOLHIswUSak6yy8LEoRv2hqsAqvwo0i576r3v6xgMI5dL8zQrO+DeqTM dI0cn8GjDfzi+RVAx7fatkoTu3LUAmjH3ibyty8ghSWwgMCZt0dqUXrPPNKjBGOjCtJi oRz3eJkQRHbdfW6nFpWmvZJY2GQFdOJx1k/d1qVuEZwn/pAOqXQe2hkuS3GBEG4P1okB nDY6HDFItFS72AX7/xlfE5wYfNumkyTf3QKbXbtUMawy+eDYE307MggGtRs7i9eyiXw7 9oaw== X-Gm-Message-State: ALoCoQk0/T/FWYQ0gn0njdTY4qeZkL9WDX4iF+gm05tRb1C7Qafb21WpcB6U8/9kslZMm4cJrPbN X-Received: by 10.112.16.36 with SMTP id c4mr351677lbd.15.1418395554428; Fri, 12 Dec 2014 06:45:54 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.120.39 with SMTP id kz7ls214224lab.25.gmail; Fri, 12 Dec 2014 06:45:54 -0800 (PST) X-Received: by 10.152.43.166 with SMTP id x6mr16167458lal.14.1418395554193; Fri, 12 Dec 2014 06:45:54 -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 ua8si1653185lac.7.2014.12.12.06.45.54 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 12 Dec 2014 06:45:54 -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 l4so5940556lbv.26 for ; Fri, 12 Dec 2014 06:45:54 -0800 (PST) X-Received: by 10.112.135.229 with SMTP id pv5mr15869909lbb.52.1418395554099; Fri, 12 Dec 2014 06:45:54 -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.142.69 with SMTP id ru5csp873562lbb; Fri, 12 Dec 2014 06:45:53 -0800 (PST) X-Received: by 10.140.93.164 with SMTP id d33mr30180061qge.37.1418395552274; Fri, 12 Dec 2014 06:45:52 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id n16si1676689qar.14.2014.12.12.06.45.51 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 12 Dec 2014 06:45:52 -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 1XzRRL-0002xn-Ny; Fri, 12 Dec 2014 14:43:31 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XzRRJ-0002x5-Qq for xen-devel@lists.xenproject.org; Fri, 12 Dec 2014 14:43:30 +0000 Received: from [85.158.139.211] by server-5.bemta-5.messagelabs.com id DA/C9-27584-11FFA845; Fri, 12 Dec 2014 14:43:29 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-13.tower-206.messagelabs.com!1418395408!13073481!1 X-Originating-IP: [74.125.82.42] 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 32671 invoked from network); 12 Dec 2014 14:43:28 -0000 Received: from mail-wg0-f42.google.com (HELO mail-wg0-f42.google.com) (74.125.82.42) by server-13.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 12 Dec 2014 14:43:28 -0000 Received: by mail-wg0-f42.google.com with SMTP id z12so9362831wgg.15 for ; Fri, 12 Dec 2014 06:43:28 -0800 (PST) X-Received: by 10.194.92.148 with SMTP id cm20mr28379873wjb.88.1418395408394; Fri, 12 Dec 2014 06:43:28 -0800 (PST) Received: from chilopoda.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id cq4sm2066234wjc.35.2014.12.12.06.43.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Dec 2014 06:43:27 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Fri, 12 Dec 2014 14:43:12 +0000 Message-Id: <1418395392-30460-5-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1418395392-30460-1-git-send-email-julien.grall@linaro.org> References: <1418395392-30460-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 for-4.6 4/4] 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 --- xen/arch/arm/domain.c | 13 ++++++++++--- 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, 20 insertions(+), 15 deletions(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 7221bc8..7d14377 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -543,10 +543,17 @@ 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(); + /* At this stage vgic_reserve_virq should never fail */ + BUG_ON(vgic_reserve_virq(d, GUEST_EVTCHN_PPI)); + } /* * 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 c238c8f..8dedc60 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -625,6 +625,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 416d42c..b0808b8 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.