From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 561AF1D6B6; Tue, 16 Jan 2024 19:45:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705434311; cv=none; b=P3QLJL1D+zQqm+nuWNCGU++ON0QCxxqJNKPeGIBBkT7FOU1E6NjnqD74g7n8k6Po1DLhU6fYu7MLFTr3DMoL3GgfI/3KMub8U0HEh/15QA/du/+OBD8xbM5F6ssqtaHezLjKqBGbflt34AP6jQV/OIGgC8VbgLQmCbnSBQ9WmbI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705434311; c=relaxed/simple; bh=ql2tB1bfXiLvuvVl402J8WGwe62YD8CeU5u3fhLTl0w=; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID: X-Mailer:In-Reply-To:References:MIME-Version:X-stable: X-Patchwork-Hint:X-stable-base:Content-Transfer-Encoding; b=mRK1IQDPpobjBbJKxQ+Mo8ntc+gyDCZhbQvn7HriDjK35uS+m+38gg9P6KhDSNqwaCpBvpFES11X/P7Ez2+NRmSLjt80eNmUGf6x+QASyV+Vb4npGnoWKVEBnNoHJauoLcd5QA3BZcdXOSploNvH7WMqmAcf4xkqGrRl1Tlacg8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XI56+u7j; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XI56+u7j" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D926C433C7; Tue, 16 Jan 2024 19:45:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705434311; bh=ql2tB1bfXiLvuvVl402J8WGwe62YD8CeU5u3fhLTl0w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XI56+u7jOF7azVjnab6BNk12vyQIsaS7dHImFx9pwiaJBDOJieMwHTsSh2wFVICkN +pyCZdVcQy3HHtDr/JCbP6pzgfqYvuEtygIY3GkHuirUQVeIAIkDd8lv7mKPQCAc/Y IpUpejJftaoK99VWr5P5ZPlw7dpvrUzTzoZsm3KEvdB2j+27ywEY+Y1R9jjRCunSGy /E+I3e6niVUBRyeqbETAN3lJKQjIoUuGCy7VtKWPBlLHOCVHOOo/YV/mfCu9wWRyxM AcxUZfBTn/o+uG2oRY4zoHu7vUG219qhpFnVueb6PVZm+n2iGVUd/fxArkVRsw57Bh LJeY2f2hrSciw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Shannon Nelson , Brett Creeley , "David S . Miller" , Sasha Levin , drivers@pensando.io, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, allen.hubbe@amd.com, florian.fainelli@broadcom.com, yuehaibing@huawei.com, drc@linux.vnet.ibm.com, justinstitt@google.com, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 6.7 061/108] ionic: pass opcode to devcmd_wait Date: Tue, 16 Jan 2024 14:39:27 -0500 Message-ID: <20240116194225.250921-61-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116194225.250921-1-sashal@kernel.org> References: <20240116194225.250921-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.7 Content-Transfer-Encoding: 8bit From: Shannon Nelson [ Upstream commit 24f110240c03c6b5368f1203bac72883d511e606 ] Don't rely on the PCI memory for the devcmd opcode because we read a 0xff value if the PCI bus is broken, which can cause us to report a bogus dev_cmd opcode later. Signed-off-by: Shannon Nelson Reviewed-by: Brett Creeley Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/pensando/ionic/ionic_dev.c | 1 + drivers/net/ethernet/pensando/ionic/ionic_dev.h | 1 + drivers/net/ethernet/pensando/ionic/ionic_main.c | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_dev.c b/drivers/net/ethernet/pensando/ionic/ionic_dev.c index c06576f43916..22ab0a44fa8c 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_dev.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_dev.c @@ -321,6 +321,7 @@ void ionic_dev_cmd_comp(struct ionic_dev *idev, union ionic_dev_cmd_comp *comp) void ionic_dev_cmd_go(struct ionic_dev *idev, union ionic_dev_cmd *cmd) { + idev->opcode = cmd->cmd.opcode; memcpy_toio(&idev->dev_cmd_regs->cmd, cmd, sizeof(*cmd)); iowrite32(0, &idev->dev_cmd_regs->done); iowrite32(1, &idev->dev_cmd_regs->doorbell); diff --git a/drivers/net/ethernet/pensando/ionic/ionic_dev.h b/drivers/net/ethernet/pensando/ionic/ionic_dev.h index 9b5463040075..fd112bee4dcf 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_dev.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_dev.h @@ -153,6 +153,7 @@ struct ionic_dev { bool fw_hb_ready; bool fw_status_ready; u8 fw_generation; + u8 opcode; u64 __iomem *db_pages; dma_addr_t phy_db_pages; diff --git a/drivers/net/ethernet/pensando/ionic/ionic_main.c b/drivers/net/ethernet/pensando/ionic/ionic_main.c index 835577392178..1b547acfd8e9 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_main.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_main.c @@ -465,7 +465,7 @@ static int __ionic_dev_cmd_wait(struct ionic *ionic, unsigned long max_seconds, */ max_wait = jiffies + (max_seconds * HZ); try_again: - opcode = readb(&idev->dev_cmd_regs->cmd.cmd.opcode); + opcode = idev->opcode; start_time = jiffies; for (fw_up = ionic_is_fw_running(idev); !done && fw_up && time_before(jiffies, max_wait); -- 2.43.0