Re: Bug report for sata_via driver

Damien Le Moal
2023-01-25T01:26:42Z

On 1/25/23 02:06, marius@psihoexpert.ro wrote:
> Hi. It's me again.
>
> May I bother you with another bug? (^_^;)
>
> The machine is a Lenovo X61 Tablet, a tablet PC with Intel GM965 / ICH8-M.
> It has a cardbus slot (32bit PCI), Ricoh RL5C476 II (VEN_1180 DEV_0476).
> The card is a VIA VT6421 (VEN_1106 DEV_3249) SATA/PATA controller.
> The card has 2 SATA ports and no PATA.
>
> ---- CARD INSERTED ----
[...]
> [ 68.460166] resume, return at end of function
> [ 68.460171] hardreset, ata_phys_link_offline check failed
> [ 68.470148] [2358] libata:ata_wait_idle:2049: ata6: abnormal Status 0x7F
> [ 68.472385] ata6: SATA link down (SStatus 0 SControl 310)
> [ 68.482547] hardreset, Online=>Offline
> [ 68.483633] resume, do loop
> [ 68.698036] resume, after do loop
> [ 68.703129] debounce, SCR=0x0
> [ 68.708218] debounce, SCR=0x0
> ...
> [ 68.804763] debounce, SCR=0x0
> [ 68.809851] debounce, SCR=0x0
> [ 68.809858] resume, return at end of function
> [ 68.809863] hardreset, ata_phys_link_offline check failed
> [ 68.819838] [2360] libata:ata_wait_idle:2049: ata7: abnormal Status 0x7F
> [ 68.822067] ata7: SATA link down (SStatus 0 SControl 310)
> [ 69.008039] [2363] libata:ata_wait_idle:2049: ata8: abnormal Status 0x8

Beuh... libata does not understand these status. Bit 3 is set in the
status, but that one is transport dependent, so defined in CF card...
Would need to look that up, but it seems to be that the device reports
that an PIO is still on-going. It seems like we are in the realm of "this
is a weird drive". You could try increasing the 10ms timeout in
ata_wait_idle(): change the call:

ata_sff_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);

to something like:

ata_sff_busy_wait(ap, ATA_BUSY | ATA_DRQ, 5000);

to see if that changes anything.

> ---- EXTERNAL HDD CONNECTED ----
> [ 118.683511] irq 16: nobody cared (try booting with the "irqpoll" option)
> [ 118.684531] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.1.0-rc8-M95D+ #1
> [ 118.684538] Hardware name: LENOVO 776702U/776702U, BIOS 7SET39WW (1.25 ) 03/22/2011
> [ 118.684542] Call Trace:
> [ 118.684547] <IRQ>
> [ 118.684550] dump_stack_lvl+0x34/0x44
> [ 118.684561] __report_bad_irq+0x30/0xa2
> [ 118.684569] note_interrupt.cold+0xb/0x61
> [ 118.684575] handle_irq_event+0x65/0x70
> [ 118.684581] handle_fasteoi_irq+0x8b/0x1c0
> [ 118.684588] __common_interrupt+0x5a/0xf0
> [ 118.684596] common_interrupt+0x9f/0xc0
> [ 118.684601] </IRQ>
> [ 118.684604] <TASK>
> [ 118.684606] asm_common_interrupt+0x22/0x40
> [ 118.684614] RIP: 0010:cpuidle_enter_state+0xbb/0x280

Looks like a problem with interrupts here. Can you "gdb vmlinux" and "list
*(cpuidle_enter_state+0xbb)" to see exactly what is failing here ?

[...]

> ---- EJECT CARD ----
> [ 136.498083] pcmcia_socket pcmcia_socket0: pccard: card ejected from slot 0
> [ 136.498159] hardreset, Online=>Offline
> [ 136.500751] Reconfig spd
> [ 136.500807] hardreset, Online=>Offline
> [ 136.500815] Reconfig spd
> [ 136.501858] resume, do loop
> [ 136.501968] resume, do loop
> [ 136.718048] resume, do loop
> [ 136.718089] resume, do loop
> [ 136.938104] resume, do loop
> [ 136.938115] resume, do loop
> [ 137.158076] resume, do loop
> [ 137.158108] resume, do loop
> [ 137.378105] resume, do loop
> [ 137.378115] resume, do loop
> [ 137.598082] resume, after do loop
> [ 137.598086] ata6: failed to resume link (SControl FFFFFFFF)
> [ 137.599831] hardreset, ata_phys_link_offline check failed
> [ 137.599872] ata6: SATA link down (SStatus FFFFFFFF SControl FFFFFFFF)
> [ 137.599897] resume, after do loop
> [ 137.599900] ata7: failed to resume link (SControl FFFFFFFF)
> [ 137.599965] ------------[ cut here ]------------
> [ 137.601620] hardreset, ata_phys_link_offline check failed
> [ 137.601618] WARNING: CPU: 1 PID: 79 at drivers/ata/libata-core.c:5910 ata_host_detach+0x1c7/0x1d0

Looks like the ATA_PFLAG_UNLOADED is not set, causing this warning. But
given that there seem to be issues with interrupts, the eject may not be
detected.

> [ 137.601661] ata7: SATA link down (SStatus FFFFFFFF SControl FFFFFFFF)
> [ 137.603368] CPU: 1 PID: 79 Comm: pccardd Not tainted 6.1.0-rc8-M95D+ #1
> [ 137.603375] Hardware name: LENOVO 776702U/776702U, BIOS 7SET39WW (1.25 ) 03/22/2011
> [ 137.603378] RIP: 0010:ata_host_detach+0x1c7/0x1d0

Please gdb that too.

> ---- CONNECT CARD WITH HDD ALREADY ATTACHED ----
> [ 168.768069] pcmcia_socket pcmcia_socket0: pccard: CardBus card inserted into slot 0
> [ 168.771207] pci 0000:06:00.0: [1106:3249] type 00 class 0x010400
> [ 168.771256] pci 0000:06:00.0: reg 0x10: [io 0x0af0-0x0aff]
> [ 168.771280] pci 0000:06:00.0: reg 0x14: [io 0x0a70-0x0a7f]
> [ 168.771302] pci 0000:06:00.0: reg 0x18: [io 0x01f0-0x01ff]
> [ 168.771322] pci 0000:06:00.0: reg 0x1c: [io 0x0170-0x017f]
> [ 168.771343] pci 0000:06:00.0: reg 0x20: [io 0xcc00-0xcc1f]
> [ 168.771363] pci 0000:06:00.0: reg 0x24: [io 0x8c00-0x8cff]
> [ 168.771695] pci 0000:06:00.0: BAR 5: assigned [io 0x4000-0x40ff]
> [ 168.771713] pci 0000:06:00.0: BAR 4: assigned [io 0x4400-0x441f]
> [ 168.771727] pci 0000:06:00.0: BAR 0: assigned [io 0x4420-0x442f]
> [ 168.771742] pci 0000:06:00.0: BAR 1: assigned [io 0x4430-0x443f]
> [ 168.771756] pci 0000:06:00.0: BAR 2: assigned [io 0x4440-0x444f]
> [ 168.771769] pci 0000:06:00.0: BAR 3: assigned [io 0x4450-0x445f]
> [ 168.771908] sata_via 0000:06:00.0: enabling device (0000 -> 0001)
> [ 168.772137] sata_via 0000:06:00.0: routed to hard irq line 0
> [ 168.772162] [79] sata_via:svia_configure:635: sata_via 0000:06:00.0: enabling SATA hotplug (0x0)
> [ 168.773265] scsi host6: sata_via
> [ 168.775256] scsi host7: sata_via
> [ 168.788766] scsi host8: sata_via
> [ 168.788866] ata9: SATA max UDMA/133 port i16@0x4420 bmdma 0x4400 irq 16
> [ 168.788872] ata10: SATA max UDMA/133 port i16@0x4430 bmdma 0x4408 irq 16
> [ 168.788875] ata11: PATA max UDMA/133 port i16@0x4440 bmdma 0x4410 irq 16
> [ 168.788961] hardreset, Online=>Offline
> [ 168.790037] resume, do loop
> [ 169.008036] resume, after do loop
> [ 169.013116] debounce, SCR=0x1
> [ 169.018189] debounce, SCR=0x1
> ...
> [ 170.054131] debounce, SCR=0x1
> [ 170.059209] debounce, SCR=0x1
> [ 170.062091] irq 16: nobody cared (try booting with the "irqpoll" option)
> [ 170.062095] CPU: 0 PID: 2356 Comm: tee Tainted: G W 6.1.0-rc8-M95D+ #1
> [ 170.062100] Hardware name: LENOVO 776702U/776702U, BIOS 7SET39WW (1.25 ) 03/22/2011
> [ 170.062102] Call Trace:
> [ 170.062107] <IRQ>
> [ 170.062109] dump_stack_lvl+0x34/0x44
> [ 170.062117] __report_bad_irq+0x30/0xa2
> [ 170.062123] note_interrupt.cold+0xb/0x61
> [ 170.062128] handle_irq_event+0x65/0x70
> [ 170.062133] handle_fasteoi_irq+0x8b/0x1c0
> [ 170.062138] __common_interrupt+0x5a/0xf0
> [ 170.062144] common_interrupt+0x9f/0xc0
> [ 170.062148] </IRQ>
> [ 170.062150] <TASK>
> [ 170.062151] asm_common_interrupt+0x22/0x40
> [ 170.062157] RIP: 0010:cfb_imageblit+0x3e8/0x800

gdb disassemble (list command) ?