Scenario: link speed change from L0
Registers
In PCI Express Capability Structure
Capabilities: [c0] Express (v2) Endpoint, MSI 00
...
LnkCap: Port #0, Speed 16GT/s, Width x4, ASPM L1, Exit Latency L1 <8us
ClockPM- Surprise- LLActRep- BwNot- ASPMOptComp+
LnkCtl: ASPM L1 Enabled; RCB 64 bytes, Disabled- CommClk+
ExtSynch+ ClockPM- AutWidDis- BWInt- AutBWInt-
LnkSta: Speed 16GT/s, Width x4
TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
...
LnkCap2: Supported Link Speeds: 2.5-16GT/s, Crosslink- Retimer+ 2Retimers+ DRS-
LnkCtl2: Target Link Speed: 16GT/s, EnterCompliance- SpeedDis-
Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
Compliance Preset/De-emphasis: -6dB de-emphasis, 0dB preshoot
LnkSta2: Current De-emphasis Level: -6dB, EqualizationComplete+ EqualizationPhase1+
EqualizationPhase2+ EqualizationPhase3+ LinkEqualizationRequest-
Retimer- 2Retimers- CrosslinkRes: unsupported
-
Link Capability Register
BwNot: Link Bandwidth Notification Capibility Structure. Notify host on link speed change.
-
Link Control Register
BWIntandAutBWInt: Link Badwidth Management Interrupt Enable and the Link Autonomous Bandwidth Interrupt Enable. For enabling bandwidth change due to Autonomous reasons (e.g. for power management reasons) or for actual bandwidth issues.
-
Link Status Register
BWMgmtandABWMgmt: Link Bandwidth Management Status and Link Autonomous Bandwidth Status.
-
Link Control Register 2
SpeedDis: Hardware Autonomous Speed Disable
Invoke speed change from software
Software can do speed change by setting the Link Control register:
Target Link Speed: set this in theLnkCtl2.Retrain Link: set bit in the Link Control register from a downstream port to force speed change. Only meaningful for a upsteram device.
Stages of speed change
Entering recovery
-
Recovery.RcvrLock: exchange TS1 in the original speed to achieve symbol lock.- Set the
speed_changebit to 1 to indicate intention for speed change. - Also advertise the target speed by setting it at the Rate ID field.
The other side ack by sending back TS1, also with
speed_changeset to 1. If both sides are fine, they enter theRecover.RcvrCfgand start exchanging TS2. - Set the
-
Recovery.RcvrCfg: upstream device send TS2 with bothspeed_changeandautonomous_changeto1, while downstream device send back TS2 withspeed_changebit set to1. -
Recovery.Speed: both side send EIOS and enter electric idle and do speed up.
After speed changed (if no equalization needed)
After that, enter Recovery.RecvrLock again, by sending EIEOS.
Now they enter the Recovery.RecvrLock again, but with new speed from both side, and repeat the process again, but without setting the speed_change and autonomous_change bits:
Recovery.RecvrLockRecovery.RcvrCfgRecovery.Idle
And finally enter L0
After speed change (if equalization needed)
Equalization is needed when first entering a Gen3 or Gen4 speed for the first time. The general feeling is that link equalization is needed whenever the link enters a 128b/130b-encoding speed for the first time, although for Gen5 it is allowed not to do Link Equalization when first entering this speed.
The difference is in that, after re-entering the Recovery.RecvrLock with a new speed, instead of going straight to Recovery.RecvrCfg, go for a detour to Recovery.equalization first, so it becomes:
Recovery.RecvrLock: EC (Equalization Control) will be set here, to suggest that link equalization comes next.Recovery.EqualizationRecovery.RecvrLock: new!Recovery.RcvrCfgRecovery.Idle
And finally enter L0.
References
Videos
Links
- p23, Troubleshooting PCI Express® Link Training and Protocol Issues: for the speed change TS1 and TS2 sequence.
- PCI Express* 3.0 Technology: PHY Implementation Considerations for Intel Platforms
- Link Status (LSTS) – Offset 52