From nobody Fri Oct 31 09:56:11 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=1749204731; cv=none; d=zohomail.com; s=zohoarc; b=GpO/oG4HsiIWtXqnIMggP9p3tI3CvUlWTL6cSwpwJNdSXM+EIFxsuw3ozJ3XACaE3Vrpgj5c2rFhx2npkXyyIs4qlrxYk6RZTQVyyatKoYpoyeTV0BeYd8/zW1evq4A0711DBj1AcFoexRa4JqeG0DtYNIsUauKlwyQQTpU4AE0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749204731; 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=9dWxP7Icxj1+b68Zu3OZEwOOJEHkIKPApD7TkfsOeh4=; b=iBtw7ovKUkUd8m0OEmyaxk6fVMz7X1zwGcudv1lZ0H02WkrIQK3TWzqmzCIODgqjQwm3d/yXeINqEgzbVbq2ySz6dybOU5bvEyyuWW5CvKFadLuCFI/DUTq7UuJKeOMKuZQs5inbOsGIXSeYyQVuqOspMEQ7PUcbfw/2VNiIQCE= 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 1749204731793668.3392161978213; Fri, 6 Jun 2025 03:12:11 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1008360.1387650 (Exim 4.92) (envelope-from ) id 1uNU3D-0005g9-ED; Fri, 06 Jun 2025 10:11:51 +0000 Received: by outflank-mailman (output) from mailman id 1008360.1387650; Fri, 06 Jun 2025 10:11:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uNU3D-0005fy-BN; Fri, 06 Jun 2025 10:11:51 +0000 Received: by outflank-mailman (input) for mailman id 1008360; Fri, 06 Jun 2025 10:11:49 +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 1uNU3B-0005Rm-Hk for xen-devel@lists.xenproject.org; Fri, 06 Jun 2025 10:11:49 +0000 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [2a00:1450:4864:20::12c]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id a8aeaa0b-42be-11f0-a301-13f23c93f187; Fri, 06 Jun 2025 12:11:49 +0200 (CEST) Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-55365c63fa5so946653e87.1 for ; Fri, 06 Jun 2025 03:11:49 -0700 (PDT) Received: from yp-VivoBook-ASUSLaptop-M1503QA-M1503QA.. ([95.67.15.120]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-553677389d5sm143592e87.259.2025.06.06.03.11.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Jun 2025 03:11:47 -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: a8aeaa0b-42be-11f0-a301-13f23c93f187 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749204708; x=1749809508; 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=9dWxP7Icxj1+b68Zu3OZEwOOJEHkIKPApD7TkfsOeh4=; b=NWnFApOn6agP8AoJCRiexbt3oZuRnUVeB0Yv9rRmn/uFgZscNdmpOt3CCygmVV7bev 5g3co1JWI963iab/o8ZmjQ//TQZvshu5chxTKLJ0LdLpsBiopLI1uMpkUT8+txw2KB7Q 6mr9FlerLBxVIKfrZWB49P88lEiZDadfVAgMwqy9M1Uf7/9son1ACSqH+xcpO3EGozUc 1cLcvUtFejT5cPJ7278QzKaoiEa0MeSesffI3jEd3Gnl19X5/vCba0RViHKTT17qFhmB H0ZEHs8bfqpWWxTVgUOYxTmhoIxWSKtIaRwP579BC8ZVzNjLCBi8JrOBGMBXUbRmCYKJ 9i1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749204708; x=1749809508; 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=9dWxP7Icxj1+b68Zu3OZEwOOJEHkIKPApD7TkfsOeh4=; b=Eeor0SkvFT8+bxN4gc7S8Bi58RVzYbFB7yLuyL8+voPWmA1xyI+0LYIYX9fTqJtqQ5 CkpwxfXhmUGg2VF7HHrL4W3CXJ1m6RawaDeW2/xnyQx1roydBIszZaLNteU+E+xAkbwO dS2ILkr3kOyvAAQQykfqFlR5d8JWI/YLdYym7pOcPpD546kY+GwQcxQQrkHVSn8z1Hr2 oP9wkPxyfGn4OAD0sl0gh1ORq/LZ7vvfFYUvPVWe7yes/7bEZ5OnDJoWQneM8NXUKOXB fL+bMWlojS0jsrvEyTBO7xvyueDh7CasunG50xIKtxhwl29wno8yXOz+S/+TMlY8ngTZ 7gUA== X-Gm-Message-State: AOJu0YzYGNrZutouLcWVMa01nkIbF0qHg7ycEc2bPh8dgO6ac3ucuEw/ N/YRbVcTpkjaPH1HCJgo79MJk1ILduuEIPRyrWwb/yQLJNv7VEizKLg4hJrv7VKJ X-Gm-Gg: ASbGncsX+62RGZ+NdUY/GYfs1vyp7ETgLG2T5uJQlM2Wpz7tyzVuGnqTIjnQ2oshNUL i49lZKG1Us4zLm9PF1pa1y+I0eAr9pJpDNBS6jwZpm0n3Jh1tDXlTIDxwO/u2ScuguYr6Cea54Y Xknt1Q/WpIXHnpaP6F+WDQ06tIoU+2F16VZ72OyEDWS7ODd/+MZMtQyczwz0ugyhnq+H5oFKsNh KcmKhYCK51DYg68tealsMpokVF++xhfGKUE5DJb5Yp+XfFN81yViMgmZJm2VmpvLLcaYlhOdo0f qRfgGWBO/+ye9ozBXycF7veKs16+VINXqpsqOSu9WUIZEvQZ9txeEGkosGTsxb0HXlFgyuRhWM7 WQ5t5fPdgAd8nWUsA9bFIqKzMwQ== X-Google-Smtp-Source: AGHT+IFtTWG82lj9kW60Ux7/zGpH+k9xbSgOEp6QEHnyKcsn4vfhrvxUPy+hETCT0HhwTVgiuuYEFw== X-Received: by 2002:a05:6512:2345:b0:553:2dce:3abc with SMTP id 2adb3069b0e04-55366c38984mr725671e87.50.1749204707935; Fri, 06 Jun 2025 03:11:47 -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 v3 2/2] xen/char: implement suspend/resume calls for SCIF driver Date: Fri, 6 Jun 2025 13:11:42 +0300 Message-ID: <3be3369910ec5159eab3cb26155da645dd1df83b.1749204282.git.mykola_kvach@epam.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1749204733003116600 Content-Type: text/plain; charset="utf-8" From: Volodymyr Babchuk The changes have been tested only on the Renesas R-Car H3 Starter Kit board. 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. --- 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