From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49668) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTTgz-0002Rg-Do for qemu-devel@nongnu.org; Wed, 31 Oct 2012 04:30:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TTTgr-0000Ha-7V for qemu-devel@nongnu.org; Wed, 31 Oct 2012 04:30:29 -0400 Date: Wed, 31 Oct 2012 09:03:51 +0100 From: Stefan Hajnoczi Message-ID: <20121031080351.GC1116@stefanha-thinkpad> References: <20121030172039.GN29280@hedwig.ini.cmu.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20121030172039.GN29280@hedwig.ini.cmu.edu> Subject: Re: [Qemu-devel] [PATCH] e1000: pre-initialize RAH/RAL registers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Gabriel L. Somlo" Cc: qemu-trivial@nongnu.org, rene@exactcode.com, somlo@cmu.edu, qemu-devel@nongnu.org, agraf@suse.de On Tue, Oct 30, 2012 at 01:20:40PM -0400, Gabriel L. Somlo wrote: > Some guest operating systems' drivers (Mac OS X in particular) fail to > properly initialize the Receive Address registers (probably expecting > them to be pre-initialized by an earlier component, such as a proprietary > BIOS). This patch pre-initializes the RA registers, allowing OS X > networking to function properly. Other guest operating systems are not > affected, and free to (re)initialize these registers during boot. > > Signed-off-by: Gabriel Somlo > --- > hw/e1000.c | 4 ++++ > 1 files changed, 4 insertions(+), 0 deletions(-) > > diff --git a/hw/e1000.c b/hw/e1000.c > index e4f1ffe..6478ff3 100644 > --- a/hw/e1000.c > +++ b/hw/e1000.c > @@ -278,6 +278,10 @@ static void e1000_reset(void *opaque) > if (d->nic->nc.link_down) { > e1000_link_down(d); > } > + > + /* Some guests expect pre-initialized RAH/RAL (AddrValid flag + MACaddr) */ > + d->mac_reg[RA+1] = E1000_RAH_AV; Please use 4 space indentation (QEMU coding style). > + memmove(&d->mac_reg[RA], &d->conf.macaddr, sizeof(struct MACAddr)); When the host is big-endian the filter code will byteswap and the MAC address will not match: for (rp = s->mac_reg + RA; rp < s->mac_reg + RA + 32; rp += 2) { if (!(rp[1] & E1000_RAH_AV)) continue; ra[0] = cpu_to_le32(rp[0]); ra[1] = cpu_to_le32(rp[1]); if (!memcmp(buf, (uint8_t *)ra, 6)) { Stefan