Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp2823490ybg; Thu, 24 Oct 2019 16:04:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqzjuO/7NsR+NeWkN7bj2VDHbzJ/VXoDuthBNxov6/t2etgvoi4m5yeKtCCz46NQQXT63YdQ X-Received: by 2002:a05:6402:1b1a:: with SMTP id by26mr712050edb.178.1571958258039; Thu, 24 Oct 2019 16:04:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571958258; cv=none; d=google.com; s=arc-20160816; b=HPaGEIN0NOn0OOTmTDic8/Tea/lbDIZeXWq/ODI3d0Wq7rKzDeZrKF6f/KMQiDZytd 5Q/DSG0pFbY9wnOisqxAlYExXYK+gjrFV5i9Sd5x68jCgAR2CazqQ42xjYzISmX0pbgX jtrTDwi4e2YHgubCKxh/DrdzJFwdDa/OdyyYT0ha2f7sQX0nfHqB3EeYLenJaOdeQr2N QiZCWC1nJ9yasT9HTGRUkeG/R7I3uyV4HyzpNnhBxMerpdJ4TPA2oOFaSX9zisFmOzwU GfDLl7DilCFnJd++75j1fjxML9p3Ee+ZBdABjuoLwb08TVWcfKiJw0giddxOrmo4rOYH +zew== 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=z+ChEAAxJT2nQ35gNnlfgfhZ9yjah8eYLE3ly0j4vNo=; b=0ZRhRFcidMBU10enRXDr/z1Le6DKN7HPUkwcoaED0dAxkQWUs0Ul68mkVVo8IMyVWU 1T1PDXpnRIpbwbNFidAgpwYvpSE5B9HOEo+EaKs61qyBkKZaBUTFPq7jtjaMpmr0b9Lg cB5yrk+RHMhknnApUxBJ3PdiJ0IcsvGImA7abkUUMhc1dHRPmWlUVG/+cHy0vFoqzeW7 Gv7JiZ6IwlT/lva4pZytsNHTN/XjIYtWY6zN7Yte3+H8MC+O7vNYDJ0QvD5ehZ61JUbe 4JZuImPYiu5k/52+wdgpxfwlMfq9IDzw7ake4tZZhpGBC0kvf/fOpIg4fMx6S6ucvI/R +w7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jX99tMhI; 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 jp2si122997ejb.178.2019.10.24.16.03.43; Thu, 24 Oct 2019 16:04:18 -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=jX99tMhI; 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 S2438023AbfJXII5 (ORCPT + 99 others); Thu, 24 Oct 2019 04:08:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:58776 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725977AbfJXII5 (ORCPT ); Thu, 24 Oct 2019 04:08:57 -0400 Received: from localhost.localdomain (nat-pool-mxp-t.redhat.com [149.6.153.186]) (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 8E33020684; Thu, 24 Oct 2019 08:08:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571904536; bh=jZQqNwSUxva3l51zcJ1O93jn/tL3QHziuhKu/M7kJVs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jX99tMhIeNmzXlOC5vHdQhDMxI7P+97pll/JeJJrLI6hYbvzLxNpwtLgDUufzC/kf KqYmUdKBxk6z0JLX8A46adBny6JpbQ7nc/t10eMunn03uvS4tw1k+WepcjZ26Qey7R +F8GG049o5JdJSh1YarPDtISzoNVVwIqYfw9yxfs= Date: Thu, 24 Oct 2019 10:08:50 +0200 From: Lorenzo Bianconi To: Kalle Valo Cc: linux-wireless@vger.kernel.org, nbd@nbd.name, sgruszka@redhat.com, lorenzo.bianconi@redhat.com, oleksandr@natalenko.name, netdev@vger.kernel.org Subject: Re: [PATCH wireless-drivers 1/2] mt76: mt76x2e: disable pcie_aspm by default Message-ID: <20191024080850.GA9346@localhost.localdomain> References: <87eez2u44r.fsf@kamboji.qca.qualcomm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="EVF5PPMfhYS0aIcm" Content-Disposition: inline In-Reply-To: <87eez2u44r.fsf@kamboji.qca.qualcomm.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 --EVF5PPMfhYS0aIcm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > Lorenzo Bianconi writes: >=20 > > 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 > > > > Signed-off-by: Felix Fietkau > > Signed-off-by: Lorenzo Bianconi >=20 > [...] >=20 > > +void mt76_mmio_disable_aspm(struct pci_dev *pdev) > > +{ > > + struct pci_dev *parent =3D pdev->bus->self; > > + u16 aspm_conf, parent_aspm_conf =3D 0; > > + > > + pcie_capability_read_word(pdev, PCI_EXP_LNKCTL, &aspm_conf); > > + aspm_conf &=3D PCI_EXP_LNKCTL_ASPMC; > > + if (parent) { > > + pcie_capability_read_word(parent, PCI_EXP_LNKCTL, > > + &parent_aspm_conf); > > + parent_aspm_conf &=3D PCI_EXP_LNKCTL_ASPMC; > > + } > > + > > + if (!aspm_conf && (!parent || !parent_aspm_conf)) { > > + /* aspm already disabled */ > > + return; > > + } > > + > > + dev_info(&pdev->dev, "disabling ASPM %s %s\n", > > + (aspm_conf & PCI_EXP_LNKCTL_ASPM_L0S) ? "L0s" : "", > > + (aspm_conf & PCI_EXP_LNKCTL_ASPM_L1) ? "L1" : ""); > > + > > +#ifdef CONFIG_PCIEASPM > > + pci_disable_link_state(pdev, aspm_conf); > > + > > + /* Double-check ASPM control. If not disabled by the above, the > > + * BIOS is preventing that from happening (or CONFIG_PCIEASPM is > > + * not enabled); override by writing PCI config space directly. > > + */ > > + pcie_capability_read_word(pdev, PCI_EXP_LNKCTL, &aspm_conf); > > + if (!(aspm_conf & PCI_EXP_LNKCTL_ASPMC)) > > + return; > > +#endif /* CONFIG_PCIEASPM */ >=20 > A minor comment, but 'if IS_ENABLED(CONFIG_PCIEASPM)' is preferred over > #ifdef. Better compiler coverage and so on. Hi Kalle, ack, I will fix it in v2. Regards, Lorenzo >=20 > --=20 > https://wireless.wiki.kernel.org/en/developers/documentation/submittingpa= tches --EVF5PPMfhYS0aIcm Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCXbFcEAAKCRA6cBh0uS2t rGOtAQCGhErEs2zXuOOCpsKHdrNhCmZVXNfmNFRLzx3pvw7gAAD/Q+FCJo/TtLTT 5bx4h3MOKy8tD22nno2praFY8IJ8LwE= =QH3z -----END PGP SIGNATURE----- --EVF5PPMfhYS0aIcm--