Skip to contentSkip to conversation

add support for cherryview gpio controller driver

PATCH Superseded Hongzhan Chen 2 participants 16 messages Aug 30, 2021 – Sep 2, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover add support for cherryview gpio controller driver

1. move out of OF config conditional compilation so that non-OF platform call same API to remove rtdm gpio chip device.
2. Introduce helper to find gpiochip as referring to pair of rtdm_gpiochip_scan_of and rtdm_gpiochip_scan_array_of.
3. Add Intel Cherryview pinctrl driver based on on 1 and 2.

I also did following tests with this patchset:
1. run /usr/lib/xenomai/testsuite/gpiobench -i 334 -i 335 -c INT33FF:02 to validate patch 9afea5ff2d7ba97db96b22a005a9a7fcf5f2d892 when setting GPIO_RTIOC_TS
2. apply following patch, and rerun 1.

index f83d7689f..50afbd418 100644

testsuite/gpiobench/gpiobench.c +1 -1
@@ -619,7 +619,7 @@ int main(int argc, char **argv)
                        goto out;
                }
 
-               ret = ioctl(ti.fd_dev_intr, GPIO_RTIOC_TS, &value);
+               ret = ioctl(ti.fd_dev_intr, GPIO_RTIOC_TS_MONO, &value);
                if (ret) {
                        printf("ioctl gpio port ts, failed\n");
                        goto out;

Hardware env:
1. Rock PI X V1.4.
2. GPIO loopback connection between GPIO 334 and 335.

Hongzhan Chen (3):
drivers/gpio: core: move out of OF config conditional compilation drivers/gpio: core: Introduce helper to find gpiochip driver/gpio: Add Intel Cherryview pinctrl driver

 include/cobalt/kernel/rtdm/gpio.h     | 10 ++++--
 kernel/drivers/gpio/Kconfig           |  7 ++++
 kernel/drivers/gpio/Makefile          |  2 ++
 kernel/drivers/gpio/gpio-cherryview.c | 42 ++++++++++++++++++++++++
 kernel/drivers/gpio/gpio-core.c       | 46 +++++++++++++++++++++++++--
 5 files changed, 103 insertions(+), 4 deletions(-)
 create mode 100644 kernel/drivers/gpio/gpio-cherryview.c
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/3 drivers/gpio: core: move out of OF config conditional compilation

The api would be called by both non-OF and OF platform to remove rtdm gpiochip device.

---
 include/cobalt/kernel/rtdm/gpio.h | 3 +--
 kernel/drivers/gpio/gpio-core.c   | 4 ++--
 2 files changed, 3 insertions(+), 4 deletions(-)
include/cobalt/kernel/rtdm/gpio.h +1 -2
index 72cc3a035..c307b1572 100644
@@ -70,9 +70,8 @@ int rtdm_gpiochip_scan_of(struct device_node *from,
 int rtdm_gpiochip_scan_array_of(struct device_node *from,
 				const char *compat[],
 				int nentries, int type);
+#endif
 
 void rtdm_gpiochip_remove_of(int type);
 
-#endif
-
 #endif /* !_COBALT_RTDM_GPIO_H */
kernel/drivers/gpio/gpio-core.c +2 -2
index 06a19b33a..ddda62b24 100644
@@ -626,6 +626,8 @@ int rtdm_gpiochip_scan_array_of(struct device_node *from,
 }
 EXPORT_SYMBOL_GPL(rtdm_gpiochip_scan_array_of);
 
+#endif /* CONFIG_OF */
+
 void rtdm_gpiochip_remove_of(int type)
 {
 	struct rtdm_gpio_chip *rgc, *n;
@@ -644,5 +646,3 @@ void rtdm_gpiochip_remove_of(int type)
 	mutex_unlock(&chip_lock);
 }
 EXPORT_SYMBOL_GPL(rtdm_gpiochip_remove_of);
-
-#endif /* CONFIG_OF */
Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH 1/3] drivers/gpio: core: move out of OF config conditional compilation

Quoted 14 lines · Hongzhan Chen via Xenomai

The api would be called by both non-OF and OF platform to remove rtdm gpiochip device.

---
 include/cobalt/kernel/rtdm/gpio.h | 3 +--
 kernel/drivers/gpio/gpio-core.c   | 4 ++--
 2 files changed, 3 insertions(+), 4 deletions(-)
include/cobalt/kernel/rtdm/gpio.h +0 -0
index 72cc3a035..c307b1572 100644

include/cobalt/kernel/rtdm/gpio.h int rtdm_gpiochip_scan_of(struct device_node *from, · line 76

Quoted 7 lines
include/cobalt/kernel/rtdm/gpio.h +1 -0
@@ -70,9 +70,8 @@ int rtdm_gpiochip_scan_of(struct device_node *from,
 int rtdm_gpiochip_scan_array_of(struct device_node *from,
 				const char *compat[],
 				int nentries, int type);
+#endif
 
 void rtdm_gpiochip_remove_of(int type);
 

But, when we call this for ACPI platforms as well, is _of still the right name?

Quoted 18 lines
include/cobalt/kernel/rtdm/gpio.h +0 -2
-#endif
-
 #endif /* !_COBALT_RTDM_GPIO_H */
kernel/drivers/gpio/gpio-core.c +2 -0
index 06a19b33a..ddda62b24 100644
@@ -626,6 +626,8 @@ int rtdm_gpiochip_scan_array_of(struct device_node *from,
 }
 EXPORT_SYMBOL_GPL(rtdm_gpiochip_scan_array_of);
 
+#endif /* CONFIG_OF */
+
 void rtdm_gpiochip_remove_of(int type)
 {
 	struct rtdm_gpio_chip *rgc, *n;

kernel/drivers/gpio/gpio-core.c void rtdm_gpiochip_remove_of(int type) · line 648

Quoted 5 lines
kernel/drivers/gpio/gpio-core.c +0 -2
@@ -644,5 +646,3 @@ void rtdm_gpiochip_remove_of(int type)
 	mutex_unlock(&chip_lock);
 }
 EXPORT_SYMBOL_GPL(rtdm_gpiochip_remove_of);
-
-#endif /* CONFIG_OF */

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#3 lore raw

PATCH 2/3 drivers/gpio: core: Introduce helper to find gpiochip

In reply to Hongzhan Chen

To find gpiochip for non-OF platforms like x86

---
 include/cobalt/kernel/rtdm/gpio.h |  7 ++++++
 kernel/drivers/gpio/gpio-core.c   | 42 +++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+)
include/cobalt/kernel/rtdm/gpio.h +7 -0
index c307b1572..07093e0be 100644
@@ -62,6 +62,13 @@ int rtdm_gpiochip_add_by_name(struct rtdm_gpio_chip *rgc,
 int rtdm_gpiochip_post_event(struct rtdm_gpio_chip *rgc,
 			     unsigned int offset);
 
+int rtdm_gpiochip_find(struct device_node *from,
+			  const char *label, int type);
+
+int rtdm_gpiochip_array_find(struct device_node *from,
+				const char *compat[],
+				int nentries, int type);
+
 #ifdef CONFIG_OF
 
 int rtdm_gpiochip_scan_of(struct device_node *from,
kernel/drivers/gpio/gpio-core.c +42 -0

48 lines not on this page · raw message

Signature · 1 line
2.17.1
#4 lore raw

PATCH 3/3 driver/gpio: Add Intel Cherryview pinctrl driver

In reply to Hongzhan Chen

Add support for Intel Cherryview pin controller driver

---
 kernel/drivers/gpio/Kconfig           |  7 +++++
 kernel/drivers/gpio/Makefile          |  2 ++
 kernel/drivers/gpio/gpio-cherryview.c | 42 +++++++++++++++++++++++++++
 3 files changed, 51 insertions(+)
 create mode 100644 kernel/drivers/gpio/gpio-cherryview.c
kernel/drivers/gpio/Kconfig +7 -0
index 44f41688c..c257444f0 100644
@@ -57,6 +57,13 @@ config XENO_DRIVERS_GPIO_OMAP
 	Enables support for the GPIO controller available from
 	OMAP family SOC.
 
+config XENO_DRIVERS_GPIO_CHERRYVIEW
+	depends on PINCTRL_CHERRYVIEW
+	tristate "Support for Cherryview GPIOs"
+	help
+
+	Enables support for the Intel Cherryview GPIO controller
+
 config XENO_DRIVERS_GPIO_DEBUG
        bool "Enable GPIO core debugging features"
 
kernel/drivers/gpio/Makefile +2 -0
index 7bcf59949..e534eab93 100644
@@ -6,6 +6,7 @@ obj-$(CONFIG_XENO_DRIVERS_GPIO_SUN8I_H3) += xeno-gpio-sun8i-h3.o
 obj-$(CONFIG_XENO_DRIVERS_GPIO_ZYNQ7000) += xeno-gpio-zynq7000.o
 obj-$(CONFIG_XENO_DRIVERS_GPIO_XILINX) += xeno-gpio-xilinx.o
 obj-$(CONFIG_XENO_DRIVERS_GPIO_OMAP) += xeno-gpio-omap.o
+obj-$(CONFIG_XENO_DRIVERS_GPIO_CHERRYVIEW) += xeno-gpio-cherryview.o
 obj-$(CONFIG_XENO_DRIVERS_GPIO) += gpio-core.o
 
 xeno-gpio-bcm2835-y := gpio-bcm2835.o
@@ -14,3 +15,4 @@ xeno-gpio-sun8i-h3-y := gpio-sun8i-h3.o
 xeno-gpio-zynq7000-y := gpio-zynq7000.o
 xeno-gpio-xilinx-y := gpio-xilinx.o
 xeno-gpio-omap-y := gpio-omap.o
+xeno-gpio-cherryview-y := gpio-cherryview.o
kernel/drivers/gpio/gpio-cherryview.c new file +42 -0

42 lines not on this page · raw message

Signature · 1 line
2.17.1
#5 lore raw
In reply to Hongzhan Chen
Quoted 6 lines · Hongzhan Chen via Xenomai

1. move out of OF config conditional compilation so that non-OF platform call same API to remove rtdm gpio chip device.
2. Introduce helper to find gpiochip as referring to pair of rtdm_gpiochip_scan_of and rtdm_gpiochip_scan_array_of.
3. Add Intel Cherryview pinctrl driver based on on 1 and 2.

Looks good, except for that naming issue.

Quoted 19 lines

I also did following tests with this patchset:
1. run /usr/lib/xenomai/testsuite/gpiobench -i 334 -i 335 -c INT33FF:02 to validate patch 9afea5ff2d7ba97db96b22a005a9a7fcf5f2d892 when setting GPIO_RTIOC_TS
2. apply following patch, and rerun 1.

index f83d7689f..50afbd418 100644

testsuite/gpiobench/gpiobench.c +1 -1
@@ -619,7 +619,7 @@ int main(int argc, char **argv)
                        goto out;
                }
 
-               ret = ioctl(ti.fd_dev_intr, GPIO_RTIOC_TS, &value);
+               ret = ioctl(ti.fd_dev_intr, GPIO_RTIOC_TS_MONO, &value);
                if (ret) {
                        printf("ioctl gpio port ts, failed\n");
                        goto out;
Quoted 4 lines

Hardware env:
1. Rock PI X V1.4.
2. GPIO loopback connection between GPIO 334 and 335.

Did you check if timestamps are as expected (different)?

Thanks,
Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#6 lore raw
Quoted 37 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Monday, August 30, 2021 3:37 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH 0/3] add support for cherryview gpio controller driver

Quoted 6 lines · Hongzhan Chen via Xenomai

1. move out of OF config conditional compilation so that non-OF platform call same API to remove rtdm gpio chip device.
2. Introduce helper to find gpiochip as referring to pair of rtdm_gpiochip_scan_of and rtdm_gpiochip_scan_array_of.
3. Add Intel Cherryview pinctrl driver based on on 1 and 2.

Looks good, except for that naming issue.

Quoted 19 lines

I also did following tests with this patchset:
1. run /usr/lib/xenomai/testsuite/gpiobench -i 334 -i 335 -c INT33FF:02 to validate patch 9afea5ff2d7ba97db96b22a005a9a7fcf5f2d892 when setting GPIO_RTIOC_TS
2. apply following patch, and rerun 1.

index f83d7689f..50afbd418 100644

testsuite/gpiobench/gpiobench.c +1 -1
@@ -619,7 +619,7 @@ int main(int argc, char **argv)
                        goto out;
                }
 
-               ret = ioctl(ti.fd_dev_intr, GPIO_RTIOC_TS, &value);
+               ret = ioctl(ti.fd_dev_intr, GPIO_RTIOC_TS_MONO, &value);
                if (ret) {
                        printf("ioctl gpio port ts, failed\n");
                        goto out;
Quoted 6 lines
Quoted 4 lines

Hardware env:
1. Rock PI X V1.4.
2. GPIO loopback connection between GPIO 334 and 335.

Did you check if timestamps are as expected (different)?

According to output of gpiobench, the inner Avg Latency would be vary large like ( 2814377.00000) after switch to MONO. But it is only about 16.879997 when we set REALTIME.

Regards

Hongzhan Chen

Quoted 7 lines

Thanks,
Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#7 lore raw
Quoted 44 lines · Hongzhan
Quoted 37 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Monday, August 30, 2021 3:37 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH 0/3] add support for cherryview gpio controller driver

Quoted 6 lines · Hongzhan Chen via Xenomai

1. move out of OF config conditional compilation so that non-OF platform call same API to remove rtdm gpio chip device.
2. Introduce helper to find gpiochip as referring to pair of rtdm_gpiochip_scan_of and rtdm_gpiochip_scan_array_of.
3. Add Intel Cherryview pinctrl driver based on on 1 and 2.

Looks good, except for that naming issue.

Quoted 19 lines

I also did following tests with this patchset:
1. run /usr/lib/xenomai/testsuite/gpiobench -i 334 -i 335 -c INT33FF:02 to validate patch 9afea5ff2d7ba97db96b22a005a9a7fcf5f2d892 when setting GPIO_RTIOC_TS
2. apply following patch, and rerun 1.

index f83d7689f..50afbd418 100644

testsuite/gpiobench/gpiobench.c +1 -1
@@ -619,7 +619,7 @@ int main(int argc, char **argv)
                        goto out;
                }
 
-               ret = ioctl(ti.fd_dev_intr, GPIO_RTIOC_TS, &value);
+               ret = ioctl(ti.fd_dev_intr, GPIO_RTIOC_TS_MONO, &value);
                if (ret) {
                        printf("ioctl gpio port ts, failed\n");
                        goto out;
Quoted 6 lines
Quoted 4 lines

Hardware env:
1. Rock PI X V1.4.
2. GPIO loopback connection between GPIO 334 and 335.

Did you check if timestamps are as expected (different)?

Quoted 3 lines

According to output of gpiobench, the inner Avg Latency would be vary large like ( 2814377.00000) after switch to MONO. But it is only about 16.879997 when we set REALTIME.

gpiobench takes timestamps from CLOCK_MONOTONIC (see clock_gettime calls)). If you compare them to REALTIME, that will give an offset. But you report just the opposite, this confuses me now...

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#8 lore raw
Quoted 53 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Tuesday, August 31, 2021 1:59 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH 0/3] add support for cherryview gpio controller driver

Quoted 44 lines · Hongzhan
Quoted 43 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Monday, August 30, 2021 3:37 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH 0/3] add support for cherryview gpio controller driver

Quoted 6 lines · Hongzhan Chen via Xenomai

1. move out of OF config conditional compilation so that non-OF platform call same API to remove rtdm gpio chip device.
2. Introduce helper to find gpiochip as referring to pair of rtdm_gpiochip_scan_of and rtdm_gpiochip_scan_array_of.
3. Add Intel Cherryview pinctrl driver based on on 1 and 2.

Looks good, except for that naming issue.

Quoted 19 lines

I also did following tests with this patchset:
1. run /usr/lib/xenomai/testsuite/gpiobench -i 334 -i 335 -c INT33FF:02 to validate patch 9afea5ff2d7ba97db96b22a005a9a7fcf5f2d892 when setting GPIO_RTIOC_TS
2. apply following patch, and rerun 1.

index f83d7689f..50afbd418 100644

testsuite/gpiobench/gpiobench.c +1 -1
@@ -619,7 +619,7 @@ int main(int argc, char **argv)
                        goto out;
                }
 
-               ret = ioctl(ti.fd_dev_intr, GPIO_RTIOC_TS, &value);
+               ret = ioctl(ti.fd_dev_intr, GPIO_RTIOC_TS_MONO, &value);
                if (ret) {
                        printf("ioctl gpio port ts, failed\n");
                        goto out;
Quoted 4 lines

Hardware env:
1. Rock PI X V1.4.
2. GPIO loopback connection between GPIO 334 and 335.

Did you check if timestamps are as expected (different)?

Quoted 7 lines
Quoted 3 lines

According to output of gpiobench, the inner Avg Latency would be vary large like ( 2814377.00000) after switch to MONO. But it is only about 16.879997 when we set REALTIME.

gpiobench takes timestamps from CLOCK_MONOTONIC (see clock_gettime calls)). If you compare them to REALTIME, that will give an offset. But you report just the opposite, this confuses me now...

The test is running on dovetail based 5.10.

Quoted 6 lines

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#9 lore raw
Quoted 57 lines · Hongzhan
Quoted 57 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Tuesday, August 31, 2021 1:59 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH 0/3] add support for cherryview gpio controller driver

Quoted 47 lines · Hongzhan
Quoted 37 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Monday, August 30, 2021 3:37 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH 0/3] add support for cherryview gpio controller driver

Quoted 6 lines · Hongzhan Chen via Xenomai

1. move out of OF config conditional compilation so that non-OF platform call same API to remove rtdm gpio chip device.
2. Introduce helper to find gpiochip as referring to pair of rtdm_gpiochip_scan_of and rtdm_gpiochip_scan_array_of.
3. Add Intel Cherryview pinctrl driver based on on 1 and 2.

Looks good, except for that naming issue.

Quoted 19 lines

I also did following tests with this patchset:
1. run /usr/lib/xenomai/testsuite/gpiobench -i 334 -i 335 -c INT33FF:02 to validate patch 9afea5ff2d7ba97db96b22a005a9a7fcf5f2d892 when setting GPIO_RTIOC_TS
2. apply following patch, and rerun 1.

index f83d7689f..50afbd418 100644

testsuite/gpiobench/gpiobench.c +1 -1
@@ -619,7 +619,7 @@ int main(int argc, char **argv)
                        goto out;
                }
 
-               ret = ioctl(ti.fd_dev_intr, GPIO_RTIOC_TS, &value);
+               ret = ioctl(ti.fd_dev_intr, GPIO_RTIOC_TS_MONO, &value);
                if (ret) {
                        printf("ioctl gpio port ts, failed\n");
                        goto out;
Quoted 6 lines
Quoted 4 lines

Hardware env:
1. Rock PI X V1.4.
2. GPIO loopback connection between GPIO 334 and 335.

Did you check if timestamps are as expected (different)?

According to output of gpiobench, the inner Avg Latency would be vary large like ( 2814377.00000) after switch to MONO. But it is only about 16.879997 when we set REALTIME.

Quoted 6 lines
Quoted 3 lines

gpiobench takes timestamps from CLOCK_MONOTONIC (see clock_gettime calls)). If you compare them to REALTIME, that will give an offset. But you report just the opposite, this confuses me now...

The test is running on dovetail based 5.10.

I missed one case in gpio_pin_interrupt where I need to check monotonic_timestamp - but, again, mono is what should remain fine, GPIO_RTIOC_TS_REAL (or GPIO_RTIOC_TS, the default) should give a delta.

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#10 lore raw
Quoted 59 lines
Quoted 59 lines

-----Original Message-----

Quoted 57 lines

From: Jan Kiszka <[email protected]>
Sent: Tuesday, August 31, 2021 1:59 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH 0/3] add support for cherryview gpio controller driver

Quoted 44 lines · Hongzhan
Quoted 37 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Monday, August 30, 2021 3:37 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH 0/3] add support for cherryview gpio controller driver

Quoted 6 lines · Hongzhan Chen via Xenomai

1. move out of OF config conditional compilation so that non-OF platform call same API to remove rtdm gpio chip device.
2. Introduce helper to find gpiochip as referring to pair of rtdm_gpiochip_scan_of and rtdm_gpiochip_scan_array_of.
3. Add Intel Cherryview pinctrl driver based on on 1 and 2.

Looks good, except for that naming issue.

Quoted 19 lines

I also did following tests with this patchset:
1. run /usr/lib/xenomai/testsuite/gpiobench -i 334 -i 335 -c INT33FF:02 to validate patch 9afea5ff2d7ba97db96b22a005a9a7fcf5f2d892 when setting GPIO_RTIOC_TS
2. apply following patch, and rerun 1.

index f83d7689f..50afbd418 100644

testsuite/gpiobench/gpiobench.c +1 -1
@@ -619,7 +619,7 @@ int main(int argc, char **argv)
                        goto out;
                }
 
-               ret = ioctl(ti.fd_dev_intr, GPIO_RTIOC_TS, &value);
+               ret = ioctl(ti.fd_dev_intr, GPIO_RTIOC_TS_MONO, &value);
                if (ret) {
                        printf("ioctl gpio port ts, failed\n");
                        goto out;
Quoted 6 lines
Quoted 4 lines

Hardware env:
1. Rock PI X V1.4.
2. GPIO loopback connection between GPIO 334 and 335.

Did you check if timestamps are as expected (different)?

Quoted 3 lines

According to output of gpiobench, the inner Avg Latency would be vary large like ( 2814377.00000) after switch to MONO. But it is only about 16.879997 when we set REALTIME.

gpiobench takes timestamps from CLOCK_MONOTONIC (see clock_gettime calls)). If you compare them to REALTIME, that will give an offset. But you report just the opposite, this confuses me now...

Quoted 6 lines
Quoted 2 lines

The test is running on dovetail based 5.10.

I missed one case in gpio_pin_interrupt where I need to check monotonic_timestamp - but, again, mono is what should remain fine, GPIO_RTIOC_TS_REAL (or GPIO_RTIOC_TS, the default) should give a delta.

I found there is one obvious gap for my comparison test.

For REALTEIM , it totally run 999999 like [1] till test normally exit. But for MONO, I force to quit during running because it may take several hours to finish and I can not wait like [2]. Let me rerun test and wait till it normally exit and get result to check.

[1]:
# Total: 000999999
# Min Latencies: 00013
# Avg Latencies: 16.879997
# Max Latencies: 00043
[2]:
# Total: 000083988
# Min Latencies: 00012
# Avg Latencies: 2814377.000000
# Max Latencies: 00041

Quoted 6 lines

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#11 lore raw
Quoted 72 lines · Hongzhan
Quoted 59 lines
Quoted 59 lines

-----Original Message-----

Quoted 57 lines

From: Jan Kiszka <[email protected]>
Sent: Tuesday, August 31, 2021 1:59 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH 0/3] add support for cherryview gpio controller driver

Quoted 44 lines · Hongzhan
Quoted 37 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Monday, August 30, 2021 3:37 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH 0/3] add support for cherryview gpio controller driver

Quoted 6 lines · Hongzhan Chen via Xenomai

1. move out of OF config conditional compilation so that non-OF platform call same API to remove rtdm gpio chip device.
2. Introduce helper to find gpiochip as referring to pair of rtdm_gpiochip_scan_of and rtdm_gpiochip_scan_array_of.
3. Add Intel Cherryview pinctrl driver based on on 1 and 2.

Looks good, except for that naming issue.

Quoted 19 lines

I also did following tests with this patchset:
1. run /usr/lib/xenomai/testsuite/gpiobench -i 334 -i 335 -c INT33FF:02 to validate patch 9afea5ff2d7ba97db96b22a005a9a7fcf5f2d892 when setting GPIO_RTIOC_TS
2. apply following patch, and rerun 1.

index f83d7689f..50afbd418 100644

testsuite/gpiobench/gpiobench.c +1 -1
@@ -619,7 +619,7 @@ int main(int argc, char **argv)
                        goto out;
                }
 
-               ret = ioctl(ti.fd_dev_intr, GPIO_RTIOC_TS, &value);
+               ret = ioctl(ti.fd_dev_intr, GPIO_RTIOC_TS_MONO, &value);
                if (ret) {
                        printf("ioctl gpio port ts, failed\n");
                        goto out;
Quoted 6 lines
Quoted 4 lines

Hardware env:
1. Rock PI X V1.4.
2. GPIO loopback connection between GPIO 334 and 335.

Did you check if timestamps are as expected (different)?

Quoted 3 lines

According to output of gpiobench, the inner Avg Latency would be vary large like ( 2814377.00000) after switch to MONO. But it is only about 16.879997 when we set REALTIME.

gpiobench takes timestamps from CLOCK_MONOTONIC (see clock_gettime calls)). If you compare them to REALTIME, that will give an offset. But you report just the opposite, this confuses me now...

Quoted 6 lines
Quoted 2 lines

The test is running on dovetail based 5.10.

I missed one case in gpio_pin_interrupt where I need to check monotonic_timestamp - but, again, mono is what should remain fine, GPIO_RTIOC_TS_REAL (or GPIO_RTIOC_TS, the default) should give a delta.

I found there is one obvious gap for my comparison test.

For REALTEIM , it totally run 999999 like [1] till test normally exit. But for MONO, I force to quit during running because it may take several hours to finish and I can not wait like [2]. Let me rerun test and wait till it normally exit and get result to check.

Quoted 11 lines

[1]:
# Total: 000999999
# Min Latencies: 00013
# Avg Latencies: 16.879997
# Max Latencies: 00043
[2]:
# Total: 000083988
# Min Latencies: 00012
# Avg Latencies: 2814377.000000
# Max Latencies: 00041

Were you able to resolve this mystery over latest next?

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#12 lore raw
Quoted 93 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Wednesday, September 1, 2021 10:27 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH 0/3] add support for cherryview gpio controller driver

Quoted 72 lines · Hongzhan
Quoted 59 lines
Quoted 59 lines

-----Original Message-----

Quoted 57 lines

From: Jan Kiszka <[email protected]>
Sent: Tuesday, August 31, 2021 1:59 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH 0/3] add support for cherryview gpio controller driver

Quoted 44 lines · Hongzhan
Quoted 37 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Monday, August 30, 2021 3:37 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH 0/3] add support for cherryview gpio controller driver

Quoted 6 lines · Hongzhan Chen via Xenomai

1. move out of OF config conditional compilation so that non-OF platform call same API to remove rtdm gpio chip device.
2. Introduce helper to find gpiochip as referring to pair of rtdm_gpiochip_scan_of and rtdm_gpiochip_scan_array_of.
3. Add Intel Cherryview pinctrl driver based on on 1 and 2.

Looks good, except for that naming issue.

Quoted 19 lines

I also did following tests with this patchset:
1. run /usr/lib/xenomai/testsuite/gpiobench -i 334 -i 335 -c INT33FF:02 to validate patch 9afea5ff2d7ba97db96b22a005a9a7fcf5f2d892 when setting GPIO_RTIOC_TS
2. apply following patch, and rerun 1.

index f83d7689f..50afbd418 100644

testsuite/gpiobench/gpiobench.c +1 -1
@@ -619,7 +619,7 @@ int main(int argc, char **argv)
                        goto out;
                }
 
-               ret = ioctl(ti.fd_dev_intr, GPIO_RTIOC_TS, &value);
+               ret = ioctl(ti.fd_dev_intr, GPIO_RTIOC_TS_MONO, &value);
                if (ret) {
                        printf("ioctl gpio port ts, failed\n");
                        goto out;
Quoted 6 lines
Quoted 4 lines

Hardware env:
1. Rock PI X V1.4.
2. GPIO loopback connection between GPIO 334 and 335.

Did you check if timestamps are as expected (different)?

Quoted 3 lines

According to output of gpiobench, the inner Avg Latency would be vary large like ( 2814377.00000) after switch to MONO. But it is only about 16.879997 when we set REALTIME.

gpiobench takes timestamps from CLOCK_MONOTONIC (see clock_gettime calls)). If you compare them to REALTIME, that will give an offset. But you report just the opposite, this confuses me now...

Quoted 6 lines
Quoted 2 lines

The test is running on dovetail based 5.10.

I missed one case in gpio_pin_interrupt where I need to check monotonic_timestamp - but, again, mono is what should remain fine, GPIO_RTIOC_TS_REAL (or GPIO_RTIOC_TS, the default) should give a delta.

I found there is one obvious gap for my comparison test.

For REALTEIM , it totally run 999999 like [1] till test normally exit. But for MONO, I force to quit during running because it may take several hours to finish and I can not wait like [2]. Let me rerun test and wait till it normally exit and get result to check.

Quoted 11 lines

[1]:
# Total: 000999999
# Min Latencies: 00013
# Avg Latencies: 16.879997
# Max Latencies: 00043
[2]:
# Total: 000083988
# Min Latencies: 00012
# Avg Latencies: 2814377.000000
# Max Latencies: 00041

Quoted 1 line

Were you able to resolve this mystery over latest next?

Yes. Firstly , I am doing complete test with passing MONO or REALTIME to check if this mystery large AVG latency still happen till gpiobench normally exit and do comparison test based on updated next code. And then figure out why it happen when gpiobench is interrupted during running and fix it if it is problem caused by timestamp.

Regards

Hongzhan Chen

Quoted 6 lines

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#13 lore raw
Quoted 93 lines · Hongzhan
Quoted 93 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Wednesday, September 1, 2021 10:27 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH 0/3] add support for cherryview gpio controller driver

Quoted 83 lines · Hongzhan
Quoted 59 lines
Quoted 59 lines

-----Original Message-----

Quoted 57 lines

From: Jan Kiszka <[email protected]>
Sent: Tuesday, August 31, 2021 1:59 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH 0/3] add support for cherryview gpio controller driver

Quoted 44 lines · Hongzhan
Quoted 37 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Monday, August 30, 2021 3:37 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH 0/3] add support for cherryview gpio controller driver

Quoted 6 lines · Hongzhan Chen via Xenomai

1. move out of OF config conditional compilation so that non-OF platform call same API to remove rtdm gpio chip device.
2. Introduce helper to find gpiochip as referring to pair of rtdm_gpiochip_scan_of and rtdm_gpiochip_scan_array_of.
3. Add Intel Cherryview pinctrl driver based on on 1 and 2.

Looks good, except for that naming issue.

Quoted 19 lines

I also did following tests with this patchset:
1. run /usr/lib/xenomai/testsuite/gpiobench -i 334 -i 335 -c INT33FF:02 to validate patch 9afea5ff2d7ba97db96b22a005a9a7fcf5f2d892 when setting GPIO_RTIOC_TS
2. apply following patch, and rerun 1.

index f83d7689f..50afbd418 100644

testsuite/gpiobench/gpiobench.c +1 -1
@@ -619,7 +619,7 @@ int main(int argc, char **argv)
                        goto out;
                }
 
-               ret = ioctl(ti.fd_dev_intr, GPIO_RTIOC_TS, &value);
+               ret = ioctl(ti.fd_dev_intr, GPIO_RTIOC_TS_MONO, &value);
                if (ret) {
                        printf("ioctl gpio port ts, failed\n");
                        goto out;
Quoted 6 lines
Quoted 4 lines

Hardware env:
1. Rock PI X V1.4.
2. GPIO loopback connection between GPIO 334 and 335.

Did you check if timestamps are as expected (different)?

Quoted 3 lines

According to output of gpiobench, the inner Avg Latency would be vary large like ( 2814377.00000) after switch to MONO. But it is only about 16.879997 when we set REALTIME.

gpiobench takes timestamps from CLOCK_MONOTONIC (see clock_gettime calls)). If you compare them to REALTIME, that will give an offset. But you report just the opposite, this confuses me now...

Quoted 6 lines
Quoted 2 lines

The test is running on dovetail based 5.10.

I missed one case in gpio_pin_interrupt where I need to check monotonic_timestamp - but, again, mono is what should remain fine, GPIO_RTIOC_TS_REAL (or GPIO_RTIOC_TS, the default) should give a delta.

I found there is one obvious gap for my comparison test.

For REALTEIM , it totally run 999999 like [1] till test normally exit. But for MONO, I force to quit during running because it may take several hours to finish and I can not wait like [2]. Let me rerun test and wait till it normally exit and get result to check.

[1]:
# Total: 000999999
# Min Latencies: 00013
# Avg Latencies: 16.879997
# Max Latencies: 00043
[2]:
# Total: 000083988
# Min Latencies: 00012
# Avg Latencies: 2814377.000000
# Max Latencies: 00041

Quoted 6 lines
Quoted 1 line

Were you able to resolve this mystery over latest next?

Yes. Firstly , I am doing complete test with passing MONO or REALTIME to check if this mystery large AVG latency still happen till gpiobench normally exit and do comparison test based on updated next code. And then figure out why it happen when gpiobench is interrupted during running and fix it if it is problem caused by timestamp.

So, you WILL do this, right? I'm asking because this is blocking -rc1, and I can't test here.

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#14 lore raw
Quoted 104 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Thursday, September 2, 2021 2:11 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH 0/3] add support for cherryview gpio controller driver

Quoted 95 lines · Hongzhan
Quoted 94 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Wednesday, September 1, 2021 10:27 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH 0/3] add support for cherryview gpio controller driver

Quoted 72 lines · Hongzhan
Quoted 59 lines
Quoted 59 lines

-----Original Message-----

Quoted 57 lines

From: Jan Kiszka <[email protected]>
Sent: Tuesday, August 31, 2021 1:59 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH 0/3] add support for cherryview gpio controller driver

Quoted 44 lines · Hongzhan
Quoted 37 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Monday, August 30, 2021 3:37 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH 0/3] add support for cherryview gpio controller driver

Quoted 6 lines · Hongzhan Chen via Xenomai

1. move out of OF config conditional compilation so that non-OF platform call same API to remove rtdm gpio chip device.
2. Introduce helper to find gpiochip as referring to pair of rtdm_gpiochip_scan_of and rtdm_gpiochip_scan_array_of.
3. Add Intel Cherryview pinctrl driver based on on 1 and 2.

Looks good, except for that naming issue.

Quoted 19 lines

I also did following tests with this patchset:
1. run /usr/lib/xenomai/testsuite/gpiobench -i 334 -i 335 -c INT33FF:02 to validate patch 9afea5ff2d7ba97db96b22a005a9a7fcf5f2d892 when setting GPIO_RTIOC_TS
2. apply following patch, and rerun 1.

index f83d7689f..50afbd418 100644

testsuite/gpiobench/gpiobench.c +1 -1
@@ -619,7 +619,7 @@ int main(int argc, char **argv)
                        goto out;
                }
 
-               ret = ioctl(ti.fd_dev_intr, GPIO_RTIOC_TS, &value);
+               ret = ioctl(ti.fd_dev_intr, GPIO_RTIOC_TS_MONO, &value);
                if (ret) {
                        printf("ioctl gpio port ts, failed\n");
                        goto out;
Quoted 6 lines
Quoted 4 lines

Hardware env:
1. Rock PI X V1.4.
2. GPIO loopback connection between GPIO 334 and 335.

Did you check if timestamps are as expected (different)?

Quoted 3 lines

According to output of gpiobench, the inner Avg Latency would be vary large like ( 2814377.00000) after switch to MONO. But it is only about 16.879997 when we set REALTIME.

gpiobench takes timestamps from CLOCK_MONOTONIC (see clock_gettime calls)). If you compare them to REALTIME, that will give an offset. But you report just the opposite, this confuses me now...

Quoted 6 lines
Quoted 2 lines

The test is running on dovetail based 5.10.

I missed one case in gpio_pin_interrupt where I need to check monotonic_timestamp - but, again, mono is what should remain fine, GPIO_RTIOC_TS_REAL (or GPIO_RTIOC_TS, the default) should give a delta.

I found there is one obvious gap for my comparison test.

For REALTEIM , it totally run 999999 like [1] till test normally exit. But for MONO, I force to quit during running because it may take several hours to finish and I can not wait like [2]. Let me rerun test and wait till it normally exit and get result to check.

Quoted 11 lines

[1]:
# Total: 000999999
# Min Latencies: 00013
# Avg Latencies: 16.879997
# Max Latencies: 00043
[2]:
# Total: 000083988
# Min Latencies: 00012
# Avg Latencies: 2814377.000000
# Max Latencies: 00041

Were you able to resolve this mystery over latest next?

Quoted 7 lines
Quoted 4 lines

Yes. Firstly , I am doing complete test with passing MONO or REALTIME to check if this mystery large AVG latency still happen till gpiobench normally exit and do comparison test based on updated next code. And then figure out why it happen when gpiobench is interrupted during running and fix it if it is problem caused by timestamp.

So, you WILL do this, right? I'm asking because this is blocking -rc1, and I can't test here.

Yes. I already found the root cause. It is caused by gpiobench itself. Because
It do not execute "ti.ts.inner_avg /= (ti.total_cycles * 2) when I use Ctrl+C to force the gpiobench to quit and inner_avg keep all sum of latency so that it is very large number. I will submit patch to review after I validate it.

Regards

Hongzhan Chen

Quoted 7 lines

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#15 lore raw
Quoted 109 lines · Hongzhan
Quoted 109 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Thursday, September 2, 2021 2:11 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH 0/3] add support for cherryview gpio controller driver

Quoted 99 lines · Hongzhan
Quoted 93 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Wednesday, September 1, 2021 10:27 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH 0/3] add support for cherryview gpio controller driver

Quoted 72 lines · Hongzhan
Quoted 59 lines
Quoted 59 lines

-----Original Message-----

Quoted 57 lines

From: Jan Kiszka <[email protected]>
Sent: Tuesday, August 31, 2021 1:59 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH 0/3] add support for cherryview gpio controller driver

Quoted 44 lines · Hongzhan
Quoted 37 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Monday, August 30, 2021 3:37 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH 0/3] add support for cherryview gpio controller driver

Quoted 6 lines · Hongzhan Chen via Xenomai

1. move out of OF config conditional compilation so that non-OF platform call same API to remove rtdm gpio chip device.
2. Introduce helper to find gpiochip as referring to pair of rtdm_gpiochip_scan_of and rtdm_gpiochip_scan_array_of.
3. Add Intel Cherryview pinctrl driver based on on 1 and 2.

Looks good, except for that naming issue.

Quoted 19 lines

I also did following tests with this patchset:
1. run /usr/lib/xenomai/testsuite/gpiobench -i 334 -i 335 -c INT33FF:02 to validate patch 9afea5ff2d7ba97db96b22a005a9a7fcf5f2d892 when setting GPIO_RTIOC_TS
2. apply following patch, and rerun 1.

index f83d7689f..50afbd418 100644

testsuite/gpiobench/gpiobench.c +1 -1
@@ -619,7 +619,7 @@ int main(int argc, char **argv)
                        goto out;
                }
 
-               ret = ioctl(ti.fd_dev_intr, GPIO_RTIOC_TS, &value);
+               ret = ioctl(ti.fd_dev_intr, GPIO_RTIOC_TS_MONO, &value);
                if (ret) {
                        printf("ioctl gpio port ts, failed\n");
                        goto out;
Quoted 6 lines
Quoted 4 lines

Hardware env:
1. Rock PI X V1.4.
2. GPIO loopback connection between GPIO 334 and 335.

Did you check if timestamps are as expected (different)?

Quoted 3 lines

According to output of gpiobench, the inner Avg Latency would be vary large like ( 2814377.00000) after switch to MONO. But it is only about 16.879997 when we set REALTIME.

gpiobench takes timestamps from CLOCK_MONOTONIC (see clock_gettime calls)). If you compare them to REALTIME, that will give an offset. But you report just the opposite, this confuses me now...

Quoted 6 lines
Quoted 2 lines

The test is running on dovetail based 5.10.

I missed one case in gpio_pin_interrupt where I need to check monotonic_timestamp - but, again, mono is what should remain fine, GPIO_RTIOC_TS_REAL (or GPIO_RTIOC_TS, the default) should give a delta.

I found there is one obvious gap for my comparison test.

For REALTEIM , it totally run 999999 like [1] till test normally exit. But for MONO, I force to quit during running because it may take several hours to finish and I can not wait like [2]. Let me rerun test and wait till it normally exit and get result to check.

Quoted 11 lines

[1]:
# Total: 000999999
# Min Latencies: 00013
# Avg Latencies: 16.879997
# Max Latencies: 00043
[2]:
# Total: 000083988
# Min Latencies: 00012
# Avg Latencies: 2814377.000000
# Max Latencies: 00041

Quoted 1 line

Were you able to resolve this mystery over latest next?

Yes. Firstly , I am doing complete test with passing MONO or REALTIME to check if this mystery large AVG latency still happen till gpiobench normally exit and do comparison test based on updated next code. And then figure out why it happen when gpiobench is interrupted during running and fix it if it is problem caused by timestamp.

Quoted 7 lines
Quoted 2 lines

So, you WILL do this, right? I'm asking because this is blocking -rc1, and I can't test here.

Yes. I already found the root cause. It is caused by gpiobench itself. Because
It do not execute "ti.ts.inner_avg /= (ti.total_cycles * 2) when I use Ctrl+C to force the gpiobench to quit and inner_avg keep all sum of latency so that it is very large number. I will submit patch to review after I validate it.

Ah, perfect, TIA!

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux