Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1854811imm; Mon, 3 Sep 2018 11:10:41 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZ03++AnjhbL4b/VRwo1AHlcXkQnM2hu1ziHsDQhArgjaIx8HjUXcaE85hRsFGFqa0mnPcC X-Received: by 2002:a63:4d47:: with SMTP id n7-v6mr21894773pgl.270.1535998241459; Mon, 03 Sep 2018 11:10:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535998241; cv=none; d=google.com; s=arc-20160816; b=TWSnZsuV6XDZPndSCB+U5sbUDnwq6ME/x/NCfTpZ2aP5cUOdhGceNaAaGtRhJuEnCH 7zAOwPUSZwkAW2QH98N0NKCxF1w0ahmJVZGb8Abhkrqknc3/VUeexdg6z2rVAP+k/Lpr UeGu6KVp5lQp3EFlwx0MneCm5ldWxEh+ouaoQRE4xRa1K6pRePWNe3P/AEILM8LjUqMR 4SdWrwNcUdlCd5EjkMLGdViI1QWfmLSbXv6YkFril+ZkG6h3wVovPaG5ys5XORUyw+8D QRWVNgF6PfnWJ5JKp4u36d75gSD4uoL3baMv/D28WPnnZD7FRGbeAw0G9+Y34BKSpjVN s+nA== 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=8J0G5W4JtT6VPSxEroJdRi3RQ9k6zszZFAj3ctiyQSw=; b=xzIsigrG9Ic/K7H0K+wBbpCciUgpDHrLV5TjSw0GSMwxFVyevbW2GN7v5U/utptMXN f7y0mLa4Kg9jaXkBM16q4hS3SiBIk3zMrOPAgAtUEWhHBB7ffuLfd0UWfqEkOxEpFxBw 9bV8SQ/3Sr5GAsrWqFQUd48a+H7AHLgZC8ySvupcf36yfB85y1gIrujnweUPkgFARnLo iBH8/t1QI5TOZJ+kqgFxqffg6DtxRZaFlT10temqvGo8Aif3X4o9enyndr3O2yRSEhQv mEbt6PQxJIJu1NnbLTRamFCnNhyFOzFm3niQyVOg1ueshI9fBJJANCH60XKSwePINP91 Ke/A== 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 n85-v6si19935541pfj.251.2018.09.03.11.10.25; Mon, 03 Sep 2018 11:10:41 -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 S1727511AbeICWaZ (ORCPT + 99 others); Mon, 3 Sep 2018 18:30:25 -0400 Received: from www.llwyncelyn.cymru ([82.70.14.225]:39478 "EHLO fuzix.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727338AbeICWaZ (ORCPT ); Mon, 3 Sep 2018 18:30:25 -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 w83I94kP029283; Mon, 3 Sep 2018 19:09:04 +0100 Date: Mon, 3 Sep 2018 19:09:03 +0100 From: Alan Cox To: Rogier Wolff Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: Re: IRQ number question. Message-ID: <20180903190903.290fff01@alans-desktop> In-Reply-To: <20180903171639.GC16262@BitWizard.nl> References: <20180903171639.GC16262@BitWizard.nl> Organization: Intel Corporation X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; 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 On Mon, 3 Sep 2018 19:16:39 +0200 Rogier Wolff wrote: > Hi, > > I'm writing a kernel driver. It is not going to be widely used, so I'm > not motivated to make things nice enough for inclusion in the standard > kernel. > > But lspci shows my device: > > 03:01.0 Serial bus controller [0c80]: Phoenix Contact GmbH & Co. Device 0002 (rev b7) > Flags: bus master, stepping, medium devsel, latency 32, IRQ 14 > I/O ports at e070 [size=16] > Memory at f7d00000 (32-bit, non-prefetchable) [size=256K] > > Now when I start my module and prod the device a bit, it will generate > an interrupt. (in this case the monitor program needs to start sending > messages to the card.) > > Then the kernel reports: > > irq 18: nobody cared (try booting with the "irqpoll" option) > > I've been writing device drivers in the past, but in the past > when the lspci listed "IRQ 14" then I'd have to request_irq (14, ... The IRQ number in the PCI configuration space is just a label really for legacy OS stuff. Nothing actually routes interrupts according to it (*). If it's coming up as 14 that looks more like the BIOS mislabelled it. Legacy PCI interrupts care about lines and pins not irq numbers. Are you looking at values after things like pci_enable_device were called or before ? Are you also looking at what is in pcidev->irq after the enable ? > Has this changed? Or is this hardware "odd"/"bad"/"broken" in that it > initializes the PCI devices wrong? (*) > > My driver now works with the interrupts coming in nicely on IRQ18... > > I have this card where I'm writing my own driver, and another PCI card > that uses an "included-in-the-kernel" driver, and it too behaves as if > it doesn't get any interrupts. > > Roger. > > (*) Obviously according to everybody "windows works", so could it be > that modern windows simply activates an irq and polls to see what > driver handles it? Or something like that? Ah! That would be somewhat > similar to what "irqpoll" does on Linux! Does the hardware also support modern INTX interrupts or just the old legacy ones. Could be Windows is using INTX if so Alan (*) PCI doesn't. Certain slightly stoned PCI 'emulations' in some hardware do.