Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp3036608lqo; Tue, 14 May 2024 18:52:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUbqEVMXaapRS2rnPBP36Wes1VxHEa0ERtNPxGfxjFQfHI3HL2csDIO2FDT5p4EKRneioZ5IHqBrBstRcagxe5+VaoiNXxm1i7nbtnAoQ== X-Google-Smtp-Source: AGHT+IEs7Kw+2zV3G4ASdIKNMXImtPVjhM9g8esORgizQxBewC/9IvXH84RdlEpJxEpK0pc6Xang X-Received: by 2002:a05:6a20:3d82:b0:1af:5a6f:1c62 with SMTP id adf61e73a8af0-1afde0a9c0dmr17232496637.4.1715737933487; Tue, 14 May 2024 18:52:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715737933; cv=pass; d=google.com; s=arc-20160816; b=xNIYroRvStF4oyAZfb9zBxVqGzmhjUhC/daMbJTi0I2/uK6nkq265mML7l+Atzv4s1 azGUVFnhb6vYSE4MBC7/WCvdfgXIN4yesnmWsrsnIcYKlFINiDQTW93SEM8JWxLYCNFy wqtYvlwe937W4eCFNJQMvHh5MCb44zpRMutxm8OeAmehHnmoUKle+S0OXPJhNUBdJoFw SU74NPvn+r+tMiPK2txJDaBHkd4+b7e9B6ny9Q091nVRwCfIx/hw05fXL6TXbZns2uZw O9MfoAe1d1SynYd+nESUEWFaDVfsEdE4MOs/27zV2/lsMkbNMCOScylbkkpBgjEZQks2 4TVw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:subject:cc:to:from:dkim-signature; bh=rbyWPwZsJd0LcGp8L2yOkHr8OYQvfB61pXQHi/tv948=; fh=4hAlqv/CEM5vo41/lVk0pILVyMzVJJ9DxLu4wHTBsNY=; b=Zsn0bZkrEWcGxgon1eYhdsW8alTzku6L+Xvg3LHeQWdmiT+pvQG8Pvb/qUDvQG4pt5 27c1LKJknB5LmCoRTO6UwpdzhGl/SUWUYR2wApXg7QeG5xVY9hYn4D2ZEX2vydM7vSNb 8wN0xNQEiixlZMNp4NMczGR5i8aGrVNfhmjE/hQ/B6C5vcklT3O99FRegSKOzzp+UiyU mxEMcUQB62LAojT27gSCY8RQ/9/w5FIEvYWE+BO4Yrbi7NDjoS8QJDjJHbDSeshB458M QUxEWAzehnDo78cbojquQCk0FaYdyucTMqRhx5RzfXuXQax3arpgpHlvDTwrAcNafFFZ li0w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=J7nUaJL1; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-wireless+bounces-7660-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7660-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 41be03b00d2f7-63412a4db9csi12317916a12.630.2024.05.14.18.52.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 May 2024 18:52:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-7660-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=J7nUaJL1; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-wireless+bounces-7660-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7660-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id AFCF5B2143E for ; Wed, 15 May 2024 01:52:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9B82E18635; Wed, 15 May 2024 01:52:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="J7nUaJL1" X-Original-To: linux-wireless@vger.kernel.org Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 54C29182DA for ; Wed, 15 May 2024 01:52:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.61.82.184 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715737925; cv=none; b=iiPWqwl+w3G7UIfmP3ZZDTzenyuNVovXl8ODMQ5FZeFKvqV7cVkUTyhuq+5sO7I/RbDBnu0pUjzTKF6HEZrN731U6XdHs/v3ttYtLvu3NiaTwwk5/A1ejTOta7BTNAcoGtEXBb6hwzaJu/pJ9N1nBAqGNlQsjlCBQ29b2vS6+xs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715737925; c=relaxed/simple; bh=C1hJMDeF1AnALarVIMssBMSPUM+VqvZu9M3X9Ln4sr4=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=BxmktmHrhLSxVNS/jAzXpCQDTHQ1ZjN/DMHFO5qFLrauU+Xzp0yyGYRSPDZdJtvFjhh6DpWFr816uSQ95kvaRjQwSptBJvZSjWS2eWRN+YiLGncMxvYm+TFL8W5j57RwIc2uiHnzc3chU49x8Mq2avSP+vh7lZ+V6z/bSPncWBc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com; spf=pass smtp.mailfrom=mediatek.com; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b=J7nUaJL1; arc=none smtp.client-ip=210.61.82.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mediatek.com X-UUID: b74d0234125d11ef8065b7b53f7091ad-20240515 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=rbyWPwZsJd0LcGp8L2yOkHr8OYQvfB61pXQHi/tv948=; b=J7nUaJL1kOPOSDUvJMs8IeGaeu1fvI9iyZmqJGs0a7gWFM653TODKiXszJy3LqHlzv2Y/11W2ac+GdaYrVI5V2Ni+g166CjOdNVt6yXWrxwnHlzYP9TbumlhiYuz5py2xLH1PYiZuwReNnANMAw5dO476KZUzXDzMiX1bqWTgq0=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.38,REQID:665825d0-e336-463f-af18-6f620359c2b7,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:82c5f88,CLOUDID:bdbe5c87-8d4f-477b-89d2-1e3bdbef96d1,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1, SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: b74d0234125d11ef8065b7b53f7091ad-20240515 Received: from mtkmbs11n2.mediatek.inc [(172.21.101.187)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 453240668; Wed, 15 May 2024 09:51:58 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs11n2.mediatek.inc (172.21.101.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Wed, 15 May 2024 09:51:57 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 15 May 2024 09:51:57 +0800 From: Mingyen Hsieh To: , CC: , , , , , , , , , , , , , , Michael Lo , Ming Yen Hsieh Subject: [PATCH] wifi: mt76: mt792x: fix scheduler interference in drv own process Date: Wed, 15 May 2024 09:51:55 +0800 Message-ID: <20240515015155.24931-1-mingyen.hsieh@mediatek.com> X-Mailer: git-send-email 2.18.0 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain From: Michael Lo Add some time to wait for LP engine to complete its operation before polling pmctrl register. Signed-off-by: Michael Lo Signed-off-by: Ming Yen Hsieh --- drivers/net/wireless/mediatek/mt76/mt7921/pci.c | 3 +++ drivers/net/wireless/mediatek/mt76/mt7925/pci.c | 3 +++ drivers/net/wireless/mediatek/mt76/mt792x.h | 1 + drivers/net/wireless/mediatek/mt76/mt792x_core.c | 6 ++++++ 4 files changed, 13 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c index f768e9389ac6..0f7d5a92f3d0 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c @@ -339,6 +339,9 @@ static int mt7921_pci_probe(struct pci_dev *pdev, bus_ops->rmw = mt7921_rmw; dev->mt76.bus = bus_ops; + if (mt7921_disable_aspm) + dev->disable_aspm = true; + ret = mt792xe_mcu_fw_pmctrl(dev); if (ret) goto err_free_dev; diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/pci.c b/drivers/net/wireless/mediatek/mt76/mt7925/pci.c index 07b74d492ce1..e7039e312538 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/pci.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/pci.c @@ -373,6 +373,9 @@ static int mt7925_pci_probe(struct pci_dev *pdev, bus_ops->rmw = mt7925_rmw; dev->mt76.bus = bus_ops; + if (mt7925_disable_aspm) + dev->disable_aspm = true; + ret = __mt792x_mcu_fw_pmctrl(dev); if (ret) goto err_free_dev; diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h index 20578497a405..8f913336a668 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x.h +++ b/drivers/net/wireless/mediatek/mt76/mt792x.h @@ -190,6 +190,7 @@ struct mt792x_dev { bool fw_assert:1; bool has_eht:1; bool regd_in_progress:1; + bool disable_aspm:1; wait_queue_head_t wait; struct work_struct init_work; diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_core.c b/drivers/net/wireless/mediatek/mt76/mt792x_core.c index a405af8d9052..a11e5438a36e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x_core.c +++ b/drivers/net/wireless/mediatek/mt76/mt792x_core.c @@ -766,6 +766,12 @@ int __mt792xe_mcu_drv_pmctrl(struct mt792x_dev *dev) for (i = 0; i < MT792x_DRV_OWN_RETRY_COUNT; i++) { mt76_wr(dev, MT_CONN_ON_LPCTL, PCIE_LPCR_HOST_CLR_OWN); + + if (!dev->disable_aspm) { + /* wait for LP engine to complete its operation */ + usleep_range(2000, 3000); + } + if (mt76_poll_msec_tick(dev, MT_CONN_ON_LPCTL, PCIE_LPCR_HOST_OWN_SYNC, 0, 50, 1)) break; -- 2.25.1