drivers/rapidio/rio.c | 58 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+)
Signed-off-by: Navid-Derakhshandeh <navid.derakhshandeh1@gmail.com>
Implement rio discovery for all
---
drivers/rapidio/rio.c | 58 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 58 insertions(+)
diff --git a/drivers/rapidio/rio.c b/drivers/rapidio/rio.c
index 333d783af6d4..0b11e8ba3126 100644
--- a/drivers/rapidio/rio.c
+++ b/drivers/rapidio/rio.c
@@ -23,6 +23,8 @@
#include <linux/spinlock.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
+#include <linux/workqueue.h>
+
#include "rio.h"
@@ -1062,6 +1064,62 @@ rio_get_input_status(struct rio_dev *rdev, int pnum, u32 *lnkresp)
return -EIO;
}
+/**
+ * rio_restart_discovery_all - Restart discovery on all RapidIO networks
+ *
+ * Iterates through all registered RapidIO networks and restarts topology
+ * discovery process from each network's host port. Intended to be used
+ * after a system-wide error or configuration change.
+ */
+void rio_restart_discovery_all(void)
+{
+ struct rio_net *net;
+
+ spin_lock(&rio_global_list_lock);
+ list_for_each_entry(net, &rio_nets, node) {
+ if (net->hport)
+ rio_scan_mport(net->hport);
+ }
+ spin_unlock(&rio_global_list_lock);
+}
+EXPORT_SYMBOL_GPL(rio_restart_discovery_all);
+/**
+ * rio_maybe_restart_discovery - Restart discovery if device requires rediscovery
+ * @rdev: Pointer to RIO device control structure
+ *
+ * If the given device is associated with a RapidIO network,
+ * attempts to restart topology discovery from the network's host port.
+ * Intended to be called if an error condition is detected that may
+ * require rediscovery to restore normal operation.
+ */
+static void rio_maybe_restart_discovery(struct rio_dev *rdev)
+{
+ struct rio_net *net;
+
+ if (!rdev || !rdev->net)
+ return;
+
+ net = rdev->net;
+
+ /* Only restart if there is a valid host port */
+ if (net->hport) {
+ msleep(100); /* Brief delay for safety */
+ pr_info("RIO: Discovery restart triggered for device %s (net '%s')\n",
+ dev_name(&rdev->dev), dev_name(&net->dev));
+ rio_scan_mport(net->hport);
+ }
+}
+
+static void rio_restart_discovery(struct rio_net *net)
+{
+ if (net && net->hport) {
+ /* Delay briefly to avoid hammering after repeated errors */
+ msleep(100);
+ pr_info("RIO: Restarting discovery process on network '%s'\n", dev_name(&net->dev));
+ rio_scan_mport(net->hport);
+ }
+}
+
/**
* rio_clr_err_stopped - Clears port Error-stopped states.
--
2.51.0
Hi Navid-Derakhshandeh,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on v6.16-rc1 next-20251219]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Navid-Derakhshandeh/mailbox-rio-implement-discovery-for-all/20251230-031149
base: linus/master
patch link: https://lore.kernel.org/r/20251229190724.20608-1-navid.derakhshandeh1%40gmail.com
patch subject: [PATCH] mailbox: rio : implement discovery for all
config: i386-randconfig-2006-20250825 (https://download.01.org/0day-ci/archive/20260102/202601020343.JqiZTBBL-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260102/202601020343.JqiZTBBL-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202601020343.JqiZTBBL-lkp@intel.com/
All error/warnings (new ones prefixed by >>):
drivers/rapidio/rio.c:1074:6: warning: no previous prototype for 'rio_restart_discovery_all' [-Wmissing-prototypes]
1074 | void rio_restart_discovery_all(void)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/rapidio/rio.c: In function 'rio_restart_discovery_all':
>> drivers/rapidio/rio.c:1081:25: error: implicit declaration of function 'rio_scan_mport'; did you mean 'rio_init_mports'? [-Wimplicit-function-declaration]
1081 | rio_scan_mport(net->hport);
| ^~~~~~~~~~~~~~
| rio_init_mports
drivers/rapidio/rio.c: At top level:
>> drivers/rapidio/rio.c:1113:13: warning: 'rio_restart_discovery' defined but not used [-Wunused-function]
1113 | static void rio_restart_discovery(struct rio_net *net)
| ^~~~~~~~~~~~~~~~~~~~~
drivers/rapidio/rio.c:1095:13: warning: 'rio_maybe_restart_discovery' defined but not used [-Wunused-function]
1095 | static void rio_maybe_restart_discovery(struct rio_dev *rdev)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +1081 drivers/rapidio/rio.c
1021
1022 /**
1023 * rio_get_input_status - Sends a Link-Request/Input-Status control symbol and
1024 * returns link-response (if requested).
1025 * @rdev: RIO devive to issue Input-status command
1026 * @pnum: Device port number to issue the command
1027 * @lnkresp: Response from a link partner
1028 */
1029 static int
1030 rio_get_input_status(struct rio_dev *rdev, int pnum, u32 *lnkresp)
1031 {
1032 u32 regval;
1033 int checkcount;
1034
1035 if (lnkresp) {
1036 /* Read from link maintenance response register
1037 * to clear valid bit */
1038 rio_read_config_32(rdev,
1039 RIO_DEV_PORT_N_MNT_RSP_CSR(rdev, pnum),
1040 ®val);
1041 udelay(50);
1042 }
1043
1044 /* Issue Input-status command */
1045 rio_write_config_32(rdev,
1046 RIO_DEV_PORT_N_MNT_REQ_CSR(rdev, pnum),
1047 RIO_MNT_REQ_CMD_IS);
1048
1049 /* Exit if the response is not expected */
1050 if (!lnkresp)
1051 return 0;
1052
1053 checkcount = 3;
1054 while (checkcount--) {
1055 udelay(50);
1056 rio_read_config_32(rdev,
1057 RIO_DEV_PORT_N_MNT_RSP_CSR(rdev, pnum),
1058 ®val);
1059 if (regval & RIO_PORT_N_MNT_RSP_RVAL) {
1060 *lnkresp = regval;
1061 return 0;
1062 }
1063 }
1064
1065 return -EIO;
1066 }
1067 /**
1068 * rio_restart_discovery_all - Restart discovery on all RapidIO networks
1069 *
1070 * Iterates through all registered RapidIO networks and restarts topology
1071 * discovery process from each network's host port. Intended to be used
1072 * after a system-wide error or configuration change.
1073 */
1074 void rio_restart_discovery_all(void)
1075 {
1076 struct rio_net *net;
1077
1078 spin_lock(&rio_global_list_lock);
1079 list_for_each_entry(net, &rio_nets, node) {
1080 if (net->hport)
> 1081 rio_scan_mport(net->hport);
1082 }
1083 spin_unlock(&rio_global_list_lock);
1084 }
1085 EXPORT_SYMBOL_GPL(rio_restart_discovery_all);
1086 /**
1087 * rio_maybe_restart_discovery - Restart discovery if device requires rediscovery
1088 * @rdev: Pointer to RIO device control structure
1089 *
1090 * If the given device is associated with a RapidIO network,
1091 * attempts to restart topology discovery from the network's host port.
1092 * Intended to be called if an error condition is detected that may
1093 * require rediscovery to restore normal operation.
1094 */
1095 static void rio_maybe_restart_discovery(struct rio_dev *rdev)
1096 {
1097 struct rio_net *net;
1098
1099 if (!rdev || !rdev->net)
1100 return;
1101
1102 net = rdev->net;
1103
1104 /* Only restart if there is a valid host port */
1105 if (net->hport) {
1106 msleep(100); /* Brief delay for safety */
1107 pr_info("RIO: Discovery restart triggered for device %s (net '%s')\n",
1108 dev_name(&rdev->dev), dev_name(&net->dev));
1109 rio_scan_mport(net->hport);
1110 }
1111 }
1112
> 1113 static void rio_restart_discovery(struct rio_net *net)
1114 {
1115 if (net && net->hport) {
1116 /* Delay briefly to avoid hammering after repeated errors */
1117 msleep(100);
1118 pr_info("RIO: Restarting discovery process on network '%s'\n", dev_name(&net->dev));
1119 rio_scan_mport(net->hport);
1120 }
1121 }
1122
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Hi Navid-Derakhshandeh,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on v6.19-rc3 next-20251219]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Navid-Derakhshandeh/mailbox-rio-implement-discovery-for-all/20251230-031149
base: linus/master
patch link: https://lore.kernel.org/r/20251229190724.20608-1-navid.derakhshandeh1%40gmail.com
patch subject: [PATCH] mailbox: rio : implement discovery for all
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20260102/202601020241.CwU3w5vS-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260102/202601020241.CwU3w5vS-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202601020241.CwU3w5vS-lkp@intel.com/
All error/warnings (new ones prefixed by >>):
>> drivers/rapidio/rio.c:1081:4: error: call to undeclared function 'rio_scan_mport'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
1081 | rio_scan_mport(net->hport);
| ^
>> drivers/rapidio/rio.c:1074:6: warning: no previous prototype for function 'rio_restart_discovery_all' [-Wmissing-prototypes]
1074 | void rio_restart_discovery_all(void)
| ^
drivers/rapidio/rio.c:1074:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
1074 | void rio_restart_discovery_all(void)
| ^
| static
drivers/rapidio/rio.c:1109:3: error: call to undeclared function 'rio_scan_mport'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
1109 | rio_scan_mport(net->hport);
| ^
drivers/rapidio/rio.c:1119:3: error: call to undeclared function 'rio_scan_mport'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
1119 | rio_scan_mport(net->hport);
| ^
1 warning and 3 errors generated.
vim +/rio_scan_mport +1081 drivers/rapidio/rio.c
1021
1022 /**
1023 * rio_get_input_status - Sends a Link-Request/Input-Status control symbol and
1024 * returns link-response (if requested).
1025 * @rdev: RIO devive to issue Input-status command
1026 * @pnum: Device port number to issue the command
1027 * @lnkresp: Response from a link partner
1028 */
1029 static int
1030 rio_get_input_status(struct rio_dev *rdev, int pnum, u32 *lnkresp)
1031 {
1032 u32 regval;
1033 int checkcount;
1034
1035 if (lnkresp) {
1036 /* Read from link maintenance response register
1037 * to clear valid bit */
1038 rio_read_config_32(rdev,
1039 RIO_DEV_PORT_N_MNT_RSP_CSR(rdev, pnum),
1040 ®val);
1041 udelay(50);
1042 }
1043
1044 /* Issue Input-status command */
1045 rio_write_config_32(rdev,
1046 RIO_DEV_PORT_N_MNT_REQ_CSR(rdev, pnum),
1047 RIO_MNT_REQ_CMD_IS);
1048
1049 /* Exit if the response is not expected */
1050 if (!lnkresp)
1051 return 0;
1052
1053 checkcount = 3;
1054 while (checkcount--) {
1055 udelay(50);
1056 rio_read_config_32(rdev,
1057 RIO_DEV_PORT_N_MNT_RSP_CSR(rdev, pnum),
1058 ®val);
1059 if (regval & RIO_PORT_N_MNT_RSP_RVAL) {
1060 *lnkresp = regval;
1061 return 0;
1062 }
1063 }
1064
1065 return -EIO;
1066 }
1067 /**
1068 * rio_restart_discovery_all - Restart discovery on all RapidIO networks
1069 *
1070 * Iterates through all registered RapidIO networks and restarts topology
1071 * discovery process from each network's host port. Intended to be used
1072 * after a system-wide error or configuration change.
1073 */
> 1074 void rio_restart_discovery_all(void)
1075 {
1076 struct rio_net *net;
1077
1078 spin_lock(&rio_global_list_lock);
1079 list_for_each_entry(net, &rio_nets, node) {
1080 if (net->hport)
> 1081 rio_scan_mport(net->hport);
1082 }
1083 spin_unlock(&rio_global_list_lock);
1084 }
1085 EXPORT_SYMBOL_GPL(rio_restart_discovery_all);
1086 /**
1087 * rio_maybe_restart_discovery - Restart discovery if device requires rediscovery
1088 * @rdev: Pointer to RIO device control structure
1089 *
1090 * If the given device is associated with a RapidIO network,
1091 * attempts to restart topology discovery from the network's host port.
1092 * Intended to be called if an error condition is detected that may
1093 * require rediscovery to restore normal operation.
1094 */
1095 static void rio_maybe_restart_discovery(struct rio_dev *rdev)
1096 {
1097 struct rio_net *net;
1098
1099 if (!rdev || !rdev->net)
1100 return;
1101
1102 net = rdev->net;
1103
1104 /* Only restart if there is a valid host port */
1105 if (net->hport) {
1106 msleep(100); /* Brief delay for safety */
1107 pr_info("RIO: Discovery restart triggered for device %s (net '%s')\n",
1108 dev_name(&rdev->dev), dev_name(&net->dev));
1109 rio_scan_mport(net->hport);
1110 }
1111 }
1112
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Hi Navid-Derakhshandeh,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on v6.19-rc3 next-20251219]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Navid-Derakhshandeh/mailbox-rio-implement-discovery-for-all/20251230-031149
base: linus/master
patch link: https://lore.kernel.org/r/20251229190724.20608-1-navid.derakhshandeh1%40gmail.com
patch subject: [PATCH] mailbox: rio : implement discovery for all
config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20260102/202601020041.aUIaVDCt-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 15.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260102/202601020041.aUIaVDCt-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202601020041.aUIaVDCt-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/rapidio/rio.c:1074:6: warning: no previous prototype for 'rio_restart_discovery_all' [-Wmissing-prototypes]
1074 | void rio_restart_discovery_all(void)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/rapidio/rio.c: In function 'rio_restart_discovery_all':
>> drivers/rapidio/rio.c:1081:25: error: implicit declaration of function 'rio_scan_mport'; did you mean 'rio_init_mports'? [-Wimplicit-function-declaration]
1081 | rio_scan_mport(net->hport);
| ^~~~~~~~~~~~~~
| rio_init_mports
drivers/rapidio/rio.c: At top level:
drivers/rapidio/rio.c:1113:13: warning: 'rio_restart_discovery' defined but not used [-Wunused-function]
1113 | static void rio_restart_discovery(struct rio_net *net)
| ^~~~~~~~~~~~~~~~~~~~~
drivers/rapidio/rio.c:1095:13: warning: 'rio_maybe_restart_discovery' defined but not used [-Wunused-function]
1095 | static void rio_maybe_restart_discovery(struct rio_dev *rdev)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +1081 drivers/rapidio/rio.c
1021
1022 /**
1023 * rio_get_input_status - Sends a Link-Request/Input-Status control symbol and
1024 * returns link-response (if requested).
1025 * @rdev: RIO devive to issue Input-status command
1026 * @pnum: Device port number to issue the command
1027 * @lnkresp: Response from a link partner
1028 */
1029 static int
1030 rio_get_input_status(struct rio_dev *rdev, int pnum, u32 *lnkresp)
1031 {
1032 u32 regval;
1033 int checkcount;
1034
1035 if (lnkresp) {
1036 /* Read from link maintenance response register
1037 * to clear valid bit */
1038 rio_read_config_32(rdev,
1039 RIO_DEV_PORT_N_MNT_RSP_CSR(rdev, pnum),
1040 ®val);
1041 udelay(50);
1042 }
1043
1044 /* Issue Input-status command */
1045 rio_write_config_32(rdev,
1046 RIO_DEV_PORT_N_MNT_REQ_CSR(rdev, pnum),
1047 RIO_MNT_REQ_CMD_IS);
1048
1049 /* Exit if the response is not expected */
1050 if (!lnkresp)
1051 return 0;
1052
1053 checkcount = 3;
1054 while (checkcount--) {
1055 udelay(50);
1056 rio_read_config_32(rdev,
1057 RIO_DEV_PORT_N_MNT_RSP_CSR(rdev, pnum),
1058 ®val);
1059 if (regval & RIO_PORT_N_MNT_RSP_RVAL) {
1060 *lnkresp = regval;
1061 return 0;
1062 }
1063 }
1064
1065 return -EIO;
1066 }
1067 /**
1068 * rio_restart_discovery_all - Restart discovery on all RapidIO networks
1069 *
1070 * Iterates through all registered RapidIO networks and restarts topology
1071 * discovery process from each network's host port. Intended to be used
1072 * after a system-wide error or configuration change.
1073 */
1074 void rio_restart_discovery_all(void)
1075 {
1076 struct rio_net *net;
1077
1078 spin_lock(&rio_global_list_lock);
1079 list_for_each_entry(net, &rio_nets, node) {
1080 if (net->hport)
> 1081 rio_scan_mport(net->hport);
1082 }
1083 spin_unlock(&rio_global_list_lock);
1084 }
1085 EXPORT_SYMBOL_GPL(rio_restart_discovery_all);
1086 /**
1087 * rio_maybe_restart_discovery - Restart discovery if device requires rediscovery
1088 * @rdev: Pointer to RIO device control structure
1089 *
1090 * If the given device is associated with a RapidIO network,
1091 * attempts to restart topology discovery from the network's host port.
1092 * Intended to be called if an error condition is detected that may
1093 * require rediscovery to restore normal operation.
1094 */
1095 static void rio_maybe_restart_discovery(struct rio_dev *rdev)
1096 {
1097 struct rio_net *net;
1098
1099 if (!rdev || !rdev->net)
1100 return;
1101
1102 net = rdev->net;
1103
1104 /* Only restart if there is a valid host port */
1105 if (net->hport) {
1106 msleep(100); /* Brief delay for safety */
1107 pr_info("RIO: Discovery restart triggered for device %s (net '%s')\n",
1108 dev_name(&rdev->dev), dev_name(&net->dev));
1109 rio_scan_mport(net->hport);
1110 }
1111 }
1112
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Hi Navid-Derakhshandeh,
kernel test robot noticed the following build warnings:
[auto build test WARNING on linus/master]
[also build test WARNING on v6.19-rc3 next-20251219]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Navid-Derakhshandeh/mailbox-rio-implement-discovery-for-all/20251230-031149
base: linus/master
patch link: https://lore.kernel.org/r/20251229190724.20608-1-navid.derakhshandeh1%40gmail.com
patch subject: [PATCH] mailbox: rio : implement discovery for all
config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20260101/202601011944.D3aRBBxZ-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 15.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260101/202601011944.D3aRBBxZ-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202601011944.D3aRBBxZ-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/rapidio/rio.c:1074:6: warning: no previous prototype for 'rio_restart_discovery_all' [-Wmissing-prototypes]
1074 | void rio_restart_discovery_all(void)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/rapidio/rio.c: In function 'rio_restart_discovery_all':
drivers/rapidio/rio.c:1081:25: error: implicit declaration of function 'rio_scan_mport'; did you mean 'rio_init_mports'? [-Wimplicit-function-declaration]
1081 | rio_scan_mport(net->hport);
| ^~~~~~~~~~~~~~
| rio_init_mports
drivers/rapidio/rio.c: At top level:
>> drivers/rapidio/rio.c:1113:13: warning: 'rio_restart_discovery' defined but not used [-Wunused-function]
1113 | static void rio_restart_discovery(struct rio_net *net)
| ^~~~~~~~~~~~~~~~~~~~~
>> drivers/rapidio/rio.c:1095:13: warning: 'rio_maybe_restart_discovery' defined but not used [-Wunused-function]
1095 | static void rio_maybe_restart_discovery(struct rio_dev *rdev)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/rio_restart_discovery_all +1074 drivers/rapidio/rio.c
1021
1022 /**
1023 * rio_get_input_status - Sends a Link-Request/Input-Status control symbol and
1024 * returns link-response (if requested).
1025 * @rdev: RIO devive to issue Input-status command
1026 * @pnum: Device port number to issue the command
1027 * @lnkresp: Response from a link partner
1028 */
1029 static int
1030 rio_get_input_status(struct rio_dev *rdev, int pnum, u32 *lnkresp)
1031 {
1032 u32 regval;
1033 int checkcount;
1034
1035 if (lnkresp) {
1036 /* Read from link maintenance response register
1037 * to clear valid bit */
1038 rio_read_config_32(rdev,
1039 RIO_DEV_PORT_N_MNT_RSP_CSR(rdev, pnum),
1040 ®val);
1041 udelay(50);
1042 }
1043
1044 /* Issue Input-status command */
1045 rio_write_config_32(rdev,
1046 RIO_DEV_PORT_N_MNT_REQ_CSR(rdev, pnum),
1047 RIO_MNT_REQ_CMD_IS);
1048
1049 /* Exit if the response is not expected */
1050 if (!lnkresp)
1051 return 0;
1052
1053 checkcount = 3;
1054 while (checkcount--) {
1055 udelay(50);
1056 rio_read_config_32(rdev,
1057 RIO_DEV_PORT_N_MNT_RSP_CSR(rdev, pnum),
1058 ®val);
1059 if (regval & RIO_PORT_N_MNT_RSP_RVAL) {
1060 *lnkresp = regval;
1061 return 0;
1062 }
1063 }
1064
1065 return -EIO;
1066 }
1067 /**
1068 * rio_restart_discovery_all - Restart discovery on all RapidIO networks
1069 *
1070 * Iterates through all registered RapidIO networks and restarts topology
1071 * discovery process from each network's host port. Intended to be used
1072 * after a system-wide error or configuration change.
1073 */
> 1074 void rio_restart_discovery_all(void)
1075 {
1076 struct rio_net *net;
1077
1078 spin_lock(&rio_global_list_lock);
1079 list_for_each_entry(net, &rio_nets, node) {
1080 if (net->hport)
1081 rio_scan_mport(net->hport);
1082 }
1083 spin_unlock(&rio_global_list_lock);
1084 }
1085 EXPORT_SYMBOL_GPL(rio_restart_discovery_all);
1086 /**
1087 * rio_maybe_restart_discovery - Restart discovery if device requires rediscovery
1088 * @rdev: Pointer to RIO device control structure
1089 *
1090 * If the given device is associated with a RapidIO network,
1091 * attempts to restart topology discovery from the network's host port.
1092 * Intended to be called if an error condition is detected that may
1093 * require rediscovery to restore normal operation.
1094 */
> 1095 static void rio_maybe_restart_discovery(struct rio_dev *rdev)
1096 {
1097 struct rio_net *net;
1098
1099 if (!rdev || !rdev->net)
1100 return;
1101
1102 net = rdev->net;
1103
1104 /* Only restart if there is a valid host port */
1105 if (net->hport) {
1106 msleep(100); /* Brief delay for safety */
1107 pr_info("RIO: Discovery restart triggered for device %s (net '%s')\n",
1108 dev_name(&rdev->dev), dev_name(&net->dev));
1109 rio_scan_mport(net->hport);
1110 }
1111 }
1112
> 1113 static void rio_restart_discovery(struct rio_net *net)
1114 {
1115 if (net && net->hport) {
1116 /* Delay briefly to avoid hammering after repeated errors */
1117 msleep(100);
1118 pr_info("RIO: Restarting discovery process on network '%s'\n", dev_name(&net->dev));
1119 rio_scan_mport(net->hport);
1120 }
1121 }
1122
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
© 2016 - 2026 Red Hat, Inc.