Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6283220rwl; Thu, 29 Dec 2022 10:07:01 -0800 (PST) X-Google-Smtp-Source: AMrXdXuWCXmbMkCwCmBBHiMamtsIbPKn2UHY1j5iVN1xlvlcbWhgXi2hYiB9DelesSDPwstpg5Fi X-Received: by 2002:a17:90a:e513:b0:225:fb71:efc1 with SMTP id t19-20020a17090ae51300b00225fb71efc1mr13129196pjy.0.1672337221075; Thu, 29 Dec 2022 10:07:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672337221; cv=none; d=google.com; s=arc-20160816; b=Dg8BaJs8pMRdn6RQrYH7Ao6A96n+i5l54TmDiKWSyj4XbktfeEa5sOcfFSWBb73N4c gB415Pdd1pdJ6dqHG2YXquoSf1rIGETgh7/dVGD3w5RNSVXSODk2/NABT1AKFJrFcOy0 h+EWymzMQWBqxa7rAuFpEdI44E5+AH27/k+Gp/FLFLaAh3hpPeV4VZSx6GegRataVg9O ztgGzxCHTDOWW7g+tGnL/IHPAM6/S7M8GDmwepJWMD/+4eHJMxY1bmO84eMSCt9UwmW0 gCskh38jgEHsZ4VvY6VZFAZk/lAOfjLnnMASeYEyO93w7WiUvhVlh15gB2swAavZkZtD amUg== 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:dkim-signature; bh=SJTQ2Zmt3saFChA+H0xVmBPrsGOB+Ci02h2DbvKMTVs=; b=Q+3gTA7+OqEoWH8wuvKCZi4fJsQcGPDGjnA7EMEWlhV48ealYcqdTdbtwy4Q8jFMt1 J6dcaqO9x8lPv4GPJnz14xlxrW+pLxtP4+v/oK4feqkvemY6l1ygLYt5Db/G4ZrfM93j erN5lwY00vEpa0bBQEo0NIzROA9ZA8XAmcTe0fm5KwqlOBtN2zJy32qqxIC/jbN3bD8G 1AbgCyEfHihu8XzCyD8v2mki6//FiqA3+l6PakCQack9A0d/L7CTA18AoUODxlyo0XJS qoHrK4IFL0Y6i05GQh1t4F3SZ60hestmhSsyolDjreYEGiI7uPCjIDyxZ4gVkAG4fPm5 +3Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=N17Q1U+j; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oc15-20020a17090b1c0f00b0022638d96fccsi1283754pjb.11.2022.12.29.10.06.53; Thu, 29 Dec 2022 10:07:01 -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=@intel.com header.s=Intel header.b=N17Q1U+j; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233791AbiL2RbU (ORCPT + 61 others); Thu, 29 Dec 2022 12:31:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233860AbiL2Ras (ORCPT ); Thu, 29 Dec 2022 12:30:48 -0500 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCC99396; Thu, 29 Dec 2022 09:30:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672335043; x=1703871043; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=jzJmJ8hNoMsewqwbxcPd1etes2MnlJv/Rt5CviLAz5E=; b=N17Q1U+j0UPm09zmjsfo2XlGVatUgI0QMpU9RjFvRhyJn+GSovwuTYD2 TYSm2mWi96kKOpcYTYGBYUaE4jMzyaIOHkvSOJqRLLKroJBAXW2aK2/Z1 g70eSzy63Z+PnZvGn6vpOwWPwnUWsmaP4wHvSZud0QG556lFZAAXwnDFD SETjXtSaF57/THypDrtkC42Sz6CYBssMVatSea4tnRVeAW62q+y0RzqPM RKCDy7pyGPqJxtxZsczTiDTOOeMRkypLCEMJTGX9lmbb68ubB2NR3U/fl kq7DDtyHYlnfNrA/bs4+CiBvEaYOyVrI9HjE4zP7pes9Du3BQIn2DxJF2 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10575"; a="319798857" X-IronPort-AV: E=Sophos;i="5.96,284,1665471600"; d="scan'208";a="319798857" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Dec 2022 09:30:43 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10575"; a="777740202" X-IronPort-AV: E=Sophos;i="5.96,284,1665471600"; d="scan'208";a="777740202" Received: from rhweight-wrk1.ra.intel.com ([137.102.106.139]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Dec 2022 09:30:43 -0800 Date: Thu, 29 Dec 2022 09:31:02 -0800 (PST) From: matthew.gerlach@linux.intel.com X-X-Sender: mgerlach@rhweight-WRK1 To: Andy Shevchenko cc: hao.wu@intel.com, yilun.xu@intel.com, russell.h.weight@intel.com, basheer.ahmed.muddebihal@intel.com, trix@redhat.com, mdf@kernel.org, linux-fpga@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, tianfei.zhang@intel.com, corbet@lwn.net, gregkh@linuxfoundation.org, linux-serial@vger.kernel.org, jirislaby@kernel.org, geert+renesas@glider.be, niklas.soderlund+renesas@ragnatech.se, macro@orcam.me.uk, johan@kernel.org, lukas@wunner.de, ilpo.jarvinen@linux.intel.com, marpagan@redhat.com, bagasdotme@gmail.com Subject: Re: [PATCH v8 3/4] fpga: dfl: add basic support for DFHv1 In-Reply-To: Message-ID: References: <20221228181624.1793433-1-matthew.gerlach@linux.intel.com> <20221228181624.1793433-4-matthew.gerlach@linux.intel.com> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE 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 Thu, 29 Dec 2022, Andy Shevchenko wrote: > On Wed, Dec 28, 2022 at 10:16:23AM -0800, matthew.gerlach@linux.intel.com wrote: >> From: Matthew Gerlach >> >> Version 1 of the Device Feature Header (DFH) definition adds >> functionality to the DFL bus. >> >> A DFHv1 header may have one or more parameter blocks that >> further describes the HW to SW. Add support to the DFL bus > > Single space is enough. Yes, single space is enough. Two spaces after a period is hard habit for me break. I will update in v9. > >> to parse the MSI-X parameter. >> >> The location of a feature's register set is explicitly >> described in DFHv1 and can be relative to the base of the DFHv1 >> or an absolute address. Parse the location and pass the information >> to DFL driver. > > I'm wondering what DFL states for. I will define DFL in the commit message like DFH in the next revision. > > ... > >> +/** >> + * dfh_get_u64_param_vals() - get array of u64 param values for given parameter id >> + * @dfl_dev: dfl device >> + * @param: id of dfl parameter >> + * @pval: location of parameter data destination >> + * @nvals: number of u64 elements of parameter data >> + * >> + * Return: pointer to start of parameter block, PTR_ERR otherwise >> + */ >> +u64 *dfh_get_u64_param_vals(struct dfl_device *dfl_dev, int param_id, u64 *pval, int nvals) >> +{ >> + u64 *param = find_param(dfl_dev->params, dfl_dev->param_size, param_id); >> + u64 next; >> + int i; >> + >> + if (!param) >> + return ERR_PTR(-ENOENT); >> + >> + next = FIELD_GET(DFHv1_PARAM_HDR_NEXT_OFFSET, *param); >> + >> + if (nvals >= next) >> + return ERR_PTR(-ENOMEM); > > ENODATA ? ENODATA does seem to be more accurate than ENOMEM in this case. > >> + for (i = 0; i < nvals; i++) >> + *pval++ = param[i + 1]; > > memcpy() ? Using memcpy() will make code cleaner. > >> + return param; >> +} > > ... > >> + finfo = kzalloc(struct_size(finfo, params, dfh_psize/sizeof(u64)), GFP_KERNEL); > > ' / ' (mind the spaces) Yes, I will mind the spaces. > > Also, perhaps better to use sizeof(*params) or what is the member of that > structure. So it will be more robust against possible changes. params is the name of the structure member that is the trailing array. > >> if (!finfo) >> return -ENOMEM; > > -- > With Best Regards, > Andy Shevchenko Thanks for the feedback, Matthew Gerlach > > >