RE: PCIe Hotplugging not working
From: Anand Kanaginhal
Date: Fri Dec 09 2011 - 07:41:20 EST
I am afraid this issue is not resolved, however to give
complete picture and my understanding so far, I have the following description:
In the diagram:
---------------
p1, p8 p9 are downstream hotplug slots(ports) on switch 8533.
c1, c2 are the custom designed pcie cards for which I have my driver.
+----------+
| |
| |
| CPUS |
| |
| |
+----+-----+
|
|
|
|
+----+-----+ +-------------+
| | | |
| | | PEX 8533 |
| ROOT |--------------------| switch |
| CMPLX | | (10b5:8533) |
| | | |
+----------+ +-------------+
| | |
p1| p8| p9|
| | |
c1 c2 |
|
|
|
|
+-------------+
| |
| Another |
| switch |
| (chain) |
| |
+-------------+
I have built 2.6.38.13 linux kernel with following options set:
CONFIG_HOTPLUG=y
CONFIG_HOTPLUG_CPU=y
CONFIG_HOTPLUG_PCI_PCIE=y
CONFIG_HOTPLUG_PCI=y
CONFIG_HOTPLUG_PCI_FAKE=y
CONFIG_HOTPLUG_PCI_COMPAQ=m
CONFIG_HOTPLUG_PCI_COMPAQ_NVRAM=y
CONFIG_HOTPLUG_PCI_IBM=m
CONFIG_HOTPLUG_PCI_ACPI=y
CONFIG_HOTPLUG_PCI_ACPI_IBM=y
CONFIG_HOTPLUG_PCI_CPCI=y
CONFIG_HOTPLUG_PCI_CPCI_ZT5550=m
CONFIG_HOTPLUG_PCI_CPCI_GENERIC=m
CONFIG_HOTPLUG_PCI_SHPC=y
--------------------------------------------------------------------------------
Please correct me if any of my understanding below is incorrect:
1. With the above setup, If I hotplug card c1 and/or c2, will my driver probe
get invoked.
2. I dont have to add any rules for in /etc/udev/rules.d/*.rules for my driver
to work.
3. The standard hotplug controller driver would get the hotplug event from the
switch and handle it.
4. The standard hotplug controller driver will be responsible for invoking
.probe and .remove functions of my driver.
---
My simplified version of driver is pasted below, I understand that I create a char dev before any of the device is found, however my main concern is detection of card insertion and removal.
-----------
static struct pci_device_id my_pci_tbl[] = {
{ PCI_DEVICE (0x174a, 0x0701) },
{ PCI_DEVICE (0x174a, 0x0801) },
{ 0, }
};
MODULE_DEVICE_TABLE(pci, my_pci_tbl);
static struct pci_driver my_pci_driver =
{
.name = DRV_NAME,
.probe = my_pci_device_init,
.remove = __devexit_p(my_pci_device_remove),
.id_table = my_pci_tbl,
};
/*******************************************************************************
module init
******************************************************************************/
static int __init my_pci_module_init(void)
{
#ifdef MODULE
printk(version);
#endif
major = register_chrdev(0, DRV_NAME, &pcie_fops);
if (major <= 0) {
return -1;
}
/* Now register the PCI drivers */
return pci_register_driver(&my_pci_driver);
}
/*******************************************************************************
module_cleanup
******************************************************************************/
static void __exit my_pci_module_cleanup(void)
{
if (major) {
unregister_chrdev(major, DRV_NAME);
}
/* delete IO memory allocated */
/* unregister pci driver */
pci_unregister_driver (&my_pci_driver);
}
/*******************************************************************************
probe
******************************************************************************/
static int my_pci_device_init (struct pci_dev *pdev,
const struct pci_device_id *ent )
{
/* probe and device inits */
}
/*******************************************************************************
remove
******************************************************************************/
static void __devexit my_pci_device_remove (struct pci_dev *pdev)
{
/* remove operation */
}
/*******************************************************************************
******************************************************************************/
module_init(my_pci_module_init);
module_exit(my_pci_module_cleanup);
Thanks
Anand
----------------------------------------
> From: bhelgaas@xxxxxxxxxx
> Date: Wed, 7 Dec 2011 10:23:26 -0700
> Subject: Re: PCIe Hotplugging not working
> To: mjg59@xxxxxxxxxxxxx
> CC: anand_dk@xxxxxxxxxxx; greg@xxxxxxxxx; linux-pci@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; linux-hotplug@xxxxxxxxxxxxxxx
>
> On Wed, Nov 30, 2011 at 11:24 AM, Matthew Garrett <mjg59@xxxxxxxxxxxxx> wrote:
> > On Wed, Nov 30, 2011 at 09:18:39AM -0800, Anand Kanaginhal wrote:
> >>
> >> Hi Mathew,
> >> I have following options set
> >>
> >> CONFIG_HOTPLUG_PCI_PCIE=y
> >> CONFIG_HOTPLUG_PCI_ACPI=m
> >
> > Please try with this built in, not as a module. What kind of board are
> > you using?
>
> Is this resolved? If not, a complete dmesg log would be interesting.
> You might also try current upstream in case there were relevant
> changes since 2.6.38.12.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/