From 3bebfa29dc4185b2f3d2752ac16b0f6639548a4a Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Tue, 7 May 2019 14:19:23 -0700 Subject: usb: reset backend device on port reset This enables the full firmware update/reset/use device in application mode sequence for Edge TPU USB Accelerator. There is a bit of a UI hiccup: once the firmware update and reset is complete, the device re-enumerates with a different VID/PID, and the "Connect to Linux" prompt shows up again. The user must re-affirm that the device should be connected to Linux to proceed with using the Edge TPU. This may be unavoidable - I'm not sure if we can tell the difference between a newly-inserted device and a reset one. Allowing USBDEVFS_DISCONNECT_CLAIM should be safe, since it can only operate on file descriptors passed into the xhci device jail. BUG=chromium:831850 TEST=Run Edge TPU Accelerator demo and verify that it can update FW Change-Id: I3d61c7bd914830ce25448b1ae4d60e1c16f10aed Signed-off-by: Daniel Verkamp Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1599881 Reviewed-by: Zach Reizner Tested-by: kokoro --- seccomp/arm/xhci.policy | 3 ++- seccomp/x86_64/xhci.policy | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'seccomp') diff --git a/seccomp/arm/xhci.policy b/seccomp/arm/xhci.policy index 14009b7..239eafd 100644 --- a/seccomp/arm/xhci.policy +++ b/seccomp/arm/xhci.policy @@ -34,7 +34,8 @@ uname: 1 # 0xc0105500 == USBDEVFS_CONTROL # 0x5514 == USBDEVFS_RESET # 0x80045505 == USBDEVFS_SETCONFIGURATION -ioctl: arg1 == 0xc0105500 || arg1 == 0x802c550a || arg1 == 0x8004551a || arg1 == 0x4004550d || arg1 == 0x8004550f || arg1 == 0x80045510 || arg1 == 0x550b || arg1 == 0x5514 || arg1 == 0x80045505 +# 0x8108551b == USBDEVFS_DISCONNECT_CLAIM +ioctl: arg1 == 0xc0105500 || arg1 == 0x802c550a || arg1 == 0x8004551a || arg1 == 0x4004550d || arg1 == 0x8004550f || arg1 == 0x80045510 || arg1 == 0x550b || arg1 == 0x5514 || arg1 == 0x80045505 || arg1 == 0x8108551b fstat: 1 sigaltstack: 1 recvmsg: 1 diff --git a/seccomp/x86_64/xhci.policy b/seccomp/x86_64/xhci.policy index 9eafb5a..19a46eb 100644 --- a/seccomp/x86_64/xhci.policy +++ b/seccomp/x86_64/xhci.policy @@ -32,7 +32,8 @@ uname: 1 # 0xc0185500 == USBDEVFS_CONTROL # 0x5514 == USBDEVFS_RESET # 0x80045505 == USBDEVFS_SETCONFIGURATION -ioctl: arg1 == 0xc0185500 || arg1 == 0x41045508 || arg1 == 0x8004550f || arg1 == 0x4008550d || arg1 == 0x8004551a || arg1 == 0x550b || arg1 == 0x80045510 || arg1 == 0x8038550a || arg1 == 0x5514 || arg1 == 0x80045505 +# 0x8108551b == USBDEVFS_DISCONNECT_CLAIM +ioctl: arg1 == 0xc0185500 || arg1 == 0x41045508 || arg1 == 0x8004550f || arg1 == 0x4008550d || arg1 == 0x8004551a || arg1 == 0x550b || arg1 == 0x80045510 || arg1 == 0x8038550a || arg1 == 0x5514 || arg1 == 0x80045505 || arg1 == 0x8108551b fstat: 1 sigaltstack: 1 recvmsg: 1 -- cgit 1.4.1