lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241017103216.316114-1-abhijit.gangurde@amd.com>
Date: Thu, 17 Oct 2024 16:02:16 +0530
From: Abhijit Gangurde <abhijit.gangurde@....com>
To: <gregkh@...uxfoundation.org>, <linux-kernel@...r.kernel.org>
CC: <git@....com>, <michal.simek@....com>, <Nipun.Gupta@....com>,
	<nikhil.agarwal@....com>, Abhijit Gangurde <abhijit.gangurde@....com>
Subject: [PATCH 1/1] cdx: register shutdown callback for cdx controller

register shutdown callback for cdx controller platform device
to handle graceful connection closure of rpmsg transport.
Also, handle shutdown of cdx bus device by disabling the bus.

Signed-off-by: Abhijit Gangurde <abhijit.gangurde@....com>
---
 drivers/cdx/cdx.c                       | 5 ++++-
 drivers/cdx/controller/cdx_controller.c | 6 ++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/cdx/cdx.c b/drivers/cdx/cdx.c
index 07371cb653d3..655a056bca4e 100644
--- a/drivers/cdx/cdx.c
+++ b/drivers/cdx/cdx.c
@@ -338,8 +338,11 @@ static void cdx_shutdown(struct device *dev)
 {
 	struct cdx_driver *cdx_drv = to_cdx_driver(dev->driver);
 	struct cdx_device *cdx_dev = to_cdx_device(dev);
+	struct cdx_controller *cdx = cdx_dev->cdx;
 
-	if (cdx_drv && cdx_drv->shutdown)
+	if (cdx_dev->is_bus && cdx_dev->enabled && cdx->ops->bus_disable)
+		cdx->ops->bus_disable(cdx, cdx_dev->bus_num);
+	else if (cdx_drv && cdx_drv->shutdown)
 		cdx_drv->shutdown(cdx_dev);
 }
 
diff --git a/drivers/cdx/controller/cdx_controller.c b/drivers/cdx/controller/cdx_controller.c
index 7c1ea5373b12..9aad5a9b328c 100644
--- a/drivers/cdx/controller/cdx_controller.c
+++ b/drivers/cdx/controller/cdx_controller.c
@@ -261,6 +261,11 @@ static void xlnx_cdx_remove(struct platform_device *pdev)
 	kfree(cdx_mcdi);
 }
 
+static void xlnx_cdx_shutdown(struct platform_device *pdev)
+{
+	cdx_destroy_rpmsg(pdev);
+}
+
 static const struct of_device_id cdx_match_table[] = {
 	{.compatible = "xlnx,versal-net-cdx",},
 	{ },
@@ -276,6 +281,7 @@ static struct platform_driver cdx_pdriver = {
 		   },
 	.probe = xlnx_cdx_probe,
 	.remove_new = xlnx_cdx_remove,
+	.shutdown = xlnx_cdx_shutdown,
 };
 
 static int __init cdx_controller_init(void)
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ