FAILED: patch "[PATCH] ata: libahci: clear pending interrupt status" failed to apply to 4.14-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-4.14.y
git checkout FETCH_HEAD
git cherry-pick -x 737dd811a3dbfd7edd4ad2ba5152e93d99074f83
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2023092019-aptitude-device-3909@gregkh' --subject-prefix 'PATCH 4.14.y' HEAD^..
Possible dependencies:
737dd811a3db ("ata: libahci: clear pending interrupt status")93c7711494f4 ("ata: ahci: Drop pointless VPRINTK() calls and convert the remaining ones")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 737dd811a3dbfd7edd4ad2ba5152e93d99074f83 Mon Sep 17 00:00:00 2001
From: Szuying Chen <[email protected]>
Date: Thu, 7 Sep 2023 16:17:10 +0800
Subject: [PATCH] ata: libahci: clear pending interrupt status
When a CRC error occurs, the HBA asserts an interrupt to indicate an interface fatal error (PxIS.IFS). The ISR clears PxIE and PxIS, then does error recovery. If the adapter receives another SDB FIS with an error (PxIS.TFES) from the device before the start of the EH recovery process, the interrupt signaling the new SDB cannot be serviced as PxIE was cleared already. This in turn results in the HBA inability to issue any command during the error recovery process after setting PxCMD.ST to 1 because PxIS.TFES is still set.
According to AHCI 1.3.1 specifications section 6.2.2, fatal errors notified by setting PxIS.HBFS, PxIS.HBDS, PxIS.IFS or PxIS.TFES will cause the HBA to enter the ERR:Fatal state. In this state, the HBA shall not issue any new commands.
To avoid this situation, introduce the function ahci_port_clear_pending_irq() to clear pending interrupts before executing a COMRESET. This follows the AHCI 1.3.1 - section 6.2.2.2 specification.
drivers/ata/libahci.c +23 -12
@@ -1256,6 +1256,26 @@ static ssize_t ahci_activity_show(struct ata_device *dev, char *buf)return sprintf (buf,"%d\n" , emp->blink_policy); } +static void ahci_port_clear_pending_irq (struct ata_port *ap) +{ +struct ahci_host_priv *hpriv = ap->host->private_data; +void __iomem *port_mmio =ahci_port_base (ap); +u32 tmp; + +/* clear SError */ + tmp =readl (port_mmio +PORT_SCR_ERR ); +dev_dbg (ap->host->dev,"PORT_SCR_ERR 0x%x\n" , tmp); +writel (tmp, port_mmio +PORT_SCR_ERR ); + +/* clear port IRQ */ + tmp =readl (port_mmio +PORT_IRQ_STAT ); +dev_dbg (ap->host->dev,"PORT_IRQ_STAT 0x%x\n" , tmp); +if (tmp) +writel (tmp, port_mmio +PORT_IRQ_STAT ); + +writel (1 << ap->port_no, hpriv->mmio +HOST_IRQ_STAT ); +} +static void ahci_port_init (struct device *dev,struct ata_port *ap,int port_no,void __iomem *mmio,void __iomem *port_mmio)
@@ -1270,18 +1290,7 @@ static void ahci_port_init(struct device *dev, struct ata_port *ap,if (rc)dev_warn (dev,"%s (%d)\n" , emsg, rc); -/* clear SError */ - tmp =readl (port_mmio +PORT_SCR_ERR ); -dev_dbg (dev,"PORT_SCR_ERR 0x%x\n" , tmp); -writel (tmp, port_mmio +PORT_SCR_ERR ); - -/* clear port IRQ */ - tmp =readl (port_mmio +PORT_IRQ_STAT ); -dev_dbg (dev,"PORT_IRQ_STAT 0x%x\n" , tmp); -if (tmp) -writel (tmp, port_mmio +PORT_IRQ_STAT ); - -writel (1 << port_no, mmio +HOST_IRQ_STAT ); +ahci_port_clear_pending_irq (ap);/* mark esata ports */ tmp =readl (port_mmio +PORT_CMD );
@@ -1603,6 +1612,8 @@ int ahci_do_hardreset(struct ata_link *link, unsigned int *class, tf.status =ATA_BUSY ;ata_tf_to_fis (&tf,0 ,0 , d2h_fis); +ahci_port_clear_pending_irq (ap); + rc =sata_link_hardreset (link, timing, deadline, online, ahci_check_ready);
Quoted 15 lines · On Wed, Sep 20, 2023 at 11:57:19AM +0200, [email protected] wrote:
The patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-4.14.y
git checkoutFETCH_HEAD
git cherry-pick -x737dd811a3dbfd7edd4ad2ba5152e93d99074f83
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2023092019-aptitude-device-3909@gregkh' --subject-prefix 'PATCH 4.14.y' HEAD^..
Quoted 8 lines
Possible dependencies:
737dd811a3db("ata: libahci: clear pending interrupt status")93c7711494f4("ata: ahci: Drop pointlessVPRINTK()calls and convert the remaining ones")thanks,
greg k-h
Hello Greg,
Seeing that this fix failed to be backported to 4.14, 4.19, 5.4, 5.10 and 5.15, simply because of a single pointless VPRINTK() call,
may I suggest that we cherry-pick this very small dependency commit:
93c7711494f4 ("ata: ahci: Drop pointless VPRINTK() calls and convert the remaining ones") for all the stable kernels listed above.
After that, the original git commit can be cherry-picked to all stable kernels listed above without conflicts.
Kind regards,
Niklas
Quoted 31 lines · Niklas Cassel
Quoted 15 lines · On Wed, Sep 20, 2023 at 11:57:19AM +0200, [email protected] wrote:
The patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-4.14.y
git checkoutFETCH_HEAD
git cherry-pick -x737dd811a3dbfd7edd4ad2ba5152e93d99074f83
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2023092019-aptitude-device-3909@gregkh' --subject-prefix 'PATCH 4.14.y' HEAD^..Quoted 8 lines
Possible dependencies:
737dd811a3db("ata: libahci: clear pending interrupt status")93c7711494f4("ata: ahci: Drop pointlessVPRINTK()calls and convert the remaining ones")thanks,
greg k-h
Hello Greg,
Seeing that this fix failed to be backported to 4.14, 4.19, 5.4, 5.10 and 5.15, simply because of a single pointless
VPRINTK()call,
may I suggest that we cherry-pick this very small dependency commit:
Quoted 5 lines
93c7711494f4("ata: ahci: Drop pointlessVPRINTK()calls and convert the remaining ones") for all the stable kernels listed above.After that, the original git commit can be cherry-picked to all stable kernels listed above without conflicts.
Hello Greg,
Any comments on this?
Kind regards,
Niklas