diff options
author | Douglas Anderson <dianders@chromium.org> | 2022-10-18 10:37:11 -0700 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-10-20 02:42:18 +0000 |
commit | 4ca43a34f5a936683ebcdc7b0edd059f313f61be (patch) | |
tree | 843eb853cae5b936b201b14188aa9dbb5334812e /firmware | |
parent | f1a7efc0ed8bcfb88b4d241dfd516a6636672c81 (diff) | |
download | vboot-4ca43a34f5a936683ebcdc7b0edd059f313f61be.tar.gz |
crossystem: arm: Retry if we fail to read a GPIO
It turns out that if two processes try to read the same GPIO at the
same time that one of them will fail because the GPIO is
"busy".
This is really by design of the kernel's GPIO API. In order to read a
value, each userspace process "requests" control of the GPIO and then
queries it. There doesn't appear to be any way to "wait" for a GPIO
that's been requested by someone else--we just need to wait a bit and
try again later. ...so that's what we'll do.
Without this patch, if you run the following script on a
write-protected sc7180-trogdor class device in two shells at the same
time:
old_val=""
while true; do
val=$(crossystem wpsw_cur)
if [[ "${val}" != "${old_val}" ]]; then
echo "$(date): ${old_val} => ${val}"
old_val="${val}"
fi
done
Then you'll see stuff like this:
GPIO_GET_LINEHANDLE_IOCTL: Device or resource busy
Tue Oct 18 11:34:01 PDT 2022: 1 => 0
Tue Oct 18 11:34:01 PDT 2022: 0 => 1
GPIO_GET_LINEHANDLE_IOCTL: Device or resource busy
Tue Oct 18 11:34:01 PDT 2022: 1 => 0
Tue Oct 18 11:34:01 PDT 2022: 0 => 1
The 0 actually comes from the fact that crossystem falls back to
`GetVdatInt(VDAT_INT_HW_WPSW_BOOT)` if it fails to read the GPIO and
that value isn't initted to anything on trogdor (VDAT_INT_HW_WPSW_BOOT
is deprecated and not populated on trogdor).
It is postulated that the above problem is causing some parts of the
system to get confused about the write protect state of devices.
BRANCH=none
BUG=b:249498455
TEST=Run script in CL commit message and see no errors
Change-Id: I307cdb4e290c27694690a19af60f4697ee0233e4
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3963985
Reviewed-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Commit-Queue: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'firmware')
0 files changed, 0 insertions, 0 deletions