From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 729F6C54EE9 for ; Tue, 27 Sep 2022 08:33:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=J2k6mFy04hLwABh4VhyiW7JilBIuENH6P6j88KmXJso=; b=kyCeIbF9HwkAmd 9h+7PqXzN1ZmiSEQOlkR2Xb9eHItegCtByiTi/pikD2IE0L88QNII/FqV/VdUHw5132mBy6Y3vFHO BLVRQEobnFPRgdE5Yb2z/2BY07EgGNvbjkiQP9dNzyLo8P+RWgCbpBv46OtU8VR4h/nF+XyZsXTZo lbJs7ybi8daa7FpuJGbvfA6ty/GSmW6GS24A4Y9wTwKrOCHqjEM+aWDFgGEUKNnXpinRd55sH3Xir UeClQHTk/NeRntcsRza0X1T+MTsq5KJLbY5/l7MrG46d4XtzgEfzhSK6KC6KBkzuV7eEGkrIBtBFA Y5o3x4CNqlZ25Andph1g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1od5zl-009AaF-19; Tue, 27 Sep 2022 08:31:14 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1od5yB-0099qb-A8 for linux-arm-kernel@lists.infradead.org; Tue, 27 Sep 2022 08:29:38 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E52C3B81A3D; Tue, 27 Sep 2022 08:29:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E77FC433D6; Tue, 27 Sep 2022 08:29:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664267372; bh=2CeOPmycerE5TVJWmbnN8knOvsJihI1Ky45q1XLPPkY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CQsNajcHM9SsFAr2spVtKGoTZbjYESD05DOrM7/lhh62jBz4mJ8FwQWeUaT1D+qyU MeeOLz+ff1Dd8AfjHM8x8dLFhVYTXzDUj5pjiNF84V9QQTK8RCkQXdeKC1MBaYmtC0 jLH9UoaHVrsoMbN9/Od0IUdQqsKjq6lWKCkpAzWXji0x8iw3qL5WeLR7rJwXEqVB5C EVEYra/OVsYQmkyz6GOcoUXl/R0FWXSAb8kekajQ8q+l5QK3BoCrxxDWyduAGu6uaS OSIqlWbCfpqF6/WlFPkiN3AfVyOGAu0EyjpgvKHj9fwzEVrc4xmisvP4UsYHcCtbn2 5AQQYytV27/Mw== Date: Tue, 27 Sep 2022 10:29:26 +0200 From: Lorenzo Pieralisi To: Marek =?iso-8859-1?Q?Beh=FAn?= Cc: Lorenzo Pieralisi , Bjorn Helgaas , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , pali@kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, maz@kernel.org, tglx@linutronix.de Subject: Re: [PATCH 03/11] PCI: aardvark: Add support for DLLSC and hotplug interrupt Message-ID: References: <20220818135140.5996-1-kabel@kernel.org> <20220818135140.5996-4-kabel@kernel.org> <20220916182302.4eba1b48@dellmb> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220916182302.4eba1b48@dellmb> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220927_012935_768869_EA5E8211 X-CRM114-Status: GOOD ( 42.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Sep 16, 2022 at 06:23:02PM +0200, Marek Beh=FAn wrote: > On Fri, 9 Sep 2022 16:57:11 +0200 > Lorenzo Pieralisi wrote: > = > > [+Marc, Thomas - I can't merge this code without them reviewing it, > > I am not sure at all you can mix the timer/IRQ code the way you do] > > = > > On Thu, Aug 18, 2022 at 03:51:32PM +0200, Marek Beh=FAn wrote: > > > From: Pali Roh=E1r > > > = > > > Add support for Data Link Layer State Change in the emulated slot > > > registers and hotplug interrupt via the emulated root bridge. > > > = > > > This is mainly useful for when an error causes link down event. With > > > this change, drivers can try recovery. > > > = > > > Link down state change can be implemented because Aardvark supports L= ink > > > Down event interrupt. Use it for signaling that Data Link Layer Link = is > > > not active anymore via Hot-Plug Interrupt on emulated root bridge. > > > = > > > Link up interrupt is not available on Aardvark, but we check for whet= her > > > link is up in the advk_pcie_link_up() function. By triggering Hot-Plug > > > Interrupt from this function we achieve Link up event, so long as the > > > function is called (which it is after probe and when rescanning). > > > Although it is not ideal, it is better than nothing. = > > = > > So before even coming to the code review: this patch does two things. > > = > > 1) It adds support for handling the Link down state > > 2) It adds some code to emulate a Link-up event > > = > > Now, for (2). IIUC you are adding code to make sure that an HP > > event is triggered if advk_pcie_link_up() is called and it > > detects a Link-down->Link-up transition, that has to be notified > > through an HP event. > > = > > If that's correct, you have to explain to me please what this is > > actually achieving and a specific scenario where we want this to be > > implemented, in fine details; then we add it to the commit log. > = > Hello Lorenzo, sorry for not replying earlier. > = > Would something like this be sufficient? > = > DLLSC is needed by the pciehp driver, which handles hotplug, but also > link state change events. AFAIK no Aardvark devices support hotplug, > but link state change events are required for graceful driver > unbinding in case of link down event. > = > So with this change we achieve graceful driver unbind for example > when WiFi card PCIe link goes down (we've seen this with ath10k and > mt76 WiFi cards). Before the WiFi driver started spitting out errors, > or even taking the whole system down. > = > Since after link goes down, it can come back up if the WiFi card can > recover (or if reset pin is used to reset the card), we need to be > able to recognize link up event. Since AFAIK Aardvark does not have > interrupt for link up event, the best thing we can do is simulate it > - whenever we read the link state, find it is up, and have cached > value saying it is down, we trigger the link up event. We read link > state whenever the configuration space is read, for example by > writing 1 to /sys/bus/pci/rescan. Better, certainly. Question, also related to Marc's query. Do you rely on the hotplug (emulated IRQ) to be run _before_ carrying on with PCI config space accesses following a link-up detection ? How was the jiffies + 1 expiration time determined ? I assume you want to run the emulated HP IRQ asap - the question though is how fast should it be ? Lorenzo > = > Marek > = > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel