Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp18243rdb; Mon, 22 Jan 2024 10:27:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IEYD3d1f36ubiWG0y1jI5oT6MrniRqxByLjpDBhvKp1ofdE4GVAdHwKht27kQmvV0KalsyK X-Received: by 2002:a05:6402:51d3:b0:55c:72dd:5c7c with SMTP id r19-20020a05640251d300b0055c72dd5c7cmr115071edd.1.1705948047585; Mon, 22 Jan 2024 10:27:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705948047; cv=pass; d=google.com; s=arc-20160816; b=D/krQxYtiC8oXkoQtZkk0VnwcyIedGS8ipiQmqttUyWKBGj1LD9h7DEVfV2pK/Yg2E sqIApozmpikbLXRGSReSCOMLuva2dlaTJfx6itMdwUSuqk4AY44Ut0kIy7ZfHsIHaj4g fv1UAuxaUnkga4aI084MUDeX383+qMJhYpY0TtKN7RjbVPfrl/+xtqV159tw2K2mqU4z e5NJ4cSGfLNDygrw/EWe4GG2TRsvrOa86A2PR7n096WZkGAtbyq1+Rr+IBkCgjRtduaz TmWgKyJpl0eBnGTzfXtoA2f1k6yGFPSSsDpEM1ki9mE+wkQA9EfT9C8HI+CBepXLtTgT yHIA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=y4VFiwtw9rxDA2XrtJsXUpAuybVxqKTG4u6ahEZl2r8=; fh=BQSex8sXkxkjVEn1pKefhBTZBbfExckE2Rh7vRJdeEs=; b=Z6BcqOquqWvOEBB7+bw1F0u/op13Jl1k6KkqMT6VGIiSL4l3swvL4dogs8qAO/0Hyd TMp8c2Q3tYorPCL5Lx4OB64HzmW4oMQlHKsiVULp6wWCDJqg/6A4dloo4d9SOuMJeA18 gzmPoqIy8KoSAqshn+1wdYig2QxnnjJWA77Y3ZWOWVaVdoWH/tzMLEzoaG646YjRJMf0 mvH5lQcpBOkvcSFYcnH9RR2JCETjU2ueF8Dln65qplMBlpDRrJV0dl8b9bOZsMt9VEwr idYW3wX1c6bx2POfcx1Mm8lpzCtTt7TIG1ttmi7UlEGoueiUeluCBNpL3Po9VpEQ88Cs VtgA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mVwJlG54; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-33806-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33806-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id g19-20020a056402321300b0055a66d864c0si3812364eda.683.2024.01.22.10.27.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 10:27:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33806-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mVwJlG54; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-33806-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33806-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 9C4B01F2ED50 for ; Mon, 22 Jan 2024 18:02:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B6D076167A; Mon, 22 Jan 2024 17:24:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="mVwJlG54" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B5841612FE; Mon, 22 Jan 2024 17:24:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705944291; cv=none; b=ISbi4beL71C3q6xTOOmE7RNb2XReoHyzHoa4v8eaxJFY0brX8zBS8p92G0erK5XTK/dBo8PEaYEdwC5Wkj7gsShBYHnFiMyXD2yVvfuoq/IG1vDfwwKRtrNLIdqjzZfjUxBiLQUpMBR9Hqpvza4ZzvQw2KyyWkdFYAf9BZRnhmM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705944291; c=relaxed/simple; bh=NPdtl0n426XRja32Jxqcz/56e80Ebxi5CwNkSRmx1Zk=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=STcdt+5KNPNXEyjsYHpl1amxBvm9LolurrskT8wlNCyVZhxvrAjDZhCJFJndURHfokqADYgAZqr1U6wWC0mkWaYAk0MWg+ABfeMm4vvCmYLpmHNVht+C6B1Bk2zJoWtODlnOdij9db+MLzn1gPb/xLJjj6qzGRKWQm2tKqSYGZE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=mVwJlG54; arc=none smtp.client-ip=198.175.65.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1705944290; x=1737480290; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=NPdtl0n426XRja32Jxqcz/56e80Ebxi5CwNkSRmx1Zk=; b=mVwJlG543WZag8bwwyjTtnkcvC+0fE3F2BBjU2dBSxnSFQBFD6f+p4JA w3szMwh24AmgNrd6n3ARBgfnAygXk05pqXjOJj/hXwxeQQRi2XNLPLoSm 3bQkfT4TmivPI8BGk/1pbUAFTgvmoFtop4eGUU1f/phbC9BDWBBlzj0Ds gj4QtJ5JiNBkCWhfXLYM2ux8I4vkm8xCsPz7kFxRtDOa5ceta8OFZ8tbl 1ia7TU4N2qt1TtWY/Eo//YC6YNnvz8FWy2CWRQV7UiA2dNEvOXsjqEUuM 5dpPvw1eRO8Yxv+OYAVpv7VGPeptzd0nY1BAV4Is7Zt3z5hFSXqzMYoTC Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10961"; a="1150981" X-IronPort-AV: E=Sophos;i="6.05,211,1701158400"; d="scan'208";a="1150981" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2024 09:24:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,211,1701158400"; d="scan'208";a="1263457" Received: from sj-2308-osc3.sj.intel.com ([10.233.115.64]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2024 09:24:49 -0800 From: Matthew Gerlach 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 Subject: [PATCH] fpga: dfl: afu: update initialization of port_hdr driver Date: Mon, 22 Jan 2024 09:24:33 -0800 Message-Id: <20240122172433.537525-1-matthew.gerlach@linux.intel.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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