Skip to contentSkip to conversation

usb: dwc3: Update nominal max votes for qcom usb

PATCH In review Akash Kumar 5 participants 8 messages Nov 5 – Nov 11 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 usb: dwc3: Update nominal max votes for qcom usb

Increase the nominal max USB memory bandwidth vote to let DDR scale higher within its nominal corner, fixing glitches seen during simultaneous USB audio use cases.

USB_MEMORY_PEAK_SS_BW is raised from 2500 MB/s to 4500 MB/s (+2000 MB/s, ~1.8x). This ICC vote does not by itself determine DDR frequency; the vote-to-frequency mapping is platform-specific and comes from each target's interconnect/OPP table. On the tested targets, the old vote kept DDR pinned at 1 GHz within the nominal corner, even though DDR can run at 1.5 GHz (+50%) within the same corner. At 1 GHz, glitches were observed during multiple concurrent USB audio use cases.

Tested internally on RB3, RB4, RB8, Shikra, and other KLM targets. With the updated vote, DDR is allowed to run at the higher nominal frequency, and the following were measured (not merely projected):

- USB memory throughput: 125 MB/s -> 145 MB/s (+16%)
- RTD-USBC audio latency: 17.9 ms -> 16.6 ms (-7.3%)

RTD-USBC is the round-trip audio latency measured over a USB-C audio path; lower is better. Note the +50% DDR frequency headroom does not map linearly to the +16% throughput gain, since throughput is also bounded by other factors along the USB/DDR path; the frequency increase is necessary but not sufficient to explain the full gain on its own.

---
v2: Added Details of targets Tested.
Added details for usb vote.
Added KPI Details.
Dropped USB AVG BW vote change which is not needed.

Link to v1: https://lore.kernel.org/all/[email protected]/

---
 drivers/usb/dwc3/dwc3-qcom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc3/dwc3-qcom.c +1 -1
index ac68b4218b56..3a19385969dc 100644
@@ -46,7 +46,7 @@
 #define USB_MEMORY_AVG_HS_BW MBps_to_icc(240)
 #define USB_MEMORY_PEAK_HS_BW MBps_to_icc(700)
 #define USB_MEMORY_AVG_SS_BW  MBps_to_icc(1000)
-#define USB_MEMORY_PEAK_SS_BW MBps_to_icc(2500)
+#define USB_MEMORY_PEAK_SS_BW MBps_to_icc(4500)
 #define APPS_USB_AVG_BW 0
 #define APPS_USB_PEAK_BW MBps_to_icc(40)
 
Signature · 1 line
2.43.0
#1 lore raw
Sashiko has reviewed this patch and found no issues.
Quoted 20 lines

Increase the nominal max USB memory bandwidth vote to let DDR scale higher within its nominal corner, fixing glitches seen during simultaneous USB audio use cases.

USB_MEMORY_PEAK_SS_BW is raised from 2500 MB/s to 4500 MB/s (+2000 MB/s, ~1.8x). This ICC vote does not by itself determine DDR frequency; the vote-to-frequency mapping is platform-specific and comes from each target's interconnect/OPP table. On the tested targets, the old vote kept DDR pinned at 1 GHz within the nominal corner, even though DDR can run at 1.5 GHz (+50%) within the same corner. At 1 GHz, glitches were observed during multiple concurrent USB audio use cases.

Tested internally on RB3, RB4, RB8, Shikra, and other KLM targets. With the updated vote, DDR is allowed to run at the higher nominal frequency, and the following were measured (not merely projected):

- USB memory throughput: 125 MB/s -> 145 MB/s (+16%)
- RTD-USBC audio latency: 17.9 ms -> 16.6 ms (-7.3%)

Quoted 8 lines

RTD-USBC is the round-trip audio latency measured over a USB-C audio path; lower is better. Note the +50% DDR frequency headroom does not map linearly to the +16% throughput gain, since throughput is also bounded by other factors along the USB/DDR path; the frequency increase is necessary but not sufficient to explain the full gain on its own.

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#2 lore raw
In reply to Akash Kumar
Quoted 6 lines · Akash Kumar

Increase the nominal max USB memory bandwidth vote to let DDR scale higher within its nominal corner, fixing glitches seen during simultaneous USB audio use cases.

USB_MEMORY_PEAK_SS_BW is raised from 2500 MB/s to 4500 MB/s (+2000 MB/s, ~1.8x). This ICC vote does not by itself determine DDR

Can we scale this depending of the real speed of the connected device adjusted for the real data throughput? i.e. if we walk the tree and min/max as appropriate, we end up with say 10G wire speed, out of which we can shave off some static overhead

4500 MB/s is 36 Gb/s which is way beyond what USB3 can do, in any configuration.

Konrad

#3 lore raw
Quoted 58 lines · Konrad Dybcio
Quoted 6 lines · Akash Kumar

Increase the nominal max USB memory bandwidth vote to let DDR scale higher within its nominal corner, fixing glitches seen during simultaneous USB audio use cases.

USB_MEMORY_PEAK_SS_BW is raised from 2500 MB/s to 4500 MB/s (+2000 MB/s, ~1.8x). This ICC vote does not by itself determine DDR

Can we scale this depending of the real speed of the connected device adjusted for the real data throughput? i.e. if we walk the tree and min/max as appropriate, we end up with say 10G wire speed, out of which we can shave off some static overhead

4500 MB/s is 36 Gb/s which is way beyond what USB3 can do, in any configuration.

Konrad

Hi Konrad,

Two things worth separating here:

1) The ICC vote is not a USB wire-speed requirement, so it shouldn't be compared directly against the USB3 line rate. This number is a DDR/memory-interconnect bandwidth vote; the platform's interconnect/OPP table is what maps a given vote to a DDR frequency/voltage corner. 4500 MB/s doesn't mean we expect 36 Gb/s on the wire - it means we want the memory subsystem's bus matrix to have enough headroom that the platform's table picks the higher in-corner DDR frequency instead of pinning it at the lower one. The vote intentionally carries margin for the aggregate memory traffic of the whole USB subsystem (descriptors, buffering, concurrent audio capture/playback, etc.), not just the raw bulk payload of one device, which is why it doesn't map 1:1 to link speed.

2) We do already have a speed-based split for this, just not a per-device dynamic one. dwc3_qcom_interconnect_init() picks between the HS and SS vote pairs based on usb_get_maximum_speed() of the controller:

     max_speed = usb_get_maximum_speed(qcom->dwc.dev);
     if (max_speed >= USB_SPEED_SUPER || max_speed == USB_SPEED_UNKNOWN)
             ret = icc_set_bw(qcom->icc_path_ddr,
                             USB_MEMORY_AVG_SS_BW, USB_MEMORY_PEAK_SS_BW);
     else
             ret = icc_set_bw(qcom->icc_path_ddr,
                             USB_MEMORY_AVG_HS_BW, USB_MEMORY_PEAK_HS_BW);

This patch only touches the SS tier's peak value; a controller whose maximum speed is HS is unaffected. It's set once at probe based on the controller's maximum capability rather than walking the topology for the actually-negotiated speed of whatever is plugged in at a given moment, so it's intentionally a worst-case value rather than a precise per-device figure - which is also why it's sized for the glitch we saw under concurrent audio+bulk load rather than for a single device's best-case throughput.

Thanks,
Akash

#4 lore raw
Quoted 41 lines · Akash Kumar
Quoted 39 lines · Konrad Dybcio
Quoted 6 lines · Akash Kumar

Increase the nominal max USB memory bandwidth vote to let DDR scale higher within its nominal corner, fixing glitches seen during simultaneous USB audio use cases.

USB_MEMORY_PEAK_SS_BW is raised from 2500 MB/s to 4500 MB/s (+2000 MB/s, ~1.8x). This ICC vote does not by itself determine DDR

Can we scale this depending of the real speed of the connected device adjusted for the real data throughput? i.e. if we walk the tree and min/max as appropriate, we end up with say 10G wire speed, out of which we can shave off some static overhead

4500 MB/s is 36 Gb/s which is way beyond what USB3 can do, in any configuration.

Konrad

Hi Konrad,

Two things worth separating here:

1) The ICC vote is not a USB wire-speed requirement, so it shouldn't be compared directly against the USB3 line rate. This number is a DDR/memory-interconnect bandwidth vote; the platform's interconnect/OPP table is what maps a given vote to a DDR frequency/voltage corner. 4500 MB/s doesn't mean we expect 36 Gb/s on the wire - it means we want the memory subsystem's bus matrix to have enough headroom that the platform's table picks the higher in-corner DDR frequency instead of pinning it at the lower one. The vote intentionally carries margin for the aggregate memory traffic of the whole USB subsystem (descriptors, buffering, concurrent audio capture/playback, etc.), not just the raw bulk payload of one device, which is why it doesn't map 1:1 to link speed.

2) We do already have a speed-based split for this, just not a per-device dynamic one. dwc3_qcom_interconnect_init() picks between the HS and SS vote pairs based on usb_get_maximum_speed() of the controller:

Quoted 8 lines
Quoted 8 lines

     max_speed = usb_get_maximum_speed(qcom->dwc.dev);
     if (max_speed >= USB_SPEED_SUPER || max_speed == USB_SPEED_UNKNOWN) ret = icc_set_bw(qcom->icc_path_ddr, USB_MEMORY_AVG_SS_BW, USB_MEMORY_PEAK_SS_BW); else
             ret = icc_set_bw(qcom->icc_path_ddr, USB_MEMORY_AVG_HS_BW, USB_MEMORY_PEAK_HS_BW);

Hi Akash,

Rather than relying on DT parameter to determine ICC bandwidth, we can
do the following:

a) In host mode, we can register notifier to usb core and based on
device connection speed at runtime, we can modify the ICC bandwidth. If its High-Speed, we can scale back to SVS. This reference is present in downstream.

b) For device mode, we can register a post-conndone glue hook to dwc3
core and depending on connection speed (DSTS regsiter read), we can set appropriate ICC vote. This is not tried on downstream but I think it must work fine.

Regards,
Krishna,

Quoted 12 lines
Quoted 11 lines

This patch only touches the SS tier's peak value; a controller whose maximum speed is HS is unaffected. It's set once at probe based on the controller's maximum capability rather than walking the topology for the actually-negotiated speed of whatever is plugged in at a given moment, so it's intentionally a worst-case value rather than a precise per-device figure - which is also why it's sized for the glitch we saw under concurrent audio+bulk load rather than for a single device's best-case throughput.

Thanks,
Akash

#5 lore raw
In reply to Akash Kumar
Quoted 4 lines · Akash Kumar

Increase the nominal max USB memory bandwidth vote to let DDR scale higher within its nominal corner, fixing glitches seen during simultaneous USB audio use cases.

Quoted 8 lines

USB_MEMORY_PEAK_SS_BW is raised from 2500 MB/s to 4500 MB/s (+2000 MB/s, ~1.8x). This ICC vote does not by itself determine DDR frequency; the vote-to-frequency mapping is platform-specific and comes from each target's interconnect/OPP table. On the tested targets, the old vote kept DDR pinned at 1 GHz within the nominal corner, even though DDR can run at 1.5 GHz (+50%) within the same corner. At 1 GHz, glitches were observed during multiple concurrent USB audio use cases.

How we decide which value is suitable, eg, you set 4500 here? If DDR can run higher, and we have more stress test case like UAS transfer + UVC transfer, do we need this value to be higher?

Is it okay we just set the highest value for USB, there is a platform OPP table, and we let ICC choose the highest value for USB at specific platform?

Peter

Quoted 44 lines

Tested internally on RB3, RB4, RB8, Shikra, and other KLM targets. With the updated vote, DDR is allowed to run at the higher nominal frequency, and the following were measured (not merely projected):

- USB memory throughput: 125 MB/s -> 145 MB/s (+16%)
- RTD-USBC audio latency: 17.9 ms -> 16.6 ms (-7.3%)

RTD-USBC is the round-trip audio latency measured over a USB-C audio path; lower is better. Note the +50% DDR frequency headroom does not map linearly to the +16% throughput gain, since throughput is also bounded by other factors along the USB/DDR path; the frequency increase is necessary but not sufficient to explain the full gain on its own.

---
v2: Added Details of targets Tested.
Added details for usb vote.
Added KPI Details.
Dropped USB AVG BW vote change which is not needed.

Link to v1: https://lore.kernel.org/all/[email protected]/

---
 drivers/usb/dwc3/dwc3-qcom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc3/dwc3-qcom.c +1 -1
index ac68b4218b56..3a19385969dc 100644
@@ -46,7 +46,7 @@
 #define USB_MEMORY_AVG_HS_BW MBps_to_icc(240)
 #define USB_MEMORY_PEAK_HS_BW MBps_to_icc(700)
 #define USB_MEMORY_AVG_SS_BW  MBps_to_icc(1000)
-#define USB_MEMORY_PEAK_SS_BW MBps_to_icc(2500)
+#define USB_MEMORY_PEAK_SS_BW MBps_to_icc(4500)
 #define APPS_USB_AVG_BW 0
 #define APPS_USB_PEAK_BW MBps_to_icc(40)
 
Signature · 1 line
2.43.0
Signature · 2 lines
Thanks,
Peter Chen

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw
Quoted 51 lines · Akash Kumar
Quoted 17 lines · Peter Chen
Quoted 4 lines · Akash Kumar

Increase the nominal max USB memory bandwidth vote to let DDR scale higher within its nominal corner, fixing glitches seen during simultaneous USB audio use cases.

Quoted 8 lines

USB_MEMORY_PEAK_SS_BW is raised from 2500 MB/s to 4500 MB/s (+2000 MB/s, ~1.8x). This ICC vote does not by itself determine DDR frequency; the vote-to-frequency mapping is platform-specific and comes from each target's interconnect/OPP table. On the tested targets, the old vote kept DDR pinned at 1 GHz within the nominal corner, even though DDR can run at 1.5 GHz (+50%) within the same corner. At 1 GHz, glitches were observed during multiple concurrent USB audio use cases.

How we decide which value is suitable, eg, you set 4500 here? If DDR can run higher, and we have more stress test case like UAS transfer + UVC transfer, do we need this value to be higher?

Quoted 6 lines

Is it okay we just set the highest value for USB, there is a platform OPP table, and we let ICC choose the highest value for USB at specific platform?

Peter

Hi Peter,

4500 MB/s was arrived at empirically, not computed: we swept the peak SS vote on each tested target and read back the committed DDR frequency. 2500 MB/s capped every target at 1 GHz; 4500 MB/s is the smallest common vote that reliably crosses into the 1.5 GHz nominal step on all of them without pushing any target into the next corner above nominal. 1.5 GHz is also the DDR frequency our power team's KPI bandwidth table accepts as nominal, so this vote keeps us inside the power budget they've signed off on, not just inside a technically-valid corner.

We've additionally run isochronous endpoint use cases with this change — mobile platform passes the full MJPEG test suite at this vote with no regressions. We've also verified UAC+UVC concurrently: for that combination,
DDR is bumped at runtime on demand by the userspace application rather than relying on this static floor vote alone.

That's also why we didn't just vote the platform max and let ICC pick:
not every USB use case needs or should force DDR to its ceiling. If we voted max unconditionally for all USB activity, DDR would sit pinned at the highest corner any time a SS device is attached, which shows up directly as a regression on the power dashboard across every platform using this shared driver. The static vote here is sized for the common case; use cases that genuinely need more (like UAC+UVC) bump DDR explicitly at runtime instead of paying that cost unconditionally.

Quoted 3 lines

In Future, we have a plan to make it configurable from device tree which can be done based on target.

Akash, thanks for detail explanation. I had not considered power consumption affect. So, we set a default value for balance performance and power at most platforms, in future, we could configure it through device tree or use space according to scenario.

Signature · 2 lines
Thanks,
Peter Chen
Reviewed-by on v2 1/1
#8 lore raw
In reply to Akash Kumar
Quoted 20 lines · Akash Kumar

Increase the nominal max USB memory bandwidth vote to let DDR scale higher within its nominal corner, fixing glitches seen during simultaneous USB audio use cases.

USB_MEMORY_PEAK_SS_BW is raised from 2500 MB/s to 4500 MB/s (+2000 MB/s, ~1.8x). This ICC vote does not by itself determine DDR frequency; the vote-to-frequency mapping is platform-specific and comes from each target's interconnect/OPP table. On the tested targets, the old vote kept DDR pinned at 1 GHz within the nominal corner, even though DDR can run at 1.5 GHz (+50%) within the same corner. At 1 GHz, glitches were observed during multiple concurrent USB audio use cases.

Tested internally on RB3, RB4, RB8, Shikra, and other KLM targets. With the updated vote, DDR is allowed to run at the higher nominal frequency, and the following were measured (not merely projected):

- USB memory throughput: 125 MB/s -> 145 MB/s (+16%)
- RTD-USBC audio latency: 17.9 ms -> 16.6 ms (-7.3%)

Quoted 8 lines

RTD-USBC is the round-trip audio latency measured over a USB-C audio path; lower is better. Note the +50% DDR frequency headroom does not map linearly to the +16% throughput gain, since throughput is also bounded by other factors along the USB/DDR path; the frequency increase is necessary but not sufficient to explain the full gain on its own.

Peter

Quoted 28 lines

---
v2: Added Details of targets Tested.
Added details for usb vote.
Added KPI Details.
Dropped USB AVG BW vote change which is not needed.

Link to v1: https://lore.kernel.org/all/[email protected]/

---
 drivers/usb/dwc3/dwc3-qcom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc3/dwc3-qcom.c +1 -1
index ac68b4218b56..3a19385969dc 100644
@@ -46,7 +46,7 @@
 #define USB_MEMORY_AVG_HS_BW MBps_to_icc(240)
 #define USB_MEMORY_PEAK_HS_BW MBps_to_icc(700)
 #define USB_MEMORY_AVG_SS_BW  MBps_to_icc(1000)
-#define USB_MEMORY_PEAK_SS_BW MBps_to_icc(2500)
+#define USB_MEMORY_PEAK_SS_BW MBps_to_icc(4500)
 #define APPS_USB_AVG_BW 0
 #define APPS_USB_PEAK_BW MBps_to_icc(40)
 
Signature · 1 line
2.43.0
Signature · 2 lines
Thanks,
Peter Chen