From: Akihiko Odaki Date: Tue, 23 May 2023 02:42:57 +0000 (+0900) Subject: igb: Clear IMS bits when committing ICR access X-Git-Tag: v8.0.1~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ba3c7bf178c8a94b2635a655918ee7ae991a9cf7;p=thirdparty%2Fqemu.git igb: Clear IMS bits when committing ICR access The datasheet says contradicting statements regarding ICR accesses so it is not reliable to determine the behavior of ICR accesses. However, e1000e does clear IMS bits when reading ICR accesses and Linux also expects ICR accesses will clear IMS bits according to: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/ethernet/intel/igb/igb_main.c?h=v6.2#n8048 Fixes: 3a977deebe ("Intrdocue igb device emulation") Signed-off-by: Akihiko Odaki Reviewed-by: Sriram Yagnaraman Signed-off-by: Jason Wang (cherry picked from commit f0b1df5c4502b5ec89f83417924935ab201511d0) Signed-off-by: Michael Tokarev --- diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index bc7af7963a1..e0ee70d1d73 100644 --- a/hw/net/igb_core.c +++ b/hw/net/igb_core.c @@ -2451,16 +2451,16 @@ igb_set_ims(IGBCore *core, int index, uint32_t val) static void igb_commit_icr(IGBCore *core) { /* - * If GPIE.NSICR = 0, then the copy of IAM to IMS will occur only if at + * If GPIE.NSICR = 0, then the clear of IMS will occur only if at * least one bit is set in the IMS and there is a true interrupt as * reflected in ICR.INTA. */ if ((core->mac[GPIE] & E1000_GPIE_NSICR) || (core->mac[IMS] && (core->mac[ICR] & E1000_ICR_INT_ASSERTED))) { - igb_set_ims(core, IMS, core->mac[IAM]); - } else { - igb_update_interrupt_state(core); + igb_clear_ims_bits(core, core->mac[IAM]); } + + igb_update_interrupt_state(core); } static void igb_set_icr(IGBCore *core, int index, uint32_t val)