mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-09-18 22:59:29 +02:00
Commit 42e2a9e11a ("net: phy: dp83640: improve phydev and driver
removal handling") moved per-bus clock cleanup from module exit to the
remove path. This leaves two lifetime problems.
dp83640_clock_get_bus() publishes a newly allocated clock before the
driver allocates its per-PHY data and registers the PTP clock. If either
operation fails, no PHY is bound and the remove callback cannot release
the clock, leaking the clock and the MII bus device reference.
The remove path can also free a clock after dropping clock_lock. A
concurrent probe may already have found the clock under
phyter_clocks_lock and be waiting for clock_lock, allowing it to acquire
a freed mutex and access the freed clock.
Use the PHY package infrastructure for the per-bus clock. PHY packages
are tracked per MII bus, and the driver uses BROADCAST_ADDR as the
package key so the DP83640 PHYs on the same bus share the same clock
storage. Call phy_package_join() during probe and phy_package_leave() on
probe errors and in remove.
Serialize the one-time clock initialization with the package lock because
phy_package_probe_once() elects an initializer but does not wait for
initialization to finish.
Cc: stable+noautosel@kernel.org # untested fix to a driver init path
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
Link: https://patch.msgid.link/20260811151345.73582-5-xuanqiang.luo@linux.dev
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
268 lines
8.9 KiB
Plaintext
268 lines
8.9 KiB
Plaintext
# SPDX-License-Identifier: GPL-2.0-only
|
|
#
|
|
# PTP clock support configuration
|
|
#
|
|
|
|
menu "PTP clock support"
|
|
|
|
config PTP_1588_CLOCK
|
|
tristate "PTP clock support"
|
|
depends on NET && POSIX_TIMERS
|
|
default ETHERNET
|
|
select PPS
|
|
select NET_PTP_CLASSIFY
|
|
help
|
|
The IEEE 1588 standard defines a method to precisely
|
|
synchronize distributed clocks over Ethernet networks. The
|
|
standard defines a Precision Time Protocol (PTP), which can
|
|
be used to achieve synchronization within a few dozen
|
|
microseconds. In addition, with the help of special hardware
|
|
time stamping units, it can be possible to achieve
|
|
synchronization to within a few hundred nanoseconds.
|
|
|
|
This driver adds support for PTP clocks as character
|
|
devices. If you want to use a PTP clock, then you should
|
|
also enable at least one clock driver as well.
|
|
|
|
To compile this driver as a module, choose M here: the module
|
|
will be called ptp.
|
|
|
|
config PTP_1588_CLOCK_OPTIONAL
|
|
tristate
|
|
default y if PTP_1588_CLOCK=n
|
|
default PTP_1588_CLOCK
|
|
help
|
|
Drivers that can optionally use the PTP_1588_CLOCK framework
|
|
should depend on this symbol to prevent them from being built
|
|
into vmlinux while the PTP support itself is in a loadable
|
|
module.
|
|
If PTP support is disabled, this dependency will still be
|
|
met, and drivers refer to dummy helpers.
|
|
|
|
config PTP_1588_CLOCK_DTE
|
|
tristate "Broadcom DTE as PTP clock"
|
|
depends on PTP_1588_CLOCK
|
|
depends on NET && HAS_IOMEM
|
|
depends on ARCH_BCM_MOBILE || (ARCH_BCM_IPROC && !(ARCH_BCM_NSP || ARCH_BCM_5301X)) || COMPILE_TEST
|
|
default y if ARCH_BCM_MOBILE || ARCH_BCM_IPROC
|
|
help
|
|
This driver adds support for using the Digital timing engine
|
|
(DTE) in the Broadcom SoC's as a PTP clock.
|
|
|
|
The clock can be used in both wired and wireless networks
|
|
for PTP purposes.
|
|
|
|
To compile this driver as a module, choose M here: the module
|
|
will be called ptp_dte.
|
|
|
|
config PTP_1588_CLOCK_QORIQ
|
|
tristate "Freescale QorIQ 1588 timer as PTP clock"
|
|
depends on GIANFAR || FSL_DPAA_ETH || FSL_DPAA2_ETH || FSL_ENETC || FSL_ENETC_VF || COMPILE_TEST
|
|
depends on PTP_1588_CLOCK
|
|
default y if GIANFAR || FSL_DPAA_ETH || FSL_DPAA2_ETH || FSL_ENETC || FSL_ENETC_VF
|
|
help
|
|
This driver adds support for using the Freescale QorIQ 1588
|
|
timer as a PTP clock. This clock is only useful if your PTP
|
|
programs are getting hardware time stamps on the PTP Ethernet
|
|
packets using the SO_TIMESTAMPING API.
|
|
|
|
To compile this driver as a module, choose M here: the module
|
|
will be called ptp_qoriq.
|
|
|
|
comment "Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks."
|
|
depends on PHYLIB=n || NETWORK_PHY_TIMESTAMPING=n
|
|
|
|
config DP83640_PHY
|
|
tristate "Driver for the National Semiconductor DP83640 PHYTER"
|
|
depends on NETWORK_PHY_TIMESTAMPING
|
|
depends on PHYLIB
|
|
depends on PTP_1588_CLOCK
|
|
select CRC32
|
|
select PHY_PACKAGE
|
|
help
|
|
Supports the DP83640 PHYTER with IEEE 1588 features.
|
|
|
|
This driver adds support for using the DP83640 as a PTP
|
|
clock. This clock is only useful if your PTP programs are
|
|
getting hardware time stamps on the PTP Ethernet packets
|
|
using the SO_TIMESTAMPING API.
|
|
|
|
In order for this to work, your MAC driver must also
|
|
implement the skb_tx_timestamp() function.
|
|
|
|
config PTP_1588_CLOCK_INES
|
|
tristate "ZHAW InES PTP time stamping IP core"
|
|
depends on NETWORK_PHY_TIMESTAMPING
|
|
depends on HAS_IOMEM
|
|
depends on PHYLIB
|
|
depends on PTP_1588_CLOCK
|
|
help
|
|
This driver adds support for using the ZHAW InES 1588 IP
|
|
core. This clock is only useful if the MII bus of your MAC
|
|
is wired up to the core.
|
|
|
|
config PTP_1588_CLOCK_PCH
|
|
tristate "Intel PCH EG20T as PTP clock"
|
|
depends on MIPS_GENERIC || X86_32 || COMPILE_TEST
|
|
depends on HAS_IOMEM && PCI
|
|
depends on NET
|
|
depends on PTP_1588_CLOCK
|
|
help
|
|
This driver adds support for using the PCH EG20T as a PTP
|
|
clock. The hardware supports time stamping of PTP packets
|
|
when using the end-to-end delay (E2E) mechanism. The peer
|
|
delay mechanism (P2P) is not supported.
|
|
|
|
This clock is only useful if your PTP programs are getting
|
|
hardware time stamps on the PTP Ethernet packets using the
|
|
SO_TIMESTAMPING API.
|
|
|
|
To compile this driver as a module, choose M here: the module
|
|
will be called ptp_pch.
|
|
|
|
config PTP_1588_CLOCK_KVM
|
|
tristate "KVM virtual PTP clock"
|
|
depends on PTP_1588_CLOCK
|
|
depends on (KVM_GUEST && X86) || (HAVE_ARM_SMCCC_DISCOVERY && ARM_ARCH_TIMER)
|
|
default y
|
|
help
|
|
This driver adds support for using kvm infrastructure as a PTP
|
|
clock. This clock is only useful if you are using KVM guests.
|
|
|
|
To compile this driver as a module, choose M here: the module
|
|
will be called ptp_kvm.
|
|
|
|
config PTP_1588_CLOCK_VMCLOCK
|
|
tristate "Virtual machine PTP clock"
|
|
depends on X86_TSC || ARM_ARCH_TIMER
|
|
depends on PTP_1588_CLOCK && ARCH_SUPPORTS_INT128
|
|
default PTP_1588_CLOCK_KVM
|
|
help
|
|
This driver adds support for using a virtual precision clock
|
|
advertised by the hypervisor. This clock is only useful in virtual
|
|
machines where such a device is present.
|
|
|
|
Unlike the KVM virtual PTP clock, the VMCLOCK device offers support
|
|
for reliable timekeeping even across live migration. So this driver
|
|
is enabled by default whenever the KVM PTP clock is.
|
|
|
|
To compile this driver as a module, choose M here: the module
|
|
will be called ptp_vmclock.
|
|
|
|
config PTP_1588_CLOCK_IDT82P33
|
|
tristate "IDT 82P33xxx PTP clock"
|
|
depends on PTP_1588_CLOCK && I2C
|
|
default n
|
|
help
|
|
This driver adds support for using the IDT 82P33xxx as a PTP
|
|
clock. This clock is only useful if your time stamping MAC
|
|
is connected to the IDT chip.
|
|
|
|
To compile this driver as a module, choose M here: the module
|
|
will be called ptp_idt82p33.
|
|
|
|
config PTP_1588_CLOCK_IDTCM
|
|
tristate "IDT CLOCKMATRIX as PTP clock"
|
|
depends on PTP_1588_CLOCK && I2C
|
|
default n
|
|
help
|
|
This driver adds support for using IDT CLOCKMATRIX(TM) as a PTP
|
|
clock. This clock is only useful if your time stamping MAC
|
|
is connected to the IDT chip.
|
|
|
|
To compile this driver as a module, choose M here: the module
|
|
will be called ptp_clockmatrix.
|
|
|
|
config PTP_1588_CLOCK_FC3W
|
|
tristate "RENESAS FemtoClock3 Wireless as PTP clock"
|
|
depends on PTP_1588_CLOCK && I2C
|
|
default n
|
|
help
|
|
This driver adds support for using Renesas FemtoClock3 Wireless
|
|
as a PTP clock. This clock is only useful if your time stamping
|
|
MAC is connected to the RENESAS chip.
|
|
|
|
To compile this driver as a module, choose M here: the module
|
|
will be called ptp_fc3.
|
|
|
|
config PTP_1588_CLOCK_MOCK
|
|
tristate "Mock-up PTP clock"
|
|
depends on PTP_1588_CLOCK
|
|
help
|
|
This driver offers a set of PTP clock manipulation operations over
|
|
the system monotonic time. It can be used by virtual network device
|
|
drivers to emulate PTP capabilities.
|
|
|
|
To compile this driver as a module, choose M here: the module
|
|
will be called ptp_mock.
|
|
|
|
config PTP_1588_CLOCK_VMW
|
|
tristate "VMware virtual PTP clock"
|
|
depends on ACPI && HYPERVISOR_GUEST && X86
|
|
depends on PTP_1588_CLOCK
|
|
help
|
|
This driver adds support for using VMware virtual precision
|
|
clock device as a PTP clock. This is only useful in virtual
|
|
machines running on VMware virtual infrastructure.
|
|
|
|
To compile this driver as a module, choose M here: the module
|
|
will be called ptp_vmw.
|
|
|
|
config PTP_1588_CLOCK_OCP
|
|
tristate "OpenCompute TimeCard as PTP clock"
|
|
depends on PTP_1588_CLOCK
|
|
depends on HAS_IOMEM && PCI
|
|
depends on I2C && MTD
|
|
depends on SERIAL_8250
|
|
depends on !S390
|
|
depends on COMMON_CLK
|
|
select NET_DEVLINK
|
|
select CRC16
|
|
select DPLL
|
|
help
|
|
This driver adds support for an OpenCompute time card.
|
|
|
|
The OpenCompute time card is an atomic clock along with
|
|
a GPS receiver that provides a Grandmaster clock source
|
|
for a PTP enabled network.
|
|
|
|
More information is available at http://www.timingcard.com/
|
|
|
|
config PTP_DFL_TOD
|
|
tristate "FPGA DFL ToD Driver"
|
|
depends on FPGA_DFL
|
|
depends on PTP_1588_CLOCK
|
|
help
|
|
The DFL (Device Feature List) device driver for the Intel ToD
|
|
(Time-of-Day) device in FPGA card. The ToD IP within the FPGA
|
|
is exposed as PTP Hardware Clock (PHC) device to the Linux PTP
|
|
stack to synchronize the system clock to its ToD information
|
|
using phc2sys utility of the Linux PTP stack.
|
|
|
|
To compile this driver as a module, choose M here: the module
|
|
will be called ptp_dfl_tod.
|
|
|
|
config PTP_S390
|
|
tristate "S390 PTP driver"
|
|
depends on PTP_1588_CLOCK
|
|
depends on S390
|
|
help
|
|
This driver adds support for S390 time steering via the PtP
|
|
interface. This works by adding a in-kernel clock delta value,
|
|
which is always added to time values used in the kernel. The PtP
|
|
driver provides the raw clock value without the delta to
|
|
userspace. That way userspace programs like chrony could steer
|
|
the kernel clock.
|
|
|
|
config PTP_NETC_V4_TIMER
|
|
tristate "NXP NETC V4 Timer PTP Driver"
|
|
depends on PTP_1588_CLOCK
|
|
depends on PCI_MSI
|
|
help
|
|
This driver adds support for using the NXP NETC V4 Timer as a PTP
|
|
clock, the clock is used by ENETC V4 or NETC V4 Switch for PTP time
|
|
synchronization. It also supports periodic output signal (e.g. PPS)
|
|
and external trigger timestamping.
|
|
|
|
endmenu
|