From patchwork Mon Jun 16 17:29:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gabriel L. Somlo" X-Patchwork-Id: 360209 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 9AFF0140080 for ; Tue, 17 Jun 2014 03:31:40 +1000 (EST) Received: from localhost ([::1]:45703 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wwaks-00013g-IW for incoming@patchwork.ozlabs.org; Mon, 16 Jun 2014 13:31:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33844) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wwaij-00065s-0I for qemu-devel@nongnu.org; Mon, 16 Jun 2014 13:29:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wwaid-0000G0-Al for qemu-devel@nongnu.org; Mon, 16 Jun 2014 13:29:24 -0400 Received: from mail-yk0-x22b.google.com ([2607:f8b0:4002:c07::22b]:48695) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wwaid-0000Fu-5k for qemu-devel@nongnu.org; Mon, 16 Jun 2014 13:29:19 -0400 Received: by mail-yk0-f171.google.com with SMTP id 200so4373658ykr.16 for ; Mon, 16 Jun 2014 10:29:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=m/KVuDFEMKlV6Err8lpti1+vKKXuFTe6HfQS5jBt2qE=; b=a0jAglyrGHnq0Q+7uldt65vBYykkdaRlsVIDdH4T35i64R9kW+qQv2Paej7ApcNKVW Pplv103mORRRQvnoZtr+EhyV9q6AHP4HXshww+8P5DF15WsGoQAQB/1W7CDKbrtpheOk iiwz7yf1YuDt+s8Fnju2YYZQr7Fh4DAb8Xmd/mgEyzrIrvszhALeD3w/wWNDvFWWqlPq uvmcHi/ns2feH7U4Zm8jU3FtvwDWWXwdPMcLqxFFDG8Aumvuwz0re4psjWsy+4CAF5L/ 2f2MpAQRazXC+SzoNsjdQnuIWs3Hn0tef5jcYxx92fPda+PQD6Zmb3FLu7Et76gyD+j0 AVsw== X-Received: by 10.229.220.197 with SMTP id hz5mr28657826qcb.9.1402939758722; Mon, 16 Jun 2014 10:29:18 -0700 (PDT) Received: from ERROL.ini.cmu.edu (ERROL.INI.CMU.EDU. [128.2.16.43]) by mx.google.com with ESMTPSA id d8sm22649164qas.24.2014.06.16.10.29.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Jun 2014 10:29:18 -0700 (PDT) From: "Gabriel L. Somlo" X-Google-Original-From: "Gabriel L. Somlo" To: qemu-devel@nongnu.org Date: Mon, 16 Jun 2014 13:29:11 -0400 Message-Id: <1402939751-8371-4-git-send-email-somlo@cmu.edu> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1402939751-8371-1-git-send-email-somlo@cmu.edu> References: <1402939751-8371-1-git-send-email-somlo@cmu.edu> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4002:c07::22b 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 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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 */ } }