diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2021-09-26 19:05:40 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-11-05 23:54:35 +0000 |
commit | 4c9dac33088946de372d977cbb09cff2fb51ed4f (patch) | |
tree | ff115746b436b7d7b2d7acf2fc3bbb1b56efca5d /.gitignore | |
parent | 0e1a9e1988c0892971313eff6bc34803e9e8b026 (diff) | |
download | chrome-ec-4c9dac33088946de372d977cbb09cff2fb51ed4f.tar.gz |
usb_spi_v2: read full PDU into a bufferv2.14294_prepvt.0
Certain test configurations present a problem for the raiden protocol
V2 implementation on the Cr50 side, which result in random SPI read
failures.
While the issue is still being investigated this patch offers a
workaround, where SPI and USB transactions are not overlaid, the
driver first reads the entire requested number of bytes into a buffer,
and then sends them to the host in multiple USB packets.
Since buffer memory can not be permanently dedicated to the driver, it
uses dynamic allocation to acquire the buffer. The allocation could
fail, for instance when the flashrom operation is requested soon after
startup and heap memory is used for NVMEM compaction. If the
allocation fails, the driver sends an error packet to the host, and
the host requests to restart the response. To be able to restart the
response the driver now stores the request.
With some instrumentation, measurements taken on reading of 200 2040
byte blocks have shown that memory was held by this driver for 94% of
the duration.
To address the case when flashrom session is interrupted mid PDU
transfer, do not wait for the transmit queue to become available for
more than 500 ms. In case the queue gets stuck return without waiting
any more, this will make sure the allocated buffer is freed.
BUG=b:196820680
TEST=successfully ran hundreds of cycles of read, and read and write
on the setup which exhibits the problem without this patch on
pretty much every read attempt.
The slow down caused by this change is pretty small: average of
five attempts to read 16MB of SPI flash on guybrush device take
50.560s before this change and 51.267s after this change, which
is a 1.7% slowdown.
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Change-Id: I82c98f912a8763b7e242dad48997a8d2ffbaf29a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3188568
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Andrey Pronin <apronin@chromium.org>
(cherry picked from commit 30c8e6783a40a6f0969972f5b342b9db3588c5e0)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3265224
Tested-by: Mary Ruthven <mruthven@chromium.org>
Auto-Submit: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
Commit-Queue: Vadim Sukhomlinov <sukhomlinov@chromium.org>
Diffstat (limited to '.gitignore')
0 files changed, 0 insertions, 0 deletions