Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3120626pxb; Mon, 18 Oct 2021 08:35:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwALh7HEB0aFbNT0uF68p0fl8M/AAgxe9Oin5PxIVHetaUjjIuEok6S54VfgChYd6HxRmEb X-Received: by 2002:a17:90a:1649:: with SMTP id x9mr33960087pje.34.1634571356355; Mon, 18 Oct 2021 08:35:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634571356; cv=none; d=google.com; s=arc-20160816; b=K3xZqtF6mzCU+NKQW2YUM5D4+kf2seNribFM8m9lN1UnQkD/l5uB7vc8/kWmqshLh0 3bCDZU5qFpp0eDjBlEs2V7upDCY5KulRKXeEDTjPqrREXICwTBAmJRHpw/r98wGtILM7 ypcdfntB3kxZq/t/El0vnPQZpDZGwpfQ5zNcq61723tl7hDBmZqVgD9vO7mzceeeE3yC kB2FvbVpq8+JwxugUpNX4R+Zvno30+l9qXlWNuaT8bF+JX9chsThCRjR0zVXC5WTtDWn X4XheTvLdD+Aau0SCGAz5mp2kcYrnkE6dk10U5KuFQYpOTrycO7VG4pC9SBPYxCGsZEL Y+iA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:message-id:subject:cc:to:from:date :dkim-signature; bh=/y+/1UoZZiNRG1jEmEuPwHD0MPL9xR8RVUhJsBgBc14=; b=as77gXKLkYyx0YtHt8F+zvgfdgvGb0mX6/vmOtDOPoxSaVRbShX9luf3Ygmsd8pS1e ugyii7qTRmxL7UmIeUXRMq5KGghJVnO4QbVNFJ+0MlqD6icHw4pJfMzvYOSjm5IrVq7u gpgC10CuMm83cYSho8R2Fkt2WV+KN8ALNvIYhn9ocL3G2YIpPmxYU5UfGJlrMTYvumPZ i/WUgMtidmxQOayzTlxSJ7HO70mLgFlmvCkoIzJqkiVf8NzhmEzKWaNNeWRkc/33kfzg BqBD0WUB13LrXwITr6RTDyzoLGWuNrHCTZ8m0dnyvFnSyCfUSdt5zKkhc+EWb20xvD+u cXew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Pvv8j5rr; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k20si19660288pji.176.2021.10.18.08.35.43; Mon, 18 Oct 2021 08:35:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Pvv8j5rr; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232818AbhJRPhr (ORCPT + 64 others); Mon, 18 Oct 2021 11:37:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:46374 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231893AbhJRPhm (ORCPT ); Mon, 18 Oct 2021 11:37:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C720B6103D; Mon, 18 Oct 2021 15:35:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634571331; bh=q7lcmruj3DqRwUoAeERdWNwhIR2lW91g6h7Kdo5lQp8=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=Pvv8j5rrguCLZzOjZEgHhY0Txc2BPVnAj4d0dfiw6bV43dEU76xoOTxKNCA5XOFeZ yHlL0Mqgywrqr5T8fNQq12o5APx8Zl2HGncM/4pFYOrRxVLbZM+lP03XqA0rpoRVso l3BukXmaCXnliqfxezF07+nUVHExtbCmVbG7VpKL2wHlfQYE5Ogl6m/6IZNNhpGETb d1Rv6QvwRmX7MtJ6/6GyKNAIAMq+5Towrzub7S7LaNAumjCmZ90nw394bZ970/cTZP 6JZryrPojvE8chSkiXvJjHZiLyz3zMr+wb0lylbqUIIZm+1Zs8UA1JWIsntfqRRgzI zS91iUQ2HG0wA== Date: Mon, 18 Oct 2021 10:35:29 -0500 From: Bjorn Helgaas To: Jonas =?iso-8859-1?Q?Dre=DFler?= Cc: Pali =?iso-8859-1?Q?Roh=E1r?= , Amitkumar Karwar , Ganapathi Bhat , Xinming Hu , Kalle Valo , "David S. Miller" , Jakub Kicinski , Tsuchiya Yuto , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Maximilian Luz , Andy Shevchenko , Bjorn Helgaas , Heiner Kallweit , Johannes Berg , Brian Norris , David Laight , Vidya Sagar , Victor Ding Subject: Re: [PATCH] mwifiex: Add quirk resetting the PCI bridge on MS Surface devices Message-ID: <20211018153529.GA2235731@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Thu, Oct 14, 2021 at 12:08:31AM +0200, Jonas Dre?ler wrote: > On 10/12/21 17:39, Bjorn Helgaas wrote: > > [+cc Vidya, Victor, ASPM L1.2 config issue; beginning of thread: > > https://lore.kernel.org/all/20211011134238.16551-1-verdre@v0yd.nl/] > > I wonder if this reset quirk works because pci_reset_function() saves > > and restores much of config space, but it currently does *not* restore > > the L1 PM Substates capability, so those T_POWER_ON, > > Common_Mode_Restore_Time, and LTR_L1.2_THRESHOLD values probably get > > cleared out by the reset. We did briefly save/restore it [1], but we > > had to revert that because of a regression that AFAIK was never > > resolved [2]. I expect we will eventually save/restore this, so if > > the quirk depends on it *not* being restored, that would be a problem. > > > > You should be able to test whether this is the critical thing by > > clearing those registers with setpci instead of doing the reset. Per > > spec, they can only be modified when L1.2 is disabled, so you would > > have to disable it via sysfs (for the endpoint, I think) > > /sys/.../l1_2_aspm and /sys/.../l1_2_pcipm, do the setpci on the root > > port, then re-enable L1.2. > > > > [1] https://git.kernel.org/linus/4257f7e008ea > > [2] https://lore.kernel.org/all/20210127160449.2990506-1-helgaas@kernel.org/ > > Hmm, interesting, thanks for those links. > > Are you sure the config values will get lost on the reset? If we only reset > the port by going into D3hot and back into D0, the device will remain powered > and won't lose the config space, will it? I think you're doing a PM reset (transition to D3hot and back to D0). Linux only does this when PCI_PM_CTRL_NO_SOFT_RESET == 0. The spec doesn't actually *require* the device to be reset; it only says the internal state of the device is undefined after these transitions.