Re: [PATCH] pci: Use hot-plug capable for testing presence on

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

 



On Fri, Jan 16, 2015 at 02:33:30PM -0600, Bjorn Helgaas wrote:
> [+cc Rajat]
> 
> On Mon, Dec 22, 2014 at 12:07:03PM -0700, Keith Busch wrote:
> > The PCI-e Base specifically says Hot-Plug Surprise capability is for
> > removal only, but pciehp checked this to determine if it should handle a
> > slot event on device add. Lots of platform's pcie slots don't advertise
> > support for surprise removal, but are perfectly capable of handling
> > hot-add, so checking surprise removal is not appropriate.
> > 
> > This patch checks the Hot-Plug Capable bit in the slot capabilities to
> > determine if the detected presence on is a reliable event instead of
> > Hot-Plug Surprise.
> > 
> > Signed-off-by: Keith Busch <keith.busch@xxxxxxxxx>
> 
> This seems reasonable to me, and I applied it to pci/hotplug for v3.20.

After our follow-up discussion, I replaced this patch with the following.
If anybody objects, let me know.

commit dc0c25c0ee9f92ba1872fdda9c2a0014611cf722
Author: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
Date:   Wed Jan 21 10:28:07 2015 -0600

    PCI: pciehp: Handle surprise add even if surprise removal isn't supported
    
    The PCIe spec (r3.0, sec 7.8.9) says Hot-Plug Surprise indicates support
    for surprise *removal*, but pciehp checked this to determine if it should
    handle presence detect interrupts for device *addition*.
    
    Allow surprise device addition even if the slot doesn't advertise support
    for surprise removal.
    
    Keith has a platform with slots for front-loading SFF devices.  The slots
    do not have attention buttons and do not support surprise removal, but they
    do have presence detect.  In that case, we still want to use presence
    detect for device addition.
    
    Keith's original patch handled surprise insertions only if Hot-Plug Capable
    is set.  I think that test is superfluous because pciehp only claims slots
    that advertise Hot-Plug Capable (see get_port_device_capability()).
    
    Link: http://lkml.kernel.org/r/1419275223-14602-1-git-send-email-keith.busch@xxxxxxxxx
    Based-on-patch-by: Keith Busch <keith.busch@xxxxxxxxx>
    Signed-off-by: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>

diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
index ff32e85e1de6..f052e951b23e 100644
--- a/drivers/pci/hotplug/pciehp_ctrl.c
+++ b/drivers/pci/hotplug/pciehp_ctrl.c
@@ -532,8 +532,6 @@ static void interrupt_event_handler(struct work_struct *work)
 		pciehp_green_led_off(p_slot);
 		break;
 	case INT_PRESENCE_ON:
-		if (!HP_SUPR_RM(ctrl))
-			break;
 		ctrl_dbg(ctrl, "Surprise Insertion\n");
 		handle_surprise_event(p_slot);
 		break;
--
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