From patchwork Tue Jun 6 17:25:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 103181 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp1536778qgd; Tue, 6 Jun 2017 10:28:05 -0700 (PDT) X-Received: by 10.36.13.20 with SMTP id 20mr19627588itx.37.1496770084967; Tue, 06 Jun 2017 10:28:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496770084; cv=none; d=google.com; s=arc-20160816; b=xGXPLm3EFcSbXkHjUkAchY6/GZfxskzhM9Y3O7vcIYYN2NR6E4ta/kgvtOsJh0bg3l jmqLxMQOcvlo3KUGW9B2Ot7f9cEEEhSoQzfpdSjuZIt8s8ktQfGRkzu3NlMyzHCtMocs BNXcnPuMXuO0FRGIiWWNPBX63gnZkgyhgpJDVAvBayYjtfiA2R0cdUzbRDM2XIHDVq8E upleEcytchxzjmFIpzxJ0mNY7mexdHA81UPkBHHXmtfiY1cAdhobvg9LyGovh1ChLGgZ k/9LQ6FrMqE3TMOo4j6y9wpuZ12nrSfwSAMdxTQVFaURO3hRQ+CSfdBZQ+Ghv2/TpiYx mdwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=T1QWsLpB8+EjMfe3lPzzUj64MJ/y9YHIfo7xkP0wQp4=; b=mxZGc0mNt1qmMyiD0RwJ1cvgYbUoY/DcIUyIkCSozKenYu+b7m82+AwCFoajnuCYUa 7z1vY8nUfmUTe02XwDwY1shIKdAqKJr1QkGFJg2mmI46hfX6qfJNzkQ9D9hUX3u8YfmJ mwC2XL5cDiPnXq/hEF4xCjHlwlwv2v9iIUoutEpIQpUz0bzzmRL1qBEXNmLyQk6Ft2sP rpySx0VBPNGxOGzX5nf15FVUduZwv1Ex+JgSuPrRzZVqIl8y7oNlFoBjN37jwnbfD25Q ILzN6xk6ITarqUXFfHVzMjC/mRuwPMd4pEjMZsrD9+xrUsgpUwyvqT5+RfPV9uYYnrvj I1AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id l186si38043839iof.223.2017.06.06.10.28.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Jun 2017 10:28:04 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dIIFF-00021b-Sh; Tue, 06 Jun 2017 17:26:17 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dIIFE-0001zl-Oo for xen-devel@lists.xenproject.org; Tue, 06 Jun 2017 17:26:16 +0000 Received: from [85.158.137.68] by server-16.bemta-3.messagelabs.com id E1/41-29088-8B5E6395; Tue, 06 Jun 2017 17:26:16 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrKIsWRWlGSWpSXmKPExsVyMfTARt3tT80 iDY5fl7P4vmUykwOjx+EPV1gCGKNYM/OS8isSWDPud31jLJgtX/FixUqmBsYv4l2MnBxCAjMY Jeavteti5OJgEZjHLPH/7mdmEEdCoJ9V4tLyT6wgVRICaRJdk5YyQtjVEo2T17JBdGtJHD01m xWkQUigmUnizoIGoAQHB5uAicSsDgmQGhEBJYl7qyYzgdQwC8xnlGia1AtWIywQIzFtjRpIDY uAqsTGN/uYQGxeAR+JGccnsUDskpO4ea6TGcTmBIrPPL+EEWKvt8SehjbGCYwCCxgZVjFqFKc WlaUW6RoZ6SUVZaZnlOQmZuboGhoY6+WmFhcnpqfmJCYV6yXn525iBAZWPQMD4w7GqSf8DjFK cjApifJGXjKLFOJLyk+pzEgszogvKs1JLT7EKMPBoSTBG/kEKCdYlJqeWpGWmQMMcZi0BAePk gjv5AdAad7igsTc4sx0iNQpRmOOK1fWfWHimHJg+xcmIZa8/LxUKXHeFSCTBEBKM0rz4AbBYu 8So6yUMC8jAwODEE9BalFuZgmq/CtGcQ5GJWHeFJApPJl5JXD7XgGdwgR0Ct8lE5BTShIRUlI NjPMtry1etbxnUeD7Lan/dsuzrm5eHNDktzWQ+cSuhqvumR95N58//1WPN/zJjND7H53fv9I4 zHmklm/Bp+cfH227kD3rocz767JFsaUCLR835+/T9goPLd2ndSh7Y5SY7gGnt/v7u9N/XHy34 p7+hhU+G/ZozjmVpDRtCt//JS/SCthEP/kVcZgrsRRnJBpqMRcVJwIA09GFXrgCAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-8.tower-31.messagelabs.com!1496769974!104434355!1 X-Originating-IP: [209.85.192.177] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.19; banners=-,-,- X-VirusChecked: Checked Received: (qmail 8248 invoked from network); 6 Jun 2017 17:26:15 -0000 Received: from mail-pf0-f177.google.com (HELO mail-pf0-f177.google.com) (209.85.192.177) by server-8.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 6 Jun 2017 17:26:15 -0000 Received: by mail-pf0-f177.google.com with SMTP id x63so2106606pff.3 for ; Tue, 06 Jun 2017 10:26:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VZJUuuIprOQStGxdyVOS4eGm62UShMry/rjYX8AeUVs=; b=EhzxyYu+/dS14vcvpqWKlvkmavwKrBKKtKftGdwsyMLae2IamgGULXAQ1+UJ3sRmY6 3MnTTurUwnegTPEZx4eRi3NQcUHyqzHrSTd8YDiYOuw3GSbpvDebBA44901QzTazY2oA xXAADDlkxnk3ZHZKObzT87g0AhRflEp5WxCL4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VZJUuuIprOQStGxdyVOS4eGm62UShMry/rjYX8AeUVs=; b=VA2dRma3X6/WFvj+kS4hg9yBaKLKSLWufWUDakq/hT26kgE1LGP8giqaNLtRwBvaHE m0AbZj1nSR0tO3wdwI61Jg407WCjQcmLd/6iLRG/zPSwUgjhW3nK7c/b9BAa+lVYOYWg 1p1+CpKQNFzTy3MWta0g9wNWDPzBz5pU/dpcEMyQzoxi6+xIUcKt8Ein3N9V2sH72ej3 NY/1Ep0TU8yRMI9MGwtDDp0N3tu1LScrlF9SuupXEMx5lM8SjWJYB8M48nI1XLNIap6j gLB83NTii72gV1WStuI8O+6MILEta7f41COxIh9OTHksOhh9KAjgqEjVOuqJpYmYVgbI bL1g== X-Gm-Message-State: AODbwcCIGJfG6Vneqcg8UrLfTrjsWD6Hak7+ppuLqljLOP1KxWIhQZU9 U7hRxfN0samftU9UBUz0OQ== X-Received: by 10.84.217.216 with SMTP id d24mr10364666plj.148.1496769973824; Tue, 06 Jun 2017 10:26:13 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com ([103.5.19.18]) by smtp.gmail.com with ESMTPSA id 62sm6031632pfr.90.2017.06.06.10.26.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Jun 2017 10:26:13 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Tue, 6 Jun 2017 22:55:28 +0530 Message-Id: <1496769929-23355-14-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496769929-23355-1-git-send-email-bhupinder.thakur@linaro.org> References: <1496769929-23355-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 13/14 v4] xen/arm: vpl011: Add a pl011 uart DT node in the guest device tree X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" The SBSA uart node format is as specified in Documentation/devicetree/bindings/serial/arm_sbsa_uart.txt and given below: ARM SBSA defined generic UART ------------------------------ This UART uses a subset of the PL011 registers and consequently lives in the PL011 driver. It's baudrate and other communication parameters cannot be adjusted at runtime, so it lacks a clock specifier here. Required properties: - compatible: must be "arm,sbsa-uart" - reg: exactly one register range - interrupts: exactly one interrupt specifier - current-speed: the (fixed) baud rate set by the firmware Currently the baud rate of 115200 has been selected as a default value, which is one of the valid baud rate setttings. Higher baud rate was selected since an emulated pl011 can support any valid baud rate without any limitation of the hardware. Signed-off-by: Bhupinder Thakur Reviewed-by: Stefano Stabellini --- CC: ij CC: wl CC: ss CC: jg tools/libxl/libxl_arm.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c index b60dfa9..b59fd9f 100644 --- a/tools/libxl/libxl_arm.c +++ b/tools/libxl/libxl_arm.c @@ -44,10 +44,22 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc, uint32_t nr_spis = 0; unsigned int i; + /* + * If pl011 vuart is enabled then increment the nr_spis to allow allocation + * of SPI VIRQ for pl011. + */ + if (d_config->b_info.arch_arm.vuart) + nr_spis += (GUEST_VPL011_SPI - 32) + 1; + for (i = 0; i < d_config->b_info.num_irqs; i++) { uint32_t irq = d_config->b_info.irqs[i]; uint32_t spi; + if (d_config->b_info.arch_arm.vuart && (irq == GUEST_VPL011_SPI)) { + LOG(ERROR, "Physical IRQ %u conflicting with pl011 SPI\n", irq); + return ERROR_FAIL; + } + if (irq < 32) continue; @@ -149,9 +161,10 @@ static struct arch_info { const char *guest_type; const char *timer_compat; const char *cpu_compat; + const char *uart_compat; } arch_info[] = { - {"xen-3.0-armv7l", "arm,armv7-timer", "arm,cortex-a15" }, - {"xen-3.0-aarch64", "arm,armv8-timer", "arm,armv8" }, + {"xen-3.0-armv7l", "arm,armv7-timer", "arm,cortex-a15", "arm,sbsa-uart" }, + {"xen-3.0-aarch64", "arm,armv8-timer", "arm,armv8", "arm,sbsa-uart" }, }; /* @@ -609,6 +622,38 @@ static int make_hypervisor_node(libxl__gc *gc, void *fdt, return 0; } +static int make_vpl011_uart_node(libxl__gc *gc, void *fdt, + const struct arch_info *ainfo, + struct xc_dom_image *dom) +{ + int res; + gic_interrupt intr; + + res = fdt_begin_node(fdt, "sbsa-pl011"); + if (res) return res; + + res = fdt_property_compat(gc, fdt, 1, ainfo->uart_compat); + if (res) return res; + + res = fdt_property_regs(gc, fdt, ROOT_ADDRESS_CELLS, ROOT_SIZE_CELLS, + 1, + GUEST_PL011_BASE, GUEST_PL011_SIZE); + if (res) return res; + + set_interrupt(intr, GUEST_VPL011_SPI, 0xf, DT_IRQ_TYPE_LEVEL_HIGH); + + res = fdt_property_interrupts(gc, fdt, &intr, 1); + if (res) return res; + + /* Use a default baud rate of 115200. */ + fdt_property_u32(fdt, "current-speed", 115200); + + res = fdt_end_node(fdt); + if (res) return res; + + return 0; +} + static const struct arch_info *get_arch_info(libxl__gc *gc, const struct xc_dom_image *dom) { @@ -908,6 +953,9 @@ next_resize: FDT( make_timer_node(gc, fdt, ainfo, xc_config->clock_frequency) ); FDT( make_hypervisor_node(gc, fdt, vers) ); + if (info->arch_arm.vuart) + FDT( make_vpl011_uart_node(gc, fdt, ainfo, dom) ); + if (pfdt) FDT( copy_partial_fdt(gc, fdt, pfdt) );