From nobody Fri Oct 31 04:06: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=1750749562; cv=none; d=zohomail.com; s=zohoarc; b=A5+UbK1QudcWNzbEO4Q/aZ34+TK/RNGe5QEjpEliyLGdPJEFgq/Vxinh81vE+enVdUAhkd3wNUwEKZiXi2qtd/u6i2XV5yXj/Tl2HGh8yzm+L0OHqRyQPl9seJRshowNOo6eU0PEvKKqg1rAjowqlzQNuGkTrY1p2MHdRanQElI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750749562; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=LXYC7VlKvFyK65wnrApO7g7blDDOmo+NPeKeGgJUPGo=; b=T0QmwXlhBnnrBSPrRrVYo0DnPspB5dls1cRUdY5nbJCbznwG/P+cm9hP6XTGa/tJLoe1/oLFPm7tBNVIc/PxVeBHKqC+cnVJcEV6+5XsgqTlxjMMDo68uEL+8YJ1CkyrbIdsSmM249qJDYesca4fjQmUYwzytNe8xBcoQPdXtH8= 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 1750749562810626.6778723301554; Tue, 24 Jun 2025 00:19:22 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1023179.1399105 (Exim 4.92) (envelope-from ) id 1uTxvw-00088s-Tm; Tue, 24 Jun 2025 07:19:08 +0000 Received: by outflank-mailman (output) from mailman id 1023179.1399105; Tue, 24 Jun 2025 07:19: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 1uTxvw-00088l-PC; Tue, 24 Jun 2025 07:19:08 +0000 Received: by outflank-mailman (input) for mailman id 1023179; Tue, 24 Jun 2025 07:19: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 1uTxvv-00088f-NX for xen-devel@lists.xenproject.org; Tue, 24 Jun 2025 07:19:07 +0000 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [2a00:1450:4864:20::136]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 82968876-50cb-11f0-a30f-13f23c93f187; Tue, 24 Jun 2025 09:19:04 +0200 (CEST) Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-553ba7f11cbso112460e87.1 for ; Tue, 24 Jun 2025 00:19:04 -0700 (PDT) Received: from yp-VivoBook-ASUSLaptop-M1503QA-M1503QA.. ([95.67.15.120]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-553e41c301esm1713392e87.143.2025.06.24.00.19.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Jun 2025 00:19:03 -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: 82968876-50cb-11f0-a30f-13f23c93f187 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1750749544; x=1751354344; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=LXYC7VlKvFyK65wnrApO7g7blDDOmo+NPeKeGgJUPGo=; b=W3RUm1EvZtOkibcHR/8KRq8sSeq4SmxIjUZULPcRWVMWfC8ajdLkDFoqfnDHQtWC60 dM+IGRBcX8MdnR1YDUrec+OfQCRssaF65iIE2FN7w8ZbmJF48pufMqr031oQJ96nvcpa 3a0ODyNrD9FVgluSFnj6XDVLa9L08YI04zutcJQzhviuXd8TmC1LpwWZarpXGzvTZfvq JjTqF6tGYYaxKdE1o2WHSSrsPbI2DZhUORyB97FehW6EOfUJir9nmAFHApRjYqODSCGd Q29/491Mppxc04kTWv3QkXkgiQDjR4SVF6iGUHW8Ub5+VXqlWY2ALOwSZWH+ZiFKLvnH 5v3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750749544; x=1751354344; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=LXYC7VlKvFyK65wnrApO7g7blDDOmo+NPeKeGgJUPGo=; b=M7qQdntocf3ejiLGckaru3yhUpHM9p9BgHW0Wh2FGMxuGHxlmlaYnPzH6drAEfAiNs dO3AmUz2W9I6f1XcvdbmNz4z0jW0sels9oQZexkAH6u7b5+fQOh7hzDUOt8A76+22o3c iqIG9Ry6gQHC5/NLuKNQNmSPH/kojzlPlSz9EFsy7txbUHGgbCAYhHBZ8UPSF6KfwA2s uuJcIyjm6HRPKd9uipBA39+EM+Oo76rkGZMvzoqXhrWDOZEIjJwtM7Tx6Uz9oWPdaM6O Zv3CPlHFkPtuyg5LvUXz8S8dgaoceUHYq+g+Igpj0aU3/8/T/rx8CfTv++q41zfPsTK1 hezQ== X-Gm-Message-State: AOJu0YyIdKRYmHnB/iF9EUVLF7t/pYx5Z2uBHDp6eq//Wy/Av00m08Nb oZNfBWc9EWpIRMzUM4UCiBclcNb/o9DZcAQF6xRqXlOTm6XF74z/FAjNHYctV06GZao= X-Gm-Gg: ASbGncshFkGDEDZxlAZuzRd/ri96cxIaP9TFGamohaOFxMsJzFmBJXMzkO68GzbqR2d UB9QyWfZnpEcnBFLIzAy80Cqw47ICY5JcHvDxCHBDUsp5wxBx0imQUPGJi7QOYhBWdObSDO2boP FXhEAUB97Eq2W5rT15qyv8MAHw0KVrb9kisqtwmDhoGbw39+/CwI2sz9839bZxQW/u12jWC5Wqb ivaIs1rf2HjbcnSlVqHfD4ZdzsAuqtfjY6DVzGUSi3JwoztdvKugWbngfhMGEfGHuRdAaUeY0k+ k2ozBoTZSOWueYr4BwtspdUXTLknSwOdDkiS9a5wyzD0gYmNI7Hw1q/KGvWuOYKm4WFomcWfdi7 GD3m+KIZIY70Fu9xQ6TYDh4qHQg== X-Google-Smtp-Source: AGHT+IGa4Au9bIHRjI28POgwOAtq9JiCYwQiOMBbK1EpfFlaP4s3Aovcoamq2nQ/Phr0HY5Pc+OOlA== X-Received: by 2002:a05:6512:224a:b0:553:ad9b:cfb1 with SMTP id 2adb3069b0e04-553e3b9a36fmr4461062e87.9.1750749543739; Tue, 24 Jun 2025 00:19:03 -0700 (PDT) From: Mykola Kvach To: xen-devel@lists.xenproject.org Cc: Volodymyr Babchuk , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Oleksandr Andrushchenko , Mykola Kvach Subject: [PATCH v4] xen/char: implement suspend/resume calls for SCIF driver Date: Tue, 24 Jun 2025 10:18:56 +0300 Message-ID: <5449d6fc4a6e47af173d9e2b285f1e3398de98a3.1750749332.git.mykola_kvach@epam.com> X-Mailer: git-send-email 2.48.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1750749564402116600 Content-Type: text/plain; charset="utf-8" From: Volodymyr Babchuk Implement suspend and resume callbacks for the SCIF UART driver, enabled when CONFIG_SYSTEM_SUSPEND is set. This allows proper handling of UART state across system suspend/resume cycles. Tested on Renesas R-Car H3 Starter Kit. Signed-off-by: Volodymyr Babchuk Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Mykola Kvach --- In patch v2, I just added a CONFIG_SYSTEM_SUSPEND check around the suspend/resume functions in the SCIF driver. In patch v4, enhance commit message, no functional changes --- xen/drivers/char/scif-uart.c | 40 ++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/xen/drivers/char/scif-uart.c b/xen/drivers/char/scif-uart.c index 757793ca45..888821a3b8 100644 --- a/xen/drivers/char/scif-uart.c +++ b/xen/drivers/char/scif-uart.c @@ -139,9 +139,8 @@ static void scif_uart_interrupt(int irq, void *data) } } =20 -static void __init scif_uart_init_preirq(struct serial_port *port) +static void scif_uart_disable(struct scif_uart *uart) { - struct scif_uart *uart =3D port->uart; const struct port_params *params =3D uart->params; =20 /* @@ -155,6 +154,14 @@ static void __init scif_uart_init_preirq(struct serial= _port *port) =20 /* Reset TX/RX FIFOs */ scif_writew(uart, SCIF_SCFCR, SCFCR_RFRST | SCFCR_TFRST); +} + +static void scif_uart_init_preirq(struct serial_port *port) +{ + struct scif_uart *uart =3D port->uart; + const struct port_params *params =3D uart->params; + + scif_uart_disable(uart); =20 /* Clear all errors and flags */ scif_readw(uart, params->status_reg); @@ -271,6 +278,31 @@ static void scif_uart_stop_tx(struct serial_port *port) scif_writew(uart, SCIF_SCSCR, scif_readw(uart, SCIF_SCSCR) & ~SCSCR_TI= E); } =20 +#ifdef CONFIG_SYSTEM_SUSPEND + +static void scif_uart_suspend(struct serial_port *port) +{ + struct scif_uart *uart =3D port->uart; + + scif_uart_stop_tx(port); + scif_uart_disable(uart); +} + +static void scif_uart_resume(struct serial_port *port) +{ + struct scif_uart *uart =3D port->uart; + const struct port_params *params =3D uart->params; + uint16_t ctrl; + + scif_uart_init_preirq(port); + + /* Enable TX/RX and Error Interrupts */ + ctrl =3D scif_readw(uart, SCIF_SCSCR); + scif_writew(uart, SCIF_SCSCR, ctrl | params->irq_flags); +} + +#endif /* CONFIG_SYSTEM_SUSPEND */ + static struct uart_driver __read_mostly scif_uart_driver =3D { .init_preirq =3D scif_uart_init_preirq, .init_postirq =3D scif_uart_init_postirq, @@ -281,6 +313,10 @@ static struct uart_driver __read_mostly scif_uart_driv= er =3D { .start_tx =3D scif_uart_start_tx, .stop_tx =3D scif_uart_stop_tx, .vuart_info =3D scif_vuart_info, +#ifdef CONFIG_SYSTEM_SUSPEND + .suspend =3D scif_uart_suspend, + .resume =3D scif_uart_resume, +#endif }; =20 static const struct dt_device_match scif_uart_dt_match[] __initconst =3D --=20 2.48.1