2006-11-15 19:10:28

by Stephen Hemminger

[permalink] [raw]
Subject: Re: [PATCH] ALSA: hda-intel - Disable MSI support by default

On Tue, 14 Nov 2006 23:24:04 -0500
Jeff Garzik <[email protected]> wrote:

> David Miller wrote:
> > Is this absolutely true? I've never been sure about this point, and I
> > was rather convinced after reading various documents that once you
> > program up the MSI registers to start generating MSI this implicitly
> > disabled INTX and this was even in the PCI specification.
> >
> > It would be great to get a definitive answer on this.
> >
> > If it is mandatory, perhaps the driver shouldn't be doing it and
> > rather the PCI layer MSI enabling should.

pci_enable_msi() calls msi_capability_init() and that disables intx
already.


>
> I can't answer for the spec, but at least two independent device vendors
> recommended to write an MSI driver that way (disable intx, enable msi).
>
> Completely independent of MSI though, a PCI 2.2 compliant driver should
> be nice and disable intx on exit, just to avoid any potential interrupt
> hassles after driver unload. And of course be aware that it might need
> to enable intx upon entry.
>
> Jeff

The driver shouldn't deal with this, pci_disable_msi() does.

--
Stephen Hemminger <[email protected]>


2006-11-15 19:23:24

by Jeff Garzik

[permalink] [raw]
Subject: Re: [PATCH] ALSA: hda-intel - Disable MSI support by default

Stephen Hemminger wrote:
> On Tue, 14 Nov 2006 23:24:04 -0500
> Jeff Garzik <[email protected]> wrote:
>
>> David Miller wrote:
>>> Is this absolutely true? I've never been sure about this point, and I
>>> was rather convinced after reading various documents that once you
>>> program up the MSI registers to start generating MSI this implicitly
>>> disabled INTX and this was even in the PCI specification.
>>>
>>> It would be great to get a definitive answer on this.
>>>
>>> If it is mandatory, perhaps the driver shouldn't be doing it and
>>> rather the PCI layer MSI enabling should.
>
> pci_enable_msi() calls msi_capability_init() and that disables intx
> already.
[...]
> The driver shouldn't deal with this, pci_disable_msi() does.

Explicit code reference please?

AFAICS the PCI layer only touched INTx bit for PCI-Express devices.

Jeff


2006-11-15 19:52:43

by Stephen Hemminger

[permalink] [raw]
Subject: Re: [PATCH] ALSA: hda-intel - Disable MSI support by default

On Wed, 15 Nov 2006 14:23:20 -0500
Jeff Garzik <[email protected]> wrote:

> Stephen Hemminger wrote:
> > On Tue, 14 Nov 2006 23:24:04 -0500
> > Jeff Garzik <[email protected]> wrote:
> >
> >> David Miller wrote:
> >>> Is this absolutely true? I've never been sure about this point, and I
> >>> was rather convinced after reading various documents that once you
> >>> program up the MSI registers to start generating MSI this implicitly
> >>> disabled INTX and this was even in the PCI specification.
> >>>
> >>> It would be great to get a definitive answer on this.
> >>>
> >>> If it is mandatory, perhaps the driver shouldn't be doing it and
> >>> rather the PCI layer MSI enabling should.
> >
> > pci_enable_msi() calls msi_capability_init() and that disables intx
> > already.
> [...]
> > The driver shouldn't deal with this, pci_disable_msi() does.
>
> Explicit code reference please?
>
> AFAICS the PCI layer only touched INTx bit for PCI-Express devices.

Yeah, why is that? Shouldn't it always be adjusting intx.
Are there are any MSI capable devices on non-PCI express?
Sorry, don't have PCI spec (costs real $$) to check.

--- 2.6.19-rc5.orig/drivers/pci/msi.c 2006-11-15 11:46:23.000000000 -0800
+++ 2.6.19-rc5/drivers/pci/msi.c 2006-11-15 11:46:55.000000000 -0800
@@ -255,10 +255,7 @@
pci_write_config_word(dev, msi_control_reg(pos), control);
dev->msix_enabled = 1;
}
- if (pci_find_capability(dev, PCI_CAP_ID_EXP)) {
- /* PCI Express Endpoint device detected */
- pci_intx(dev, 0); /* disable intx */
- }
+ pci_intx(dev, 0); /* disable intx */
}

void disable_msi_mode(struct pci_dev *dev, int pos, int type)
@@ -276,10 +273,8 @@
pci_write_config_word(dev, msi_control_reg(pos), control);
dev->msix_enabled = 0;
}
- if (pci_find_capability(dev, PCI_CAP_ID_EXP)) {
- /* PCI Express Endpoint device detected */
- pci_intx(dev, 1); /* enable intx */
- }
+
+ pci_intx(dev, 1); /* re-enable intx */
}

static int msi_lookup_irq(struct pci_dev *dev, int type)




--
Stephen Hemminger <[email protected]>

2006-11-15 22:31:44

by Roland Dreier

[permalink] [raw]
Subject: Re: [PATCH] ALSA: hda-intel - Disable MSI support by default

> Are there are any MSI capable devices on non-PCI express?

Yes, e.g. the mthca driver handles PCI-X adapters that do MSI-X.

- R.