From owner-freebsd-virtualization@freebsd.org Tue Mar 17 12:42:12 2020 Return-Path: Delivered-To: freebsd-virtualization@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8F2FD264C44; Tue, 17 Mar 2020 12:42:12 +0000 (UTC) (envelope-from daniel.nicolescu10@gmail.com) Received: from mail-vk1-xa33.google.com (mail-vk1-xa33.google.com [IPv6:2607:f8b0:4864:20::a33]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48hXql4wk0z3Qy0; Tue, 17 Mar 2020 12:42:11 +0000 (UTC) (envelope-from daniel.nicolescu10@gmail.com) Received: by mail-vk1-xa33.google.com with SMTP id k63so5900113vka.7; Tue, 17 Mar 2020 05:42:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=ZfVaZiTETHUimPDSX5rhf3miFggNXjxOvBuGrrXHtcs=; b=Ofzpr7YIr7D9DfXebPbLHr92ElpI48QkPbYUlFC4oiXG/pcYKYybB4FzotQwVuYEAt FFVdRRXUEQ8TPq8aC39brMHvXiqJMmkBi1lY+KKAOtfs5rDMgvf/4e1ezioXLud1tozo c7FwsI1TTaBE2PAlk098SX+fv2sYKmRXtoyseZErws5+Dn/oH6JuPzte7Rluae9EYMqU c+89pbSp02/Hdxg5q9wZLKslEIKxGtGWQ+1cmsqKEFFVUiCIT5xe9YEbtgUOK9jMYh6y Me6SMsZgXuGA2Nay5iPZp0g4YR4dlk5BdB/bPrvZpIt7jSwHAZJy3L7v2M+Liw0XcTUS zEMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=ZfVaZiTETHUimPDSX5rhf3miFggNXjxOvBuGrrXHtcs=; b=MGbSv7SRpcsAacKfWdD3H+Mj525cS6W/Aw5Dqnh8CmurHaAlqS595kRQbzv7mYdIRD fHgfiNsfCeNQDikiQRu3rihSoGPgTJp3UWkbRh5ZJeDeok1tIedKfGxOglKIn3gd0Gn2 Avd7PFLcP482oSZggK31j/zqqE/XQj+XR4Rd/psjmBioRC+MBEVfeJ+dq4qRy48NyE5Z OrNXzakNJevHQqOZpG0XbvaCTN53K8nzBdAqM1rcNhIru7GYbiXCkNclebwSOoOFGJ85 07iiKdCCXg8gcD+Qp0yAWNvaFfJywB50chpNRP84UEwrQkn1SkZRKMAKVqJyrSecmXlX 3qzg== X-Gm-Message-State: ANhLgQ0XO9YiCprkjhZTlC11ubDSpWOTZH5EcgqrK4xqi4PbEAgHYWiU oqUjN8xTfhSfa7xCmYoYRt2+vpzM/YYUQTLkOmS/O4LV/9w= X-Google-Smtp-Source: ADFU+vufThdsJSUvb66q2WGJwRD3k5o7ZxEhvywIm63WAqWf9ZrEkIIR1jZvlpvORv6T4eupRYLmcIAIrDPqU7gkGtI= X-Received: by 2002:a1f:728a:: with SMTP id n132mr3436882vkc.1.1584448930005; Tue, 17 Mar 2020 05:42:10 -0700 (PDT) MIME-Version: 1.0 From: Daniel Nicolescu Date: Tue, 17 Mar 2020 14:41:59 +0200 Message-ID: Subject: USB device passthrough implementation To: freebsd-virtualization@freebsd.org, freebsd-hackers@freebsd.org Cc: patrascu.naina14@gmail.com, Mihai Carabas X-Rspamd-Queue-Id: 48hXql4wk0z3Qy0 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=Ofzpr7YI; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of danielnicolescu10@gmail.com designates 2607:f8b0:4864:20::a33 as permitted sender) smtp.mailfrom=danielnicolescu10@gmail.com X-Spamd-Result: default: False [-1.50 / 15.00]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; FROM_EQ_ENVFROM(0.00)[]; IP_SCORE(0.00)[ip: (-9.09), ipnet: 2607:f8b0::/32(-1.85), asn: 15169(-1.65), country: US(-0.05)]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; TAGGED_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[3.3.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; FREEMAIL_CC(0.00)[gmail.com]; RCVD_TLS_ALL(0.00)[]; SUSPICIOUS_RECIPS(1.50)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Mar 2020 12:42:12 -0000 Hi, We want to implement the USB pass through feature for bhyve so that users will be able to pass through individual USB devices like in QEMU. We are trying to emulate the USB controller and pass to the virtual machine only one port. * We need to disconnect the USB device from host: we are currently not very familiar with the kernel API to perform this * We need to emulate a USB device controller: we are currently looking into pci_xhci.c and usb_mouse.c to reuse some of the code from there and we would like to know if there is some sort of in depth documentation regarding these. * We need to pass the USB device to the guest through an emulated port of the device controller: we know that project ACRN implements USB device passthrough and we are trying to figure out how they do it. Could you give us a few suggestions on how to tackle these? Thanks!