Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4017103ybg; Fri, 25 Oct 2019 12:08:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqytGXXZu7+BD2rxg4D2GLqNcoK56b5Hr3XuU5zSHOIHIAM5eSaq1qWM5OP1Pb45OSOhQvTB X-Received: by 2002:a17:906:73d5:: with SMTP id n21mr4977784ejl.228.1572030533701; Fri, 25 Oct 2019 12:08:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572030533; cv=none; d=google.com; s=arc-20160816; b=XjgG3etVXtHrZUCIRzu6jv9W+iTbpnQQ9WZVWOLgp/kvT0Cv0/JOwz3OLea1qEq35O feBZS1MTswOKgUD9Ho1DJgfPrFineLWouTE3LUCxEBhwl3AWIAgPHV8B8pKfihph0trr CwHtmNGXYh3dCCui5MA9aWp7slPlymtR4/P/zezJs9aVDreej4l7Xg+V+hO3Zhrjne9n t4nUA/Dv8ZABB5F84TmED7X0BI3IFoJlXgAcnmcSJCWJwW7TceOjPbh6u/qqrCtYLHXo ZjJi83afYe+nz8jsfgrdhABND/CzAhwIQ+74m3LyPw8a0ptXu6AEQDOYO2o9pgBmxBF4 wfcQ== 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:dkim-signature; bh=aPaMgCIGmlpTt66hTR32mK4GXYdYWDgE7qtwfaUdVyw=; b=wW+Wt4K2RV210E8R6Wq97yrgo76yumUbUcWJ99dHvkPKxUEsFgHf+dVOIGLmllEN5q d4OxamLeKuPdN+5jhaI+7i3r0Yt/w0Cx4QCfnxPXwP8tIHqyDTZMXmXXJq/GeNRa/uiZ tZ4uVFVeviKDyhdMNZrIMBqdaXP4a7Vnh4kMkxlsldLEPOBrjSWcRW5DEZeDBZ5jJ41b gjeK3MGpDjodK16v0a8faUqkQXyiBN5pDwHt1avH8CJvvIEtgIbn5eEva/63G4T8X7BH L0NiuPDZ2KAXNGU29T3ffG3tFk0a98z3fXrFZbwtvK8+PIaG4LonOVs9oXyuu9IYEhfG TWcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Z/Lr3MJG"; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id 35si2285462edl.409.2019.10.25.12.08.30; Fri, 25 Oct 2019 12:08:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Z/Lr3MJG"; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 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 S1729727AbfJXVzE (ORCPT + 99 others); Thu, 24 Oct 2019 17:55:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:56916 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726279AbfJXVzE (ORCPT ); Thu, 24 Oct 2019 17:55:04 -0400 Received: from lore-desk.lan (unknown [151.66.11.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5EAC020663; Thu, 24 Oct 2019 21:55:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571954102; bh=Ct0arrhFcRuyT69o0kp0Cxj1ORQIfTWXcIwmtNzYuKU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Z/Lr3MJGtB3UIwlHFIrZvAMG0p/ehmMO8AILTBMCChW556GYNY1uK46QmHU3cX7Gj CVjbCb+DzikaCNeFrZA5DdSN4oS4OSaTkspa1kDIwYsbgFRgbpG+Xje9eMaCTyQFGC rAqOozr9b1dWIcdfyV6cy2u9Cy6TDMQvifK0pxvA= Date: Thu, 24 Oct 2019 23:54:51 +0200 From: Lorenzo Bianconi To: Heiner Kallweit Cc: kvalo@codeaurora.org, linux-wireless@vger.kernel.org, nbd@nbd.name, sgruszka@redhat.com, lorenzo.bianconi@redhat.com, oleksandr@natalenko.name, netdev@vger.kernel.org, "linux-pci@vger.kernel.org" Subject: Re: [PATCH wireless-drivers 1/2] mt76: mt76x2e: disable pcie_aspm by default Message-ID: <20191024215451.GA30822@lore-desk.lan> References: <5924c8eb-7269-b8ef-ad0e-957104645638@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="k1lZvvs/B4yU6o8G" Content-Disposition: inline In-Reply-To: <5924c8eb-7269-b8ef-ad0e-957104645638@gmail.com> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org --k1lZvvs/B4yU6o8G Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > On 24.10.2019 00:23, Lorenzo Bianconi wrote: > > On same device (e.g. U7612E-H1) PCIE_ASPM causes continuous mcu hangs a= nd > > instability and so let's disable PCIE_ASPM by default. This patch has > > been successfully tested on U7612E-H1 mini-pice card > >=20 > > Signed-off-by: Felix Fietkau > > Signed-off-by: Lorenzo Bianconi > > --- > > drivers/net/wireless/mediatek/mt76/mmio.c | 47 +++++++++++++++++++ > > drivers/net/wireless/mediatek/mt76/mt76.h | 1 + > > .../net/wireless/mediatek/mt76/mt76x2/pci.c | 2 + > > 3 files changed, 50 insertions(+) > >=20 [...] > > + > > + if (parent) > > + pcie_capability_clear_word(parent, PCI_EXP_LNKCTL, > > + aspm_conf); >=20 > + linux-pci mailing list Hi Heiner, >=20 > All this seems to be legacy code copied from e1000e. > Fiddling with the low-level PCI(e) registers should be left to the > PCI core. It shouldn't be needed here, a simple call to > pci_disable_link_state() should be sufficient. Note that this function > has a return value meanwhile that you can check instead of reading > back low-level registers. ack, I will add it to v2 > If BIOS forbids that OS changes ASPM settings, then this should be > respected (like PCI core does). Instead the network chip may provide > the option to configure whether it activates certain ASPM (sub-)states > or not. We went through a similar exercise with the r8169 driver, > you can check how it's done there. looking at the vendor sdk (at least in the version I currently have) there = are no particular ASPM configurations, it just optionally disables it writing d= irectly in pci registers. Moreover there are multiple drivers that are currently using this approach: - ath9k in ath_pci_aspm_init() - tg3 in tg3_chip_reset() - e1000e in __e1000e_disable_aspm() - r8169 in rtl_enable_clock_request()/rtl_disable_clock_request() Is disabling the ASPM for the system the only option to make this minipcie work? Regards, Lorenzo >=20 > > +} > > +EXPORT_SYMBOL_GPL(mt76_mmio_disable_aspm); > > + > > void mt76_mmio_init(struct mt76_dev *dev, void __iomem *regs) > > { > > static const struct mt76_bus_ops mt76_mmio_ops =3D { > > diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wi= reless/mediatek/mt76/mt76.h > > index 570c159515a0..962812b6247d 100644 > > --- a/drivers/net/wireless/mediatek/mt76/mt76.h > > +++ b/drivers/net/wireless/mediatek/mt76/mt76.h > > @@ -578,6 +578,7 @@ bool __mt76_poll_msec(struct mt76_dev *dev, u32 off= set, u32 mask, u32 val, > > #define mt76_poll_msec(dev, ...) __mt76_poll_msec(&((dev)->mt76), __VA= _ARGS__) > > =20 > > void mt76_mmio_init(struct mt76_dev *dev, void __iomem *regs); > > +void mt76_mmio_disable_aspm(struct pci_dev *pdev); > > =20 > > static inline u16 mt76_chip(struct mt76_dev *dev) > > { > > diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci.c b/drivers/= net/wireless/mediatek/mt76/mt76x2/pci.c > > index 73c3104f8858..264bef87e5c7 100644 > > --- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci.c > > +++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci.c > > @@ -81,6 +81,8 @@ mt76pci_probe(struct pci_dev *pdev, const struct pci_= device_id *id) > > /* RG_SSUSB_CDR_BR_PE1D =3D 0x3 */ > > mt76_rmw_field(dev, 0x15c58, 0x3 << 6, 0x3); > > =20 > > + mt76_mmio_disable_aspm(pdev); > > + > > return 0; > > =20 > > error: > >=20 >=20 --k1lZvvs/B4yU6o8G Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCXbIdqQAKCRA6cBh0uS2t rCwJAP9TQYbzoTDW107MrwmbRPSxNPttIP2u/vIHoAO7CnI/bgD/VEbeg3ymqpVw iEM7cfdP6FEholmTwZV+BSUBcm4e5AY= =7Nvy -----END PGP SIGNATURE----- --k1lZvvs/B4yU6o8G--