From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on atuin.qyliss.net X-Spam-Level: X-Spam-Status: No, score=-4.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: by atuin.qyliss.net (Postfix, from userid 496) id 8A89E81F0B; Wed, 13 Oct 2021 13:54:45 +0000 (UTC) Received: from atuin.qyliss.net (localhost [IPv6:::1]) by atuin.qyliss.net (Postfix) with ESMTP id 2104681DB2; Wed, 13 Oct 2021 13:53:41 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 496) id 6D32E81CF1; Wed, 13 Oct 2021 13:53:37 +0000 (UTC) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by atuin.qyliss.net (Postfix) with ESMTPS id 4F7B981D27 for ; Wed, 13 Oct 2021 13:53:27 +0000 (UTC) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 480125C01B1 for ; Wed, 13 Oct 2021 09:53:25 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 13 Oct 2021 09:53:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alyssa.is; h= from:to:subject:date:message-id:mime-version :content-transfer-encoding; s=fm1; bh=Uvd6OxpGkdgpVsqAdPYXc1ggSn Be/K5hPDdemUUA05Q=; b=XKQgt+jSnd/qahzNmMN3TEn6ef3agk4WVzNv7mqjPG 4ZU9gjVMf/r5uAd4NOUQxD4A6pFabEe3Ru0IKSyRsdjFJqTwJdgx7CllszIHvBH4 3vSXHnA23c1UGybZfZtCDl6c93ghH+ENsW2BnAJrcJ0+k1MOuWyo5yD5Mn/p2wVk p3Qd+at7c1VAgyewPJJd+gyOXa6hE0uW+1UPQmnJmif92UXw0NtyyZU7mijP8uJv HRiX5ynjM5r89TMSbMy51AONh7t7QQhigGvVvCvdRlSc6aOkTptFNOYg0udz5Eaw /v1yCwUwewWnuMN6zQR6NW9gz2vgpipHIzw5WA3u9VWw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=Uvd6OxpGkdgpVsqAd PYXc1ggSnBe/K5hPDdemUUA05Q=; b=Chu3xQhliV/1lJrkurPRcAvE1mOmmcEwA ar+xBMwyuuCf/eFSPyZiEyyyX+xLo1zAqv8lWNzwAyhgLsLDHFPo0AD+fmKeqtaH pNjpgzL/FBAeJZpQxBs0q+6fV0QmiHdDgCmjyuaQFuq8nhMMj4NeUs0QOuxlP1ZN UtM2R8S7FtGUUclN4f8DzhNLS/xOzkITm9OnRjlvCKOKx+b161itAYUtX+SHbcN8 0YNg3dc5q49fcYlW8cSm/qJtQlWMj0QSePAgHiFkYRf2hUKdJ7NRVJqrOADhopij BC1elTsP2qg+piAfPAd9wvc1/8Li7M7m+GfR4cyRUx2A56YcraY9A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddutddgieekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgggfestdekredtre dttdenucfhrhhomheptehlhihsshgrucftohhsshcuoehhihesrghlhihsshgrrdhisheq necuggftrfgrthhtvghrnhephfdvudetvdegfeffffelvdefgeehieeutefgffekieeuvd dvteetleeivdeiffefnecuffhomhgrihhnpehgihhthhhusgdrtghomhdpuggvshhtqdhu nhhrvggrtghhrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepqhihlhhishhsseigvddvtddrqhihlhhishhsrdhnvght X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Wed, 13 Oct 2021 09:53:24 -0400 (EDT) Received: by x220.qyliss.net (Postfix, from userid 1000) id BCC0516BA; Wed, 13 Oct 2021 13:53:22 +0000 (UTC) From: Alyssa Ross To: devel@spectrum-os.org Subject: [DEMO PATCH linux 0/3] usbip: tools: support USB over vsock(7) Date: Wed, 13 Oct 2021 13:53:10 +0000 Message-Id: <20211013135313.2494599-1-hi@alyssa.is> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: MG6JGTSQX6D5WA6IPW7NVZF4A6HVMGUU X-Message-ID-Hash: MG6JGTSQX6D5WA6IPW7NVZF4A6HVMGUU X-MailFrom: qyliss@x220.qyliss.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.4 Precedence: list List-Id: Patches and low-level development discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: This series implements USB over VSOCK sockets, as an alternative to USB over IP. This would allow, for example, a host system to share its USB controller with a VM over VFIO, and then selectively attach to certain specific USB devices exported by the VM over a VSOCK connection. If inter-guest VSOCK were to be implemented in the kernel, or using a program like vsock-bridge[1] or socat[2], USB devices could also be shared between VMs in this way, without having to have a full-on networking setup between those VMs. I've taken different approaches to implement the VSOCK support in each of the usbip client and server. For the server, I added a new program, in.usbipd, that implements an inetd-style interface, taking a socket from its environment. This way, the socket could be a TCP socket, a VSOCK socket, or something else entirely, and the program doesn't have to care. The usbip client, on the other hand, cares about what type of socket it's communicating over, because it records address information for the remote server. Since this meant I had to teach it about VSOCK anyway, to tell it how to find that information for VSOCK sockets, it was easier to just extend the existing program with an option to choose an alternative protocol family than to have it take a socket from its environment. I've tested this series by running in.usbipd in a NixOS VM, and then attaching a device from it to my host system. The following NixOS configuration sets up an in.usbipd service listening on a VSOCK socket: systemd.sockets.usbipd = { wantedBy = [ "sockets.target" ]; listenStreams = [ "vsock::3240" ]; socketConfig.Accept = "yes"; }; systemd.services."usbipd@" = { serviceConfig.ExecStart = "${usbip}/bin/in.usbipd"; serviceConfig.StandardInput = "socket"; serviceConfig.StandardOutput = "socket"; serviceConfig.StandardError = "journal"; }; [1]: https://github.com/stefano-garzarella/vsock-bridge [2]: http://www.dest-unreach.org/socat/ Alyssa Ross (3): usbip: tools: in.usbipd: add usbip: tools: usbip: record protocol usbip: tools: usbip: support vsock(7) connections tools/usb/usbip/libsrc/vhci_driver.c | 26 ++- tools/usb/usbip/src/Makefile.am | 4 +- tools/usb/usbip/src/in.usbipd.c | 326 +++++++++++++++++++++++++++ tools/usb/usbip/src/usbip_attach.c | 54 ++++- tools/usb/usbip/src/usbip_list.c | 43 +++- tools/usb/usbip/src/usbip_network.c | 51 ++++- tools/usb/usbip/src/usbip_network.h | 4 +- 7 files changed, 470 insertions(+), 38 deletions(-) create mode 100644 tools/usb/usbip/src/in.usbipd.c base-commit: 620b74d01b9d4393bef6742bf121908322c2fe0b -- 2.32.0