From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anand Kanaginhal Date: Fri, 09 Dec 2011 12:41:18 +0000 Subject: RE: PCIe Hotplugging not working Message-Id: List-Id: References: ,<20111130154022.GA1411@srcf.ucam.org> ,<20111130182423.GA4831@srcf.ucam.org>, In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: bhelgaas@google.com, mjg59@srcf.ucam.org, greg@kroah.com Cc: Linux PCI mailing , linux kernel mailing , linux hotplug mailing I am afraid this issue is not resolved, however to give=20 complete picture and my understanding so far, I have the following descript= ion: In the diagram: --------------- p1, p8 p9 are downstream hotplug slots(ports) on switch 8533.=A0=20 c1, c2 are the custom designed pcie cards for which I have my driver. =A0=A0=A0 +----------+ =A0=A0=A0 |=A0=A0=A0=A0=A0=A0=A0=A0=A0 | =A0=A0=A0 |=A0=A0=A0=A0=A0=A0=A0=A0=A0 | =A0=A0=A0 |=A0 CPUS=A0=A0=A0 | =A0=A0=A0 |=A0=A0=A0=A0=A0=A0=A0=A0=A0 | =A0=A0=A0 |=A0=A0=A0=A0=A0=A0=A0=A0=A0 | =A0=A0=A0 +----+-----+ =A0=A0=A0=A0=A0=A0=A0=A0 | =A0=A0=A0=A0=A0=A0=A0=A0 | =A0=A0=A0=A0=A0=A0=A0=A0 | =A0=A0=A0=A0=A0=A0=A0=A0 | =A0=A0=A0 +----+-----+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0 +-------------+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=20 =A0=A0=A0 |=A0=A0=A0=A0=A0=A0=A0=A0=A0 |=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0 |=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 |=20 =A0=A0=A0 |=A0=A0=A0=A0=A0=A0=A0=A0=A0 |=A0=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0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 |=A0=A0 switch=A0=A0=A0 | =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 |=A0=A0 (chain)=A0=A0 | =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 |=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0 | =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 +-------------+ I have built 2.6.38.13 linux kernel with following options set: CONFIG_HOTPLUG=3Dy CONFIG_HOTPLUG_CPU=3Dy CONFIG_HOTPLUG_PCI_PCIE=3Dy CONFIG_HOTPLUG_PCI=3Dy CONFIG_HOTPLUG_PCI_FAKE=3Dy CONFIG_HOTPLUG_PCI_COMPAQ=3Dm CONFIG_HOTPLUG_PCI_COMPAQ_NVRAM=3Dy CONFIG_HOTPLUG_PCI_IBM=3Dm CONFIG_HOTPLUG_PCI_ACPI=3Dy CONFIG_HOTPLUG_PCI_ACPI_IBM=3Dy CONFIG_HOTPLUG_PCI_CPCI=3Dy CONFIG_HOTPLUG_PCI_CPCI_ZT5550=3Dm CONFIG_HOTPLUG_PCI_CPCI_GENERIC=3Dm CONFIG_HOTPLUG_PCI_SHPC=3Dy ---------------------------------------------------------------------------= ----- 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 pro= be=20 get invoked.=20 2. I dont have to add any rules for in /etc/udev/rules.d/*.rules for my dri= ver =A0to work.=20 3. The standard hotplug controller driver would get the hotplug event from = the =A0switch and handle it.=20 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 d= etection of card insertion and removal. ----------- static struct pci_device_id my_pci_tbl[] =3D { =A0=A0=A0=A0=A0=A0 { PCI_DEVICE (0x174a, 0x0701) }, =A0=A0=A0=A0=A0=A0 { PCI_DEVICE (0x174a, 0x0801) }, =A0=A0=A0=A0=A0=A0 { 0, } =A0=A0=A0=A0=A0=A0 }; MODULE_DEVICE_TABLE(pci, my_pci_tbl); static struct pci_driver my_pci_driver { =A0=A0=A0 .name=A0=A0=A0=A0=A0=A0 =3D DRV_NAME, =A0=A0=A0 .probe=A0=A0=A0=A0=A0 =3D my_pci_device_init, =A0=A0=A0 .remove=A0=A0=A0=A0 =3D __devexit_p(my_pci_device_remove), =A0=A0=A0 .id_table=A0=A0 =3D my_pci_tbl, }; /**************************************************************************= ***** =A0=A0=A0 module init=20 ***************************************************************************= ***/ static int __init my_pci_module_init(void) { #ifdef MODULE =A0=A0=A0 printk(version); #endif =A0=A0=A0 major =3D register_chrdev(0, DRV_NAME, &pcie_fops); =A0=A0=A0 if (major <=3D 0) { =A0=A0=A0=A0=A0=A0=A0 return -1; =A0=A0=A0 } =A0=A0=A0 /* Now register the PCI drivers */ =A0=A0=A0 return pci_register_driver(&my_pci_driver); } /**************************************************************************= ***** =A0=A0=A0 module_cleanup =A0************************************************************************= ******/ static void __exit my_pci_module_cleanup(void) { =A0=A0=A0 if (major) { =A0=A0=A0=A0=A0=A0=A0 unregister_chrdev(major, DRV_NAME); =A0=A0=A0 } =A0=A0=A0 /* delete IO memory allocated */ =A0=A0=A0 /* unregister pci driver */ =A0=A0=A0 pci_unregister_driver (&my_pci_driver); } /**************************************************************************= ***** probe=20 ***************************************************************************= ***/ static int my_pci_device_init (struct=A0=A0=A0=A0=A0=A0=A0=A0=A0 pci_dev=A0= =A0=A0=A0=A0=A0 *pdev,=20 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0 const struct=A0=A0=A0 pci_device_id *ent ) { =A0=A0=A0 /* probe and device inits */ }=20 /**************************************************************************= ***** remove =A0************************************************************************= ******/ static void __devexit my_pci_device_remove (struct pci_dev *pdev) { =A0=A0=A0 /* remove operation */ } /**************************************************************************= ***** =A0************************************************************************= ******/ module_init(my_pci_module_init); module_exit(my_pci_module_cleanup); Thanks=20 Anand ---------------------------------------- > From: bhelgaas@google.com > Date: Wed, 7 Dec 2011 10:23:26 -0700 > Subject: Re: PCIe Hotplugging not working > To: mjg59@srcf.ucam.org > CC: anand_dk@hotmail.com; greg@kroah.com; linux-pci@vger.kernel.org; linu= x-kernel@vger.kernel.org; linux-hotplug@vger.kernel.org > > On Wed, Nov 30, 2011 at 11:24 AM, Matthew Garrett w= rote: > > On Wed, Nov 30, 2011 at 09:18:39AM -0800, Anand Kanaginhal wrote: > >> > >> Hi Mathew, > >> I have following options set > >> > >> CONFIG_HOTPLUG_PCI_PCIE=3Dy > >> CONFIG_HOTPLUG_PCI_ACPI=3Dm > > > > 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@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/