Received: from eggs.gnu.org ([2001:4830:134:3::10]:49739) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2c0u-0001Mu-4h for qemu-devel@nongnu.org; Thu, 03 Jul 2014 04:05:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X2c0m-0002vn-KP for qemu-devel@nongnu.org; Thu, 03 Jul 2014 04:05:04 -0400 Received: from cantor2.suse.de ([195.135.220.15]:36594 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2c0m-0002vi-8k for qemu-devel@nongnu.org; Thu, 03 Jul 2014 04:04:56 -0400 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) From: Alexander Graf In-Reply-To: <20140702220224.GA1688@ERROL.INI.CMU.EDU> Date: Thu, 3 Jul 2014 10:04:55 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <4CC5752B-B4BA-4624-9CFC-9C30010996C5@suse.de> References: <1404147350-28904-1-git-send-email-somlo@cmu.edu> <1404147350-28904-3-git-send-email-somlo@cmu.edu> <20140630175554.GA2871@redhat.com> <20140702090207.GA2945@crash.ini.cmu.edu> <53B3CE04.5020700@suse.de> <20140702204959.GY1688@ERROL.INI.CMU.EDU> <53B47366.6000101@suse.de> <20140702211425.GZ1688@ERROL.INI.CMU.EDU> <20140702220224.GA1688@ERROL.INI.CMU.EDU> Subject: Re: [Qemu-devel] e1000 autoneg timing, piix/osx List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Gabriel L. Somlo" Cc: "pbonzini@redhat.com" , "qemu-devel@nongnu.org" , "stefanha@redhat.com" , "Michael S. Tsirkin" > Am 03.07.2014 um 00:02 schrieb "Gabriel L. Somlo" : >=20 >> On Wed, Jul 02, 2014 at 05:14:26PM -0400, Gabriel L. Somlo wrote: >>> On Wed, Jul 02, 2014 at 11:02:30PM +0200, Alexander Graf wrote: >>>=20 >>>> On 02.07.14 22:49, Gabriel L. Somlo wrote: >>>> So it turns out everything I thought I knew (which was little indeed) >>>> was more or less wrong. The problem, as far as I'm observing it now, >>>> is that on PIIX, the OS X guest obsessively reads the ICR in a tight >>>> loop. It reads the injected LSC (and probably discards it) before >>>> unmasking the corresponding interrupt bit; later on, when it unmasks >>>> LSC, giving the emulated e1000 hardware a chance to raise the irq >>>> line, the actual LSC event has been flushed from the ICR, and the >>>> driver does not detect the link coming up. >>>>=20 >>>> [...] >>>>=20 >>>> Any clue as to why ICR gets read like that on PIIX, but not Q35 ? >>>=20 >>> Either way, why does the bit get cleared even though it hasn't been rais= ed? >>> What does real hardware do with interrupts that have been masked? >>=20 >> The e1000 manual says ICR bits are cleared on read. It also says PCI >> interrupts are only generated if the corresponding bit in *both* ICR >> and IMS registers is 1. ICR bits are still cleared if read, even if >> masked and no actual interrupt is raised. >>=20 >>> Maybe it's using MSI on q35? :) >>> Maybe we also share the same IRQ line with another device on PIIX that g= ets >>> polled all the time? IDE maybe? >>=20 >> Even if that were the case, how come it's reading precisely our >> device's ICR register ? Isn't that too much of a coincidence ? >=20 > Unless some other device on a shared IRQ line generated the interrupt, > and our e1000 driver then checked ICR. Although if that happened, our > driver should happily acknowledge the link-up event (I checked, and it > does NOT read IMS, so it has no way of knowing it's masked). Except it > does -- it knows the last thing it did was set_imc(0xFFFFFFFF), and > that it hasn't yet set_ims(anything) yet...=20 >=20 > And I think you're right: >=20 > (qemu) info pci > Bus 0, device 0, function 0: > Host bridge: PCI device 8086:1237 > id "" > Bus 0, device 1, function 0: > ISA bridge: PCI device 8086:7000 > id "" > Bus 0, device 1, function 1: > IDE controller: PCI device 8086:7010 > BAR4: I/O at 0xc080 [0xc08f]. > id "" > Bus 0, device 1, function 2: > USB controller: PCI device 8086:7020 > IRQ 11. > BAR4: I/O at 0xc040 [0xc05f]. > id "" > Bus 0, device 1, function 3: > Bridge: PCI device 8086:7113 > IRQ 9. > id "" > Bus 0, device 2, function 0: > VGA controller: PCI device 1013:00b8 > BAR0: 32 bit prefetchable memory at 0xfc000000 [0xfdffffff]. > BAR1: 32 bit memory at 0xfebf0000 [0xfebf0fff]. > BAR6: 32 bit memory at 0xffffffffffffffff [0x0000fffe]. > id "" > Bus 0, device 3, function 0: > SATA controller: PCI device 8086:2922 > IRQ 11. > BAR4: I/O at 0xc060 [0xc07f]. > BAR5: 32 bit memory at 0xfebf1000 [0xfebf1fff]. > id "ide" > Bus 0, device 4, function 0: > Ethernet controller: PCI device 8086:100f > IRQ 11. > BAR0: 32 bit memory at 0xfebc0000 [0xfebdffff]. > BAR1: I/O at 0xffffffffffffffff [0x003e]. > BAR6: 32 bit memory at 0xffffffffffffffff [0x0003fffe]. > id "vnet0" >=20 > so Ethernet, SATA, and USB, all sharing IRQ 11. Is there an easy way > to force one of those to use a different IRQ ? IIRC if you plug the device in a different slot, the irq distribution should= be different :). Alex >=20 >=20