[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/3] xen/arm64: add early printk for the classic i.MX UART


  • To: Wig Cheng <onlywig@xxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Mon, 17 Aug 2026 10:37:04 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gmail.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=i4+tSok4Pnje7Wo8DoBwkNvCvPh1TY4Of3DJzT7jiAE=; b=u1vhzmRc25IDMpzAi7ZZSI+D1iJzPdPfoK8CAwutTCaYJJHM/GnJI5CHZ83vonQcQvgQOnFaK3HApa3mORwbpRIZW9L2/D2B7YpiSZ9kCepiZ4vmR9GuNBH3oK8WxikUWQZpwLsbYv7S/WLWyfTLUuWj5Ar2QvQ+6bCL+wZSx0pjILWEkwXSllIKX9CnUOtxebaKvritG6VIMo85oBDtAlnTtQtVEmDhuDAGqipHMYxQRg9XOEaH1Me4BU/Bz7mIuh3yS9Gl74C4AtDSfK4/RVDgb5axGUuUl4ED9pjesdyMCr2bUdjeYOmvUAxZO95b/250ktLMuSBoHjOT7k0nzA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=De4xZ41pAxskTvd8zzrsfCjraSG44fNNFZRe6iLh7c8ixsSxFshWFbeO+7K3KBrkq+P7zcS/6s4/GQwEAY17SHEYyNgr+XHFTbQzAnWS4VBx+pQqIOqU+3mapeF7UujIuIcxd6rXJDJN8bbE9jdZQAgFEiqQEALWq8k1LL4WjG+KvWvHihkodFsURC97H5Fd11N9jS8ao0+9lob9al0ViWbNtuYq4hLKpyWBdSPddlXtZfSnQZobDylGZKQegiW/utGfulPvhwQJpb5/SPno7oZtHeT/YPbP2yhl9T6Og5jWI/x+VOiFnzH8EU1UonXVhAqvpILCUUtWh/t/Tai1Fw==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, John Ernberg <john.ernberg@xxxxxxxx>, Peng Fan <peng.fan@xxxxxxx>
  • Delivery-date: Mon, 17 Aug 2026 08:37:26 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 14-Aug-26 18:25, Wig Cheng wrote:
> Add an early printk implementation for the classic i.MX UART IP,
> selectable via EARLY_UART_CHOICE_IMX_UART.  The UART is expected to be
> fully initialized by the bootloader.
> 
> Signed-off-by: Wig Cheng <onlywig@xxxxxxxxx>
> ---
>  xen/arch/arm/Kconfig.debug            | 12 +++++++++
>  xen/arch/arm/arm64/debug-imx-uart.inc | 39 +++++++++++++++++++++++++++
>  2 files changed, 51 insertions(+)
>  create mode 100644 xen/arch/arm/arm64/debug-imx-uart.inc
> 
> diff --git a/xen/arch/arm/Kconfig.debug b/xen/arch/arm/Kconfig.debug
> index 5a03b220ac..63a34b813a 100644
> --- a/xen/arch/arm/Kconfig.debug
> +++ b/xen/arch/arm/Kconfig.debug
> @@ -44,6 +44,14 @@ choice
>                 Say Y here if you wish the early printk to direct their
>                 output to a i.MX LPUART.
>  
> +     config EARLY_UART_CHOICE_IMX_UART
> +             select EARLY_UART_IMX_UART
> +             depends on ARM_64
> +             bool "Early printk via i.MX UART"
> +             help
> +               Say Y here if you wish the early printk to direct their
> +               output to the classic i.MX UART (i.MX8M family).
> +
>       config EARLY_UART_CHOICE_LINFLEX
>               select EARLY_UART_LINFLEX
>               depends on ARM_64
> @@ -97,6 +105,9 @@ config EARLY_UART_EXYNOS4210
>  config EARLY_UART_IMX_LPUART
>       select EARLY_PRINTK
>       bool
> +config EARLY_UART_IMX_UART
> +     select EARLY_PRINTK
> +     bool
>  config EARLY_UART_LINFLEX
>       select EARLY_PRINTK
>       bool
> @@ -185,6 +196,7 @@ config EARLY_PRINTK_INC
>       default "debug-cadence.inc" if EARLY_UART_CADENCE
>       default "debug-exynos4210.inc" if EARLY_UART_EXYNOS4210
>       default "debug-imx-lpuart.inc" if EARLY_UART_IMX_LPUART
> +     default "debug-imx-uart.inc" if EARLY_UART_IMX_UART
>       default "debug-linflex.inc" if EARLY_UART_LINFLEX
>       default "debug-meson.inc" if EARLY_UART_MESON
>       default "debug-mvebu.inc" if EARLY_UART_MVEBU
> diff --git a/xen/arch/arm/arm64/debug-imx-uart.inc 
> b/xen/arch/arm/arm64/debug-imx-uart.inc
> new file mode 100644
> index 0000000000..80ac647f5e
> --- /dev/null
> +++ b/xen/arch/arm/arm64/debug-imx-uart.inc
> @@ -0,0 +1,39 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
> +/*
> + * xen/arch/arm/arm64/debug-imx-uart.inc
This can go stale. Please drop.

> + *
> + * Early printk for the classic i.MX UART IP (i.MX6/7/8M families).
Don't mention 6 and 7 in a arm64 driver.

> + * The UART is expected to be fully initialized by the bootloader.
> + *
> + * Copyright 2026 Open-EP (E-Paper) Community
> + */
> +
> +#include <asm/imx-uart.h>
This header contains non-asm compatible macros. Please fix.

> +
> +/*
> + * Wait for the UART to be ready to transmit
> + * xb: register which contains the UART base address
> + * c: scratch register
> + */
> +.macro early_uart_ready xb, c
> +1:
> +        ldr   w\c, [\xb, #UTS]        /* <- Test register */
> +        tst   w\c, #UTS_TXFULL        /* Check TX FIFO full bit */
> +        bne   1b                      /* Wait until there is room */
b.ne please

> +.endm
> +
> +/*
> + * UART transmit character
> + * xb: register which contains the UART base address
> + * wt: register which contains the character to transmit
> + */
> +.macro early_uart_transmit xb, wt
> +        str   \wt, [\xb, #URTX0]      /* -> Transmitter register */
> +.endm
> +
> +/*
> + * Local variables:
> + * mode: ASM
> + * indent-tabs-mode: nil
> + * End:
> + */

Other than that, it looks good.

~Michal




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.