From patchwork Thu Jun 22 07:38:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 106161 Delivered-To: patch@linaro.org Received: by 10.140.91.2 with SMTP id y2csp2327095qgd; Thu, 22 Jun 2017 00:41:12 -0700 (PDT) X-Received: by 10.36.194.71 with SMTP id i68mr728458itg.106.1498117272241; Thu, 22 Jun 2017 00:41:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498117272; cv=none; d=google.com; s=arc-20160816; b=CUQNDcPXLgPC3Xl8j7BBkp6lD0D2n2Hp5a/aG7J0hrVwPt2b782rSqkdEdBeWLg6VT dvrr2+QlYP6Gb3sajmrRYNsCvf7uUae737c+Twt4uMEd0dXdSKovzuxH6pxvFVmk0620 aExLY16sk44Rb8s23KjApInfTbg2y6Ncu8/O6npwzmtJkB5jsBVixA9wshJuRq8m5JJq nRm4vkJxsUQNiu5Z2quABlEuKua9EX4iokvlsX7+/XI68al1YLorkYwGypkGcFzQBwix r4Otlb9bHUtmyWx6OlELjdw46gYj6RJLX1IBvOGlkqhzv80JZCn4xWNpD8dTsvLXjvUX ingg== 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=8xJVRoF3xNhgxAJVnLtI3xS6RpEjIuvw2QK3FQvK/qo=; b=VyadDEsos3LrKKnQIGcI1vTDlHz9KHzn2vqBzCaqUX6H264g4vnNPrDd1eZVpOyOwG e8bPEk0n3vkWSc2pfqdFdiKdny3S4HZywPwCOgWTEu9FeOYT3HAb5KxbsPSso2QBPDtx GzZ6lfWVR/ulkSjb0Wgv51ngTwZmLb1v8TLKSFwlFf74ZfR1qGAgZJpT5Yqr4ipJ2EP0 12n9pFhkNl+cQXcg71Ji3vsTARNH/KTN7bkqeYsCajMhQIo32MGx+Zow2oTMeHFKCeWK E0qAUq4C7OHqOaiVUXorV1hUjWyc+7fdPu61FAd3zoZw4OJ1qQ/T5jDTQCClaPUecDpk Ua9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=W+yPbE/H; 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 2si706629iob.205.2017.06.22.00.41.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Jun 2017 00:41:12 -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 header.b=W+yPbE/H; 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 1dNwiX-00063S-DD; Thu, 22 Jun 2017 07:39:53 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dNwiW-00061O-F1 for xen-devel@lists.xenproject.org; Thu, 22 Jun 2017 07:39:52 +0000 Received: from [85.158.139.211] by server-5.bemta-5.messagelabs.com id BD/A2-02183-7447B495; Thu, 22 Jun 2017 07:39:51 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrAIsWRWlGSWpSXmKPExsXiVRtspute4h1 p8CfH4vuWyUwOjB6HP1xhCWCMYs3MS8qvSGDNuH/wBHvBUoWKKfv72BsYv0l0MXJxCAnMYJR4 09XJCOKwCMxjlji1cBY7iCMh0M8q8bV/G1MXIyeQkybx+epEdgi7QmLTy06wuJCAlsTRU7NZI UbtY5JYfuEVUIKDg03ARGJWhwRIjYiAksS9VZOZQGqYBeYzSjRN6mUDSQgLxEhsm9rHCmKzCK hKPJj7lxnE5hXwkdgx7x8jxDI5iZvnOsHinEDxFTsWskMs9pbYdWYyywRGgQWMDKsYNYpTi8p Si3SNTPWSijLTM0pyEzNzdA0NTPVyU4uLE9NTcxKTivWS83M3MQJDq56BgXEH4652v0OMkhxM SqK8//O8I4X4kvJTKjMSizPii0pzUosPMcpwcChJ8CoXA+UEi1LTUyvSMnOAQQ6TluDgURLhb QFp5S0uSMwtzkyHSJ1i1OWYdGD7FyYhlrz8vFQpcV5RkBkCIEUZpXlwI2ARd4lRVkqYl5GBgU GIpyC1KDezBFX+FaM4B6OSMK9+EdAUnsy8ErhNr4COYAI64sURD5AjShIRUlINjBVyZQXnrn5 1brq0JGOrQPCyeneDR6VlDEcnxBzvUP5QK+eVPLFKovq3+t3JCRFvU/Yn3DfO7pBN5wjfu/rU 285Z/qEvc34fn9vHt9+B+9EfOdWp6d157EKbUs8FTb682FdNYHrTs1dKNoLOzEeOSsp8Kk7cV nue3WDSpPTHF8TPzBAqvde5XImlOCPRUIu5qDgRAABkYoazAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-5.tower-206.messagelabs.com!1498117189!100099331!1 X-Originating-IP: [74.125.83.54] 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 55210 invoked from network); 22 Jun 2017 07:39:50 -0000 Received: from mail-pg0-f54.google.com (HELO mail-pg0-f54.google.com) (74.125.83.54) by server-5.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Jun 2017 07:39:50 -0000 Received: by mail-pg0-f54.google.com with SMTP id f127so4629460pgc.0 for ; Thu, 22 Jun 2017 00:39:50 -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=DpDkfnSmAOPxKcNgj9ayeEYhq5xmRGTaV9bCbfvFz5o=; b=W+yPbE/HSl/NVP5x8HWWHMqwdAts2jimSfsMCsjMrQfVzdvWCOQ6FymlbG0Zf6L7mz 3UT0kV9N434su2uBKaCijVY2dqI4TYTlPDbOllnlnpNM3jSebKQ6z6KuiYD2UDPeefJe cMSpZjpK3boucyKPFwbyDX7xGIBkBBryJOzF4= 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=DpDkfnSmAOPxKcNgj9ayeEYhq5xmRGTaV9bCbfvFz5o=; b=mXOU4kTedWdkQRqqf3z6Jxd8JH4pJRLcSb3qaB9i0xRu5YXoo2IYbnzbJj/l/qtPt7 +LRNTKYkd19TPB2gzMQnhB9A574U15/BwJRUx1JXqQyTykGCOuvBj8TjvWQEsWwgtC6c AIJte9AApzX+UJ0KFpWYgxGMA4mGtjykBT6Wcm4jGOIrLe5+KTQTzf9mc23DtBOltvOf M5pctaEJYB/dI+TB6UbmB23o+tAJ2kRVMTRocrrfBTjkaX0WwYzwX1VrkD85tJwIXUIV 8IaKKDyC5SMuXjd5iR8LeI8/gfGToE2cu+xiwxb19CeL63prsyLahOCZ4802RtFqpj46 /3cA== X-Gm-Message-State: AKS2vOxrZiaO8Toxz/GpvmBwZ4LVqyKoI2Ri5aqJHVyk3OGWgi57xD2T DRb54qLpwvGdfe66qAJ3Og== X-Received: by 10.101.88.130 with SMTP id d2mr1293888pgu.58.1498117189026; Thu, 22 Jun 2017 00:39:49 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id w69sm1883591pfk.107.2017.06.22.00.39.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 22 Jun 2017 00:39:48 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Thu, 22 Jun 2017 13:08:51 +0530 Message-Id: <1498117132-27139-17-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1498117132-27139-1-git-send-email-bhupinder.thakur@linaro.org> References: <1498117132-27139-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 16/17 v5] 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 Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall 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 9d6448e..cf3de01 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; @@ -130,9 +142,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" }, }; /* @@ -590,6 +603,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) { @@ -889,6 +934,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) );