[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 2/2] xen/char: implement suspend/resume calls for SCIF driver


  • To: Mykola Kvach <xakep.amatop@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Ayan Kumar Halder <ayankuma@xxxxxxx>
  • Date: Fri, 13 Jun 2025 15:36:44 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5Bhfezr/npPdf/3ciPsOvpWHjiqsuZEZHbRLK1j6hSw=; b=aGGgocjXmp/t8LM9puwiCpvMyQeQ88XU3CM/PtTWHPl/EQ3PkrNFUXUucbvvMNBfBpQDjEdCUMXFWPMQReYATQt08bQOwQHuqVWYFJJTTNqbK12C4u1LWRUdsU8SnTt7P/8jHhb8E+lVQFrbsjTT9za9zqWCQRXGPiSGsUDYEi7CRCdlEGI/7FKOCW38agRhewestlyAT7gmqxGllQPIZw3AIAyODfOf5pbsL2YPNgbKroq/y3M8d46ds8waHZRFv1a2AuZ+/BjSqacXheNn8cSh3qqJ9avEVWEpRIRq8qXMvBlfbaQdFKdZGYpiMwWPb+nRKsmKtyS8a3eHM6rgKA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GsuT/tOSWZR13eC0M8vuptMINBmy9u7jo0tOI93unVkixs9zov03XWL0/FG1DFhiVRqi0fgVDl4L/JIS+7vQZW8MvcAVjIyUmAZQGUHLOKQbuOoFjwwhepdKX3O+hwWBkL9oMxuX9UEvyZMn6E3C8bAZpO/VfLVA3F9VrY2gBwxLe7VHxTDiKyESBLw0Kdy+3Dd4U5hblrVlUK5z5JjYqyW1ryHLv3vYFeQ6nYAudxatIu1u6wAcTzMx/+1xnNy4oQ88ZIclz++uo0F6bB147l05feD2y9Jn5qNXv551hqmCMhxeC/dVUvyBSzn7wdpHunK8FsLuWO9vGFSZ0F7bgA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>, Mykola Kvach <mykola_kvach@xxxxxxxx>
  • Delivery-date: Fri, 13 Jun 2025 14:37:11 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Mykola,

On 06/06/2025 11:11, Mykola Kvach wrote:
CAUTION: This message has originated from an External Source. Please use proper 
judgment and caution when opening attachments, clicking links, or responding to 
this email.


From: Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>

The changes have been tested only on the Renesas R-Car H3 Starter Kit board.

The commit message need to explain what the change is and why it is needed.

Also ...


Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
Signed-off-by: Mykola Kvach <mykola_kvach@xxxxxxxx>
---
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)
      }
  }

-static void __init scif_uart_init_preirq(struct serial_port *port)
+static void scif_uart_disable(struct scif_uart *uart)
  {
-    struct scif_uart *uart = port->uart;
      const struct port_params *params = uart->params;

      /*
@@ -155,6 +154,14 @@ static void __init scif_uart_init_preirq(struct 
serial_port *port)

      /* 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 = port->uart;
+    const struct port_params *params = uart->params;
+
+    scif_uart_disable(uart);

      /* 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_TIE);
  }

+#ifdef CONFIG_SYSTEM_SUSPEND
+
+static void scif_uart_suspend(struct serial_port *port)
+{
+    struct scif_uart *uart = port->uart;
+
+    scif_uart_stop_tx(port);
+    scif_uart_disable(uart);
+}
+
+static void scif_uart_resume(struct serial_port *port)
+{
+    struct scif_uart *uart = port->uart;
+    const struct port_params *params = uart->params;
+    uint16_t ctrl;
+
+    scif_uart_init_preirq(port);
+
+    /* Enable TX/RX and Error Interrupts  */
+    ctrl = scif_readw(uart, SCIF_SCSCR);
+    scif_writew(uart, SCIF_SCSCR, ctrl | params->irq_flags);

If you can give reference to a public doc which describe these registers, it will be great.

Otherwise, the changes look ok to me.

+}
+
+#endif /* CONFIG_SYSTEM_SUSPEND */
+
  static struct uart_driver __read_mostly scif_uart_driver = {
      .init_preirq  = scif_uart_init_preirq,
      .init_postirq = scif_uart_init_postirq,
@@ -281,6 +313,10 @@ static struct uart_driver __read_mostly scif_uart_driver = 
{
      .start_tx     = scif_uart_start_tx,
      .stop_tx      = scif_uart_stop_tx,
      .vuart_info   = scif_vuart_info,
+#ifdef CONFIG_SYSTEM_SUSPEND
+    .suspend      = scif_uart_suspend,
+    .resume       = scif_uart_resume,
+#endif
  };

  static const struct dt_device_match scif_uart_dt_match[] __initconst =
- Ayan
--
2.48.1





 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.