linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arthur Marsh <arthur.marsh@internode.on.net>
To: Jiang Liu <jiang.liu@linux.intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org
Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	linux-scsi@vger.kernel.org
Subject: Re: [Bugfix] PCI, x86: Correctly allocate IRQs for PCI devices managed by non-PCI drivers
Date: Tue, 08 Sep 2015 18:33:25 +0930	[thread overview]
Message-ID: <55EEA45D.2070709@internode.on.net> (raw)
In-Reply-To: <1441697190-27993-1-git-send-email-jiang.liu@linux.intel.com>



Jiang Liu wrote on 08/09/15 16:56:
> Commit 991de2e59090 ("PCI, x86: Implement pcibios_alloc_irq() and
> pcibios_free_irq()") changes the way to allocate PCI legacy IRQ
> for PCI devices on x86 platforms. Instead of allocating PCI legacy
> IRQs when pcibios_enable_device() gets called, now pcibios_alloc_irq()
> will be called by pci_device_probe() to allocate PCI legacy IRQs
> when binding PCI drivers to PCI devices.
>
> But some device drivers, such as eata, directly access PCI devices
> without implementing corresponding PCI drivers, so pcibios_alloc_irq()
> won't be called for those PCI devices and wrong IRQ number may be
> used to manage the PCI device.
>
> So detect such a case in pcibios_enable_device() by checking
> pci_dev->driver is NULL and call pcibios_alloc_irq() to allocate PCI
> legacy IRQs.
>
> Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
> ---
>   arch/x86/pci/common.c |   10 ++++++++++
>   1 file changed, 10 insertions(+)
>
> diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
> index 09d3afc0a181..60b237783582 100644
> --- a/arch/x86/pci/common.c
> +++ b/arch/x86/pci/common.c
> @@ -685,6 +685,16 @@ void pcibios_free_irq(struct pci_dev *dev)
>
>   int pcibios_enable_device(struct pci_dev *dev, int mask)
>   {
> +	/*
> +	 * By design, pcibios_alloc_irq() will be called by pci_device_probe()
> +	 * when binding a PCI device to a PCI driver. But some device drivers,
> +	 * such as eata, directly make use of PCI devices without implementing
> +	 * PCI device drivers, so pcibios_alloc_irq() won't be called for those
> +	 * PCI devices.
> +	 */
> +	if (!dev->driver)
> +		pcibios_alloc_irq(dev);
> +
>   	return pci_enable_resources(dev, mask);
>   }
>
>

Thanks, I removed the test patch and applied the revised patch and built 
and rebooted the kernel and successfully mounted file systems on a disk 
attached to the DPT 2044W card using the eata driver:

[    0.000000] Linux version 4.2.0+ (root@victoria) (gcc version 5.2.1 
20150903
(Debian 5.2.1-16) ) #31 SMP PREEMPT Tue Sep 8 17:36:28 ACST 2015
...

[   80.691097] EATA0: IRQ 10 mapped to IO-APIC IRQ 17.
[   80.724519] EATA/DMA 2.0x: Copyright (C) 1994-2003 Dario Ballabio.
[   80.752035] EATA config options -> tm:1, lc:y, mq:16, rs:y, et:n, 
ip:n, ep:n, pp:y.
[   80.777063] EATA0: 2.0C, PCI 0xd890, IRQ 17, BMST, SG 122, MB 64.
[   80.802391] EATA0: wide SCSI support enabled, max_id 16, max_lun 8.
[   80.827959] EATA0: SCSI channel 0 enabled, host target ID 7.
[   80.853413] scsi host3: EATA/DMA 2.0x rev. 8.10.00
[   82.445662] scsi 3:0:6:0: Direct-Access     IBM      DCAS-34330W 
  S65A PQ: 0 ANSI: 2
[   82.471584] scsi 3:0:6:0: cmds/lun 16, sorted, simple tags.
[   84.571451] sd 3:0:6:0: Attached scsi generic sg4 type 0
[   84.597572] sd 3:0:6:0: [sdd] 8466688 512-byte logical blocks: (4.33 
GB/4.03 GiB)
[   84.659874] sd 3:0:6:0: [sdd] Write Protect is off
[   84.688543] sd 3:0:6:0: [sdd] Mode Sense: b3 00 00 08
[   84.714021] sd 3:0:6:0: [sdd] Write cache: enabled, read cache: 
enabled, doesn't support DPO or FUA
[   84.817682]  sdd: sdd1 sdd2 < sdd5 >
[   84.919267] sd 3:0:6:0: [sdd] Attached SCSI disk

Arthur.

  reply	other threads:[~2015-09-08  9:03 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <55EE8106.6060100@internode.on.net>
2015-09-08  7:26 ` [Bugfix] PCI, x86: Correctly allocate IRQs for PCI devices managed by non-PCI drivers Jiang Liu
2015-09-08  9:03   ` Arthur Marsh [this message]
2015-09-08  9:44     ` Jiang Liu
2015-09-08 16:27   ` Bjorn Helgaas
2015-09-08 16:49     ` Jiang Liu
2015-09-09 19:11       ` Bjorn Helgaas
2015-09-10  8:58         ` Jiang Liu
2015-09-14  3:08         ` [Bugfix 0/3] Convert eata driver to a normal PCI device driver Jiang Liu
2015-09-14  3:08           ` [Bugfix 1/3] eata: Use IDA to manage eata board IDs Jiang Liu
2015-09-14  8:08             ` Hannes Reinecke
2015-09-14  3:08           ` [Bugfix 2/3] eata: Implement PCI driver to manage eata PCI devices Jiang Liu
2015-09-14  8:17             ` Hannes Reinecke
2015-09-14  8:31               ` Jiang Liu
2015-09-14  3:08           ` [Bugfix 3/3] eata: Enhance eata driver to support PCI device hot-removal Jiang Liu
2015-09-14  8:21             ` Hannes Reinecke
2015-09-14  8:31               ` Ballabio, Dario
2015-09-14  8:33                 ` Jiang Liu
2015-09-16 13:42               ` Christoph Hellwig
2015-09-17  6:49                 ` Jiang Liu
2015-09-18 15:08                 ` Arthur Marsh
2015-09-22  7:30                 ` [RFT v3] eata: Convert eata driver as normal PCI and platform device drivers Jiang Liu
2015-09-22 20:27                   ` Hannes Reinecke
2015-09-22 22:25                   ` Arthur Marsh
2015-09-22 22:45                     ` James Bottomley
2015-09-22 23:36                       ` Arthur Marsh
2015-09-23  5:24                         ` Jiang Liu
2015-09-23 10:44                           ` Arthur Marsh
2015-09-23 14:40                             ` James Bottomley
2015-09-24  4:28                               ` Jiang Liu
2015-09-24  5:56                                 ` Arthur Marsh
2015-09-26  6:27                                   ` Arthur Marsh
2015-10-03  8:11                                     ` Jiang Liu
2015-10-03 11:14                                       ` Arthur Marsh
2015-10-05  8:29                                       ` Arthur Marsh
2015-09-14 16:01           ` [Bugfix 0/3] Convert eata driver to a normal PCI device driver Arthur Marsh
2015-09-15  2:31             ` Jiang Liu
2015-09-15  7:19               ` Arthur Marsh
2015-09-16  5:07                 ` Jiang Liu
2015-09-16  7:37                   ` Arthur Marsh
2015-09-16  8:21                     ` Jiang Liu
2015-09-16 11:29                       ` Arthur Marsh
2015-09-09 19:04   ` [Bugfix] PCI, x86: Correctly allocate IRQs for PCI devices managed by non-PCI drivers Arthur Marsh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55EEA45D.2070709@internode.on.net \
    --to=arthur.marsh@internode.on.net \
    --cc=bhelgaas@google.com \
    --cc=hpa@zytor.com \
    --cc=jiang.liu@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).