Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp480324ybn; Thu, 3 Oct 2019 07:50:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqysDsfuWSxH7zh97UbqjFT7f+CWPKpPEQTQLlpKqdrC2CIcPyUXYPnu3UGM22RRd3e/jrGC X-Received: by 2002:a17:906:3083:: with SMTP id 3mr7848148ejv.259.1570114208071; Thu, 03 Oct 2019 07:50:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570114208; cv=none; d=google.com; s=arc-20160816; b=JTl76jQd3IP3bAiB2PRF6SFN+tTfl2tiPlLLO1U2XKucKlFxOEOzL3WXnyNFNmvmHV 62b7kSOsC9QbY76MryPkxJB0GnLEHtQ0/2VIBfTA7mzR5Ea7r97Qnn8Oo3PUPZai3Knz 0WHMS0dwBD0eyGCexvrBnnETZf676qTrbSzdh7HVkd1xHVcZ4/SWwJXkDPy+zbpv3dQy qWJU5kydvzF3wnvG8esXXKcXB9SvNw6NDPiub3dMFmWMiwHu7VsA4K/RwXWWMUlzeFmJ I+xQ9SGBx+EA6gioBLDiZbo9nTGYPn9Vh6OQxzErc4B6GDwfJY30BN8ujDM17TuJxwf7 VryA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:references:in-reply-to:mime-version :dkim-signature; bh=Xbl2FVDV/NRDS6TRrMIuIQnHaMA9j+8M/vbEhytQez0=; b=zAe84IH6YtSLJUwypvdjN8i6G4LLyycrVWRDvOJt0wKAjevPfAlQ4wR7jfVyJ4JYiU bZPxrleqfPCO9oduzTgxgm+YDl8/IAs+4kk3U/9kSLRXUPYq7aATbkcxsm4ZCBRgrcyT dNvqYxkvSUIT+2CqyUQ8MrX4rzBkqlUwxUMyD9WBMlGRs35k8+VYHvvlXQvRQqe0iS3H e/rf7FbBRaNGkMtlWngVCRJuj7PGkmvLc7teB1ebwOhqQfr0OuncrRbQHwk4s9+5DYpi oG7c+/zC3Cptc/Xf8r1pE3M+7NVPC6yISHxL6PMKfyF7pP4MIvsJ80Co978o/6A+XV/X BvZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uErh8nrK; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id oq24si1345223ejb.202.2019.10.03.07.49.36; Thu, 03 Oct 2019 07:50:08 -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=@gmail.com header.s=20161025 header.b=uErh8nrK; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729835AbfJCOBj (ORCPT + 99 others); Thu, 3 Oct 2019 10:01:39 -0400 Received: from mail-oi1-f193.google.com ([209.85.167.193]:45858 "EHLO mail-oi1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727488AbfJCOBj (ORCPT ); Thu, 3 Oct 2019 10:01:39 -0400 Received: by mail-oi1-f193.google.com with SMTP id o205so2633796oib.12 for ; Thu, 03 Oct 2019 07:01:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=Xbl2FVDV/NRDS6TRrMIuIQnHaMA9j+8M/vbEhytQez0=; b=uErh8nrK1Rs0KHN+obi/qdELNSpKYpzBn8koOfceCkJVWTVpbNiP46flbubxGRXUDc cR6hCdWYmUHMZrJDF+4Z+Iq3euNopfgyXB07pSdYUTJPR65bqetkW2L60WPHAxIfjZHk YCjZc1ABi5OVMy24FahqAhNFRSibUJOOk4gyz45cow1U7h250+/UiIoqCXD8WRiv0gnv garCRttau3lmFyRIkaGl4S/pszqE8b5VkexGS4wgTfWSPAiTHxEhow5nhtDkNZzJJiHX 8er50thFFqK8iEKqrSQn7cMZJPtP1svTDzyY3pk4NTQre5QmRiB/4fRvskLFZqTx8XFx UhLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Xbl2FVDV/NRDS6TRrMIuIQnHaMA9j+8M/vbEhytQez0=; b=lhlkbNRNxwFsogNPq2rGiI/B5jVjmoJIV589Of5+4VG2kAoRxrqTHDB4m9eS58mfLT ny2f0JS4WKG5rt9TNPbBkSuy0jr3Rf+vvVs60IOc+5VRQN9HZlpO4WYX4VDrTvuT7b3v IrCxMn9BnlucOj9oWSiBw4nD09uv+zH9krasmNgQx1WfG+19dyjmwhOBhCqLTYplaqyd k3bPIAG6q5/qaBMH+mnelWWb1xshGNrqMc+H+o+GrZXpyLj33j0X4vhdiZJqFY74TblB R8LHAj4M5xdPlnFhl5ZQHSSn4C5ch/Gy3xyENbHSqZo4SDfn+LwkZMgBZK2hM8Y4Vyxh xjmQ== X-Gm-Message-State: APjAAAWS40RkKUCANUpktVgXV4kJIGdMf2oes2IJzZRteDJCh7C45CjM fUYLECdqaZUFE2XF/ANjhd3H5wddf2WxpC6T3n0= X-Received: by 2002:aca:a88e:: with SMTP id r136mr3020734oie.30.1570111296850; Thu, 03 Oct 2019 07:01:36 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:2286:0:0:0:0:0 with HTTP; Thu, 3 Oct 2019 07:01:35 -0700 (PDT) In-Reply-To: <87wodmgdhh.fsf@tynnyri.adurom.net> References: <1553025580-6118-1-git-send-email-pozega.tomislav@gmail.com> <87wodmgdhh.fsf@tynnyri.adurom.net> From: Tom Psyborg Date: Thu, 3 Oct 2019 16:01:35 +0200 Message-ID: Subject: Re: [PATCH] ath10k: Fix ASPM L1 state on QCA988X To: Kalle Valo Cc: linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 03/10/2019, Kalle Valo wrote: > (please always CC ath10k list so that ath10k patches are easy to find) > > Tomislav Po=C5=BEega writes: > >> On some systems there are heavy crashes if the kernel config >> option CONFIG_PCIEASPM_PERFORMANCE is not set. Patch provided by >> Sujith for ath9k fixes this issue and the card operates without >> crashes with kernel default CONFIG_PCIEASPM_DEFAULT option that uses >> BIOS provided ASPM settings. Tested with QCA9862 mPCIe card. >> >> Signed-off-by: Sujith Manoharan >> Signed-off-by: Tomislav Po=C5=BEega > > So I'll summarise the discussion from patchwork: > > https://patchwork.kernel.org/patch/10860301/ > > Sujith wrote this workaround first for ath9k and you ported it to > ath10k: > > https://lore.kernel.org/linux-wireless/1377421989-21240-1-git-send-email-= sujith@msujith.org/ > > https://git.kernel.org/linus/b380a43b52be > > And you have PCI problems after QCA988X firmware has crashed on HP > Compaq 6735b laptop, apparently the device just does not respond on PCI > bus at that point. And this workaround solves the issue and you don't > have any problems anymore. > > Please correct if I have misunderstood. > >> --- a/drivers/net/wireless/ath/ath10k/pci.c >> +++ b/drivers/net/wireless/ath/ath10k/pci.c >> @@ -2787,14 +2787,25 @@ static int ath10k_pci_hif_power_up(struct ath10k >> *ar, >> enum ath10k_firmware_mode fw_mode) >> { >> struct ath10k_pci *ar_pci =3D ath10k_pci_priv(ar); >> + struct pci_dev *pdev =3D ar_pci->pdev; >> int ret; >> + u32 val; >> >> ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot hif power up\n"); >> >> - pcie_capability_read_word(ar_pci->pdev, PCI_EXP_LNKCTL, >> + if (ar->dev_id =3D=3D QCA988X_2_0_DEVICE_ID) { >> + pci_read_config_dword(pdev, 0x70c, &val); >> + if ((val & 0xff000000) =3D=3D 0x17000000) { >> + val &=3D 0x00ffffff; >> + val |=3D 0x27000000; >> + pci_write_config_dword(pdev, 0x570c, val); >> + } >> + } else { >> + pcie_capability_read_word(ar_pci->pdev, PCI_EXP_LNKCTL, >> &ar_pci->link_ctl); >> - pcie_capability_write_word(ar_pci->pdev, PCI_EXP_LNKCTL, >> + pcie_capability_write_word(ar_pci->pdev, PCI_EXP_LNKCTL, >> ar_pci->link_ctl & ~PCI_EXP_LNKCTL_ASPMC); >> + } > > Magic values are not nice, it's better to have proper defines. Sujith > already provided meaning for 0x70c, but I don't know what 0x570c means > (or I guess 0x500 offset)? > > Also please use GENMASK() and FIELD_PREP(). Otherwise looks good to me. > > -- > https://wireless.wiki.kernel.org/en/developers/documentation/submittingpa= tches > I don't think the old patch from ath9k is that much relevant in this bug case at all, since by applying it the way it is the patch actually prevented ASPM code from execution (moved after } else { ) on QCA988X_2_0 devices. The ASPM enable code that was commited years ago causes regression as I've already wrote, and reverting that commit is sufficient to have card operating properly. When that is handled properly, this patch can then be added before or after the ASPM enable code. Also, since the read value will obviously differ from system to system, something like this could be used: if ((val & 0xff000000) !=3D 0x27000000) 0x570c should refer to programming address for this register, at least according to reference driver.