From patchwork Mon Jul 17 13:06:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 107957 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp4495472qge; Mon, 17 Jul 2017 06:09:41 -0700 (PDT) X-Received: by 10.36.222.215 with SMTP id d206mr5684715itg.63.1500296981065; Mon, 17 Jul 2017 06:09:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500296981; cv=none; d=google.com; s=arc-20160816; b=h5ZRPfACfZMI1/dKsaMCYYNs9qOUjxgZY8giIBRKF+Jbqlc9TK8jUk9/PA99NlbW4A tQta7fhuHZscurnQw1xnQeCU5qp/yESNQfxiUoFBY+o0SMpp6I2hUrgnQBN8tDzGHDz2 UfdxDUsej2JweiElemEAukzk/LyKjCikCmUxOirbWeLMaAk7sNQtuYjA4WbM+pKOhfJc VjX8gJ6xOCobGMx0LCjsfWfgqjbhcNx7sDHrJ/iDLmM9exRpIV1/v27yKmxku8fKckQj h133ZY3XiyT+Gf5YB02dKn8mPEWGMrc52E0EdYeYxbZUajoU1kOmh3SnztC60ooS1E7h PjQw== 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=h2L/JqMbyNus1hEDb2PS6+YbB4xyOWEm5Y//U2coDmo=; b=G7ayQyRmv7mjRWbtaSsA/eiy4aNG7W63RPQodtjctMu/suvETvpyCR3DCwOHEWbvZ2 R5fdE1ZiuNaNR472E0XPhMTHyIXe+6WCZ9iEGlmn8qXKlO9kXWWevdLdHwOM75QKL1vZ nd6Kq0/lQkEeOkZYee8FeboQ4MyHOsNFtjtBLsGoazaYMA+EjosTORG4sYeWOHdQG5Ae Zl851BmhpXpTd+oIzzAtRvs14wfEo75wJP22Azbzk1Zaf1BbHJRQsLc5O0P7sKvfy+F/ v1PCmz15mmK/9Ybq2w1A8s1brv+4IMN2hr1U25z18G1OSYiEd6Nd+ErikbZMC8iKVUMc kuIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=QZTpAuCP; 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 f76si9843302ita.144.2017.07.17.06.09.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jul 2017 06:09:41 -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=QZTpAuCP; 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 1dX5l4-0005J9-Ta; Mon, 17 Jul 2017 13:08:18 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dX5l3-0005G8-HJ for xen-devel@lists.xenproject.org; Mon, 17 Jul 2017 13:08:17 +0000 Received: from [85.158.137.68] by server-7.bemta-3.messagelabs.com id D5/8F-02177-0C6BC695; Mon, 17 Jul 2017 13:08:16 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrCIsWRWlGSWpSXmKPExsXiVRuso3tgW06 kwYdZjBbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8ako6uZCs4qVLTf/snewDhLsouRi0NIYAaj xK5jB1hBHBaBecwSF1f/ZAJxJAT6WSWm/Wxi7GLkBHLSJK523GCGsKslXj6cyQZiCwloSRw9N ZsVwm5lkrh5SamLkYODTcBEYlaHBEhYREBJ4t6qyWAzmQXmM0o0TeplA6kRFoiR2HvbB6SGRU BVovflLCYQm1fAR+LWlkYmiFVyEjfPdYKt5QSKn9mwmglilbfEzSMTmSYwCixgZFjFqF6cWlS WWqRrqpdUlJmeUZKbmJmja2hgrJebWlycmJ6ak5hUrJecn7uJERhW9QwMjDsYL391OsQoycGk JMp7kS07UogvKT+lMiOxOCO+qDQntfgQowwHh5IE7+atOZFCgkWp6akVaZk5wACHSUtw8CiJ8 FaDpHmLCxJzizPTIVKnGI05Jh3Y/oWJ49WE/9+YhFjy8vNSpcR5V4CUCoCUZpTmwQ2CRd4lRl kpYV5GBgYGIZ6C1KLczBJU+VeM4hyMSsK8y0Gm8GTmlcDtewV0ChPQKcK+YKeUJCKkpBoYN4u sVJxnt7TD/67n61a1u/f4fU4e8nh4ovTN9zJnpbnvzgUKrm55L3a0fIHnX52cm4mGx27OSL51 ms/D8kJX7HnHb8dTjCVuhhX21x+/X+Elm7OF85t7nOJJtQ9l5ziXHgpJ6L2yfpp8VsC2xNraU w/YXRtcZqz8LVObeuTghLAPidF3e2T2KrEUZyQaajEXFScCAPtvd7S3AgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-7.tower-31.messagelabs.com!1500296894!98249672!1 X-Originating-IP: [74.125.83.44] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 46890 invoked from network); 17 Jul 2017 13:08:15 -0000 Received: from mail-pg0-f44.google.com (HELO mail-pg0-f44.google.com) (74.125.83.44) by server-7.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 17 Jul 2017 13:08:15 -0000 Received: by mail-pg0-f44.google.com with SMTP id k14so79618485pgr.0 for ; Mon, 17 Jul 2017 06:08: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=qeIH6mri6baDhY7Yk2iqtbCBeVmFW4zSmk2Zg4YVBBo=; b=QZTpAuCP6HOB2sRTkEia8Q1Fpj1l/bcxdXezYnbhJ5AFXtknA4SFUkogFI9cki4buu QwN0vbEH6HxKR8VcflSfHJi+B6ZPF7+8IaBqOoyCnFiDsGi2XSJrrYWf7JrWUx4Nt3Po Cg9vceEVahWXXxIuWSso8d/NdGZqDSaz+aPjQ= 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=qeIH6mri6baDhY7Yk2iqtbCBeVmFW4zSmk2Zg4YVBBo=; b=XY5UF0YXCX/O9W93fEuPtFlmeqEYIhrLxaWBUbjK6ej1lKyQimqtbX+h5kwTT6qqPk JjA8MpuUPeF3U45p6YPQnqPTL84q+udmUhC7ScNvRQsbMLpiR70FqUQ65oBL/BrW+pwL XPPeGkyCELLWWoECYQtRZChDqTObNJxWxO9kTY+dmTYyc98NO7n3YIF1gzcuU4oGCBDa TZuSzX+ZL2DbiGoSOMNZavoZp3PpXzy10NYFu8pEYOeQ9hWbLRsXIkt4oVo0qqHI/LB+ 7D7+YocO9EnRwkCIa48hwW/t3hifbpm+6EFK0rxEU5b6i58Nds8sNaALAxoPgSHbgWrV Qodw== X-Gm-Message-State: AIVw11059zBYJUpxlskfSmAtoHIHhXwR680UeZLfOU7hWqgGvqVgzXll 0GQQ3yyTRWvye4gtXdLD9w== X-Received: by 10.99.97.212 with SMTP id v203mr14884576pgb.188.1500296894198; Mon, 17 Jul 2017 06:08:14 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com ([103.5.19.18]) by smtp.gmail.com with ESMTPSA id z69sm15705665pgz.42.2017.07.17.06.08.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Jul 2017 06:08:13 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 17 Jul 2017 18:36:54 +0530 Message-Id: <1500296815-10243-25-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1500296815-10243-1-git-send-email-bhupinder.thakur@linaro.org> References: <1500296815-10243-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 24/25 v6] 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 e3e5791..9eee50c 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) );