Received: by 10.213.65.68 with SMTP id h4csp947389imn; Wed, 28 Mar 2018 16:29:19 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/hc/maepfFNkbFx1JkaeeBvC5e0BFwfoHpBzfjIm+JjUowVqvevD6br9L5T0MdmBSqJen4 X-Received: by 10.98.160.92 with SMTP id r89mr4402548pfe.235.1522279759272; Wed, 28 Mar 2018 16:29:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522279759; cv=none; d=google.com; s=arc-20160816; b=kICY8IB+r8ZAgKC1nf4TgjO/zK+a9syjW3dec1xcfkWR//bA1Qklw2Lbl0gOVXhgX/ tY4NUXOMGAI2wtWEN1ydXPzRMhO4P356x4cHVKH8eUUcbXiL8XAOQ9IbQB7Qwj8GOfG9 Q+V1xCKCucv5zwpyq2ECZoof62XbiSjReCbXATMZGSHBkG4IWtyUAJee6G7UD4a9cMgw N+3F+ieAecxunENIOw7JyrGRL6DCU61z20VzOVH8ffhIUE99CQYovFZUdCnjqB85dsC8 cqetuTS007e4VSfOoBLAhEFKRfwkukFbQQciItC/Hg9AjkcSmhUQ3avdWu/zrbva5xrs YKTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:arc-authentication-results; bh=Lgk7GWNBYdBfvrZToxJMCaOgDaJmoTf9y9dc/jDbtCI=; b=g45YJXQq4kKAET8/X8lp8dW+wo238c19lGgsNH1oRfJFEI0CBhHdHFfukaMMzTicl7 DRbMYahd65ca+cvD4VyRCXBJJ4t9SfBnRav/40A9hoYEOLjefyIgsYfhMwidhT7NYvpU sJoN0ch5thKk19Z46/DsWyxpA/vd/XGLapJmLnJXMqSyVh+sqIlLAUq7nv5CgVRUHL6n yW59zkhSrrbSGfA39VBmeX4TxmUGYKKgtZ2jrBRkIzBf9K6kXTs12VUliKhmzjINcrY1 azKkiUOuNSXW4JzJQOROykM+2O22KjWm9+tdulNjfkXlepFT46dYLM3o4E3uIJiXxQeu LSpA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b17si3598631pfd.155.2018.03.28.16.29.03; Wed, 28 Mar 2018 16:29:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751194AbeC1X2K (ORCPT + 99 others); Wed, 28 Mar 2018 19:28:10 -0400 Received: from www.llwyncelyn.cymru ([82.70.14.225]:51138 "EHLO fuzix.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751058AbeC1X2I (ORCPT ); Wed, 28 Mar 2018 19:28:08 -0400 Received: from alans-desktop (82-70-14-226.dsl.in-addr.zen.co.uk [82.70.14.226]) by fuzix.org (8.15.2/8.15.2) with ESMTP id w2SNS6aJ021759; Thu, 29 Mar 2018 00:28:06 +0100 Date: Thu, 29 Mar 2018 00:28:05 +0100 From: Alan Cox To: Timothy Normand Miller Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: Re: HELP PLEASE: Without ugly hacks, no interrupt delivery at all to our driver; 3.10.0 kernel (RHEL7.4) on Intel 82X38/X48 chipset, Shuttle (SX38/FX38, Core 2 Duo) Message-ID: <20180329002805.2824f7af@alans-desktop> In-Reply-To: References: Organization: Intel Corporation X-Mailer: Claws Mail 3.15.1-dirty (GTK+ 2.24.31; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > I suspect a large part of the problem is that our device isn't really > a PCIe device. It's a PCI device retrofitted with a TI > XIO2000(A)/XIO2200A PCI Express-to-PCI Bridge. Large numbers of this That really shouldn't be an issue. Just about every PC up to a few years ago has something that at least looks like a PCIe to PCI bridge on it somewhere (or buried in the chipset) to handle the PCI slots. There are also a vast number of older PCIe cards that are in fact PCI devices glued to PCIe x1 this way (or by worse things) in the market. .. > The next thing I notice is that all of a sudden, the interrupt line > for our chip has changed: > > 02:00.0 Display controller: Tech-Source Device 0043 > Subsystem: Tech-Source Device 0043 > Control: I/O- Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- > ParErr- Stepping- SERR- FastB2B+ DisINTx- > Status: Cap- 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium > >TAbort- SERR- Interrupt: pin A routed to IRQ 16 > > Some more debug messages later, and I find out that it was > pci_enable_device that changed the IRQ line: Yes it can do that. > So, the pci_dev struct has had irq updated to 16, and lspci reports > that the IRQ line has been updated to 16 in the hardware. So why is > it that when I read PCI config space directly, I get the old value? > In fact, lspci is apparently LYING about this! Here's what I get from > a raw dump of PCI config space: The hardware generates INTA-INTD, your bridge should turn those into the in band PCIe messages for INTA-INTD. The IRQ 'number' is just a configuration construct, and in fact it's very much a *PC* BIOS one. However pci_assign_irq does always update the INTERRUPT_LINE register because it has to do so for certain 'fake PCI' environments (like some old VIA chipsets) where the INTERRUPT_LINE is used for IRQ routing magic internally. Anyway it shouldn't matter! > long after booting. There seems to be a global function pointer > pcibios_enable_irq that is called from pcibios_enable_device. And > this brings me to the question as to what is the difference between > pci_ calls and pcibios_ calls. One thing I can see is that Armwavingly 'generic' vs 'platform specific'. If you look at a modern kernel you'll find pci_assign_irq deals with all of this and does update the LINE register. 3.10 is five years old (I actually had hair when it came out) so this is really the wrong place to worry about ancient computing history. > In the Documention on PCI, it mentions using pci_enable_msi and > pci_enable_msix calls. That and other text makes it pretty clear that > INTx interrupts are the *default*, and MSI has to be enabled Yes. > explicitly. Looking at do_pci_enable_device, if msi and msix are > disabled, then it will clear PCI_COMMAND_INTX_DISABLE on the device, > but it doesn't ascend the bridge hierarchy fixing those too. Do you see the same problem with a current 4.x kernel ? If you then it's definitely worth further discussion (and I've added linux-pci to the cc), if it works fine in 4.14, then I'd stick your hack in the Red Hat driver, and remember its not something anyone is too likely to fix there. Alan