qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: "Gabriel L. Somlo" <gsomlo@gmail.com>
Cc: qemu-trivial@nongnu.org, rene@exactcode.com, somlo@cmu.edu,
	qemu-devel@nongnu.org, agraf@suse.de
Subject: Re: [Qemu-devel] [PATCH] e1000: pre-initialize RAH/RAL registers
Date: Wed, 31 Oct 2012 09:03:51 +0100	[thread overview]
Message-ID: <20121031080351.GC1116@stefanha-thinkpad> (raw)
In-Reply-To: <20121030172039.GN29280@hedwig.ini.cmu.edu>

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 <somlo@cmu.edu>
> ---
>  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

  reply	other threads:[~2012-10-31  8:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-30 17:20 [Qemu-devel] [PATCH] e1000: pre-initialize RAH/RAL registers Gabriel L. Somlo
2012-10-31  8:03 ` Stefan Hajnoczi [this message]
2012-10-31 18:15   ` [Qemu-devel] [PATCH v2] " Gabriel L. Somlo
2012-11-01 12:28     ` Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121031080351.GC1116@stefanha-thinkpad \
    --to=stefanha@gmail.com \
    --cc=agraf@suse.de \
    --cc=gsomlo@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=rene@exactcode.com \
    --cc=somlo@cmu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).