Re: [PATCH] incremental fix for NIU MSI-X problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2009-05-14 at 07:44 -0600, Matthew Wilcox wrote:
> commit 7d4f9bdd8995e6718cb9dec57fd294bc16f17919
> Author: Matthew Wilcox <matthew@xxxxxx>
> Date:   Wed May 13 17:31:11 2009 -0400
> 
...
> @@ -480,22 +481,31 @@ static int msix_capability_init(struct pci_dev *dev,
>  		return ret;
>  	}
>  
> +	/*
> +	 * Some devices require MSI-X to be enabled before we can touch the
> +	 * MSI-X registers.  We need to mask all the vectors to prevent
> +	 * interrupts coming in before they're fully set up.
> +	 */
> +	control |= PCI_MSIX_FLAGS_MASKALL | PCI_MSIX_FLAGS_ENABLE;
> +	pci_write_config_word(dev, pos + PCI_MSIX_FLAGS, control);
> +
>  	i = 0;
>  	list_for_each_entry(entry, &dev->msi_list, list) {
>  		entries[i].vector = entry->irq;
>  		set_irq_msi(entry->irq, entry);
> +		j = entries[i].entry;
> +		entry->masked = readl(base + j * PCI_MSIX_ENTRY_SIZE +
> +					PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET);
> +		msix_mask_irq(entry, 1);
>  		i++;
>  	}
> -	/* Set MSI-X enabled bits */
> +
> +	/* Set MSI-X enabled bits and unmask the function */
>  	pci_intx_for_msi(dev, 0);

I wonder if moving this relative to the enable has any implications, but
I doubt it.

> -	msix_set_enable(dev, 1);
>  	dev->msix_enabled = 1;
>  
> -	list_for_each_entry(entry, &dev->msi_list, list) {
> -		int vector = entry->msi_attrib.entry_nr;
> -		entry->masked = readl(base + vector * PCI_MSIX_ENTRY_SIZE +
> -					PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET);
> -	}
> +	control &= ~PCI_MSIX_FLAGS_MASKALL;
> +	pci_write_config_word(dev, pos + PCI_MSIX_FLAGS, control);
>  
>  	return 0;
>  }
> 

Looks good otherwise, I haven't tested it sorry.

cheers

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux