sata_mv: don't avoid clearing interrupt status on SoC host adapters
RFC PATCH 1/1 sata_mv: don't avoid clearing interrupt status on SoC host adapters
For some reason, sata_mv doesn't clear interrupt status during init when it's running on an SoC host adapter. If the bootloader has touched the SATA controller before starting Linux, Linux can end up enabling the SATA interrupt with events pending, which will cause the interrupt to be marked as spurious and then be disabled, which then breaks all further accesses to the controller.
This patch makes the SoC path clear interrupt status on init like in the non-SoC case.
--- drivers/ata/sata_mv.c | 21 ++++++++++----------- 1 files changed, 10 insertions(+), 11 deletions(-)
drivers/ata/sata_mv.c +10 -11
@@ -3131,19 +3131,18 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx)writelfl (0 , hc_mmio +HC_IRQ_CAUSE_OFS ); } -if (!IS_SOC (hpriv)) { -/* Clear any currently outstanding host interrupt conditions */ -writelfl (0 , mmio + hpriv->irq_cause_ofs); +/* Clear any currently outstanding host interrupt conditions */ +writelfl (0 , mmio + hpriv->irq_cause_ofs); -/* and unmask interrupt generation for host regs */ -writelfl (hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs); +/* and unmask interrupt generation for host regs */ +writelfl (hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs); + +/* +* enable only global host interrupts for now. +* The per-port interrupts get done later as ports are set up. +*/ +mv_set_main_irq_mask (host,0 ,PCI_ERR ); -/* -* enable only global host interrupts for now. -* The per-port interrupts get done later as ports are set up. -*/ -mv_set_main_irq_mask (host,0 ,PCI_ERR ); - } done:return rc; }
Signature · 1 line
1.5.6.4
Quoted 39 lines · Lennert Buytenhek
For some reason,
sata_mvdoesn't clear interrupt status during init when it's running on an SoC host adapter. If the bootloader has touched the SATA controller before starting Linux, Linux can end up enabling the SATA interrupt with events pending, which will cause the interrupt to be marked as spurious and then be disabled, which then breaks all further accesses to the controller.This patch makes the SoC path clear interrupt status on init like in the non-SoC case.
Signed-off-by Lennert Buytenhek <[email protected]>--- drivers/ata/sata_mv.c | 21 ++++++++++----------- 1 files changed, 10 insertions(+), 11 deletions(-)drivers/ata/sata_mv.c +10
-5@@ -3131,19 +3131,18 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx)writelfl (0 , hc_mmio +HC_IRQ_CAUSE_OFS ); } -if (!IS_SOC (hpriv)) { -/* Clear any currently outstanding host interrupt conditions */ -writelfl (0 , mmio + hpriv->irq_cause_ofs); +/* Clear any currently outstanding host interrupt conditions */ +writelfl (0 , mmio + hpriv->irq_cause_ofs); -/* and unmask interrupt generation for host regs */ -writelfl (hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs); +/* and unmask interrupt generation for host regs */ +writelfl (hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs); + +/* +* enable only global host interrupts for now. +* The per-port interrupts get done later as ports are set up. +*/ +mv_set_main_irq_mask (host,0 ,PCI_ERR );
drivers/ata/sata_mv.c static int mv_init_host(struct ata_host *host, unsigned int board_idx) · line 3148
Quoted 10 lines
drivers/ata/sata_mv.c +0
-6-/* -* enable only global host interrupts for now. -* The per-port interrupts get done later as ports are set up. -*/ -mv_set_main_irq_mask (host,0 ,PCI_ERR ); - } done:return rc; }
Looks fine to me -- Saeed Bishara did the SOC stuff, and Marvell refuses to show me any documentation for it. So if it works for you, then let's put it in there. Or maybe get Saeed's sign-off first.
Cheers
Quoted 39 lines · Lennert Buytenhek
For some reason,
sata_mvdoesn't clear interrupt status during init when it's running on an SoC host adapter. If the bootloader has touched the SATA controller before starting Linux, Linux can end up enabling the SATA interrupt with events pending, which will cause the interrupt to be marked as spurious and then be disabled, which then breaks all further accesses to the controller.This patch makes the SoC path clear interrupt status on init like in the non-SoC case.
Signed-off-by Lennert Buytenhek <[email protected]>--- drivers/ata/sata_mv.c | 21 ++++++++++----------- 1 files changed, 10 insertions(+), 11 deletions(-)drivers/ata/sata_mv.c +10
-5@@ -3131,19 +3131,18 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx)writelfl (0 , hc_mmio +HC_IRQ_CAUSE_OFS ); } -if (!IS_SOC (hpriv)) { -/* Clear any currently outstanding host interrupt conditions */ -writelfl (0 , mmio + hpriv->irq_cause_ofs); +/* Clear any currently outstanding host interrupt conditions */ +writelfl (0 , mmio + hpriv->irq_cause_ofs); -/* and unmask interrupt generation for host regs */ -writelfl (hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs); +/* and unmask interrupt generation for host regs */ +writelfl (hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs); + +/* +* enable only global host interrupts for now. +* The per-port interrupts get done later as ports are set up. +*/ +mv_set_main_irq_mask (host,0 ,PCI_ERR );
drivers/ata/sata_mv.c static int mv_init_host(struct ata_host *host, unsigned int board_idx) · line 3148
Quoted 10 lines
drivers/ata/sata_mv.c +0
-6-/* -* enable only global host interrupts for now. -* The per-port interrupts get done later as ports are set up. -*/ -mv_set_main_irq_mask (host,0 ,PCI_ERR ); - } done:return rc; }
The patch looks fine.
Mark, I think that all the code that clears the cause registers should be moved from mv_init_host to the reset_hc functions, which already clears some of those register. for example, register 0x14 (host controller cause register) get cleared twice, the first time at mv5_reset_one_hc. also, the reset_hc functions better use the register define instead of a hardcoded number when possible.
saeed
Quoted 42 lines · Mark Lord
Quoted 42 lines
For some reason,
sata_mvdoesn't clear interrupt status during init when it's running on an SoC host adapter. If the bootloader has touched the SATA controller before starting Linux, Linux can end up enabling the SATA interrupt with events pending, which will cause the interrupt to be marked as spurious and then be disabled, which then breaks all further accesses to the controller.This patch makes the SoC path clear interrupt status on init like in the non-SoC case.
Signed-off-by Lennert Buytenhek <[email protected]>---
drivers/ata/sata_mv.c| 21 ++++++++++-----------1 files changed, 10 insertions(+), 11 deletions(-)drivers/ata/sata_mv.c +10
-5@@ -3131,19 +3131,18 @@ static int mv_init_host(struct ata_host *host,unsigned int board_idx) writelfl(0, hc_mmio + HC_IRQ_CAUSE_OFS); } -if (!IS_SOC (hpriv)) { -/* Clear any currently outstanding host interrupt conditions */ -writelfl (0 , mmio + hpriv->irq_cause_ofs); +/* Clear any currently outstanding host interrupt conditions */ +writelfl (0 , mmio + hpriv->irq_cause_ofs); -/* and unmask interrupt generation for host regs */ -writelfl (hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs); +/* and unmask interrupt generation for host regs */ +writelfl (hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs); + +/* +* enable only global host interrupts for now. +* The per-port interrupts get done later as ports are set up. +*/ +mv_set_main_irq_mask (host,0 ,PCI_ERR );
Quoted 13 lines
Quoted 10 lines
drivers/ata/sata_mv.c +0
-3-/* -* enable only global host interrupts for now. -* The per-port interrupts get done later as ports are set up.
drivers/ata/sata_mv.c +0
-3-*/ -mv_set_main_irq_mask (host,0 ,PCI_ERR ); - }done:
return rc; }Looks fine to me -- Saeed Bishara did the SOC stuff, and Marvell refuses to show me any documentation for it.
Yeah, docs are often a problem (even internally). However, this particular bit has been opened up, and you can get a copy of the SoC docs here:
http://www.marvell.com/products/media/index.jsp
(Get the docs for the 5182, which is the only 5xxx series SoC that has SATA built-in.)
Quoted 9 lines · Lennert Buytenhek
For some reason,
sata_mvdoesn't clear interrupt status during init when it's running on an SoC host adapter. If the bootloader has touched the SATA controller before starting Linux, Linux can end up enabling the SATA interrupt with events pending, which will cause the interrupt to be marked as spurious and then be disabled, which then breaks all further accesses to the controller.This patch makes the SoC path clear interrupt status on init like in the non-SoC case.
What's the status of this patch? Saeed said that the patch is correct [1] and Mark asked for his Signed-off-by. Saeed, can you add your Signed-off-by, so this can go in?
[1] http://www.spinics.net/lists/linux-ide/msg25686.html
Quoted 45 lines
Signed-off-by Lennert Buytenhek <[email protected]>--- drivers/ata/sata_mv.c | 21 ++++++++++----------- 1 files changed, 10 insertions(+), 11 deletions(-)drivers/ata/sata_mv.c +10
-11@@ -3131,19 +3131,18 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx)writelfl (0 , hc_mmio +HC_IRQ_CAUSE_OFS ); } -if (!IS_SOC (hpriv)) { -/* Clear any currently outstanding host interrupt conditions */ -writelfl (0 , mmio + hpriv->irq_cause_ofs); +/* Clear any currently outstanding host interrupt conditions */ +writelfl (0 , mmio + hpriv->irq_cause_ofs); -/* and unmask interrupt generation for host regs */ -writelfl (hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs); +/* and unmask interrupt generation for host regs */ +writelfl (hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs); + +/* +* enable only global host interrupts for now. +* The per-port interrupts get done later as ports are set up. +*/ +mv_set_main_irq_mask (host,0 ,PCI_ERR ); -/* -* enable only global host interrupts for now. -* The per-port interrupts get done later as ports are set up. -*/ -mv_set_main_irq_mask (host,0 ,PCI_ERR ); - } done:return rc; }Signature · 5 lines
1.5.6.4 -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Martin Michlmayr http://www.cyrius.com/
Quoted 8 lines · Martin Michlmayr
Quoted 7 lines · Lennert Buytenhek
For some reason,
sata_mvdoesn't clear interrupt status during init when it's running on an SoC host adapter. If the bootloader has touched the SATA controller before starting Linux, Linux can end up enabling the SATA interrupt with events pending, which will cause the interrupt to be marked as spurious and then be disabled, which then breaks all further accesses to the controller.
Quoted 6 lines
Quoted 2 lines
This patch makes the SoC path clear interrupt status on init like in the non-SoC case.
What's the status of this patch? Saeed said that the patch is correct [1] and Mark asked for his Signed-off-by. Saeed, can you add your Signed-off-by, so this can go in?
"Acked-by:" is already implied with Saeed's previous email:
"The patch looks fine."
That should be sufficient.
This patch can be applied by jgarzik to libata tree.
hth,
grant
Quoted 57 lines
[1] http://www.spinics.net/lists/linux-ide/msg25686.html
Quoted 40 lines
Signed-off-by Lennert Buytenhek <[email protected]>--- drivers/ata/sata_mv.c | 21 ++++++++++----------- 1 files changed, 10 insertions(+), 11 deletions(-)drivers/ata/sata_mv.c +10
-12@@ -3131,19 +3131,18 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx)writelfl (0 , hc_mmio +HC_IRQ_CAUSE_OFS ); } -if (!IS_SOC (hpriv)) { -/* Clear any currently outstanding host interrupt conditions */ -writelfl (0 , mmio + hpriv->irq_cause_ofs); +/* Clear any currently outstanding host interrupt conditions */ +writelfl (0 , mmio + hpriv->irq_cause_ofs); -/* and unmask interrupt generation for host regs */ -writelfl (hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs); +/* and unmask interrupt generation for host regs */ +writelfl (hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs); + +/* +* enable only global host interrupts for now. +* The per-port interrupts get done later as ports are set up. +*/ +mv_set_main_irq_mask (host,0 ,PCI_ERR ); -/* -* enable only global host interrupts for now. -* The per-port interrupts get done later as ports are set up. -*/ -mv_set_main_irq_mask (host,0 ,PCI_ERR ); - } done:return rc; } --Quoted 5 lines
1.5.6.4
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
Martin Michlmayr
http://www.cyrius.com/
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html