Skip to contentSkip to conversation

Remove hw_error from target-arm

PATCH Applied Peter Crosthwaite 2 participants 6 messages Aug 29, 2015 – Sep 1, 2015

lore
Share & tools
lore
#0 lore raw

v2 cover Remove hw_error from target-arm

Hi Peter,

This removes the last of the hw_errors from target-arm.

Regards,
Peter

Changed since v1:
Handle everything as an assert()

Peter Crosthwaite (2):
arm: cpu: assert() on no-EL2 virt IRQ error condition.
arm: Remove hw_error() usages.

 target-arm/cpu.c    | 9 +++------
 target-arm/helper.c | 2 +-
 2 files changed, 4 insertions(+), 7 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/2 arm: cpu: assert() on no-EL2 virt IRQ error condition.

Replace the hw_error() for no-EL2 VIRQ with an assert.

---
Changed since v1:
Reimplement as assert

---
 target-arm/cpu.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
target-arm/cpu.c +1 -4
index cc6c6f3..4ba5929 100644
@@ -331,10 +331,7 @@ static void arm_cpu_set_irq(void *opaque, int irq, int level)
     switch (irq) {
     case ARM_CPU_VIRQ:
     case ARM_CPU_VFIQ:
-        if (!arm_feature(env, ARM_FEATURE_EL2)) {
-            hw_error("%s: Virtual interrupt line %d with no EL2 support\n",
-                     __func__, irq);
-        }
+        assert(arm_feature(env, ARM_FEATURE_EL2));
         /* fall through */
     case ARM_CPU_IRQ:
     case ARM_CPU_FIQ:
Signature · 1 line
1.9.1
#2 lore raw

PATCH v2 2/2 arm: Remove hw_error() usages.

In reply to Peter Crosthwaite

All of these hw_errors are fatal and indicate something wrong with QEMU implementation.

Convert to g_assert_not_reached.

---
Dropped the error messages as they are not hugely useful outside of a debug flow.

---
 target-arm/cpu.c    | 4 ++--
 target-arm/helper.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
target-arm/cpu.c +2 -2
index 4ba5929..7da29f5 100644
@@ -342,7 +342,7 @@ static void arm_cpu_set_irq(void *opaque, int irq, int level)
         }
         break;
     default:
-        hw_error("arm_cpu_set_irq: Bad interrupt line %d\n", irq);
+        g_assert_not_reached();
     }
 }
 
@@ -361,7 +361,7 @@ static void arm_cpu_kvm_set_irq(void *opaque, int irq, int level)
         kvm_irq |= KVM_ARM_IRQ_CPU_FIQ;
         break;
     default:
-        hw_error("arm_cpu_kvm_set_irq: Bad interrupt line %d\n", irq);
+        g_assert_not_reached();
     }
     kvm_irq |= cs->cpu_index << KVM_ARM_IRQ_VCPU_SHIFT;
     kvm_set_irq(kvm_state, kvm_irq, level ? 1 : 0);
target-arm/helper.c +1 -1
index 7df1f06..352eaba 100644
@@ -4990,7 +4990,7 @@ int bank_number(int mode)
     case ARM_CPU_MODE_MON:
         return 7;
     }
-    hw_error("bank number requested for bad CPSR mode value 0x%x\n", mode);
+    g_assert_not_reached();
 }
 
 void switch_mode(CPUARMState *env, int mode)
Signature · 1 line
1.9.1
#3 lore raw
In reply to Peter Crosthwaite
Quoted 3 lines · Peter Crosthwaite

Hi Peter,

This removes the last of the hw_errors from target-arm.

Hi; can you remind me what the reason was for wanting to remove them?

thanks
-- PMM

#4 lore raw
Quoted 9 lines · Peter Maydell
Quoted 3 lines · Peter Crosthwaite

Hi Peter,

This removes the last of the hw_errors from target-arm.

Hi; can you remind me what the reason was for wanting to remove them?

So hw_error is depracated in it's own right so I was thinking it stands alone.

But the idea that actually prompted it was I was looking at arch-obj undef symbols from the multi-arch compile to see how much these TCG modules depend on core code for linkage. The idea was to minimise core-code linkage deps of the modules, so a TCG translator could be linked to something that is not QEMU. This is ambitious and I have since shelved the idea as it is a huge project. But once you accept glib and the QOM core need to come with, it is a half sane list of APIs you need to implement to link TCG to something new.

hw_error() stuck out like a sore thumb as a core-defined symbol I could get rid of from target-arm arch-obj and reduce that API by one symbol.

Regards,
Peter

Quoted 2 lines

thanks
-- PMM

#5 lore raw
In reply to Peter Crosthwaite
Quoted 10 lines · Peter Crosthwaite

Hi Peter,

This removes the last of the hw_errors from target-arm.

Regards,
Peter

Changed since v1:
Handle everything as an assert()

Quoted 7 lines

Peter Crosthwaite (2):
arm: cpu: assert() on no-EL2 virt IRQ error condition.
arm: Remove hw_error() usages.

 target-arm/cpu.c    | 9 +++------
 target-arm/helper.c | 2 +-
 2 files changed, 4 insertions(+), 7 deletions(-)

Applied to target-arm.next, thanks.

-- PMM