All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] hw/intc: clean-up error reporting for failed ITS cmd
@ 2021-11-12 17:04 Alex Bennée
  2021-11-29 13:56 ` Peter Maydell
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Bennée @ 2021-11-12 17:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Shashi Mallela, qemu-arm, Alex Bennée

While trying to debug a GIC ITS failure I saw some guest errors that
had poor formatting as well as leaving me confused as to what failed.
As most of the checks aren't possible without a valid dte split that
check apart and then check the other conditions in steps. This avoids
us relying on undefined data.

I still get a failure with the current kvm-unit-tests but at least I
know (partially) why now:

  Exception return from AArch64 EL1 to AArch64 EL1 PC 0x40080588
  PASS: gicv3: its-trigger: inv/invall: dev2/eventid=20 now triggers an LPI
  ITS: MAPD devid=2 size = 0x8 itt=0x40430000 valid=0
  INT dev_id=2 event_id=20
  process_its_cmd: invalid command attributes: invalid dte: 0 for 2 (MEM_TX: 0)
  PASS: gicv3: its-trigger: mapd valid=false: no LPI after device unmap
  SUMMARY: 6 tests, 1 unexpected failures

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Cc: Shashi Mallela <shashi.mallela@linaro.org>
Cc: Peter Maydell <peter.maydell@linaro.org>
---
 hw/intc/arm_gicv3_its.c | 39 +++++++++++++++++++++++++++------------
 1 file changed, 27 insertions(+), 12 deletions(-)

diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c
index 84bcbb5f56..d5267814ab 100644
--- a/hw/intc/arm_gicv3_its.c
+++ b/hw/intc/arm_gicv3_its.c
@@ -274,21 +274,36 @@ static bool process_its_cmd(GICv3ITSState *s, uint64_t value, uint32_t offset,
         if (res != MEMTX_OK) {
             return result;
         }
+    } else {
+        qemu_log_mask(LOG_GUEST_ERROR,
+                      "%s: invalid command attributes: "
+                      "invalid dte: %"PRIx64" for %d (MEM_TX: %d)\n",
+                      __func__, dte, devid, res);
+        return result;
     }
 
-    if ((devid > s->dt.maxids.max_devids) || !dte_valid || !ite_valid ||
-            !cte_valid || (eventid > max_eventid)) {
+
+    /*
+     * In this implementation, in case of guest errors we ignore the
+     * command and move onto the next command in the queue.
+     */
+    if (devid > s->dt.maxids.max_devids) {
         qemu_log_mask(LOG_GUEST_ERROR,
-                      "%s: invalid command attributes "
-                      "devid %d or eventid %d or invalid dte %d or"
-                      "invalid cte %d or invalid ite %d\n",
-                      __func__, devid, eventid, dte_valid, cte_valid,
-                      ite_valid);
-        /*
-         * in this implementation, in case of error
-         * we ignore this command and move onto the next
-         * command in the queue
-         */
+                      "%s: invalid command attributes: devid %d>%d",
+                      __func__, devid, s->dt.maxids.max_devids);
+
+    } else if (!dte_valid || !ite_valid || !cte_valid) {
+        qemu_log_mask(LOG_GUEST_ERROR,
+                      "%s: invalid command attributes: "
+                      "dte: %s, ite: %s, cte: %s\n",
+                      __func__,
+                      dte_valid ? "valid" : "invalid",
+                      ite_valid ? "valid" : "invalid",
+                      cte_valid ? "valid" : "invalid");
+    } else if (eventid > max_eventid) {
+        qemu_log_mask(LOG_GUEST_ERROR,
+                      "%s: invalid command attributes: eventid %d > %d\n",
+                      __func__, eventid, max_eventid);
     } else {
         /*
          * Current implementation only supports rdbase == procnum
-- 
2.30.2



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

* Re: [RFC PATCH] hw/intc: clean-up error reporting for failed ITS cmd
  2021-11-12 17:04 [RFC PATCH] hw/intc: clean-up error reporting for failed ITS cmd Alex Bennée
@ 2021-11-29 13:56 ` Peter Maydell
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2021-11-29 13:56 UTC (permalink / raw)
  To: Alex Bennée; +Cc: Shashi Mallela, qemu-arm, qemu-devel

On Fri, 12 Nov 2021 at 17:05, Alex Bennée <alex.bennee@linaro.org> wrote:
>
> While trying to debug a GIC ITS failure I saw some guest errors that
> had poor formatting as well as leaving me confused as to what failed.
> As most of the checks aren't possible without a valid dte split that
> check apart and then check the other conditions in steps. This avoids
> us relying on undefined data.
>
> I still get a failure with the current kvm-unit-tests but at least I
> know (partially) why now:
>
>   Exception return from AArch64 EL1 to AArch64 EL1 PC 0x40080588
>   PASS: gicv3: its-trigger: inv/invall: dev2/eventid=20 now triggers an LPI
>   ITS: MAPD devid=2 size = 0x8 itt=0x40430000 valid=0
>   INT dev_id=2 event_id=20
>   process_its_cmd: invalid command attributes: invalid dte: 0 for 2 (MEM_TX: 0)
>   PASS: gicv3: its-trigger: mapd valid=false: no LPI after device unmap
>   SUMMARY: 6 tests, 1 unexpected failures
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Cc: Shashi Mallela <shashi.mallela@linaro.org>
> Cc: Peter Maydell <peter.maydell@linaro.org>
> --

Seems reasonable to me; I've put this on my list of things to queue
for 7.0.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


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

end of thread, other threads:[~2021-11-29 13:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-12 17:04 [RFC PATCH] hw/intc: clean-up error reporting for failed ITS cmd Alex Bennée
2021-11-29 13:56 ` Peter Maydell

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.