qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Richard Tollerton <rich.tollerton@ni.com>
Cc: mst@redhat.com, qemu-devel@nongnu.org,
	Jeff Westfahl <jeff.westfahl@ni.com>,
	kraxel@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 1/2] e1000: Clear MDIC register when PHY	addr is invalid
Date: Thu, 18 Dec 2014 00:08:23 -0500 (EST)	[thread overview]
Message-ID: <1687228951.235198.1418879303199.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <1418275427-18921-2-git-send-email-rich.tollerton@ni.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 <rich.tollerton@ni.com>
> Signed-off-by: Jeff Westfahl <jeff.westfahl@ni.com>
> ---

Looks correct.

Reviewed-by: Jason Wang <jasowang@redhat.com>
>  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
> 
> 
> 

  reply	other threads:[~2014-12-18  5:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-11  5:23 [Qemu-devel] [PATCH v2 0/2] e1000: fixes for Phar Lap ETS Richard Tollerton
2014-12-11  5:23 ` [Qemu-devel] [PATCH v2 1/2] e1000: Clear MDIC register when PHY addr is invalid Richard Tollerton
2014-12-18  5:08   ` Jason Wang [this message]
2014-12-11  5:23 ` [Qemu-devel] [PATCH v2 2/2] e1000: decrement RDT if equal to RDH Richard Tollerton
2014-12-18  5:01   ` Jason Wang
2015-01-12 10:24     ` Michael S. Tsirkin
2015-01-12 19:12       ` Richard Tollerton
2015-01-13  6:48         ` Jason Wang
2015-01-13 21:06           ` Richard Tollerton
2015-01-14  9:48             ` Jason Wang
2015-03-24  9:37 ` [Qemu-devel] [PATCH v2 0/2] e1000: fixes for Phar Lap ETS Stefan Hajnoczi
2015-03-25  6:02   ` Richard Tollerton

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=1687228951.235198.1418879303199.JavaMail.zimbra@redhat.com \
    --to=jasowang@redhat.com \
    --cc=jeff.westfahl@ni.com \
    --cc=kraxel@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rich.tollerton@ni.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).