Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 2 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The patch deletes the `pin_num > ARRAY_SIZE(labels)` (16)
bound from ice_dpll_init_info_pins_generic()…
- [Medium] In the generic path, two independent sources now decide
whether an input is a recovered-clock parent.
--
ice: describe generic DPLL pins from firmware pin classification
This commit changes how generic DPLL pins are described. Their names,
types and supported frequencies now come from the classification
returned by firmware in Get CGU Input Config, instead of the shared
numeric labels "0" to "15". Inputs become GNSS-<n>, RCLK-<n>, EXT-<n> or
IN-<n>, outputs become OUT-<n>, and the 16 pin limit in the generic path
is removed.
> diff --git a/drivers/net/ethernet/intel/ice/ice_dpll.c b/drivers/net/ethernet/intel/ice/ice_dpll.c
> index 1c853fd4a6bda..889d0e40b8bf4 100644
> --- a/drivers/net/ethernet/intel/ice/ice_dpll.c
> +++ b/drivers/net/ethernet/intel/ice/ice_dpll.c
[ ... ]
> +static int
> +ice_dpll_init_info_pin_generic_input(struct ice_pf *pf, struct ice_dpll_pin *pin)
> +{
> + u8 type, caps, num;
> + const char *kind;
> + int ret;
> +
> + ret = ice_aq_get_input_pin_cfg(&pf->hw, pin->idx, NULL, &type, &caps,
> + NULL, NULL, NULL);
> + if (ret)
> + return ret;
> +
> + if (type & ICE_AQC_GET_CGU_IN_CFG_TYPE_GPS) {
> + pin->prop.type = DPLL_PIN_TYPE_GNSS;
> + kind = "GNSS";
> + } else if (type & ICE_AQC_GET_CGU_IN_CFG_TYPE_PHY) {
> + pin->prop.type = DPLL_PIN_TYPE_MUX;
> + kind = "RCLK";
> + } else if (type & ICE_AQC_GET_CGU_IN_CFG_TYPE_EXTERNAL) {
> + pin->prop.type = DPLL_PIN_TYPE_EXT;
> + kind = "EXT";
> + if (caps & ICE_AQC_GET_CGU_IN_CFG_FLG1_ANYFREQ)
> + caps |= ICE_AQC_GET_CGU_IN_CFG_FLG1_1PPS_SUPP |
> + ICE_AQC_GET_CGU_IN_CFG_FLG1_10MHZ_SUPP;
> + } else {
> + pin->prop.type = pin->freq == ICE_DPLL_PIN_GEN_RCLK_FREQ ?
> + DPLL_PIN_TYPE_MUX : DPLL_PIN_TYPE_EXT;
> + kind = "IN";
> + }
[Severity: Medium]
In the generic path, can this classification disagree with the recovered
clock parent indexes that the driver works out separately?
ice_get_cgu_rclk_pin_info() in ice_ptp_hw.c still hardcodes the RCLK
parent inputs based on the device ID. On E810C, for example:
*base_idx = E810T_CGU_INPUT_C827(phy_idx, ICE_RCLKA_PIN);
Those become pf->dplls.rclk.parent_idx[i] = base_rclk_idx + i.
Later, ice_dpll_init_pin_common() registers the RCLK pin on top of
inputs[parent_idx[i]]:
ret = dpll_pin_on_pin_register(parent->pin, pin->pin, ops, pin);
dpll_pin_on_pin_register() requires the parent to be a MUX:
if (WARN_ON(parent->prop.type != DPLL_PIN_TYPE_MUX))
return -EINVAL;
With this change, the ICE_DPLL_PIN_GEN_RCLK_FREQ rule only applies when
firmware sets no kind bit. Suppose firmware reports GPS or EXTERNAL for an
input at one of the hardcoded RCLK indexes. That input then becomes GNSS
or EXT even if it runs at the RCLK frequency, and before this patch it
would have been MUX.
Would that trigger the WARN_ON and fail ice_dpll_init_rclk_pin()? That
failure would unwind ice_dpll_init_pins() and leave the PF without DPLL
support.
Should the firmware type be checked against rclk.parent_idx[], or should
the known parent indexes always be MUX?
> + snprintf(pin->label, sizeof(pin->label), "%s-%u", kind, pin->idx);
> + pin->prop.board_label = pin->label;
[ ... ]
> @@ -4756,12 +4803,9 @@ static int ice_dpll_init_info_pins_generic(struct ice_pf *pf, bool input)
> phase_adj_max = pf->dplls.output_phase_adj_max;
> pin_type = ICE_DPLL_PIN_TYPE_OUTPUT;
> }
> - if (pin_num > ARRAY_SIZE(labels))
> - return ret;
>
> for (i = 0; i < pin_num; i++) {
[Severity: Medium]
The commit message says the 16 pin limit "existed only because of the
static label table". Is that accurate?
ice_dpll_pps_update_phase_offsets() uses a fixed size stack array but
loops over the input count reported by firmware:
struct ice_cgu_input_measure meas[ICE_DPLL_INPUT_REF_NUM];
...
ret = ice_aq_get_cgu_input_pin_measure(&pf->hw, DPLL_TYPE_PPS, meas,
ARRAY_SIZE(meas));
...
for (i = 0; i < pf->dplls.num_inputs; i++) {
...
tmp = meas[i].phase_offset[j];
...
*phase_offset_pins_updated |= (1 << i);
ICE_DPLL_INPUT_REF_NUM is 10. pf->dplls.num_inputs is taken directly from
abilities.num_inputs, which is a u8. Without the cap, the generic path
now accepts up to 255 inputs.
If the PPS phase offset monitor is enabled, can ice_dpll_periodic_work()
read past the end of meas[] here? The stack contents would land in
p->phase_offset, and ice_dpll_phase_offset_get() reports that value to
userspace.
The overread was already possible with 11 to 16 inputs before this
patch, but removing the cap makes it much larger.
For i >= 31, 1 << i is also a signed int shift with undefined behaviour.
Separately, a u32 mask can't represent inputs at index 32 and above.
ice_dpll_pins_notify_mask() does:
if (phase_offset_ntf_mask & BIT(i))
so those pins would never get notified.
Should the generic path keep an upper bound tied to
ICE_DPLL_INPUT_REF_NUM, or should these users be bounded on their own?
> pins[i].idx = i;
> - pins[i].prop.board_label = labels[i];
> ice_dpll_phase_range_set(&pins[i].prop.phase_range,
> phase_adj_max);
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40intel.com