Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp614786pxh; Tue, 9 Nov 2021 16:12:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJzvTFRwt7K7AUF8AM8+eHH7uXfedZUTueWDYV88BZ2gxvgS/crojVoQLCREMZR1NWw7j3pX X-Received: by 2002:a5d:974f:: with SMTP id c15mr7897649ioo.22.1636503172159; Tue, 09 Nov 2021 16:12:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636503172; cv=none; d=google.com; s=arc-20160816; b=CUb2U+SWFo47hovfjCS3MbSY0oPCfotqoQ2gbZD0LjqDfpUC3YZ+eKJb2CQNekSy7Z VuD24QC8QY0Bs2dGEPm5EU5B27nd/QrS3yuFERxyeve4UmZbJDamSHxkMfaj1q8jjiqN cogmnnimyBreNeNMPyck9l3nT8egr/44KlngdwOc97V8XFQDFMnP21rkqn/feY92C+lG vFG98OIGsGLA/eidvZNUmiUv+yoNNXphUbOxD/DAtVqFvgEGNbyoTw1orkGfatY9hVQ/ 1pJM1WmMBolDMFcVhSmvYAifg46FOtFB22Yg0EOe6RB97lFwR97eBa279AkTQoZH/Xie 4MvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=JiNY2CrktFwKMhWVgpCOqJG+ogjrQq1iEykNS6n8KD0=; b=a9M/iBq9Ps1z32HNiPGeHc5eQhBqndhlKKCxD1E0WJ//T8D5oXywTc0/Dguk9H5qpb ktpYYA+yuQ3v2WGSKg2/1aKaz7UjT4L4PMGXZOHMkLAwVq99/QO3bKhhV/1klLhsmRik kl6fSosSx/aXXxCcjpGFGJ0zZT2R8Kj8Nm19f+d2xQeBATqhFZgH3t7mnIxXg/MfWeaj ARKJC/11zn9JnrdnbZtIsfHa3Eqo9KzGZ++5axgu2GiIBN7EDkPUaU3fcUDvGMVP44Gv k8wAKsX8vhQJmUlei88Ey912gAFt4m/gkrhjlAINMT/QKVNGem6swuhhqc37hhUFDQAY Y6FQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s12si7567554ilv.122.2021.11.09.16.12.39; Tue, 09 Nov 2021 16:12:52 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242726AbhKISwf (ORCPT + 97 others); Tue, 9 Nov 2021 13:52:35 -0500 Received: from mga01.intel.com ([192.55.52.88]:53766 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242639AbhKISwe (ORCPT ); Tue, 9 Nov 2021 13:52:34 -0500 X-IronPort-AV: E=McAfee;i="6200,9189,10163"; a="256200216" X-IronPort-AV: E=Sophos;i="5.87,221,1631602800"; d="scan'208";a="256200216" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2021 10:49:47 -0800 X-IronPort-AV: E=Sophos;i="5.87,221,1631602800"; d="scan'208";a="503635086" Received: from rhweight-wrk1.ra.intel.com ([137.102.106.40]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2021 10:49:47 -0800 Date: Tue, 9 Nov 2021 10:51:33 -0800 (PST) From: matthew.gerlach@linux.intel.com X-X-Sender: mgerlach@rhweight-WRK1 To: Tom Rix cc: Andy Shevchenko , Moritz Fischer , linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org, Wu Hao , Xu Yilun Subject: Re: [PATCH v1 1/1] fpga: dfl: pci: Use pci_find_vsec_capability() when looking for DFL In-Reply-To: <39ac1f40-66ab-6c7e-0042-8fcdc062ed00@redhat.com> Message-ID: References: <20211109154127.18455-1-andriy.shevchenko@linux.intel.com> <8ccc133a-fb47-4548-fee3-d57775a5166d@redhat.com> <39ac1f40-66ab-6c7e-0042-8fcdc062ed00@redhat.com> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 9 Nov 2021, Tom Rix wrote: > > On 11/9/21 10:05 AM, Andy Shevchenko wrote: >> On Tue, Nov 09, 2021 at 07:55:43AM -0800, Tom Rix wrote: >>> On 11/9/21 7:41 AM, Andy Shevchenko wrote: >>>> Currently the find_dfls_by_vsec() opens code pci_find_vsec_capability(). >>>> Refactor the former to use the latter. No functional change intended. >> Thanks for review, my answers below. >> >> ... >> >>>> + u16 voff; >>> The later use of voff in pci_read_config_dword is of type 'int', it may be >>> better to keep voff as an int. >> I don't think so. The rule of thumb that the types should match the value >> they >> got in the first place. In this case it's u16. Compiler will implicitly >> cast it >> to whatever is needed as long as the type is good for integer promotion. >> I think u16 is more precise than int, but I think it'll get promoted to an int anywhen when used with calls to pci_read_config_dword(). Was this change tested on real or emulated HW? >> ... >> >>>> + voff = pci_find_vsec_capability(dev, PCI_VENDOR_ID_INTEL, >>>> PCI_VSEC_ID_INTEL_DFLS); >>> This may be a weakness in the origin code, but intel isn't the exclusive >>> user of DFL. >> This does not change the original code. If you think so, this can be >> extended >> later on. > > I would rather see this fixed now or explained why this isn't a problem. I agree that a single Vendor/VSEC id being supported is a problem, but I think fixing it should be a separate patch. Do we need to change this a table lookup of Vendor/VSEC id's, or do we need to reserve a more generic Vendor/VSEC pair? > > Tom > >> >>>> if (!voff) { >>>> dev_dbg(&pcidev->dev, "%s no DFL VSEC found\n", __func__); >>>> return -ENODEV; > >