From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38088) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y1TKA-0005Vv-3z for qemu-devel@nongnu.org; Thu, 18 Dec 2014 00:08:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y1TK5-000127-DD for qemu-devel@nongnu.org; Thu, 18 Dec 2014 00:08:30 -0500 Received: from mx4-phx2.redhat.com ([209.132.183.25]:44452) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y1TK5-000122-6H for qemu-devel@nongnu.org; Thu, 18 Dec 2014 00:08:25 -0500 Date: Thu, 18 Dec 2014 00:08:23 -0500 (EST) From: Jason Wang Message-ID: <1687228951.235198.1418879303199.JavaMail.zimbra@redhat.com> In-Reply-To: <1418275427-18921-2-git-send-email-rich.tollerton@ni.com> References: <1418275427-18921-1-git-send-email-rich.tollerton@ni.com> <1418275427-18921-2-git-send-email-rich.tollerton@ni.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 1/2] e1000: Clear MDIC register when PHY addr is invalid List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Tollerton Cc: mst@redhat.com, qemu-devel@nongnu.org, Jeff Westfahl , kraxel@redhat.com ----- Original Message ----- > Some drivers probe PHY addresses beyond the first one, and > also (unfortunately) don't check for MDIC_ERROR on reads. It appears > that the driver assumes that the data reads will return zero in this > case (invalid PHY address). Anecdotally, hardware is believed to do > this; but qemu wasn't, and instead was reusing the previous value of the > MDIC register. This screwed up driver init. > > To fix, don't reuse the current value of the MDIC register when an > invalid PHY address is referenced; let the value be set to precisely > MDIC_ERROR|MDIC_READY. > > Signed-off-by: Richard Tollerton > Signed-off-by: Jeff Westfahl > --- Looks correct. Reviewed-by: Jason Wang > hw/net/e1000.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/net/e1000.c b/hw/net/e1000.c > index e33a4da..44ae3a8 100644 > --- a/hw/net/e1000.c > +++ b/hw/net/e1000.c > @@ -457,7 +457,7 @@ set_mdic(E1000State *s, int index, uint32_t val) > uint32_t addr = ((val & E1000_MDIC_REG_MASK) >> E1000_MDIC_REG_SHIFT); > > if ((val & E1000_MDIC_PHY_MASK) >> E1000_MDIC_PHY_SHIFT != 1) // phy # > - val = s->mac_reg[MDIC] | E1000_MDIC_ERROR; > + val = E1000_MDIC_ERROR; > else if (val & E1000_MDIC_OP_READ) { > DBGOUT(MDIC, "MDIC read reg 0x%x\n", addr); > if (!(phy_regcap[addr] & PHY_R)) { > -- > 2.1.3 > > >