From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49012) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtHPN-0003Zf-9v for qemu-devel@nongnu.org; Thu, 10 Jan 2013 07:39:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TtHPK-0004Rx-Mr for qemu-devel@nongnu.org; Thu, 10 Jan 2013 07:38:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52218) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtHPK-0004Rt-EI for qemu-devel@nongnu.org; Thu, 10 Jan 2013 07:38:54 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0ACcqOl008908 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 10 Jan 2013 07:38:53 -0500 Date: Thu, 10 Jan 2013 14:08:51 +0200 From: "Michael S. Tsirkin" Message-ID: <20130110120851.GA21858@redhat.com> References: <20130110120339.GA21794@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130110120339.GA21794@redhat.com> Subject: Re: [Qemu-devel] [PATCH] e1000: document ICS read behaviour List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Bill Paul Cc: Paolo Bonzini , Anthony Liguori , Jason Wang , Stefan Hajnoczi On Thu, Jan 10, 2013 at 02:03:39PM +0200, Michael S. Tsirkin wrote: > Add code comment to clarify the reason we set ICS with ICR: > the reason was previously undocumented and git > log (commit b1332393cdd7d023de8f1f8aa136ee7866a18968) > confused rather than clarified the comments. > Digging in the mailing list archives gives the real reason > https://lists.gnu.org/archive/html/qemu-devel/2009-06/msg00401.html > > Add code comment with an explanation supplied by Bill Paul. > > Signed-off-by: Michael S. Tsirkin This is v2 of the patch. > --- > hw/e1000.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/hw/e1000.c b/hw/e1000.c > index 92fb00a..d10119c 100644 > --- a/hw/e1000.c > +++ b/hw/e1000.c > @@ -230,7 +230,17 @@ set_interrupt_cause(E1000State *s, int index, uint32_t val) > val |= E1000_ICR_INT_ASSERTED; > } > s->mac_reg[ICR] = val; > + > + /* > + * Make sure ICR and ICS registers have the same value. > + * The spec says that the ICS register is write-only. However in practice, > + * on real hardware ICS is readable, and for reads it has the same value as > + * ICR (except that ICS does not have the clear on read behaviour of ICR). > + * > + * The VxWorks PRO/1000 driver uses this behaviour. > + */ > s->mac_reg[ICS] = val; > + > qemu_set_irq(s->dev.irq[0], (s->mac_reg[IMS] & s->mac_reg[ICR]) != 0); > } > > -- > MST