Received: from eggs.gnu.org ([2001:4830:134:3::10]:57298) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2k6q-0004Wm-A7 for qemu-devel@nongnu.org; Thu, 03 Jul 2014 12:43:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X2k6h-0004UU-8m for qemu-devel@nongnu.org; Thu, 03 Jul 2014 12:43:44 -0400 Received: from mail-qg0-x22c.google.com ([2607:f8b0:400d:c04::22c]:39231) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2k6h-0004UQ-1h for qemu-devel@nongnu.org; Thu, 03 Jul 2014 12:43:35 -0400 Received: by mail-qg0-f44.google.com with SMTP id j107so460726qga.3 for ; Thu, 03 Jul 2014 09:43:34 -0700 (PDT) Date: Thu, 3 Jul 2014 12:43:32 -0400 From: "Gabriel L. Somlo" Message-ID: <20140703164331.GE1688@ERROL.INI.CMU.EDU> References: <53B47366.6000101@suse.de> <20140702211425.GZ1688@ERROL.INI.CMU.EDU> <20140702220224.GA1688@ERROL.INI.CMU.EDU> <4CC5752B-B4BA-4624-9CFC-9C30010996C5@suse.de> <20140703131723.GB1688@ERROL.INI.CMU.EDU> <20140703135846.GC1688@ERROL.INI.CMU.EDU> <53B5625E.8030304@suse.de> <20140703141451.GD1688@ERROL.INI.CMU.EDU> <53B575D0.7080700@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <53B575D0.7080700@suse.de> Subject: Re: [Qemu-devel] e1000 autoneg timing, piix/osx List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: "pbonzini@redhat.com" , "qemu-devel@nongnu.org" , "stefanha@redhat.com" , "Michael S. Tsirkin" On Thu, Jul 03, 2014 at 05:25:04PM +0200, Alexander Graf wrote: > Maybe the IRQ line is simply never shared on real Macs :). Who knows. > > Does this (untested!) patch make it work for you? Yep, it works. Doesn't break OSX on q35, Linux (F20) or windows (7) either :) Thanks, --Gabriel > diff --git a/hw/net/e1000.c b/hw/net/e1000.c > index 0fc29a0..7db0538 100644 > --- a/hw/net/e1000.c > +++ b/hw/net/e1000.c > @@ -1090,9 +1090,24 @@ static uint32_t > mac_icr_read(E1000State *s, int index) > { > uint32_t ret = s->mac_reg[ICR]; > + uint32_t new_icr = 0; > > DBGOUT(INTERRUPT, "ICR read: %x\n", ret); > - set_interrupt_cause(s, 0, 0); > + > + /* > + * Mac OS X reads ICR on every interrupt. When the IRQ line is shared, > + * this may result in a race where LSC is not interpreted yet, but > + * already gets cleared. > + * > + * The easiest fix is to delay LSC events until after they have been > + * property unmasked, so let's just claim we never saw any here. > + */ > + if ((ret & E1000_ICS_LSC) && !(s->mac_reg[IMS] & E1000_ICS_LSC)) { > + ret &= ~E1000_ICS_LSC; > + new_icr |= E1000_ICS_LSC; > + } > + > + set_interrupt_cause(s, 0, new_icr); > return ret; > } >