Received: from eggs.gnu.org ([2001:4830:134:3::10]:55307) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1boRmU-00082c-VQ for qemu-devel@nongnu.org; Mon, 26 Sep 2016 05:00:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1boRmT-0000Qf-5p for qemu-devel@nongnu.org; Mon, 26 Sep 2016 05:00:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59280) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1boRmS-0000QU-VL for qemu-devel@nongnu.org; Mon, 26 Sep 2016 05:00:57 -0400 From: Jason Wang Date: Mon, 26 Sep 2016 16:59:32 +0800 Message-Id: <1474880375-22946-25-git-send-email-jasowang@redhat.com> In-Reply-To: <1474880375-22946-1-git-send-email-jasowang@redhat.com> References: <1474880375-22946-1-git-send-email-jasowang@redhat.com> Subject: [Qemu-devel] [PULL 24/27] e1000e: Fix EIAC register implementation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.maydell@linaro.org Cc: qemu-devel@nongnu.org, Dmitry Fleytman , Jason Wang From: Dmitry Fleytman This patch fixes 2 issues: 1. Bits set in EIAC register should be cleared from IMS when EIAM is not used. 2. Only bit that corresonds to the interrupt being raised should be cleared. See spec. 10.2.4.7 Interrupt Auto Clear Signed-off-by: Dmitry Fleytman Signed-off-by: Jason Wang --- hw/net/e1000e_core.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c index 0298136..6505983 100644 --- a/hw/net/e1000e_core.c +++ b/hw/net/e1000e_core.c @@ -2015,13 +2015,17 @@ e1000e_msix_notify_one(E1000ECore *core, uint32_t cause, uint32_t int_cfg) trace_e1000e_irq_icr_clear_eiac(core->mac[ICR], core->mac[EIAC]); - if (core->mac[EIAC] & E1000_ICR_OTHER) { - effective_eiac = (core->mac[EIAC] & E1000_EIAC_MASK) | - E1000_ICR_OTHER_CAUSES; - } else { - effective_eiac = core->mac[EIAC] & E1000_EIAC_MASK; + effective_eiac = core->mac[EIAC] & cause; + + if (effective_eiac == E1000_ICR_OTHER) { + effective_eiac |= E1000_ICR_OTHER_CAUSES; } + core->mac[ICR] &= ~effective_eiac; + + if (!(core->mac[CTRL_EXT] & E1000_CTRL_EXT_IAME)) { + core->mac[IMS] &= ~effective_eiac; + } } static void -- 2.7.4