Skip to contentSkip to conversation

Add missing facility check to ptp_s390 driver

PATCH Applied Sven Schnelle 3 participants 6 messages Jul 14 – Jul 23

Subsystems (5)
lore
Share & tools
lore

Sven Schnelle

author maintainer
#0 lore raw

v2 cover Add missing facility check to ptp_s390 driver

This patchset adds a missing facility check and a check that the 'query physical clock' (PTFF QPT) function is actually available. If it's not present, no qpt ptp device will be registered. In order to use ptff_query() in a module, the first patch adds a EXPORT_SYMBOL() to export ptff_function_mask.

Changes in v2:
- drop CC check
- add PTFF QAF check
- add patch to export ptff_function_mask

Sven Schnelle (2):
s390/ptff: Export ptff_function_mask[]
ptp: ptp_s390: Add missing facility check

 arch/s390/kernel/time.c | 1 +
 drivers/ptp/ptp_s390.c  | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

--
2.55.0

author maintainer
#1 lore raw

PATCH v2 1/2 s390/ptff: Export ptff_function_mask[]

Export the ptff_function_mask to make ptff_query() usable in modules.

---
 arch/s390/kernel/time.c | 1 +
 1 file changed, 1 insertion(+)
arch/s390/kernel/time.c +1 -0
index bd0df61d1907..2b989bebd220 100644
@@ -65,6 +65,7 @@ ATOMIC_NOTIFIER_HEAD(s390_epoch_delta_notifier);
 EXPORT_SYMBOL(s390_epoch_delta_notifier);
 
 unsigned char ptff_function_mask[16];
+EXPORT_SYMBOL(ptff_function_mask);
 
 static unsigned long lpar_offset;
 static unsigned long initial_leap_seconds;
Signature · 1 line
2.55.0
author maintainer
#3 lore raw

PATCH v2 2/2 ptp: ptp_s390: Add missing facility check

In reply to Sven Schnelle

Only register the physical clock when facility 28 is installed and PTFF QAF returns that PTFF QPT is available.

Fixes 2d7de7a3010d ("s390/time: Add PtP driver")
---
 drivers/ptp/ptp_s390.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/ptp/ptp_s390.c +5 -1
index 29618eb9bf44..02d624d89a0a 100644
@@ -107,6 +107,9 @@ static __init int ptp_s390_init(void)
 	if (IS_ERR(ptp_stcke_clock))
 		return PTR_ERR(ptp_stcke_clock);
 
+	if (!test_facility(28) || !ptff_query(PTFF_QPT))
+		return 0;
+
 	ptp_qpt_clock = ptp_clock_register(&ptp_s390_qpt_info, NULL);
 	if (IS_ERR(ptp_qpt_clock)) {
 		ptp_clock_unregister(ptp_stcke_clock);
@@ -117,7 +120,8 @@ static __init int ptp_s390_init(void)
 
 static __exit void ptp_s390_exit(void)
 {
-	ptp_clock_unregister(ptp_qpt_clock);
+	if (ptp_qpt_clock)
+		ptp_clock_unregister(ptp_qpt_clock);
 	ptp_clock_unregister(ptp_stcke_clock);
 }
 
Signature · 1 line
2.55.0
maintainer Reviewed-by on v2 2/2
#4 lore raw

Re: [PATCH v2 2/2] ptp: ptp_s390: Add missing facility check

Quoted 9 lines · Sven Schnelle

Only register the physical clock when facility 28 is installed and PTFF QAF returns that PTFF QPT is available.

Fixes 2d7de7a3010d ("s390/time: Add PtP driver")
---
 drivers/ptp/ptp_s390.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
#5 lore raw
In reply to Sven Schnelle
This series was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 6 lines · On Tue, 14 Jul 2026 15:03:40 +0200 you wrote:

This patchset adds a missing facility check and a check that the 'query physical clock' (PTFF QPT) function is actually available. If it's not present, no qpt ptp device will be registered. In order to use ptff_query() in a module, the first patch adds a EXPORT_SYMBOL() to export ptff_function_mask.

Quoted 6 lines

Changes in v2:
- drop CC check
- add PTFF QAF check
- add patch to export ptff_function_mask

[...]

Here is the summary with links:
- [v2,1/2] s390/ptff: Export ptff_function_mask[]

    https://git.kernel.org/netdev/net/c/9de445d8296a
  - [v2,2/2] ptp: ptp_s390: Add missing facility check
    https://git.kernel.org/netdev/net/c/e78f1ac37afc

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html