qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] target/ppc: Fix BookE debug interrupt generation


From: Cédric Le Goater
Subject: Re: [PATCH v2] target/ppc: Fix BookE debug interrupt generation
Date: Thu, 21 Apr 2022 08:23:22 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0

On 4/21/22 03:17, Bin Meng wrote:
From: Bin Meng <bin.meng@windriver.com>

Per E500 core reference manual [1], chapter 8.4.4 "Branch Taken Debug
Event" and chapter 8.4.5 "Instruction Complete Debug Event":

   "A branch taken debug event occurs if both MSR[DE] and DBCR0[BRT]
   are set ... Branch taken debug events are not recognized if MSR[DE]
   is cleared when the branch instruction executes."

   "An instruction complete debug event occurs when any instruction
   completes execution so long as MSR[DE] and DBCR0[ICMP] are both
   set ... Instruction complete debug events are not recognized if
   MSR[DE] is cleared at the time of the instruction execution."

Current codes do not check MSR.DE bit before setting HFLAGS_SE and
HFLAGS_BE flag, which would cause the immediate debug interrupt to
be generated, e.g.: when DBCR0.ICMP bit is set by guest software
and MSR.DE is not set.

[1] https://www.nxp.com/docs/en/reference-manual/E500CORERM.pdf

Signed-off-by: Bin Meng <bin.meng@windriver.com>

Reviewed-by: Cédric Le Goater <clg@kaod.org>

Thanks,

C.

---

Changes in v2:
- update commit message to use E500CORERM instead of PowerISA 2.07

  target/ppc/helper_regs.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/ppc/helper_regs.c b/target/ppc/helper_regs.c
index 9a691d6833..77bc57415c 100644
--- a/target/ppc/helper_regs.c
+++ b/target/ppc/helper_regs.c
@@ -63,10 +63,10 @@ static uint32_t hreg_compute_hflags_value(CPUPPCState *env)
if (ppc_flags & POWERPC_FLAG_DE) {
          target_ulong dbcr0 = env->spr[SPR_BOOKE_DBCR0];
-        if (dbcr0 & DBCR0_ICMP) {
+        if ((dbcr0 & DBCR0_ICMP) && msr_de) {
              hflags |= 1 << HFLAGS_SE;
          }
-        if (dbcr0 & DBCR0_BRT) {
+        if ((dbcr0 & DBCR0_BRT) && msr_de) {
              hflags |= 1 << HFLAGS_BE;
          }
      } else {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]