From: "Mark A. Williamson" Subject: Re: usb storage vitualization Date: Mon, 8 Nov 2004 16:56:10 +0000 Message-ID: <200411081656.10268.mark.williamson@cl.cam.ac.uk> References: <200411060144.25513.mark.williamson@cl.cam.ac.uk> Reply-To: mark.williamson@cl.cam.ac.uk Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: Content-Disposition: inline Sender: xen-devel-admin@lists.sourceforge.net Errors-To: xen-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Deepak Manohar Cc: xen-devel@lists.sourceforge.net, James Harper , Ian Pratt List-Id: xen-devel@lists.xenproject.org > If I remember correctly - u had mentioned that you had started > working on USB virtualization. How much progress have you made? Got sidetracked by the Xen 2.0 release work. I'll be back to working on th= is=20 (almost) full time now. > I would be interested in contributing/learning to/from the USB > virtualization project. I'm planning on making the code available once I have a prototype=20 implementation starting to do things... > If you have time pls give me some detailed information on how you plan on > virtualizing USB. The Linux USB subsystem provides core functionality that is independent of= =20 platform, device and controller. Uses two kinds of device drivers: * Host controller drivers - these talk to the actual USB controller and=20 provide services to the core USB code. These generally use the services=20 provided by the PCI core since USB controllers are usually attached to the= =20 PCI bus. * USB device drivers - these use the services provided by the USB core in=20 order to provide support for a specific device (e.g. USB mass storage, webc= am=20 foo...) You can think of it like this: Things using block / webcam / whatever =2D---------------------------------------------------------- USB Client Device Driver (block / webcam / whatever) =2D---------------------------------------------------------- USB Core (generic services for client device drivers) =2D---------------------------------------------------------- USB Host Controller Driver I'm writing a Xen Virtual Host Controller driver that will run in unprivile= ged=20 domains. Instead of talking to a hardware host controller, it'll relay=20 requests to a backend USB driver running in dom0. The backend driver in do= m0=20 will vet the requests to make sure they are safe and then issue them to the= =20 device on behalf of the domain. You can visualise this (use a fixed width font ;-) as follows: Dom 0 XenU dom =2D----------------------- ----------------------- Backend USB driver USB Client driver (block /=20 (a USB Client Driver to <----+ webcam / whatever) rest of dom0 kernel) | =2D----------------------- | ----------------------- USB Core | USB Core =2D----------------------- | ----------------------- USB Host Controller +----> Xen Virtual Host Controller (talks to real hardware) (talks to backend using shared memory) =46rom the XenU kernel's PoV, the Xen Virtual Host Controller looks like an= y=20 other host controller. However, it's really implemented entirely in softwa= re=20 =2D the details of talking to the real host controller are taken care of in= =20 dom0. The shared memory interface will be OS agnostic, so BSD etc can hook in the= ir=20 own drivers here if they want (the USB subsystem has a similar structure in= =20 *BSD and probably any sane implementation). I'm planning to support Linux= =20 2.4 first, then maybe port to 2.6. =46rom the user's PoV, you'll be able to say "Give this USB port [on my phy= sical=20 host] to this domain." then plug devices into it and the domain should just= =20 register the device and start using it. HTH, Mark > > On Sat, 6 Nov 2004 01:44:25 +0000, Mark A. Williamson > > wrote: > > > Does it just work? USB storage devices would probably alter all the > > > time in terms of their major and minor numbers, and would come and go > > > as hot pluggable devices do. Maybe udev takes care of all this though. > > > > Weeell, as long as you keep the thing plugged in while you're using it > > you shouldn't have any problems exporting the device like any other blo= ck > > device, so in that sense it should work fine. > > > > Unfortunately, as you rightly point out, by the time you've rebooted do= m0 > > and plugged / unplugged devices a few times you may find that your USB > > storage device has different major / minor. On non-udev setups, it's > > quite possibly going to have a different device node altogether, which > > will mean your config file needs updating... > > > > I tend to agree that udev should solve this problem, however, since > > you'll be able to configure that device to always bind to the same devi= ce > > node. Whenever you create the domain, it'll look up the major / minor > > associated with that device node and everything should work fine. > > > > Cheers, > > Mark > > > > > I ask because i'm interested in doing this too. > > > > > > James > > > > > > > > > ------------------------------------------------------- > > > This SF.Net email is sponsored by: > > > Sybase ASE Linux Express Edition - download now for FREE > > > LinuxWorld Reader's Choice Award Winner for best database on Linux. > > > http://ads.osdn.com/?ad_idU88&alloc_id=12065&op=3DClick > > > _______________________________________________ > > > Xen-devel mailing list > > > Xen-devel@lists.sourceforge.net > > > https://lists.sourceforge.net/lists/listinfo/xen-devel ------------------------------------------------------- This SF.Net email is sponsored by: Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux. http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click