From nobody Mon Dec 15 21:31:17 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1749829770; cv=none; d=zohomail.com; s=zohoarc; b=GAG9EvZpjXTr6M+eQHAhY4T2E+2UhTyyIF8983jtk7gZew6zapWZX5rSoW/54V0K1ZuAxPiNvptMnQwve8w+ND2joAQdz6JKtjdLre+QBVvTH744pC4ypzg0cxxS0grI95odv//s6j29euZumco3jsW9F1FPoXJTBiA+WiAufbw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749829770; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=c5Lkbfnvd1QCDHpROG9OH/otgdh2NEdBGe+vvJ9B82I=; b=PkyF9m6n+ja1xhE7xfPll+lGVAEZEoBNwlUcSqwU/+qkDcV2++a2ft3HdGIsQd2xGvKRozIF47HRLfRODxYuRCMBEg/1iFAa2YSWGQIMWPBQw8fEf3NuBkg6T1kzlcs+TEwGXrbhVhmLT6RyeDeFP2FBrQPs3jZEMbD3lnlvDvA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1749829770704132.92746804973035; Fri, 13 Jun 2025 08:49:30 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1014638.1392816 (Exim 4.92) (envelope-from ) id 1uQ6eW-0000qp-SS; Fri, 13 Jun 2025 15:49:12 +0000 Received: by outflank-mailman (output) from mailman id 1014638.1392816; Fri, 13 Jun 2025 15:49:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uQ6eW-0000op-KB; Fri, 13 Jun 2025 15:49:12 +0000 Received: by outflank-mailman (input) for mailman id 1014638; Fri, 13 Jun 2025 15:49:10 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uQ6eU-0006cn-Mu for xen-devel@lists.xenproject.org; Fri, 13 Jun 2025 15:49:10 +0000 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [2a00:1450:4864:20::62a]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id f16b4efe-486d-11f0-b894-0df219b8e170; Fri, 13 Jun 2025 17:49:08 +0200 (CEST) Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-ad56cbc7b07so333047666b.0 for ; Fri, 13 Jun 2025 08:49:08 -0700 (PDT) Received: from fedora.. (user-109-243-64-38.play-internet.pl. [109.243.64.38]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-adec8979563sm144821766b.158.2025.06.13.08.49.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jun 2025 08:49:07 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: f16b4efe-486d-11f0-b894-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749829748; x=1750434548; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=c5Lkbfnvd1QCDHpROG9OH/otgdh2NEdBGe+vvJ9B82I=; b=RH39gf91ScptKdVXhMs/cSuMdSwsZjaeuaUhGzFbiVftV7BgncT20yBp3BQNsLTV5T oRB5FaGf5RM+PstmdZu4X4umrReWdL68TlrkwBb4XdiTu9HibJ/Y+qZdixOu5/CbKmDu HGmkBIYugV4OcivTzKZbYMGrikwEKzsO3doKIdgU3g2p1vMRMcWeTIKZRR7Y7j6QQtAj rw95i13NQjps+HFV0TFMEgbfhI/FgFzJrPeU+0yFZ/llqixf9zVr4pyig+oMq/w2w1Kn Hb4+j/3Efh2D6ITjHNPaFrCq0bGCJhmz+MzYuefs7jURxVL6gFZnwreILaLw+sVZaS9J q/eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749829748; x=1750434548; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=c5Lkbfnvd1QCDHpROG9OH/otgdh2NEdBGe+vvJ9B82I=; b=H5oFYSMCN9jAyJd+0aefTEOW+YxjbJ7zid6/NoWusHNQm7odcDwJsw2/RQikCnMjA3 z38RGXKsA3Cy/QHJM9HKXULApT/KXmUeJ5Xs/4LGtorBIsEvdI89OmZV+ad3m5lhFuyV K79p9cFa+Q32tX3W+0TdNfuCO1p2MYcY4SoA3oXrmqba5nKb7PQ514eeAS51/a10gVV2 NSM3xbNrSq31dZYNGuIh/kwOdcJ0PCLjALL5yUy5PLjDvk8xna/8uKCmc4jiBVYfbJlN qxpqikfz2qosOGRp5Lu0JTm4VqoXcItLhIwNLYgJeh+ZxkknHeLutswcPaXy/K+Zyr06 i5lg== X-Gm-Message-State: AOJu0Yx12Z+FCJIV8H95UXIyliU5o5OEbqYhjdEC2hJTfE23KFYDm/ZU Kj0XIg0jcWhOSm01mour1ktjrJyAQOkXrCYLGVb69o56bX7kFj4ARIfSaMkvMg== X-Gm-Gg: ASbGncs26o/xLEv1pbCE+oBNpOljwMCF5YoLoZtsL87+0Lz38ciqKWimlwkNs+E130k hidDJ5jOEjpaJMFrHjZiUCWs5p9pCnNb03v2jbkhiRVbLFadM3W9Kg1Lfba5qvGf6kBA37Q2xPb YWCsPRmOxUFaxMChhJ7ZFQg+iY1SOmqvDVMFuuklZVjhNn8NJ4u+5s6zc8uIbHCbwqLosRAbN2O pMF4JhXXvatVBm5eizfGXYh613ebsp1A6UohQ2ywNgZogHmV/xDjtnfWQLZNw0Ybflm4Oe+9r1j Ga/lNqdZVmQYkbBKVQgtaARhTMli1w56UN5OAOR1+G21IjB+1bHxsRBeuzBruY1e/jXIwW4KvaI QoBHCIxeyo6jV3qNELyZLUs/qMnhZ X-Google-Smtp-Source: AGHT+IF4HdQ4K6/e1c/Kjg77Lf3UA4pI1sMICe8tX4U+SECyg2QF9kkXnhTQ5AC2l5A/KM2+pPXYzg== X-Received: by 2002:a17:906:c106:b0:add:ee2c:7313 with SMTP id a640c23a62f3a-adec55a7a66mr346620266b.22.1749829747753; Fri, 13 Jun 2025 08:49:07 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Alistair Francis , Bob Eshleman , Connor Davis , Andrew Cooper , Anthony PERARD , Michal Orzel , Jan Beulich , Julien Grall , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Stefano Stabellini Subject: [PATCH v5 9/9] xen/riscv: add basic UART support Date: Fri, 13 Jun 2025 17:48:48 +0200 Message-ID: X-Mailer: git-send-email 2.49.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1749829771495116600 Content-Type: text/plain; charset="utf-8" Update Kconfig to select GENERIC_UART_INIT for basic UART init ( find a dt = node and call device specific device_init() ). Drop `default n if RISCV` statement for config HAS_NS16550 as now ns16550 is ready to be compiled and used by RISC-V. Also, make the config user selecta= ble for everyone except X86. Initialize a minimal amount of stuff to have UART and Xen console: - Initialize uart by calling uart_init(). - Initialize Xen console by calling console_init_{pre,post}irq(). - Initialize timer and its internal lists which are used by init_timer() which is called by ns16550_init_postirq(); otherwise "Unhandled exception: Store/AMO Page Fault" occurs. - Enable local interrupt to recieve an input from UART Signed-off-by: Oleksii Kurochko Acked-by: Jan Beulich --- Changes in V4-V5: - Nothing changed. Only rebase. --- Changes in v3: - Drop inclusion of as nothing in setup.c requires it. - Add Acked-by: Jan Beulich . --- Changes in v2: - Drop #include in setup.c, isn't needed anymore. - Drop call of percpu_init_areas() as it was needed when I used polling mode for UART, for this case percpu is used to receive serial port info: struct serial_port *port =3D this_cpu(poll_port); So percpu isn't really needed at the current development state. - Make HAS_NS16550 user selectable for everyone, except X86. - Update the commit message. --- xen/arch/riscv/Kconfig | 1 + xen/arch/riscv/setup.c | 12 ++++++++++++ xen/drivers/char/Kconfig | 3 +-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/xen/arch/riscv/Kconfig b/xen/arch/riscv/Kconfig index 62c5b7ba34..96bef90751 100644 --- a/xen/arch/riscv/Kconfig +++ b/xen/arch/riscv/Kconfig @@ -2,6 +2,7 @@ config RISCV def_bool y select FUNCTION_ALIGNMENT_16B select GENERIC_BUG_FRAME + select GENERIC_UART_INIT select HAS_DEVICE_TREE select HAS_PMAP select HAS_UBSAN diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c index 0e7398159c..a17096bf02 100644 --- a/xen/arch/riscv/setup.c +++ b/xen/arch/riscv/setup.c @@ -4,12 +4,15 @@ #include #include #include +#include #include #include #include #include +#include #include #include +#include #include #include =20 @@ -134,8 +137,17 @@ void __init noreturn start_xen(unsigned long bootcpu_i= d, =20 intc_preinit(); =20 + uart_init(); + console_init_preirq(); + intc_init(); =20 + timer_init(); + + local_irq_enable(); + + console_init_postirq(); + printk("All set up\n"); =20 machine_halt(); diff --git a/xen/drivers/char/Kconfig b/xen/drivers/char/Kconfig index e6e12bb413..8e49a52c73 100644 --- a/xen/drivers/char/Kconfig +++ b/xen/drivers/char/Kconfig @@ -2,8 +2,7 @@ config GENERIC_UART_INIT bool =20 config HAS_NS16550 - bool "NS16550 UART driver" if ARM - default n if RISCV + bool "NS16550 UART driver" if !X86 default y help This selects the 16550-series UART support. For most systems, say Y. --=20 2.49.0