From patchwork Thu Aug 15 16:45:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 2845229 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F20139F2F5 for ; Thu, 15 Aug 2013 16:46:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DA6F52032D for ; Thu, 15 Aug 2013 16:46:36 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5DA9C20328 for ; Thu, 15 Aug 2013 16:46:35 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VA0gy-00084p-Pr; Thu, 15 Aug 2013 16:46:33 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VA0gw-0003LC-HQ; Thu, 15 Aug 2013 16:46:30 +0000 Received: from mail-lb0-f173.google.com ([209.85.217.173]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VA0gs-0003Ki-3F for linux-arm-kernel@lists.infradead.org; Thu, 15 Aug 2013 16:46:28 +0000 Received: by mail-lb0-f173.google.com with SMTP id 10so813122lbf.32 for ; Thu, 15 Aug 2013 09:46:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=xfqrZe2NfSML7GSC+YkbvJmrd5r02Wdv9Khp+ATkOqk=; b=blhvVDqCAOuAeYW+sDYs5wQR/qxdgiEDmY8JUCjqn4l7BO+g3MMfeGLrlhkZLFHHUs jwm8FeDvsYunRXY7SkLDVt7xxxT41+fwxgB4rRkEVDaPsJD/xsCqHO+1HzCoPZgW4rZe F2KOY+snZ43u7y8RBuMGOkCvQ847Zi/usDIi4QFgX3OBZjGz70A0t0P4Hh5kqXjhj+E9 pKRVayDU414LwJGod7bb/DC/5zAbMubigF2TZJYIL1z9LixCBrd5oKnZNwiZr8eCKDzS BWpBGQtdAR/DR2zo866dF+xnxzftjlLX4wOdZVJuhoPEsQtfYtddyT6A/X0J2CkLcn9C gYHQ== X-Gm-Message-State: ALoCoQlF6yfc3bMiTTjxnEhIxtvVt8GywT0ZTtNfaES6rZEfBwr6qJMfeSpDYvokdDpVhFIGurKd X-Received: by 10.112.52.225 with SMTP id w1mr7326203lbo.31.1376585162344; Thu, 15 Aug 2013 09:46:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.112.13.2 with HTTP; Thu, 15 Aug 2013 09:45:42 -0700 (PDT) In-Reply-To: <20130813034054.GA18218@roeck-us.net> References: <5207B3C3.9080508@roeck-us.net> <20130811220450.GY23006@n2100.arm.linux.org.uk> <52082EF8.10005@roeck-us.net> <20130813034054.GA18218@roeck-us.net> From: Peter Maydell Date: Thu, 15 Aug 2013 17:45:42 +0100 Message-ID: Subject: Re: [Qemu-devel] SCSI bus failures with qemu-arm in kernel 3.8+ To: Guenter Roeck X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130815_124626_406396_EF721240 X-CRM114-Status: GOOD ( 21.84 ) X-Spam-Score: -2.6 (--) Cc: Russell King - ARM Linux , "linux-kernel@vger.kernel.org" , QEMU Developers , Paul Gortmaker , Arnd Bergmann , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 13 August 2013 04:40, Guenter Roeck wrote: > Patch tested and working with qemu 1.5.2, using the configuration file > from the yocto project. Patch applied on top of kernel version 3.11-rc5. OK, I tested this on PB926+PCI backplane hardware, and it is definitely better than current mainline, in that the test USB card that I have no longer causes the kernel to generate this sort of backtrace: ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver ehci-pci: EHCI PCI platform driver ehci-pci 0000:00:1e.2: EHCI Host Controller ehci-pci 0000:00:1e.2: new USB bus registered, assigned bus number 1 ehci-pci 0000:00:1e.2: irq 91, io mem 0x50002000 ehci-pci 0000:00:1e.2: USB 2.0 started, EHCI 1.00 usb usb1: New USB device found, idVendor=1d6b, idProduct=0002 usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1 usb usb1: Product: EHCI Host Controller usb usb1: Manufacturer: Linux 3.10.0+ ehci_hcd usb usb1: SerialNumber: 0000:00:1e.2 hub 1-0:1.0: USB hub found hub 1-0:1.0: 3 ports detected ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver ohci-pci: OHCI PCI platform driver ohci-pci 0000:00:1e.0: OHCI PCI host controller ohci-pci 0000:00:1e.0: new USB bus registered, assigned bus number 2 irq 93: nobody cared (try booting with the "irqpoll" option) CPU: 0 PID: 1 Comm: swapper Not tainted 3.10.0+ #9 [] (unwind_backtrace+0x0/0xf0) from [] (show_stack+0x10/0x14) [] (show_stack+0x10/0x14) from [] (__report_bad_irq+0x24/0xb8) [] (__report_bad_irq+0x24/0xb8) from [] (note_interrupt+0x1cc/0x230) [] (note_interrupt+0x1cc/0x230) from [] (handle_irq_event_percpu+0xac/0x1c4) [] (handle_irq_event_percpu+0xac/0x1c4) from [] (handle_irq_event+0x28/0x38) [] (handle_irq_event+0x28/0x38) from [] (handle_level_irq+0x80/0xd4) [] (handle_level_irq+0x80/0xd4) from [] (generic_handle_irq+0x2c/0x40) [] (generic_handle_irq+0x2c/0x40) from [] (fpga_irq_handle+0x3c/0x50) [] (fpga_irq_handle+0x3c/0x50) from [] (generic_handle_irq+0x2c/0x40) [] (generic_handle_irq+0x2c/0x40) from [] (handle_IRQ+0x30/0x84) [] (handle_IRQ+0x30/0x84) from [] (vic_handle_irq+0x5c/0x9c) [] (vic_handle_irq+0x5c/0x9c) from [] (__irq_svc+0x40/0x4c) Exception stack(0xc7829cc8 to 0xc7829d10) 9cc0: 00000001 0000000a 00000100 20000013 00000002 00000024 9ce0: c7828000 c0476980 3fb96c1c c0443950 c04693c0 00000001 c0456a50 c7829d10 9d00: c0025f38 c0025fa8 20000013 ffffffff [] (__irq_svc+0x40/0x4c) from [] (__do_softirq+0x80/0x1b4) [] (__do_softirq+0x80/0x1b4) from [] (irq_exit+0x54/0x90) [] (irq_exit+0x54/0x90) from [] (handle_IRQ+0x34/0x84) [] (handle_IRQ+0x34/0x84) from [] (vic_handle_irq+0x5c/0x9c) [] (vic_handle_irq+0x5c/0x9c) from [] (__irq_svc+0x40/0x4c) Exception stack(0xc7829d80 to 0xc7829dc8) 9d80: 00000000 0000005d 20000000 00000000 c79bb7e0 c0446990 60000013 c79c0000 9da0: 0000005d 00000000 c04469c4 00000001 00000000 c7829dc8 c00555c8 c0054460 9dc0: 40000013 ffffffff [] (__irq_svc+0x40/0x4c) from [] (__setup_irq+0x1f4/0x3f0) [] (__setup_irq+0x1f4/0x3f0) from [] (request_threaded_irq+0xb4/0x138) [] (request_threaded_irq+0xb4/0x138) from [] (usb_add_hcd+0x4f0/0x6f0) [] (usb_add_hcd+0x4f0/0x6f0) from [] (usb_hcd_pci_probe+0x200/0x36c) [] (usb_hcd_pci_probe+0x200/0x36c) from [] (pci_device_probe+0x68/0x90) [] (pci_device_probe+0x68/0x90) from [] (driver_probe_device+0x78/0x200) [] (driver_probe_device+0x78/0x200) from [] (__driver_attach+0x8c/0x90) [] (__driver_attach+0x8c/0x90) from [] (bus_for_each_dev+0x58/0x88) [] (bus_for_each_dev+0x58/0x88) from [] (bus_add_driver+0xd8/0x220) [] (bus_add_driver+0xd8/0x220) from [] (driver_register+0x78/0x144) [] (driver_register+0x78/0x144) from [] (do_one_initcall+0x94/0x154) [] (do_one_initcall+0x94/0x154) from [] (kernel_init_freeable+0xec/0x1b0) [] (kernel_init_freeable+0xec/0x1b0) from [] (kernel_init+0x8/0xe4) [] (kernel_init+0x8/0xe4) from [] (ret_from_fork+0x14/0x24) handlers: [] usb_hcd_irq Disabling IRQ #93 However it still doesn't seem to reliably detect the USB harddisk plugged into the card, so I think there may be further issues, possibly some subset of those Arnd identified and fixed with this patch: http://permalink.gmane.org/gmane.linux.ports.arm.kernel/93397 so I'd like to continue testing. The other thing this patch should (IMHO) have is the line in pci_versatile_setup() which tells QEMU that the kernel really does expect hardware-like behaviour: pci_slot_ignore |= (1 << myslot); I appreciate that QEMU-specific code in the kernel is a bit ugly, but (a) 99.9% of the people running this code are going to be running it on QEMU (b) the bugs in this area have been extremely long-standing in both the kernel and QEMU and so there are a lot of legacy kernel images out there that worked just fine with QEMU (c) it's rather less code than I have in QEMU as the QEMU-side part of this backwards-compatibility autodetection. (Without this line QEMU will guess whether the kernel is broken or not and will get it right most but not necessarily all of the time.) thanks -- PMM --- a/arch/arm/mach-versatile/pci.c +++ b/arch/arm/mach-versatile/pci.c @@ -295,6 +295,19 @@ int __init pci_versatile_setup(int nr, struct pci_sys_data *sys) __raw_writel(PHYS_OFFSET, local_pci_cfg_base + PCI_BASE_ADDRESS_2); /* + * For many years the kernel and QEMU were symbiotically buggy + * in that they both assumed the same broken IRQ mapping. + * QEMU therefore attempts to auto-detect old broken kernels + * so that they still work on newer QEMU as they did on old + * QEMU. Since we now use the correct (ie matching-hardware) + * IRQ mapping we write a definitely different value to a + * PCI_INTERRUPT_LINE register to tell QEMU that we expect + * real hardware behaviour and it need not be backwards + * compatible for us. This write is harmless on real hardware. + */ + __raw_writel(0, VERSATILE_PCI_VIRT_BASE+PCI_INTERRUPT_LINE); + + /* * Do not to map Versatile FPGA PCI device into memory space */