* USB problem. 'irq 9: nobody cared!'
@ 2003-09-21 18:41 Yaroslav Halchenko
2003-09-22 6:33 ` Jan Dittmer
0 siblings, 1 reply; 11+ messages in thread
From: Yaroslav Halchenko @ 2003-09-21 18:41 UTC (permalink / raw)
To: linux-kernel; +Cc: kernel
Dear Gurus,
Since one of the bk versions in -test4- USB problem persist. On boot I'm
getting next dump. More information about my system and configuration is at
http://www.onerussian.com/Linux/bug.USB/
Please help to get rid of the problem cause USB doesn't work now for me :-(
drivers/usb/host/uhci-hcd.c: USB Universal Host Controller Interface
driver v2.1
uhci-hcd 0000:00:1f.2: UHCI Host Controller
irq 9: nobody cared!
Call Trace:
[<c010b70a>] __report_bad_irq+0x2a/0x90
[<c010b800>] note_interrupt+0x70/0xb0
[<c010bad0>] do_IRQ+0x120/0x130
[<c0109d88>] common_interrupt+0x18/0x20
[<c0124b6e>] do_softirq+0x3e/0xa0
[<c010baab>] do_IRQ+0xfb/0x130
[<c0109d88>] common_interrupt+0x18/0x20
[<c01f3c60>] pci_bus_write_config_word+0x60/0x90
[<c02f6331>] uhci_reset+0x41/0x60
[<c02e5b44>] usb_hcd_pci_probe+0x194/0x4a0
[<c016b3a1>] dput+0x31/0x220
[<c01f7bc2>] pci_device_probe_static+0x52/0x70
[<c01f7c1c>] __pci_device_probe+0x3c/0x50
[<c01f7c5c>] pci_device_probe+0x2c/0x50
[<c025accf>] bus_match+0x3f/0x70
[<c025ae1f>] driver_attach+0x6f/0xb0
[<c025b0e3>] bus_add_driver+0x93/0xb0
[<c025b51f>] driver_register+0x2f/0x40
[<c01f7e50>] pci_register_driver+0x60/0x90
[<c053207d>] uhci_hcd_init+0xbd/0x150
[<c05167ab>] do_initcalls+0x2b/0xa0
[<c01305bf>] init_workqueues+0xf/0x30
[<c01050a4>] init+0x34/0x1d0
[<c0105070>] init+0x0/0x1d0
[<c01072a5>] kernel_thread_helper+0x5/0x10
handlers:
[<c02015cf>] (acpi_irq+0x0/0x16)
[<c02bb040>] (ohci_irq_handler+0x0/0x7e0)
[<c02d9240>] (yenta_interrupt+0x0/0x40)
Disabling IRQ #9
Sincerely
.-.
=------------------------------ /v\ ----------------------------=
Keep in touch // \\ (yoh@|www.)onerussian.com
Yaroslav Halchenko /( )\ ICQ#: 60653192
Linux User ^^-^^ [175555]
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: USB problem. 'irq 9: nobody cared!' 2003-09-21 18:41 USB problem. 'irq 9: nobody cared!' Yaroslav Halchenko @ 2003-09-22 6:33 ` Jan Dittmer [not found] ` <20030923050848.GA5917@washoe.rutgers.edu> 0 siblings, 1 reply; 11+ messages in thread From: Jan Dittmer @ 2003-09-22 6:33 UTC (permalink / raw) To: kernel; +Cc: linux-kernel Yaroslav Halchenko <kernel@onerussian.com> wrote on 2003-09-21 14:41:49 > Dear Gurus, > > Since one of the bk versions in -test4- USB problem persist. On boot I'm > getting next dump. More information about my system and configuration is at > > http://www.onerussian.com/Linux/bug.USB/ > > Please help to get rid of the problem cause USB doesn't work now for me :-( Try reverting the following patch, taken from the bk4-bk5 incremental diff (Apply with patch -p1 -R). This fixed it for me. Jan -- Jan Dittmer - jdittmer@ppp0.net diff -urN linux-2.6.0-test4-bk4/drivers/usb/core/hcd-pci.c linux-2.6.0-test4-bk5/drivers/usb/core/hcd-pci.c --- linux-2.6.0-test4-bk4/drivers/usb/core/hcd-pci.c 2003-08-22 16:55:40.000000000 -0700 +++ linux-2.6.0-test4-bk5/drivers/usb/core/hcd-pci.c 2003-09-03 04:46:52.000000000 -0700 @@ -139,6 +139,7 @@ return retval; } } + // hcd zeroed everything hcd->regs = base; hcd->region = region; @@ -165,6 +166,7 @@ dev_err (hcd->controller, "can't reset\n"); goto clean_3; } + hcd->state = USB_STATE_HALT; pci_set_master (dev); #ifndef __sparc__ @@ -230,7 +232,8 @@ BUG (); hub = hcd->self.root_hub; - hcd->state = USB_STATE_QUIESCING; + if (HCD_IS_RUNNING (hcd->state)) + hcd->state = USB_STATE_QUIESCING; dev_dbg (hcd->controller, "roothub graceful disconnect\n"); usb_disconnect (&hub); @@ -287,8 +290,8 @@ pci_save_state (dev, hcd->pci_state); /* driver may want to disable DMA etc */ + hcd->state = USB_STATE_QUIESCING; retval = hcd->driver->suspend (hcd, state); - hcd->state = USB_STATE_SUSPENDED; } pci_set_power_state (dev, state); diff -urN linux-2.6.0-test4-bk4/drivers/usb/core/hcd.c linux-2.6.0-test4-bk5/drivers/usb/core/hcd.c --- linux-2.6.0-test4-bk4/drivers/usb/core/hcd.c 2003-08-22 16:57:00.000000000 -0700 +++ linux-2.6.0-test4-bk5/drivers/usb/core/hcd.c 2003-09-03 04:46:52.000000000 -0700 @@ -483,7 +483,7 @@ { struct urb *urb; struct usb_hcd *hcd; - int length; + int length = 0; unsigned long flags; urb = (struct urb *) ptr; @@ -499,7 +499,9 @@ return; } - length = hcd->driver->hub_status_data (hcd, urb->transfer_buffer); + if (!HCD_IS_SUSPENDED (hcd->state)) + length = hcd->driver->hub_status_data ( + hcd, urb->transfer_buffer); /* complete the status urb, or retrigger the timer */ spin_lock (&hcd_data_lock); @@ -1097,6 +1099,8 @@ static int hcd_get_frame_number (struct usb_device *udev) { struct usb_hcd *hcd = (struct usb_hcd *)udev->bus->hcpriv; + if (!HCD_IS_RUNNING (hcd->state)) + return -ESHUTDOWN; return hcd->driver->get_frame_number (hcd); } @@ -1193,6 +1197,12 @@ goto done; } + /* running ~= hc unlink handshake works (irq, timer, etc) + * halted ~= no unlink handshake is needed + * suspended, resuming == should never happen + */ + WARN_ON (!HCD_IS_RUNNING (hcd->state) && hcd->state != USB_STATE_HALT); + if (!urb->hcpriv) { retval = -EINVAL; goto done; @@ -1208,6 +1218,17 @@ goto done; } + /* PCI IRQ setup can easily be broken so that USB controllers + * never get completion IRQs ... maybe even the ones we need to + * finish unlinking the initial failed usb_set_address(). + */ + if (!hcd->saw_irq) { + dev_warn (hcd->controller, "Unlink after no-IRQ? " + "Different ACPI or APIC settings may help." + "\n"); + hcd->saw_irq = 1; + } + /* maybe set up to block until the urb's completion fires. the * lower level hcd code is always async, locking on urb->status * updates; an intercepted completion unblocks us. @@ -1287,6 +1308,8 @@ dev = udev->hcpriv; hcd = udev->bus->hcpriv; + WARN_ON (!HCD_IS_RUNNING (hcd->state) && hcd->state != USB_STATE_HALT); + local_irq_disable (); rescan: @@ -1483,6 +1506,7 @@ if (unlikely (hcd->state == USB_STATE_HALT)) /* irq sharing? */ return IRQ_NONE; + hcd->saw_irq = 1; hcd->driver->irq (hcd, r); if (hcd->state != start && hcd->state == USB_STATE_HALT) usb_hc_died (hcd); diff -urN linux-2.6.0-test4-bk4/drivers/usb/core/hcd.h linux-2.6.0-test4-bk5/drivers/usb/core/hcd.h --- linux-2.6.0-test4-bk4/drivers/usb/core/hcd.h 2003-08-22 16:53:55.000000000 -0700 +++ linux-2.6.0-test4-bk5/drivers/usb/core/hcd.h 2003-09-03 04:46:52.000000000 -0700 @@ -73,6 +73,7 @@ * hardware info/state */ struct hc_driver *driver; /* hw-specific hooks */ + unsigned saw_irq : 1; int irq; /* irq allocated */ void *regs; /* device memory/io */ struct device *controller; /* handle to hardware */ @@ -89,13 +90,11 @@ int state; # define __ACTIVE 0x01 -# define __SLEEPY 0x02 # define __SUSPEND 0x04 # define __TRANSIENT 0x80 # define USB_STATE_HALT 0 # define USB_STATE_RUNNING (__ACTIVE) -# define USB_STATE_READY (__ACTIVE|__SLEEPY) # define USB_STATE_QUIESCING (__SUSPEND|__TRANSIENT|__ACTIVE) # define USB_STATE_RESUMING (__SUSPEND|__TRANSIENT) # define USB_STATE_SUSPENDED (__SUSPEND) diff -urN linux-2.6.0-test4-bk4/drivers/usb/core/message.c linux-2.6.0-test4-bk5/drivers/usb/core/message.c --- linux-2.6.0-test4-bk4/drivers/usb/core/message.c 2003-08-22 16:53:13.000000000 -0700 +++ linux-2.6.0-test4-bk5/drivers/usb/core/message.c 2003-09-03 04:46:52.000000000 -0700 @@ -246,21 +246,22 @@ io->status = urb->status; /* the previous urbs, and this one, completed already. - * unlink the later ones so they won't rx/tx bad data, - * - * FIXME don't bother unlinking urbs that haven't yet been - * submitted; those non-error cases shouldn't be syslogged + * unlink pending urbs so they won't rx/tx bad data. */ for (i = 0, found = 0; i < io->entries; i++) { + if (!io->urbs [i]) + continue; if (found) { status = usb_unlink_urb (io->urbs [i]); - if (status && status != -EINPROGRESS) - err ("sg_complete, unlink --> %d", - status); + if (status != -EINPROGRESS && status != -EBUSY) + dev_err (&io->dev->dev, + "%s, unlink --> %d\n", + __FUNCTION__, status); } else if (urb == io->urbs [i]) found = 1; } } + urb->dev = 0; /* on the last completion, signal usb_sg_wait() */ io->bytes += urb->actual_length; @@ -356,7 +357,7 @@ goto nomem; } - io->urbs [i]->dev = dev; + io->urbs [i]->dev = 0; io->urbs [i]->pipe = pipe; io->urbs [i]->interval = period; io->urbs [i]->transfer_flags = urb_flags; @@ -448,6 +449,7 @@ for (i = 0; i < io->entries && !io->status; i++) { int retval; + io->urbs [i]->dev = io->dev; retval = usb_submit_urb (io->urbs [i], SLAB_ATOMIC); /* after we submit, let completions or cancelations fire; @@ -459,9 +461,9 @@ case -ENXIO: // hc didn't queue this one case -EAGAIN: case -ENOMEM: + io->urbs [i]->dev = 0; retval = 0; i--; - // FIXME: should it usb_sg_cancel() on INTERRUPT? yield (); break; @@ -477,8 +479,10 @@ /* fail any uncompleted urbs */ default: + io->urbs [i]->dev = 0; io->urbs [i]->status = retval; - dbg ("usb_sg_msg, submit --> %d", retval); + dev_dbg (&io->dev->dev, "%s, submit --> %d\n", + __FUNCTION__, retval); usb_sg_cancel (io); } spin_lock_irqsave (&io->lock, flags); @@ -521,9 +525,9 @@ if (!io->urbs [i]->dev) continue; retval = usb_unlink_urb (io->urbs [i]); - if (retval && retval != -EINPROGRESS) - warn ("usb_sg_cancel, unlink --> %d", retval); - // FIXME don't warn on "not yet submitted" error + if (retval != -EINPROGRESS && retval != -EBUSY) + dev_warn (&io->dev->dev, "%s, unlink --> %d\n", + __FUNCTION__, retval); } } spin_unlock_irqrestore (&io->lock, flags); diff -urN linux-2.6.0-test4-bk4/drivers/usb/core/usb.c linux-2.6.0-test4-bk5/drivers/usb/core/usb.c --- linux-2.6.0-test4-bk4/drivers/usb/core/usb.c 2003-08-22 16:56:17.000000000 -0700 +++ linux-2.6.0-test4-bk5/drivers/usb/core/usb.c 2003-09-03 04:46:52.000000000 -0700 @@ -991,8 +991,8 @@ * * This call is synchronous, and may not be used in an interrupt context. * - * Only hub drivers (including virtual root hub drivers for host - * controllers) should ever call this. + * Only the hub driver should ever call this; root hub registration + * uses it only indirectly. */ #define NEW_DEVICE_RETRYS 2 #define SET_ADDRESS_RETRYS 2 @@ -1417,11 +1417,46 @@ usb_pipein (pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE); } +static int usb_device_suspend(struct device *dev, u32 state) +{ + struct usb_interface *intf; + struct usb_driver *driver; + + if ((dev->driver == &usb_generic_driver) || + (dev->driver_data == &usb_generic_driver_data)) + return 0; + + intf = to_usb_interface(dev); + driver = to_usb_driver(dev->driver); + + if (driver && driver->suspend) + return driver->suspend(intf, state); + return 0; +} + +static int usb_device_resume(struct device *dev) +{ + struct usb_interface *intf; + struct usb_driver *driver; + + if ((dev->driver == &usb_generic_driver) || + (dev->driver_data == &usb_generic_driver_data)) + return 0; + + intf = to_usb_interface(dev); + driver = to_usb_driver(dev->driver); + + if (driver && driver->resume) + return driver->resume(intf); + return 0; +} struct bus_type usb_bus_type = { .name = "usb", .match = usb_device_match, .hotplug = usb_hotplug, + .suspend = usb_device_suspend, + .resume = usb_device_resume, }; #ifndef MODULE @@ -1509,7 +1544,6 @@ EXPORT_SYMBOL(usb_find_interface); EXPORT_SYMBOL(usb_ifnum_to_if); -EXPORT_SYMBOL(usb_new_device); EXPORT_SYMBOL(usb_reset_device); EXPORT_SYMBOL(usb_disconnect); diff -urN linux-2.6.0-test4-bk4/drivers/usb/host/uhci-hcd.c linux-2.6.0-test4-bk5/drivers/usb/host/uhci-hcd.c --- linux-2.6.0-test4-bk4/drivers/usb/host/uhci-hcd.c 2003-08-22 16:59:32.000000000 -0700 +++ linux-2.6.0-test4-bk5/drivers/usb/host/uhci-hcd.c 2003-09-03 04:46:52.000000000 -0700 @@ -2099,7 +2099,7 @@ uhci->state_end = jiffies + HZ; outw(USBCMD_RS | USBCMD_CF | USBCMD_MAXP, io_addr + USBCMD); - uhci->hcd.state = USB_STATE_READY; + uhci->hcd.state = USB_STATE_RUNNING; } /* @@ -2143,6 +2143,20 @@ #endif } +static int uhci_reset(struct usb_hcd *hcd) +{ + struct uhci_hcd *uhci = hcd_to_uhci(hcd); + + uhci->io_addr = (unsigned long) hcd->regs; + + /* Maybe kick BIOS off this hardware. Then reset, so we won't get + * interrupts from any previous setup. + */ + pci_write_config_word(hcd->pdev, USBLEGSUP, USBLEGSUP_DEFAULT); + reset_hc(uhci); + return 0; +} + /* * Allocate a frame list, and then setup the skeleton * @@ -2159,7 +2173,7 @@ * - The fourth queue is the bandwidth reclamation queue, which loops back * to the high speed control queue. */ -static int __devinit uhci_start(struct usb_hcd *hcd) +static int uhci_start(struct usb_hcd *hcd) { struct uhci_hcd *uhci = hcd_to_uhci(hcd); int retval = -EBUSY; @@ -2171,7 +2185,6 @@ struct proc_dir_entry *ent; #endif - uhci->io_addr = (unsigned long) hcd->regs; io_size = pci_resource_len(hcd->pdev, hcd->region); #ifdef CONFIG_PROC_FS @@ -2188,10 +2201,6 @@ uhci->proc_entry = ent; #endif - /* Reset here so we don't get any interrupts from an old setup */ - /* or broken setup */ - reset_hc(uhci); - uhci->fsbr = 0; uhci->fsbrtimeout = 0; @@ -2343,9 +2352,6 @@ init_stall_timer(hcd); - /* disable legacy emulation */ - pci_write_config_word(hcd->pdev, USBLEGSUP, USBLEGSUP_DEFAULT); - udev->speed = USB_SPEED_FULL; if (usb_register_root_hub(udev, &hcd->pdev->dev) != 0) { @@ -2446,7 +2452,7 @@ reset_hc(uhci); start_hc(uhci); } - uhci->hcd.state = USB_STATE_READY; + uhci->hcd.state = USB_STATE_RUNNING; return 0; } #endif @@ -2484,6 +2490,7 @@ .flags = HCD_USB11, /* Basic lifecycle operations */ + .reset = uhci_reset, .start = uhci_start, #ifdef CONFIG_PM .suspend = uhci_suspend, @@ -2504,18 +2511,9 @@ }; static const struct pci_device_id uhci_pci_ids[] = { { - /* handle any USB UHCI controller */ - .class = ((PCI_CLASS_SERIAL_USB << 8) | 0x00), - .class_mask = ~0, + PCI_DEVICE_CLASS(((PCI_CLASS_SERIAL_USB << 8) | 0x00), ~0), .driver_data = (unsigned long) &uhci_driver, - - /* no matter who makes it */ - .vendor = PCI_ANY_ID, - .device = PCI_ANY_ID, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, { /* end: all zeroes */ } }; ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <20030923050848.GA5917@washoe.rutgers.edu>]
* Re: USB problem. 'irq 9: nobody cared!' [not found] ` <20030923050848.GA5917@washoe.rutgers.edu> @ 2003-09-23 9:47 ` Jan Dittmer 2003-09-24 20:48 ` Greg KH 0 siblings, 1 reply; 11+ messages in thread From: Jan Dittmer @ 2003-09-23 9:47 UTC (permalink / raw) To: Greg KH; +Cc: Yaroslav Halchenko, linux-kernel Yaroslav Halchenko <yoh@onerussian.com> wrote on 2003-09-23 01:08:48 > Thanx - reversing all "improvements" done in -bk5 seems to help > - usb works :-)) > > --Yarik > > On Mon, Sep 22, 2003 at 08:33:24AM +0200, Jan Dittmer wrote: > > Yaroslav Halchenko <kernel@onerussian.com> wrote on 2003-09-21 14:41:49 > > > Dear Gurus, > > > > > > Since one of the bk versions in -test4- USB problem persist. On boot I'm > > > getting next dump. More information about my system and configuration is at > > > > > > http://www.onerussian.com/Linux/bug.USB/ > > > > > > Please help to get rid of the problem cause USB doesn't work now for me :-( > > > > Try reverting the following patch, taken from the bk4-bk5 incremental > > diff (Apply with patch -p1 -R). This fixed it for me. > > > > Jan > > Greg, what is going on here? In a nutshell: Irq 9 gets disabled on boot and all other devices on this irq consequently doesn't work any more. Here is the oops from dmesg again: uhci-hcd 0000:00:1f.2: UHCI Host Controller irq 9: nobody cared! Call Trace: [<c010b65a>] __report_bad_irq+0x2a/0x90 [<c010b750>] note_interrupt+0x70/0xb0 [<c010ba21>] do_IRQ+0x121/0x130 [<c0109d38>] common_interrupt+0x18/0x20 [<c01e007b>] crypto_init_compress_ops+0x3b/0x40 [<c01226de>] do_softirq+0x3e/0xa0 [<c010b9fd>] do_IRQ+0xfd/0x130 [<c0109d38>] common_interrupt+0x18/0x20 [<c01e44bf>] pci_bus_write_config_word+0x5f/0x90 [<c029f450>] uhci_reset+0x0/0x60 [<c029f48f>] uhci_reset+0x3f/0x60 [<c0295ad6>] usb_hcd_pci_probe+0x196/0x4a0 [<c01e8092>] pci_device_probe_static+0x52/0x70 [<c01e821c>] __pci_device_probe+0x3c/0x50 [<c01e825c>] pci_device_probe+0x2c/0x50 [<c023c6ff>] bus_match+0x3f/0x70 [<c023c84f>] driver_attach+0x6f/0xb0 [<c023cb13>] bus_add_driver+0x93/0xb0 [<c023cf4f>] driver_register+0x2f/0x40 [<c01e84ec>] pci_register_driver+0x5c/0x90 [<c044bbb4>] uhci_hcd_init+0xc4/0x160 [<c04347cb>] do_initcalls+0x2b/0xa0 [<c012e10f>] init_workqueues+0xf/0x30 [<c01050a4>] init+0x34/0x1d0 [<c0105070>] init+0x0/0x1d0 [<c0107255>] kernel_thread_helper+0x5/0x10 handlers: [<c01eb9af>] (acpi_irq+0x0/0x16) Disabling IRQ #9 PCI: Setting latency timer of device 0000:00:1f.2 to 64 uhci-hcd 0000:00:1f.2: irq 9, io base 00001820 uhci-hcd 0000:00:1f.2: new USB bus registered, assigned bus number 1 PM: Adding info for usb:usb1 hub 1-0:0: USB hub found hub 1-0:0: 2 ports detected PM: Adding info for usb:1-0:0 uhci-hcd 0000:00:1f.4: UHCI Host Controller PCI: Setting latency timer of device 0000:00:1f.4 to 64 uhci-hcd 0000:00:1f.4: irq 9, io base 00002400 uhci-hcd 0000:00:1f.4: new USB bus registered, assigned bus number 2 PM: Adding info for usb:usb2 hub 2-0:0: USB hub found hub 2-0:0: 2 ports detected PM: Adding info for usb:2-0:0 Thanks, Jan diff -urN linux-2.6.0-test4-bk4/drivers/usb/core/hcd-pci.c linux-2.6.0-test4-bk5/drivers/usb/core/hcd-pci.c --- linux-2.6.0-test4-bk4/drivers/usb/core/hcd-pci.c 2003-08-22 16:55:40.000000000 -0700 +++ linux-2.6.0-test4-bk5/drivers/usb/core/hcd-pci.c 2003-09-03 04:46:52.000000000 -0700 @@ -139,6 +139,7 @@ return retval; } } + // hcd zeroed everything hcd->regs = base; hcd->region = region; @@ -165,6 +166,7 @@ dev_err (hcd->controller, "can't reset\n"); goto clean_3; } + hcd->state = USB_STATE_HALT; pci_set_master (dev); #ifndef __sparc__ @@ -230,7 +232,8 @@ BUG (); hub = hcd->self.root_hub; - hcd->state = USB_STATE_QUIESCING; + if (HCD_IS_RUNNING (hcd->state)) + hcd->state = USB_STATE_QUIESCING; dev_dbg (hcd->controller, "roothub graceful disconnect\n"); usb_disconnect (&hub); @@ -287,8 +290,8 @@ pci_save_state (dev, hcd->pci_state); /* driver may want to disable DMA etc */ + hcd->state = USB_STATE_QUIESCING; retval = hcd->driver->suspend (hcd, state); - hcd->state = USB_STATE_SUSPENDED; } pci_set_power_state (dev, state); diff -urN linux-2.6.0-test4-bk4/drivers/usb/core/hcd.c linux-2.6.0-test4-bk5/drivers/usb/core/hcd.c --- linux-2.6.0-test4-bk4/drivers/usb/core/hcd.c 2003-08-22 16:57:00.000000000 -0700 +++ linux-2.6.0-test4-bk5/drivers/usb/core/hcd.c 2003-09-03 04:46:52.000000000 -0700 @@ -483,7 +483,7 @@ { struct urb *urb; struct usb_hcd *hcd; - int length; + int length = 0; unsigned long flags; urb = (struct urb *) ptr; @@ -499,7 +499,9 @@ return; } - length = hcd->driver->hub_status_data (hcd, urb->transfer_buffer); + if (!HCD_IS_SUSPENDED (hcd->state)) + length = hcd->driver->hub_status_data ( + hcd, urb->transfer_buffer); /* complete the status urb, or retrigger the timer */ spin_lock (&hcd_data_lock); @@ -1097,6 +1099,8 @@ static int hcd_get_frame_number (struct usb_device *udev) { struct usb_hcd *hcd = (struct usb_hcd *)udev->bus->hcpriv; + if (!HCD_IS_RUNNING (hcd->state)) + return -ESHUTDOWN; return hcd->driver->get_frame_number (hcd); } @@ -1193,6 +1197,12 @@ goto done; } + /* running ~= hc unlink handshake works (irq, timer, etc) + * halted ~= no unlink handshake is needed + * suspended, resuming == should never happen + */ + WARN_ON (!HCD_IS_RUNNING (hcd->state) && hcd->state != USB_STATE_HALT); + if (!urb->hcpriv) { retval = -EINVAL; goto done; @@ -1208,6 +1218,17 @@ goto done; } + /* PCI IRQ setup can easily be broken so that USB controllers + * never get completion IRQs ... maybe even the ones we need to + * finish unlinking the initial failed usb_set_address(). + */ + if (!hcd->saw_irq) { + dev_warn (hcd->controller, "Unlink after no-IRQ? " + "Different ACPI or APIC settings may help." + "\n"); + hcd->saw_irq = 1; + } + /* maybe set up to block until the urb's completion fires. the * lower level hcd code is always async, locking on urb->status * updates; an intercepted completion unblocks us. @@ -1287,6 +1308,8 @@ dev = udev->hcpriv; hcd = udev->bus->hcpriv; + WARN_ON (!HCD_IS_RUNNING (hcd->state) && hcd->state != USB_STATE_HALT); + local_irq_disable (); rescan: @@ -1483,6 +1506,7 @@ if (unlikely (hcd->state == USB_STATE_HALT)) /* irq sharing? */ return IRQ_NONE; + hcd->saw_irq = 1; hcd->driver->irq (hcd, r); if (hcd->state != start && hcd->state == USB_STATE_HALT) usb_hc_died (hcd); diff -urN linux-2.6.0-test4-bk4/drivers/usb/core/hcd.h linux-2.6.0-test4-bk5/drivers/usb/core/hcd.h --- linux-2.6.0-test4-bk4/drivers/usb/core/hcd.h 2003-08-22 16:53:55.000000000 -0700 +++ linux-2.6.0-test4-bk5/drivers/usb/core/hcd.h 2003-09-03 04:46:52.000000000 -0700 @@ -73,6 +73,7 @@ * hardware info/state */ struct hc_driver *driver; /* hw-specific hooks */ + unsigned saw_irq : 1; int irq; /* irq allocated */ void *regs; /* device memory/io */ struct device *controller; /* handle to hardware */ @@ -89,13 +90,11 @@ int state; # define __ACTIVE 0x01 -# define __SLEEPY 0x02 # define __SUSPEND 0x04 # define __TRANSIENT 0x80 # define USB_STATE_HALT 0 # define USB_STATE_RUNNING (__ACTIVE) -# define USB_STATE_READY (__ACTIVE|__SLEEPY) # define USB_STATE_QUIESCING (__SUSPEND|__TRANSIENT|__ACTIVE) # define USB_STATE_RESUMING (__SUSPEND|__TRANSIENT) # define USB_STATE_SUSPENDED (__SUSPEND) diff -urN linux-2.6.0-test4-bk4/drivers/usb/core/message.c linux-2.6.0-test4-bk5/drivers/usb/core/message.c --- linux-2.6.0-test4-bk4/drivers/usb/core/message.c 2003-08-22 16:53:13.000000000 -0700 +++ linux-2.6.0-test4-bk5/drivers/usb/core/message.c 2003-09-03 04:46:52.000000000 -0700 @@ -246,21 +246,22 @@ io->status = urb->status; /* the previous urbs, and this one, completed already. - * unlink the later ones so they won't rx/tx bad data, - * - * FIXME don't bother unlinking urbs that haven't yet been - * submitted; those non-error cases shouldn't be syslogged + * unlink pending urbs so they won't rx/tx bad data. */ for (i = 0, found = 0; i < io->entries; i++) { + if (!io->urbs [i]) + continue; if (found) { status = usb_unlink_urb (io->urbs [i]); - if (status && status != -EINPROGRESS) - err ("sg_complete, unlink --> %d", - status); + if (status != -EINPROGRESS && status != -EBUSY) + dev_err (&io->dev->dev, + "%s, unlink --> %d\n", + __FUNCTION__, status); } else if (urb == io->urbs [i]) found = 1; } } + urb->dev = 0; /* on the last completion, signal usb_sg_wait() */ io->bytes += urb->actual_length; @@ -356,7 +357,7 @@ goto nomem; } - io->urbs [i]->dev = dev; + io->urbs [i]->dev = 0; io->urbs [i]->pipe = pipe; io->urbs [i]->interval = period; io->urbs [i]->transfer_flags = urb_flags; @@ -448,6 +449,7 @@ for (i = 0; i < io->entries && !io->status; i++) { int retval; + io->urbs [i]->dev = io->dev; retval = usb_submit_urb (io->urbs [i], SLAB_ATOMIC); /* after we submit, let completions or cancelations fire; @@ -459,9 +461,9 @@ case -ENXIO: // hc didn't queue this one case -EAGAIN: case -ENOMEM: + io->urbs [i]->dev = 0; retval = 0; i--; - // FIXME: should it usb_sg_cancel() on INTERRUPT? yield (); break; @@ -477,8 +479,10 @@ /* fail any uncompleted urbs */ default: + io->urbs [i]->dev = 0; io->urbs [i]->status = retval; - dbg ("usb_sg_msg, submit --> %d", retval); + dev_dbg (&io->dev->dev, "%s, submit --> %d\n", + __FUNCTION__, retval); usb_sg_cancel (io); } spin_lock_irqsave (&io->lock, flags); @@ -521,9 +525,9 @@ if (!io->urbs [i]->dev) continue; retval = usb_unlink_urb (io->urbs [i]); - if (retval && retval != -EINPROGRESS) - warn ("usb_sg_cancel, unlink --> %d", retval); - // FIXME don't warn on "not yet submitted" error + if (retval != -EINPROGRESS && retval != -EBUSY) + dev_warn (&io->dev->dev, "%s, unlink --> %d\n", + __FUNCTION__, retval); } } spin_unlock_irqrestore (&io->lock, flags); diff -urN linux-2.6.0-test4-bk4/drivers/usb/core/usb.c linux-2.6.0-test4-bk5/drivers/usb/core/usb.c --- linux-2.6.0-test4-bk4/drivers/usb/core/usb.c 2003-08-22 16:56:17.000000000 -0700 +++ linux-2.6.0-test4-bk5/drivers/usb/core/usb.c 2003-09-03 04:46:52.000000000 -0700 @@ -991,8 +991,8 @@ * * This call is synchronous, and may not be used in an interrupt context. * - * Only hub drivers (including virtual root hub drivers for host - * controllers) should ever call this. + * Only the hub driver should ever call this; root hub registration + * uses it only indirectly. */ #define NEW_DEVICE_RETRYS 2 #define SET_ADDRESS_RETRYS 2 @@ -1417,11 +1417,46 @@ usb_pipein (pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE); } +static int usb_device_suspend(struct device *dev, u32 state) +{ + struct usb_interface *intf; + struct usb_driver *driver; + + if ((dev->driver == &usb_generic_driver) || + (dev->driver_data == &usb_generic_driver_data)) + return 0; + + intf = to_usb_interface(dev); + driver = to_usb_driver(dev->driver); + + if (driver && driver->suspend) + return driver->suspend(intf, state); + return 0; +} + +static int usb_device_resume(struct device *dev) +{ + struct usb_interface *intf; + struct usb_driver *driver; + + if ((dev->driver == &usb_generic_driver) || + (dev->driver_data == &usb_generic_driver_data)) + return 0; + + intf = to_usb_interface(dev); + driver = to_usb_driver(dev->driver); + + if (driver && driver->resume) + return driver->resume(intf); + return 0; +} struct bus_type usb_bus_type = { .name = "usb", .match = usb_device_match, .hotplug = usb_hotplug, + .suspend = usb_device_suspend, + .resume = usb_device_resume, }; #ifndef MODULE @@ -1509,7 +1544,6 @@ EXPORT_SYMBOL(usb_find_interface); EXPORT_SYMBOL(usb_ifnum_to_if); -EXPORT_SYMBOL(usb_new_device); EXPORT_SYMBOL(usb_reset_device); EXPORT_SYMBOL(usb_disconnect); diff -urN linux-2.6.0-test4-bk4/drivers/usb/host/uhci-hcd.c linux-2.6.0-test4-bk5/drivers/usb/host/uhci-hcd.c --- linux-2.6.0-test4-bk4/drivers/usb/host/uhci-hcd.c 2003-08-22 16:59:32.000000000 -0700 +++ linux-2.6.0-test4-bk5/drivers/usb/host/uhci-hcd.c 2003-09-03 04:46:52.000000000 -0700 @@ -2099,7 +2099,7 @@ uhci->state_end = jiffies + HZ; outw(USBCMD_RS | USBCMD_CF | USBCMD_MAXP, io_addr + USBCMD); - uhci->hcd.state = USB_STATE_READY; + uhci->hcd.state = USB_STATE_RUNNING; } /* @@ -2143,6 +2143,20 @@ #endif } +static int uhci_reset(struct usb_hcd *hcd) +{ + struct uhci_hcd *uhci = hcd_to_uhci(hcd); + + uhci->io_addr = (unsigned long) hcd->regs; + + /* Maybe kick BIOS off this hardware. Then reset, so we won't get + * interrupts from any previous setup. + */ + pci_write_config_word(hcd->pdev, USBLEGSUP, USBLEGSUP_DEFAULT); + reset_hc(uhci); + return 0; +} + /* * Allocate a frame list, and then setup the skeleton * @@ -2159,7 +2173,7 @@ * - The fourth queue is the bandwidth reclamation queue, which loops back * to the high speed control queue. */ -static int __devinit uhci_start(struct usb_hcd *hcd) +static int uhci_start(struct usb_hcd *hcd) { struct uhci_hcd *uhci = hcd_to_uhci(hcd); int retval = -EBUSY; @@ -2171,7 +2185,6 @@ struct proc_dir_entry *ent; #endif - uhci->io_addr = (unsigned long) hcd->regs; io_size = pci_resource_len(hcd->pdev, hcd->region); #ifdef CONFIG_PROC_FS @@ -2188,10 +2201,6 @@ uhci->proc_entry = ent; #endif - /* Reset here so we don't get any interrupts from an old setup */ - /* or broken setup */ - reset_hc(uhci); - uhci->fsbr = 0; uhci->fsbrtimeout = 0; @@ -2343,9 +2352,6 @@ init_stall_timer(hcd); - /* disable legacy emulation */ - pci_write_config_word(hcd->pdev, USBLEGSUP, USBLEGSUP_DEFAULT); - udev->speed = USB_SPEED_FULL; if (usb_register_root_hub(udev, &hcd->pdev->dev) != 0) { @@ -2446,7 +2452,7 @@ reset_hc(uhci); start_hc(uhci); } - uhci->hcd.state = USB_STATE_READY; + uhci->hcd.state = USB_STATE_RUNNING; return 0; } #endif @@ -2484,6 +2490,7 @@ .flags = HCD_USB11, /* Basic lifecycle operations */ + .reset = uhci_reset, .start = uhci_start, #ifdef CONFIG_PM .suspend = uhci_suspend, @@ -2504,18 +2511,9 @@ }; static const struct pci_device_id uhci_pci_ids[] = { { - /* handle any USB UHCI controller */ - .class = ((PCI_CLASS_SERIAL_USB << 8) | 0x00), - .class_mask = ~0, + PCI_DEVICE_CLASS(((PCI_CLASS_SERIAL_USB << 8) | 0x00), ~0), .driver_data = (unsigned long) &uhci_driver, - - /* no matter who makes it */ - .vendor = PCI_ANY_ID, - .device = PCI_ANY_ID, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, { /* end: all zeroes */ } }; ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: USB problem. 'irq 9: nobody cared!' 2003-09-23 9:47 ` Jan Dittmer @ 2003-09-24 20:48 ` Greg KH 2003-09-24 22:20 ` Yaroslav Halchenko 2003-09-25 7:41 ` Jan Dittmer 0 siblings, 2 replies; 11+ messages in thread From: Greg KH @ 2003-09-24 20:48 UTC (permalink / raw) To: Yaroslav Halchenko, linux-kernel On Tue, Sep 23, 2003 at 11:47:46AM +0200, Jan Dittmer wrote: > Yaroslav Halchenko <yoh@onerussian.com> wrote on 2003-09-23 01:08:48 > > Thanx - reversing all "improvements" done in -bk5 seems to help > > - usb works :-)) > > > > --Yarik > > > > On Mon, Sep 22, 2003 at 08:33:24AM +0200, Jan Dittmer wrote: > > > Yaroslav Halchenko <kernel@onerussian.com> wrote on 2003-09-21 14:41:49 > > > > Dear Gurus, > > > > > > > > Since one of the bk versions in -test4- USB problem persist. On boot I'm > > > > getting next dump. More information about my system and configuration is at > > > > > > > > http://www.onerussian.com/Linux/bug.USB/ > > > > > > > > Please help to get rid of the problem cause USB doesn't work now for me :-( > > > > > > Try reverting the following patch, taken from the bk4-bk5 incremental > > > diff (Apply with patch -p1 -R). This fixed it for me. > > > > > > Jan > > > > > Greg, what is going on here? In a nutshell: Irq 9 gets disabled on boot > and all other devices on this irq consequently doesn't work any more. > Here is the oops from dmesg again: There's no "oops" here, just a warning message. Things worked just fine after this, right? Did you try David Brownell's patch for this issue? thanks, greg k-h ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: USB problem. 'irq 9: nobody cared!' 2003-09-24 20:48 ` Greg KH @ 2003-09-24 22:20 ` Yaroslav Halchenko 2003-09-25 7:41 ` Jan Dittmer 1 sibling, 0 replies; 11+ messages in thread From: Yaroslav Halchenko @ 2003-09-24 22:20 UTC (permalink / raw) To: linux-kernel; +Cc: Greg KH On Wed, Sep 24, 2003 at 01:48:46PM -0700, Greg KH wrote: > On Tue, Sep 23, 2003 at 11:47:46AM +0200, Jan Dittmer wrote: > > Yaroslav Halchenko <yoh@onerussian.com> wrote on 2003-09-23 01:08:48 > > > > > > > > > > http://www.onerussian.com/Linux/bug.USB/ > > Greg, what is going on here? In a nutshell: Irq 9 gets disabled on boot > > and all other devices on this irq consequently doesn't work any more. > > Here is the oops from dmesg again: > > There's no "oops" here, just a warning message. Things worked just fine > after this, right? If you mean after issuing that 'warning'? no - USB doesn't work at all. Reverse patch kinda helped, but then I started getting some weird behaviour which might be not due to reverse patch but some other problems... > Did you try David Brownell's patch for this issue? Can you please point which one exactly? I've tried to locate patch you meant but it is too much of USB staff is happening now seems to me. Thank you in advance .-. =------------------------------ /v\ ----------------------------= Keep in touch // \\ (yoh@|www.)onerussian.com Yaroslav Halchenko /( )\ ICQ#: 60653192 Linux User ^^-^^ [175555] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: USB problem. 'irq 9: nobody cared!' 2003-09-24 20:48 ` Greg KH 2003-09-24 22:20 ` Yaroslav Halchenko @ 2003-09-25 7:41 ` Jan Dittmer 1 sibling, 0 replies; 11+ messages in thread From: Jan Dittmer @ 2003-09-25 7:41 UTC (permalink / raw) To: Greg KH; +Cc: Yaroslav Halchenko, linux-kernel Greg KH wrote: > On Tue, Sep 23, 2003 at 11:47:46AM +0200, Jan Dittmer wrote: >> >>Greg, what is going on here? In a nutshell: Irq 9 gets disabled on boot >>and all other devices on this irq consequently doesn't work any more. >>Here is the oops from dmesg again: > > > There's no "oops" here, just a warning message. Things worked just fine > after this, right? > No, read my message, irq 9 doesn't get reenabled again. And as my nic is also on this interrupt, it cannot receive any packets anymore, usb doesn't work, acpi doesn't work: 9: 100000 XT-PIC acpi, uhci-hcd, uhci-hcd, ohci1394, Intel 82801BA-ICH2, eth0, 0000:01:02.0, 0000:01:05.0, orinoco_cs Thanks, Jan ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: USB problem. 'irq 9: nobody cared!'
@ 2003-09-24 22:57 Milton Miller
2003-09-25 4:23 ` Yaroslav Halchenko
2003-09-26 3:14 ` Yaroslav Halchenko
0 siblings, 2 replies; 11+ messages in thread
From: Milton Miller @ 2003-09-24 22:57 UTC (permalink / raw)
To: Yaroslav Halchenko; +Cc: linux-kernel, Greg KH
Yaroslav Halchenko wrote:
> Greg KH wrote:
> > Did you try David Brownell's patch for this issue?
> Can you please point which one exactly? I've tried to locate patch you
> meant but it is too much of USB staff is happening now seems to me.
I'm guessing this one: Re: irq 11: nobody cared! is back
http://marc.theaimsgroup.com/?l=linux-kernel&m=106399942523614&w=2
milton
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: USB problem. 'irq 9: nobody cared!' 2003-09-24 22:57 Milton Miller @ 2003-09-25 4:23 ` Yaroslav Halchenko 2003-09-25 18:00 ` Greg KH 2003-09-26 3:14 ` Yaroslav Halchenko 1 sibling, 1 reply; 11+ messages in thread From: Yaroslav Halchenko @ 2003-09-25 4:23 UTC (permalink / raw) To: Milton Miller; +Cc: linux-kernel, Greg KH Nop - it didn't help :-( http://onerussian.com/Linux/bug.USB2/dmesg which else usefull information I can provide? --Yarik On Wed, Sep 24, 2003 at 05:57:27PM -0500, Milton Miller wrote: > > Yaroslav Halchenko wrote: > > Greg KH wrote: > > > Did you try David Brownell's patch for this issue? > > Can you please point which one exactly? I've tried to locate patch you > > meant but it is too much of USB staff is happening now seems to me. > > > I'm guessing this one: Re: irq 11: nobody cared! is back > > http://marc.theaimsgroup.com/?l=linux-kernel&m=106399942523614&w=2 > > > milton .-. =------------------------------ /v\ ----------------------------= Keep in touch // \\ (yoh@|www.)onerussian.com Yaroslav Halchenko /( )\ ICQ#: 60653192 Linux User ^^-^^ [175555] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: USB problem. 'irq 9: nobody cared!' 2003-09-25 4:23 ` Yaroslav Halchenko @ 2003-09-25 18:00 ` Greg KH 2003-09-25 19:11 ` David Brownell 0 siblings, 1 reply; 11+ messages in thread From: Greg KH @ 2003-09-25 18:00 UTC (permalink / raw) To: Milton Miller, linux-kernel, David Brownell On Thu, Sep 25, 2003 at 12:23:26AM -0400, Yaroslav Halchenko wrote: > Nop - it didn't help :-( > > http://onerussian.com/Linux/bug.USB2/dmesg > > which else usefull information I can provide? David, can you try to fix this up. It all started with your uhci patch... thanks, greg k-h ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: USB problem. 'irq 9: nobody cared!' 2003-09-25 18:00 ` Greg KH @ 2003-09-25 19:11 ` David Brownell 0 siblings, 0 replies; 11+ messages in thread From: David Brownell @ 2003-09-25 19:11 UTC (permalink / raw) To: Greg KH; +Cc: Milton Miller, linux-kernel [-- Attachment #1: Type: text/plain, Size: 888 bytes --] Greg KH wrote: > On Thu, Sep 25, 2003 at 12:23:26AM -0400, Yaroslav Halchenko wrote: > >>Nop - it didn't help :-( >> >>http://onerussian.com/Linux/bug.USB2/dmesg >> >>which else usefull information I can provide? > > > David, can you try to fix this up. It all started with your uhci > patch... I have tried, two or three times now ... The problem is that nobody has ever reported back with results from testing any updated patch (see attachment, the guts of this being from Alan Stern). Sort of makes trying be a moot point ... :) It's OK with me if you just revert the patch that adds a uhci_reset() entry, but based on what I saw with EHCI and OHCI that'll just turn up a different set of problems with certain BIOS configurations (none of which I have) ... which will need to be fixed by having a UHCI reset sequence that works correctly from _all_ initial states. - Dave [-- Attachment #2: Diff --] [-- Type: text/plain, Size: 729 bytes --] --- 1.44/drivers/usb/host/uhci-hcd.c Fri Jul 18 06:22:32 2003 +++ edited/drivers/usb/host/uhci-hcd.c Fri Sep 19 12:23:54 2003 @@ -1960,8 +1960,9 @@ { unsigned int io_addr = uhci->io_addr; - /* Global reset for 50ms */ + /* Global reset for 50ms, and don't interrupt me */ uhci->state = UHCI_RESET; + outw(0, io_addr + USBINTR); outw(USBCMD_GRESET, io_addr + USBCMD); set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout((HZ*50+999) / 1000); @@ -2187,6 +2188,7 @@ /* Maybe kick BIOS off this hardware. Then reset, so we won't get * interrupts from any previous setup. */ + outw(0, uhci->io_addr + USBINTR); pci_write_config_word(hcd->pdev, USBLEGSUP, USBLEGSUP_DEFAULT); reset_hc(uhci); return 0; ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: USB problem. 'irq 9: nobody cared!' 2003-09-24 22:57 Milton Miller 2003-09-25 4:23 ` Yaroslav Halchenko @ 2003-09-26 3:14 ` Yaroslav Halchenko 1 sibling, 0 replies; 11+ messages in thread From: Yaroslav Halchenko @ 2003-09-26 3:14 UTC (permalink / raw) To: Milton Miller, Greg KH; +Cc: linux kernel mailing list I've tried again with recent bk12 kernel and this patch worked... May be I was too tired and actually didn't patch the first time I tried, and then reported to you that it didn't help - I'm sorry. Will check later if it is the case. Thanx for your help Sincerely Yarik On Wed, Sep 24, 2003 at 05:57:27PM -0500, Milton Miller wrote: > > Yaroslav Halchenko wrote: > > Greg KH wrote: > > > Did you try David Brownell's patch for this issue? > > Can you please point which one exactly? I've tried to locate patch you > > meant but it is too much of USB staff is happening now seems to me. > > > I'm guessing this one: Re: irq 11: nobody cared! is back > > http://marc.theaimsgroup.com/?l=linux-kernel&m=106399942523614&w=2 > > > milton .-. =------------------------------ /v\ ----------------------------= Keep in touch // \\ (yoh@|www.)onerussian.com Yaroslav Halchenko /( )\ ICQ#: 60653192 Linux User ^^-^^ [175555] ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2003-09-26 3:14 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-21 18:41 USB problem. 'irq 9: nobody cared!' Yaroslav Halchenko
2003-09-22 6:33 ` Jan Dittmer
[not found] ` <20030923050848.GA5917@washoe.rutgers.edu>
2003-09-23 9:47 ` Jan Dittmer
2003-09-24 20:48 ` Greg KH
2003-09-24 22:20 ` Yaroslav Halchenko
2003-09-25 7:41 ` Jan Dittmer
-- strict thread matches above, loose matches on Subject: below --
2003-09-24 22:57 Milton Miller
2003-09-25 4:23 ` Yaroslav Halchenko
2003-09-25 18:00 ` Greg KH
2003-09-25 19:11 ` David Brownell
2003-09-26 3:14 ` Yaroslav Halchenko
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox