linux-fpga.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fpga: dfl: afu: update initialization of port_hdr driver
@ 2024-01-22 17:24 Matthew Gerlach
  2024-01-23  2:20 ` Xu Yilun
  0 siblings, 1 reply; 9+ messages in thread
From: Matthew Gerlach @ 2024-01-22 17:24 UTC (permalink / raw)
  To: hao.wu, trix, mdf, yilun.xu, linux-fpga, linux-kernel; +Cc: Matthew Gerlach

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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-02-05 23:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-22 17:24 [PATCH] fpga: dfl: afu: update initialization of port_hdr driver Matthew Gerlach
2024-01-23  2:20 ` 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

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 NNTP newsgroup(s).