Re: question regarding pciehp and pciehp_probe()

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

 



On Fri, 2008-12-12 at 09:59 +0900, Kenji Kaneshige wrote:
> Praveen Kalamegham wrote:
> > I'm trying to get my setup to work with the native PCIe hotplug driver.
> >>From my testing, it looks like when the pciehp driver is loaded, it
> > expects all the PCIe slots to be powered off.  In pciehp_probe(), we
> > have:
> > 
> > t_slot->hpc_ops->get_adapter_status(t_slot, &value); /* Check if slot is
> > occupied */
> > if (value && pciehp_force) {
> >     rc = pciehp_enable_slot(t_slot);
> >     if (rc)   /* -ENODEV: shouldn't happen, but deal with it */
> >         value = 0;
> > }
> > if ((POWER_CTRL(ctrl)) && !value) {
> >     rc = t_slot->hpc_ops->power_off_slot(t_slot); /* Power off slot if
> > not occupied*/
> >     if (rc)
> >         goto err_out_free_ctrl_slot;
> > }
> > 
> > But pciehp_enable_slot() will return EINVAL if the slot is already
> > powered up and ready to go.  Consequently pciehp_probe() will attempt to
> > power off the slot.  If I change the rc conditional after the
> > pciehp_enable_slot() call to explicitly specify ENODEV (and thus exclude
> > the case of the EINVAL return):
> > 
> > ... 
> >    if (rc == ENODEV) /* no adapter in slot or latch open on slot */
> >         value = 0;
> > }
> > 
> > it seems to work right, the PCIe card in the slot is up initially, I
> > modprobe pciehp in, it correctly handles the slot being powered already
> > and loads without error, and I'm able to hotplug the card out and back
> > in just fine.  
> > 
> > But I'm guessing it's like it is for a reason.  Can someone explain why
> > this is so?
> > 
> 
> As you pointed out, current pciehp_proble() has a bug that causes unexpected
> power off if the environment is under the following condition.
> 
>   - pciehp driver was loaded with pciehp_force option specified, and
>   - hotplug controller has power controller
> 
> I recently posted the patch to fix this bug. Please see.
> 
> http://marc.info/?l=linux-pci&m=122871424909137&w=2
> 
> I didn't think this fix is not so urgent because I thought the above-mentioned
> condition was relatively rare. So it is not scheduled to 2.6.28. Is it urgent
> for you?

Sorry, I missed your patch in my search.  If it's scheduled for 2.6.28,
that's fine for my purposes. 

Thanks,
Praveen

> 
> Thanks,
> Kenji Kaneshige
> 
> --
> 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
--
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