Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp2677667ybg; Thu, 24 Oct 2019 13:24:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqw75cQz/w+nyMqksLFD0Tj913LqqveYDhdCzF/86+Ks1y918qs/wXH8CGKA9MJubRp+NTiD X-Received: by 2002:aa7:c954:: with SMTP id h20mr9201edt.159.1571948684482; Thu, 24 Oct 2019 13:24:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571948684; cv=none; d=google.com; s=arc-20160816; b=p6xoWXV+RbJ0xYZ3c2rI3CXNlNjyskb47vjTonlTYuykkhfwF4yzf7zxfbPo3oatri 2dmea1jENEirr/2R+eoj5B2/4lT2HpFTCzahWpVOlPr4ttV1EDWql1k/FRAnVf0vurG6 vHIdJzER6SXUwuMup9i06FoOhrEmI9b7q7MdtfxbmXXcn0AA+6svOcH+ERW/Qrprwwl5 LD8ujHX1kbCTifIJJxAXkGEWtAKVVi0N9yjq/FLQxB0aiPfbBTqds1oBuq/EPPspqQ41 BDRTOjaD0Jk7Lz70z1g3aCMN64kv72uAyct36m/ycJ1xWHxUaGUIfm7SD/TunX7cDKrH rWyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:dmarc-filter :dkim-signature:dkim-signature; bh=IpyvmNIhWxZoDoGgxnDUjIwhEc/aj9MuN6uwrXe3jII=; b=J76EqVlNFMfNc3QAcb8gzze0KhYwzRBw3gX7NdzfGpzIclrzqu+osH0ue8nqdpC9Kg Fy6vhjzpQzF0VydwYcBKuGaWK4VCeMWsOF9Un9Pyh4ouR169uQHn5a/yYvhZZkF5MjAf wWAhIfD2m4jb0qHPhjuWyN7z8aSs2+Q87/zqdwl1UYGychVq7EdYT2JtyAGhE9N0Vkm8 YNNoDyLCsDparDifRZ0/iNgsXHyGz8oKgkFSADjIGFIhtny6zesSCEotkCsdMvOey1dT AJiGCgcO7fm+LZuYd86N2MzO7s/4pXSBtt+hi9Q4f0WowexVI+H07RR79O7V08lMBCkO 4DRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=RWwbs03N; dkim=pass header.i=@codeaurora.org header.s=default header.b=RWwbs03N; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i5si17707576edj.107.2019.10.24.13.24.04; Thu, 24 Oct 2019 13:24:44 -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=@codeaurora.org header.s=default header.b=RWwbs03N; dkim=pass header.i=@codeaurora.org header.s=default header.b=RWwbs03N; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437442AbfJXFDX (ORCPT + 99 others); Thu, 24 Oct 2019 01:03:23 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:32846 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725298AbfJXFDX (ORCPT ); Thu, 24 Oct 2019 01:03:23 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id D11CF60DEA; Thu, 24 Oct 2019 05:03:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1571893401; bh=vYRU+bM5JuL4RITs+SLUICptP4u3V+UStBVyN02aLUw=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=RWwbs03Ne47c4LigpsA9MtG3IVJ8M9D/Q5mU+dOTEYDIHHP3rc+m7UQCfZdYlfovL U1M2Thsw9jhkjYuS9SdUqGwH0jdofLNsogcoTIXOx8zXPTyeALvWvhm/pGMftejcWm NAOzIVcMxAfQlWxsPLH1FQ05HfS+rxqCGMHCBqCA= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED,SPF_NONE autolearn=no autolearn_force=no version=3.4.0 Received: from potku.adurom.net (unknown [88.114.240.156]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: kvalo@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 5293A60F78; Thu, 24 Oct 2019 05:03:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1571893401; bh=vYRU+bM5JuL4RITs+SLUICptP4u3V+UStBVyN02aLUw=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=RWwbs03Ne47c4LigpsA9MtG3IVJ8M9D/Q5mU+dOTEYDIHHP3rc+m7UQCfZdYlfovL U1M2Thsw9jhkjYuS9SdUqGwH0jdofLNsogcoTIXOx8zXPTyeALvWvhm/pGMftejcWm NAOzIVcMxAfQlWxsPLH1FQ05HfS+rxqCGMHCBqCA= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 5293A60F78 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=kvalo@codeaurora.org From: Kalle Valo To: Lorenzo Bianconi 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 References: Date: Thu, 24 Oct 2019 08:03:16 +0300 In-Reply-To: (Lorenzo Bianconi's message of "Thu, 24 Oct 2019 00:23:15 +0200") Message-ID: <87eez2u44r.fsf@kamboji.qca.qualcomm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Lorenzo Bianconi writes: > On same device (e.g. U7612E-H1) PCIE_ASPM causes continuous mcu hangs and > 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 [...] > +void mt76_mmio_disable_aspm(struct pci_dev *pdev) > +{ > + struct pci_dev *parent = pdev->bus->self; > + u16 aspm_conf, parent_aspm_conf = 0; > + > + pcie_capability_read_word(pdev, PCI_EXP_LNKCTL, &aspm_conf); > + aspm_conf &= PCI_EXP_LNKCTL_ASPMC; > + if (parent) { > + pcie_capability_read_word(parent, PCI_EXP_LNKCTL, > + &parent_aspm_conf); > + parent_aspm_conf &= 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 */ A minor comment, but 'if IS_ENABLED(CONFIG_PCIEASPM)' is preferred over #ifdef. Better compiler coverage and so on. -- https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches