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: 1382449 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=Do0tpheU; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CBbp05vcQz9sTL for ; Thu, 15 Oct 2020 15:26:32 +1100 (AEDT) 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-Google-Smtp-Source: ABdhPJyKF64afArYKPrO5pB6zv8jCkm6s7A9Tq8kjBErwPQHEkzDYaaorjhvyoUFV7hDmZK4IGS3LA== 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(-) 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