[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 24/29] target/ppc: move power-saving interrupt masking out of
From: |
Matheus Ferst |
Subject: |
[PATCH v3 24/29] target/ppc: move power-saving interrupt masking out of cpu_has_work_POWER7 |
Date: |
Tue, 11 Oct 2022 17:48:24 -0300 |
Move the interrupt masking logic out of cpu_has_work_POWER7 in a new
method, p7_interrupt_powersave, that only returns an interrupt if it can
wake the processor from power-saving mode.
Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br>
---
target/ppc/cpu_init.c | 45 ++++++++++++++++++++++++-------------------
1 file changed, 25 insertions(+), 20 deletions(-)
diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
index 4a44ba1733..53a87c379c 100644
--- a/target/ppc/cpu_init.c
+++ b/target/ppc/cpu_init.c
@@ -5960,6 +5960,30 @@ static bool ppc_pvr_match_power7(PowerPCCPUClass *pcc,
uint32_t pvr, bool best)
return true;
}
+static int p7_interrupt_powersave(CPUPPCState *env)
+{
+ if ((env->pending_interrupts & PPC_INTERRUPT_EXT) &&
+ (env->spr[SPR_LPCR] & LPCR_P7_PECE0)) {
+ return PPC_INTERRUPT_EXT;
+ }
+ if ((env->pending_interrupts & PPC_INTERRUPT_DECR) &&
+ (env->spr[SPR_LPCR] & LPCR_P7_PECE1)) {
+ return PPC_INTERRUPT_DECR;
+ }
+ if ((env->pending_interrupts & PPC_INTERRUPT_MCK) &&
+ (env->spr[SPR_LPCR] & LPCR_P7_PECE2)) {
+ return PPC_INTERRUPT_MCK;
+ }
+ if ((env->pending_interrupts & PPC_INTERRUPT_HMI) &&
+ (env->spr[SPR_LPCR] & LPCR_P7_PECE2)) {
+ return PPC_INTERRUPT_HMI;
+ }
+ if (env->pending_interrupts & PPC_INTERRUPT_RESET) {
+ return PPC_INTERRUPT_RESET;
+ }
+ return 0;
+}
+
static bool cpu_has_work_POWER7(CPUState *cs)
{
PowerPCCPU *cpu = POWERPC_CPU(cs);
@@ -5969,26 +5993,7 @@ static bool cpu_has_work_POWER7(CPUState *cs)
if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) {
return false;
}
- if ((env->pending_interrupts & PPC_INTERRUPT_EXT) &&
- (env->spr[SPR_LPCR] & LPCR_P7_PECE0)) {
- return true;
- }
- if ((env->pending_interrupts & PPC_INTERRUPT_DECR) &&
- (env->spr[SPR_LPCR] & LPCR_P7_PECE1)) {
- return true;
- }
- if ((env->pending_interrupts & PPC_INTERRUPT_MCK) &&
- (env->spr[SPR_LPCR] & LPCR_P7_PECE2)) {
- return true;
- }
- if ((env->pending_interrupts & PPC_INTERRUPT_HMI) &&
- (env->spr[SPR_LPCR] & LPCR_P7_PECE2)) {
- return true;
- }
- if (env->pending_interrupts & PPC_INTERRUPT_RESET) {
- return true;
- }
- return false;
+ return p7_interrupt_powersave(env) != 0;
} else {
return FIELD_EX64(env->msr, MSR, EE) &&
(cs->interrupt_request & CPU_INTERRUPT_HARD);
--
2.25.1
- [PATCH v3 19/29] target/ppc: create an interrupt masking method for POWER7, (continued)
- [PATCH v3 19/29] target/ppc: create an interrupt masking method for POWER7, Matheus Ferst, 2022/10/11
- [PATCH v3 20/29] target/ppc: remove unused interrupts from p7_next_unmasked_interrupt, Matheus Ferst, 2022/10/11
- [PATCH v3 21/29] target/ppc: create an interrupt deliver method for POWER7, Matheus Ferst, 2022/10/11
- [PATCH v3 22/29] target/ppc: remove unused interrupts from p7_deliver_interrupt, Matheus Ferst, 2022/10/11
- [PATCH v3 23/29] target/ppc: remove generic architecture checks from p7_deliver_interrupt, Matheus Ferst, 2022/10/11
- [PATCH v3 24/29] target/ppc: move power-saving interrupt masking out of cpu_has_work_POWER7,
Matheus Ferst <=
- [PATCH v3 25/29] target/ppc: add power-saving interrupt masking logic to p7_next_unmasked_interrupt, Matheus Ferst, 2022/10/11
- [PATCH v3 26/29] target/ppc: remove ppc_store_lpcr from CONFIG_USER_ONLY builds, Matheus Ferst, 2022/10/11
- [PATCH v3 27/29] target/ppc: introduce ppc_maybe_interrupt, Matheus Ferst, 2022/10/11
- [PATCH v3 28/29] target/ppc: unify cpu->has_work based on cs->interrupt_request, Matheus Ferst, 2022/10/11
- [PATCH v3 29/29] target/ppc: move the p*_interrupt_powersave methods to excp_helper.c, Matheus Ferst, 2022/10/11
- Re: [PATCH v3 00/29] PowerPC interrupt rework, Daniel Henrique Barboza, 2022/10/17