[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC v2 09/12] target/ppc: Use common code for Hypervisor interrupts
From: |
Fabiano Rosas |
Subject: |
[RFC v2 09/12] target/ppc: Use common code for Hypervisor interrupts |
Date: |
Mon, 20 Dec 2021 15:19:00 -0300 |
The Hypervisor interrupts all set the MSR_HV bit, and use HSRRs
instead of SRRs, so we can use the same code to setup them all.
No functional change.
Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
---
target/ppc/interrupts.c | 128 +++++++---------------------------------
target/ppc/ppc_intr.h | 8 +--
2 files changed, 21 insertions(+), 115 deletions(-)
diff --git a/target/ppc/interrupts.c b/target/ppc/interrupts.c
index 1e4fb2d6db..61a7dec682 100644
--- a/target/ppc/interrupts.c
+++ b/target/ppc/interrupts.c
@@ -364,86 +364,22 @@ void ppc_intr_system_reset(PowerPCCPU *cpu, PPCIntrArgs
*regs, bool *ignore)
}
}
+void ppc_intr_hv(PowerPCCPU *cpu, PPCIntrArgs *regs, bool *ignore)
+{
+ CPUPPCState *env = &cpu->env;
+
+ regs->sprn_srr0 = SPR_HSRR0;
+ regs->sprn_srr1 = SPR_HSRR1;
+ regs->new_msr |= (target_ulong)MSR_HVB;
+ regs->new_msr |= env->msr & ((target_ulong)1 << MSR_RI);
+}
+
void ppc_intr_hv_insn_storage(PowerPCCPU *cpu, PPCIntrArgs *regs, bool *ignore)
{
CPUPPCState *env = &cpu->env;
regs->msr |= env->error_code;
-
- regs->sprn_srr0 = SPR_HSRR0;
- regs->sprn_srr1 = SPR_HSRR1;
- regs->new_msr |= (target_ulong)MSR_HVB;
- regs->new_msr |= env->msr & ((target_ulong)1 << MSR_RI);
-}
-
-void ppc_intr_hv_decrementer(PowerPCCPU *cpu, PPCIntrArgs *regs, bool *ignore)
-{
- CPUPPCState *env = &cpu->env;
-
- regs->sprn_srr0 = SPR_HSRR0;
- regs->sprn_srr1 = SPR_HSRR1;
- regs->new_msr |= (target_ulong)MSR_HVB;
- regs->new_msr |= env->msr & ((target_ulong)1 << MSR_RI);
-}
-
-void ppc_intr_hv_data_storage(PowerPCCPU *cpu, PPCIntrArgs *regs, bool *ignore)
-{
- CPUPPCState *env = &cpu->env;
-
- regs->sprn_srr0 = SPR_HSRR0;
- regs->sprn_srr1 = SPR_HSRR1;
- regs->new_msr |= (target_ulong)MSR_HVB;
- regs->new_msr |= env->msr & ((target_ulong)1 << MSR_RI);
-}
-
-void ppc_intr_hv_data_segment(PowerPCCPU *cpu, PPCIntrArgs *regs, bool *ignore)
-{
- CPUPPCState *env = &cpu->env;
-
- regs->sprn_srr0 = SPR_HSRR0;
- regs->sprn_srr1 = SPR_HSRR1;
- regs->new_msr |= (target_ulong)MSR_HVB;
- regs->new_msr |= env->msr & ((target_ulong)1 << MSR_RI);
-}
-
-void ppc_intr_hv_insn_segment(PowerPCCPU *cpu, PPCIntrArgs *regs, bool *ignore)
-{
- CPUPPCState *env = &cpu->env;
-
- regs->sprn_srr0 = SPR_HSRR0;
- regs->sprn_srr1 = SPR_HSRR1;
- regs->new_msr |= (target_ulong)MSR_HVB;
- regs->new_msr |= env->msr & ((target_ulong)1 << MSR_RI);
-}
-
-void ppc_intr_hv_doorbell(PowerPCCPU *cpu, PPCIntrArgs *regs, bool *ignore)
-{
- CPUPPCState *env = &cpu->env;
-
- regs->sprn_srr0 = SPR_HSRR0;
- regs->sprn_srr1 = SPR_HSRR1;
- regs->new_msr |= (target_ulong)MSR_HVB;
- regs->new_msr |= env->msr & ((target_ulong)1 << MSR_RI);
-}
-
-void ppc_intr_hv_emulation(PowerPCCPU *cpu, PPCIntrArgs *regs, bool *ignore)
-{
- CPUPPCState *env = &cpu->env;
-
- regs->sprn_srr0 = SPR_HSRR0;
- regs->sprn_srr1 = SPR_HSRR1;
- regs->new_msr |= (target_ulong)MSR_HVB;
- regs->new_msr |= env->msr & ((target_ulong)1 << MSR_RI);
-}
-
-void ppc_intr_hv_virtualization(PowerPCCPU *cpu, PPCIntrArgs *regs, bool
*ignore)
-{
- CPUPPCState *env = &cpu->env;
-
- regs->sprn_srr0 = SPR_HSRR0;
- regs->sprn_srr1 = SPR_HSRR1;
- regs->new_msr |= (target_ulong)MSR_HVB;
- regs->new_msr |= env->msr & ((target_ulong)1 << MSR_RI);
+ ppc_intr_hv(cpu, regs, ignore);
}
void ppc_intr_facility_unavail(PowerPCCPU *cpu, PPCIntrArgs *regs, bool
*ignore)
@@ -459,11 +395,7 @@ void ppc_intr_hv_facility_unavail(PowerPCCPU *cpu,
PPCIntrArgs *regs, bool *igno
#ifdef TARGET_PPC64
CPUPPCState *env = &cpu->env;
env->spr[SPR_FSCR] |= ((target_ulong)env->error_code << FSCR_IC_POS);
-
- regs->sprn_srr0 = SPR_HSRR0;
- regs->sprn_srr1 = SPR_HSRR1;
- regs->new_msr |= (target_ulong)MSR_HVB;
- regs->new_msr |= env->msr & ((target_ulong)1 << MSR_RI);
+ ppc_intr_hv(cpu, regs, ignore);
#endif
}
@@ -571,34 +503,10 @@ PPCInterrupt interrupts[POWERPC_EXCP_NB] = {
"Facility unavailable", ppc_intr_facility_unavail
},
- [POWERPC_EXCP_HDECR] = {
- "Hypervisor decrementer", ppc_intr_hv_decrementer
- },
-
- [POWERPC_EXCP_HDSEG] = {
- "Hypervisor data segment", ppc_intr_hv_data_segment
- },
-
- [POWERPC_EXCP_HDSI] = {
- "Hypervisor data storage", ppc_intr_hv_data_storage
- },
-
- [POWERPC_EXCP_HISEG] = {
- "Hypervisor insn segment", ppc_intr_hv_insn_segment
- },
-
[POWERPC_EXCP_HISI] = {
"Hypervisor instruction storage", ppc_intr_hv_insn_storage
},
- [POWERPC_EXCP_HVIRT] = {
- "Hypervisor virtualization", ppc_intr_hv_virtualization
- },
-
- [POWERPC_EXCP_HV_EMU] = {
- "Hypervisor emulation assist", ppc_intr_hv_emulation
- },
-
[POWERPC_EXCP_HV_FU] = {
"Hypervisor facility unavailable" , ppc_intr_hv_facility_unavail
},
@@ -627,10 +535,6 @@ PPCInterrupt interrupts[POWERPC_EXCP_NB] = {
"System reset", ppc_intr_system_reset
},
- [POWERPC_EXCP_SDOOR_HV] = {
- "Hypervisor doorbell", ppc_intr_hv_doorbell
- },
-
[POWERPC_EXCP_SPEU] = {
"SPE/embedded FP unavailable/VPU", ppc_intr_spe_unavailable
},
@@ -655,6 +559,14 @@ PPCInterrupt interrupts[POWERPC_EXCP_NB] = {
"Watchdog timer", ppc_intr_watchdog
},
+ [POWERPC_EXCP_HDECR] = { "Hypervisor decrementer", ppc_intr_hv
},
+ [POWERPC_EXCP_HDSEG] = { "Hypervisor data segment", ppc_intr_hv
},
+ [POWERPC_EXCP_HDSI] = { "Hypervisor data storage", ppc_intr_hv
},
+ [POWERPC_EXCP_HISEG] = { "Hypervisor insn segment", ppc_intr_hv
},
+ [POWERPC_EXCP_HVIRT] = { "Hypervisor virtualization", ppc_intr_hv
},
+ [POWERPC_EXCP_HV_EMU] = { "Hypervisor emulation assist", ppc_intr_hv
},
+ [POWERPC_EXCP_SDOOR_HV] = { "Hypervisor doorbell", ppc_intr_hv
},
+
[POWERPC_EXCP_APU] = { "Aux. processor unavailable", ppc_intr_noop },
[POWERPC_EXCP_DECR] = { "Decrementer", ppc_intr_noop },
[POWERPC_EXCP_DOORI] = { "Embedded doorbell", ppc_intr_noop },
diff --git a/target/ppc/ppc_intr.h b/target/ppc/ppc_intr.h
index a96062c583..078906ed68 100644
--- a/target/ppc/ppc_intr.h
+++ b/target/ppc/ppc_intr.h
@@ -27,15 +27,9 @@ void ppc_intr_embedded_doorbell_crit(PowerPCCPU *cpu,
PPCIntrArgs *regs, bool *i
void ppc_intr_external(PowerPCCPU *cpu, PPCIntrArgs *regs, bool *ignore);
void ppc_intr_facility_unavail(PowerPCCPU *cpu, PPCIntrArgs *regs, bool
*ignore);
void ppc_intr_fit(PowerPCCPU *cpu, PPCIntrArgs *regs, bool *ignore);
-void ppc_intr_hv_data_segment(PowerPCCPU *cpu, PPCIntrArgs *regs, bool
*ignore);
-void ppc_intr_hv_data_storage(PowerPCCPU *cpu, PPCIntrArgs *regs, bool
*ignore);
-void ppc_intr_hv_decrementer(PowerPCCPU *cpu, PPCIntrArgs *regs, bool *ignore);
-void ppc_intr_hv_doorbell(PowerPCCPU *cpu, PPCIntrArgs *regs, bool *ignore);
-void ppc_intr_hv_emulation(PowerPCCPU *cpu, PPCIntrArgs *regs, bool *ignore);
+void ppc_intr_hv(PowerPCCPU *cpu, PPCIntrArgs *regs, bool *ignore);
void ppc_intr_hv_facility_unavail(PowerPCCPU *cpu, PPCIntrArgs *regs, bool
*ignore);
-void ppc_intr_hv_insn_segment(PowerPCCPU *cpu, PPCIntrArgs *regs, bool
*ignore);
void ppc_intr_hv_insn_storage(PowerPCCPU *cpu, PPCIntrArgs *regs, bool
*ignore);
-void ppc_intr_hv_virtualization(PowerPCCPU *cpu, PPCIntrArgs *regs, bool
*ignore);
void ppc_intr_insn_storage(PowerPCCPU *cpu, PPCIntrArgs *regs, bool *ignore);
void ppc_intr_machine_check(PowerPCCPU *cpu, PPCIntrArgs *regs, bool *ignore);
void ppc_intr_noop(PowerPCCPU *cpu, PPCIntrArgs *regs, bool *ignore);
--
2.33.1
- [RFC v2 03/12] target/ppc: powerpc_excp: Move system call vectored code together, (continued)
- [RFC v2 03/12] target/ppc: powerpc_excp: Move system call vectored code together, Fabiano Rosas, 2021/12/20
- [RFC v2 07/12] target/ppc: Introduce PPCInterrupt, Fabiano Rosas, 2021/12/20
- [RFC v2 05/12] target/ppc: powerpc_excp: Standardize arguments to interrupt code, Fabiano Rosas, 2021/12/20
- [RFC v2 08/12] target/ppc: Remove unimplemented interrupt code, Fabiano Rosas, 2021/12/20
- [RFC v2 06/12] target/ppc: Extract interrupt routines into a new file, Fabiano Rosas, 2021/12/20
- [RFC v2 10/12] target/ppc: Split powerpc_excp into book3s, booke and 32 bit, Fabiano Rosas, 2021/12/20
- [RFC v2 09/12] target/ppc: Use common code for Hypervisor interrupts,
Fabiano Rosas <=
- [RFC v2 12/12] target/ppc: Do not enable all interrupts when running KVM, Fabiano Rosas, 2021/12/20
- [RFC v2 11/12] target/ppc: Create new files for book3s, booke and ppc32 exception code, Fabiano Rosas, 2021/12/20
- Re: [RFC v2 00/12] target/ppc: powerpc_excp improvements, Cédric Le Goater, 2021/12/26