ahci: Tweaks to the driver's PCI function
cover ahci: Tweaks to the driver's PCI function
Hello,
The changes are against the latest Linus tree.
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(-)
Signature · 1 line
1.7.7.6
PATCH 1/2 ahci: Ensure "MSI Revert to Single Message" mode is not enforced
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.
--- drivers/ata/ahci.c | 17 +++++++++++++++++ drivers/ata/ahci.h | 1 + 2 files changed, 18 insertions(+), 0 deletions(-)
drivers/ata/ahci.c +17 -0
@@ -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:
drivers/ata/ahci.h +1 -0
@@ -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 */
Signature · 1 line
1.7.7.6
Re: [PATCH 1/2] ahci: Ensure "MSI Revert to Single Message" mode is not enforced
Hello, Alexander.
drivers/ata/ahci.c static inline void ahci_gtf_filter_workaround(struct ata_host *host) · line 1172
Quoted 7 lines · Alexander Gordeev
drivers/ata/ahci.c +7
-0+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.
Signature · 1 line
tejun
Re: [PATCH 1/2] ahci: Ensure "MSI Revert to Single Message" mode is not enforced
Quoted 3 lines · Tejun Heo
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.
Quoted 4 lines
Thanks.
Signature · 1 line
tejun
Signature · 3 lines
Regards, Alexander Gordeev [email protected]
PATCH 2/2 ahci: Use pci_enable_msi_exact() instead of pci_enable_msi_range()
In reply to Alexander GordeevThe driver calls pci_enable_msi_range() function with the range of [nvec..nvec] which what pci_enable_msi_exact() function is for.
--- drivers/ata/ahci.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/ata/ahci.c +4 -4
@@ -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;/*
Signature · 1 line
1.7.7.6
Re: [PATCH 2/2] ahci: Use pci_enable_msi_exact() instead of pci_enable_msi_range()
Quoted 6 lines · Alexander Gordeev
The driver calls
pci_enable_msi_range()function with the range of [nvec..nvec] which whatpci_enable_msi_exact()function is for.Signed-off-by Alexander Gordeev <[email protected]>
Please refresh this one after updating the first patch.
Thanks.
Signature · 1 line
tejun