[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 35/62] target/ppc: move power-saving interrupt masking out of cpu_
From: |
Daniel Henrique Barboza |
Subject: |
[PULL 35/62] target/ppc: move power-saving interrupt masking out of cpu_has_work_POWER8 |
Date: |
Fri, 28 Oct 2022 13:39:24 -0300 |
From: Matheus Ferst <matheus.ferst@eldorado.org.br>
Move the interrupt masking logic out of cpu_has_work_POWER8 in a new
method, p8_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>
Reviewed-by: Fabiano Rosas <farosas@linux.ibm.com>
Message-Id: <20221011204829.1641124-18-matheus.ferst@eldorado.org.br>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
target/ppc/cpu_init.c | 61 +++++++++++++++++++++++--------------------
1 file changed, 33 insertions(+), 28 deletions(-)
diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
index 423d99d8d3..922390b938 100644
--- a/target/ppc/cpu_init.c
+++ b/target/ppc/cpu_init.c
@@ -6133,6 +6133,38 @@ static bool ppc_pvr_match_power8(PowerPCCPUClass *pcc,
uint32_t pvr, bool best)
return true;
}
+static int p8_interrupt_powersave(CPUPPCState *env)
+{
+ if ((env->pending_interrupts & PPC_INTERRUPT_EXT) &&
+ (env->spr[SPR_LPCR] & LPCR_P8_PECE2)) {
+ return PPC_INTERRUPT_EXT;
+ }
+ if ((env->pending_interrupts & PPC_INTERRUPT_DECR) &&
+ (env->spr[SPR_LPCR] & LPCR_P8_PECE3)) {
+ return PPC_INTERRUPT_DECR;
+ }
+ if ((env->pending_interrupts & PPC_INTERRUPT_MCK) &&
+ (env->spr[SPR_LPCR] & LPCR_P8_PECE4)) {
+ return PPC_INTERRUPT_MCK;
+ }
+ if ((env->pending_interrupts & PPC_INTERRUPT_HMI) &&
+ (env->spr[SPR_LPCR] & LPCR_P8_PECE4)) {
+ return PPC_INTERRUPT_HMI;
+ }
+ if ((env->pending_interrupts & PPC_INTERRUPT_DOORBELL) &&
+ (env->spr[SPR_LPCR] & LPCR_P8_PECE0)) {
+ return PPC_INTERRUPT_DOORBELL;
+ }
+ if ((env->pending_interrupts & PPC_INTERRUPT_HDOORBELL) &&
+ (env->spr[SPR_LPCR] & LPCR_P8_PECE1)) {
+ return PPC_INTERRUPT_HDOORBELL;
+ }
+ if (env->pending_interrupts & PPC_INTERRUPT_RESET) {
+ return PPC_INTERRUPT_RESET;
+ }
+ return 0;
+}
+
static bool cpu_has_work_POWER8(CPUState *cs)
{
PowerPCCPU *cpu = POWERPC_CPU(cs);
@@ -6142,34 +6174,7 @@ static bool cpu_has_work_POWER8(CPUState *cs)
if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) {
return false;
}
- if ((env->pending_interrupts & PPC_INTERRUPT_EXT) &&
- (env->spr[SPR_LPCR] & LPCR_P8_PECE2)) {
- return true;
- }
- if ((env->pending_interrupts & PPC_INTERRUPT_DECR) &&
- (env->spr[SPR_LPCR] & LPCR_P8_PECE3)) {
- return true;
- }
- if ((env->pending_interrupts & PPC_INTERRUPT_MCK) &&
- (env->spr[SPR_LPCR] & LPCR_P8_PECE4)) {
- return true;
- }
- if ((env->pending_interrupts & PPC_INTERRUPT_HMI) &&
- (env->spr[SPR_LPCR] & LPCR_P8_PECE4)) {
- return true;
- }
- if ((env->pending_interrupts & PPC_INTERRUPT_DOORBELL) &&
- (env->spr[SPR_LPCR] & LPCR_P8_PECE0)) {
- return true;
- }
- if ((env->pending_interrupts & PPC_INTERRUPT_HDOORBELL) &&
- (env->spr[SPR_LPCR] & LPCR_P8_PECE1)) {
- return true;
- }
- if (env->pending_interrupts & PPC_INTERRUPT_RESET) {
- return true;
- }
- return false;
+ return p8_interrupt_powersave(env) != 0;
} else {
return FIELD_EX64(env->msr, MSR, EE) &&
(cs->interrupt_request & CPU_INTERRUPT_HARD);
--
2.37.3
- [PULL 25/62] target/ppc: create an interrupt deliver method for POWER9/POWER10, (continued)
- [PULL 25/62] target/ppc: create an interrupt deliver method for POWER9/POWER10, Daniel Henrique Barboza, 2022/10/28
- [PULL 24/62] target/ppc: remove unused interrupts from p9_next_unmasked_interrupt, Daniel Henrique Barboza, 2022/10/28
- [PULL 26/62] target/ppc: remove unused interrupts from p9_deliver_interrupt, Daniel Henrique Barboza, 2022/10/28
- [PULL 27/62] target/ppc: remove generic architecture checks from p9_deliver_interrupt, Daniel Henrique Barboza, 2022/10/28
- [PULL 28/62] target/ppc: move power-saving interrupt masking out of cpu_has_work_POWER9, Daniel Henrique Barboza, 2022/10/28
- [PULL 29/62] target/ppc: add power-saving interrupt masking logic to p9_next_unmasked_interrupt, Daniel Henrique Barboza, 2022/10/28
- [PULL 30/62] target/ppc: create an interrupt masking method for POWER8, Daniel Henrique Barboza, 2022/10/28
- [PULL 31/62] target/ppc: remove unused interrupts from p8_next_unmasked_interrupt, Daniel Henrique Barboza, 2022/10/28
- [PULL 32/62] target/ppc: create an interrupt deliver method for POWER8, Daniel Henrique Barboza, 2022/10/28
- [PULL 33/62] target/ppc: remove unused interrupts from p8_deliver_interrupt, Daniel Henrique Barboza, 2022/10/28
- [PULL 35/62] target/ppc: move power-saving interrupt masking out of cpu_has_work_POWER8,
Daniel Henrique Barboza <=
- [PULL 36/62] target/ppc: add power-saving interrupt masking logic to p8_next_unmasked_interrupt, Daniel Henrique Barboza, 2022/10/28
- [PULL 34/62] target/ppc: remove generic architecture checks from p8_deliver_interrupt, Daniel Henrique Barboza, 2022/10/28
- [PULL 37/62] target/ppc: create an interrupt masking method for POWER7, Daniel Henrique Barboza, 2022/10/28
- [PULL 38/62] target/ppc: remove unused interrupts from p7_next_unmasked_interrupt, Daniel Henrique Barboza, 2022/10/28
- [PULL 40/62] target/ppc: remove unused interrupts from p7_deliver_interrupt, Daniel Henrique Barboza, 2022/10/28
- [PULL 41/62] target/ppc: remove generic architecture checks from p7_deliver_interrupt, Daniel Henrique Barboza, 2022/10/28
- [PULL 39/62] target/ppc: create an interrupt deliver method for POWER7, Daniel Henrique Barboza, 2022/10/28
- [PULL 42/62] target/ppc: move power-saving interrupt masking out of cpu_has_work_POWER7, Daniel Henrique Barboza, 2022/10/28
- [PULL 43/62] target/ppc: add power-saving interrupt masking logic to p7_next_unmasked_interrupt, Daniel Henrique Barboza, 2022/10/28
- [PULL 44/62] target/ppc: remove ppc_store_lpcr from CONFIG_USER_ONLY builds, Daniel Henrique Barboza, 2022/10/28