Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3756215rwb; Fri, 30 Sep 2022 07:58:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6w1XTJ/QfAl7tanVbrlJV+ydFUMLebXm3k2VNxv5maHxBk7UJ5uyfE1BIJAFJZN+PZiBi+ X-Received: by 2002:a17:906:fe0a:b0:76f:e373:d84b with SMTP id wy10-20020a170906fe0a00b0076fe373d84bmr6739210ejb.297.1664549926146; Fri, 30 Sep 2022 07:58:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664549926; cv=none; d=google.com; s=arc-20160816; b=utgnOrBAFmTZnv1a8LYC/eZfZYSlLM5duOHXWzP5McbF0KZiy1zWblQ6awkNQYXTxd aJUOdoEPgleOCbdppkkfp9+gE6ah7oYi4BkDX4tL/46vymnxdBIIEiJ+nmgh5+Ixi4gB wN0C7MBv8r69liwYuMcoD+THlZ+Hfgrd9z54yTAEZsgyLvxfGMl/MtRMWjaOphLUgagV LLrv/mJC6bzMZ/cIyvhDQDMl5Xnomicufl23U9QF73pZ9kHFbnzXZRJ5b+NrDTf/vBM+ YM6LrJMbNDKpS/fJMm4kZ6oNZU5kvU/dBMyuts4xJQu4zDlxjcuzcSQnWwxUJo56l28N ZXiA== 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=Xx1bq85C5cFYcqIshEkRwRsIIXYaqjnQER+Zdcea9Vg=; b=NsxxQZ6RYKxFA/KjIkNCw2tyf1dh9d+awuaTd8BYZMLOGf0wvGCDF1wDmdiuwW8RPu FDXFHeu9QdcEj3l02ZP122venor8xvmCEqWzwd7yULwjvVQJkZns8NrjbZN9EsVTlkMD IigvD7POv2k2kci40AEoKFpu34/GzstiGvA0i0ndtLwf2jXpSsRQA1Stj08DX0PklvJI ZJ8hWtYHpfimQ9AoFtY+IYKGttBEzdhzJwlihtZ5rE1I1l+5nxSdKo1bp1b4CWILPw8j yH/UoO1HGIpbpzHjNMJjWdGmVKsTUiaKCcrI+0Q8w5RxxQTjcq5CdNzSXl9mx4n4yhCT uvVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TCytLOFK; 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 k21-20020aa7d8d5000000b00456f739cf5bsi1866726eds.470.2022.09.30.07.58.21; Fri, 30 Sep 2022 07:58:46 -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=TCytLOFK; 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 S231771AbiI3OKS (ORCPT + 99 others); Fri, 30 Sep 2022 10:10:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230363AbiI3OKN (ORCPT ); Fri, 30 Sep 2022 10:10:13 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C8E336405; Fri, 30 Sep 2022 07:10:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664547008; x=1696083008; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=YXEUeoO6/hYWuwTpFS0HnvKZYn5bRmmE1JqrdtO1JmE=; b=TCytLOFK70Iae1ixY0UQenUcNkRG3Qm9LagaBgFwurLZ2tnvjATTvc+Q nUkNht/f2GyfkZCSmG7kCD+3bAwPOY4Y/2Wv+KtMskNKs+eK1O2SBHOy2 N54GdJFqd/Ez0SLS8zdRyn8HzKhmgbV1jDAFhmBa2AqkXXgd4jX4x0CGG 73MDv+kRNRt0dcjWR67NYlliMVgAOIMrCE62fUZugd4gUmKdYcOP0A7JG NamMCT48aDd4PaT0ngYAeerjggkOxkq/H9ziUrV7OFXT5umOFnsC7Jb5v ZMoI7JXg1TbFQJ5RvabxAEY7O1RBrO697O5N3GBqK1PZPyMF/wl5UcbSJ g==; X-IronPort-AV: E=McAfee;i="6500,9779,10486"; a="300915273" X-IronPort-AV: E=Sophos;i="5.93,358,1654585200"; d="scan'208";a="300915273" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Sep 2022 07:09:46 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10486"; a="622779244" X-IronPort-AV: E=Sophos;i="5.93,358,1654585200"; d="scan'208";a="622779244" Received: from rhweight-wrk1.ra.intel.com ([137.102.106.139]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Sep 2022 07:09:46 -0700 Date: Fri, 30 Sep 2022 07:09:57 -0700 (PDT) From: matthew.gerlach@linux.intel.com X-X-Sender: mgerlach@rhweight-WRK1 To: Tom Rix cc: hao.wu@intel.com, yilun.xu@intel.com, russell.h.weight@intel.com, basheer.ahmed.muddebihal@intel.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, andriy.shevchenko@linux.intel.com, niklas.soderlund+renesas@ragnatech.se, phil.edworthy@renesas.com, macro@orcam.me.uk, johan@kernel.org, lukas@wunner.de, Basheer Ahmed Muddebihal Subject: Re: [PATCH v2 2/6] fpga: dfl: Move the DFH definitions In-Reply-To: <36342784-34c3-6a08-7cd4-eb185b61061a@redhat.com> Message-ID: References: <20220923121745.129167-1-matthew.gerlach@linux.intel.com> <20220923121745.129167-3-matthew.gerlach@linux.intel.com> <36342784-34c3-6a08-7cd4-eb185b61061a@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 X-Spam-Status: No, score=-4.4 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 Sat, 24 Sep 2022, Tom Rix wrote: > > On 9/23/22 5:17 AM, matthew.gerlach@linux.intel.com wrote: >> From: Basheer Ahmed Muddebihal >> >> Moving the DFH register offset and register definitions from >> drivers/fpga/dfl.h to include/linux/dfl.h. These definitions >> need to be accessed by dfl drivers that are outside of >> drivers/fpga. > > This comment does not match what is done. > > A move, a change in names and the introduction new defines. > > I am not sure if moving these #defines is the best approach, the later use of > the in the uart with FIELD_GET's i think should be wrapped as functions and > these functions exported rather than the #defines. > > So split this patch and justify why #defines are added to the user's > includes. > > Tom I agree the original intent "diverged in v2". I will minimize moving and make helper functions to simplify things. > >> >> Signed-off-by: Basheer Ahmed Muddebihal >> >> Signed-off-by: Matthew Gerlach >> --- >> v2: remove extra space in commit >> use uniform number of digits in constants >> don't change copyright date because of removed content >> --- >> drivers/fpga/dfl-afu-main.c | 4 ++-- >> drivers/fpga/dfl.c | 2 +- >> drivers/fpga/dfl.h | 20 +------------------- >> include/linux/dfl.h | 33 ++++++++++++++++++++++++++++++++- >> 4 files changed, 36 insertions(+), 23 deletions(-) >> >> diff --git a/drivers/fpga/dfl-afu-main.c b/drivers/fpga/dfl-afu-main.c >> index 7f621e96d3b8..c26961ee33db 100644 >> --- a/drivers/fpga/dfl-afu-main.c >> +++ b/drivers/fpga/dfl-afu-main.c >> @@ -468,8 +468,8 @@ afu_id_show(struct device *dev, struct device_attribute >> *attr, char *buf) >> return -EBUSY; >> } >> - guidl = readq(base + GUID_L); >> - guidh = readq(base + GUID_H); >> + guidl = readq(base + DFH_GUID_L); >> + guidh = readq(base + DFH_GUID_H); >> mutex_unlock(&pdata->lock); >> return scnprintf(buf, PAGE_SIZE, "%016llx%016llx\n", guidh, guidl); >> diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c >> index b9aae85ba930..1132f3c10440 100644 >> --- a/drivers/fpga/dfl.c >> +++ b/drivers/fpga/dfl.c >> @@ -1163,7 +1163,7 @@ static int parse_feature_fiu(struct >> build_feature_devs_info *binfo, >> * find and parse FIU's child AFU via its NEXT_AFU register. >> * please note that only Port has valid NEXT_AFU pointer per spec. >> */ >> - v = readq(binfo->ioaddr + NEXT_AFU); >> + v = readq(binfo->ioaddr + DFH_NEXT_AFU); >> offset = FIELD_GET(NEXT_AFU_NEXT_DFH_OFST, v); >> if (offset) >> diff --git a/drivers/fpga/dfl.h b/drivers/fpga/dfl.h >> index 06cfcd5e84bb..e620fcb02b5a 100644 >> --- a/drivers/fpga/dfl.h >> +++ b/drivers/fpga/dfl.h >> @@ -17,6 +17,7 @@ >> #include >> #include >> #include >> +#include >> #include >> #include >> #include >> @@ -53,28 +54,9 @@ >> #define PORT_FEATURE_ID_UINT 0x12 >> #define PORT_FEATURE_ID_STP 0x13 >> -/* >> - * Device Feature Header Register Set >> - * >> - * For FIUs, they all have DFH + GUID + NEXT_AFU as common header >> registers. >> - * For AFUs, they have DFH + GUID as common header registers. >> - * For private features, they only have DFH register as common header. >> - */ >> -#define DFH 0x0 >> -#define GUID_L 0x8 >> -#define GUID_H 0x10 >> -#define NEXT_AFU 0x18 >> - >> -#define DFH_SIZE 0x8 >> - >> /* Device Feature Header Register Bitfield */ >> -#define DFH_ID GENMASK_ULL(11, 0) /* Feature ID >> */ >> #define DFH_ID_FIU_FME 0 >> #define DFH_ID_FIU_PORT 1 >> -#define DFH_REVISION GENMASK_ULL(15, 12) /* Feature revision >> */ >> -#define DFH_NEXT_HDR_OFST GENMASK_ULL(39, 16) /* Offset to next DFH >> */ >> -#define DFH_EOL BIT_ULL(40) /* End of >> list */ >> -#define DFH_TYPE GENMASK_ULL(63, 60) /* Feature type */ >> #define DFH_TYPE_AFU 1 >> #define DFH_TYPE_PRIVATE 3 >> #define DFH_TYPE_FIU 4 >> diff --git a/include/linux/dfl.h b/include/linux/dfl.h >> index 431636a0dc78..33d167c53b09 100644 >> --- a/include/linux/dfl.h >> +++ b/include/linux/dfl.h >> @@ -2,7 +2,7 @@ >> /* >> * Header file for DFL driver and device API >> * >> - * Copyright (C) 2020 Intel Corporation, Inc. >> + * Copyright (C) 2020-2022 Intel Corporation, Inc. >> */ >> #ifndef __LINUX_DFL_H >> @@ -11,6 +11,37 @@ >> #include >> #include >> +/* >> + * Device Feature Header Register Set >> + * >> + * For FIUs, they all have DFH + GUID + NEXT_AFU as common header >> registers. >> + * For AFUs, they have DFH + GUID as common header registers. >> + * For private features, they only have DFH register as common header. >> + */ >> +#define DFH 0x00 >> +#define DFH_GUID_L 0x08 >> +#define DFH_GUID_H 0x10 >> +#define DFH_NEXT_AFU 0x18 >> + >> +/* >> + * DFHv1 Register Offset definitons >> + * In DHFv1, DFH + GUID + CSR_START + CSR_SIZE_GROUP + PARAM_HDR + >> PARAM_DATA >> + * as common header registers >> + */ >> +#define DFHv1_CSR_ADDR 0x18 /* CSR Register start address >> */ >> +#define DFHv1_CSR_SIZE_GRP 0x20 /* Size of Reg Block and Group/tag */ >> +#define DFHv1_PARAM_HDR 0x28 /* Optional First Param header >> */ >> +#define DFHv1_PARAM_DATA 0x08 /* Offset of Param data from Param >> header */ >> + >> +#define DFH_SIZE 0x08 >> + >> +/* Device Feature Header Register Bitfield */ >> +#define DFH_ID GENMASK_ULL(11, 0) /* Feature ID >> */ >> +#define DFH_REVISION GENMASK_ULL(15, 12) /* Feature revision >> */ >> +#define DFH_NEXT_HDR_OFST GENMASK_ULL(39, 16) /* Offset to next DFH >> */ >> +#define DFH_EOL BIT_ULL(40) /* End of >> list */ >> +#define DFH_TYPE GENMASK_ULL(63, 60) /* Feature type */ >> + >> /** >> * enum dfl_id_type - define the DFL FIU types >> */ > >