Skip to content

Commit 91e43ca

Browse files
jacob-kellerkuba-moo
authored andcommitted
ice: fix linking when CONFIG_PTP_1588_CLOCK=n
The recent support for DPLL introduced by commit 8a3a565 ("ice: add admin commands to access cgu configuration") and commit d7999f5 ("ice: implement dpll interface to control cgu") broke linking the ice driver if CONFIG_PTP_1588_CLOCK=n: ld: vmlinux.o: in function `ice_init_feature_support': (.text+0x8702b8): undefined reference to `ice_is_phy_rclk_present' ld: (.text+0x8702cd): undefined reference to `ice_is_cgu_present' ld: (.text+0x8702d9): undefined reference to `ice_is_clock_mux_present_e810t' ld: vmlinux.o: in function `ice_dpll_init_info_direct_pins': ice_dpll.c:(.text+0x894167): undefined reference to `ice_cgu_get_pin_freq_supp' ld: ice_dpll.c:(.text+0x894197): undefined reference to `ice_cgu_get_pin_name' ld: ice_dpll.c:(.text+0x8941a8): undefined reference to `ice_cgu_get_pin_type' ld: vmlinux.o: in function `ice_dpll_update_state': ice_dpll.c:(.text+0x894494): undefined reference to `ice_get_cgu_state' ld: vmlinux.o: in function `ice_dpll_init': (.text+0x8953d5): undefined reference to `ice_get_cgu_rclk_pin_info' The first commit broke things by calling functions in ice_init_feature_support that are compiled as part of ice_ptp_hw.o, including: * ice_is_phy_rclk_present * ice_is_clock_mux_present_e810t * ice_is_cgU_present The second commit continued the break by calling several CGU functions defined in ice_ptp_hw.c in the DPLL code. Because the ice_dpll.c file is compiled unconditionally, it will not link when CONFIG_PTP_1588_CLOCK=n. It might be possible to break this dependency and expose those functions without CONFIG_PTP_1588_CLOCK, but that is not clear to me. For the DPLL case, simply compile ice_dpll.o only when we have CONFIG_PTP_1588_CLOCK. Add stub no-op implementation of ice_dpll_init() and ice_dpll_uninit() when CONFIG_PTP_1588_CLOCK=n into ice_dpll.h The other functions are part of checking the netlist to see if hardware features are enabled. These checks don't really belong in ice_ptp_hw.c, and make more sense as part of the ice_common.c file. We already have ice_is_gps_in_netlist() in ice_common.c which is doing a similar check. Move the functions into ice_common.c and rename them to have the similar postfix of "in_netlist()" to be more expressive of what they are actually checking. This also makes the ice_find_netlist_node only called from within ice_common.c, so its safe to mark it static and stop declaring it in the ice_common.h header as well. Fixes: 8a3a565 ("ice: add admin commands to access cgu configuration") Fixes: d7999f5 ("ice: implement dpll interface to control cgu") Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected] Signed-off-by: Jacob Keller <[email protected]> Reviewed-by: Przemek Kitszel <[email protected]> Signed-off-by: Tony Nguyen <[email protected]> Reviewed-by: Simon Horman <[email protected]> Tested-by: Simon Horman <[email protected]> # build-tested Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 20767b2 commit 91e43ca

File tree

7 files changed

+76
-82
lines changed

7 files changed

+76
-82
lines changed

drivers/net/ethernet/intel/ice/Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ ice-y := ice_main.o \
3434
ice_lag.o \
3535
ice_ethtool.o \
3636
ice_repr.o \
37-
ice_tc_lib.o \
38-
ice_dpll.o
37+
ice_tc_lib.o
3938
ice-$(CONFIG_PCI_IOV) += \
4039
ice_sriov.o \
4140
ice_virtchnl.o \
@@ -44,7 +43,7 @@ ice-$(CONFIG_PCI_IOV) += \
4443
ice_vf_mbx.o \
4544
ice_vf_vsi_vlan_ops.o \
4645
ice_vf_lib.o
47-
ice-$(CONFIG_PTP_1588_CLOCK) += ice_ptp.o ice_ptp_hw.o
46+
ice-$(CONFIG_PTP_1588_CLOCK) += ice_ptp.o ice_ptp_hw.o ice_dpll.o
4847
ice-$(CONFIG_DCB) += ice_dcb.o ice_dcb_nl.o ice_dcb_lib.o
4948
ice-$(CONFIG_RFS_ACCEL) += ice_arfs.o
5049
ice-$(CONFIG_XDP_SOCKETS) += ice_xsk.o

drivers/net/ethernet/intel/ice/ice_common.c

Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -477,9 +477,8 @@ ice_aq_get_netlist_node(struct ice_hw *hw, struct ice_aqc_get_link_topo *cmd,
477477
* netlist. When found ICE_SUCCESS is returned, ICE_ERR_DOES_NOT_EXIST
478478
* otherwise. If node_handle provided, it would be set to found node handle.
479479
*/
480-
int
481-
ice_find_netlist_node(struct ice_hw *hw, u8 node_type_ctx, u8 node_part_number,
482-
u16 *node_handle)
480+
static int ice_find_netlist_node(struct ice_hw *hw, u8 node_type_ctx,
481+
u8 node_part_number, u16 *node_handle)
483482
{
484483
struct ice_aqc_get_link_topo cmd;
485484
u8 rec_node_part_number;
@@ -2764,6 +2763,67 @@ bool ice_is_pf_c827(struct ice_hw *hw)
27642763
return false;
27652764
}
27662765

2766+
/**
2767+
* ice_is_phy_rclk_in_netlist
2768+
* @hw: pointer to the hw struct
2769+
*
2770+
* Check if the PHY Recovered Clock device is present in the netlist
2771+
*/
2772+
bool ice_is_phy_rclk_in_netlist(struct ice_hw *hw)
2773+
{
2774+
if (ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_CTRL,
2775+
ICE_AQC_GET_LINK_TOPO_NODE_NR_C827, NULL) &&
2776+
ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_CTRL,
2777+
ICE_AQC_GET_LINK_TOPO_NODE_NR_E822_PHY, NULL))
2778+
return false;
2779+
2780+
return true;
2781+
}
2782+
2783+
/**
2784+
* ice_is_clock_mux_in_netlist
2785+
* @hw: pointer to the hw struct
2786+
*
2787+
* Check if the Clock Multiplexer device is present in the netlist
2788+
*/
2789+
bool ice_is_clock_mux_in_netlist(struct ice_hw *hw)
2790+
{
2791+
if (ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_MUX,
2792+
ICE_AQC_GET_LINK_TOPO_NODE_NR_GEN_CLK_MUX,
2793+
NULL))
2794+
return false;
2795+
2796+
return true;
2797+
}
2798+
2799+
/**
2800+
* ice_is_cgu_in_netlist - check for CGU presence
2801+
* @hw: pointer to the hw struct
2802+
*
2803+
* Check if the Clock Generation Unit (CGU) device is present in the netlist.
2804+
* Save the CGU part number in the hw structure for later use.
2805+
* Return:
2806+
* * true - cgu is present
2807+
* * false - cgu is not present
2808+
*/
2809+
bool ice_is_cgu_in_netlist(struct ice_hw *hw)
2810+
{
2811+
if (!ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_CTRL,
2812+
ICE_AQC_GET_LINK_TOPO_NODE_NR_ZL30632_80032,
2813+
NULL)) {
2814+
hw->cgu_part_number = ICE_AQC_GET_LINK_TOPO_NODE_NR_ZL30632_80032;
2815+
return true;
2816+
} else if (!ice_find_netlist_node(hw,
2817+
ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_CTRL,
2818+
ICE_AQC_GET_LINK_TOPO_NODE_NR_SI5383_5384,
2819+
NULL)) {
2820+
hw->cgu_part_number = ICE_AQC_GET_LINK_TOPO_NODE_NR_SI5383_5384;
2821+
return true;
2822+
}
2823+
2824+
return false;
2825+
}
2826+
27672827
/**
27682828
* ice_is_gps_in_netlist
27692829
* @hw: pointer to the hw struct

drivers/net/ethernet/intel/ice/ice_common.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ ice_aq_get_phy_caps(struct ice_port_info *pi, bool qual_mods, u8 report_mode,
9393
struct ice_aqc_get_phy_caps_data *caps,
9494
struct ice_sq_cd *cd);
9595
bool ice_is_pf_c827(struct ice_hw *hw);
96+
bool ice_is_phy_rclk_in_netlist(struct ice_hw *hw);
97+
bool ice_is_clock_mux_in_netlist(struct ice_hw *hw);
98+
bool ice_is_cgu_in_netlist(struct ice_hw *hw);
9699
bool ice_is_gps_in_netlist(struct ice_hw *hw);
97100
int
98-
ice_find_netlist_node(struct ice_hw *hw, u8 node_type_ctx, u8 node_part_number,
99-
u16 *node_handle);
100-
int
101101
ice_aq_get_netlist_node(struct ice_hw *hw, struct ice_aqc_get_link_topo *cmd,
102102
u8 *node_part_number, u16 *node_handle);
103103
int

drivers/net/ethernet/intel/ice/ice_dpll.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,12 @@ struct ice_dplls {
9797
s32 output_phase_adj_max;
9898
};
9999

100+
#if IS_ENABLED(CONFIG_PTP_1588_CLOCK)
100101
void ice_dpll_init(struct ice_pf *pf);
101-
102102
void ice_dpll_deinit(struct ice_pf *pf);
103+
#else
104+
static inline void ice_dpll_init(struct ice_pf *pf) { }
105+
static inline void ice_dpll_deinit(struct ice_pf *pf) { }
106+
#endif
103107

104108
#endif

drivers/net/ethernet/intel/ice/ice_lib.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3976,14 +3976,14 @@ void ice_init_feature_support(struct ice_pf *pf)
39763976
case ICE_DEV_ID_E810_XXV_QSFP:
39773977
case ICE_DEV_ID_E810_XXV_SFP:
39783978
ice_set_feature_support(pf, ICE_F_DSCP);
3979-
if (ice_is_phy_rclk_present(&pf->hw))
3979+
if (ice_is_phy_rclk_in_netlist(&pf->hw))
39803980
ice_set_feature_support(pf, ICE_F_PHY_RCLK);
39813981
/* If we don't own the timer - don't enable other caps */
39823982
if (!ice_pf_src_tmr_owned(pf))
39833983
break;
3984-
if (ice_is_cgu_present(&pf->hw))
3984+
if (ice_is_cgu_in_netlist(&pf->hw))
39853985
ice_set_feature_support(pf, ICE_F_CGU);
3986-
if (ice_is_clock_mux_present_e810t(&pf->hw))
3986+
if (ice_is_clock_mux_in_netlist(&pf->hw))
39873987
ice_set_feature_support(pf, ICE_F_SMA_CTRL);
39883988
if (ice_gnss_is_gps_present(&pf->hw))
39893989
ice_set_feature_support(pf, ICE_F_GNSS);

drivers/net/ethernet/intel/ice/ice_ptp_hw.c

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -3556,45 +3556,6 @@ int ice_clear_phy_tstamp(struct ice_hw *hw, u8 block, u8 idx)
35563556
}
35573557
}
35583558

3559-
/**
3560-
* ice_is_phy_rclk_present - check recovered clk presence
3561-
* @hw: pointer to the hw struct
3562-
*
3563-
* Check if the PHY Recovered Clock device is present in the netlist
3564-
* Return:
3565-
* * true - device found in netlist
3566-
* * false - device not found
3567-
*/
3568-
bool ice_is_phy_rclk_present(struct ice_hw *hw)
3569-
{
3570-
if (ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_CTRL,
3571-
ICE_AQC_GET_LINK_TOPO_NODE_NR_C827, NULL) &&
3572-
ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_CTRL,
3573-
ICE_AQC_GET_LINK_TOPO_NODE_NR_E822_PHY, NULL))
3574-
return false;
3575-
3576-
return true;
3577-
}
3578-
3579-
/**
3580-
* ice_is_clock_mux_present_e810t
3581-
* @hw: pointer to the hw struct
3582-
*
3583-
* Check if the Clock Multiplexer device is present in the netlist
3584-
* Return:
3585-
* * true - device found in netlist
3586-
* * false - device not found
3587-
*/
3588-
bool ice_is_clock_mux_present_e810t(struct ice_hw *hw)
3589-
{
3590-
if (ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_MUX,
3591-
ICE_AQC_GET_LINK_TOPO_NODE_NR_GEN_CLK_MUX,
3592-
NULL))
3593-
return false;
3594-
3595-
return true;
3596-
}
3597-
35983559
/**
35993560
* ice_get_pf_c827_idx - find and return the C827 index for the current pf
36003561
* @hw: pointer to the hw struct
@@ -3708,33 +3669,6 @@ int ice_get_phy_tx_tstamp_ready(struct ice_hw *hw, u8 block, u64 *tstamp_ready)
37083669
}
37093670
}
37103671

3711-
/**
3712-
* ice_is_cgu_present - check for CGU presence
3713-
* @hw: pointer to the hw struct
3714-
*
3715-
* Check if the Clock Generation Unit (CGU) device is present in the netlist
3716-
* Return:
3717-
* * true - cgu is present
3718-
* * false - cgu is not present
3719-
*/
3720-
bool ice_is_cgu_present(struct ice_hw *hw)
3721-
{
3722-
if (!ice_find_netlist_node(hw, ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_CTRL,
3723-
ICE_AQC_GET_LINK_TOPO_NODE_NR_ZL30632_80032,
3724-
NULL)) {
3725-
hw->cgu_part_number = ICE_AQC_GET_LINK_TOPO_NODE_NR_ZL30632_80032;
3726-
return true;
3727-
} else if (!ice_find_netlist_node(hw,
3728-
ICE_AQC_LINK_TOPO_NODE_TYPE_CLK_CTRL,
3729-
ICE_AQC_GET_LINK_TOPO_NODE_NR_SI5383_5384,
3730-
NULL)) {
3731-
hw->cgu_part_number = ICE_AQC_GET_LINK_TOPO_NODE_NR_SI5383_5384;
3732-
return true;
3733-
}
3734-
3735-
return false;
3736-
}
3737-
37383672
/**
37393673
* ice_cgu_get_pin_desc_e823 - get pin description array
37403674
* @hw: pointer to the hw struct

drivers/net/ethernet/intel/ice/ice_ptp_hw.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,10 +271,7 @@ int ice_read_sma_ctrl_e810t(struct ice_hw *hw, u8 *data);
271271
int ice_write_sma_ctrl_e810t(struct ice_hw *hw, u8 data);
272272
int ice_read_pca9575_reg_e810t(struct ice_hw *hw, u8 offset, u8 *data);
273273
bool ice_is_pca9575_present(struct ice_hw *hw);
274-
bool ice_is_phy_rclk_present(struct ice_hw *hw);
275-
bool ice_is_clock_mux_present_e810t(struct ice_hw *hw);
276274
int ice_get_pf_c827_idx(struct ice_hw *hw, u8 *idx);
277-
bool ice_is_cgu_present(struct ice_hw *hw);
278275
enum dpll_pin_type ice_cgu_get_pin_type(struct ice_hw *hw, u8 pin, bool input);
279276
struct dpll_pin_frequency *
280277
ice_cgu_get_pin_freq_supp(struct ice_hw *hw, u8 pin, bool input, u8 *num);

0 commit comments

Comments
 (0)