Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3335032rwb; Sun, 20 Nov 2022 11:55:05 -0800 (PST) X-Google-Smtp-Source: AA0mqf4qbf0OlGbskEEvPQtO+BPW0TM+JiFexgMNWmTppJ4a9fapZUiVjpTEzlx5jiM5itmm8NEj X-Received: by 2002:a17:906:1187:b0:7ad:88f8:6a53 with SMTP id n7-20020a170906118700b007ad88f86a53mr13439348eja.61.1668974105243; Sun, 20 Nov 2022 11:55:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668974105; cv=none; d=google.com; s=arc-20160816; b=ZnXAWss7ym+CiVUUl+bSl8hINN0mbkOdAuJK8ubLqfQITbdjePUInY90aRPZYWaeV0 nN83lgMVLQ0uB9PyqW0cXE+vYmwym07++8ymD7AF+e2VnX6RVT8WRKDtirKsHH1OytFE F3zb9RpaS+qZXMfG1BZAEVgxTr1LZXms/BWGKfzGo1wi9RDcx5FGZgux+lVMNTT3KHOk HdKV6yhPTc5cKrdXOUssCJNKzbOJPpjvVDVC4fBG8WBoxpLUEVrZ+ODc5y5KWtH4Jvvn p4VLIr4D1cmAc9Lvm7On73g5m3AtGETllti+NfGwJSeDJwwZbTIEY07jo2UErTUfSFIN EhQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=8LaHKmq7OFJnIyMctlCwRLI+i+Iq0pi+JZ2iY5cq02g=; b=ENYSDj8KxeAtjzRl72PV1XQPyLTIufA7VZWXWLUtx4OLhQQzGZTAa39URPEAW1gnKW tb2VDi1Z2oMAfeoZUGp5I4trxJFrMyZwZ8WSB6hZtN7FyaBjnmuw9a7ajdvq5ttU58Ez CCSJrUDqKZgVe/fWg83ZH+TNbHnGLQNxu7AozxhJjjtpVcO8RX40o2QbCRAeBeSDby1v 0niT2Euqj07h4dlAJrvxMujrvIB2F50+ZN4px71fUECKcaB8owDiHArsC4KhiyBN+8KJ /auO7Ni/fYA7RaiMTmeKHF58MOhy8D5lbUZe2vyee3VEOqHUzzokHhdHRnSj1OjnBa7K TI2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=AN9rStZC; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i20-20020a1709064fd400b007a8dddc7ec8si8457467ejw.382.2022.11.20.11.54.39; Sun, 20 Nov 2022 11:55:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=AN9rStZC; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229852AbiKTTvF (ORCPT + 68 others); Sun, 20 Nov 2022 14:51:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229853AbiKTTun (ORCPT ); Sun, 20 Nov 2022 14:50:43 -0500 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18F9C450BE for ; Sun, 20 Nov 2022 11:50:10 -0800 (PST) Received: by mail-ej1-x633.google.com with SMTP id ud5so24316440ejc.4 for ; Sun, 20 Nov 2022 11:50:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=8LaHKmq7OFJnIyMctlCwRLI+i+Iq0pi+JZ2iY5cq02g=; b=AN9rStZCtMgLQUv9/49V7YhZAwRm+PNwNReA0n5gVRkWkdm8EppkQHCh6QfYmbAz19 nGJx969XrtxRL75oXJIT6O5lutVJn79Z0ZE6S1cOpJcK059OpNDnHAp9V0Z7eqE7Hfs3 Pq+G1Eg8XcgIwk8HX9ZN+QR/sFd3ln2kak9Gqsnb4wpoxvZNCBL694BDuOy/UHRniyL0 r1UxjNYXQv/ii4DIYNoRJYVC75SNcjFVpe8TqOtK87CJ4WDOrfirVUlaiB81RVWeM58u jpSTDP41uj8SxgB+ObYoDoFRNks6vK6p2GQy3zsznfNqUxXMSuUhoNQbU6qOWNPJTB47 k4Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=8LaHKmq7OFJnIyMctlCwRLI+i+Iq0pi+JZ2iY5cq02g=; b=rVzTuIwm5fubhAMHGfpl2QGo6hOe4jC7RJSgITxlNe4ns3xpAYaVbP5kGzG0UYrkdi 1WLbHkSRvSILu8PXoKK2E/YQxEmv+VBGgA1gdhOFh0d0Pz74P9T/S+XmqKZdj5VI5LFf CdpKDA143uRk1HumzvkNvRVYGgSIf005snwlOUcYuylC4DA6kJRfTZXwb6EuBEnv/eXb uPx3UsJQM2KG0chIL9c39mH4lnjna0qE+MEWoyQ51ZteTphNvVc9nIKsoon8QzewzAI/ SoeMM5xmDx1WqQ7dDqvFyt1COz7kFogHwbVUWT9sY/VeYiTIo8BodjEFfskZTVEo4xnH 6MHQ== X-Gm-Message-State: ANoB5pkt5Nh93LqkVRamOCrQqfcF6Jc+876cGm4nHVPP/zsHk9JHUpOU nUyogM3DZIjUxcTdc6lWChc00gIVMWjwG0HzODqeP+LI X-Received: by 2002:a17:906:d785:b0:7ad:a3c6:6797 with SMTP id pj5-20020a170906d78500b007ada3c66797mr13487063ejb.665.1668973808804; Sun, 20 Nov 2022 11:50:08 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Emmanuel Grumbach Date: Sun, 20 Nov 2022 21:49:57 +0200 Message-ID: Subject: Re: iwlwifi write to PCI_CFG_RETRY_TIMEOUT To: Jason Andryuk Cc: linux-wireless@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Fri, Nov 18, 2022 at 11:13 PM Jason Andryuk wrote: > > On Thu, Nov 17, 2022 at 2:33 PM Jason Andryuk wrote: > > > > Hi, > > > > I was looking at iwlwifi under Xen PCI passthrough and I noticed a > > curious PCI config space write: > > > > https://github.com/torvalds/linux/blob/master/drivers/net/wireless/intel/iwlwifi/pcie/drv.c#L1721 > > /* > > * We disable the RETRY_TIMEOUT register (0x41) to keep > > * PCI Tx retries from interfering with C3 CPU state. > > */ > > pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); > > > > With 00:14.3 Network controller: Intel Corporation Cannon Point-LP > > CNVi [Wireless-AC] (rev 30) > > register 0x41 in the PCI config space is the next cap pointer for > > "Capabilities: [40] Express Root Complex Integrated Endpoint, MSI 00". > > > > On baremetal, the write seems to be dropped since `hexdump -C > > /sys/bus/pci/devices/0000\:00\:14.3/config` still shows 0x80 (in my > > case). Though I suppose the device could be acting on it even if the > > value doesn't change. > > > > With Xen PCI passthrough, QEMU seems to honor emulating the write and > > it breaks lspci traversing the capabilities so MSI-X is no longer > > shown. > > > > Is the write to RETRY_TIMEOUT at 0x41 correct? It seems to be really > > old. Here it references being copied from ipw2100: > > It seems like lots of drivers copied the write from ipw2100. And it > seems like no one knows exactly why it is there. But it does do > something for some devices which is why ath9k kept it. > > These are some interesting and relevant emails: > https://lore.kernel.org/linux-wireless/43e72e890912192251r4de4a3c3idb5e4c3723ef87aa@mail.gmail.com/ > > https://lore.kernel.org/linux-wireless/20090616151258.GA22849@jm.kir.nu/ > > >> I seem to remember the provenance of this code was copy-paste from > >> an intel driver, so while it does "something," the comment may not > >> match the code, 0x41 being vendor-defined. > > > > The exact story behind this has been a bit more than trivial task to > > figure out ;-). I would assume this comment is referring to a madwifi > > changeset: http://madwifi-project.org/changeset/584 > > Unfortunately, that link seems to be dead and archive.org doesn't have it. > I asked internally and unfortunately I couldn't get any clear answer. Looks like this setting has been there for many many years (~15) and nobody really understands why. It has been removed for our newest device in another (close source) driver and I guess we'll do the same in Linux. I am not sure what we'll do with legacy devices though... We could remove it and risk a regression, or just ... leave it..