From patchwork Tue Feb 11 23:18:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 3633361 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7A1D7BF13A for ; Tue, 11 Feb 2014 23:18:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4ED6220203 for ; Tue, 11 Feb 2014 23:18:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 29C77201F2 for ; Tue, 11 Feb 2014 23:18:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751566AbaBKXSk (ORCPT ); Tue, 11 Feb 2014 18:18:40 -0500 Received: from mail-ie0-f173.google.com ([209.85.223.173]:54558 "EHLO mail-ie0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751071AbaBKXSj (ORCPT ); Tue, 11 Feb 2014 18:18:39 -0500 Received: by mail-ie0-f173.google.com with SMTP id y20so2364938ier.18 for ; Tue, 11 Feb 2014 15:18:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=oQG5z9dGmMPyG86aO5GVXJ2OJgrym1QdHVXIsMj4z/M=; b=UjjH5IdU/Os/IOX2Vp/3BGMXjQliZjful1rwZOUyjy+e76L7uYgrWRZSRaA+MKRmKN w3IeB9iabPAGmZecX1sUaE4oFYWLPxomL7h3XFbAD+BaIjPx9xlJARWn96KoN9ycdENW xgLqk1gFjS836HhQ60BiKM2rklT0cKnTybj46OEuHepWJmNShXn504MFF0ntIO5wfVy3 CugRoxyb/Cd+L+bvvQ+6oPIHBVSfiNvPPPV61tef441a4Dh3wlTc/fLzU4X53s1+Dgfh oKK0c1iHrpDL85PC3pd3tKKTqrTbdEIBp9lY4B0fAy8mslvWSZ5l+2fCBwlN1pjoZEyo ekxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=oQG5z9dGmMPyG86aO5GVXJ2OJgrym1QdHVXIsMj4z/M=; b=kS+84Y+GdpedDkheyUTrD+RcLSMAL0qslNm5v57SAnAuBrF83r2GNbP5xqCZi2P59b UGZuG27nHOm80vtuemGhWcA6MANI/QBU5tWVAi8r4SdDEOxBf/wXivw+z3oYS6MAhMIT 95R/gS6AFxMy8WRZ+BaMELREI4Mn5H3tKH4NOkniN7BPG4mc0lKXAlN9zSOY8NiC4qSJ 8Q0lnCqsZFU3P7+N9N1AWnBq+Q1r29WC8+NNUPNk+R9aHhcpS7lr5nDt+mH+K9tJDJOW /x0NkV82b9XaXfHO6CYXcqFDOZzS3lvuhgnaKETpBmZx019SOb/IvYSqR26ZJpzaUSqK rtvg== X-Gm-Message-State: ALoCoQkXRs7cV8Tw1xRe8dChKobeZkiucuCfv8dfWb4+jC2APF61gS0D9iQ8stUvJZU1ziixxHV5EDioCpaVXsFDBp7oNFm52BOKLUNQtg6zxV2z7DeGPoiYxeVstbdE2QcZu7u/6iXL5GUJtReFuDG00o9YhrsdHsUTaffeXm8nyJVyqR1E5/GxiwswmJS71/SGcCU35ho6ZhOKlNQYmiIJc6WJJWZF9w== X-Received: by 10.50.29.9 with SMTP id f9mr1047001igh.2.1392160718354; Tue, 11 Feb 2014 15:18:38 -0800 (PST) Received: from google.com ([172.16.49.108]) by mx.google.com with ESMTPSA id y7sm2090873igl.8.2014.02.11.15.18.37 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 11 Feb 2014 15:18:37 -0800 (PST) Date: Tue, 11 Feb 2014 16:18:35 -0700 From: Bjorn Helgaas To: Rajat Jain Cc: Takashi Iwai , Alex Williamson , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] PCI: pciehp: Remove surprise bit checks Message-ID: <20140211231835.GA21057@google.com> References: <1117e550ec6248e3a1834f887cbfdfad@DM2PR05MB671.namprd05.prod.outlook.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1117e550ec6248e3a1834f887cbfdfad@DM2PR05MB671.namprd05.prod.outlook.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FSL_HELO_FAKE, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Tue, Feb 11, 2014 at 06:52:30PM +0000, Rajat Jain wrote: > Hello Takashi, > > > -----Original Message----- > > From: linux-pci-owner@vger.kernel.org [mailto:linux-pci- > > owner@vger.kernel.org] On Behalf Of Takashi Iwai > > Sent: Tuesday, February 11, 2014 3:39 AM > > To: Bjorn Helgaas > > Cc: Alex Williamson; linux-pci@vger.kernel.org; linux- > > kernel@vger.kernel.org > > Subject: [PATCH] PCI: pciehp: Remove surprise bit checks > > > > Currently pciehp driver checks the surprise removal bit and handles > > the hotplug event only when the bit is set. But there are devices > > that don't set that bit but yet expect the hotplug working, e.g. the > > PCI card reader on HP ProBook 445 and 455 laptops appears only when > > you insert a card, and it needs the hotplug event handling. > > > > For fixing this, basically we may ignore the surprise bit and always > > handle the event. > > Some of this has been taken care of in the recent changes to pciehcp (last night). > > Please see > > https://git.kernel.org/cgit/linux/kernel/git/helgaas/pci.git/commit/?h=pci/pciehp&id=a3eba3887960d00abb912fe3703cd3a058c721b8 > > Also, link state hotplug has been added as part of this patch set. Can you please try with Bjorn's latest pci tree? > > With that, I think you should not see the issue you are describing, because if the PCIe Link comes up when you insert the card, it shall be added (now) irrespective of whether or not you have the surprise bit set. Takashi's patch removed more HP_SUPR_RM() usage than yours, and I think those additional changes are probably necessary. I rebased Takashi's patch on top of my pci/pciehp branch, resulting in the patch below. I pushed this, so you can try the whole thing out at: http://git.kernel.org/cgit/linux/kernel/git/helgaas/pci.git/commit/?h=pci/pciehp&id=237e0218bcad52d3df6746cd8d15a0d353bae84f Bjorn PCI: pciehp: Remove surprise bit checks From: Takashi Iwai Currently pciehp driver checks the surprise removal bit and handles the hotplug event only when the bit is set. But there are devices that don't set that bit, yet expect hotplug to work, e.g., the SD/MMC card reader on HP ProBook 445 and 455 laptops appears only when you insert a card, and it needs the hotplug event handling. For fixing this, basically we may ignore the surprise bit and always handle the event. The only big concern in the past was the KVM device assignment, but this has been fixed in KVM side (ignoring hotplug events during secondary bus resets), there should be no obstacle ahead. The earlier discussion thread is found at: https://lkml.kernel.org/r/s5h38vqjhk6.wl%25tiwai@suse.de [bhelgaas: rebase on Rajat's changes, remove HP_SUPR_RM() completely] Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=70261 Signed-off-by: Takashi Iwai Signed-off-by: Bjorn Helgaas --- drivers/pci/hotplug/pciehp.h | 1 - drivers/pci/hotplug/pciehp_ctrl.c | 2 -- drivers/pci/hotplug/pciehp_hpc.c | 11 +++++------ 3 files changed, 5 insertions(+), 9 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h index 8a66866b8cf1..d2a67aa0e49d 100644 --- a/drivers/pci/hotplug/pciehp.h +++ b/drivers/pci/hotplug/pciehp.h @@ -124,7 +124,6 @@ struct controller { #define MRL_SENS(ctrl) ((ctrl)->slot_cap & PCI_EXP_SLTCAP_MRLSP) #define ATTN_LED(ctrl) ((ctrl)->slot_cap & PCI_EXP_SLTCAP_AIP) #define PWR_LED(ctrl) ((ctrl)->slot_cap & PCI_EXP_SLTCAP_PIP) -#define HP_SUPR_RM(ctrl) ((ctrl)->slot_cap & PCI_EXP_SLTCAP_HPS) #define EMI(ctrl) ((ctrl)->slot_cap & PCI_EXP_SLTCAP_EIP) #define NO_CMD_CMPL(ctrl) ((ctrl)->slot_cap & PCI_EXP_SLTCAP_NCCS) #define PSN(ctrl) ((ctrl)->slot_cap >> 19) diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c index fec99a164d93..a4d29d24057d 100644 --- a/drivers/pci/hotplug/pciehp_ctrl.c +++ b/drivers/pci/hotplug/pciehp_ctrl.c @@ -535,8 +535,6 @@ static void interrupt_event_handler(struct work_struct *work) break; case INT_PRESENCE_ON: case INT_PRESENCE_OFF: - if (!HP_SUPR_RM(ctrl)) - break; ctrl_dbg(ctrl, "Surprise Removal\n"); handle_surprise_event(p_slot); break; diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index da4b0204b4f7..1076a51623b5 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -628,17 +628,18 @@ int pciehp_reset_slot(struct slot *slot, int probe) { struct controller *ctrl = slot->ctrl; struct pci_dev *pdev = ctrl_dev(ctrl); - u16 stat_mask = 0, ctrl_mask = 0; + u16 stat_mask, ctrl_mask; if (probe) return 0; - if (HP_SUPR_RM(ctrl) && !ATTN_BUTTN(ctrl)) { + ctrl_mask = PCI_EXP_SLTCTL_DLLSCE; + stat_mask = PCI_EXP_SLTSTA_DLLSC; + + if (!ATTN_BUTTN(ctrl)) { /* as in pcie_enable_notification() */ ctrl_mask |= PCI_EXP_SLTCTL_PDCE; stat_mask |= PCI_EXP_SLTSTA_PDC; } - ctrl_mask |= PCI_EXP_SLTCTL_DLLSCE; - stat_mask |= PCI_EXP_SLTSTA_DLLSC; pcie_write_cmd(ctrl, 0, ctrl_mask); if (pciehp_poll_mode) @@ -741,8 +742,6 @@ static inline void dbg_ctrl(struct controller *ctrl) ATTN_LED(ctrl) ? "yes" : "no"); ctrl_info(ctrl, " Power Indicator : %3s\n", PWR_LED(ctrl) ? "yes" : "no"); - ctrl_info(ctrl, " Hot-Plug Surprise : %3s\n", - HP_SUPR_RM(ctrl) ? "yes" : "no"); ctrl_info(ctrl, " EMI Present : %3s\n", EMI(ctrl) ? "yes" : "no"); ctrl_info(ctrl, " Command Completed : %3s\n",