Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp3503233pxm; Mon, 28 Feb 2022 22:41:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJzDy2prr+7szoY3PGtgRIVArbDGn8ALvU3Eduv0enAKSUl0P8eMICyKf/DRzcoRJh3/1MMU X-Received: by 2002:a63:fb44:0:b0:372:9ec8:745a with SMTP id w4-20020a63fb44000000b003729ec8745amr20651927pgj.551.1646116914115; Mon, 28 Feb 2022 22:41:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646116914; cv=none; d=google.com; s=arc-20160816; b=hIn9kZfPI+AC6YcRdJ66ofmkID7lae6RrE9ZvWe74gEOzbckwqQb4kA/fNhqW6F+Q2 f8PtgGFiRD/W3+drO4L2dZ3sriKWJq+FnZPj52Rt46MBFl/xgEyireS2+fXb4JYOcDeM ncJq4lCMQPk6gyyjtGrTi7A/AaKkyrRWN24m9scI2VaIOM0dfwhaDs90iL3c1YO5piMF DV/Chq6YDDPzEhnscG8ySoVQni1P0UMe4mgMxs7HvOu5Sn6/WTz1R+dK/Lh7O+/mGVFh Ol0okN+lLRKhcQIdhekPjcxyRN1KnS8jvJtKKQBrLs7wn12j9roNIxZQ32p8qNasCiPd czlg== 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=Ya5FsZp48R3VisjD3yEj7LAZhIsPAPQIJCHlMVmhXBc=; b=xJ3w+2tcDMOeExb4MTGdjij9cqDghioMkS/UV0Yjcbhr4FN7Nin6Qmd6UN7MK/n6rl Zo36ZVYfmmQLx+n7SKjLuNglGozHwfqdWcO+W4pU5UiQ6k6ulOGxNPOTmsUR2JUS+J7w 3NdS9psFZuE3Swm+3b3MpeD2Ow0Xm2KUydCr1KSbWgcnzJM6GhBV/JZo1KGRJ5OouI8v G7ijmItHTcxwr/Tn1sz9FFW2gg8tdvVDxhJWm+t9tKpZshpFeisU8QMxPPD045z52gDm 4n1qrtDDmFygfycaUIHE9+cV3VH6glC6BbWQCn5MZu0EE5WQYFXrDf4S73h0v6EgK3TK CWmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=HSdvxiPf; 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 m10-20020a656a0a000000b003745fd0bb24si14082240pgu.494.2022.02.28.22.41.39; Mon, 28 Feb 2022 22:41:54 -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=HSdvxiPf; 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 S232623AbiCAGZi (ORCPT + 99 others); Tue, 1 Mar 2022 01:25:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232637AbiCAGZf (ORCPT ); Tue, 1 Mar 2022 01:25:35 -0500 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAC2171C8B; Mon, 28 Feb 2022 22:24:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646115892; x=1677651892; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=24p7OOw6w729bcrujGtk33vHmfAenl7pX1TqgA5rAzs=; b=HSdvxiPf9upVZaKwKJI66Mi8R9OhyrzKRF4Z4h99EFO66IYJBDmgTmbe vBxktTDfMBXCjh87Svugr7oMuUtcA+daq/ab/xqTqPhLL1hvvNF9s7Afx lfIUhpz/as2thnnUJMdqxzLRQtvSt8rZ/Fbe4rSiW7PVP9q0MdUpiy9UF JsC/JH0C6fmIqZX2qwiJWWalR2SbtoO3ZE33G0qL22nQ4PGSphvOB3WGK VpdMAB/TSwdV8gPe5NPBjQ/jGMC73IBg+Mtq+K7zGLzn4zUZppyWdBnf8 5fvRhVJYhCGPCVI5UO5Oj4UbfOuoTLLm/WhOILCoUKOoaTPuVn7b+dcQz Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10272"; a="251900319" X-IronPort-AV: E=Sophos;i="5.90,145,1643702400"; d="scan'208";a="251900319" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Feb 2022 22:24:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,145,1643702400"; d="scan'208";a="708941766" Received: from unknown (HELO localhost.localdomain.sh.intel.com) ([10.238.175.107]) by orsmga005.jf.intel.com with ESMTP; 28 Feb 2022 22:24:42 -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 Cc: linux-kernel@vger.kernel.org, corbet@lwn.net, Tianfei zhang , Matthew Gerlach Subject: [PATCH v3 3/5] fpga: dfl: fix VF creation in OFS Date: Tue, 1 Mar 2022 01:21:21 -0500 Message-Id: <20220301062123.818687-4-tianfei.zhang@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20220301062123.818687-1-tianfei.zhang@intel.com> References: <20220301062123.818687-1-tianfei.zhang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 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 Signed-off-by: Tianfei zhang --- 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