All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/21] arm64: KVM: world switch in C
@ 2015-11-16 13:11 ` Marc Zyngier
  0 siblings, 0 replies; 86+ messages in thread
From: Marc Zyngier @ 2015-11-16 13:11 UTC (permalink / raw)
  To: Christoffer Dall
  Cc: Mark Rutland, Catalin Marinas, linux-arm-kernel, kvm, kvmarm

Once upon a time, the KVM/arm64 world switch was a nice, clean, lean
and mean piece of hand-crafted assembly code. Over time, features have
crept in, the code has become harder to maintain, and the smallest
change is a pain to introduce. The VHE patches are a prime example of
why this doesn't work anymore.

This series rewrites most of the existing assembly code in C, but keeps
the existing code structure in place (most function names will look
familiar to the reader). The biggest change is that we don't have to
deal with a static register allocation (the compiler does it for us),
we can easily follow structure and pointers, and only the lowest level
is still in assembly code. Oh, and a negative diffstat.

There is still a healthy dose of inline assembly (system register
accessors, runtime code patching), but I've tried not to make it too
invasive. The generated code, while not exactly brilliant, doesn't
look too shaby. I do expect a small performance degradation, but I
believe this is something we can improve over time (my initial
measurements don't show any obvious regression).

Eventually (and assuming people are happy with the general approach
taken here), it should be possible to make the 32bit converge with
this and reuse some parts of the code.

Patches are against 4.4-rc1 (mostly), and I've pushed a branch out
(kvm-arm64/wsinc). This has been tested on Juno, Seattle and the FVP
model. I also have pushed out kvm-arm64/vhe-wsinc that implements VHE
on top of these patches.
	M.

Marc Zyngier (20):
  arm64: KVM: Add a HYP-specific header file
  arm64: KVM: Implement vgic-v2 save/restore
  arm64: KVM: Implement vgic-v3 save/restore
  arm64: KVM: Implement timer save/restore
  arm64: KVM: Implement system register save/restore
  arm64: KVM: Implement 32bit system register save/restore
  arm64: KVM: Implement debug save/restore
  arm64: KVM: Implement guest entry
  arm64: KVM: Add patchable function selector
  arm64: KVM: Implement the core world switch
  arm64: KVM: Implement fpsimd save/restore
  arm64: KVM: Implement TLB handling
  arm64: KVM: HYP mode entry points
  arm64: KVM: Add panic handling
  arm64: KVM: Add compatibility aliases
  arm64: KVM: Map the kernel RO section into HYP
  arm64: KVM: Move away from the assembly version of the world switch
  arm64: KVM: Turn system register numbers to an enum
  arm64: KVM: Cleanup asm-offset.c
  arm64: KVM: Remove weak attributes

Mark Rutland (1):
  arm64: add macros to read/write system registers

 arch/arm/kvm/arm.c                   |    7 +
 arch/arm64/include/asm/kvm_asm.h     |   76 ---
 arch/arm64/include/asm/kvm_emulate.h |    1 -
 arch/arm64/include/asm/kvm_host.h    |   81 ++-
 arch/arm64/include/asm/kvm_mmio.h    |    1 -
 arch/arm64/include/asm/sysreg.h      |   17 +
 arch/arm64/kernel/asm-offsets.c      |   40 +-
 arch/arm64/kvm/Makefile              |    3 +-
 arch/arm64/kvm/guest.c               |    1 -
 arch/arm64/kvm/handle_exit.c         |    1 +
 arch/arm64/kvm/hyp.S                 | 1071 +---------------------------------
 arch/arm64/kvm/hyp/Makefile          |   14 +
 arch/arm64/kvm/hyp/debug-sr.c        |  135 +++++
 arch/arm64/kvm/hyp/entry.S           |  184 ++++++
 arch/arm64/kvm/hyp/fpsimd.S          |   33 ++
 arch/arm64/kvm/hyp/hyp-entry.S       |  198 +++++++
 arch/arm64/kvm/hyp/hyp.h             |   80 +++
 arch/arm64/kvm/hyp/switch.c          |  179 ++++++
 arch/arm64/kvm/hyp/sysreg-sr.c       |  132 +++++
 arch/arm64/kvm/hyp/timer-sr.c        |   68 +++
 arch/arm64/kvm/hyp/tlb.c             |   79 +++
 arch/arm64/kvm/hyp/vgic-v2-sr.c      |   85 +++
 arch/arm64/kvm/hyp/vgic-v3-sr.c      |  224 +++++++
 arch/arm64/kvm/sys_regs.c            |    1 +
 arch/arm64/kvm/vgic-v2-switch.S      |  134 -----
 arch/arm64/kvm/vgic-v3-switch.S      |  269 ---------
 virt/kvm/arm/vgic-v3.c               |    1 +
 27 files changed, 1521 insertions(+), 1594 deletions(-)
 create mode 100644 arch/arm64/kvm/hyp/Makefile
 create mode 100644 arch/arm64/kvm/hyp/debug-sr.c
 create mode 100644 arch/arm64/kvm/hyp/entry.S
 create mode 100644 arch/arm64/kvm/hyp/fpsimd.S
 create mode 100644 arch/arm64/kvm/hyp/hyp-entry.S
 create mode 100644 arch/arm64/kvm/hyp/hyp.h
 create mode 100644 arch/arm64/kvm/hyp/switch.c
 create mode 100644 arch/arm64/kvm/hyp/sysreg-sr.c
 create mode 100644 arch/arm64/kvm/hyp/timer-sr.c
 create mode 100644 arch/arm64/kvm/hyp/tlb.c
 create mode 100644 arch/arm64/kvm/hyp/vgic-v2-sr.c
 create mode 100644 arch/arm64/kvm/hyp/vgic-v3-sr.c
 delete mode 100644 arch/arm64/kvm/vgic-v2-switch.S
 delete mode 100644 arch/arm64/kvm/vgic-v3-switch.S

-- 
2.1.4


^ permalink raw reply	[flat|nested] 86+ messages in thread

end of thread, other threads:[~2015-11-25  8:23 UTC | newest]

Thread overview: 86+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-16 13:11 [PATCH 00/21] arm64: KVM: world switch in C Marc Zyngier
2015-11-16 13:11 ` Marc Zyngier
2015-11-16 13:11 ` [PATCH 01/21] arm64: add macros to read/write system registers Marc Zyngier
2015-11-16 13:11   ` Marc Zyngier
2015-11-16 13:11 ` [PATCH 02/21] arm64: KVM: Add a HYP-specific header file Marc Zyngier
2015-11-16 13:11   ` Marc Zyngier
2015-11-16 13:11 ` [PATCH 03/21] arm64: KVM: Implement vgic-v2 save/restore Marc Zyngier
2015-11-16 13:11   ` Marc Zyngier
2015-11-20 15:22   ` Steve Capper
2015-11-20 15:22     ` Steve Capper
2015-11-20 15:54     ` Marc Zyngier
2015-11-20 15:54       ` Marc Zyngier
2015-11-16 13:11 ` [PATCH 04/21] arm64: KVM: Implement vgic-v3 save/restore Marc Zyngier
2015-11-16 13:11   ` Marc Zyngier
2015-11-20 16:48   ` Steve Capper
2015-11-20 16:48     ` Steve Capper
2015-11-20 17:41     ` Marc Zyngier
2015-11-20 17:41       ` Marc Zyngier
2015-11-16 13:11 ` [PATCH 05/21] arm64: KVM: Implement timer save/restore Marc Zyngier
2015-11-16 13:11   ` Marc Zyngier
2015-11-23 10:47   ` Steve Capper
2015-11-23 10:47     ` Steve Capper
2015-11-25  8:23     ` Marc Zyngier
2015-11-25  8:23       ` Marc Zyngier
2015-11-25  8:23       ` Marc Zyngier
2015-11-16 13:11 ` [PATCH 06/21] arm64: KVM: Implement system register save/restore Marc Zyngier
2015-11-16 13:11   ` Marc Zyngier
2015-11-16 13:11 ` [PATCH 07/21] arm64: KVM: Implement 32bit " Marc Zyngier
2015-11-16 13:11   ` Marc Zyngier
2015-11-16 13:11 ` [PATCH 08/21] arm64: KVM: Implement debug save/restore Marc Zyngier
2015-11-16 13:11   ` Marc Zyngier
2015-11-16 13:11 ` [PATCH 09/21] arm64: KVM: Implement guest entry Marc Zyngier
2015-11-16 13:11   ` Marc Zyngier
2015-11-16 13:11 ` [PATCH 10/21] arm64: KVM: Add patchable function selector Marc Zyngier
2015-11-16 13:11   ` Marc Zyngier
2015-11-16 13:11 ` [PATCH 11/21] arm64: KVM: Implement the core world switch Marc Zyngier
2015-11-16 13:11   ` Marc Zyngier
2015-11-24 17:29   ` Alex Bennée
2015-11-24 17:29     ` Alex Bennée
2015-11-24 17:40     ` Marc Zyngier
2015-11-24 17:40       ` Marc Zyngier
2015-11-24 17:40       ` Marc Zyngier
2015-11-16 13:11 ` [PATCH 12/21] arm64: KVM: Implement fpsimd save/restore Marc Zyngier
2015-11-16 13:11   ` Marc Zyngier
2015-11-17 11:13   ` Steve Capper
2015-11-17 11:13     ` Steve Capper
2015-11-17 11:25     ` Marc Zyngier
2015-11-17 11:25       ` Marc Zyngier
2015-11-17 11:49       ` Steve Capper
2015-11-17 11:49         ` Steve Capper
2015-11-17 11:56         ` Marc Zyngier
2015-11-17 11:56           ` Marc Zyngier
2015-11-16 13:11 ` [PATCH 13/21] arm64: KVM: Implement TLB handling Marc Zyngier
2015-11-16 13:11   ` Marc Zyngier
2015-11-16 13:11 ` [PATCH 14/21] arm64: KVM: HYP mode entry points Marc Zyngier
2015-11-16 13:11   ` Marc Zyngier
2015-11-16 13:11 ` [PATCH 15/21] arm64: KVM: Add panic handling Marc Zyngier
2015-11-16 13:11   ` Marc Zyngier
2015-11-16 14:16   ` Mark Rutland
2015-11-16 14:16     ` Mark Rutland
2015-11-16 14:26     ` Marc Zyngier
2015-11-16 14:26       ` Marc Zyngier
2015-11-16 14:32       ` Mark Rutland
2015-11-16 14:32         ` Mark Rutland
2015-11-16 14:44         ` Marc Zyngier
2015-11-16 14:44           ` Marc Zyngier
2015-11-16 15:53   ` Ard Biesheuvel
2015-11-16 15:53     ` Ard Biesheuvel
2015-11-16 16:57     ` Marc Zyngier
2015-11-16 16:57       ` Marc Zyngier
2015-11-16 13:11 ` [PATCH 16/21] arm64: KVM: Add compatibility aliases Marc Zyngier
2015-11-16 13:11   ` Marc Zyngier
2015-11-16 13:11 ` [PATCH 17/21] arm64: KVM: Map the kernel RO section into HYP Marc Zyngier
2015-11-16 13:11   ` Marc Zyngier
2015-11-16 14:27   ` Mark Rutland
2015-11-16 14:27     ` Mark Rutland
2015-11-16 14:43     ` Marc Zyngier
2015-11-16 14:43       ` Marc Zyngier
2015-11-16 13:11 ` [PATCH 18/21] arm64: KVM: Move away from the assembly version of the world switch Marc Zyngier
2015-11-16 13:11   ` Marc Zyngier
2015-11-16 13:11 ` [PATCH 19/21] arm64: KVM: Turn system register numbers to an enum Marc Zyngier
2015-11-16 13:11   ` Marc Zyngier
2015-11-16 13:11 ` [PATCH 20/21] arm64: KVM: Cleanup asm-offset.c Marc Zyngier
2015-11-16 13:11   ` Marc Zyngier
2015-11-16 13:11 ` [PATCH 21/21] arm64: KVM: Remove weak attributes Marc Zyngier
2015-11-16 13:11   ` Marc Zyngier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.