target/ppc: Fix BookE debug interrupt generation
PATCH 1/1 target/ppc: Fix BookE debug interrupt generation
From: Bin Meng <[email protected]>
Per PowerISA v2.07 [1], Book III-E, chapter 7.6 "Interrupt definitions"
"When in Internal Debug Mode with MSR.DE=0, then Instruction Complete and Branch Taken debug events cannot occur, and no DBSR status bits are set and no subsequent imprecise Debug interrupt will occur."
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://ibm.ent.box.com/s/jd5w15gz301s5b5dt375mshpq9c3lh4u
---
target/ppc/helper_regs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target/ppc/helper_regs.c +2 -2
@@ -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 {
Signature · 1 line
2.25.1
Quoted 3 lines · Bin Meng
From: Bin Meng <[email protected]>
Per PowerISA v2.07 [1], Book III-E, chapter 7.6 "Interrupt definitions"
Which BookE board are you concerned about? I don't think we have any BookE ISA v2.07 in QEMU currently.
Quoted 9 lines
"When in Internal Debug Mode with MSR.DE=0, then Instruction Complete and Branch Taken debug events cannot occur, and no DBSR status bits are set and no subsequent imprecise Debug interrupt will occur."
Current codes do not check MSR.DE bit before setting
HFLAGS_SEandHFLAGS_BEflag, 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.
The rationale and the change itself look ok.
Quoted 25 lines
[1] https://ibm.ent.box.com/s/jd5w15gz301s5b5dt375mshpq9c3lh4u
Signed-off-by Bin Meng <[email protected]>---
target/ppc/helper_regs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)target/ppc/helper_regs.c +2
-2@@ -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 {
Quoted 9 lines · Fabiano Rosas
Quoted 3 lines · Bin Meng
From: Bin Meng <[email protected]>
Per PowerISA v2.07 [1], Book III-E, chapter 7.6 "Interrupt definitions"
Which BookE board are you concerned about? I don't think we have any BookE ISA v2.07 in QEMU currently.
It's actually a PPC E500 core, but I am too lazy to dig out the E500 manual from Freescale/NXP :(
Let me know if I need to replace the link to an E500 manual.
Quoted 5 lines
Quoted 5 lines
"When in Internal Debug Mode with MSR.DE=0, then Instruction Complete and Branch Taken debug events cannot occur, and no DBSR status bits are set and no subsequent imprecise Debug interrupt will occur."
Quoted 16 lines
Quoted 5 lines
Current codes do not check MSR.DE bit before setting
HFLAGS_SEandHFLAGS_BEflag, 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.The rationale and the change itself look ok.
Quoted 8 lines
[1] https://ibm.ent.box.com/s/jd5w15gz301s5b5dt375mshpq9c3lh4u
Signed-off-by Bin Meng <[email protected]>---
target/ppc/helper_regs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Regards,
Bin
Quoted 6 lines · Bin Meng
Quoted 5 lines · Fabiano Rosas
Quoted 2 lines · Bin Meng
From: Bin Meng <[email protected]>
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Per PowerISA v2.07 [1], Book III-E, chapter 7.6 "Interrupt definitions"
Which BookE board are you concerned about? I don't think we have any BookE ISA v2.07 in QEMU currently.
It's actually a PPC E500 core, but I am too lazy to dig out the E500 manual from Freescale/NXP :(
Here it is: https://www.nxp.com/docs/en/reference-manual/E500CORERM.pdf
You can keep it =)
Quoted 1 line
Let me know if I need to replace the link to an E500 manual.
Yes, please. And the description as well:
"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."
Otherwise a few years from now someone will use the git log as reference and will get confused.
Thanks.
Quoted 24 lines
Quoted 5 lines
Quoted 5 lines
"When in Internal Debug Mode with MSR.DE=0, then Instruction Complete and Branch Taken debug events cannot occur, and no DBSR status bits are set and no subsequent imprecise Debug interrupt will occur."
Quoted 16 lines
Quoted 5 lines
Current codes do not check MSR.DE bit before setting
HFLAGS_SEandHFLAGS_BEflag, 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.The rationale and the change itself look ok.
Quoted 8 lines
[1] https://ibm.ent.box.com/s/jd5w15gz301s5b5dt375mshpq9c3lh4u
Signed-off-by Bin Meng <[email protected]>---
target/ppc/helper_regs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Regards,
Bin