Re: [PATCH 6/9] pci/msi: add __msix_set_enable()

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

 



On Wed, 2008-06-04 at 13:49 +0900, Hidetoshi Seto wrote:
> If we know the offset of MSI-X capability, then use it to go fast.
> 
> Signed-off-by: Hidetoshi Seto <seto.hidetoshi@xxxxxxxxxxxxxx>

Is this really worth it? These are not hot paths.

cheers

> ---
>  drivers/pci/msi.c |   19 +++++++++++++------
>  1 files changed, 13 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index 7eea1dd..4e5999e 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -88,12 +88,10 @@ static void msi_set_enable(struct pci_dev *dev, int enable)
>  	__msi_set_enable(dev, pci_find_capability(dev, PCI_CAP_ID_MSI), enable);
>  }
>  
> -static void msix_set_enable(struct pci_dev *dev, int enable)
> +static void __msix_set_enable(struct pci_dev *dev, int pos, int enable)
>  {
> -	int pos;
>  	u16 control;
>  
> -	pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
>  	if (pos) {
>  		pci_read_config_word(dev, pos + PCI_MSIX_FLAGS, &control);
>  		control &= ~PCI_MSIX_FLAGS_ENABLE;
> @@ -103,6 +101,12 @@ static void msix_set_enable(struct pci_dev *dev, int enable)
>  	}
>  }
>  
> +static void msix_set_enable(struct pci_dev *dev, int enable)
> +{
> +	__msix_set_enable(dev, pci_find_capability(dev, PCI_CAP_ID_MSIX),
> +			  enable);
> +}
> +
>  static void msix_flush_writes(unsigned int irq)
>  {
>  	struct msi_desc *entry;
> @@ -454,9 +458,11 @@ static int msix_capability_init(struct pci_dev *dev,
>  	u8 bir;
>  	void __iomem *base;
>  
> -	msix_set_enable(dev, 0);/* Ensure msix is disabled as I set it up */
> -
>     	pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
> +
> +	/* Ensure msix is disabled as I set it up */
> +	__msix_set_enable(dev, pos, 0);
> +
>  	/* Request & Map MSI-X table region */
>   	pci_read_config_word(dev, msi_control_reg(pos), &control);
>  	nr_entries = multi_msix_capable(control);
> @@ -514,9 +520,10 @@ static int msix_capability_init(struct pci_dev *dev,
>  		set_irq_msi(entry->irq, entry);
>  		i++;
>  	}
> +
>  	/* Set MSI-X enabled bits */
>  	pci_intx_for_msi(dev, 0);
> -	msix_set_enable(dev, 1);
> +	__msix_set_enable(dev, pos, 1);
>  	dev->msix_enabled = 1;
>  
>  	return 0;
-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

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