From patchwork Wed Aug 28 14:47:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 19584 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f197.google.com (mail-vc0-f197.google.com [209.85.220.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C3D9425E58 for ; Wed, 28 Aug 2013 14:48:40 +0000 (UTC) Received: by mail-vc0-f197.google.com with SMTP id ha11sf6780887vcb.8 for ; Wed, 28 Aug 2013 07:48:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=FuC8NQBmL/ZJtPWVbv2KgOf9t+z1Q+00Kb5aFmGuldQ=; b=f9q3t5+TML2ZQ89p+Goa+shdwLvWoBB3IEbqCCPR5wzo+KYp6QEf3oD+04iBMmTqM6 1YoIFUWkeI/bTsDA6172FjZD1jECN1m5R+rxXuoXUb1Y94IH1sCD1JCcETSLhs1lodOJ ciFpxI58Mk2gL1h8+SnvCApdP9ReV9o3X5sNNEkYyyEBITiLEk6WVtC/GOzPT+Invcxr wjfBjgTxwnn9whB7VP173uhaH06gmbNWsQL3on0VTXbbGYvWDzC1/l4nCk0ENnq5lwXB AAwKv13QyGhnv39OKX4A5t45IVt+ovY12XBycMMZhHQzcl0fXrpKq9H3qeFtjstl/nfq yLMg== X-Received: by 10.236.167.138 with SMTP id i10mr10723959yhl.9.1377701320502; Wed, 28 Aug 2013 07:48:40 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.3.102 with SMTP id b6ls403781qeb.1.gmail; Wed, 28 Aug 2013 07:48:40 -0700 (PDT) X-Received: by 10.58.207.103 with SMTP id lv7mr616103vec.33.1377701320373; Wed, 28 Aug 2013 07:48:40 -0700 (PDT) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id aa5si6608081vdc.78.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 28 Aug 2013 07:48:40 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id id13so4031407vcb.4 for ; Wed, 28 Aug 2013 07:48:40 -0700 (PDT) X-Gm-Message-State: ALoCoQkz3lz+tNqt5lJrgdR+kgdm+qVyUij8yN2hWO3f+HNmh1LrG/ovam9JvDbH9/yVNiMxEKww X-Received: by 10.52.98.7 with SMTP id ee7mr537203vdb.37.1377701320282; Wed, 28 Aug 2013 07:48:40 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp359968vcz; Wed, 28 Aug 2013 07:48:39 -0700 (PDT) X-Received: by 10.194.134.168 with SMTP id pl8mr2737767wjb.74.1377701319044; Wed, 28 Aug 2013 07:48:39 -0700 (PDT) Received: from mail-wg0-f50.google.com (mail-wg0-f50.google.com [74.125.82.50]) by mx.google.com with ESMTPS id m3si699371wic.53.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 28 Aug 2013 07:48:39 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.50 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=74.125.82.50; Received: by mail-wg0-f50.google.com with SMTP id m15so5547607wgh.5 for ; Wed, 28 Aug 2013 07:48:38 -0700 (PDT) X-Received: by 10.194.240.164 with SMTP id wb4mr2708736wjc.70.1377701318510; Wed, 28 Aug 2013 07:48:38 -0700 (PDT) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id a8sm5590498wie.6.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 28 Aug 2013 07:48:37 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Cc: stefano.stabellini@eu.citrix.com, ian.campbell@citrix.com, patches@linaro.org, andre.przywara@linaro.org, Julien Grall Subject: [PATCH V1 22/29] xen/arm: Create a fake timer node in dom0 device tree Date: Wed, 28 Aug 2013 15:47:36 +0100 Message-Id: <1377701263-3319-23-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1377701263-3319-1-git-send-email-julien.grall@linaro.org> References: <1377701263-3319-1-git-send-email-julien.grall@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Recreate the timer node and remove hypervisor specific interrupt. Signed-off-by: Julien Grall --- xen/arch/arm/domain_build.c | 67 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index c57a79d..3afe48f 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -498,6 +498,67 @@ static int make_gic_node(const struct domain *d, void *fdt, return res; } +static int make_timer_node(const struct domain *d, void *fdt, + const struct dt_device_node *parent) +{ + static const struct dt_device_match timer_ids[] __initconst = + { + DT_MATCH_COMPATIBLE("arm,armv7-timer"), + DT_MATCH_COMPATIBLE("arm,armv8-timer"), + { /* sentinel */ }, + }; + struct dt_device_node *dev; + u32 len; + const void *compatible; + int res; + const struct dt_irq *irq; + interrupt_t intrs[3]; + + DPRINT("Create timer node\n"); + + dev = dt_find_matching_node(NULL, timer_ids); + if ( !dev ) + { + dprintk(XENLOG_ERR, "Missing timer node in the device tree?\n"); + return -FDT_ERR_XEN(ENOENT); + } + + compatible = dt_get_property(dev, "compatible", &len); + if ( !compatible ) + { + dprintk(XENLOG_ERR, "Can't find compatible property for timer node\n"); + return -FDT_ERR_XEN(ENOENT); + } + + res = fdt_begin_node(fdt, "timer"); + if ( res ) + return res; + + res = fdt_property(fdt, "compatible", compatible, len); + if ( res ) + return res; + + irq = timer_dt_irq(TIMER_PHYS_SECURE_PPI); + DPRINT(" Secure interrupt %u\n", irq->irq); + set_interrupts(intrs[0], irq->irq, 0xf, irq->type); + + irq = timer_dt_irq(TIMER_PHYS_NONSECURE_PPI); + DPRINT(" Non secure interrupt %u\n", irq->irq); + set_interrupts(intrs[1], irq->irq, 0xf, irq->type); + + irq = timer_dt_irq(TIMER_VIRT_PPI); + DPRINT(" Virt interrupt %u\n", irq->irq); + set_interrupts(intrs[2], irq->irq, 0xf, irq->type); + + res = fdt_property(fdt, "interrupts", intrs, sizeof (intrs[0]) * 3); + if ( res ) + return res; + + res = fdt_end_node(fdt); + + return res; +} + /* Map the device in the domain */ static int map_device(struct domain *d, const struct dt_device_node *dev) { @@ -588,6 +649,8 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo, DT_MATCH_COMPATIBLE("arm,psci"), DT_MATCH_PATH("/cpus"), DT_MATCH_COMPATIBLE("arm,cortex-a15-gic"), + DT_MATCH_COMPATIBLE("arm,armv7-timer"), + DT_MATCH_COMPATIBLE("arm,armv8-timer"), { /* sentinel */ }, }; const struct dt_device_node *child; @@ -665,6 +728,10 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo, res = make_gic_node(d, kinfo->fdt, np); if ( res ) return res; + + res = make_timer_node(d, kinfo->fdt, np); + if ( res ) + return res; } res = fdt_end_node(kinfo->fdt);