qemu-ppc
[Top][All Lists]
Advanced

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

[Qemu-ppc] [PATCH v3 00/12] ISA 3.00 KVM guest support


From: Sam Bobroff
Subject: [Qemu-ppc] [PATCH v3 00/12] ISA 3.00 KVM guest support
Date: Thu, 2 Mar 2017 16:38:55 +1100

ISA 3.00 KVM guest support

Because KVM will soon provide the necessary infrastructure for KVM guests to
run on POWER9 CPUs, we can now start exploiting this new functionality from
QEMU. See:
https://lists.ozlabs.org/pipermail/linuxppc-dev/2017-January/153433.html

This set aims to support only the following scenarios:
* A POWER9 host running in radix mode, running a guest in radix mode.
* A POWER9 host running in hash mode, running a guest in hash mode.
* A POWER9 host running in hash mode, running a guest in legacy(+) mode.
(+) Where legacy means that the guest does not support ISA 3.00.

Hash or radix mode for the host is controlled via the "disable_radix" kernel
command line parameter: the host will use radix unless disable_radix is given.
For the guest it should be automatically selected to match the host.

Bad legacy guests: There are some recent kernels (e.g. 4.9) that will, when run
as a KVM guest and if the ibm,pa-features entry in the device tree has the
Radix MMU bit set, attempt to initialize the MMU as if they were a host (which
will cause them to crash). To avoid exposing this problem, the Radix MMU bit
is removed from ibm,pa-features when a legacy guest is detected.

Notes:
* This set is based on David Gibson's ppc-for-2.9 branch, available
in his tree on github at https://github.com/dgibson/qemu.git .
* This set sits on top of Suraj's recent patch set titled "target/ppc:
Implement POWER9 pseries TCG legacy support", archved here:
https://lists.gnu.org/archive/html/qemu-ppc/2017-03/msg00004.html .
* I have merged my patch that implements with h_register_process_table()
with the patches Suraj's work that implement the same function for TCG (to make
integration easier). The patches are now:
    * target/ppc: Add new H-CALL shells for in memory table translation
    * target/ppc: Implement H_REGISTER_PROCESS_TABLE H_CALL
* The set itself and Suraj's related work are availbe in a branch called p9-cas,
from my tree on github at https://github.com/sambltc/qemu.git .

Patch set changelog follows:

====== Version 2 -> version 3: ======

Patch 1/12: spapr: Small cleanup of PPC MMU enums
* Slight changes due to reordering patches.
* Fixed additional uses of POWERPC_MMU_3_00 caused by reordering.

Patch 7/12: spapr: Only setup HTP if necessary.
* in spapr_setup_hpt_and_vrma() replaced MACHINE(qdev_get_machine()) with 
MACHINE(spapr).

Patch 8/12: target/ppc: Add new H-CALL shells for in memory table translation
* Brought in from Suraj's work.

Patch 9/12: target/ppc: Implement H_REGISTER_PROCESS_TABLE H_CALL
* KVM-only implementation of h_register_process_table() integrated into the TCG 
version.

Patch 11/12: spapr: Enable ISA 3.0 MMU mode selection via CAS
* Added some terse documentation for the ibm,pa_features bits for ISA 3.00.
* Shortened the error reports for guest termination a little.

Patch 12/12: spapr: Workaround for broken radix guests
* Legacy guest detection now uses the ISA 3.00 bit in option vector 1.

====== Version 1 -> version 2: ======

Patch 3/13: scripts/update-linux-headers.sh: refactor extra files
I've factored the script to make it easier to add new files.

Patch 4/13: scripts/update-linux-headers.sh: add new files for ARM
* Added the two new arm headers.

Patch 5/13: Move virtio_mmio.h to fix update-linux-headers.sh
* FWIW, here's one way of fixing it.

Patch 6/13: Update headers using update-linux-headers.sh
* Added information about where the headers came from.

Patch 7/13: spapr: Add ibm,processor-radix-AP-encodings to the device tree
* ppc_radix_page_info now kept in native format, conversion to BE done when 
adding to the device tree.
* radix_page_info moved into the CPU class, cleaning up some code.

Patch 8/13: target-ppc: support KVM_CAP_PPC_MMU_RADIX, KVM_CAP_PPC_MMU_HASH_V3
* cap_mmu_hash renamed to cap_mmu_hash_v3.

Patch 9/13: spapr: Only setup HTP if necessary.
* This patch has been mostly rewritten to move the late HPT allocation to CAS.
This allows a guest to start in radix mode (when it's in real mode) and then
change to hash, even if it is a legacy guest and will not call
h_register_process_table().
* Added an exported function to spapr.c to perform HPT allocation and adjust
the vrma if necessary. This makes it possible to allocate the HPT from
h_client_architecture_support() in spapr_hcall.c.

Patch 10/13: spapr: Add h_register_process_table() hypercall
* I haven't addressed review comments for this patch because it overlaps with
Suraj's implementation of the same function and we'll work together to
integrate them.

Patch 12/13: spapr: Enable ISA 3.0 MMU mode selection via CAS
* Unused bits removed.
* Logic and bit definitions changed due to architectural change.
* Cleanly terminate QEMU if the guest requests an unavailable mode (as required
  by the new architecture).
* Legacy guest workaround moved to it's own patch.
* I'm sorry for the bitfield constants in spapr_dt_ov5_platform_support() but
  there don't seem to be convienent macros for converting an option vector
  specifier (OV_BIT(x,y)) into a byte-mask. I'm open to suggestions.


Sam Bobroff (10):
  spapr: Small cleanup of PPC MMU enums
  scripts/update-linux-headers.sh: refactor extra files
  scripts/update-linux-headers.sh: add new files for ARM
  Update headers using update-linux-headers.sh
  spapr: Add ibm,processor-radix-AP-encodings to the device tree
  target-ppc: support KVM_CAP_PPC_MMU_RADIX, KVM_CAP_PPC_MMU_HASH_V3
  spapr: Only setup HTP if necessary.
  spapr: move spapr_populate_pa_features()
  spapr: Enable ISA 3.0 MMU mode selection via CAS
  spapr: Workaround for broken radix guests

Suraj Jitindar Singh (2):
  target/ppc: Add new H-CALL shells for in memory table translation
  target/ppc: Implement H_REGISTER_PROCESS_TABLE H_CALL

 hw/ppc/spapr.c                                     | 230 +++++++----
 hw/ppc/spapr_hcall.c                               | 174 ++++++++-
 include/hw/ppc/spapr.h                             |   6 +
 include/hw/ppc/spapr_ovec.h                        |   8 +
 include/standard-headers/linux/input-event-codes.h |   2 +-
 include/standard-headers/linux/pci_regs.h          |   8 +
 include/standard-headers/linux/virtio_ids.h        |   1 +
 include/sysemu/kvm.h                               |   1 +
 linux-headers/asm-arm/kvm.h                        |   2 +
 linux-headers/asm-arm/unistd-eabi.h                |   5 +
 linux-headers/asm-arm/unistd-oabi.h                |  17 +
 linux-headers/asm-arm/unistd.h                     | 419 +--------------------
 linux-headers/asm-powerpc/kvm.h                    |  27 ++
 linux-headers/asm-powerpc/unistd.h                 |   1 +
 linux-headers/asm-x86/kvm_para.h                   |   4 +-
 linux-headers/linux/kvm.h                          |  20 +-
 linux-headers/linux/vfio.h                         |  10 +
 scripts/update-linux-headers.sh                    |  26 +-
 target/ppc/cpu-qom.h                               |  13 +-
 target/ppc/cpu.h                                   |   4 +
 target/ppc/kvm.c                                   |  67 +++-
 target/ppc/kvm_ppc.h                               |  14 +
 target/ppc/mmu-hash64.c                            |  12 +-
 target/ppc/mmu_helper.c                            |  71 ++--
 target/ppc/translate.c                             |  14 +-
 25 files changed, 580 insertions(+), 576 deletions(-)
 create mode 100644 linux-headers/asm-arm/unistd-eabi.h
 create mode 100644 linux-headers/asm-arm/unistd-oabi.h

-- 
2.11.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]