From: Laurent Vivier <lvivier@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>,
Igor Mammedov <imammedo@redhat.com>,
Bharata B Rao <bharata@linux.vnet.ibm.com>,
David Gibson <david@gibson.dropbear.id.au>,
Peter Maydell <peter.maydell@linaro.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Alexander Graf <agraf@suse.de>,
Matthew Rosato <mjrosato@linux.vnet.ibm.com>,
qemu-devel@nongnu.org, Richard Henderson <rth@twiddle.net>,
qemu-arm@nongnu.org, Greg Ungerer <gerg@uclinux.org>,
Guan Xuetao <gxt@mprc.pku.edu.cn>, Jia Liu <proljc@gmail.com>,
Markus Armbruster <armbru@redhat.com>,
Artyom Tarasenko <atar4qemu@gmail.com>,
"Edgar E . Iglesias" <edgar.iglesias@gmail.com>,
Michael Walle <michael@walle.cc>,
Chen Gang <gang.chen.5i5j@gmail.com>,
Aurelien Jarno <aurelien@aurel32.net>,
Anthony Green <green@moxielogic.com>,
qemu-ppc@nongnu.org,
Bastian Koppelmann <kbastian@mail.uni-paderborn.de>,
Greg Kurz <groug@kaod.org>, Max Filippov <jcmvbkbc@gmail.com>,
Laurent Vivier <lvivier@redhat.com>
Subject: [Qemu-devel] [PATCH v3 3/3] exec: call cpu_exec_exit() from a CPU unrealize common function
Date: Sat, 15 Oct 2016 00:52:49 +0200 [thread overview]
Message-ID: <1476485569-6744-4-git-send-email-lvivier@redhat.com> (raw)
In-Reply-To: <1476485569-6744-1-git-send-email-lvivier@redhat.com>
As cpu_exec_exit() mirrors the cpu_exec_realizefn(),
rename it as cpu_exec_unrealizefn().
Create and register a cpu_common_unrealizefn() function for
the CPU device class and call cpu_exec_unrealizefn() from
this function.
Remove cpu_exec_exit() from cpu_common_finalize()
(which mirrors init, not realize), and as x86_cpu_unrealizefn()
overwrites the device class unrealize function, add a call to
cpu_exec_unrealizefn() (as in ppc_cpu_unrealizefn()).
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
exec.c | 2 +-
include/qom/cpu.h | 2 +-
qom/cpu.c | 8 +++++++-
target-i386/cpu.c | 2 ++
target-ppc/translate_init.c | 2 +-
5 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/exec.c b/exec.c
index 203eb52..3cd25db 100644
--- a/exec.c
+++ b/exec.c
@@ -596,7 +596,7 @@ AddressSpace *cpu_get_address_space(CPUState *cpu, int asidx)
}
#endif
-void cpu_exec_exit(CPUState *cpu)
+void cpu_exec_unrealizefn(CPUState *cpu)
{
CPUClass *cc = CPU_GET_CLASS(cpu);
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 5520c6c..633c3fc 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -948,7 +948,7 @@ void QEMU_NORETURN cpu_abort(CPUState *cpu, const char *fmt, ...)
GCC_FMT_ATTR(2, 3);
void cpu_exec_initfn(CPUState *cpu);
void cpu_exec_realizefn(CPUState *cpu, Error **errp);
-void cpu_exec_exit(CPUState *cpu);
+void cpu_exec_unrealizefn(CPUState *cpu);
#ifdef CONFIG_SOFTMMU
extern const struct VMStateDescription vmstate_cpu_common;
diff --git a/qom/cpu.c b/qom/cpu.c
index 85f1132..03d9190 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -345,6 +345,12 @@ static void cpu_common_realizefn(DeviceState *dev, Error **errp)
trace_init_vcpu(cpu);
}
+static void cpu_common_unrealizefn(DeviceState *dev, Error **errp)
+{
+ CPUState *cpu = CPU(dev);
+ cpu_exec_unrealizefn(cpu);
+}
+
static void cpu_common_initfn(Object *obj)
{
CPUState *cpu = CPU(obj);
@@ -369,7 +375,6 @@ static void cpu_common_initfn(Object *obj)
static void cpu_common_finalize(Object *obj)
{
CPUState *cpu = CPU(obj);
- cpu_exec_exit(cpu);
g_free(cpu->trace_dstate);
}
@@ -403,6 +408,7 @@ static void cpu_class_init(ObjectClass *klass, void *data)
k->cpu_exec_exit = cpu_common_noop;
k->cpu_exec_interrupt = cpu_common_exec_interrupt;
dc->realize = cpu_common_realizefn;
+ dc->unrealize = cpu_common_unrealizefn;
/*
* Reason: CPUs still need special care by board code: wiring up
* IRQs, adding reset handlers, halting non-first CPUs, ...
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 3476d46..399a3e4 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -3253,6 +3253,8 @@ static void x86_cpu_unrealizefn(DeviceState *dev, Error **errp)
object_unparent(OBJECT(cpu->apic_state));
cpu->apic_state = NULL;
}
+
+ cpu_exec_unrealizefn(CPU(dev));
}
typedef struct BitProperty {
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 40dae70..2de6a06 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -9910,7 +9910,7 @@ static void ppc_cpu_unrealizefn(DeviceState *dev, Error **errp)
opc_handler_t **table, **table_2;
int i, j, k;
- cpu_exec_exit(CPU(dev));
+ cpu_exec_unrealizefn(CPU(dev));
for (i = 0; i < PPC_CPU_OPCODES_LEN; i++) {
if (env->opcodes[i] == &invalid_handler) {
--
2.7.4
next prev parent reply other threads:[~2016-10-14 23:02 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-14 22:52 [Qemu-devel] [PATCH v3 0/3] Split cpu_exec_init() into an init and a realize part Laurent Vivier
2016-10-14 22:52 ` [Qemu-devel] [PATCH v3 1/3] exec: split cpu_exec_init() Laurent Vivier
2016-10-17 3:43 ` David Gibson
2016-10-17 11:15 ` Igor Mammedov
2016-10-17 18:46 ` Eduardo Habkost
2016-10-14 22:52 ` [Qemu-devel] [PATCH v3 2/3] exec: rename cpu_exec_init() as cpu_exec_realizefn() Laurent Vivier
2016-10-17 3:43 ` David Gibson
2016-10-17 11:20 ` Igor Mammedov
2016-10-17 14:03 ` Eduardo Habkost
2016-10-17 14:25 ` Laurent Vivier
2016-10-17 19:20 ` Eduardo Habkost
2016-10-18 10:48 ` Igor Mammedov
2016-10-18 13:00 ` Andrew Jones
2016-10-18 13:18 ` Eduardo Habkost
2016-10-18 14:22 ` Andrew Jones
2016-10-18 15:22 ` Eduardo Habkost
2016-10-18 16:22 ` Andrew Jones
2016-10-18 16:57 ` Laurent Vivier
2016-10-18 17:07 ` Peter Maydell
2016-10-18 17:57 ` Andrew Jones
2016-10-18 18:12 ` Peter Maydell
2016-10-18 18:45 ` [Qemu-devel] QOM properties vs C functions/fields (was Re: [PATCH v3 2/3] exec: rename cpu_exec_init() as cpu_exec_realizefn()) Eduardo Habkost
2016-10-18 20:30 ` Peter Maydell
2016-10-18 20:49 ` Eduardo Habkost
2016-10-18 21:08 ` Peter Maydell
2016-10-19 11:11 ` Eduardo Habkost
2016-10-19 11:22 ` Peter Maydell
2016-10-21 18:26 ` Markus Armbruster
2016-10-22 9:31 ` Peter Maydell
2016-10-24 7:24 ` Markus Armbruster
2016-10-14 22:52 ` Laurent Vivier [this message]
2016-10-17 3:43 ` [Qemu-devel] [PATCH v3 3/3] exec: call cpu_exec_exit() from a CPU unrealize common function David Gibson
2016-10-17 11:30 ` Igor Mammedov
2016-10-17 3:44 ` [Qemu-devel] [PATCH v3 0/3] Split cpu_exec_init() into an init and a realize part David Gibson
2016-10-17 18:47 ` Eduardo Habkost
2016-10-17 22:50 ` David Gibson
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=1476485569-6744-4-git-send-email-lvivier@redhat.com \
--to=lvivier@redhat.com \
--cc=agraf@suse.de \
--cc=armbru@redhat.com \
--cc=atar4qemu@gmail.com \
--cc=aurelien@aurel32.net \
--cc=bharata@linux.vnet.ibm.com \
--cc=david@gibson.dropbear.id.au \
--cc=edgar.iglesias@gmail.com \
--cc=ehabkost@redhat.com \
--cc=gang.chen.5i5j@gmail.com \
--cc=gerg@uclinux.org \
--cc=green@moxielogic.com \
--cc=groug@kaod.org \
--cc=gxt@mprc.pku.edu.cn \
--cc=imammedo@redhat.com \
--cc=jcmvbkbc@gmail.com \
--cc=kbastian@mail.uni-paderborn.de \
--cc=michael@walle.cc \
--cc=mjrosato@linux.vnet.ibm.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=proljc@gmail.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=rth@twiddle.net \
/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).