From patchwork Tue Sep 10 14:49:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 19919 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f200.google.com (mail-ve0-f200.google.com [209.85.128.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 71083246A4 for ; Tue, 10 Sep 2013 14:49:49 +0000 (UTC) Received: by mail-ve0-f200.google.com with SMTP id oy12sf8077235veb.3 for ; Tue, 10 Sep 2013 07:49:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; 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=ZHyamLOVoCILlCJBh9cT1WwHpDNrcpna/l5T94IXlv8=; b=JcatD0KA1P0TNfoUiek1HSehbMhu5ZxftC845evvXvLntvgmena5b4u8q81WSuflOA 4zSo/Ee9u8zkBbsezM7M6igBgrdYCXm5m+rjlZ8KVYKA9rrxFVIiOFXFV25rBWv5/KFr d21oEJ+eY7qawB7JOe8UTX4us//0BMWqM56nN9PB2ztUChZyTFz0uc5VIJXajQvzbq49 Vqmia8w0Ray2GwecTtaonN7DtcER5c+BGOm5fofOXUes90ULPv36d2EuH8SHw9LPMXKm Tnhwqjb0WdTFm1y/2yBsVsFXyyEetAOr7zH1lvkCaR9JZKpZSaXcjqPJa4vNSP/tIQGo JPeQ== X-Received: by 10.236.90.67 with SMTP id d43mr8464315yhf.36.1378824589282; Tue, 10 Sep 2013 07:49:49 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.38.130 with SMTP id g2ls2144095qek.99.gmail; Tue, 10 Sep 2013 07:49:49 -0700 (PDT) X-Received: by 10.58.165.70 with SMTP id yw6mr8832029veb.19.1378824589025; Tue, 10 Sep 2013 07:49:49 -0700 (PDT) Received: from mail-ve0-f180.google.com (mail-ve0-f180.google.com [209.85.128.180]) by mx.google.com with ESMTPS id is10si4523763veb.108.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Sep 2013 07:49:49 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.180; Received: by mail-ve0-f180.google.com with SMTP id jz11so4488187veb.25 for ; Tue, 10 Sep 2013 07:49:48 -0700 (PDT) X-Gm-Message-State: ALoCoQlJHy+sl7+7cjSBxVoLDBy3f+41LLswN1p43eNiGmAeJobrLcE/Yqj96FEDVxQYcghXdR8E X-Received: by 10.220.1.203 with SMTP id 11mr23204316vcg.15.1378824588913; Tue, 10 Sep 2013 07:49:48 -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 u4csp4669vcz; Tue, 10 Sep 2013 07:49:48 -0700 (PDT) X-Received: by 10.15.107.10 with SMTP id ca10mr3224392eeb.76.1378824587637; Tue, 10 Sep 2013 07:49:47 -0700 (PDT) Received: from mail-ea0-f171.google.com (mail-ea0-f171.google.com [209.85.215.171]) by mx.google.com with ESMTPS id u46si15318227eeg.136.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Sep 2013 07:49:47 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.215.171 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=209.85.215.171; Received: by mail-ea0-f171.google.com with SMTP id n15so3953436ead.16 for ; Tue, 10 Sep 2013 07:49:47 -0700 (PDT) X-Received: by 10.14.37.4 with SMTP id x4mr39959822eea.16.1378824587035; Tue, 10 Sep 2013 07:49:47 -0700 (PDT) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id i1sm31911644eeg.0.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Sep 2013 07:49:46 -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 v3 18/27] xen/arm: Create a fake timer node in dom0 device tree Date: Tue, 10 Sep 2013 15:49:06 +0100 Message-Id: <1378824555-16564-19-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1378824555-16564-1-git-send-email-julien.grall@linaro.org> References: <1378824555-16564-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.128.180 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 --- Changes in v3: - Use DT_MATCH_TIMER --- xen/arch/arm/domain_build.c | 66 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 9865ca4..75192af 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -491,6 +491,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) { @@ -581,6 +642,7 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo, DT_MATCH_COMPATIBLE("arm,psci"), DT_MATCH_PATH("/cpus"), DT_MATCH_GIC, + DT_MATCH_TIMER, { /* sentinel */ }, }; const struct dt_device_node *child; @@ -658,6 +720,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);