All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hw/m68k/mcf52xx: Replace hw_error() by qemu_log_mask()
@ 2020-05-18  9:49 Philippe Mathieu-Daudé
  2020-05-18 16:32 ` Thomas Huth
  0 siblings, 1 reply; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-18  9:49 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, Jason Wang, Laurent Vivier, Philippe Mathieu-Daudé

hw_error() calls exit(). This a bit overkill when we can log
the accesses as unimplemented or guest error.

When fuzzing the devices, we don't want the whole process to
exit. Replace some hw_error() calls by qemu_log_mask().

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/m68k/mcf5206.c  |  7 +++++--
 hw/m68k/mcf5208.c  | 14 +++++++++-----
 hw/m68k/mcf_intc.c |  4 +++-
 hw/net/mcf_fec.c   |  8 +++++---
 4 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/hw/m68k/mcf5206.c b/hw/m68k/mcf5206.c
index b155dd8170..34a863a588 100644
--- a/hw/m68k/mcf5206.c
+++ b/hw/m68k/mcf5206.c
@@ -8,6 +8,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu/error-report.h"
+#include "qemu/log.h"
 #include "cpu.h"
 #include "hw/hw.h"
 #include "hw/irq.h"
@@ -306,7 +307,8 @@ static uint64_t m5206_mbar_read(m5206_mbar_state *s,
     case 0x170: return s->uivr[0];
     case 0x1b0: return s->uivr[1];
     }
-    hw_error("Bad MBAR read offset 0x%x", (int)offset);
+    qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad MBAR offset 0x%" HWADDR_PRIX "\n",
+                  __func__, offset);
     return 0;
 }
 
@@ -360,7 +362,8 @@ static void m5206_mbar_write(m5206_mbar_state *s, uint32_t offset,
         s->uivr[1] = value;
         break;
     default:
-        hw_error("Bad MBAR write offset 0x%x", (int)offset);
+        qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad MBAR offset 0x%x\n",
+                      __func__, offset);
         break;
     }
 }
diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c
index b84c152ce3..cd8a32e0c6 100644
--- a/hw/m68k/mcf5208.c
+++ b/hw/m68k/mcf5208.c
@@ -9,10 +9,10 @@
 #include "qemu/osdep.h"
 #include "qemu/units.h"
 #include "qemu/error-report.h"
+#include "qemu/log.h"
 #include "qapi/error.h"
 #include "qemu-common.h"
 #include "cpu.h"
-#include "hw/hw.h"
 #include "hw/irq.h"
 #include "hw/m68k/mcf.h"
 #include "hw/m68k/mcf_fec.h"
@@ -111,7 +111,8 @@ static void m5208_timer_write(void *opaque, hwaddr offset,
     case 4:
         break;
     default:
-        hw_error("m5208_timer_write: Bad offset 0x%x\n", (int)offset);
+        qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
+                      __func__, offset);
         break;
     }
     m5208_timer_update(s);
@@ -136,7 +137,8 @@ static uint64_t m5208_timer_read(void *opaque, hwaddr addr,
     case 4:
         return ptimer_get_count(s->timer);
     default:
-        hw_error("m5208_timer_read: Bad offset 0x%x\n", (int)addr);
+        qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
+                      __func__, addr);
         return 0;
     }
 }
@@ -164,7 +166,8 @@ static uint64_t m5208_sys_read(void *opaque, hwaddr addr,
         return 0;
 
     default:
-        hw_error("m5208_sys_read: Bad offset 0x%x\n", (int)addr);
+        qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
+                      __func__, addr);
         return 0;
     }
 }
@@ -172,7 +175,8 @@ static uint64_t m5208_sys_read(void *opaque, hwaddr addr,
 static void m5208_sys_write(void *opaque, hwaddr addr,
                             uint64_t value, unsigned size)
 {
-    hw_error("m5208_sys_write: Bad offset 0x%x\n", (int)addr);
+    qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
+                  __func__, addr);
 }
 
 static const MemoryRegionOps m5208_sys_ops = {
diff --git a/hw/m68k/mcf_intc.c b/hw/m68k/mcf_intc.c
index d9e03a06ab..7dddf17d33 100644
--- a/hw/m68k/mcf_intc.c
+++ b/hw/m68k/mcf_intc.c
@@ -8,6 +8,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu/module.h"
+#include "qemu/log.h"
 #include "cpu.h"
 #include "hw/hw.h"
 #include "hw/irq.h"
@@ -127,7 +128,8 @@ static void mcf_intc_write(void *opaque, hwaddr addr,
         }
         break;
     default:
-        hw_error("mcf_intc_write: Bad write offset %d\n", offset);
+        qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%02x\n",
+                      __func__, offset);
         break;
     }
     mcf_intc_update(s);
diff --git a/hw/net/mcf_fec.c b/hw/net/mcf_fec.c
index 9327ac8a30..b3a92c0114 100644
--- a/hw/net/mcf_fec.c
+++ b/hw/net/mcf_fec.c
@@ -7,7 +7,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "hw/hw.h"
+#include "qemu/log.h"
 #include "hw/irq.h"
 #include "net/net.h"
 #include "qemu/module.h"
@@ -392,7 +392,8 @@ static uint64_t mcf_fec_read(void *opaque, hwaddr addr,
     case 0x188: return s->emrbr;
     case 0x200 ... 0x2e0: return s->mib[(addr & 0x1ff) / 4];
     default:
-        hw_error("mcf_fec_read: Bad address 0x%x\n", (int)addr);
+        qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad address 0x%" HWADDR_PRIX "\n",
+                      __func__, addr);
         return 0;
     }
 }
@@ -492,7 +493,8 @@ static void mcf_fec_write(void *opaque, hwaddr addr,
         s->mib[(addr & 0x1ff) / 4] = value;
         break;
     default:
-        hw_error("mcf_fec_write Bad address 0x%x\n", (int)addr);
+        qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad address 0x%" HWADDR_PRIX "\n",
+                      __func__, addr);
     }
     mcf_fec_update(s);
 }
-- 
2.21.3



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

* Re: [PATCH] hw/m68k/mcf52xx: Replace hw_error() by qemu_log_mask()
  2020-05-18  9:49 [PATCH] hw/m68k/mcf52xx: Replace hw_error() by qemu_log_mask() Philippe Mathieu-Daudé
@ 2020-05-18 16:32 ` Thomas Huth
  2020-05-18 16:58   ` Philippe Mathieu-Daudé
  2020-05-18 17:08   ` Philippe Mathieu-Daudé
  0 siblings, 2 replies; 6+ messages in thread
From: Thomas Huth @ 2020-05-18 16:32 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Thomas Huth, Jason Wang, Laurent Vivier

On 18/05/2020 11.49, Philippe Mathieu-Daudé wrote:
> hw_error() calls exit(). This a bit overkill when we can log
> the accesses as unimplemented or guest error.

Good idea. hw_error() is also mainly for CPU errors, it really should
not be used for non-CPU devices.

> When fuzzing the devices, we don't want the whole process to
> exit. Replace some hw_error() calls by qemu_log_mask().
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/m68k/mcf5206.c  |  7 +++++--
>  hw/m68k/mcf5208.c  | 14 +++++++++-----
>  hw/m68k/mcf_intc.c |  4 +++-
>  hw/net/mcf_fec.c   |  8 +++++---
>  4 files changed, 22 insertions(+), 11 deletions(-)
> 
> diff --git a/hw/m68k/mcf5206.c b/hw/m68k/mcf5206.c
> index b155dd8170..34a863a588 100644
> --- a/hw/m68k/mcf5206.c
> +++ b/hw/m68k/mcf5206.c
> @@ -8,6 +8,7 @@
>  
>  #include "qemu/osdep.h"
>  #include "qemu/error-report.h"
> +#include "qemu/log.h"
>  #include "cpu.h"
>  #include "hw/hw.h"
>  #include "hw/irq.h"
> @@ -306,7 +307,8 @@ static uint64_t m5206_mbar_read(m5206_mbar_state *s,
>      case 0x170: return s->uivr[0];
>      case 0x1b0: return s->uivr[1];
>      }
> -    hw_error("Bad MBAR read offset 0x%x", (int)offset);
> +    qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad MBAR offset 0x%" HWADDR_PRIX "\n",

offset seems to be uint64_t in this function, so I think this should
rather use PRIx64 instead of HWADDR_PRIX ? Or maybe check whether we can
change the offset to uint32_t ?

> +                  __func__, offset);
>      return 0;
>  }
>  
> @@ -360,7 +362,8 @@ static void m5206_mbar_write(m5206_mbar_state *s, uint32_t offset,
>          s->uivr[1] = value;
>          break;
>      default:
> -        hw_error("Bad MBAR write offset 0x%x", (int)offset);
> +        qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad MBAR offset 0x%x\n",
> +                      __func__, offset);

Here offset seems to be uint32_t ... so I guess it should be fine for
the _read function, too.

>          break;
>      }
>  }
> diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c
> index b84c152ce3..cd8a32e0c6 100644
> --- a/hw/m68k/mcf5208.c
> +++ b/hw/m68k/mcf5208.c
> @@ -9,10 +9,10 @@
>  #include "qemu/osdep.h"
>  #include "qemu/units.h"
>  #include "qemu/error-report.h"
> +#include "qemu/log.h"
>  #include "qapi/error.h"
>  #include "qemu-common.h"
>  #include "cpu.h"
> -#include "hw/hw.h"
>  #include "hw/irq.h"
>  #include "hw/m68k/mcf.h"
>  #include "hw/m68k/mcf_fec.h"
> @@ -111,7 +111,8 @@ static void m5208_timer_write(void *opaque, hwaddr offset,
>      case 4:
>          break;
>      default:
> -        hw_error("m5208_timer_write: Bad offset 0x%x\n", (int)offset);
> +        qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
> +                      __func__, offset);
>          break;

Should the "break" be replaced by a "return" now?

>      }
>      m5208_timer_update(s);
> @@ -136,7 +137,8 @@ static uint64_t m5208_timer_read(void *opaque, hwaddr addr,
>      case 4:
>          return ptimer_get_count(s->timer);
>      default:
> -        hw_error("m5208_timer_read: Bad offset 0x%x\n", (int)addr);
> +        qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
> +                      __func__, addr);
>          return 0;
>      }
>  }
> @@ -164,7 +166,8 @@ static uint64_t m5208_sys_read(void *opaque, hwaddr addr,
>          return 0;
>  
>      default:
> -        hw_error("m5208_sys_read: Bad offset 0x%x\n", (int)addr);
> +        qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
> +                      __func__, addr);
>          return 0;
>      }
>  }
> @@ -172,7 +175,8 @@ static uint64_t m5208_sys_read(void *opaque, hwaddr addr,
>  static void m5208_sys_write(void *opaque, hwaddr addr,
>                              uint64_t value, unsigned size)
>  {
> -    hw_error("m5208_sys_write: Bad offset 0x%x\n", (int)addr);
> +    qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
> +                  __func__, addr);
>  }
>  
>  static const MemoryRegionOps m5208_sys_ops = {
> diff --git a/hw/m68k/mcf_intc.c b/hw/m68k/mcf_intc.c
> index d9e03a06ab..7dddf17d33 100644
> --- a/hw/m68k/mcf_intc.c
> +++ b/hw/m68k/mcf_intc.c
> @@ -8,6 +8,7 @@
>  
>  #include "qemu/osdep.h"
>  #include "qemu/module.h"
> +#include "qemu/log.h"
>  #include "cpu.h"
>  #include "hw/hw.h"
>  #include "hw/irq.h"
> @@ -127,7 +128,8 @@ static void mcf_intc_write(void *opaque, hwaddr addr,
>          }
>          break;
>      default:
> -        hw_error("mcf_intc_write: Bad write offset %d\n", offset);
> +        qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%02x\n",
> +                      __func__, offset);
>          break;

"return" instead of "break" ?

>      }
>      mcf_intc_update(s);
> diff --git a/hw/net/mcf_fec.c b/hw/net/mcf_fec.c
> index 9327ac8a30..b3a92c0114 100644
> --- a/hw/net/mcf_fec.c
> +++ b/hw/net/mcf_fec.c
> @@ -7,7 +7,7 @@
>   */
>  
>  #include "qemu/osdep.h"
> -#include "hw/hw.h"
> +#include "qemu/log.h"
>  #include "hw/irq.h"
>  #include "net/net.h"
>  #include "qemu/module.h"
> @@ -392,7 +392,8 @@ static uint64_t mcf_fec_read(void *opaque, hwaddr addr,
>      case 0x188: return s->emrbr;
>      case 0x200 ... 0x2e0: return s->mib[(addr & 0x1ff) / 4];
>      default:
> -        hw_error("mcf_fec_read: Bad address 0x%x\n", (int)addr);
> +        qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad address 0x%" HWADDR_PRIX "\n",
> +                      __func__, addr);
>          return 0;
>      }
>  }
> @@ -492,7 +493,8 @@ static void mcf_fec_write(void *opaque, hwaddr addr,
>          s->mib[(addr & 0x1ff) / 4] = value;
>          break;
>      default:
> -        hw_error("mcf_fec_write Bad address 0x%x\n", (int)addr);
> +        qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad address 0x%" HWADDR_PRIX "\n",
> +                      __func__, addr);

return here?

>      }
>      mcf_fec_update(s);
>  }
> 

 Thomas



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

* Re: [PATCH] hw/m68k/mcf52xx: Replace hw_error() by qemu_log_mask()
  2020-05-18 16:32 ` Thomas Huth
@ 2020-05-18 16:58   ` Philippe Mathieu-Daudé
  2020-05-18 17:08   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-18 16:58 UTC (permalink / raw)
  To: Thomas Huth, qemu-devel; +Cc: Thomas Huth, Jason Wang, Laurent Vivier

On 5/18/20 6:32 PM, Thomas Huth wrote:
> On 18/05/2020 11.49, Philippe Mathieu-Daudé wrote:
>> hw_error() calls exit(). This a bit overkill when we can log
>> the accesses as unimplemented or guest error.
> 
> Good idea. hw_error() is also mainly for CPU errors, it really should
> not be used for non-CPU devices.
> 
>> When fuzzing the devices, we don't want the whole process to
>> exit. Replace some hw_error() calls by qemu_log_mask().
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>>   hw/m68k/mcf5206.c  |  7 +++++--
>>   hw/m68k/mcf5208.c  | 14 +++++++++-----
>>   hw/m68k/mcf_intc.c |  4 +++-
>>   hw/net/mcf_fec.c   |  8 +++++---
>>   4 files changed, 22 insertions(+), 11 deletions(-)
>>
>> diff --git a/hw/m68k/mcf5206.c b/hw/m68k/mcf5206.c
>> index b155dd8170..34a863a588 100644
>> --- a/hw/m68k/mcf5206.c
>> +++ b/hw/m68k/mcf5206.c
>> @@ -8,6 +8,7 @@
>>   
>>   #include "qemu/osdep.h"
>>   #include "qemu/error-report.h"
>> +#include "qemu/log.h"
>>   #include "cpu.h"
>>   #include "hw/hw.h"
>>   #include "hw/irq.h"
>> @@ -306,7 +307,8 @@ static uint64_t m5206_mbar_read(m5206_mbar_state *s,
>>       case 0x170: return s->uivr[0];
>>       case 0x1b0: return s->uivr[1];
>>       }
>> -    hw_error("Bad MBAR read offset 0x%x", (int)offset);
>> +    qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad MBAR offset 0x%" HWADDR_PRIX "\n",
> 
> offset seems to be uint64_t in this function, so I think this should
> rather use PRIx64 instead of HWADDR_PRIX ? Or maybe check whether we can
> change the offset to uint32_t ?

Too many copy/pasting, sorry.

> 
>> +                  __func__, offset);
>>       return 0;
>>   }
>>   
>> @@ -360,7 +362,8 @@ static void m5206_mbar_write(m5206_mbar_state *s, uint32_t offset,
>>           s->uivr[1] = value;
>>           break;
>>       default:
>> -        hw_error("Bad MBAR write offset 0x%x", (int)offset);
>> +        qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad MBAR offset 0x%x\n",
>> +                      __func__, offset);
> 
> Here offset seems to be uint32_t ... so I guess it should be fine for
> the _read function, too.
> 
>>           break;
>>       }
>>   }
>> diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c
>> index b84c152ce3..cd8a32e0c6 100644
>> --- a/hw/m68k/mcf5208.c
>> +++ b/hw/m68k/mcf5208.c
>> @@ -9,10 +9,10 @@
>>   #include "qemu/osdep.h"
>>   #include "qemu/units.h"
>>   #include "qemu/error-report.h"
>> +#include "qemu/log.h"
>>   #include "qapi/error.h"
>>   #include "qemu-common.h"
>>   #include "cpu.h"
>> -#include "hw/hw.h"
>>   #include "hw/irq.h"
>>   #include "hw/m68k/mcf.h"
>>   #include "hw/m68k/mcf_fec.h"
>> @@ -111,7 +111,8 @@ static void m5208_timer_write(void *opaque, hwaddr offset,
>>       case 4:
>>           break;
>>       default:
>> -        hw_error("m5208_timer_write: Bad offset 0x%x\n", (int)offset);
>> +        qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
>> +                      __func__, offset);
>>           break;
> 
> Should the "break" be replaced by a "return" now?

I was not sure, OK.

> 
>>       }
>>       m5208_timer_update(s);
>> @@ -136,7 +137,8 @@ static uint64_t m5208_timer_read(void *opaque, hwaddr addr,
>>       case 4:
>>           return ptimer_get_count(s->timer);
>>       default:
>> -        hw_error("m5208_timer_read: Bad offset 0x%x\n", (int)addr);
>> +        qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
>> +                      __func__, addr);
>>           return 0;
>>       }
>>   }
>> @@ -164,7 +166,8 @@ static uint64_t m5208_sys_read(void *opaque, hwaddr addr,
>>           return 0;
>>   
>>       default:
>> -        hw_error("m5208_sys_read: Bad offset 0x%x\n", (int)addr);
>> +        qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
>> +                      __func__, addr);
>>           return 0;
>>       }
>>   }
>> @@ -172,7 +175,8 @@ static uint64_t m5208_sys_read(void *opaque, hwaddr addr,
>>   static void m5208_sys_write(void *opaque, hwaddr addr,
>>                               uint64_t value, unsigned size)
>>   {
>> -    hw_error("m5208_sys_write: Bad offset 0x%x\n", (int)addr);
>> +    qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
>> +                  __func__, addr);
>>   }
>>   
>>   static const MemoryRegionOps m5208_sys_ops = {
>> diff --git a/hw/m68k/mcf_intc.c b/hw/m68k/mcf_intc.c
>> index d9e03a06ab..7dddf17d33 100644
>> --- a/hw/m68k/mcf_intc.c
>> +++ b/hw/m68k/mcf_intc.c
>> @@ -8,6 +8,7 @@
>>   
>>   #include "qemu/osdep.h"
>>   #include "qemu/module.h"
>> +#include "qemu/log.h"
>>   #include "cpu.h"
>>   #include "hw/hw.h"
>>   #include "hw/irq.h"
>> @@ -127,7 +128,8 @@ static void mcf_intc_write(void *opaque, hwaddr addr,
>>           }
>>           break;
>>       default:
>> -        hw_error("mcf_intc_write: Bad write offset %d\n", offset);
>> +        qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%02x\n",
>> +                      __func__, offset);
>>           break;
> 
> "return" instead of "break" ?
> 
>>       }
>>       mcf_intc_update(s);
>> diff --git a/hw/net/mcf_fec.c b/hw/net/mcf_fec.c
>> index 9327ac8a30..b3a92c0114 100644
>> --- a/hw/net/mcf_fec.c
>> +++ b/hw/net/mcf_fec.c
>> @@ -7,7 +7,7 @@
>>    */
>>   
>>   #include "qemu/osdep.h"
>> -#include "hw/hw.h"
>> +#include "qemu/log.h"
>>   #include "hw/irq.h"
>>   #include "net/net.h"
>>   #include "qemu/module.h"
>> @@ -392,7 +392,8 @@ static uint64_t mcf_fec_read(void *opaque, hwaddr addr,
>>       case 0x188: return s->emrbr;
>>       case 0x200 ... 0x2e0: return s->mib[(addr & 0x1ff) / 4];
>>       default:
>> -        hw_error("mcf_fec_read: Bad address 0x%x\n", (int)addr);
>> +        qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad address 0x%" HWADDR_PRIX "\n",
>> +                      __func__, addr);
>>           return 0;
>>       }
>>   }
>> @@ -492,7 +493,8 @@ static void mcf_fec_write(void *opaque, hwaddr addr,
>>           s->mib[(addr & 0x1ff) / 4] = value;
>>           break;
>>       default:
>> -        hw_error("mcf_fec_write Bad address 0x%x\n", (int)addr);
>> +        qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad address 0x%" HWADDR_PRIX "\n",
>> +                      __func__, addr);
> 
> return here?
> 
>>       }
>>       mcf_fec_update(s);
>>   }
>>
> 
>   Thomas
> 
> 


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

* Re: [PATCH] hw/m68k/mcf52xx: Replace hw_error() by qemu_log_mask()
  2020-05-18 16:32 ` Thomas Huth
  2020-05-18 16:58   ` Philippe Mathieu-Daudé
@ 2020-05-18 17:08   ` Philippe Mathieu-Daudé
  2020-05-18 17:17     ` Thomas Huth
  1 sibling, 1 reply; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-18 17:08 UTC (permalink / raw)
  To: Thomas Huth, qemu-devel; +Cc: Thomas Huth, Jason Wang, Laurent Vivier

On 5/18/20 6:32 PM, Thomas Huth wrote:
> On 18/05/2020 11.49, Philippe Mathieu-Daudé wrote:
>> hw_error() calls exit(). This a bit overkill when we can log
>> the accesses as unimplemented or guest error.
> 
> Good idea. hw_error() is also mainly for CPU errors, it really should
> not be used for non-CPU devices.

Are you sure?

$ git grep hw_error target | wc -l
5
$ git grep hw_error hw | wc -l
137

[...]


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

* Re: [PATCH] hw/m68k/mcf52xx: Replace hw_error() by qemu_log_mask()
  2020-05-18 17:08   ` Philippe Mathieu-Daudé
@ 2020-05-18 17:17     ` Thomas Huth
  2020-05-18 17:24       ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Huth @ 2020-05-18 17:17 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Thomas Huth, qemu-devel
  Cc: Thomas Huth, Jason Wang, Laurent Vivier

On 18/05/2020 19.08, Philippe Mathieu-Daudé wrote:
> On 5/18/20 6:32 PM, Thomas Huth wrote:
>> On 18/05/2020 11.49, Philippe Mathieu-Daudé wrote:
>>> hw_error() calls exit(). This a bit overkill when we can log
>>> the accesses as unimplemented or guest error.
>>
>> Good idea. hw_error() is also mainly for CPU errors, it really should
>> not be used for non-CPU devices.
> 
> Are you sure?
> 
> $ git grep hw_error target | wc -l
> 5
> $ git grep hw_error hw | wc -l
> 137

Well, the function is defined in cpus.c and it's dumping the state of
each CPU ... I think it's used in a lot of places during development of
new code to quickly get some information on where things went wrong in
the guest, but technically, it really sounds wrong to me that a non-CPU
device creates CPU dumps in mature code.

 Thomas


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

* Re: [PATCH] hw/m68k/mcf52xx: Replace hw_error() by qemu_log_mask()
  2020-05-18 17:17     ` Thomas Huth
@ 2020-05-18 17:24       ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-18 17:24 UTC (permalink / raw)
  To: Thomas Huth, Thomas Huth, qemu-devel
  Cc: Thomas Huth, Jason Wang, Laurent Vivier

On 5/18/20 7:17 PM, Thomas Huth wrote:
> On 18/05/2020 19.08, Philippe Mathieu-Daudé wrote:
>> On 5/18/20 6:32 PM, Thomas Huth wrote:
>>> On 18/05/2020 11.49, Philippe Mathieu-Daudé wrote:
>>>> hw_error() calls exit(). This a bit overkill when we can log
>>>> the accesses as unimplemented or guest error.
>>>
>>> Good idea. hw_error() is also mainly for CPU errors, it really should
>>> not be used for non-CPU devices.
>>
>> Are you sure?
>>
>> $ git grep hw_error target | wc -l
>> 5
>> $ git grep hw_error hw | wc -l
>> 137
> 
> Well, the function is defined in cpus.c and it's dumping the state of
> each CPU ... I think it's used in a lot of places during development of
> new code to quickly get some information on where things went wrong in
> the guest, but technically, it really sounds wrong to me that a non-CPU
> device creates CPU dumps in mature code.

OK got it now, thanks.


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

end of thread, other threads:[~2020-05-18 17:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-18  9:49 [PATCH] hw/m68k/mcf52xx: Replace hw_error() by qemu_log_mask() Philippe Mathieu-Daudé
2020-05-18 16:32 ` Thomas Huth
2020-05-18 16:58   ` Philippe Mathieu-Daudé
2020-05-18 17:08   ` Philippe Mathieu-Daudé
2020-05-18 17:17     ` Thomas Huth
2020-05-18 17:24       ` Philippe Mathieu-Daudé

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.