All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] hw/net: e1000e: Clear ICR on read when using non MSI-X interrupts
@ 2022-02-12  9:44 Nick Hudson
  2022-02-14  3:33 ` Jason Wang
  0 siblings, 1 reply; 2+ messages in thread
From: Nick Hudson @ 2022-02-12  9:44 UTC (permalink / raw)
  Cc: Jason Wang, Dmitry Fleytman, open list:All patches CC here

In section 7.4.3 of the 82574 datasheet it states that

    "In systems that do not support MSI-X, reading the ICR
     register clears it's bits..."

Some OSes rely on this.

Signed-off-by: Nick Hudson <skrll@netbsd.org>
---
 hw/net/e1000e_core.c | 5 +++++
 hw/net/trace-events  | 1 +
 2 files changed, 6 insertions(+)

diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c
index 8ae6fb7e14..2c51089a82 100644
--- a/hw/net/e1000e_core.c
+++ b/hw/net/e1000e_core.c
@@ -2607,6 +2607,11 @@ e1000e_mac_icr_read(E1000ECore *core, int index)
         core->mac[ICR] = 0;
     }
 
+    if (!msix_enabled(core->owner)) {
+        trace_e1000e_irq_icr_clear_nonmsix_icr_read();
+        core->mac[ICR] = 0;
+    }
+
     if ((core->mac[ICR] & E1000_ICR_ASSERTED) &&
         (core->mac[CTRL_EXT] & E1000_CTRL_EXT_IAME)) {
         trace_e1000e_irq_icr_clear_iame();
diff --git a/hw/net/trace-events b/hw/net/trace-events
index 643338f610..4c0ec3fda1 100644
--- a/hw/net/trace-events
+++ b/hw/net/trace-events
@@ -221,6 +221,7 @@ e1000e_irq_write_ics(uint32_t val) "Adding ICR bits 0x%x"
 e1000e_irq_icr_process_iame(void) "Clearing IMS bits due to IAME"
 e1000e_irq_read_ics(uint32_t ics) "Current ICS: 0x%x"
 e1000e_irq_read_ims(uint32_t ims) "Current IMS: 0x%x"
+e1000e_irq_icr_clear_nonmsix_icr_read(void) "Clearing ICR on read due to non MSI-X int"
 e1000e_irq_icr_read_entry(uint32_t icr) "Starting ICR read. Current ICR: 0x%x"
 e1000e_irq_icr_read_exit(uint32_t icr) "Ending ICR read. Current ICR: 0x%x"
 e1000e_irq_icr_clear_zero_ims(void) "Clearing ICR on read due to zero IMS"
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] hw/net: e1000e: Clear ICR on read when using non MSI-X interrupts
  2022-02-12  9:44 [PATCH v2] hw/net: e1000e: Clear ICR on read when using non MSI-X interrupts Nick Hudson
@ 2022-02-14  3:33 ` Jason Wang
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Wang @ 2022-02-14  3:33 UTC (permalink / raw)
  To: Nick Hudson; +Cc: Dmitry Fleytman, open list:All patches CC here


在 2022/2/12 下午5:44, Nick Hudson 写道:
> In section 7.4.3 of the 82574 datasheet it states that
>
>      "In systems that do not support MSI-X, reading the ICR
>       register clears it's bits..."
>
> Some OSes rely on this.
>
> Signed-off-by: Nick Hudson <skrll@netbsd.org>


Applied.

Thanks


> ---
>   hw/net/e1000e_core.c | 5 +++++
>   hw/net/trace-events  | 1 +
>   2 files changed, 6 insertions(+)
>
> diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c
> index 8ae6fb7e14..2c51089a82 100644
> --- a/hw/net/e1000e_core.c
> +++ b/hw/net/e1000e_core.c
> @@ -2607,6 +2607,11 @@ e1000e_mac_icr_read(E1000ECore *core, int index)
>           core->mac[ICR] = 0;
>       }
>   
> +    if (!msix_enabled(core->owner)) {
> +        trace_e1000e_irq_icr_clear_nonmsix_icr_read();
> +        core->mac[ICR] = 0;
> +    }
> +
>       if ((core->mac[ICR] & E1000_ICR_ASSERTED) &&
>           (core->mac[CTRL_EXT] & E1000_CTRL_EXT_IAME)) {
>           trace_e1000e_irq_icr_clear_iame();
> diff --git a/hw/net/trace-events b/hw/net/trace-events
> index 643338f610..4c0ec3fda1 100644
> --- a/hw/net/trace-events
> +++ b/hw/net/trace-events
> @@ -221,6 +221,7 @@ e1000e_irq_write_ics(uint32_t val) "Adding ICR bits 0x%x"
>   e1000e_irq_icr_process_iame(void) "Clearing IMS bits due to IAME"
>   e1000e_irq_read_ics(uint32_t ics) "Current ICS: 0x%x"
>   e1000e_irq_read_ims(uint32_t ims) "Current IMS: 0x%x"
> +e1000e_irq_icr_clear_nonmsix_icr_read(void) "Clearing ICR on read due to non MSI-X int"
>   e1000e_irq_icr_read_entry(uint32_t icr) "Starting ICR read. Current ICR: 0x%x"
>   e1000e_irq_icr_read_exit(uint32_t icr) "Ending ICR read. Current ICR: 0x%x"
>   e1000e_irq_icr_clear_zero_ims(void) "Clearing ICR on read due to zero IMS"



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-14  3:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-12  9:44 [PATCH v2] hw/net: e1000e: Clear ICR on read when using non MSI-X interrupts Nick Hudson
2022-02-14  3:33 ` Jason Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.