qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/2] via-ide: Also emulate non 100% native mode


From: BALATON Zoltan
Subject: Re: [PATCH 2/2] via-ide: Also emulate non 100% native mode
Date: Sun, 1 Mar 2020 19:32:34 +0100 (CET)
User-agent: Alpine 2.22 (BSF 395 2020-01-19)

On Sun, 1 Mar 2020, Mark Cave-Ayland wrote:
On 01/03/2020 16:42, BALATON Zoltan wrote:

The other part I'm not sure about is that I can't see how via_ide_set_irq() can 
ever
raise a native PCI IRQ - comparing with my experience on cmd646, should there 
not be
a pci_set_irq(d, level) at the end?

According to my tests with several guests it seems the via-ide does not seem to 
use
PCI interrupts as described in the previous reply, only either legacy IRQ14 and 
15 or
one ISA IRQ line set by a config reg in native mode (except on Pegasos2). This 
may be
due to how it's internally connected in the southbridge chip it's part of or 
some
other platform specific quirk, I'm not sure.

I think this is the key part here: how does via-ide switch between legacy and 
native
mode? For CMD646 this is done by setting a bit in PCI configuration space, and 
I'd
expect to see something similar here.

It might be that the BIOS sets legacy mode on startup, and unless the OS 
explicitly
switches to native mode then the interrupt routing remains at IRQ 14/15 (or 
whatever
value is in PCI_INTERRUPT_LINE). Is there a datasheet available for the VIA 
chip to
check this?

Yes, searching for datasheets for the southbridge chips containing this IDE controller such as VT82C686B and VT8231 might turn up something but the docs are not too detailed regarding IRQ mapping. Switching between modes is done the same way as on CMD646 via bits of the PROG_IF config reg but as it's also noted in Linux fixup func the firmware on pegasos2 does set it up as native mode and also writes to the interrupt line reg to set it to 9, yet it seems to remain set to 14 (this is confirmed by reg dump from Linux on real hardware) and IRQs are expected on 14 and 15 as in legacy mode (shown by expectation of Amiga like OSes, regardless of what's in config regs). Docs say that in legacy mode io addresses should be legacy io ports assigned to IDE, yet firmware and OSes use PCI BARs as in native mode but expect interrupts on legacy IRQ as in legacy mode so I think it's kind of half-native mode.

This is what the log shows on real PegasosII (using Debian 5 because later versions seems to have problems with radeon driver so have no display):

[    0.000000] Linux version 2.6.26-2-powerpc (Debian 2.6.26-29) 
(address@hidden) (gcc version 4.1.3 20080704 (prerelease) (Debian 4.1.2-25)) #1 
Sun Mar 4 06:19:00 UTC 2012

[    0.000000] chrp type = 6 [Genesi Pegasos]

[    1.562960] Fixing VIA IDE, force legacy mode on '0000:00:0c.1'

[ 7.203599] VP_IDE: IDE controller (0x1106:0x0571 rev 0x06) at PCI slot 
0000:00:0c.1
[ 7.211068] VP_IDE: not 100% native mode: will probe irqs later
[ 7.218300] VP_IDE: VIA vt8231 (rev 10) IDE UDMA100 controller on 
pci0000:00:0c.1
[ 7.225534] ide0: BM-DMA at 0x1060-0x1067
[ 7.232794] ide1: BM-DMA at 0x1068-0x106f
[ 7.239927] Probing IDE interface ide0...
[here detects devices attached to ide channels]

[    9.013151] ide0 at 0x1040-0x1047,0x104e on irq 14
[    9.020384] ide1 at 0x1050-0x1057,0x105e on irq 15

lspci says:

0000:00:0c.1 IDE interface: VIA Technologies, Inc. 
VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE (rev 06) (prog-if 8a 
[Master SecP PriP])
        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- 
Stepping- SERR- FastB2B- DisINTx-
        Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- 
<MAbort- >SERR- <PERR- INTx-
        Latency: 0
        Interrupt: pin ? routed to IRQ 14
        Region 0: [virtual] I/O ports at 1040 [size=8]
        Region 1: [virtual] I/O ports at 104c [size=4]
        Region 2: [virtual] I/O ports at 1050 [size=8]
        Region 3: [virtual] I/O ports at 105c [size=4]
        Region 4: I/O ports at 1060 [size=16]
        Capabilities: [c0] Power Management version 2
                Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA 
PME(D0-,D1-,D2-,D3hot-,D3cold-)
                Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
        Kernel driver in use: VIA_IDE
        Kernel modules: via82cxxx

If this was legacy mode io ports should not be what seem to be coming from PCI BARs so either docs are not correct about how legacy mode works or this is not legacy mode but "not 100% native mode". The prog-if is set to 0x8a which corresponds to native mode but this is what the Linux fixup function does, firmware sets it to 0x8f which means native mode.

Regards,
BALATON Zoltan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]