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 X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E06DCA9EAF for ; Thu, 24 Oct 2019 05:03:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1F33420679 for ; Thu, 24 Oct 2019 05:03:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="RWwbs03N"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="RWwbs03N" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437444AbfJXFDX (ORCPT ); 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= 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