Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1851861pxf; Fri, 26 Mar 2021 17:21:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsFOduc+ExJdLIahfNg96NqxwnsmIgtgnBkx51/PByGd7ST+liawkUqo0HyK43zTMkNeEz X-Received: by 2002:a17:906:5797:: with SMTP id k23mr18444682ejq.515.1616804514199; Fri, 26 Mar 2021 17:21:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616804514; cv=none; d=google.com; s=arc-20160816; b=tF1Iatp+JgXbBmb0UM/zDS+7Zi3gDT0uArNtyUey/0bZqc1nznzGbh1Oent/1tw949 pqEwN/cf94DuHyNJeCmiaj3w0fWUFeOZQV7QDaAIQiYE2Ax/AOBO+5rM5iFNMv8RxUpo 9B7iN81h/ai4WPN4vt6rI3vAVgBIl2XusMlgvMo/L7+geBdMwHyYUCJjRKNtnDoxqpup Mr7Abc7fyaGuHJoGFHlFFlHff7JUlhwHCpnc4WyxCcT4n+ZY2CwBCHbzmdqA0eDqvvcK 5q3g2c4LbLMEsHZp215gey3wPNT8Jlro1gROGDhsjqO5lFv9px0f9t2N55ECccA4uxx+ Qmjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=SEcUk0EunwKzPM97F5uKAKJTsTQwxZ5rqKq25o2rWsk=; b=y7gtTFLLRh7fGTkYGd6vDjWmXZRS/5VQUmM0HO2dGVvt/OC6nXd8uVMRJcVn1sw+PC NvNLej+qqBXurQJMui0iVlBPiQuY4A/j2F9Y4OvzI4nnahpsxqy+SYWA4lGOCNPYvkh3 HBFmJeb7Q3TD2Cf8jHes8+3ix81M9s0Bp1b+JIkz0O33rEGNDHNYQjc8td0baAjlUDWw Di3kXL6aVXS8u54hJSTn+kUmt9nm0YOpu+ZO5mHRgxDQBvOKaynOOIA2sW/+C9hZ/ELK pBbknjF7oZkjUNp2F9J1oG4asusk9QlIyLSRAdMvJDRO0spU7JADV5bEeGHfz67VjicY pUJg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a21si7814558ejd.654.2021.03.26.17.21.32; Fri, 26 Mar 2021 17:21:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231139AbhC0AOd (ORCPT + 99 others); Fri, 26 Mar 2021 20:14:33 -0400 Received: from mail-lf1-f41.google.com ([209.85.167.41]:34704 "EHLO mail-lf1-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230134AbhC0AON (ORCPT ); Fri, 26 Mar 2021 20:14:13 -0400 Received: by mail-lf1-f41.google.com with SMTP id i26so10141651lfl.1; Fri, 26 Mar 2021 17:14:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=SEcUk0EunwKzPM97F5uKAKJTsTQwxZ5rqKq25o2rWsk=; b=K3cXqbbbsMAxi/RhBEeziukGrjLj7pExUZgP9tDu9qsQjYZW2c7d6F6mBz7rSxSf45 uFDvK19qCrozli+tpvMcM5Zz1MknVaIyPiNibLYZ2abPuxJhcsWSWRvKu3vyLFdSY+gd b7KkTggwtGr5SpFQoclPiFYwQtZuLXHCYuF0S0DnbRF2zA1IYwmjvN4Bf+gfYQ82Dltg QVifIrfo2i5vvs/RLdfgL/hKIflUoyJxVwbvYb7Ptpl0t0jYCmNCMwSGPSarxi0Lv0YN JJhaRG8AIuoMkEuAuvIjWU10j33OgH5XphZIdT41qfvYVtqjGku9VU/+vGkg3dnIwxvh ye5w== X-Gm-Message-State: AOAM533QvoC1+6Ohuj331Lbiry7S9AB+FnUo4ZvUB2V/8pixe9+vAKY5 Sozl9acLWzXgki1K5d0FiLY= X-Received: by 2002:a05:6512:405:: with SMTP id u5mr9253215lfk.574.1616804051808; Fri, 26 Mar 2021 17:14:11 -0700 (PDT) Received: from rocinante ([95.155.85.46]) by smtp.gmail.com with ESMTPSA id n11sm1020676lfe.243.2021.03.26.17.14.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Mar 2021 17:14:11 -0700 (PDT) Date: Sat, 27 Mar 2021 01:14:10 +0100 From: Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= To: Pali =?utf-8?B?Um9ow6Fy?= Cc: Bjorn Helgaas , Kalle Valo , Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= , Marek =?utf-8?B?QmVow7pu?= , vtolkm@gmail.com, Rob Herring , Ilias Apalodimas , Thomas Petazzoni , Jason Cooper , linux-pci@vger.kernel.org, ath10k@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] PCI: Disallow retraining link for Atheros QCA98xx chips on non-Gen1 PCIe bridges Message-ID: References: <20210326124326.21163-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210326124326.21163-1-pali@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Pali, Thank you for sending the patch over! [...] > +static int pcie_change_tls_to_gen1(struct pci_dev *parent) Just a nitpick, so feel free to ignore it. I would just call the variable "dev" as we pass a pointer to a particular device, but it does not matter as much, so I am leaving this to you. [...] > + if (ret == 0) { You prefer this style over "if (!ret)"? Just asking in the view of the style that seem to be preferred in the code base at the moment. > + /* Verify that new value was really set */ > + pcie_capability_read_word(parent, PCI_EXP_LNKCTL2, ®16); > + if ((reg16 & PCI_EXP_LNKCTL2_TLS) != PCI_EXP_LNKCTL2_TLS_2_5GT) > + ret = -EINVAL; I am wondering about this verification - did you have a case where the device would not properly set its capability, or accept the write and do nothing? > + if (ret != 0) I think "if (ret)" would be fine to use here, unless you prefer being more explicit. See my question about style above. > static bool pcie_retrain_link(struct pcie_link_state *link) > { > struct pci_dev *parent = link->pdev; > unsigned long end_jiffies; > u16 reg16; > + u32 reg32; > + > + /* Check if link is capable of higher speed than 2.5 GT/s and needs quirk */ > + pcie_capability_read_dword(parent, PCI_EXP_LNKCAP, ®32); > + if ((reg32 & PCI_EXP_LNKCAP_SLS) > PCI_EXP_LNKCAP_SLS_2_5GB) { I wonder if moving this check to pcie_change_tls_to_gen1() would make more sense? It would then make this function a little cleaner. What do you think? [...] > +static void quirk_no_bus_reset_and_no_retrain_link(struct pci_dev *dev) > +{ > + dev->dev_flags |= PCI_DEV_FLAGS_NO_BUS_RESET | PCI_DEV_FLAGS_NO_RETRAIN_LINK_WHEN_NOT_GEN1; > +} [...] I know that the style has been changed to allow 100 characters width and that checkpatch.pl now also does not warn about line length, as per commit bdc48fa11e46 ("checkpatch/coding-style: deprecate 80-column warning"), but I think Bjorn still prefers 80 characters, thus this line above might have to be aligned. Krzysztof