* [PATCH 0/2] Fix two issues in ptp_s390 driver
@ 2026-07-14 8:49 Sven Schnelle
2026-07-14 8:49 ` [PATCH 1/2] ptp: ptp_s390: Add missing CC check for ptff() Sven Schnelle
2026-07-14 8:49 ` [PATCH 2/2] ptp: ptp_s390: Add missing facility check Sven Schnelle
0 siblings, 2 replies; 4+ messages in thread
From: Sven Schnelle @ 2026-07-14 8:49 UTC (permalink / raw)
To: Richard Cochran
Cc: netdev, linux-s390, linux-kernel, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev
This patchset fixes two issues in the ptp_s390 driver:
a) Missing check of condition code in qpt query function. When PTFF QPT is
not supported ptp_s390_qpt_gettime() would just return without storing
the physical time.
b) Missing test for presence of facility 28 during driver registration.
Sven Schnelle (2):
ptp: ptp_s390: Add missing CC check for ptff()
ptp: ptp_s390: Add missing facility check
drivers/ptp/ptp_s390.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] ptp: ptp_s390: Add missing CC check for ptff()
2026-07-14 8:49 [PATCH 0/2] Fix two issues in ptp_s390 driver Sven Schnelle
@ 2026-07-14 8:49 ` Sven Schnelle
2026-07-14 8:49 ` [PATCH 2/2] ptp: ptp_s390: Add missing facility check Sven Schnelle
1 sibling, 0 replies; 4+ messages in thread
From: Sven Schnelle @ 2026-07-14 8:49 UTC (permalink / raw)
To: Richard Cochran
Cc: netdev, linux-s390, linux-kernel, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev
The code doesn't honor the returned condition code when issuing
the PTFF_QPT call. Fix this by checking the return code and returning
EIO if it is not zero.
Fixes: 2d7de7a3010d ("s390/time: Add PtP driver")
Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Cc: stable@kernel.org
---
drivers/ptp/ptp_s390.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/ptp/ptp_s390.c b/drivers/ptp/ptp_s390.c
index 29618eb9bf44..7299c3aae65f 100644
--- a/drivers/ptp/ptp_s390.c
+++ b/drivers/ptp/ptp_s390.c
@@ -48,7 +48,8 @@ static int ptp_s390_qpt_gettime(struct ptp_clock_info *ptp,
{
unsigned long tod;
- ptff(&tod, sizeof(tod), PTFF_QPT);
+ if (ptff(&tod, sizeof(tod), PTFF_QPT) != 0)
+ return -EOPNOTSUPP;
*ts = tod_to_timespec64(tod);
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] ptp: ptp_s390: Add missing facility check
2026-07-14 8:49 [PATCH 0/2] Fix two issues in ptp_s390 driver Sven Schnelle
2026-07-14 8:49 ` [PATCH 1/2] ptp: ptp_s390: Add missing CC check for ptff() Sven Schnelle
@ 2026-07-14 8:49 ` Sven Schnelle
2026-07-14 9:39 ` Heiko Carstens
1 sibling, 1 reply; 4+ messages in thread
From: Sven Schnelle @ 2026-07-14 8:49 UTC (permalink / raw)
To: Richard Cochran
Cc: netdev, linux-s390, linux-kernel, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev
Only register the physical clock when facility 28 is installed.
Fixes: 2d7de7a3010d ("s390/time: Add PtP driver")
Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Cc: stable@kernel.org
---
drivers/ptp/ptp_s390.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/ptp/ptp_s390.c b/drivers/ptp/ptp_s390.c
index 7299c3aae65f..3ea94648cdde 100644
--- a/drivers/ptp/ptp_s390.c
+++ b/drivers/ptp/ptp_s390.c
@@ -108,6 +108,9 @@ static __init int ptp_s390_init(void)
if (IS_ERR(ptp_stcke_clock))
return PTR_ERR(ptp_stcke_clock);
+ if (!test_facility(28))
+ 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);
@@ -118,7 +121,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);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] ptp: ptp_s390: Add missing facility check
2026-07-14 8:49 ` [PATCH 2/2] ptp: ptp_s390: Add missing facility check Sven Schnelle
@ 2026-07-14 9:39 ` Heiko Carstens
0 siblings, 0 replies; 4+ messages in thread
From: Heiko Carstens @ 2026-07-14 9:39 UTC (permalink / raw)
To: Sven Schnelle
Cc: Richard Cochran, netdev, linux-s390, linux-kernel,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Vasily Gorbik, Alexander Gordeev
On Tue, Jul 14, 2026 at 10:49:21AM +0200, Sven Schnelle wrote:
> Only register the physical clock when facility 28 is installed.
>
> Fixes: 2d7de7a3010d ("s390/time: Add PtP driver")
> Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
> Cc: stable@kernel.org
> ---
> drivers/ptp/ptp_s390.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/ptp/ptp_s390.c b/drivers/ptp/ptp_s390.c
> index 7299c3aae65f..3ea94648cdde 100644
> --- a/drivers/ptp/ptp_s390.c
> +++ b/drivers/ptp/ptp_s390.c
> @@ -108,6 +108,9 @@ static __init int ptp_s390_init(void)
> if (IS_ERR(ptp_stcke_clock))
> return PTR_ERR(ptp_stcke_clock);
>
> + if (!test_facility(28))
> + 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);
Wouldn't it make more sense to check if PTFF-QPT is available via PTFF-QAF
before registering the clock? This would also avoid the need of the first
patch - since then it is guaranteed that PTFF-QPT will always return with
condition code zero.
And... we wouldn't have the potential oddity to have a clock registered which
doesn't work.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-07-14 9:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-14 8:49 [PATCH 0/2] Fix two issues in ptp_s390 driver Sven Schnelle
2026-07-14 8:49 ` [PATCH 1/2] ptp: ptp_s390: Add missing CC check for ptff() Sven Schnelle
2026-07-14 8:49 ` [PATCH 2/2] ptp: ptp_s390: Add missing facility check Sven Schnelle
2026-07-14 9:39 ` Heiko Carstens
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox