From: Jan Kiszka <jan.kiszka@web.de>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: mtosatti@redhat.com, qemu-devel@nongnu.org, kvm@vger.kernel.org,
avi@redhat.com
Subject: Re: [Qemu-devel] [PATCH 4/3] ioapic: change pre_save/post_load methods to get/put
Date: Tue, 30 Oct 2012 19:18:17 +0100 [thread overview]
Message-ID: <509019E9.1080309@web.de> (raw)
In-Reply-To: <1351599394-24876-5-git-send-email-pbonzini@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 3823 bytes --]
On 2012-10-30 13:16, Paolo Bonzini wrote:
> Similar to the APIC, add get/put methods that can be called from common
> IOAPIC code. Use them already for pre_save/post_load, since they are
> exact replacements.
Also here: I don't see a benefit and prefer the current style.
Jan
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> hw/ioapic_common.c | 40 +++++++++++++++++++++++++---------------
> hw/ioapic_internal.h | 4 ++--
> hw/kvm/ioapic.c | 4 ++--
> 3 files changed, 29 insertions(+), 19 deletions(-)
>
> diff --git a/hw/ioapic_common.c b/hw/ioapic_common.c
> index 653eef2..1f3ea37 100644
> --- a/hw/ioapic_common.c
> +++ b/hw/ioapic_common.c
> @@ -23,7 +23,25 @@
> #include "ioapic_internal.h"
> #include "sysbus.h"
>
> -void ioapic_reset_common(DeviceState *dev)
> +static void ioapic_get(IOAPICCommonState *s)
> +{
> + IOAPICCommonClass *info = IOAPIC_COMMON_GET_CLASS(s);
> +
> + if (info->get) {
> + info->get(s);
> + }
> +}
> +
> +static void ioapic_put(IOAPICCommonState *s)
> +{
> + IOAPICCommonClass *info = IOAPIC_COMMON_GET_CLASS(s);
> +
> + if (info->put) {
> + info->put(s);
> + }
> +}
> +
> +static void ioapic_reset_common(DeviceState *dev)
> {
> IOAPICCommonState *s = IOAPIC_COMMON(dev);
> int i;
> @@ -36,24 +54,16 @@ void ioapic_reset_common(DeviceState *dev)
> }
> }
>
> -static void ioapic_dispatch_pre_save(void *opaque)
> +static void ioapic_pre_save(void *opaque)
> {
> IOAPICCommonState *s = IOAPIC_COMMON(opaque);
> - IOAPICCommonClass *info = IOAPIC_COMMON_GET_CLASS(s);
> -
> - if (info->pre_save) {
> - info->pre_save(s);
> - }
> + ioapic_get(s);
> }
>
> -static int ioapic_dispatch_post_load(void *opaque, int version_id)
> +static int ioapic_post_load(void *opaque, int version_id)
> {
> IOAPICCommonState *s = IOAPIC_COMMON(opaque);
> - IOAPICCommonClass *info = IOAPIC_COMMON_GET_CLASS(s);
> -
> - if (info->post_load) {
> - info->post_load(s);
> - }
> + ioapic_put(s);
> return 0;
> }
>
> @@ -81,8 +91,8 @@ static const VMStateDescription vmstate_ioapic_common = {
> .version_id = 3,
> .minimum_version_id = 1,
> .minimum_version_id_old = 1,
> - .pre_save = ioapic_dispatch_pre_save,
> - .post_load = ioapic_dispatch_post_load,
> + .pre_save = ioapic_pre_save,
> + .post_load = ioapic_post_load,
> .fields = (VMStateField[]) {
> VMSTATE_UINT8(id, IOAPICCommonState),
> VMSTATE_UINT8(ioregsel, IOAPICCommonState),
> diff --git a/hw/ioapic_internal.h b/hw/ioapic_internal.h
> index e04c9f3..7311ad0 100644
> --- a/hw/ioapic_internal.h
> +++ b/hw/ioapic_internal.h
> @@ -84,8 +84,8 @@ typedef struct IOAPICCommonState IOAPICCommonState;
> typedef struct IOAPICCommonClass {
> SysBusDeviceClass parent_class;
> void (*init)(IOAPICCommonState *s, int instance_no);
> - void (*pre_save)(IOAPICCommonState *s);
> - void (*post_load)(IOAPICCommonState *s);
> + void (*get)(IOAPICCommonState *s);
> + void (*put)(IOAPICCommonState *s);
> } IOAPICCommonClass;
>
> struct IOAPICCommonState {
> diff --git a/hw/kvm/ioapic.c b/hw/kvm/ioapic.c
> index 6c3b8fe..03cb36c 100644
> --- a/hw/kvm/ioapic.c
> +++ b/hw/kvm/ioapic.c
> @@ -104,8 +104,8 @@ static void kvm_ioapic_class_init(ObjectClass *klass, void *data)
> DeviceClass *dc = DEVICE_CLASS(klass);
>
> k->init = kvm_ioapic_init;
> - k->pre_save = kvm_ioapic_get;
> - k->post_load = kvm_ioapic_put;
> + k->get = kvm_ioapic_get;
> + k->put = kvm_ioapic_put;
> dc->reset = kvm_ioapic_reset;
> dc->props = kvm_ioapic_properties;
> }
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]
next prev parent reply other threads:[~2012-10-30 18:18 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-30 12:16 [Qemu-devel] [PATCH uq/master 0/3] Fix MSI injection at load time Paolo Bonzini
2012-10-30 12:16 ` [Qemu-devel] [PATCH 1/3] kvm: move KVM_GET_LAPIC/KVM_SET_LAPIC to hw/kvm/apic.c Paolo Bonzini
2012-10-30 18:13 ` Jan Kiszka
2012-10-30 12:16 ` [Qemu-devel] [PATCH 2/3] apic: add get/put methods Paolo Bonzini
2012-10-30 18:17 ` Jan Kiszka
2012-10-30 12:16 ` [Qemu-devel] [PATCH 3/3] apic: always update the in-kernel status after loading Paolo Bonzini
2012-10-30 12:38 ` Avi Kivity
2012-10-30 14:16 ` Paolo Bonzini
2012-10-30 18:21 ` Jan Kiszka
2012-11-02 14:53 ` Paolo Bonzini
2012-11-02 14:59 ` Jan Kiszka
2012-11-02 15:07 ` Gerd Hoffmann
2012-11-02 15:13 ` Paolo Bonzini
2012-11-02 15:17 ` Gerd Hoffmann
2012-11-02 15:21 ` Paolo Bonzini
2012-10-30 18:17 ` Jan Kiszka
2012-10-30 12:16 ` [Qemu-devel] [PATCH 4/3] ioapic: change pre_save/post_load methods to get/put Paolo Bonzini
2012-10-30 18:18 ` Jan Kiszka [this message]
2012-10-30 12:16 ` [Qemu-devel] [PATCH 5/3] ioapic: unify reset callbacks Paolo Bonzini
2012-10-30 16:47 ` [Qemu-devel] [PATCH uq/master 0/3] Fix MSI injection at load time Paolo Bonzini
2012-10-30 18:22 ` Jan Kiszka
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=509019E9.1080309@web.de \
--to=jan.kiszka@web.de \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--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).