From nobody Fri Oct 31 04:14:26 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=1751878972; cv=none; d=zohomail.com; s=zohoarc; b=iBAJ4EpTxp5AN8lMSD9lwf87LufhMqEJ4JQKqfF8xAfjeto2BWp3+JU+wWwbz0y56apN/9VaW5c6gnO9P689XDg9t4p8JFzTbXPLFFAIVbHENuFsyzMmoIlopYWT2zeV1KcwyizFG8otRTN7VaiR737qzG4JP4EwWSLR6KTcIss= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751878972; 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=KgFU41UimQ/zZbHUJpWhEqNY3tBNxulYXPtHv+ceHlQ=; b=Pg5+soEYiup+6LqEe/FrlKFpLXxrHXju3haYzapqC4nrSmdPC7rkdZlR6FjFjYZO7LCqDUGH4FkMRDH7h6PJewjKlqMzRCRS9nLu7H8FRHgpT2TFVjPXvH/l9MboIpMlRqBiJN3Ait9Wn8zvwCUltf0U3AO9rHC4UY690HIhmKc= 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 1751878972913357.43219208295864; Mon, 7 Jul 2025 02:02:52 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1035348.1407639 (Exim 4.92) (envelope-from ) id 1uYhjk-0003yF-V7; Mon, 07 Jul 2025 09:02:08 +0000 Received: by outflank-mailman (output) from mailman id 1035348.1407639; Mon, 07 Jul 2025 09:02:08 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uYhjk-0003xz-QH; Mon, 07 Jul 2025 09:02:08 +0000 Received: by outflank-mailman (input) for mailman id 1035348; Mon, 07 Jul 2025 09:02:07 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uYhjj-0002Us-4B for xen-devel@lists.xenproject.org; Mon, 07 Jul 2025 09:02:07 +0000 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [2a00:1450:4864:20::62c]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 0e762611-5b11-11f0-a316-13f23c93f187; Mon, 07 Jul 2025 11:02:06 +0200 (CEST) Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-ae401ebcbc4so449759966b.1 for ; Mon, 07 Jul 2025 02:02:06 -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-ae3f6b04d30sm662892766b.133.2025.07.07.02.02.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Jul 2025 02:02:04 -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: 0e762611-5b11-11f0-a316-13f23c93f187 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1751878926; x=1752483726; 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=KgFU41UimQ/zZbHUJpWhEqNY3tBNxulYXPtHv+ceHlQ=; b=KJqj19P9TwbEjKyoEO7rgzcsAnfpVULAjm7/0kmwV5UihEh1UXpI58PltHVycdIQOc nvk733oV/Luq0w+g56v0G/YHxfR5ohpzEZ2pTSQnPWl6lRrpWOkjmmcXXIQE0+tMln7u c5iH9/S4kmWh8fBm7WZH/Djb3gd5kZ6dGJB2/hcM31y1UgmCz43X9eVmUPGxz/29hszm W9yYFlWEqzfg9mmYx5+9lVywlBw4jEpd/ZwTtQ0YR9U3XyMDTKOzjmz+VU0O3BGiHuJx Vtq/BTA2tXv6uHREg2RIWvD8w9lnaF5sex1FeQaV3GLD47pWkeml3/BBH8fxCdfaO00i Wu1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751878926; x=1752483726; 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=KgFU41UimQ/zZbHUJpWhEqNY3tBNxulYXPtHv+ceHlQ=; b=Nvq01sIunKuk9KTITDqDjNRzBv886GjbEjebSqfjklF0bX2VqtKgx358aFbznorqgH 7RH7771m9ZjubzDS4ISY5ABQfnpcBLoCgjfwLQ691Y34B8TfxzCrBBeVC2wW1mUKTQck TxIAqn4c7DcPV/bnfOqIpPhIT6y5Zpjjwp1DIim2GIPtGSZWe8YfJIEc6649WdBWPwJJ Zt6YTDP0F/cEzXFy7MeH2m5fAvoWdNg+2czyGvH1K0YCQG5bgtgdt7h2wQ0KGxRXwXsS 2sEjhnOFQ+zo+zqC85bABjZLrbATN2Tzqss53KEtlE3WR5wG7JeQvJAWP6acmrLdBbCS 5U2Q== X-Gm-Message-State: AOJu0YxDkXKVg+GoLLR3VoV2k2aNqqGQHwlAObQj7Qx6wK4kTny2D93G h/oEDMtVMTXaEI41bYuQDSowD+JRdOoRt7WLVdwTac/UzRrKnkvqDLkoKNJyuw== X-Gm-Gg: ASbGnctu8nnszazJpRDfqL3qdb4veSgOEIOgdy7arjVcrNWEdrTlx+Bs1NQC90pc4MZ r1k7bTdI0ovHV+lA6pLEOzX2IVObjXMLT9URuXGPvnzoobTYXvfl4DWLxP3Diw15gUFeONCUYrl 3WPMkL7GXUkYqB/q6vdiTYpVbC24roQZQoMcmTvobcdTxL6BHC1sics4C56SwCrvmtBla6qA6k4 48tvEd//BYQOcuhybgnz01/e/EzYaBTLeXrYpHSYmOlTQJoJ+3kBVXAwHiwZhWzsAtCcqeXtpWI lUrGUY///DQOJp70XuguRheddd1jPwc3yYaFm4aLZ71L6XSruppcp0BDmrkzJrDWMoxvlCXpmC+ U1oO27LUdP41lYM5JrI4FyiCP8Q== X-Google-Smtp-Source: AGHT+IHI9D2VTZIG6GSmhmQ6N2OOyfKfRCCQz5e8giCisFysulvITfgZukuH5bZ7YfRAK+xBLwfBkQ== X-Received: by 2002:a17:906:9fd2:b0:ae3:6ff6:1aad with SMTP id a640c23a62f3a-ae4108e5ee0mr708659466b.14.1751878925298; Mon, 07 Jul 2025 02:02:05 -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 v6 7/7] xen/riscv: add basic UART support Date: Mon, 7 Jul 2025 11:01:43 +0200 Message-ID: <946f390b54c4ac9ce64860236565857d105da54e.1751876912.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.50.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1751878973852116600 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-V6: - 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.50.0