[PATCH] e1000e: Avoid hw_error if legacy mode used

Yuri Benditovich posted 1 patch 4 years, 3 months ago
Test FreeBSD passed
Test docker-mingw@fedora passed
Test checkpatch passed
Test docker-quick@centos7 passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20200127160312.31367-1-yuri.benditovich@daynix.com
Maintainers: Jason Wang <jasowang@redhat.com>, Dmitry Fleytman <dmitry.fleytman@gmail.com>
hw/net/e1000e_core.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
[PATCH] e1000e: Avoid hw_error if legacy mode used
Posted by Yuri Benditovich 4 years, 3 months ago
https://bugzilla.redhat.com/show_bug.cgi?id=1787142
The emulation issues hw_error if PSRCTL register
is written, for example, with zero value.
Such configuration does not present any problem when
DTYP bits of RCTL register define legacy format of
transfer descriptors. Current commit discards check
for BSIZE0 and BSIZE1 when legacy mode used.

Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
---
 hw/net/e1000e_core.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c
index 5b05c8ea8a..94ea34dca5 100644
--- a/hw/net/e1000e_core.c
+++ b/hw/net/e1000e_core.c
@@ -2813,12 +2813,15 @@ e1000e_set_eitr(E1000ECore *core, int index, uint32_t val)
 static void
 e1000e_set_psrctl(E1000ECore *core, int index, uint32_t val)
 {
-    if ((val & E1000_PSRCTL_BSIZE0_MASK) == 0) {
-        hw_error("e1000e: PSRCTL.BSIZE0 cannot be zero");
-    }
+    if (core->mac[RCTL] & E1000_RCTL_DTYP_MASK) {
+
+        if ((val & E1000_PSRCTL_BSIZE0_MASK) == 0) {
+            hw_error("e1000e: PSRCTL.BSIZE0 cannot be zero");
+        }
 
-    if ((val & E1000_PSRCTL_BSIZE1_MASK) == 0) {
-        hw_error("e1000e: PSRCTL.BSIZE1 cannot be zero");
+        if ((val & E1000_PSRCTL_BSIZE1_MASK) == 0) {
+            hw_error("e1000e: PSRCTL.BSIZE1 cannot be zero");
+        }
     }
 
     core->mac[PSRCTL] = val;
-- 
2.17.1


Re: [PATCH] e1000e: Avoid hw_error if legacy mode used
Posted by Jason Wang 4 years, 3 months ago
On 2020/1/28 上午12:03, Yuri Benditovich wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1787142
> The emulation issues hw_error if PSRCTL register
> is written, for example, with zero value.
> Such configuration does not present any problem when
> DTYP bits of RCTL register define legacy format of
> transfer descriptors. Current commit discards check
> for BSIZE0 and BSIZE1 when legacy mode used.
>
> Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
> ---
>   hw/net/e1000e_core.c | 13 ++++++++-----
>   1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c
> index 5b05c8ea8a..94ea34dca5 100644
> --- a/hw/net/e1000e_core.c
> +++ b/hw/net/e1000e_core.c
> @@ -2813,12 +2813,15 @@ e1000e_set_eitr(E1000ECore *core, int index, uint32_t val)
>   static void
>   e1000e_set_psrctl(E1000ECore *core, int index, uint32_t val)
>   {
> -    if ((val & E1000_PSRCTL_BSIZE0_MASK) == 0) {
> -        hw_error("e1000e: PSRCTL.BSIZE0 cannot be zero");
> -    }
> +    if (core->mac[RCTL] & E1000_RCTL_DTYP_MASK) {
> +
> +        if ((val & E1000_PSRCTL_BSIZE0_MASK) == 0) {
> +            hw_error("e1000e: PSRCTL.BSIZE0 cannot be zero");
> +        }
>   
> -    if ((val & E1000_PSRCTL_BSIZE1_MASK) == 0) {
> -        hw_error("e1000e: PSRCTL.BSIZE1 cannot be zero");
> +        if ((val & E1000_PSRCTL_BSIZE1_MASK) == 0) {
> +            hw_error("e1000e: PSRCTL.BSIZE1 cannot be zero");
> +        }
>       }
>   
>       core->mac[PSRCTL] = val;


Applied.

Thanks


Re: [PATCH] e1000e: Avoid hw_error if legacy mode used
Posted by Dmitry Fleytman 4 years, 3 months ago
> On 27 Jan 2020, at 18:03, Yuri Benditovich <yuri.benditovich@daynix.com> wrote:
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1787142
> The emulation issues hw_error if PSRCTL register
> is written, for example, with zero value.
> Such configuration does not present any problem when
> DTYP bits of RCTL register define legacy format of
> transfer descriptors. Current commit discards check
> for BSIZE0 and BSIZE1 when legacy mode used.
> 
> Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>

Acked-by: Dmitry Fleytman <dmitry.fleytman@gmail.com>

> ---
> hw/net/e1000e_core.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c
> index 5b05c8ea8a..94ea34dca5 100644
> --- a/hw/net/e1000e_core.c
> +++ b/hw/net/e1000e_core.c
> @@ -2813,12 +2813,15 @@ e1000e_set_eitr(E1000ECore *core, int index, uint32_t val)
> static void
> e1000e_set_psrctl(E1000ECore *core, int index, uint32_t val)
> {
> -    if ((val & E1000_PSRCTL_BSIZE0_MASK) == 0) {
> -        hw_error("e1000e: PSRCTL.BSIZE0 cannot be zero");
> -    }
> +    if (core->mac[RCTL] & E1000_RCTL_DTYP_MASK) {
> +
> +        if ((val & E1000_PSRCTL_BSIZE0_MASK) == 0) {
> +            hw_error("e1000e: PSRCTL.BSIZE0 cannot be zero");
> +        }
> 
> -    if ((val & E1000_PSRCTL_BSIZE1_MASK) == 0) {
> -        hw_error("e1000e: PSRCTL.BSIZE1 cannot be zero");
> +        if ((val & E1000_PSRCTL_BSIZE1_MASK) == 0) {
> +            hw_error("e1000e: PSRCTL.BSIZE1 cannot be zero");
> +        }
>     }
> 
>     core->mac[PSRCTL] = val;
> -- 
> 2.17.1
>