* [PATCH 0/2] ahci: Tweaks to the driver's PCI function @ 2014-04-02 8:19 Alexander Gordeev 2014-04-02 8:19 ` [PATCH 1/2] ahci: Ensure "MSI Revert to Single Message" mode is not enforced Alexander Gordeev 2014-04-02 8:19 ` [PATCH 2/2] ahci: Use pci_enable_msi_exact() instead of pci_enable_msi_range() Alexander Gordeev 0 siblings, 2 replies; 6+ messages in thread From: Alexander Gordeev @ 2014-04-02 8:19 UTC (permalink / raw) To: linux-kernel; +Cc: Alexander Gordeev, linux-ide Hello, The changes are against the latest Linus tree. Cc: linux-ide@vger.kernel.org Alexander Gordeev (2): ahci: Ensure "MSI Revert to Single Message" mode is not enforced ahci: Use pci_enable_msi_exact() instead of pci_enable_msi_range() drivers/ata/ahci.c | 25 +++++++++++++++++++++---- drivers/ata/ahci.h | 1 + 2 files changed, 22 insertions(+), 4 deletions(-) -- 1.7.7.6 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] ahci: Ensure "MSI Revert to Single Message" mode is not enforced 2014-04-02 8:19 [PATCH 0/2] ahci: Tweaks to the driver's PCI function Alexander Gordeev @ 2014-04-02 8:19 ` Alexander Gordeev 2014-04-16 20:01 ` Tejun Heo 2014-04-02 8:19 ` [PATCH 2/2] ahci: Use pci_enable_msi_exact() instead of pci_enable_msi_range() Alexander Gordeev 1 sibling, 1 reply; 6+ messages in thread From: Alexander Gordeev @ 2014-04-02 8:19 UTC (permalink / raw) To: linux-kernel; +Cc: Alexander Gordeev, linux-ide Do not rely on successful initialization of multiple MSIs mode alone and always check if "MSI Revert to Single Message" mode was enforced by the controller. Fall back to the single MSI mode in case it did. Not doing so might screw up the interrupt handling. Signed-off-by: Alexander Gordeev <agordeev@redhat.com> Cc: linux-ide@vger.kernel.org --- drivers/ata/ahci.c | 17 +++++++++++++++++ drivers/ata/ahci.h | 1 + 2 files changed, 18 insertions(+), 0 deletions(-) diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 5a0bf8e..838d97e 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -1163,6 +1163,14 @@ static inline void ahci_gtf_filter_workaround(struct ata_host *host) {} #endif +static int ahci_is_mrsm(struct ahci_host_priv *hpriv) +{ + void __iomem *mmio = hpriv->mmio; + u32 ctl = readl(mmio + HOST_CTL); + + return ctl & HOST_MRSM; +} + static int ahci_init_interrupts(struct pci_dev *pdev, unsigned int n_ports, struct ahci_host_priv *hpriv) { @@ -1189,6 +1197,15 @@ static int ahci_init_interrupts(struct pci_dev *pdev, unsigned int n_ports, else if (nvec < 0) goto intx; + /* + * Fallback to single MSI mode if the controller enforced MRSM mode + */ + if (ahci_is_mrsm(hpriv)) { + pci_disable_msi(pdev); + printk(KERN_INFO "ahci: MRSM is on, fallback to single MSI\n"); + goto single_msi; + } + return nvec; single_msi: diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h index 51af275..b5eb886 100644 --- a/drivers/ata/ahci.h +++ b/drivers/ata/ahci.h @@ -94,6 +94,7 @@ enum { /* HOST_CTL bits */ HOST_RESET = (1 << 0), /* reset controller; self-clear */ HOST_IRQ_EN = (1 << 1), /* global IRQ enable */ + HOST_MRSM = (1 << 2), /* MSI Revert to Single Message */ HOST_AHCI_EN = (1 << 31), /* AHCI enabled */ /* HOST_CAP bits */ -- 1.7.7.6 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] ahci: Ensure "MSI Revert to Single Message" mode is not enforced 2014-04-02 8:19 ` [PATCH 1/2] ahci: Ensure "MSI Revert to Single Message" mode is not enforced Alexander Gordeev @ 2014-04-16 20:01 ` Tejun Heo 2014-04-17 12:16 ` Alexander Gordeev 0 siblings, 1 reply; 6+ messages in thread From: Tejun Heo @ 2014-04-16 20:01 UTC (permalink / raw) To: Alexander Gordeev; +Cc: linux-kernel, linux-ide Hello, Alexander. On Wed, Apr 02, 2014 at 10:19:56AM +0200, Alexander Gordeev wrote: > +static int ahci_is_mrsm(struct ahci_host_priv *hpriv) > +{ > + void __iomem *mmio = hpriv->mmio; > + u32 ctl = readl(mmio + HOST_CTL); > + > + return ctl & HOST_MRSM; > +} Can you please just open code this in ahci_init_interrupt()? Also, do I need to backport this through -stable? Has this been tested somehow? What are the impacts of missing this? Thanks. -- tejun ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] ahci: Ensure "MSI Revert to Single Message" mode is not enforced 2014-04-16 20:01 ` Tejun Heo @ 2014-04-17 12:16 ` Alexander Gordeev 0 siblings, 0 replies; 6+ messages in thread From: Alexander Gordeev @ 2014-04-17 12:16 UTC (permalink / raw) To: Tejun Heo; +Cc: linux-kernel, linux-ide On Wed, Apr 16, 2014 at 04:01:32PM -0400, Tejun Heo wrote: > Can you please just open code this in ahci_init_interrupt()? Also, do > I need to backport this through -stable? Has this been tested > somehow? What are the impacts of missing this? Hi Tejun, Sent out an updated version. Yes, I think it needs to go to -stable. > Thanks. > > -- > tejun -- Regards, Alexander Gordeev agordeev@redhat.com ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] ahci: Use pci_enable_msi_exact() instead of pci_enable_msi_range() 2014-04-02 8:19 [PATCH 0/2] ahci: Tweaks to the driver's PCI function Alexander Gordeev 2014-04-02 8:19 ` [PATCH 1/2] ahci: Ensure "MSI Revert to Single Message" mode is not enforced Alexander Gordeev @ 2014-04-02 8:19 ` Alexander Gordeev 2014-04-16 20:02 ` Tejun Heo 1 sibling, 1 reply; 6+ messages in thread From: Alexander Gordeev @ 2014-04-02 8:19 UTC (permalink / raw) To: linux-kernel; +Cc: Alexander Gordeev, linux-ide The driver calls pci_enable_msi_range() function with the range of [nvec..nvec] which what pci_enable_msi_exact() function is for. Signed-off-by: Alexander Gordeev <agordeev@redhat.com> Cc: linux-ide@vger.kernel.org --- drivers/ata/ahci.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 838d97e..01c5541 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -1174,7 +1174,7 @@ static int ahci_is_mrsm(struct ahci_host_priv *hpriv) static int ahci_init_interrupts(struct pci_dev *pdev, unsigned int n_ports, struct ahci_host_priv *hpriv) { - int nvec; + int rc, nvec; if (hpriv->flags & AHCI_HFLAG_NO_MSI) goto intx; @@ -1191,10 +1191,10 @@ static int ahci_init_interrupts(struct pci_dev *pdev, unsigned int n_ports, if (nvec < n_ports) goto single_msi; - nvec = pci_enable_msi_range(pdev, nvec, nvec); - if (nvec == -ENOSPC) + rc = pci_enable_msi_exact(pdev, nvec); + if (rc == -ENOSPC) goto single_msi; - else if (nvec < 0) + else if (rc < 0) goto intx; /* -- 1.7.7.6 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] ahci: Use pci_enable_msi_exact() instead of pci_enable_msi_range() 2014-04-02 8:19 ` [PATCH 2/2] ahci: Use pci_enable_msi_exact() instead of pci_enable_msi_range() Alexander Gordeev @ 2014-04-16 20:02 ` Tejun Heo 0 siblings, 0 replies; 6+ messages in thread From: Tejun Heo @ 2014-04-16 20:02 UTC (permalink / raw) To: Alexander Gordeev; +Cc: linux-kernel, linux-ide On Wed, Apr 02, 2014 at 10:19:57AM +0200, Alexander Gordeev wrote: > The driver calls pci_enable_msi_range() function with the > range of [nvec..nvec] which what pci_enable_msi_exact() > function is for. > > Signed-off-by: Alexander Gordeev <agordeev@redhat.com> > Cc: linux-ide@vger.kernel.org Please refresh this one after updating the first patch. Thanks. -- tejun ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-04-17 13:14 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-04-02 8:19 [PATCH 0/2] ahci: Tweaks to the driver's PCI function Alexander Gordeev 2014-04-02 8:19 ` [PATCH 1/2] ahci: Ensure "MSI Revert to Single Message" mode is not enforced Alexander Gordeev 2014-04-16 20:01 ` Tejun Heo 2014-04-17 12:16 ` Alexander Gordeev 2014-04-02 8:19 ` [PATCH 2/2] ahci: Use pci_enable_msi_exact() instead of pci_enable_msi_range() Alexander Gordeev 2014-04-16 20:02 ` Tejun Heo
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).