[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200901091523.18308.jbarnes@virtuousgeek.org>
Date: Fri, 9 Jan 2009 15:23:17 -0800
From: Jesse Barnes <jbarnes@...tuousgeek.org>
To: "Rafael J. Wysocki" <rjw@...k.pl>
Cc: Linux PCI <linux-pci@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/8] PCI PCIe portdrv: Aviod using service devices with wrong interrupts
On Sunday, January 4, 2009 2:49 pm Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw@...k.pl>
>
> 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-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists