Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp8489638rwl; Tue, 10 Jan 2023 14:28:24 -0800 (PST) X-Google-Smtp-Source: AMrXdXuoSKDJqUzhTNaUwoSBRVXyBfPulB2crIUM1sUjgLykMVkNW2Hf9Cy9ynyoWGkhe/0AL9si X-Received: by 2002:a05:6a00:414c:b0:581:7c46:debd with SMTP id bv12-20020a056a00414c00b005817c46debdmr49999223pfb.24.1673389704624; Tue, 10 Jan 2023 14:28:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673389704; cv=none; d=google.com; s=arc-20160816; b=M8y64+Bt3xlI23AaxFxo6XYg8bjGY0IGtE2t27EnO5VnVvEv0Mzw6JqrNGESMvrmPi Sy0KlJW2vSZoHvONRk2v1YkWMK2xBjl9xmbSY4wLguHWglmJ/Pi2K7bAVX5hmulkEaxQ q0OS8F4xIccIX3nQVJJE7DofZ/xWlYW8XPZDaR3on9px91sBRLCerjP4rPHbcAsGiS7m 8HZTNTDmxpo+lnAnujRda81Fsu5EyJcfp0msNHS+9G3NChBYd9Xs+M77ojtSaKfq4Jrn ekG0HqkQ70H3qr0tBWlfnA2snmE2Nlj54IpbVrLE7kd1jmZ2SmzMPvGW/YIVdPcfyary UheQ== 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=DtT5I/yPB8T3uMepX2Ru8KlfRX0xIZS/keg62pim6RQ=; b=P5o1+vFhNIPL166shAnNc9tx+ulgj7N0NwukJpAp09ldWLsdpVfGTkl1As5o0TIN3b AmTmot84gbnt8Awj2MJzUM0sYl76jRDDeyfNvymz1cNOyQe7BJqxhzgOc3Mkdq8xBXW7 bIr0eWap6RNyHylUCZ/ZcxtYXzVWQGP4cOXF+BjkvcDM8RcLlrRC6mHdhJCw7XK7SpHv ophqGIoCumY6L/ByP2ZjNMy86wwLAQIZkxUZ3ynZXMcqhqoZ6vZti7bezPNHqDIJcTWo yvKYwbfUby/qhNe2+WObk41q1Cmh02ZGrYIbRxd3Z3MEED9TJk5vkk5aC4y2opvelfWf hryw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CKrenAfy; 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 j12-20020a056a00174c00b00580d9a62ab8si3825856pfc.184.2023.01.10.14.28.18; Tue, 10 Jan 2023 14:28:24 -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=CKrenAfy; 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 S234043AbjAJWGu (ORCPT + 53 others); Tue, 10 Jan 2023 17:06:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230389AbjAJWGr (ORCPT ); Tue, 10 Jan 2023 17:06:47 -0500 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1E3D260; Tue, 10 Jan 2023 14:06:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673388406; x=1704924406; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=LH+hHdI7o8TH5N1WCBGmYGRn+JJFqlj06ghwrzSCHBI=; b=CKrenAfypdP5CASLv9u/NZs+FnFfOV5pX0zSChq4qped+Y9NDOn1xiHE 75nyJo4OQnYjr+9FdXd0qL/nssadVB+Lwn23LmU2VfXT46VJPphFC/Pyf rA8M0GmzCkuB19yZpzDwV3/Y6sceYJwUhUenbgMs38n3riHypCRaMrz56 MYHCG14qbkCA73wwXwrJvpSl7lq/zwylmfZX3GCo+ZgZfhliY3yRQDziM ioLVz9+vlD0LhgtgIyazsHvNRnanjwVKJ71yi9M7MzZgconfDnDjrpCJG Ul2UgP/yHIGvs7jIExN8/oFbHxzV16bcSLAv1FPjHg16yNaEiWgPNrQWG g==; X-IronPort-AV: E=McAfee;i="6500,9779,10586"; a="409505779" X-IronPort-AV: E=Sophos;i="5.96,315,1665471600"; d="scan'208";a="409505779" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2023 14:06:46 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10586"; a="799588231" X-IronPort-AV: E=Sophos;i="5.96,315,1665471600"; d="scan'208";a="799588231" Received: from rhweight-wrk1.ra.intel.com ([137.102.106.43]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2023 14:06:45 -0800 Date: Tue, 10 Jan 2023 14:07:16 -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 v10 3/4] fpga: dfl: add basic support for DFHv1 In-Reply-To: Message-ID: References: <20230110003029.806022-1-matthew.gerlach@linux.intel.com> <20230110003029.806022-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 Tue, 10 Jan 2023, Andy Shevchenko wrote: > On Mon, Jan 09, 2023 at 04:30:28PM -0800, matthew.gerlach@linux.intel.com wrote: >> From: Matthew Gerlach >> >> Version 1 of the Device Feature Header (DFH) definition adds >> functionality to the Device Feature List (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 >> 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. > > ... > >> v10: change dfh_find_param to return size of parameter data in bytes > > The problem that might occur with this approach is byte ordering. > When we have u64 items, we know that they all are placed in CPU > ordering by the bottom layer. What's the contract now? Can it be > a problematic? Please double check this (always keep in mind BE32 > as most interesting case for u64/unsigned long representation and > other possible byte ordering outcomes). A number of u64 items certainly states explicit alignment of the memory, but I think byte ordering is a different issue. The bottom layer, by design, is still enforcing a number u64 items under the hood. So the contract has not changed. Changing units of size from u64s to bytes was suggested to match the general practice of size of memory being in bytes. I think the suggestion was made because the return type for dfh_find_param() changed from u64* to void* in version 9, when indirectly returning the size of the parameter data was introduced. So a void * with a size in bytes makes sense. On the other hand, returning a u64 * is a more precise reflection of the data alignment. I think the API should be as follows: /** * dfh_find_param() - find parameter block for the given parameter id * @dfl_dev: dfl device * @param_id: id of dfl parameter * @pcount: destination to store size of parameter data in u64 bit words * * Return: pointer to start of parameter data, PTR_ERR otherwise. */ u64 *dfh_find_param(struct dfl_device *dfl_dev, int param_id, size_t *pcount) Regarding byte ordering, Documentation/fpga/dfl.rst does not currently mention endianness. All current HW implementations of DFL are little-endian. I should add a statement in Documentation/fpga/dfl.rst that fields in the Device Feature Header are little-endian. Thanks for the feedback, Matthew Gerlach > > -- > With Best Regards, > Andy Shevchenko > > >