ahci: use pci_alloc_irq_vectors
Use the new pci_alloc_irq_vectors API to allocate MSI-X and MSI vectors. The big advantage over the old code is that we can use the same API for MSI and MSI-X, and that we don't need to store the MSI-X vector mapping in driver-private data structures. This first conversion keeps the probe order as-is: MSI-X multi vector, MSI multi vector, MSI single vector, MSI-X single vector and last a single least legacy interrupt line. There is one small change of behavior: we now check the "MSI Revert to Single Message" flag for MSI-X in addition to MSI. Because the API to find the Linux IRQ number for a MSI/MSI-X vector is PCI specific, but libahaci is bus-agnostic I had to a get_irq_vector function pointer to struct ahci_host_priv. The alternative would be to move the multi-vector case of ahci_host_activate to ahci.c and just call ata_host_activate directly from the others users of ahci_host_activate. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:

committed by
Tejun Heo

parent
2536524a91
commit
0b9e2988ab
@@ -242,12 +242,10 @@ enum {
|
||||
AHCI_HFLAG_NO_FBS = (1 << 18), /* no FBS */
|
||||
|
||||
#ifdef CONFIG_PCI_MSI
|
||||
AHCI_HFLAG_MULTI_MSI = (1 << 20), /* multiple PCI MSIs */
|
||||
AHCI_HFLAG_MULTI_MSIX = (1 << 21), /* per-port MSI-X */
|
||||
AHCI_HFLAG_MULTI_MSI = (1 << 20), /* per-port MSI(-X) */
|
||||
#else
|
||||
/* compile out MSI infrastructure */
|
||||
AHCI_HFLAG_MULTI_MSI = 0,
|
||||
AHCI_HFLAG_MULTI_MSIX = 0,
|
||||
#endif
|
||||
AHCI_HFLAG_WAKE_BEFORE_STOP = (1 << 22), /* wake before DMA stop */
|
||||
|
||||
@@ -351,7 +349,6 @@ struct ahci_host_priv {
|
||||
* the PHY position in this array.
|
||||
*/
|
||||
struct phy **phys;
|
||||
struct msix_entry *msix; /* Optional MSI-X support */
|
||||
unsigned nports; /* Number of ports */
|
||||
void *plat_data; /* Other platform data */
|
||||
unsigned int irq; /* interrupt line */
|
||||
@@ -362,22 +359,11 @@ struct ahci_host_priv {
|
||||
*/
|
||||
void (*start_engine)(struct ata_port *ap);
|
||||
irqreturn_t (*irq_handler)(int irq, void *dev_instance);
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PCI_MSI
|
||||
static inline int ahci_irq_vector(struct ahci_host_priv *hpriv, int port)
|
||||
{
|
||||
if (hpriv->flags & AHCI_HFLAG_MULTI_MSIX)
|
||||
return hpriv->msix[port].vector;
|
||||
else
|
||||
return hpriv->irq + port;
|
||||
}
|
||||
#else
|
||||
static inline int ahci_irq_vector(struct ahci_host_priv *hpriv, int port)
|
||||
{
|
||||
return hpriv->irq;
|
||||
}
|
||||
#endif
|
||||
/* only required for per-port MSI(-X) support */
|
||||
int (*get_irq_vector)(struct ata_host *host,
|
||||
int port);
|
||||
};
|
||||
|
||||
extern int ahci_ignore_sss;
|
||||
|
||||
|
Reference in New Issue
Block a user