Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1283108rwb; Wed, 9 Nov 2022 15:45:03 -0800 (PST) X-Google-Smtp-Source: AMsMyM6FNz+nTk3yat+IPoCOxLgwIbB5Y5Mjh76FQ3+ebzaye2Z2Va1NX32ohnOcl1lfb/7n7ufm X-Received: by 2002:a17:907:a608:b0:7ad:a198:3177 with SMTP id vt8-20020a170907a60800b007ada1983177mr1940939ejc.750.1668037502845; Wed, 09 Nov 2022 15:45:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668037502; cv=none; d=google.com; s=arc-20160816; b=Y2UdhIuQN1cb9ealsBQ7ufkj5VXMNIK+kLH0ouZ/xr5Kr9P7iFSbM6Co8uCgytdlS6 WZecCbGl4bNo5GC1Ig199QUbU47M8uBF0+ysmbxNEIc8Z8CUfo3s9lSBOcTKieCvluZT chxLf+aBxO8St4ojXqdOdAZEHaKJW6r/VQFjyewQGWrgAEwWTXPdLV9L6x37NDVhNnBX oca2WXFK/lddLHixJXv6KNgV9DualR6ziwPHc1GuqYqbUpwAeZb3BvyYCsIDsysALhT1 oxVvw2PR7gxz3vDY/soOj2btiPzav5dppBZrw7H/yB9HPHuA9pHNX1S0zDGTOEGB3nfd YWRw== 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 :message-id:subject:cc:to:from:date:dkim-signature; bh=+uZeBEx9EJPuv5nvbX6MeWeF5goNL75hur3R95F7Y5k=; b=Jqz9v9j+1t9TUHeK6bfEFUiLhA1Up96OsoNRR6mHv7LzuBkKsRNbJj7ZadEI/0rRSy S8qYuOir7JS0hzJdo0jWJFiZy2+JjZG9L3ospcioAAImTYmT79Yx/XzLz5OQwRzx6et6 TpRALy70kgy7U1HwTVqEIIU6+/HRuu889YVqBto0E2g2zn3mR1z94IFnhi+2Q5bIBStr kXjDWcRBQi/gkOYfUE9sjFhpshrF0Q3zvALVtvpuUKMzySxf0qWfITgdtVNEZXhiHtky SHzQ3YIuAWu90FWDkASfPCLtKEpAlhGmX1w1PTe3gfVnKQGiGN+6m07eC0f3lZpeE8d2 z52g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QFLVSPjB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw18-20020a170906479200b0078dd7383ed8si18843771ejc.414.2022.11.09.15.44.41; Wed, 09 Nov 2022 15:45:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=@kernel.org header.s=k20201202 header.b=QFLVSPjB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229959AbiKIXKJ (ORCPT + 92 others); Wed, 9 Nov 2022 18:10:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231366AbiKIXJ7 (ORCPT ); Wed, 9 Nov 2022 18:09:59 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CE112A40E; Wed, 9 Nov 2022 15:09:59 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9503461D1F; Wed, 9 Nov 2022 23:09:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA487C43470; Wed, 9 Nov 2022 23:09:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668035398; bh=jr17mFKpsW2i8xVCNI4y+k87mzG/8DXMLZLvqNoTp4c=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=QFLVSPjBGWRiiGUTDBSelwI+hMsi0aVHrecfBsmwLUwev0zISa/qzDC0PAL2dJtpr MRhpQ+RO1LjpXcMxcyqr8OY1/dMM2prjLH8F0BkLr/Bc0/8pv1uiK8cbDla0C5Id6B cjcWfc5DUWLYYY6wtFqlfik8OtezMYz6Pp9ro7qfkR9/dXzGrChXA+XuCG3mO/zqNW YXzajQH3gOzFpJNPOIyP5W8No6CTLwtPwBJBdZoomF3zmEPuq+CI4ZNkGRU5ggN/N4 5E7v32djTDtkLiIEHJ2wb4vnosAxkXWxkzMv+Bqs+Dg3U+sb5GAnyTm9maXWftH3ez 6giGSOKIamf7Q== Date: Wed, 9 Nov 2022 17:09:56 -0600 From: Bjorn Helgaas To: Robert Richter Cc: Alison Schofield , Vishal Verma , Ira Weiny , Ben Widawsky , Dan Williams , linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org, Bjorn Helgaas , "Rafael J. Wysocki" , Len Brown , Jonathan Cameron , Davidlohr Bueso , Dave Jiang Subject: Re: [PATCH v3 6/9] cxl/pci: Do not ignore PCI config read errors in match_add_dports() Message-ID: <20221109230956.GA581201@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221109104059.766720-7-rrichter@amd.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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-kernel@vger.kernel.org On Wed, Nov 09, 2022 at 11:40:56AM +0100, Robert Richter wrote: > The link capabilities of a PCI device are read when enumerating its > dports. This is done by reading the PCI config space. If that fails > port enumeration ignores that error. However, reading the PCI config > space should reliably work. > > To reduce some complexity to the code flow when factoring out parts of > the code in match_add_dports() for later reuse, change this to throw > an error. > > Signed-off-by: Robert Richter > --- > drivers/cxl/core/pci.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c > index 0dbbe8d39b07..8271b8abde7a 100644 > --- a/drivers/cxl/core/pci.c > +++ b/drivers/cxl/core/pci.c > @@ -47,7 +47,7 @@ static int match_add_dports(struct pci_dev *pdev, void *data) > return 0; > if (pci_read_config_dword(pdev, pci_pcie_cap(pdev) + PCI_EXP_LNKCAP, > &lnkcap)) You didn't change this, but I recommend using pcie_capability_read_dword() when reading the PCIe Capability. It takes care of some annoying corner cases like devices that don't implement Link Cap and the different versions of the PCIe Capability. > - return 0; > + return -ENXIO; > > rc = cxl_find_regblock(pdev, CXL_REGLOC_RBI_COMPONENT, &map); > if (rc) > -- > 2.30.2 >