mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 18:23:57 -06:00
cpu: Move halted and interrupt_request fields to CPUState
Both fields are used in VMState, thus need to be moved together. Explicitly zero them on reset since they were located before breakpoints. Pass PowerPCCPU to kvmppc_handle_halt(). Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
21317bc222
commit
259186a7d2
70 changed files with 319 additions and 224 deletions
|
@ -420,26 +420,28 @@ static void mmubooke_create_initial_mapping(CPUPPCState *env)
|
|||
static void ppce500_cpu_reset_sec(void *opaque)
|
||||
{
|
||||
PowerPCCPU *cpu = opaque;
|
||||
CPUState *cs = CPU(cpu);
|
||||
CPUPPCState *env = &cpu->env;
|
||||
|
||||
cpu_reset(CPU(cpu));
|
||||
cpu_reset(cs);
|
||||
|
||||
/* Secondary CPU starts in halted state for now. Needs to change when
|
||||
implementing non-kernel boot. */
|
||||
env->halted = 1;
|
||||
cs->halted = 1;
|
||||
env->exception_index = EXCP_HLT;
|
||||
}
|
||||
|
||||
static void ppce500_cpu_reset(void *opaque)
|
||||
{
|
||||
PowerPCCPU *cpu = opaque;
|
||||
CPUState *cs = CPU(cpu);
|
||||
CPUPPCState *env = &cpu->env;
|
||||
struct boot_info *bi = env->load_info;
|
||||
|
||||
cpu_reset(CPU(cpu));
|
||||
cpu_reset(cs);
|
||||
|
||||
/* Set initial guest state. */
|
||||
env->halted = 0;
|
||||
cs->halted = 0;
|
||||
env->gpr[1] = (16<<20) - 8;
|
||||
env->gpr[3] = bi->dt_base;
|
||||
env->nip = bi->entry;
|
||||
|
|
22
hw/ppc/ppc.c
22
hw/ppc/ppc.c
|
@ -72,7 +72,7 @@ void ppc_set_irq(PowerPCCPU *cpu, int n_IRQ, int level)
|
|||
|
||||
LOG_IRQ("%s: %p n_IRQ %d level %d => pending %08" PRIx32
|
||||
"req %08x\n", __func__, env, n_IRQ, level,
|
||||
env->pending_interrupts, env->interrupt_request);
|
||||
env->pending_interrupts, CPU(cpu)->interrupt_request);
|
||||
}
|
||||
|
||||
/* PowerPC 6xx / 7xx internal IRQ controller */
|
||||
|
@ -87,6 +87,8 @@ static void ppc6xx_set_irq(void *opaque, int pin, int level)
|
|||
cur_level = (env->irq_input_state >> pin) & 1;
|
||||
/* Don't generate spurious events */
|
||||
if ((cur_level == 1 && level == 0) || (cur_level == 0 && level != 0)) {
|
||||
CPUState *cs = CPU(cpu);
|
||||
|
||||
switch (pin) {
|
||||
case PPC6xx_INPUT_TBEN:
|
||||
/* Level sensitive - active high */
|
||||
|
@ -126,7 +128,7 @@ static void ppc6xx_set_irq(void *opaque, int pin, int level)
|
|||
/* XXX: Note that the only way to restart the CPU is to reset it */
|
||||
if (level) {
|
||||
LOG_IRQ("%s: stop the CPU\n", __func__);
|
||||
env->halted = 1;
|
||||
cs->halted = 1;
|
||||
}
|
||||
break;
|
||||
case PPC6xx_INPUT_HRESET:
|
||||
|
@ -174,6 +176,8 @@ static void ppc970_set_irq(void *opaque, int pin, int level)
|
|||
cur_level = (env->irq_input_state >> pin) & 1;
|
||||
/* Don't generate spurious events */
|
||||
if ((cur_level == 1 && level == 0) || (cur_level == 0 && level != 0)) {
|
||||
CPUState *cs = CPU(cpu);
|
||||
|
||||
switch (pin) {
|
||||
case PPC970_INPUT_INT:
|
||||
/* Level sensitive - active high */
|
||||
|
@ -203,11 +207,11 @@ static void ppc970_set_irq(void *opaque, int pin, int level)
|
|||
/* XXX: TODO: relay the signal to CKSTP_OUT pin */
|
||||
if (level) {
|
||||
LOG_IRQ("%s: stop the CPU\n", __func__);
|
||||
env->halted = 1;
|
||||
cs->halted = 1;
|
||||
} else {
|
||||
LOG_IRQ("%s: restart the CPU\n", __func__);
|
||||
env->halted = 0;
|
||||
qemu_cpu_kick(CPU(cpu));
|
||||
cs->halted = 0;
|
||||
qemu_cpu_kick(cs);
|
||||
}
|
||||
break;
|
||||
case PPC970_INPUT_HRESET:
|
||||
|
@ -295,6 +299,8 @@ static void ppc40x_set_irq(void *opaque, int pin, int level)
|
|||
cur_level = (env->irq_input_state >> pin) & 1;
|
||||
/* Don't generate spurious events */
|
||||
if ((cur_level == 1 && level == 0) || (cur_level == 0 && level != 0)) {
|
||||
CPUState *cs = CPU(cpu);
|
||||
|
||||
switch (pin) {
|
||||
case PPC40x_INPUT_RESET_SYS:
|
||||
if (level) {
|
||||
|
@ -332,11 +338,11 @@ static void ppc40x_set_irq(void *opaque, int pin, int level)
|
|||
/* Level sensitive - active low */
|
||||
if (level) {
|
||||
LOG_IRQ("%s: stop the CPU\n", __func__);
|
||||
env->halted = 1;
|
||||
cs->halted = 1;
|
||||
} else {
|
||||
LOG_IRQ("%s: restart the CPU\n", __func__);
|
||||
env->halted = 0;
|
||||
qemu_cpu_kick(CPU(cpu));
|
||||
cs->halted = 0;
|
||||
qemu_cpu_kick(cs);
|
||||
}
|
||||
break;
|
||||
case PPC40x_INPUT_DEBUG:
|
||||
|
|
|
@ -112,7 +112,7 @@ static void spin_kick(void *data)
|
|||
map_start = ldq_p(&curspin->addr) & ~(map_size - 1);
|
||||
mmubooke_create_initial_mapping(env, 0, map_start, map_size);
|
||||
|
||||
env->halted = 0;
|
||||
cpu->halted = 0;
|
||||
env->exception_index = -1;
|
||||
cpu->stopped = false;
|
||||
qemu_cpu_kick(cpu);
|
||||
|
|
|
@ -617,6 +617,8 @@ static void spapr_reset_htab(sPAPREnvironment *spapr)
|
|||
|
||||
static void ppc_spapr_reset(void)
|
||||
{
|
||||
CPUState *first_cpu_cpu;
|
||||
|
||||
/* Reset the hash table & recalc the RMA */
|
||||
spapr_reset_htab(spapr);
|
||||
|
||||
|
@ -627,9 +629,10 @@ static void ppc_spapr_reset(void)
|
|||
spapr->rtas_size);
|
||||
|
||||
/* Set up the entry state */
|
||||
first_cpu_cpu = CPU(first_cpu);
|
||||
first_cpu->gpr[3] = spapr->fdt_addr;
|
||||
first_cpu->gpr[5] = 0;
|
||||
first_cpu->halted = 0;
|
||||
first_cpu_cpu->halted = 0;
|
||||
first_cpu->nip = spapr->entry_point;
|
||||
|
||||
}
|
||||
|
@ -637,14 +640,15 @@ static void ppc_spapr_reset(void)
|
|||
static void spapr_cpu_reset(void *opaque)
|
||||
{
|
||||
PowerPCCPU *cpu = opaque;
|
||||
CPUState *cs = CPU(cpu);
|
||||
CPUPPCState *env = &cpu->env;
|
||||
|
||||
cpu_reset(CPU(cpu));
|
||||
cpu_reset(cs);
|
||||
|
||||
/* All CPUs start halted. CPU0 is unhalted from the machine level
|
||||
* reset code and the rest are explicitly started up by the guest
|
||||
* using an RTAS call */
|
||||
env->halted = 1;
|
||||
cs->halted = 1;
|
||||
|
||||
env->spr[SPR_HIOR] = 0;
|
||||
|
||||
|
|
|
@ -543,7 +543,7 @@ static target_ulong h_cede(PowerPCCPU *cpu, sPAPREnvironment *spapr,
|
|||
env->msr |= (1ULL << MSR_EE);
|
||||
hreg_compute_hflags(env);
|
||||
if (!cpu_has_work(cs)) {
|
||||
env->halted = 1;
|
||||
cs->halted = 1;
|
||||
env->exception_index = EXCP_HLT;
|
||||
cs->exit_request = 1;
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ static void rtas_query_cpu_stopped_state(sPAPREnvironment *spapr,
|
|||
continue;
|
||||
}
|
||||
|
||||
if (env->halted) {
|
||||
if (cpu->halted) {
|
||||
rtas_st(rets, 1, 0);
|
||||
} else {
|
||||
rtas_st(rets, 1, 2);
|
||||
|
@ -184,7 +184,7 @@ static void rtas_start_cpu(sPAPREnvironment *spapr,
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!env->halted) {
|
||||
if (!cpu->halted) {
|
||||
rtas_st(rets, 0, -1);
|
||||
return;
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ static void rtas_start_cpu(sPAPREnvironment *spapr,
|
|||
env->msr = (1ULL << MSR_SF) | (1ULL << MSR_ME);
|
||||
env->nip = start;
|
||||
env->gpr[3] = r3;
|
||||
env->halted = 0;
|
||||
cpu->halted = 0;
|
||||
|
||||
qemu_cpu_kick(cpu);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue