qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: qemu-devel@nongnu.org
Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Alistair Francis" <alistair.francis@wdc.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: [PATCH 6/6] target/microblaze: Set OPB bits in tlb_fill, not in transaction_failed
Date: Thu,  3 Jun 2021 11:03:10 +0200	[thread overview]
Message-ID: <20210603090310.2749892-7-f4bug@amsat.org> (raw)
In-Reply-To: <20210603090310.2749892-1-f4bug@amsat.org>

Per the 'MicroBlaze Processor Reference Guide' UG081 (v9.0),
"Hardware Exceptions" chapter:

  Exception Causes:

  * Instruction Bus Exception

  The instruction On-chip Peripheral Bus exception is caused by an
  active error signal from the slave (IOPB_errAck) or timeout signal
  from the arbiter (IOPB_timeout).

  * Data Bus Exception

  The data On-chip Peripheral Bus exception is caused by an active
  error signal from the slave (DOPB_errAck) or timeout signal from
  the arbiter (DOPB_timeout).

the table 1-24 (Processor Version Register 2):

  * IOPBEXC:  Generate exception for IOPB error

  * DOPBEXC: Generate exception for DOPB error

and the table 2-12 (MPD Parameters):

  * C_IOPB_BUS_EXCEPTION

  Enable exception handling for IOPB bus error

  * C_DOPB_BUS_EXCEPTION

  Enable exception handling for DOPB bus error

So if PVR2.[ID]OPBEXC feature is disabled, no exception will be
generated. Thus we can not get to the transaction_failed() handler.
The ESR bits have to be set in tlb_fill().

However we never implemented the MMU check whether the address belong
to the On-chip Peripheral Bus interface, so simply add a stub for it,
warning the feature is not implemented.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 target/microblaze/helper.c    | 19 +++++++++++++++++++
 target/microblaze/op_helper.c | 13 -------------
 2 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/target/microblaze/helper.c b/target/microblaze/helper.c
index d537f300ca6..60e62bc0710 100644
--- a/target/microblaze/helper.c
+++ b/target/microblaze/helper.c
@@ -56,6 +56,18 @@ static bool mb_cpu_access_is_secure(MicroBlazeCPU *cpu,
     }
 }
 
+/* On-chip Peripheral Bus (OPB) interface */
+static bool mb_cpu_address_is_opb(MicroBlazeCPU *cpu,
+                                  vaddr address, unsigned size)
+{
+    if (cpu->cfg.iopb_bus_exception || cpu->cfg.dopb_bus_exception) {
+        /* TODO */
+        warn_report_once("On-chip Peripheral Bus (OPB) interface "
+                         "feature not implemented.");
+    }
+    return false;
+}
+
 bool mb_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
                      MMUAccessType access_type, int mmu_idx,
                      bool probe, uintptr_t retaddr)
@@ -119,6 +131,13 @@ bool mb_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
     default:
         abort();
     }
+    if (mb_cpu_address_is_opb(cpu, address, size)) {
+        if (access_type == MMU_INST_FETCH) {
+            env->esr = ESR_EC_INSN_BUS;
+        } else {
+           env->esr = ESR_EC_DATA_BUS;
+        }
+    }
 
     if (cs->exception_index == EXCP_MMU) {
         cpu_abort(cs, "recursive faults\n");
diff --git a/target/microblaze/op_helper.c b/target/microblaze/op_helper.c
index 1048e656e27..171c4cf99a0 100644
--- a/target/microblaze/op_helper.c
+++ b/target/microblaze/op_helper.c
@@ -123,19 +123,6 @@ void mb_cpu_transaction_failed(CPUState *cs, hwaddr physaddr, vaddr addr,
                   (access_type == MMU_DATA_LOAD ? "DATA_LOAD" : "DATA_STORE"));
 
     assert(env->msr & MSR_EE);
-
-    if (access_type == MMU_INST_FETCH) {
-        if (!cpu->cfg.iopb_bus_exception) {
-            return;
-        }
-        env->esr = ESR_EC_INSN_BUS;
-    } else {
-        if (!cpu->cfg.dopb_bus_exception) {
-            return;
-        }
-        env->esr = ESR_EC_DATA_BUS;
-    }
-
     env->ear = addr;
     cs->exception_index = EXCP_HW_EXCP;
     cpu_loop_exit_restore(cs, retaddr);
-- 
2.26.3



  parent reply	other threads:[~2021-06-03  9:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-03  9:03 [PATCH 0/6] target/microblaze: Clean up MMU translation failed path Philippe Mathieu-Daudé
2021-06-03  9:03 ` [PATCH 1/6] target/microblaze: Use the IEC binary prefix definitions Philippe Mathieu-Daudé
2021-06-03 16:29   ` Edgar E. Iglesias
2021-06-03 16:34   ` Richard Henderson
2021-06-03 23:34   ` Alistair Francis
2021-06-03  9:03 ` [PATCH 2/6] target/microblaze: Extract FPU helpers to fpu_helper.c Philippe Mathieu-Daudé
2021-06-03 16:29   ` Edgar E. Iglesias
2021-06-03 23:35   ` Alistair Francis
2021-06-03  9:03 ` [PATCH 3/6] target/microblaze: Assert transaction failures have exception enabled Philippe Mathieu-Daudé
2021-06-03 16:30   ` Edgar E. Iglesias
2021-06-03  9:03 ` [PATCH 4/6] target/microblaze: Fix Exception Status Register 'Cause' definitions Philippe Mathieu-Daudé
2021-06-03 16:35   ` Edgar E. Iglesias
2021-06-03  9:03 ` [PATCH 5/6] target/microblaze: Replace magic values by proper definitions Philippe Mathieu-Daudé
2021-06-03 16:36   ` Edgar E. Iglesias
2021-06-03 16:37   ` Richard Henderson
2021-06-03  9:03 ` Philippe Mathieu-Daudé [this message]
2021-06-03 16:47   ` [PATCH 6/6] target/microblaze: Set OPB bits in tlb_fill, not in transaction_failed Edgar E. Iglesias

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210603090310.2749892-7-f4bug@amsat.org \
    --to=f4bug@amsat.org \
    --cc=alistair.francis@wdc.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).