[PATCH qom-cpu 00/11] QOM CPUState, part 6: CPU_COMMON for KVM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>
Cc: Marcelo Tosatti <mtosatti@xxxxxxxxxx>
Cc: kvm <kvm@xxxxxxxxxxxxxxx>
Cc: Alexander Graf <agraf@xxxxxxx>
Cc: Peter Maydell <peter.maydell@xxxxxxxxxx>

Cc: Igor Mammedov <imammedo@xxxxxxxxxx>
Cc: Eduardo Habkost <ehabkost@xxxxxxxxxx>

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

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux