qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	kvm@vger.kernel.org, mtosatti@redhat.com,
	"Alexander Graf" <agraf@suse.de>,
	anthony@codemonkey.ws, "Igor Mammedov" <imammedo@redhat.com>,
	"Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [PATCH qom-cpu 00/11] QOM CPUState, part 6: CPU_COMMON for KVM
Date: Sun,  2 Dec 2012 05:50:40 +0100	[thread overview]
Message-ID: <1354423851-24818-1-git-send-email-afaerber@suse.de> (raw)

Hello,

As announced in my KVM Forum talk, here's a patchset converting the QEMU-side
KVM API to use CPUState where possible. While carrying the same name as before
the introduction of CPUArchState, CPUState is now a target-independent type,
theoretically allowing, e.g., KVM vCPU ioctls from target-independent devices.

Since kvm_arch_*() functions are by definition implemented per target and each
target author knows its *CPU type (X86CPU, PowerPCCPU, S390CPU; ARMCPU, MIPSCPU),
the API can be changed to accept CPUState without waiting for all fields touched
in a function's implementation(s) to move from CPU*State to CPUState.

All KVM-specific fields from CPU_COMMON are moved into CPUState. Some are left
visible outside of softmmu to avoid cluttering if (kvm_enabled()) {...} code
with #ifdef CONFIG_KVM.
Static functions are aggressively refactored to pass the most specific QOM type
to avoid consecutive conversions between CPUState/*CPU and its CPU*State child.
KVM changes are followed up with (rather than depending on) a few ppc cleanups
propagating PowerPCCPU in rarely touched code, which I guess Alex won't mind. ;)

We've slowly reached a point where the previous refactorings are starting to
pay off in terms of being able to eliminate env variables in some places. :-)

Compile-tested on x86_64, ppc64, s390x; mainly x86_64 runtime-tested.

Context:
* CPUState part 4{,a,b} series were pulled into v1.2 / v1.3
* CPU-as-a-device (former part 5) is being reviewed and queued on qom-cpu
-> this CPUState part 6 series
+ CPU TLB changes TBD
+ remainder of CPUState part 4 series, up to halted / interrupt_request

Possible conflicts:
* ARM support - not merged yet and thus not refactored here
* in-kernel IRQ refactorings discussed in the BoF - where ioctls are called
* obviously, any patch that touches kvm_{fd,state,run,vcpu_is_dirty} fields

Marcelo: I would like to merge this through qom-cpu once the initial round of
pulls for the 1.4 window (possibly including your uq/master) are merged.

Available here:
https://github.com/afaerber/qemu-cpu/commits/qom-cpu-6.v1
git://github.com/afaerber/qemu-cpu.git qom-cpu-6.v1

Regards,
Andreas

Cc: Anthony Liguori <anthony@codemonkey.ws>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm <kvm@vger.kernel.org>
Cc: Alexander Graf <agraf@suse.de>
Cc: Peter Maydell <peter.maydell@linaro.org>

Cc: Igor Mammedov <imammedo@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>

Andreas Färber (11):
  cpu: Move kvm_fd into CPUState
  kvm: Pass CPUState to kvm_arch_*
  kvm: Pass CPUState to kvm_vcpu_ioctl()
  ppc: Pass PowerPCCPU to ppc_set_irq()
  ppc: Pass PowerPCCPU to [h]decr callbacks
  ppc: Pass PowerPCCPU to [h]decr timer callbacks
  ppc_booke: Pass PowerPCCPU to {decr,fit,wdt} timer callbacks
  ppc4xx_devs: Return PowerPCCPU from ppc4xx_init()
  ppc_booke: Pass PowerPCCPU to ppc_booke_timers_init()
  cpu: Move kvm_state field into CPUState
  cpu: Move kvm_run into CPUState

 cpu-defs.h                 |    8 +-
 hw/kvm/apic.c              |   10 +-
 hw/kvm/clock.c             |    2 +-
 hw/ppc.c                   |  128 +++++++++++++----------
 hw/ppc.h                   |    4 +-
 hw/ppc/e500.c              |    2 +-
 hw/ppc405_uc.c             |   10 +-
 hw/ppc440_bamboo.c         |    2 +-
 hw/ppc4xx.h                |    6 +-
 hw/ppc4xx_devs.c           |    8 +-
 hw/ppc_booke.c             |   44 ++++----
 hw/s390-virtio-bus.c       |   12 +--
 hw/spapr.c                 |    2 +-
 hw/virtex_ml507.c          |    2 +-
 include/qemu/cpu.h         |   10 ++
 kvm-all.c                  |  127 ++++++++++++-----------
 kvm.h                      |   32 +++---
 target-i386/cpu.c          |    7 +-
 target-i386/kvm.c          |  240 +++++++++++++++++++++++++-------------------
 target-ppc/kvm.c           |  121 +++++++++++++---------
 target-ppc/kvm_ppc.h       |    8 +-
 target-s390x/cpu.h         |   12 +--
 target-s390x/interrupt.c   |    3 +-
 target-s390x/kvm.c         |  176 ++++++++++++++++++--------------
 target-s390x/misc_helper.c |    2 +-
 25 Dateien geändert, 557 Zeilen hinzugefügt(+), 421 Zeilen entfernt(-)

-- 
1.7.10.4

             reply	other threads:[~2012-12-02  4:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-02  4:50 Andreas Färber [this message]
2012-12-02  4:50 ` [Qemu-devel] [PATCH qom-cpu 01/11] cpu: Move kvm_fd into CPUState Andreas Färber
2012-12-02  4:56   ` Andreas Färber
2012-12-02  4:50 ` [Qemu-devel] [PATCH qom-cpu 02/11] kvm: Pass CPUState to kvm_arch_* Andreas Färber
2012-12-02  4:50 ` [Qemu-devel] [PATCH qom-cpu 03/11] kvm: Pass CPUState to kvm_vcpu_ioctl() Andreas Färber
2012-12-02  4:50 ` [Qemu-devel] [PATCH qom-cpu 04/11] ppc: Pass PowerPCCPU to ppc_set_irq() Andreas Färber
2012-12-02  4:50 ` [Qemu-devel] [PATCH qom-cpu 05/11] ppc: Pass PowerPCCPU to [h]decr callbacks Andreas Färber
2012-12-02  4:50 ` [Qemu-devel] [PATCH qom-cpu 06/11] ppc: Pass PowerPCCPU to [h]decr timer callbacks Andreas Färber
2012-12-02  4:50 ` [Qemu-devel] [PATCH qom-cpu 07/11] ppc_booke: Pass PowerPCCPU to {decr, fit, wdt} " Andreas Färber
2012-12-02  4:50 ` [Qemu-devel] [PATCH qom-cpu 08/11] ppc4xx_devs: Return PowerPCCPU from ppc4xx_init() Andreas Färber
2012-12-02  4:50 ` [Qemu-devel] [PATCH qom-cpu 09/11] ppc_booke: Pass PowerPCCPU to ppc_booke_timers_init() Andreas Färber
2012-12-02  4:50 ` [Qemu-devel] [PATCH qom-cpu 10/11] cpu: Move kvm_state field into CPUState Andreas Färber
2012-12-02  4:50 ` [Qemu-devel] [PATCH qom-cpu 11/11] cpu: Move kvm_run " Andreas Färber

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=1354423851-24818-1-git-send-email-afaerber@suse.de \
    --to=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=anthony@codemonkey.ws \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=peter.maydell@linaro.org \
    --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).