From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [PATCH 13/20] ppc: Pass PowerPCCPU to [h]decr callbacks
Date: Wed, 19 Dec 2012 14:36:29 +0100 [thread overview]
Message-ID: <1355924196-19288-14-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1355924196-19288-1-git-send-email-afaerber@suse.de>
Cleans up after passing PowerPCCPU to ppc_set_irq().
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
hw/ppc.c | 60 +++++++++++++++++++++++++++++++++---------------------------
1 Datei geändert, 33 Zeilen hinzugefügt(+), 27 Zeilen entfernt(-)
diff --git a/hw/ppc.c b/hw/ppc.c
index 6db595f..b1b93a1 100644
--- a/hw/ppc.c
+++ b/hw/ppc.c
@@ -644,30 +644,27 @@ uint64_t cpu_ppc_load_purr (CPUPPCState *env)
/* When decrementer expires,
* all we need to do is generate or queue a CPU exception
*/
-static inline void cpu_ppc_decr_excp(CPUPPCState *env)
+static inline void cpu_ppc_decr_excp(PowerPCCPU *cpu)
{
- PowerPCCPU *cpu = ppc_env_get_cpu(env);
-
/* Raise it */
LOG_TB("raise decrementer exception\n");
ppc_set_irq(cpu, PPC_INTERRUPT_DECR, 1);
}
-static inline void cpu_ppc_hdecr_excp(CPUPPCState *env)
+static inline void cpu_ppc_hdecr_excp(PowerPCCPU *cpu)
{
- PowerPCCPU *cpu = ppc_env_get_cpu(env);
-
/* Raise it */
LOG_TB("raise decrementer exception\n");
ppc_set_irq(cpu, PPC_INTERRUPT_HDECR, 1);
}
-static void __cpu_ppc_store_decr (CPUPPCState *env, uint64_t *nextp,
- struct QEMUTimer *timer,
- void (*raise_excp)(CPUPPCState *),
- uint32_t decr, uint32_t value,
- int is_excp)
+static void __cpu_ppc_store_decr(PowerPCCPU *cpu, uint64_t *nextp,
+ struct QEMUTimer *timer,
+ void (*raise_excp)(PowerPCCPU *),
+ uint32_t decr, uint32_t value,
+ int is_excp)
{
+ CPUPPCState *env = &cpu->env;
ppc_tb_t *tb_env = env->tb_env;
uint64_t now, next;
@@ -697,53 +694,61 @@ static void __cpu_ppc_store_decr (CPUPPCState *env, uint64_t *nextp,
if ((tb_env->flags & PPC_DECR_UNDERFLOW_TRIGGERED)
&& (value & 0x80000000)
&& !(decr & 0x80000000)) {
- (*raise_excp)(env);
+ (*raise_excp)(cpu);
}
}
-static inline void _cpu_ppc_store_decr(CPUPPCState *env, uint32_t decr,
+static inline void _cpu_ppc_store_decr(PowerPCCPU *cpu, uint32_t decr,
uint32_t value, int is_excp)
{
- ppc_tb_t *tb_env = env->tb_env;
+ ppc_tb_t *tb_env = cpu->env.tb_env;
- __cpu_ppc_store_decr(env, &tb_env->decr_next, tb_env->decr_timer,
+ __cpu_ppc_store_decr(cpu, &tb_env->decr_next, tb_env->decr_timer,
&cpu_ppc_decr_excp, decr, value, is_excp);
}
void cpu_ppc_store_decr (CPUPPCState *env, uint32_t value)
{
- _cpu_ppc_store_decr(env, cpu_ppc_load_decr(env), value, 0);
+ PowerPCCPU *cpu = ppc_env_get_cpu(env);
+
+ _cpu_ppc_store_decr(cpu, cpu_ppc_load_decr(env), value, 0);
}
static void cpu_ppc_decr_cb (void *opaque)
{
- _cpu_ppc_store_decr(opaque, 0x00000000, 0xFFFFFFFF, 1);
+ CPUPPCState *env = opaque;
+
+ _cpu_ppc_store_decr(ppc_env_get_cpu(env), 0x00000000, 0xFFFFFFFF, 1);
}
-static inline void _cpu_ppc_store_hdecr(CPUPPCState *env, uint32_t hdecr,
+static inline void _cpu_ppc_store_hdecr(PowerPCCPU *cpu, uint32_t hdecr,
uint32_t value, int is_excp)
{
- ppc_tb_t *tb_env = env->tb_env;
+ ppc_tb_t *tb_env = cpu->env.tb_env;
if (tb_env->hdecr_timer != NULL) {
- __cpu_ppc_store_decr(env, &tb_env->hdecr_next, tb_env->hdecr_timer,
+ __cpu_ppc_store_decr(cpu, &tb_env->hdecr_next, tb_env->hdecr_timer,
&cpu_ppc_hdecr_excp, hdecr, value, is_excp);
}
}
void cpu_ppc_store_hdecr (CPUPPCState *env, uint32_t value)
{
- _cpu_ppc_store_hdecr(env, cpu_ppc_load_hdecr(env), value, 0);
+ PowerPCCPU *cpu = ppc_env_get_cpu(env);
+
+ _cpu_ppc_store_hdecr(cpu, cpu_ppc_load_hdecr(env), value, 0);
}
static void cpu_ppc_hdecr_cb (void *opaque)
{
- _cpu_ppc_store_hdecr(opaque, 0x00000000, 0xFFFFFFFF, 1);
+ CPUPPCState *env = opaque;
+
+ _cpu_ppc_store_hdecr(ppc_env_get_cpu(env), 0x00000000, 0xFFFFFFFF, 1);
}
-static void cpu_ppc_store_purr(CPUPPCState *env, uint64_t value)
+static void cpu_ppc_store_purr(PowerPCCPU *cpu, uint64_t value)
{
- ppc_tb_t *tb_env = env->tb_env;
+ ppc_tb_t *tb_env = cpu->env.tb_env;
tb_env->purr_load = value;
tb_env->purr_start = qemu_get_clock_ns(vm_clock);
@@ -752,6 +757,7 @@ static void cpu_ppc_store_purr(CPUPPCState *env, uint64_t value)
static void cpu_ppc_set_tb_clk (void *opaque, uint32_t freq)
{
CPUPPCState *env = opaque;
+ PowerPCCPU *cpu = ppc_env_get_cpu(env);
ppc_tb_t *tb_env = env->tb_env;
tb_env->tb_freq = freq;
@@ -760,9 +766,9 @@ static void cpu_ppc_set_tb_clk (void *opaque, uint32_t freq)
* if a decrementer exception is pending when it enables msr_ee at startup,
* it's not ready to handle it...
*/
- _cpu_ppc_store_decr(env, 0xFFFFFFFF, 0xFFFFFFFF, 0);
- _cpu_ppc_store_hdecr(env, 0xFFFFFFFF, 0xFFFFFFFF, 0);
- cpu_ppc_store_purr(env, 0x0000000000000000ULL);
+ _cpu_ppc_store_decr(cpu, 0xFFFFFFFF, 0xFFFFFFFF, 0);
+ _cpu_ppc_store_hdecr(cpu, 0xFFFFFFFF, 0xFFFFFFFF, 0);
+ cpu_ppc_store_purr(cpu, 0x0000000000000000ULL);
}
/* Set up (once) timebase frequency (in Hz) */
--
1.7.10.4
next prev parent reply other threads:[~2012-12-19 13:37 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-19 13:36 [Qemu-devel] [PULL] QOM CPUState patch queue 2012-12-19 Andreas Färber
2012-12-19 13:36 ` [Qemu-devel] [PATCH 01/20] target-alpha: Let cpu_alpha_init() return AlphaCPU Andreas Färber
2012-12-19 13:36 ` [Qemu-devel] [PATCH 02/20] alpha: Pass AlphaCPU array to Typhoon Andreas Färber
2012-12-19 13:36 ` [Qemu-devel] [PATCH 03/20] target-alpha: Avoid leaking the alarm timer over reset Andreas Färber
2012-12-19 13:36 ` [Qemu-devel] [PATCH 04/20] target-alpha: Turn CPU definitions into subclasses Andreas Färber
2012-12-19 13:36 ` [Qemu-devel] [PATCH 05/20] target-alpha: Add support for -cpu ? Andreas Färber
2012-12-19 13:36 ` [Qemu-devel] [PATCH 06/20] cpu: Introduce CPUListState struct Andreas Färber
2012-12-19 13:36 ` [Qemu-devel] [PATCH 07/20] qdev: Coding style fixes Andreas Färber
2012-12-19 13:36 ` [Qemu-devel] [PATCH 08/20] qdev-properties.c: Separate core from the code used only by qemu-system-* Andreas Färber
2012-12-19 13:36 ` [Qemu-devel] [PATCH 09/20] cpu: Move kvm_fd into CPUState Andreas Färber
2012-12-19 13:36 ` [Qemu-devel] [PATCH 10/20] kvm: Pass CPUState to kvm_arch_* Andreas Färber
2012-12-19 13:36 ` [Qemu-devel] [PATCH 11/20] kvm: Pass CPUState to kvm_vcpu_ioctl() Andreas Färber
2012-12-19 13:36 ` [Qemu-devel] [PATCH 12/20] ppc: Pass PowerPCCPU to ppc_set_irq() Andreas Färber
2012-12-19 13:36 ` Andreas Färber [this message]
2012-12-19 13:36 ` [Qemu-devel] [PATCH 14/20] ppc: Pass PowerPCCPU to [h]decr timer callbacks Andreas Färber
2012-12-19 13:36 ` [Qemu-devel] [PATCH 15/20] ppc_booke: Pass PowerPCCPU to {decr, fit, wdt} " Andreas Färber
2012-12-19 13:36 ` [Qemu-devel] [PATCH 16/20] ppc4xx_devs: Return PowerPCCPU from ppc4xx_init() Andreas Färber
2012-12-19 13:36 ` [Qemu-devel] [PATCH 17/20] ppc_booke: Pass PowerPCCPU to ppc_booke_timers_init() Andreas Färber
2012-12-19 13:36 ` [Qemu-devel] [PATCH 18/20] cpu: Move kvm_state field into CPUState Andreas Färber
2012-12-19 13:36 ` [Qemu-devel] [PATCH 19/20] cpu: Move kvm_run " Andreas Färber
2012-12-19 13:36 ` [Qemu-devel] [PATCH 20/20] MAINTAINERS: Include X86CPU in CPU maintenance area Andreas Färber
2012-12-22 12:08 ` [Qemu-devel] [PULL] QOM CPUState patch queue 2012-12-19 Blue Swirl
2012-12-23 0:00 ` Andreas Färber
2012-12-28 20:05 ` Blue Swirl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1355924196-19288-14-git-send-email-afaerber@suse.de \
--to=afaerber@suse.de \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).