Linux-FPGA Archive mirror
 help / color / mirror / Atom feed
From: Matthew Gerlach <matthew.gerlach@linux.intel.com>
To: hao.wu@intel.com, trix@redhat.com, mdf@kernel.org,
	yilun.xu@intel.com, linux-fpga@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: Matthew Gerlach <matthew.gerlach@linux.intel.com>
Subject: [PATCH] fpga: dfl: afu: update initialization of port_hdr driver
Date: Mon, 22 Jan 2024 09:24:33 -0800	[thread overview]
Message-ID: <20240122172433.537525-1-matthew.gerlach@linux.intel.com> (raw)

Revision 2 of the Device Feature List (DFL) Port feature has
slightly different requirements than revision 1. Revision 2
does not need the port to reset at driver startup. In fact,
performing a port reset during driver initialization can cause
driver race conditions when the port is connected to a different
PCIe Physical Function (PF) than the management PF performing
the actual port reset.

Signed-off-by: Matthew Gerlach <matthew.gerlach@linux.intel.com>
---
 drivers/fpga/dfl-afu-main.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/fpga/dfl-afu-main.c b/drivers/fpga/dfl-afu-main.c
index c0a75ca360d6..7d7f80cd264f 100644
--- a/drivers/fpga/dfl-afu-main.c
+++ b/drivers/fpga/dfl-afu-main.c
@@ -417,7 +417,18 @@ static const struct attribute_group port_hdr_group = {
 static int port_hdr_init(struct platform_device *pdev,
 			 struct dfl_feature *feature)
 {
-	port_reset(pdev);
+	void __iomem *base;
+	u8 rev;
+
+	base = dfl_get_feature_ioaddr_by_id(&pdev->dev, PORT_FEATURE_ID_HEADER);
+
+	rev = dfl_feature_revision(base);
+
+	if (rev < 2)
+		port_reset(pdev);
+
+	if (rev > 2)
+		dev_info(&pdev->dev, "unexpected port feature revision, %u\n", rev);
 
 	return 0;
 }
-- 
2.34.1


             reply	other threads:[~2024-01-22 17:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-22 17:24 Matthew Gerlach [this message]
2024-01-23  2:20 ` [PATCH] fpga: dfl: afu: update initialization of port_hdr driver Xu Yilun
2024-01-24 19:40   ` matthew.gerlach
2024-01-30  9:35     ` Xu Yilun
2024-01-30 17:13       ` matthew.gerlach
2024-01-31  4:59         ` Xu Yilun
2024-01-31 23:53           ` matthew.gerlach
2024-02-05  2:51             ` Xu Yilun
2024-02-05 23:30               ` matthew.gerlach

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=20240122172433.537525-1-matthew.gerlach@linux.intel.com \
    --to=matthew.gerlach@linux.intel.com \
    --cc=hao.wu@intel.com \
    --cc=linux-fpga@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).