Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp2303899rwi; Fri, 21 Oct 2022 02:11:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7uYkMJSVi1DoQ1T1enw9Zvq45w8R89jNcjs2Sgpfby77JwCFary+H0IHAqBjZomcN5CeHZ X-Received: by 2002:aa7:8893:0:b0:563:89e0:2d43 with SMTP id z19-20020aa78893000000b0056389e02d43mr17698313pfe.25.1666343481067; Fri, 21 Oct 2022 02:11:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666343481; cv=none; d=google.com; s=arc-20160816; b=G5Y5rIeXDjq06hqN9HtrAprcr2Tgc4ILWG506QZCKvHh7OFX1cMdGJrcK8Aw7DSowi N9JJrzzQm87Xif7TNM9glbMtaKPqwhBlutk1xM4m2gsbEcaJUycg7KBgXLsEHuImuk2D mYHqE4cW8lITcjPXYM6ipomtPdsdOnzLILcCZ2xAa10Hr8nu64ml72wPIxPg9QZ6gbe8 I/qJJ+RA3tUiW2jTx7PsrUEq7HpAWY/wtb0Pgst9BsmuJ3iTkuc4ECMF2bbYAsTGHOzi Nje8gNoqssTWXuzB09rdYqCShQqQniw1aq3IqVOfc+xFCR6JeTVBCUEnYbbatz2Ivv3w zH5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=SwOp9LPuDwOtK7k7GRYl8zAr120Dh8QJ3niyg4Uzckk=; b=OBnYrjV3DCFlAcFlfQLMKbtwHgd16CBBCkis2yZoEKda2+ElsPbOVl179QpvF4nh5q 2MFUj7RQ5YyhTF3kH64sx7sFlgzzS+ZFyQICiWzHFcjzcYzyZZL7iEcgCeEJeROX4Che 10yTYD7zuDAKgtr8jM7ecBTaQN09Ssp9Yt46j2gyCUbZa+lwkZyay1kNKlIpxtmIp7W7 O2PH61VzKNrX4gEhje51zx9t197Vcyr6e9ccSNDzTv8HPho31gzEMMJaE7uVDUuK3iYu Ko3E19Knp2vzfjqmiznjMTr1Ge8MqWaA4MEpAFlLvLeMRI0hjLhkDKVLrDT53u+sT1fG ggaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=S4MlOm+f; 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 e2-20020a170902cf4200b001852d369de4si7071256plg.478.2022.10.21.02.11.09; Fri, 21 Oct 2022 02:11:21 -0700 (PDT) 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=S4MlOm+f; 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 S230483AbiJUI64 (ORCPT + 99 others); Fri, 21 Oct 2022 04:58:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230442AbiJUI6j (ORCPT ); Fri, 21 Oct 2022 04:58:39 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 682BD2514CD; Fri, 21 Oct 2022 01:58:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666342717; x=1697878717; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=MFsSrj3k9MJQ1OZ5lW1BWstRBTlDnFaSJtvAoGYuQ5w=; b=S4MlOm+f6brUzutaM9+SxCRtmzbyuEJA5AizMbf5QZ8CX+qjD5jQMSk2 yjBRQZQF2KAyHd5hBhB4so7mls5Q3pbQXjW54vyFvJ9/6HYs8CpzlFlG+ XXURwi2iyzERDQrlKnoNxGUdG93hgu3XPP4x/qygR/12mn9vDmyEQsXL7 XHV5o35bHyC6r4Xd1w9Xh10CZY7LVx7tQK9vvpvG2VmzPjsAmcWTKUnWe 6l9UJcNlPcYrWRcbD1b1chyllryM4W5nLtYw9bjAM2LI6ubUkcKRDvEYB ksIfvzQr189vHWo8nRhgER1nkQbGJ38H8eSd7wBW9VTa+OLK4D6qdhgF8 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10506"; a="371167243" X-IronPort-AV: E=Sophos;i="5.95,200,1661842800"; d="scan'208";a="371167243" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 01:58:23 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10506"; a="755697464" X-IronPort-AV: E=Sophos;i="5.95,200,1661842800"; d="scan'208";a="755697464" Received: from lramir2-mobl1.ger.corp.intel.com ([10.252.44.179]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 01:58:17 -0700 Date: Fri, 21 Oct 2022 11:58:14 +0300 (EEST) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Matthew Gerlach 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, LKML , tianfei.zhang@intel.com, corbet@lwn.net, Greg Kroah-Hartman , linux-serial , Jiri Slaby , geert+renesas@glider.be, Andy Shevchenko , niklas.soderlund+renesas@ragnatech.se, macro@orcam.me.uk, johan@kernel.org, Lukas Wunner , marpagan@redhat.com Subject: Re: [PATCH v4 3/4] fpga: dfl: add basic support DFHv1 In-Reply-To: <20221020212610.697729-4-matthew.gerlach@linux.intel.com> Message-ID: <97f6047-e364-8ae7-195c-4cf33c4b3ec7@linux.intel.com> References: <20221020212610.697729-1-matthew.gerlach@linux.intel.com> <20221020212610.697729-4-matthew.gerlach@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-4.5 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,URIBL_BLOCKED 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, 20 Oct 2022, matthew.gerlach@linux.intel.com wrote: > From: Matthew Gerlach > > Add generic support for MSI-X interrupts for DFL devices. > > The location of a feature's registers 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. > > Signed-off-by: Matthew Gerlach > --- > v4: s/MSIX/MSI_X > move kernel doc to implementation > use structure assignment > fix decode of absolute address > clean up comment in parse_feature_irqs > remove use of csr_res > > v3: remove unneeded blank line > use clearer variable name > pass finfo into parse_feature_irqs() > refactor code for better indentation > use switch statement for irq parsing > squash in code parsing register location > > v2: fix kernel doc > clarify use of DFH_VERSION field > --- > +static int dfh_get_psize(void __iomem *dfh_base, resource_size_t max) > +{ > + int size = 0; > + u64 v, next; > + > + if (!FIELD_GET(DFHv1_CSR_SIZE_GRP_HAS_PARAMS, > + readq(dfh_base + DFHv1_CSR_SIZE_GRP))) > + return 0; > + > + while (size + DFHv1_PARAM_HDR < max) { > + v = readq(dfh_base + DFHv1_PARAM_HDR + size); > + > + next = FIELD_GET(DFHv1_PARAM_HDR_NEXT_OFFSET, v); > + if (!(next & ~DFHv1_PARAM_HDR_NEXT_MASK)) In general, try to not use inverse logic for defining masks. However here, just change DFHv1_PARAM_HDR_NEXT_OFFSET to not include any extra bits (no rsvd nor eop) and you no longer need this extra masking. > + return -EINVAL; > + > + size += next & ~DFHv1_PARAM_HDR_NEXT_MASK; ...Then you can drop this anding too. > + > + if (next & DFHv1_PARAM_HDR_NEXT_EOL) Your docs say EOP, but here you use EOL. Change DFHv1_PARAM_HDR_NEXT_EOL such that this is extracted directly from v. -- i.