Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5697718pxb; Mon, 14 Feb 2022 05:37:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJxzlJl+5ZfIQPRMo+9GpyOQfcRtI1EXsU2z0K3ipueTB0xsFK3vjviVpBSAimg9/CGXzUpN X-Received: by 2002:a05:6a00:852:: with SMTP id q18mr14568798pfk.74.1644845876028; Mon, 14 Feb 2022 05:37:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644845876; cv=none; d=google.com; s=arc-20160816; b=x8I8SxGiQK8kE0LBu6tJqB6Dy22o/cZRYhS6EXIBC8lHenFE6s8YbvB/zSYuu+oVC+ vVd19ZDZvn1TQ5ENfS2Pc031eCV0W6TFSaF8AZmrtG73hnU3cHbV9UwVajtuAYaPanwH hzPXYSHm7sDLbF1GRpNjzlPO+HUstRA1SyHc8OLucBuWLxdLQjQ2fvOb38Jz0XO2+7Oi ig7XrEolgHiRXud2A4wWkEKwbKdb2bxhSo2jGbzfbYNH6S2eW+t920kc3UCRUKG9zFx1 jL4PZ3Lx8v1Rmyd5Pf1la5ux1W7V+BTkWNhZgRDm43hWSyB2Y0SC34PhS+0xWEDrZ8Or v8gQ== 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=qLiW2w9+z39d5Ss2vTmrtVEVe0tjDwzWkvpjh/cC4I8=; b=SFZU8xDomrjS+kBhsWDZfKWHy9+nEhfyKv3YGpqYjQ3rM4rEnderV/zgHzbkvcmQ2X lmoFTTbnuEGa8qrx6nTHvSHLU9bkLNrQBt0/wggM53DCd5aB0CBb4cOez8E+KDBAeTVT +N0weMVhMmNlohhaI5Gx15Xq2D6+lwJw7+Lio3q+LHZo7n71cP/6rkS26WAWMCPIOA4m ts6KSw6egfNxyKarjOH7E6LdkcouswCR8AW7FuN7gidyaXYdcdW+DxQW7RN0XcqF3zD8 nO523O9cdExiLdBnCZfGiEdhURA+hYBwVoTTxRGWWfOseKhcYE+jMsGoqsm97xi9p/Bo /S8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hwIot3nR; 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 n6si1059405plh.373.2022.02.14.05.37.39; Mon, 14 Feb 2022 05:37:56 -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=hwIot3nR; 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 S1352435AbiBNLjv (ORCPT + 99 others); Mon, 14 Feb 2022 06:39:51 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352013AbiBNLja (ORCPT ); Mon, 14 Feb 2022 06:39:30 -0500 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79E3CDE8B; Mon, 14 Feb 2022 03:29:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644838182; x=1676374182; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=L8LQgDjx0EOOe2M9p7V6FYObzOK0Cj9rYbobse8T9IQ=; b=hwIot3nRZlzQeibazRS60y4VaAjyAAxVFr6W6tB2unGRT68e1Gsxwn3h gSvb5kk2nM96FDGq4m17wKW2fz4uJWTtglYy9emUeGx6oA1m4pr4jeGD7 NdKVSmN/DQR9LVj4QCVsRKDjam5A7PqX2lpRL+oQ5txOAwqe1ozH3rOiF cEXFl9SAHIVKFAzJML2n4lfObyuw370OZD8VUy6jdrgEOsxSjpXt7xwYJ YffOIn0ATsEfBcya35jUGfVq0l7LUtPQ+m4d5yGBBAtstPnTsxL53SOUT KS0EN1TPzKy6YjWNsOZAaDjnDXPtzgQYcZdYbeqCmR3PwLyOdGa17FR1z g==; X-IronPort-AV: E=McAfee;i="6200,9189,10257"; a="250276735" X-IronPort-AV: E=Sophos;i="5.88,367,1635231600"; d="scan'208";a="250276735" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Feb 2022 03:29:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,367,1635231600"; d="scan'208";a="587167012" Received: from unknown (HELO localhost.localdomain.sh.intel.com) ([10.238.175.107]) by fmsmga008.fm.intel.com with ESMTP; 14 Feb 2022 03:29:39 -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, Matthew Gerlach , Tianfei Zhang Subject: [PATCH v1 3/7] fpga: dfl: Allow for ports with no local bar space. Date: Mon, 14 Feb 2022 06:26:15 -0500 Message-Id: <20220214112619.219761-4-tianfei.zhang@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20220214112619.219761-1-tianfei.zhang@intel.com> References: <20220214112619.219761-1-tianfei.zhang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.2 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 From: Matthew Gerlach From a fpga partial reconfiguration standpoint, a port may not be connected any local BAR space. The port could be connected to a different PCIe Physical Function (PF) or Virtual Function (VF), in which case another driver instance would manage the endpoint. Signed-off-by: Matthew Gerlach Signed-off-by: Tianfei Zhang --- drivers/fpga/dfl-pci.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/fpga/dfl-pci.c b/drivers/fpga/dfl-pci.c index 4d68719e608f..8abd9b408403 100644 --- a/drivers/fpga/dfl-pci.c +++ b/drivers/fpga/dfl-pci.c @@ -243,6 +243,7 @@ static int find_dfls_by_default(struct pci_dev *pcidev, v = readq(base + FME_HDR_CAP); port_num = FIELD_GET(FME_CAP_NUM_PORTS, v); + dev_info(&pcidev->dev, "port_num = %d\n", port_num); WARN_ON(port_num > MAX_DFL_FPGA_PORT_NUM); for (i = 0; i < port_num; i++) { @@ -258,6 +259,13 @@ static int find_dfls_by_default(struct pci_dev *pcidev, */ bar = FIELD_GET(FME_PORT_OFST_BAR_ID, v); offset = FIELD_GET(FME_PORT_OFST_DFH_OFST, v); + if (bar >= PCI_STD_NUM_BARS) { + dev_info(&pcidev->dev, "skipping port without local BAR space %d\n", + bar); + continue; + } else { + dev_info(&pcidev->dev, "BAR %d offset %u\n", bar, offset); + } start = pci_resource_start(pcidev, bar) + offset; len = pci_resource_len(pcidev, bar) - offset; -- 2.17.1