Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3566554imj; Tue, 12 Feb 2019 00:31:00 -0800 (PST) X-Google-Smtp-Source: AHgI3IbdP/HLIpogcC6/nEfpQcFb74H8AA8FrfyTPyNu2czneE9lqAGHx0MvdKXQIYn6p/Up+eGI X-Received: by 2002:a17:902:a50e:: with SMTP id s14mr2832699plq.311.1549960260078; Tue, 12 Feb 2019 00:31:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549960260; cv=none; d=google.com; s=arc-20160816; b=KmharB4NQpTO3RIYyKl5N9FgjU6y7Z91/vvSboMFUZO4zZnAzrWfCAgcxWb4bWKUfJ QTwfpCPi87u1WuaBMIT9v/CIdAilS5tELzuszzgUbs3iW+XPxAKfunJpWPBXASXADnTY 2C2XxYNGd0P4381/z5hoXztswMNAsICS9IMZVV3TUmEwluBpd2U8vl24wyXiRyKWmhgc eo2+jKx8Unu5RYtZskIQH5H79Pil1zxUE5SVGCaG9hYzYdg5F5yMU1JYgimkbtVuORlJ FbLIexrSCpegIRVKFyVDBXRtxQHvQqpIJcZB6hheBPPpU8WN9yz6fcDC9+7bZ17oXVNY 9NxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=O04RC/SEK0Eez/4yWDBooeHvJHyigalucM/VdJN30yg=; b=SDr9DQSGczWEJzy741BjgLk+/o7RH+w1kbsm3gAx/8E/oqnRuZT6W0Otz/0Uu2zH+x PuluMUnIKD+IbzbpcUgkrKX1DjRb6KjHpDuJqdfgbMgf17Gm2zAlULpwxDatISlOzD3V FUpZN0i9Gp8BNrxqT2AeWMnFRFxJjP6gii/ADHfRh4BzaMz+JiKTaeiKwhJeks51UgBX e6kWCPEJP/gOQnB18j+9msIW5giEy93urynz6W5naTX4562s37ADu6RcbyelO/YQihLF b2AJSiCfVWY9Rxy92UeTwGQPS1P8CqyUdOfoVmIIcy7VNxuUAJLSM8MN6qfyn/vMjSYI LCwQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q20si11529557pll.255.2019.02.12.00.30.43; Tue, 12 Feb 2019 00:31:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728502AbfBLIae (ORCPT + 99 others); Tue, 12 Feb 2019 03:30:34 -0500 Received: from bmailout1.hostsharing.net ([83.223.95.100]:47383 "EHLO bmailout1.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728218AbfBLIae (ORCPT ); Tue, 12 Feb 2019 03:30:34 -0500 Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.hostsharing.net", Issuer "COMODO RSA Domain Validation Secure Server CA" (not verified)) by bmailout1.hostsharing.net (Postfix) with ESMTPS id AB90C30000CD5; Tue, 12 Feb 2019 09:30:31 +0100 (CET) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 621403187A; Tue, 12 Feb 2019 09:30:31 +0100 (CET) Date: Tue, 12 Feb 2019 09:30:31 +0100 From: Lukas Wunner To: Alex_Gagniuc@Dellteam.com Cc: mr.nuke.me@gmail.com, bhelgaas@google.com, Austin.Bolen@dell.com, keith.busch@intel.com, Shyam.Iyer@dell.com, gustavo@embeddedor.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] PCI: pciehp: Do not turn off slot if presence comes up after link Message-ID: <20190212083031.2no7mzn5xug7nba3@wunner.de> References: <20190205210701.25387-1-mr.nuke.me@gmail.com> <20190209115849.244u67h7wmn3eb7o@wunner.de> <52afa1c45f684dbda6a8771b65583a22@ausx13mps321.AMER.DELL.COM> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <52afa1c45f684dbda6a8771b65583a22@ausx13mps321.AMER.DELL.COM> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 11, 2019 at 11:48:12PM +0000, Alex_Gagniuc@Dellteam.com wrote: > On 2/9/19 5:58 AM, Lukas Wunner wrote: > ECN [1] was approved last November, so it's normative spec text. Sorry > if the Ukranians didn't get ahold of it yet. I'll try to explain the delta. > There's an in-band PD supported/disable set of bits. If 'supported' is > set, then you can set 'disable', which removes the 'logical OR" and now > PD is only out-of-band presence. I see, thanks a lot for relaying this information. The PCI SIG should probably consider granting access to specs to open source developers to ease adoption of new features in Linux et al. > > Table 4-14 in sec 4.2.6 is also important because it shows the difference > > between Link Up and in-band presence. > > So, we'd expect PD to come up at the same time or before DLL? Per table 4-14 and figure 4-23 (immediately below the table) in r4.0, PDC ought to be signaled before DLLSC. As said, Linux can handle PDC after DLLSC if they're not too far apart (100 ms, see pcie_wait_for_link()). > I'd like a generic solution. I suspect supporting 'in-band PD disabled' > and quirking for that would be a saner way to do things. If we support > it, then we need to handle PDSC after DLLSC scenarios anyway. I agree, having support for this new ECN would be great. If you look at struct controller in drivers/pci/hotplug/pciehp.h, there's a section labelled /* capabilities and quirks */. An idea would be to add an unsigned int there to indicate whether in-band presence is disabled. An alternative would be to add a flag to struct pci_dev. Instead of modifying the logic in pciehp_handle_presence_or_link_change(), you could amend pcie_wait_for_link() to poll PDS until it's set, in addition to DLLLA. The rationale would be that although the link is up, the hot-added device cannot really be considered accessible until PDS is also set. Unfortunately we cannot do this for all devices because (as I've said before), some broken devices hardwire PDS to zero. But it should be safe to constrain it to those which can disable in-band presence. Be mindful however that pcie_wait_for_link() is also called from the DPC driver. Keith should be able to judge whether a change to that function breaks DPC. You'll probably also need to add code to disable in-band presence if that is supported, either in pcie_init() in pciehp_hpc.c or in generic PCI code. Thanks, Lukas