All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tianfei zhang <tianfei.zhang@intel.com>
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
Cc: linux-kernel@vger.kernel.org, corbet@lwn.net,
	Tianfei zhang <tianfei.zhang@intel.com>,
	Matthew Gerlach <matthew.gerlach@linux.intel.com>
Subject: [PATCH v3 3/5] fpga: dfl: fix VF creation in OFS
Date: Tue,  1 Mar 2022 01:21:21 -0500	[thread overview]
Message-ID: <20220301062123.818687-4-tianfei.zhang@intel.com> (raw)
In-Reply-To: <20220301062123.818687-1-tianfei.zhang@intel.com>

In OFS legacy model, there is only 1 Port device related to
1 VF, the flag DFL_FEAT_PORT_CONNECTED_AFU will take notes for
this model. In legacy model, it need to check the released port
number match VF device number or not. But in "Multiple VFs per
PR slot" model, the Port device would not connected to AFU/PR
slot, so we don't need to release the Port device before creating
the VFs.

Signed-off-by: Matthew Gerlach <matthew.gerlach@linux.intel.com>
Signed-off-by: Tianfei zhang <tianfei.zhang@intel.com>
---
 drivers/fpga/dfl.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c
index 5872031c2e9f..fd04ef5c8b03 100644
--- a/drivers/fpga/dfl.c
+++ b/drivers/fpga/dfl.c
@@ -1702,11 +1702,13 @@ int dfl_fpga_cdev_config_ports_vf(struct dfl_fpga_cdev *cdev, int num_vfs)
 
 	mutex_lock(&cdev->lock);
 	/*
-	 * can't turn multiple ports into 1 VF device, only 1 port for 1 VF
-	 * device, so if released port number doesn't match VF device number,
-	 * then reject the request with -EINVAL error code.
+	 * In the OFS legacy model, it can't turn multiple ports into 1 VF
+	 * device, because only 1 port conneced to 1 VF device, so if released
+	 * port number doesn't match VF device number, then reject the request
+	 * with -EINVAL error code.
 	 */
-	if (cdev->released_port_num != num_vfs) {
+	if ((cdev->features & DFL_FEAT_PORT_CONNECTED_AFU) &&
+	    cdev->released_port_num != num_vfs) {
 		ret = -EINVAL;
 		goto done;
 	}
-- 
2.26.2


  parent reply	other threads:[~2022-03-01  6:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-01  6:21 [PATCH v3 0/5] Add OFS support for DFL driver Tianfei zhang
2022-03-01  6:21 ` [PATCH v3 1/5] fpga: dfl: Allow for ports without specific bar space Tianfei zhang
2022-03-01  6:44   ` Wu, Hao
2022-03-01  6:50     ` Zhang, Tianfei
2022-03-01  6:21 ` [PATCH v3 2/5] fpga: dfl: add features in dfl_fpga_cdev Tianfei zhang
2022-03-01  6:59   ` Wu, Hao
2022-03-01  6:21 ` Tianfei zhang [this message]
2022-03-01  7:13   ` [PATCH v3 3/5] fpga: dfl: fix VF creation in OFS Wu, Hao
2022-03-01  6:21 ` [PATCH v3 4/5] fpga: dfl: Handle dfl's starting with AFU Tianfei zhang
2022-03-01  7:27   ` Wu, Hao
2022-03-02  2:42     ` Zhang, Tianfei
2022-03-01  6:21 ` [PATCH v3 5/5] Documentation: fpga: dfl: add description of OFS Tianfei zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220301062123.818687-4-tianfei.zhang@intel.com \
    --to=tianfei.zhang@intel.com \
    --cc=corbet@lwn.net \
    --cc=hao.wu@intel.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-fpga@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew.gerlach@linux.intel.com \
    --cc=mdf@kernel.org \
    --cc=trix@redhat.com \
    --cc=yilun.xu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.