From patchwork Thu Oct 15 04:25:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 317755 Delivered-To: patch@linaro.org Received: by 2002:a92:d603:0:0:0:0:0 with SMTP id w3csp122889ilm; Wed, 14 Oct 2020 21:26:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxv6xLakUidFUTITFRyXKUKQBeikGzEAR804eDpCZ43vzGH6TzVqF16AowykZ5wDdBckZ6K X-Received: by 2002:aa7:c7c2:: with SMTP id o2mr2428162eds.366.1602735990366; Wed, 14 Oct 2020 21:26:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602735990; cv=none; d=google.com; s=arc-20160816; b=h/b86G2eRw9oLutvOv60gA5IrYN8vflbvqwW57k2gu75LVlukQI4eWV1MaAHI/rvlP eHvbI1S0+jlXs6r+33rKsX57QUqPFc7lqE2ceDeXfjSaHRQDd+ZdSeqzqyVIUHZGfQTl GaMKgx2ARGLwg7z5g9pfGE7nSwhZP3LgPJmwiAv33xCsAFGvX7CRXoz3/S6vSRmVqu87 B6GsX8u5IB4co6FdweCqiQSpuFlf+bzZIXCGCy7dM7mQBQ/WEq/F1qOe44HR57GDRthi Zityv6nZIW4CHN6UsYXkd8g1hfg9reTp144BooALH8W9UbYtnnirF0RasGlhGrfzLp/U IwOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=n6zhHXf14PTvan9difWQHk+Wdx9Y8KOQYIWTF+AlerE=; b=rj9lWrRL+Z1B3AwXsmROeg03Zj2NgwwIpDy5vY/2Krs89kwwnkrX1z+4n9dUxIAQsi Nf9nfjx2Bkyg815MQadUN6XOebus0iAUslmB4dldYpKOBZ14rotoTfOyGDuZgWZ/FSTP dy1b2dcehg5WQeIHrK2MWoriEtrZB/DBX5Hxz183LjU2DqWLAbn+QvAtt+0JEWkdJxSj KAg5z3GTv2ji0jbPlsDZSyA1wSzAgUwaFaaUeamiMNzrDbBMVXqhPNjhQebosd6DdJM+ ZYXOhSnRACjruhk6Ghc58u7NPD5crakhFZC1jJSPDIhyaQQZCW/QF3uaPPjP23AJCCH5 YEOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Do0tpheU; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id w7si1229269ejf.3.2020.10.14.21.26.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Oct 2020 21:26:30 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Do0tpheU; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B3EFA823DD; Thu, 15 Oct 2020 06:25:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Do0tpheU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4AAF7823DE; Thu, 15 Oct 2020 06:25:55 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A0796823C9 for ; Thu, 15 Oct 2020 06:25:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pj1-x1042.google.com with SMTP id a1so1140027pjd.1 for ; Wed, 14 Oct 2020 21:25:52 -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 :mime-version:content-transfer-encoding; bh=n6zhHXf14PTvan9difWQHk+Wdx9Y8KOQYIWTF+AlerE=; b=Do0tpheU/ninx8JAbGXgis0Lk2mtlAc7/565xupclnCvPYRfwx+m+U/GkB0u10VqjS 8DSf288GvVMQXgEX7Noh21qDsE/0eCG7gn+tqlGda6DeNM/bgmL+QB8NaEsPWbN11nIj Xi9o91lOBCt7kSzK4Mbm7FHf1yWKdQ/gvb3h9tB6XpRG/TX4frIJ6xB/XIEQceE2QVX4 j2kr50JaI4hb5nKBW5IDwpbfYy9KbB0PPNFpn0Eh1ykObmar5wnrzjw+ucBrbgk1ElG+ pF8KMBHH/mT/Rw0fLS+ll/8Wh/ufwmZCnxjPzh2mpdirFUYWT1eAbN/bzGoRAIVb6HZ9 H2cQ== 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:mime-version:content-transfer-encoding; bh=n6zhHXf14PTvan9difWQHk+Wdx9Y8KOQYIWTF+AlerE=; b=Vqp3Yo8+blEsKPUrBq9YlHURl8ii5xrYiE1oJ4FSlf3B6aUM4AVihH16kXGrkMmZIr 2x+pGgNzZjjXrRt3KckcEHOVRkbXoe8J9AMJZvyw2/Zz3cNFrY0eeIcq8aQYI7zbZN9z LTvNvP9JKNrx3tnTQjhI1qC3f/pGiic+uPMI6+9AjpL/he8itRSgckZKw+HSzrIUBGKH BVgyThKL1ElK2S6/kaaZ367flMtMuxgjXn6RvyRurwT1j9IU2YjPY0/0gnyCJBN5ojQ8 EIXIoJlzW3cQJiRE9tSNtD7bUopJ99Hm3omz5vYv8y21HLhYlTk99Mn1qWtPHwgi9zXu nkmA== X-Gm-Message-State: AOAM531Napk2Ixxff/3pD+yCR2f1FlSaKurVbvXiu2vi6uvSqm8cZ+LK cEg8xiKCdIiKRqoC5O/aEbTMcw== X-Received: by 2002:a17:90a:d341:: with SMTP id i1mr2575862pjx.18.1602735951197; Wed, 14 Oct 2020 21:25:51 -0700 (PDT) Received: from localhost.localdomain (p784a66b9.tkyea130.ap.so-net.ne.jp. [120.74.102.185]) by smtp.gmail.com with ESMTPSA id w17sm1306489pga.16.2020.10.14.21.25.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Oct 2020 21:25:50 -0700 (PDT) From: AKASHI Takahiro To: anastasiia_lukianenko@epam.com, oleksandr_andrushchenko@epam.com Cc: u-boot@lists.denx.de, AKASHI Takahiro Subject: [PATCH 4/4] serial: serial_xen: add DEBUG_UART support Date: Thu, 15 Oct 2020 13:25:16 +0900 Message-Id: <20201015042516.41197-5-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201015042516.41197-1-takahiro.akashi@linaro.org> References: <20201015042516.41197-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean By using a hypervisor call, we can implement DEBUG_UART on xen. This will allow us to see messages even earlier than serial_init(). Signed-off-by: AKASHI Takahiro --- drivers/serial/Kconfig | 14 +++++++++++--- drivers/serial/serial_xen.c | 20 ++++++++++++++++++++ 2 files changed, 31 insertions(+), 3 deletions(-) -- 2.28.0 diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index e344677f91f6..536cf0641773 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -401,11 +401,19 @@ config DEBUG_UART_MTK driver will be available until the real driver model serial is running. +config DEBUG_UART_XEN + bool "XEN Hypervisor Console" + depends on XEN_SERIAL + help + Select this to enable a debug UART using the serial_xen driver. You + will not have to provide any parameters to make this work. The driver + will be available until the real driver-model serial is running. + endchoice config DEBUG_UART_BASE hex "Base address of UART" - depends on DEBUG_UART + depends on DEBUG_UART && !DEBUG_UART_XEN default 0 if DEBUG_UART_SANDBOX help This is the base address of your UART for memory-mapped UARTs. @@ -415,7 +423,7 @@ config DEBUG_UART_BASE config DEBUG_UART_CLOCK int "UART input clock" - depends on DEBUG_UART + depends on DEBUG_UART && !DEBUG_UART_XEN default 0 if DEBUG_UART_SANDBOX help The UART input clock determines the speed of the internal UART @@ -427,7 +435,7 @@ config DEBUG_UART_CLOCK config DEBUG_UART_SHIFT int "UART register shift" - depends on DEBUG_UART + depends on DEBUG_UART && !DEBUG_UART_XEN default 0 if DEBUG_UART help Some UARTs (notably ns16550) support different register layouts diff --git a/drivers/serial/serial_xen.c b/drivers/serial/serial_xen.c index ed191829f059..34c90ece40fc 100644 --- a/drivers/serial/serial_xen.c +++ b/drivers/serial/serial_xen.c @@ -5,6 +5,7 @@ */ #include #include +#include #include #include #include @@ -15,11 +16,14 @@ #include #include +#include #include #include #include #include +#include + DECLARE_GLOBAL_DATA_PTR; u32 console_evtchn; @@ -178,3 +182,19 @@ U_BOOT_DRIVER(serial_xen) = { .flags = DM_FLAG_PRE_RELOC, }; +#if defined(CONFIG_DEBUG_UART_XEN) +static inline void _debug_uart_init(void) {} + +static inline void _debug_uart_putc(int c) +{ +#if CONFIG_IS_ENABLED(ARM) + xen_debug_putc(c); +#else + /* the type cast should work on LE only */ + HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch); +#endif +} + +DEBUG_UART_FUNCS + +#endif