ice: dpll: fix phase offset value
Subsystems (2)
PATCH v2 1/1 ice: dpll: fix phase offset value
Stop dividing the phase_offset value received from firmware. This fault is present since the initial implementation.
The phase_offset value received from firmware is in 0.01ps resolution. Dpll subsystem is using the value in 0.001ps, raw value is adjusted before providing it to the user.
The user can observe the value of phase offset with response to pin-get netlink message of dpll subsystem for an active pin:
$ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/dpll.yaml \
--do pin-get --json '{"id":2}'Where example of correct response would be:
{'board-label': 'C827_0-RCLKA',
'capabilities': 6,
'clock-id': 4658613174691613800,
'frequency': 1953125,
'id': 2,
'module-name': 'ice',
'parent-device': [{'direction': 'input',
'parent-id': 6,
'phase-offset': -216839550,
'prio': 9,
'state': 'connected'},
{'direction': 'input',
'parent-id': 7,
'phase-offset': -42930,
'prio': 8,
'state': 'connected'}], 'phase-adjust': 0,
'phase-adjust-max': 16723,
'phase-adjust-min': -16723,
'type': 'mux'}
Provided phase-offset value (-42930) shall be divided by the user with DPLL_PHASE_OFFSET_DIVIDER to get actual value of -42.930 ps.
Before the fix, the response was not correct:
{'board-label': 'C827_0-RCLKA',
'capabilities': 6,
'clock-id': 4658613174691613800,
'frequency': 1953125,
'id': 2,
'module-name': 'ice',
'parent-device': [{'direction': 'input',
'parent-id': 6,
'phase-offset': -216839,
'prio': 9,
'state': 'connected'},
{'direction': 'input',
'parent-id': 7,
'phase-offset': -42,
'prio': 8,
'state': 'connected'}], 'phase-adjust': 0,
'phase-adjust-max': 16723,
'phase-adjust-min': -16723,
'type': 'mux'}
Where phase-offset value (-42), after division
(DPLL_PHASE_OFFSET_DIVIDER) would be: -0.042 ps.
--- drivers/net/ethernet/intel/ice/ice_common.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/intel/ice/ice_common.c +1 -3
@@ -5332,7 +5332,6 @@ ice_aq_get_cgu_dpll_status(struct ice_hw *hw, u8 dpll_num, u8 *ref_state, u8 *eec_mode) {struct ice_aqc_get_cgu_dpll_status *cmd; -const s64 nsec_per_psec =1000LL ;struct ice_aq_desc desc;int status;
@@ -5348,8 +5347,7 @@ ice_aq_get_cgu_dpll_status(struct ice_hw *hw, u8 dpll_num, u8 *ref_state, *phase_offset =le32_to_cpu (cmd->phase_offset_h); *phase_offset <<=32 ; *phase_offset +=le32_to_cpu (cmd->phase_offset_l); - *phase_offset =div64_s64 (sign_extend64 (*phase_offset,47 ), - nsec_per_psec); + *phase_offset =sign_extend64 (*phase_offset,47 ); *eec_mode = cmd->eec_mode; }
Signature · 6 lines
2.38.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Dear Arkadiusz,
Am 18.12.23 um 15:58 schrieb Arkadiusz Kubalewski:
Quoted 53 lines
Stop dividing the
phase_offsetvalue received from firmware. This fault is present since the initial implementation.
Thephase_offsetvalue received from firmware is in 0.01ps resolution. Dpll subsystem is using the value in 0.001ps, raw value is adjusted before providing it to the user.The user can observe the value of phase offset with response to
pin-getnetlink message of dpll subsystem for an active pin:$ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/dpll.yaml \ --do pin-get --json '{"id":2}'Where example of correct response would be:
{'board-label': 'C827_0-RCLKA',
'capabilities': 6,
'clock-id': 4658613174691613800,
'frequency': 1953125,
'id': 2,
'module-name': 'ice',
'parent-device': [{'direction': 'input','parent-id': 6, 'phase-offset': -216839550, 'prio': 9, 'state': 'connected'}, {'direction': 'input', 'parent-id': 7, 'phase-offset': -42930, 'prio': 8, 'state': 'connected'}],'phase-adjust': 0,
'phase-adjust-max': 16723,
'phase-adjust-min': -16723,
'type': 'mux'}Provided phase-offset value (-42930) shall be divided by the user with
DPLL_PHASE_OFFSET_DIVIDERto get actual value of -42.930 ps.Before the fix, the response was not correct:
{'board-label': 'C827_0-RCLKA',
'capabilities': 6,
'clock-id': 4658613174691613800,
'frequency': 1953125,
'id': 2,
'module-name': 'ice',
'parent-device': [{'direction': 'input','parent-id': 6, 'phase-offset': -216839, 'prio': 9, 'state': 'connected'}, {'direction': 'input', 'parent-id': 7, 'phase-offset': -42, 'prio': 8, 'state': 'connected'}],
Quoted 7 lines
'phase-adjust': 0,
'phase-adjust-max': 16723,
'phase-adjust-min': -16723,
'type': 'mux'}Where phase-offset value (-42), after division
(DPLL_PHASE_OFFSET_DIVIDER) would be: -0.042 ps.
Thank you for the detailed description.
Quoted 22 lines
Fixes 8a3a565ff210 ("ice: add admin commands to access cgu configuration")Fixes 90e1c90750d7 ("ice: dpll: implement phase related callbacks")Reviewed-by Aleksandr Loktionov <[email protected]>Reviewed-by Przemek Kitszel <[email protected]>Signed-off-by Arkadiusz Kubalewski <[email protected]>--- drivers/net/ethernet/intel/ice/ice_common.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/net/ethernet/intel/ice/ice_common.c +0
-1@@ -5332,7 +5332,6 @@ ice_aq_get_cgu_dpll_status(struct ice_hw *hw, u8 dpll_num, u8 *ref_state, u8 *eec_mode) {struct ice_aqc_get_cgu_dpll_status *cmd; -const s64 nsec_per_psec =1000LL ;struct ice_aq_desc desc;int status;
drivers/net/ethernet/intel/ice/ice_common.c ice_aq_get_cgu_dpll_status(struct ice_hw *hw, u8 dpll_num, u8 *ref_state, · line 5352
Quoted 8 lines
drivers/net/ethernet/intel/ice/ice_common.c +1
-2@@ -5348,8 +5347,7 @@ ice_aq_get_cgu_dpll_status(struct ice_hw *hw, u8 dpll_num, u8 *ref_state, *phase_offset =le32_to_cpu (cmd->phase_offset_h); *phase_offset <<=32 ; *phase_offset +=le32_to_cpu (cmd->phase_offset_l); - *phase_offset =div64_s64 (sign_extend64 (*phase_offset,47 ), - nsec_per_psec); + *phase_offset =sign_extend64 (*phase_offset,47 ); *eec_mode = cmd->eec_mode; }
Kind regards,
Paul
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Quoted 54 lines · Arkadiusz Kubalewski
Stop dividing the
phase_offsetvalue received from firmware. This fault is present since the initial implementation.
Thephase_offsetvalue received from firmware is in 0.01ps resolution. Dpll subsystem is using the value in 0.001ps, raw value is adjusted before providing it to the user.The user can observe the value of phase offset with response to
pin-getnetlink message of dpll subsystem for an active pin:$ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/dpll.yaml \ --do pin-get --json '{"id":2}'Where example of correct response would be:
{'board-label': 'C827_0-RCLKA',
'capabilities': 6,
'clock-id': 4658613174691613800,
'frequency': 1953125,
'id': 2,
'module-name': 'ice',
'parent-device': [{'direction': 'input','parent-id': 6, 'phase-offset': -216839550, 'prio': 9, 'state': 'connected'}, {'direction': 'input', 'parent-id': 7, 'phase-offset': -42930, 'prio': 8, 'state': 'connected'}],'phase-adjust': 0,
'phase-adjust-max': 16723,
'phase-adjust-min': -16723,
'type': 'mux'}Provided phase-offset value (-42930) shall be divided by the user with
DPLL_PHASE_OFFSET_DIVIDERto get actual value of -42.930 ps.Before the fix, the response was not correct:
{'board-label': 'C827_0-RCLKA',
'capabilities': 6,
'clock-id': 4658613174691613800,
'frequency': 1953125,
'id': 2,
'module-name': 'ice',
'parent-device': [{'direction': 'input','parent-id': 6, 'phase-offset': -216839, 'prio': 9, 'state': 'connected'}, {'direction': 'input', 'parent-id': 7, 'phase-offset': -42, 'prio': 8, 'state': 'connected'}],
Quoted 7 lines
'phase-adjust': 0,
'phase-adjust-max': 16723,
'phase-adjust-min': -16723,
'type': 'mux'}Where phase-offset value (-42), after division
(DPLL_PHASE_OFFSET_DIVIDER) would be: -0.042 ps.
The following is not an objection to the patch, just a related point:
Why does the documentation for "phase-offset-divider" in Documentation/netlink/specs/dpll.yaml not mention the units at all? It tells you one has to divide the raw value by the divider, but it does not tell you that the result is then in picoseconds. Actually, why is the divider defined at all? Wouldn't it have been enough to document that the raw value is in femtoseconds?
Michal
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Quoted 68 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Arkadiusz Kubalewski
Sent: Monday, December 18, 2023 8:29 PM
To: [email protected]
Cc: Loktionov, Aleksandr <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Kubalewski, Arkadiusz <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-net v2] ice: dpll: fix phase offset valueStop dividing the
phase_offsetvalue received from firmware. This fault is present since the initial implementation.
Thephase_offsetvalue received from firmware is in 0.01ps resolution. Dpll subsystem is using the value in 0.001ps, raw value is adjusted before providing it to the user.The user can observe the value of phase offset with response to
pin-getnetlink message of dpll subsystem for an active pin:$ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/dpll.yaml \ --do pin-get --json '{"id":2}'Where example of correct response would be:
{'board-label': 'C827_0-RCLKA',
'capabilities': 6,
'clock-id': 4658613174691613800,
'frequency': 1953125,
'id': 2,
'module-name': 'ice',
'parent-device': [{'direction': 'input','parent-id': 6, 'phase-offset': -216839550, 'prio': 9, 'state': 'connected'}, {'direction': 'input', 'parent-id': 7, 'phase-offset': -42930, 'prio': 8, 'state': 'connected'}],'phase-adjust': 0,
'phase-adjust-max': 16723,
'phase-adjust-min': -16723,
'type': 'mux'}Provided phase-offset value (-42930) shall be divided by the user with
DPLL_PHASE_OFFSET_DIVIDERto get actual value of -42.930 ps.Before the fix, the response was not correct:
{'board-label': 'C827_0-RCLKA',
'capabilities': 6,
'clock-id': 4658613174691613800,
'frequency': 1953125,
'id': 2,
'module-name': 'ice',
'parent-device': [{'direction': 'input','parent-id': 6, 'phase-offset': -216839, 'prio': 9, 'state': 'connected'}, {'direction': 'input', 'parent-id': 7, 'phase-offset': -42, 'prio': 8, 'state': 'connected'}],'phase-adjust': 0,
'phase-adjust-max': 16723,
'phase-adjust-min': -16723,
'type': 'mux'}Where phase-offset value (-42), after division
(DPLL_PHASE_OFFSET_DIVIDER) would be: -0.042 ps.
Quoted 9 lines
Fixes 8a3a565ff210 ("ice: add admin commands to access cgu configuration")Fixes 90e1c90750d7 ("ice: dpll: implement phase related callbacks")Reviewed-by Aleksandr Loktionov <[email protected]>Reviewed-by Przemek Kitszel <[email protected]>Signed-off-by Arkadiusz Kubalewski <[email protected]>--- drivers/net/ethernet/intel/ice/ice_common.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan