From nobody Mon Dec 15 18:19:19 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=1747843486; cv=none; d=zohomail.com; s=zohoarc; b=MHCVshzfHfpFbW/PCiw2YzuGEO80vvsoOK/KVZywevxv8gnrMsBHxKxULQ3yYwe8QngPPIMoMLVHLHuQ0NmUzYvIDDCiXE0xfmL1lNc918kMSGQL3yH4/5hRfDYZbtbRNlkciKeL7GD5Yi2mK6fuzP/uUhsD9wkMV/SZp1Z9Ua8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1747843486; 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=mnu64s57ZUL2GkbK8NSRVCu3wg1knPSgvCDSoN2TG7w=; b=XiuR62LmfpKEty9Ai3XwpW/RZCrNLknwnkm9wu+k2fvmgCZQCPnuNEodqtne3Sp9Smu8KME7R+rtShzpEsC6ftJXUFKc1YMCNf8xcf1zAtLcEGSRyzOweAucULCgqws1F0rybXdp+wXlJ32NVn91KT+1UgRWrL2vYqpt+I//kpo= 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 1747843486813896.5799862812202; Wed, 21 May 2025 09:04:46 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.992154.1376045 (Exim 4.92) (envelope-from ) id 1uHlvV-0007wS-GZ; Wed, 21 May 2025 16:04:17 +0000 Received: by outflank-mailman (output) from mailman id 992154.1376045; Wed, 21 May 2025 16:04:17 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uHlvV-0007uS-7r; Wed, 21 May 2025 16:04:17 +0000 Received: by outflank-mailman (input) for mailman id 992154; Wed, 21 May 2025 16:04:15 +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 1uHlvT-0004Wm-Qp for xen-devel@lists.xenproject.org; Wed, 21 May 2025 16:04:15 +0000 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [2a00:1450:4864:20::530]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 3d702837-365d-11f0-b892-0df219b8e170; Wed, 21 May 2025 18:04:14 +0200 (CEST) Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-601fb2b7884so5505590a12.2 for ; Wed, 21 May 2025 09:04:14 -0700 (PDT) Received: from fedora.. (user-109-243-64-38.play-internet.pl. [109.243.64.38]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6004d502736sm9152513a12.25.2025.05.21.09.04.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 May 2025 09:04:12 -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: 3d702837-365d-11f0-b892-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747843453; x=1748448253; 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=mnu64s57ZUL2GkbK8NSRVCu3wg1knPSgvCDSoN2TG7w=; b=c2ulDGUUJYxEIQfBuZbMGM5qTI6rinRZ49vUQOYujNqN9UQ1Yft+Nt0+Fs7C8wLJL7 d5ojoStVSqj08RS2QDpumvrBhEOcIcYR0CtC6eXfZJmDCipvk3H/dL+MKNfFyUKw6eOg u6Hp3VJtWfuokr7wE3K+yM9boAeGbJKTn+i222HiISw0y5TzFZNoNnd3YPOXEX/DYw77 U6hSLW2EaVxp3QhwYlEWWaWkXhbD3dBx8w2ySkue1sj+4RKbucn0xL4IUUyhzynYAz6d YpRA5C6aVWgsI9ABDviWgIeDQ/CYMyppCFXhP0CyiMgGDbG/OTj8wCQ5/esJo9/4QBiL dtpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747843453; x=1748448253; 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=mnu64s57ZUL2GkbK8NSRVCu3wg1knPSgvCDSoN2TG7w=; b=g2AeBNyWrC6sbz+HN6/KUknMrpPnRAiZRRTi5Q9xOqMhtCro6UsayVBrA7B3QQF6Qv 0AYwLwqpLMD0+2NEEM0h+zHh83PP4uqBMhkjc2eFLJ0+Nby4FO7bLWMMFYjvIWE6xTdh 6Zs9SKGz/h988SN10kMbR6KRNkeYctvPT5Lyjex93nSVHN9KteRI1VDlaK3VJvEVbNb9 zl/2TR0/mS3ANXj1p/A+a+wPZAju7Czm04wwtz5WMqZ6E6lDO41SxBYhX974UR/juFDj V0sX7vH8u+oskgd+bE1T83MwO+pfzvjn+kuSY25yCosRGNE2kGVteOrtK7kxzt5fimuo m/cQ== X-Gm-Message-State: AOJu0YxwYViVCW6ar9kGKD42ruqfmURTYPNTixGTG23K68oWAk2tXC4n 0KNWoJMvEaxL5iLaIWsI3JnRBxHmZMHXNuhq13LMa2QhKWHMmVa0Lv7cTJOYpA== X-Gm-Gg: ASbGncu2H5JxSG76Zi5ZilX/k3K2FhSzm2pl69VIxbh3a05ys7cjBFpxcTlWqDtHyq7 JrGq00MXb6Aewp3CtsmFAKUz2MP5qoOQPE7HYdEz8iJ+5EBRPDLcurM4tXOuqx9+3ZBn/FUGWzJ YmcZNAWB8VYaTsbNILL6EQX6styYOP8Gq6Rn0F8PiXiFjHDGTq1v5KLPtRj4oCCmWa3Cp8NLzGa ZKSBZaoZuAPVXseEIhBBxXsnVpopsRBkwm0Uc3KxHT9Ox1CWsUkgX2Q+VMIS4PoQZ40vr17HFf3 z+9GF/M0Y6q2/eu/EfX8ZYrqdaYnN49hkaQ2U/azvbv9pl0rQYB/ArN32WotsXqNnL22hbCsSky s8NCHedJzye93Zxsdjw== X-Google-Smtp-Source: AGHT+IGunMgZiri1Ev5kZ3w9ZTII3G+8c7DPfjfcl25jVSc2uIWoNuARjTbhoI0T2M9oflC+5lXPDg== X-Received: by 2002:a17:907:7da2:b0:ad2:2ef3:cc1b with SMTP id a640c23a62f3a-ad536b7bd28mr1899159666b.7.1747843453074; Wed, 21 May 2025 09:04:13 -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 v3 14/14] xen/riscv: add basic UART support Date: Wed, 21 May 2025 18:03:54 +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: 1747843487391116600 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 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