Here''s the latest USB code against the xen 3.0.0 release. Since the last posting this version updates the code to use the new 32 bit grant references and the latest GNTTABOP_map_grant_ref definition. I''ve also changed the definition of the virtual USB HCD to have a single port rather than seven ports with six unused. Domains importing multiple USB devices will get a HCD for each device (this feature currently untested). I went with this solution because it scales indefinitely. This code passes the usual sniff test of mounting a filesystem on a USB key. The issues that I know about that remain with this code are as follows: o - The USB protocol requires stalling the URB queue during error conditions. This isn''t done correctly yet which makes the code unsafe for write access during error recovery. o - The resource pools are currently only allocating the minimum resources required to avoid deadlock so performance will be resource constrained. This can be fixed either by implementing a larger static resource allocation or improving the buffer_resource_provider to implement a dynamic shared resource pool. Either is fairly easy. o - You no longer need to specify swiotlb=force because xen has a small swiotlb turned on by default. If you explicitly turn the swiotlb off, the USB code will still be broken. o - The USB-specific part of the interdomain protocol is using polling for device discovery which is inefficient. I looked into fixing this and it won''t be too hard to change the protocol so that the BE sends a message to the FE to kick the FE into re-probing the BE. This will make the BE device state machine a bit more complicated. o - Design documentation for the USB driver is required. o - We might not want to keep the xenidc code. API documentation for the xenidc API is required if we are going to keep the xenidc code. o - Isochronous URBs are untested. o - My test machine is USB 1.2 and I''ve not yet tested with USB 2.0. o - Suspend and resume is untested. Domain migration is untested. o - I''ve only ever tried to build the code for X86 and never X86_64. o - Automated tests integrated with the xm-test framework would be good. o - Need to run the USB part by the usb mailing list once I fix the protocol and think it''s OK. I split the patch into two just in case anyone wants to play with the xenidc code. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
I installed both patches ( xenidc and usb) to an HS20 blade which has an USB cdrom. Also I installed submount-0.9-33.6 in order to mount CDROM. It ends up to an error when I try to access the CD. "/media/cdrom; No medium found" I have the following line in /etc/fstab: /dev/cdrom /media/cdrom subfs fs=cdfss,ro 0 0 ( Tried with different fs like. fs=iso9660 also has the same problem) dmesg has: subfs: submountd execution failure. Error 256 Anyone has any ideas ? Regards, Hien Nguyen Linux Technology Center AUSTIN Phone: (512) 838-4140 Tie Line: 678-4140 e-mail: hien1@us.ibm.com _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
I can''t tell what''s wrong or very much about how far you got from your note below. What you are doing has never been tried before so it may very well simply not work yet but if you are happy to have a go anyway, here''s how to proceed: It would be a good start to check that a directory for the usb cdrom device appears in /sys/bus/usb/devices in the front-end domain. If it doesn''t then it means that the USB split driver hasn''t been installed properly or isn''t configured properly or has a bug in this area. Some things to check in this case would be whether the front-end and back-end USB driver modules were loaded and whether the front-end domain configuration contained a line to configure the mapping of the back-end USB port to the front end domain. Also check that you are actually configuring the correct back-end port here. You should also disable the usb driver that would otherwise drive the cdrom in the backend domain otherwise it may grab the cdrom before the split driver gets a chance. If a directory for the cdrom device does appear in the front-end /sys/bus/usb/devices then that means that you have successfully mapped the cdrom device into the front-end domain and are halfway towards getting it working. Then you need to make sure that you have a USB driver for the cdrom device loaded in the front-end domain. After that, it may work. You will of course need to put a cd into the drive :-) If you are still having problems then you can rebuild the USB back and front end drivers with tracing turned on (it''s a kernel option). Then retry your test and post me the syslogs containing the trace output of the back end and front end drivers. This should be enough information for me to debug the problem. Thanks for trying this out. Harry On Wed, 2005-12-07 at 15:01 -0600, Hien Nguyen wrote:> I installed both patches ( xenidc and usb) to an HS20 blade which has > an USB cdrom. Also I installed submount-0.9-33.6 in order to mount CDROM. > It ends up to an error when I try to access the CD. > "/media/cdrom; No medium found" > > I have the following line in /etc/fstab: > /dev/cdrom /media/cdrom subfs fs=cdfss,ro 0 0 > ( Tried with different fs like. fs=iso9660 also has the same problem) > > dmesg has: > subfs: submountd execution failure. Error 256 > Anyone has any ideas ? > > Regards, > > Hien Nguyen > Linux Technology Center AUSTIN > Phone: (512) 838-4140 Tie Line: 678-4140 > e-mail: hien1@us.ibm.com > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel >-- Harry Butterworth <harry@hebutterworth.freeserve.co.uk> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Harry, I know that I missed something. Please tell me what to do to configure the usb cdrom correctly . How do I know which one is the usb cdrom device that shows up in /sys/bus/usb/devices ? bl3-5:/sys/bus/usb/devices # ls -lt total 0 drwxr-xr-x 2 root root 0 Dec 12 13:22 . lrwxrwxrwx 1 root root 0 Dec 12 13:22 1-0:1.0 -> ../../../devices/pci0000:00/0000:00:0f.2/usb1/1-0:1.0 lrwxrwxrwx 1 root root 0 Dec 12 13:22 1-2 -> ../../../devices/pci0000:00/0000:00:0f.2/usb1/1-2 lrwxrwxrwx 1 root root 0 Dec 12 13:22 1-2.1 -> ../../../devices/pci0000:00/0000:00:0f.2/usb1/1-2/1-2.1 lrwxrwxrwx 1 root root 0 Dec 12 13:22 1-2.1:1.0 -> ../../../devices/pci0000:00/0000:00:0f.2/usb1/1-2/1-2.1/1-2.1:1.0 lrwxrwxrwx 1 root root 0 Dec 12 13:22 1-2.1:1.1 -> ../../../devices/pci0000:00/0000:00:0f.2/usb1/1-2/1-2.1/1-2.1:1.1 lrwxrwxrwx 1 root root 0 Dec 12 13:22 1-2:1.0 -> ../../../devices/pci0000:00/0000:00:0f.2/usb1/1-2/1-2:1.0 lrwxrwxrwx 1 root root 0 Dec 12 13:22 usb1 -> ../../../devices/pci0000:00/0000:00:0f.2/usb1 lrwxrwxrwx 1 root root 0 Dec 12 13:22 1-1 -> ../../../devices/pci0000:00/0000:00:0f.2/usb1/1-1 lrwxrwxrwx 1 root root 0 Dec 12 13:22 1-1.1 -> ../../../devices/pci0000:00/0000:00:0f.2/usb1/1-1/1-1.1 lrwxrwxrwx 1 root root 0 Dec 12 13:22 1-1.1:1.0 -> ../../../devices/pci0000:00/0000:00:0f.2/usb1/1-1/1-1.1/1-1.1:1.0 lrwxrwxrwx 1 root root 0 Dec 12 13:22 1-1.3 -> ../../../devices/pci0000:00/0000:00:0f.2/usb1/1-1/1-1.3 lrwxrwxrwx 1 root root 0 Dec 12 13:22 1-1.3:1.0 -> ../../../devices/pci0000:00/0000:00:0f.2/usb1/1-1/1-1.3/1-1.3:1.0 lrwxrwxrwx 1 root root 0 Dec 12 13:22 1-1:1.0 -> ../../../devices/pci0000:00/0000:00:0f.2/usb1/1-1/1-1:1.0 lrwxrwxrwx 1 root root 0 Dec 12 13:22 1-2.3 -> ../../../devices/pci0000:00/0000:00:0f.2/usb1/1-2/1-2.3 lrwxrwxrwx 1 root root 0 Dec 12 13:22 1-2.3:1.0 -> ../../../devices/pci0000:00/0000:00:0f.2/usb1/1-2/1-2.3/1-2.3:1.0 lrwxrwxrwx 1 root root 0 Dec 12 13:22 1-2.3:1.1 -> ../../../devices/pci0000:00/0000:00:0f.2/usb1/1-2/1-2.3/1-2.3:1.1 drwxr-xr-x 4 root root 0 Dec 7 13:20 .. ------ Also modules loaded included here: bl3-5:/sys/bus/usb/devices # lsmod Module Size Used by ipt_physdev 2640 2 iptable_filter 2944 1 ip_tables 19072 2 ipt_physdev,iptable_filter udf 90756 0 thermal 10696 0 processor 15492 1 thermal fan 3428 0 button 5136 0 battery 7780 0 ac 3588 0 qla2300 123104 0 qla2xxx 89936 8 qla2300 scsi_transport_fc 25952 1 qla2xxx sworks_agp 7712 0 agpgart 31080 1 sworks_agp subfs 6048 1 ------------ Attached the .config file for dom0 on HS20 blade: (See attached file: config.dom0.blade) Regards, Hien Nguyen Linux Technology Center AUSTIN Phone: (512) 838-4140 Tie Line: 678-4140 e-mail: hien1@us.ibm.com Harry Butterworth <harry@hebutterwo rth.freeserve.co. To uk> Hien Nguyen/Austin/IBM@IBMUS 12/07/2005 05:05 cc PM xen-devel@lists.xensource.com Subject Re: [Xen-devel] Re: Latest USB code I can''t tell what''s wrong or very much about how far you got from your note below. What you are doing has never been tried before so it may very well simply not work yet but if you are happy to have a go anyway, here''s how to proceed: It would be a good start to check that a directory for the usb cdrom device appears in /sys/bus/usb/devices in the front-end domain. If it doesn''t then it means that the USB split driver hasn''t been installed properly or isn''t configured properly or has a bug in this area. Some things to check in this case would be whether the front-end and back-end USB driver modules were loaded and whether the front-end domain configuration contained a line to configure the mapping of the back-end USB port to the front end domain. Also check that you are actually configuring the correct back-end port here. You should also disable the usb driver that would otherwise drive the cdrom in the backend domain otherwise it may grab the cdrom before the split driver gets a chance. If a directory for the cdrom device does appear in the front-end /sys/bus/usb/devices then that means that you have successfully mapped the cdrom device into the front-end domain and are halfway towards getting it working. Then you need to make sure that you have a USB driver for the cdrom device loaded in the front-end domain. After that, it may work. You will of course need to put a cd into the drive :-) If you are still having problems then you can rebuild the USB back and front end drivers with tracing turned on (it''s a kernel option). Then retry your test and post me the syslogs containing the trace output of the back end and front end drivers. This should be enough information for me to debug the problem. Thanks for trying this out. Harry On Wed, 2005-12-07 at 15:01 -0600, Hien Nguyen wrote:> I installed both patches ( xenidc and usb) to an HS20 blade which has> an USB cdrom. Also I installed submount-0.9-33.6 in order to mount CDROM.> It ends up to an error when I try to access the CD. > "/media/cdrom; No medium found" > > I have the following line in /etc/fstab: > /dev/cdrom /media/cdrom subfs fs=cdfss,ro 0 0 > ( Tried with different fs like. fs=iso9660 also has the same problem) > > dmesg has: > subfs: submountd execution failure. Error 256 > Anyone has any ideas ? > > Regards, > > Hien Nguyen > Linux Technology Center AUSTIN > Phone: (512) 838-4140 Tie Line: 678-4140 > e-mail: hien1@us.ibm.com > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel >-- Harry Butterworth <harry@hebutterworth.freeserve.co.uk> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
I''m fairly confused by your note below: I can''t work out whether you are trying to get the USB cdrom drive working in domain 0 or in another guest domain. If you are trying to get the cdrom drive working in domain 0 then you don''t need my patch. The cdrom drive should just work the same as it does in native Linux provided you compile the kernel with all the modules that are required. If it doesn''t, I can''t help you. If you are trying to get the cdrom drive working in another guest domain then you have made some mistakes below. I''ll run through again from the beginning in more detail this time... Let''s assume you have two domains: dom0 and domU. dom0 is the one with physical access to the USB host controller device hardware. domU is a guest domain. You want to plug the cdrom into the USB host controller device driven by dom0 and have the cdrom device appear as a USB device in domU. You need to: 1) Apply my patch to both the dom0 and the domU kernels. 2) Compile the dom0 kernel with support for the usb back-end driver as a module. The dom0 kernel also needs to be compiled with USB support and support for driving the USB host controller device (UHCI/OHCI/EHCI depending on what hardware you have). 3) Compile the domU kernel with support for the usb front-end driver as a module. The domU kernel also needs USB support and support for any other modules required to drive the cdrom under native linux. I think usb-storage is the only module you need to drive the cdrom device but I''m not sure. You can check by getting it working in native Linux and having a look at what USB modules are loaded. If you want, you can put the union of all these options into one kernel and use the same kernel for dom0 and domU. In any case, you will need to disable the usb-storage module in dom0 to prevent it from grabbing the cdrom before the split driver can export it to domU. 4) Put a line in the domU configuration---THIS IS THE domU DOMAIN CONFIGURATION, NOT THE domU KERNEL CONFIGURATION---to export the cdrom device from dom0 to domU: If the cdrom device was 1-1 in /sys/bus/usb/devices in dom0 then the domU domain configuration should contain the line: usb = [''path=1''] Alternatively, if the cdrom device was 1-2 in /sys/bus/usb/devices in dom0 then the domU domain configuration should contain the line: usb = [''path=2''] Or, as a final example, if the cdrom device was 1-2.3 in sys/bus/usb/devices in dom0 then the domU domain configuration should contain the line: usb = [''path=2.3''] You should be able to tell which dom0 device is the cdrom device by examining the contents of the ''product'' entry in the device directory in /sys/bus/usb/devices in dom0. Alternatively, you could unplug the cdrom, list sys/bus/usb/devices then plug it back in and list sys/bus/usb/devices again. A number of directories should have appeared for the cdrom. The one with the shortest name is the one for the device, any others are for interfaces of the device. 5) modprobe the usbback module into the dom0 kernel. 6) boot the domU domain. 7) modprobe the usbfront module into the domU kernel. 8) Now have a look at /sys/bus/usb/devices in domU. You should now see a directory for the cdrom device here in domU. 9) Modprobe usb-storage in domU. This should give you a SCSI device for your cdrom drive. Look in /var/log/syslog to find out which one. 10) Put a CD in the drive. 11) Mount the scsi device. All of this works with a USB flash device but I''m not sure how much will work with a cdrom. I''ll go through your note below to point out any problems I can see... On Mon, 2005-12-12 at 12:38 -0700, Hien Nguyen wrote:> Harry, > > I know that I missed something. Please tell me what to do to configure > the usb cdrom correctly . > > How do I know which one is the usb cdrom device that shows up > in /sys/bus/usb/devices ?Look at the ''product'' file or unplug and replug to see what goes away and then comes back.> > bl3-5:/sys/bus/usb/devices # ls -lt > total 0 > drwxr-xr-x 2 root root 0 Dec 12 13:22 . > lrwxrwxrwx 1 root root 0 Dec 12 13:22 1-0:1.0 > -> ../../../devices/pci0000:00/0000:00:0f.2/usb1/1-0:1.0 > lrwxrwxrwx 1 root root 0 Dec 12 13:22 1-2 > -> ../../../devices/pci0000:00/0000:00:0f.2/usb1/1-2 > lrwxrwxrwx 1 root root 0 Dec 12 13:22 1-2.1 > -> ../../../devices/pci0000:00/0000:00:0f.2/usb1/1-2/1-2.1It might be 1-2.1> lrwxrwxrwx 1 root root 0 Dec 12 13:22 1-2.1:1.0 > -> ../../../devices/pci0000:00/0000:00:0f.2/usb1/1-2/1-2.1/1-2.1:1.0 > lrwxrwxrwx 1 root root 0 Dec 12 13:22 1-2.1:1.1 > -> ../../../devices/pci0000:00/0000:00:0f.2/usb1/1-2/1-2.1/1-2.1:1.1 > lrwxrwxrwx 1 root root 0 Dec 12 13:22 1-2:1.0 > -> ../../../devices/pci0000:00/0000:00:0f.2/usb1/1-2/1-2:1.0 > lrwxrwxrwx 1 root root 0 Dec 12 13:22 usb1 > -> ../../../devices/pci0000:00/0000:00:0f.2/usb1 > lrwxrwxrwx 1 root root 0 Dec 12 13:22 1-1 > -> ../../../devices/pci0000:00/0000:00:0f.2/usb1/1-1 > lrwxrwxrwx 1 root root 0 Dec 12 13:22 1-1.1 > -> ../../../devices/pci0000:00/0000:00:0f.2/usb1/1-1/1-1.1It might be 1-1.1> lrwxrwxrwx 1 root root 0 Dec 12 13:22 1-1.1:1.0 > -> ../../../devices/pci0000:00/0000:00:0f.2/usb1/1-1/1-1.1/1-1.1:1.0 > lrwxrwxrwx 1 root root 0 Dec 12 13:22 1-1.3 > -> ../../../devices/pci0000:00/0000:00:0f.2/usb1/1-1/1-1.3It might be 1-1.3> lrwxrwxrwx 1 root root 0 Dec 12 13:22 1-1.3:1.0 > -> ../../../devices/pci0000:00/0000:00:0f.2/usb1/1-1/1-1.3/1-1.3:1.0 > lrwxrwxrwx 1 root root 0 Dec 12 13:22 1-1:1.0 > -> ../../../devices/pci0000:00/0000:00:0f.2/usb1/1-1/1-1:1.0 > lrwxrwxrwx 1 root root 0 Dec 12 13:22 1-2.3 > -> ../../../devices/pci0000:00/0000:00:0f.2/usb1/1-2/1-2.3It might be 1-2.3> lrwxrwxrwx 1 root root 0 Dec 12 13:22 1-2.3:1.0 > -> ../../../devices/pci0000:00/0000:00:0f.2/usb1/1-2/1-2.3/1-2.3:1.0 > lrwxrwxrwx 1 root root 0 Dec 12 13:22 1-2.3:1.1 > -> ../../../devices/pci0000:00/0000:00:0f.2/usb1/1-2/1-2.3/1-2.3:1.1 > drwxr-xr-x 4 root root 0 Dec 7 13:20 .. > ------ > Also modules loaded included here:This is dom0 so you should have the usbback module loaded but you don''t.> > bl3-5:/sys/bus/usb/devices # lsmod > Module Size Used by > ipt_physdev 2640 2 > iptable_filter 2944 1 > ip_tables 19072 2 ipt_physdev,iptable_filter > udf 90756 0 > thermal 10696 0 > processor 15492 1 thermal > fan 3428 0 > button 5136 0 > battery 7780 0 > ac 3588 0 > qla2300 123104 0 > qla2xxx 89936 8 qla2300 > scsi_transport_fc 25952 1 qla2xxx > sworks_agp 7712 0 > agpgart 31080 1 sworks_agp > subfs 6048 1 > > ------------ > Attached the .config file for dom0 on HS20 blade: > (See attached file: config.dom0.blade)The .config file doesn''t have the usbback module configured. You need to cuild the usbback module for dom0 and the usbfront module for domU. Hopefully this will get you a bit further. Harry.> > Regards, > > Hien Nguyen > Linux Technology Center AUSTIN > Phone: (512) 838-4140 Tie Line: 678-4140 > e-mail: hien1@us.ibm.com > > Inactive hide details for Harry Butterworth > <harry@hebutterworth.freeserve.co.uk>Harry Butterworth > <harry@hebutterworth.freeserve.co.uk> > > > Harry Butterworth <harry@hebutterworth.freeserve.co.uk> > > 12/07/2005 05:05 PM > > > To > > Hien > Nguyen/Austin/IBM@IBMUS > > cc > > xen-devel@lists.xensource.com > > > > > > > > > > Subject > > Re: [Xen-devel] > Re: Latest USB > code > > > > I can''t tell what''s wrong or very much about how far you got from your > note below. What you are doing has never been tried before so it may > very well simply not work yet but if you are happy to have a go > anyway, > here''s how to proceed: > > It would be a good start to check that a directory for the usb cdrom > device appears in /sys/bus/usb/devices in the front-end domain. > > If it doesn''t then it means that the USB split driver hasn''t been > installed properly or isn''t configured properly or has a bug in this > area. > > Some things to check in this case would be whether the front-end and > back-end USB driver modules were loaded and whether the front-end > domain > configuration contained a line to configure the mapping of the > back-end > USB port to the front end domain. Also check that you are actually > configuring the correct back-end port here. You should also disable > the > usb driver that would otherwise drive the cdrom in the backend domain > otherwise it may grab the cdrom before the split driver gets a chance. > > If a directory for the cdrom device does appear in the > front-end /sys/bus/usb/devices then that means that you have > successfully mapped the cdrom device into the front-end domain and are > halfway towards getting it working. > > Then you need to make sure that you have a USB driver for the cdrom > device loaded in the front-end domain. > > After that, it may work. > > You will of course need to put a cd into the drive :-) > > If you are still having problems then you can rebuild the USB back and > front end drivers with tracing turned on (it''s a kernel option). Then > retry your test and post me the syslogs containing the trace output of > the back end and front end drivers. > > This should be enough information for me to debug the problem. > > Thanks for trying this out. > > Harry > > On Wed, 2005-12-07 at 15:01 -0600, Hien Nguyen wrote: > > I installed both patches ( xenidc and usb) to an HS20 blade which > has > > an USB cdrom. Also I installed submount-0.9-33.6 in order to mount > CDROM. > > It ends up to an error when I try to access the CD. > > "/media/cdrom; No medium found" > > > > I have the following line in /etc/fstab: > > /dev/cdrom /media/cdrom subfs fs=cdfss,ro 0 0 > > ( Tried with different fs like. fs=iso9660 also has the same > problem) > > > > dmesg has: > > subfs: submountd execution failure. Error 256 > > Anyone has any ideas ? > > > > Regards, > > > > Hien Nguyen > > Linux Technology Center AUSTIN > > Phone: (512) 838-4140 Tie Line: 678-4140 > > e-mail: hien1@us.ibm.com > > > > > > _______________________________________________ > > Xen-devel mailing list > > Xen-devel@lists.xensource.com > > http://lists.xensource.com/xen-devel > > > -- > Harry Butterworth <harry@hebutterworth.freeserve.co.uk> > > > > >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel