Skip to contentSkip to conversation

mailbox: zynqmp-ipi: Make polling period configurable from kconfig

PATCH Superseded Ben Levinsky 2 participants 2 messages Jul 16, 2024 – Jul 17, 2024

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mailbox: zynqmp-ipi: Make polling period configurable from kconfig

The polling period for ZynqMP IPI Mailbox is currently hard-coded to five milliseconds. To avoid patching this when modifying the value, the value is now set with default that can be overwritten from kconfig prompt.

---
 drivers/mailbox/Kconfig              | 12 ++++++++++++
 drivers/mailbox/zynqmp-ipi-mailbox.c |  9 ++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)
drivers/mailbox/Kconfig +12 -0
index 3b8842c4a340..c87a92400616 100644
@@ -259,6 +259,18 @@ config ZYNQMP_IPI_MBOX
 	  message to the IPI buffer and will access the IPI control
 	  registers to kick the other processor or enquire status.
 
+config ZYNQMP_IPI_MBOX_POLL_PERIOD
+	int
+	prompt "ZynqMP IPI Mailbox driver polling period"
+	default 5
+	depends on ZYNQMP_IPI_MBOX
+	help
+	  By default the Xilinx-AMD IPI mailbox driver has a polling period
+	  of five milliseconds. If this option is set then the provided value
+	  will be used.
+
+	  Leave as default if not sure.
+
 config SUN6I_MSGBOX
 	tristate "Allwinner sun6i/sun8i/sun9i/sun50i Message Box"
 	depends on ARCH_SUNXI || COMPILE_TEST
drivers/mailbox/zynqmp-ipi-mailbox.c +8 -1
index 4acf5612487c..df540e2b9dbe 100644
@@ -64,6 +64,13 @@
 
 #define MAX_SGI 16
 
+/* Polling period in milliseconds. */
+#ifndef CONFIG_ZYNQMP_IPI_MBOX_POLL_PERIOD
+#define ZYNQMP_IPI_MBOX_POLL_PERIOD (5U)
+#else
+#define ZYNQMP_IPI_MBOX_POLL_PERIOD CONFIG_ZYNQMP_IPI_MBOX_POLL_PERIOD
+#endif
+
 /**
  * struct zynqmp_ipi_mchan - Description of a Xilinx ZynqMP IPI mailbox channel
  * @is_opened: indicate if the IPI channel is opened
@@ -537,7 +544,7 @@ static int zynqmp_ipi_mbox_probe(struct zynqmp_ipi_mbox *ipi_mbox,
 	mbox->num_chans = 2;
 	mbox->txdone_irq = false;
 	mbox->txdone_poll = true;
-	mbox->txpoll_period = 5;
+	mbox->txpoll_period = ZYNQMP_IPI_MBOX_POLL_PERIOD;
 	mbox->of_xlate = zynqmp_ipi_of_xlate;
 	chans = devm_kzalloc(mdev, 2 * sizeof(*chans), GFP_KERNEL);
 	if (!chans)
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 39 lines · Ben Levinsky

The polling period for ZynqMP IPI Mailbox is currently hard-coded to five milliseconds. To avoid patching this when modifying the value, the value is now set with default that can be overwritten from kconfig prompt.

---
  drivers/mailbox/Kconfig              | 12 ++++++++++++
  drivers/mailbox/zynqmp-ipi-mailbox.c |  9 ++++++++-
  2 files changed, 20 insertions(+), 1 deletion(-)
drivers/mailbox/Kconfig +12 -0
index 3b8842c4a340..c87a92400616 100644
@@ -259,6 +259,18 @@ config ZYNQMP_IPI_MBOX
  	  message to the IPI buffer and will access the IPI control
  	  registers to kick the other processor or enquire status.
 
+config ZYNQMP_IPI_MBOX_POLL_PERIOD
+	int
+	prompt "ZynqMP IPI Mailbox driver polling period"
+	default 5
+	depends on ZYNQMP_IPI_MBOX
+	help
+	  By default the Xilinx-AMD IPI mailbox driver has a polling period
+	  of five milliseconds. If this option is set then the provided value
+	  will be used.
+
+	  Leave as default if not sure.
+
  config SUN6I_MSGBOX
  	tristate "Allwinner sun6i/sun8i/sun9i/sun50i Message Box"
  	depends on ARCH_SUNXI || COMPILE_TEST
drivers/mailbox/zynqmp-ipi-mailbox.c +0 -0
index 4acf5612487c..df540e2b9dbe 100644

drivers/mailbox/zynqmp-ipi-mailbox.c line 73

Quoted 10 lines
drivers/mailbox/zynqmp-ipi-mailbox.c +7 -0
@@ -64,6 +64,13 @@
 
  #define MAX_SGI 16
 
+/* Polling period in milliseconds. */
+#ifndef CONFIG_ZYNQMP_IPI_MBOX_POLL_PERIOD
+#define ZYNQMP_IPI_MBOX_POLL_PERIOD (5U)
+#else
+#define ZYNQMP_IPI_MBOX_POLL_PERIOD CONFIG_ZYNQMP_IPI_MBOX_POLL_PERIOD
+#endif
+

I think it would be better if this is module parameter that you don't need to recompile the kernel all the time when you want to change this value.

Thanks,
Michal