qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Gabriel L. Somlo" <gsomlo@gmail.com>
To: qemu-devel@nongnu.org
Cc: romain@dolbeau.org, mst@redhat.com, agraf@suse.de,
	stefanha@redhat.com, pbonzini@redhat.com, afaerber@suse.de
Subject: [Qemu-devel] [PATCH v1 3/3] e1000: signal guest on successful link auto-negotiation
Date: Mon, 16 Jun 2014 13:29:11 -0400	[thread overview]
Message-ID: <1402939751-8371-4-git-send-email-somlo@cmu.edu> (raw)
In-Reply-To: <1402939751-8371-1-git-send-email-somlo@cmu.edu>

Generate a link status change interrupt once link auto-netotiation
is successfully completed. This does not affect Linux and Windows
(XP and 7 tested) in any way, but is needed by the stock OS X driver
(AppleIntel8254XEthernet.kext), which would otherwise fail to notice
the link status change event.

Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
---

While Windows and Linux e1000 drivers (and, apparently, the open-source
AppleIntelE1000.kext from SourceForge) don't need an LSC interrupt to
detect when the link comes on (maybe because they're polling for it, I'd
have to look through the source to be 100% sure), Apple's stock, "out of
the box" e1000 driver (AppleIntel8254XEthernet.kext) will not become
aware of the link status change unless we send it an interrupt.

I believe it's not an unreasonable thing to do, and it's definitely not
something that happens in the BIOS, as I previously (mistakenly) thought...

As I mentioned in the commit blurb above, Linux and Windows don't mind the
additional LSC interrupt (not that they should, but just making sure... :).

Finally, it may be better to simply move e1000_autoneg_timer() to somewhere
*after* set_ics() in the source file, to avoid the forward-reference, but
I figured I'd keep the visual noise to a minimum for now...

Thanks,
  Gabriel

 hw/net/e1000.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/net/e1000.c b/hw/net/e1000.c
index 04e4044..0c9b472 100644
--- a/hw/net/e1000.c
+++ b/hw/net/e1000.c
@@ -204,6 +204,8 @@ set_phy_ctrl(E1000State *s, int index, uint16_t val)
     }
 }
 
+static void set_ics(E1000State *s, int index, uint32_t val);
+
 static void
 e1000_autoneg_timer(void *opaque)
 {
@@ -213,6 +215,7 @@ e1000_autoneg_timer(void *opaque)
         s->phy_reg[PHY_LP_ABILITY] |= MII_LPAR_LPACK;
         s->phy_reg[PHY_STATUS] |= MII_SR_AUTONEG_COMPLETE;
         DBGOUT(PHY, "Auto negotiation is completed\n");
+        set_ics(s, 0, E1000_ICS_LSC); /* signal link status change to guest */
     }
 }
 
-- 
1.9.3

  parent reply	other threads:[~2014-06-16 17:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-16 17:29 [Qemu-devel] [PATCH v1 0/3] e1000: link auto-negotiation fixes Gabriel L. Somlo
2014-06-16 17:29 ` [Qemu-devel] [PATCH v1 1/3] e1000: emulate auto-negotiation during external link status change Gabriel L. Somlo
2014-06-19 13:51   ` Michael S. Tsirkin
2014-06-16 17:29 ` [Qemu-devel] [PATCH v1 2/3] e1000: improve auto-negotiation reporting via mii-tool Gabriel L. Somlo
2014-06-16 17:29 ` Gabriel L. Somlo [this message]
2014-06-16 22:35 ` [Qemu-devel] [PATCH v1 0/3] e1000: link auto-negotiation fixes Alexander Graf
2014-06-17  4:31   ` Paolo Bonzini
2014-06-17  6:33     ` Alexander Graf
2014-06-17  8:06       ` Paolo Bonzini
2014-06-17 10:48       ` Michael S. Tsirkin
2014-06-17 10:50         ` Alexander Graf
2014-06-18 10:19 ` Stefan Hajnoczi
2014-06-19 13:54 ` Michael S. Tsirkin

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=1402939751-8371-4-git-send-email-somlo@cmu.edu \
    --to=gsomlo@gmail.com \
    --cc=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=romain@dolbeau.org \
    --cc=stefanha@redhat.com \
    /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).