Re: [PATCH 2/8] PCI PCIe portdrv: Aviod using service devices with wrong interrupts

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

 



On Sunday, January 4, 2009 2:49 pm Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw@xxxxxxx>
>
> The PCI Express port driver should not attempt to register service
> devices that require the ability to generate interrupts if generating
> interrupts is not possible.  Namely, if the port has no interrupt pin
> configured and we cannot set up MSI or MSI-X for it, there is no way
> it can generate interrupts and in such a case the port services that
> rely on interrupts (PME, PCIe HP, AER) should not be enabled for it.
>

>  /* Root/Upstream/Downstream Port's Interrupt Mode */
> +#define PCIE_PORT_NO_IRQ		(-1)
>  #define PCIE_PORT_INTx_MODE		0
>  #define PCIE_PORT_MSI_MODE		1
>  #define PCIE_PORT_MSIX_MODE		2
> Index: linux-2.6/drivers/pci/pcie/portdrv_core.c
> ===================================================================
> --- linux-2.6.orig/drivers/pci/pcie/portdrv_core.c
> +++ linux-2.6/drivers/pci/pcie/portdrv_core.c
> @@ -41,13 +41,15 @@ static void release_pcie_device(struct d
>  static int assign_interrupt_mode(struct pci_dev *dev, int *vectors, int
> mask) {
>  	int i, pos, nvec, status = -EINVAL;
> -	int interrupt_mode = PCIE_PORT_INTx_MODE;
> +	int interrupt_mode = PCIE_PORT_NO_IRQ;
>
>  	/* Set INTx as default */
>  	for (i = 0, nvec = 0; i < PCIE_PORT_DEVICE_MAXSERVICES; i++) {
>  		if (mask & (1 << i))
>  			nvec++;
>  		vectors[i] = dev->irq;
> +		if (dev->pin)
> +			interrupt_mode = PCIE_PORT_INTx_MODE;
>  	}


Looks like a good cleanup.  I didn't audit all the places PCIE_PORT_* stuff 
was used to see if != would be a problem though (probably isn't).

-- 
Jesse Barnes, Intel Open Source Technology Center
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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