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

On Thu, Jun 03, 2021 at 11:03:10AM +0200, Philippe Mathieu-Daudé wrote:
> 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.


This doesn't look correct either...

The OPB interface that you're refering to is implemented. It's the
insn and data memory ports of the cpu. Most MB designs today use
AXI though, but the name originated from the old DT bindings.

The transaction_failed() you're editing is not related to the MMU.
It's related to bus errors (e.g device slave errors).
These are not "avoided" by the CPU, if SW issues a transactions that
results in one, the MSR_EE flag and the properties invovled here
determine if the core will generate an trap for SW to handle the
bus error or if the error will be ignored.

Cheers,
Edgar



> 
> 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
> 


      reply	other threads:[~2021-06-03 16:48 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 ` [PATCH 6/6] target/microblaze: Set OPB bits in tlb_fill, not in transaction_failed Philippe Mathieu-Daudé
2021-06-03 16:47   ` Edgar E. Iglesias [this message]

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=20210603164708.GM477672@toto \
    --to=edgar.iglesias@gmail.com \
    --cc=alistair.francis@wdc.com \
    --cc=f4bug@amsat.org \
    --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 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.