* [PATCH] sata_via: Enable hotplug only on VT6421
@ 2017-03-31 18:35 Ondrej Zary
2017-03-31 19:15 ` [RFC PATCH] sata_via: Enable hotplug on VT6420 Ondrej Zary
2017-04-11 0:12 ` [PATCH] sata_via: Enable hotplug only on VT6421 Tejun Heo
0 siblings, 2 replies; 4+ messages in thread
From: Ondrej Zary @ 2017-03-31 18:35 UTC (permalink / raw)
To: linux-ide; +Cc: Tejun Heo, Kernel development list
Commit 57e5568fda27 ("sata_via: Implement hotplug for VT6421") adds
hotplug IRQ handler for VT6421 but enables hotplug on all chips. This
is a bug because it causes "irq xx: nobody cared" error on VT6420 when
hot-(un)plugging a drive:
[ 381.839948] irq 20: nobody cared (try booting with the "irqpoll" option)
[ 381.840014] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.10.0-rc5+ #148
[ 381.840066] Hardware name: P4VM800/P4VM800, BIOS P1.60 05/29/2006
[ 381.840117] Call Trace:
[ 381.840167] <IRQ>
[ 381.840225] ? dump_stack+0x44/0x58
[ 381.840278] ? __report_bad_irq+0x14/0x97
[ 381.840327] ? handle_edge_irq+0xa5/0xa5
[ 381.840376] ? note_interrupt+0x155/0x1cf
[ 381.840426] ? handle_edge_irq+0xa5/0xa5
[ 381.840474] ? handle_irq_event_percpu+0x32/0x38
[ 381.840524] ? handle_irq_event+0x1f/0x38
[ 381.840573] ? handle_fasteoi_irq+0x69/0xb8
[ 381.840625] ? handle_irq+0x4f/0x5d
[ 381.840672] </IRQ>
[ 381.840726] ? do_IRQ+0x2e/0x8b
[ 381.840782] ? common_interrupt+0x2c/0x34
[ 381.840836] ? mwait_idle+0x60/0x82
[ 381.840892] ? arch_cpu_idle+0x6/0x7
[ 381.840949] ? do_idle+0x96/0x18e
[ 381.841002] ? cpu_startup_entry+0x16/0x1a
[ 381.841057] ? start_kernel+0x319/0x31c
[ 381.841111] ? startup_32_smp+0x166/0x168
[ 381.841165] handlers:
[ 381.841219] [<c12a7263>] ata_bmdma_interrupt
[ 381.841274] Disabling IRQ #20
Seems that VT6420 can do hotplug too (there's no documentation) but the
comments say that SCR register access (required for detecting hotplug
events) can cause problems on these chips.
For now, just keep hotplug disabled on anything other than VT6421.
Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
---
drivers/ata/sata_via.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
index 0636d84..f3f538e 100644
--- a/drivers/ata/sata_via.c
+++ b/drivers/ata/sata_via.c
@@ -644,14 +644,16 @@ static void svia_configure(struct pci_dev *pdev, int board_id,
pci_write_config_byte(pdev, SATA_NATIVE_MODE, tmp8);
}
- /* enable IRQ on hotplug */
- pci_read_config_byte(pdev, SVIA_MISC_3, &tmp8);
- if ((tmp8 & SATA_HOTPLUG) != SATA_HOTPLUG) {
- dev_dbg(&pdev->dev,
- "enabling SATA hotplug (0x%x)\n",
- (int) tmp8);
- tmp8 |= SATA_HOTPLUG;
- pci_write_config_byte(pdev, SVIA_MISC_3, tmp8);
+ if (board_id == vt6421) {
+ /* enable IRQ on hotplug */
+ pci_read_config_byte(pdev, SVIA_MISC_3, &tmp8);
+ if ((tmp8 & SATA_HOTPLUG) != SATA_HOTPLUG) {
+ dev_dbg(&pdev->dev,
+ "enabling SATA hotplug (0x%x)\n",
+ (int) tmp8);
+ tmp8 |= SATA_HOTPLUG;
+ pci_write_config_byte(pdev, SVIA_MISC_3, tmp8);
+ }
}
/*
--
Ondrej Zary
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [RFC PATCH] sata_via: Enable hotplug on VT6420
2017-03-31 18:35 [PATCH] sata_via: Enable hotplug only on VT6421 Ondrej Zary
@ 2017-03-31 19:15 ` Ondrej Zary
2017-04-11 0:14 ` Tejun Heo
2017-04-11 0:12 ` [PATCH] sata_via: Enable hotplug only on VT6421 Tejun Heo
1 sibling, 1 reply; 4+ messages in thread
From: Ondrej Zary @ 2017-03-31 19:15 UTC (permalink / raw)
To: linux-ide; +Cc: Tejun Heo, Kernel development list
VT6420 seems to have the same hotplug capability as VT6421.
However, enabling hotplug needs to expose SCR registers which can cause
problems. It works for me but might break elsewhere.
---
drivers/ata/sata_via.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
index f3f538e..fafb0d3 100644
--- a/drivers/ata/sata_via.c
+++ b/drivers/ata/sata_via.c
@@ -132,6 +132,8 @@ struct svia_priv {
static struct ata_port_operations vt6420_sata_ops = {
.inherits = &svia_base_ops,
+ .scr_read = svia_scr_read,
+ .scr_write = svia_scr_write,
.freeze = svia_noop_freeze,
.prereset = vt6420_prereset,
.bmdma_start = vt6420_bmdma_start,
@@ -556,7 +558,7 @@ static void svia_wd_fix(struct pci_dev *pdev)
pci_write_config_byte(pdev, 0x52, tmp8 | BIT(2));
}
-static irqreturn_t vt6421_interrupt(int irq, void *dev_instance)
+static irqreturn_t vt642x_interrupt(int irq, void *dev_instance)
{
struct ata_host *host = dev_instance;
irqreturn_t rc = ata_bmdma_interrupt(irq, dev_instance);
@@ -644,7 +646,7 @@ static void svia_configure(struct pci_dev *pdev, int board_id,
pci_write_config_byte(pdev, SATA_NATIVE_MODE, tmp8);
}
- if (board_id == vt6421) {
+ if (board_id == vt6420 || board_id == vt6421) {
/* enable IRQ on hotplug */
pci_read_config_byte(pdev, SVIA_MISC_3, &tmp8);
if ((tmp8 & SATA_HOTPLUG) != SATA_HOTPLUG) {
@@ -744,8 +746,8 @@ static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
svia_configure(pdev, board_id, hpriv);
pci_set_master(pdev);
- if (board_id == vt6421)
- return ata_host_activate(host, pdev->irq, vt6421_interrupt,
+ if (board_id == vt6420 || board_id == vt6421)
+ return ata_host_activate(host, pdev->irq, vt642x_interrupt,
IRQF_SHARED, &svia_sht);
else
return ata_host_activate(host, pdev->irq, ata_bmdma_interrupt,
--
Ondrej Zary
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] sata_via: Enable hotplug only on VT6421
2017-03-31 18:35 [PATCH] sata_via: Enable hotplug only on VT6421 Ondrej Zary
2017-03-31 19:15 ` [RFC PATCH] sata_via: Enable hotplug on VT6420 Ondrej Zary
@ 2017-04-11 0:12 ` Tejun Heo
1 sibling, 0 replies; 4+ messages in thread
From: Tejun Heo @ 2017-04-11 0:12 UTC (permalink / raw)
To: Ondrej Zary; +Cc: linux-ide, Kernel development list
On Fri, Mar 31, 2017 at 08:35:42PM +0200, Ondrej Zary wrote:
> Commit 57e5568fda27 ("sata_via: Implement hotplug for VT6421") adds
> hotplug IRQ handler for VT6421 but enables hotplug on all chips. This
> is a bug because it causes "irq xx: nobody cared" error on VT6420 when
> hot-(un)plugging a drive:
Applied to libata/for-4.11-fixes.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC PATCH] sata_via: Enable hotplug on VT6420
2017-03-31 19:15 ` [RFC PATCH] sata_via: Enable hotplug on VT6420 Ondrej Zary
@ 2017-04-11 0:14 ` Tejun Heo
0 siblings, 0 replies; 4+ messages in thread
From: Tejun Heo @ 2017-04-11 0:14 UTC (permalink / raw)
To: Ondrej Zary; +Cc: linux-ide, Kernel development list
Hello,
On Fri, Mar 31, 2017 at 09:15:34PM +0200, Ondrej Zary wrote:
> VT6420 seems to have the same hotplug capability as VT6421.
>
> However, enabling hotplug needs to expose SCR registers which can cause
> problems. It works for me but might break elsewhere.
Heh, I'm a bit too nervous to apply this patch after all these years.
If somebody really needs it, we can make it conditional on a boot
parameter or sth but I'm not sure about enabling it by default given
the rocky history and age of the device.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-04-11 0:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-31 18:35 [PATCH] sata_via: Enable hotplug only on VT6421 Ondrej Zary
2017-03-31 19:15 ` [RFC PATCH] sata_via: Enable hotplug on VT6420 Ondrej Zary
2017-04-11 0:14 ` Tejun Heo
2017-04-11 0:12 ` [PATCH] sata_via: Enable hotplug only on VT6421 Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).