Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2320417pxm; Thu, 24 Feb 2022 22:44:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJwklpSCFQw0WVIVGss84RQNY4fZ0P4X7CtQpuMORvI8cuQbe3NeBkVwgjaEwOgqsTyMDUum X-Received: by 2002:a17:902:f602:b0:14f:53a8:64f7 with SMTP id n2-20020a170902f60200b0014f53a864f7mr6060530plg.151.1645771453846; Thu, 24 Feb 2022 22:44:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645771453; cv=none; d=google.com; s=arc-20160816; b=0CVury6Ianp4C4Y0x41lbTVh5Kk2WibfHtmWMQG9528Df18JUwWuphJE7eAN7aeCkA kOTSI00Rr23C4LI6tkmjZf8SMXRn/E7rB//Qpc6L6eOiUgp6KBt6aTIzZD2G4f3x0VnJ D3PDvAcYXBtMa+JHWYMY542c/qyel4bWE5zKO6EuEKXYuHvvszhJA+4DgsvDnWoEw7Td hdp2R8isHnN3IfVrxA10Y6BnEZpj1xH2Swvo9LO971go+Onfnu9kyX97HpdtTIElDI35 WW2WOS9+Xs9RQ5NYx6wJ1YcSpeitpBujC/j0dN5vmaF3I35T7wx32QiZ4FWurDVmPwnM UyUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NLQCkP0zdWFT47YjVZpSKIctu7GRMPRTRBBXrKyuiBc=; b=nhJAtyStFQcnSTW9rF8626/poD9NuphQoB895DNtEE/Zr0Ou8FPyEXmgxtb6qXtdCy 3iJ1p1pX3ZIq8m4OSm8Zk8JQsktZzy5CWuxXZVRHhCi2vkNfSC7QddH3N6pprRlzi2QK A+IJpveqv3x+MxgL5/wXtj5Ba0X0k9YpMFwyd2fNRHgBcX0bxbfptMsmAqTGLBEVS/V4 0mE7ygaLJLMjigDf/nr5yLmUxceBN6jSDl/Gfkx5Jv2g843OKzSQZaqbdA/18IsmjSO8 OXsK6EXTJU6ga1nfvIJZUHimry+CgQAZ+0/d4+9cBjgRU1NX+7GC9qWQ7f3k67dboj96 IS5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="DMgGq/Jz"; 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 k29-20020a63ba1d000000b00373dd4e9f5esi1112697pgf.873.2022.02.24.22.43.34; Thu, 24 Feb 2022 22:44:13 -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="DMgGq/Jz"; 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 S236969AbiBYDOA (ORCPT + 99 others); Thu, 24 Feb 2022 22:14:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236942AbiBYDNu (ORCPT ); Thu, 24 Feb 2022 22:13:50 -0500 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAB047DA91; Thu, 24 Feb 2022 19:13:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645758798; x=1677294798; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KdPQ6SeVdfaExi695kgdsiaNjw0SiA/pAv18ILKo/QM=; b=DMgGq/JzrK3Nq7ONjagHmKCGNUQCMwZoVzK3sNZ5FG88gMQqAvIEqfFX FgOE76eVlghnmQefikgXPkcfYhfD9R8kTQSZpTcQ4hQK7QzNKguszoLQ5 fjwBmR6fk9uA/xGKvCT1Yxj93rD1i7pHi8vX9fyYoYNI+IWvr2CDrJqZ2 ZP0vFzYCxdjfeE0CDVUHRyVXmTMsS0w0eUNLsAWFmjsO5QNco7PknQ60a W4srsR00e5nyYKYlsZJPTvYpSlEjuBggVfofnJLQ/dPHpCSAwiUj19dsY nJTvZGq6SLkhEJKLpepDFLDDHC5A/MYdIn/q4jGfjmkm8OVroyHcMNm5I w==; X-IronPort-AV: E=McAfee;i="6200,9189,10268"; a="252602990" X-IronPort-AV: E=Sophos;i="5.90,135,1643702400"; d="scan'208";a="252602990" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2022 19:13:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,135,1643702400"; d="scan'208";a="684512463" Received: from unknown (HELO localhost.localdomain.sh.intel.com) ([10.238.175.107]) by fmsmga001.fm.intel.com with ESMTP; 24 Feb 2022 19:13:16 -0800 From: Tianfei zhang To: hao.wu@intel.com, trix@redhat.com, mdf@kernel.org, yilun.xu@intel.com, linux-fpga@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: corbet@lwn.net, Tianfei zhang Subject: [PATCH v2 2/5] fpga: dfl: add features in dfl_fpga_cdev Date: Thu, 24 Feb 2022 22:09:59 -0500 Message-Id: <20220225031002.261264-3-tianfei.zhang@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20220225031002.261264-1-tianfei.zhang@intel.com> References: <20220225031002.261264-1-tianfei.zhang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 Introducing features in dfl_fpga_cdev during DFL enumeration. On IOFS, we will add more extensions or features in DFL in future, so adding a new member "features"in dfl_fpga_cdev. For example, in the legacy model, the AFU was connected to Port device, but in "multiple VFs per PR slot" model, the AFU or PR slot without connected to Port device directly, so in this model, we only can access the resource of AFU or PR slot via VFs. In this patch, we introducing a new flags DFL_FEAT_PORT_CONNECTED_AFU to distinguish them. Signed-off-by: Tianfei zhang --- drivers/fpga/dfl.c | 6 +++++- drivers/fpga/dfl.h | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c index 6bff39ff21a0..9b7a01a4af04 100644 --- a/drivers/fpga/dfl.c +++ b/drivers/fpga/dfl.c @@ -1130,6 +1130,7 @@ static void build_info_complete(struct build_feature_devs_info *binfo) static int parse_feature_fiu(struct build_feature_devs_info *binfo, resource_size_t ofst) { + struct dfl_fpga_cdev *cdev = binfo->cdev; int ret = 0; u32 offset; u16 id; @@ -1166,8 +1167,11 @@ static int parse_feature_fiu(struct build_feature_devs_info *binfo, v = readq(binfo->ioaddr + NEXT_AFU); offset = FIELD_GET(NEXT_AFU_NEXT_DFH_OFST, v); - if (offset) + if (offset) { + if (dfh_id_to_type(id) == PORT_ID) + cdev->features |= DFL_FEAT_PORT_CONNECTED_AFU; return parse_feature_afu(binfo, offset); + } dev_dbg(binfo->dev, "No AFUs detected on FIU %d\n", id); diff --git a/drivers/fpga/dfl.h b/drivers/fpga/dfl.h index 1fd493e82dd8..6171bcdcb3c5 100644 --- a/drivers/fpga/dfl.h +++ b/drivers/fpga/dfl.h @@ -461,6 +461,9 @@ int dfl_fpga_enum_info_add_irq(struct dfl_fpga_enum_info *info, unsigned int nr_irqs, int *irq_table); void dfl_fpga_enum_info_free(struct dfl_fpga_enum_info *info); +/* in legacy model, the AFU was connected to Port device */ +#define DFL_FEAT_PORT_CONNECTED_AFU BIT_ULL(0) + /** * struct dfl_fpga_cdev - container device of DFL based FPGA * @@ -470,6 +473,7 @@ void dfl_fpga_enum_info_free(struct dfl_fpga_enum_info *info); * @lock: mutex lock to protect the port device list. * @port_dev_list: list of all port feature devices under this container device. * @released_port_num: released port number under this container device. + * @features: features discovered during DFL enumeration. */ struct dfl_fpga_cdev { struct device *parent; @@ -478,6 +482,7 @@ struct dfl_fpga_cdev { struct mutex lock; struct list_head port_dev_list; int released_port_num; + u64 features; }; struct dfl_fpga_cdev * -- 2.26.2