]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ionic: pass opcode to devcmd_wait
authorShannon Nelson <shannon.nelson@amd.com>
Mon, 11 Dec 2023 18:57:57 +0000 (10:57 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Feb 2024 07:42:08 +0000 (08:42 +0100)
[ 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 <shannon.nelson@amd.com>
Reviewed-by: Brett Creeley <brett.creeley@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/pensando/ionic/ionic_dev.c
drivers/net/ethernet/pensando/ionic/ionic_dev.h
drivers/net/ethernet/pensando/ionic/ionic_main.c

index dc5fbc2704f3a3b4f3c37fddcb686a4ea7d804d9..b5f681918f6ee1e926da1359dfc80ec4a35ed6a0 100644 (file)
@@ -200,6 +200,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);
index 64d27e8e077253cc1b69a9782162124900ab129e..1ce0d307a9d0fb9398c6b2c80033d8fc8b6cc0d6 100644 (file)
@@ -136,6 +136,7 @@ struct ionic_dev {
        unsigned long last_hb_time;
        u32 last_hb;
        u8 last_fw_status;
+       u8 opcode;
 
        u64 __iomem *db_pages;
        dma_addr_t phy_db_pages;
index 00b6985edea0497bfc7b56fc37c6e5a4623ad725..694e710244e698fbff03bd0a8141e0701ed2a75f 100644 (file)
@@ -333,7 +333,7 @@ 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;
        do {
                done = ionic_dev_cmd_done(idev);