From patchwork Tue Sep 27 12:58:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 116599 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 743A5B6F70 for ; Tue, 27 Sep 2011 22:58:27 +1000 (EST) Received: from localhost ([::1]:34546 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8XEt-0003aN-Mk for incoming@patchwork.ozlabs.org; Tue, 27 Sep 2011 08:58:23 -0400 Received: from eggs.gnu.org ([140.186.70.92]:56337) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8XEZ-0002cn-6P for qemu-devel@nongnu.org; Tue, 27 Sep 2011 08:58:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R8XET-0000O5-5m for qemu-devel@nongnu.org; Tue, 27 Sep 2011 08:58:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47798) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8XES-0000Nz-Uf for qemu-devel@nongnu.org; Tue, 27 Sep 2011 08:57:57 -0400 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 p8RCvhPV014611 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 27 Sep 2011 08:57:44 -0400 Received: from redhat.com (dhcp-1-35.tlv.redhat.com [10.35.1.35]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p8RCvdKo026987; Tue, 27 Sep 2011 08:57:40 -0400 Date: Tue, 27 Sep 2011 15:58:52 +0300 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org, Andy Gospodarek , Dean Nelson , Jesse Brandeburg , Jeff Kirsher Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mutt-Fcc: =sent User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 209.132.183.28 Cc: peter.maydell@linaro.org, Anthony Liguori , "Michael S. Tsirkin" , Alex Williamson , Anthony PERARD , Kevin Wolf , Aurelien Jarno Subject: [Qemu-devel] [PATCH 2/2] e1000: CTRL.RST emulation 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 e1000 spec says CTRL.RST write should have the same effect as bus reset, except that is preserves PCI Config. Reset device registers and interrupts. Fix suggested by Andy Gospodarek Similar fix proposed by Anthony PERARD Signed-off-by: Michael S. Tsirkin --- hw/e1000.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/e1000.c b/hw/e1000.c index 87a1104..b51e089 100644 --- a/hw/e1000.c +++ b/hw/e1000.c @@ -241,8 +241,13 @@ static void e1000_reset(void *opaque) static void set_ctrl(E1000State *s, int index, uint32_t val) { - /* RST is self clearing */ - s->mac_reg[CTRL] = val & ~E1000_CTRL_RST; + if (val & E1000_CTRL_RST) { + e1000_reset(s); + qemu_set_irq(s->dev.irq[0], 0); + return; + } + + s->mac_reg[CTRL] = val; } static void