linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/7]  arm64: KVM: vgic-v2: Allow unsafe GICV accesses
@ 2016-09-06  8:28 Marc Zyngier
  2016-09-06  8:28 ` [PATCH v2 1/7] arm64: KVM: Move kvm_vcpu_get_condition out of emulate.c Marc Zyngier
                   ` (7 more replies)
  0 siblings, 8 replies; 14+ messages in thread
From: Marc Zyngier @ 2016-09-06  8:28 UTC (permalink / raw)
  To: linux-arm-kernel

In a number of cases, KVM cannot give access direct access to the
GICv2 GICV region, either because GICV is not page aligned, or its
size is not a multiple of the page size. This is especially visible
with 16kB/64kB pages and the original GIC-400 layout where each region
is only 4k aligned.

Instead of disabling KVM altogether (which is the current behaviour),
there is some value in trapping each guest GICV access, performing the
access as quickly as possible at EL2, and resuming the guest. This
allows us to keep KVM enabled on this HW.

Implementation wise, this is done with a static key controlling the
workaround being enabled, hence coming at zero cost (well, an extra
nop on the exit hot path) for unaffected platforms. On the affected
HW, I've measured a 10 to 15% overhead for a self-IPI test, which is
pretty bad, but still much better than not having a GIC at all.

There is two pending issues:

- A failed write to GICV ends up being forwarded to userspace. This
  will be addressed in a follow-up series where we deal with injecting
  vSError in the guest

- Skipping instructions (as we do when emulating anything) breaks
  things like guest single-step and watchpoints. This is a long
  standing problem, and someone should probably have a look at
  it. Alex?

Tested on Juno-r1 with 64kB pages.

* From v1:
  - Made the AArch32 conditional code common to both 32 and 64bit
  ports, as well as accessible from EL2 (suggested by Christoffer)
  - Made the workaround message a bit more scary

Marc Zyngier (7):
  arm64: KVM: Move kvm_vcpu_get_condition out of emulate.c
  arm64: KVM: Move the AArch32 conditional execution to common code
  arm: KVM: Use common AArch32 conditional execution code
  arm64: KVM: Make kvm_skip_instr32 available to HYP
  arm64: KVM: vgic-v2: Add the GICV emulation infrastructure
  arm64: KVM: vgic-v2: Add GICV access from HYP
  arm64: KVM: vgic-v2: Enable GICV access from HYP if access from guest
    is unsafe

 arch/arm/include/asm/kvm_emulate.h   |  34 ++++++--
 arch/arm/kvm/Makefile                |   1 +
 arch/arm/kvm/emulate.c               |  99 ----------------------
 arch/arm64/include/asm/kvm_emulate.h |  10 +++
 arch/arm64/include/asm/kvm_hyp.h     |   1 +
 arch/arm64/kvm/Makefile              |   3 +-
 arch/arm64/kvm/emulate.c             | 159 -----------------------------------
 arch/arm64/kvm/hyp/switch.c          |  32 +++++++
 include/kvm/arm_vgic.h               |   6 ++
 virt/kvm/arm/aarch32.c               | 152 +++++++++++++++++++++++++++++++++
 virt/kvm/arm/hyp/vgic-v2-sr.c        |  46 ++++++++++
 virt/kvm/arm/vgic/vgic-v2.c          |  71 ++++++++++------
 12 files changed, 321 insertions(+), 293 deletions(-)
 delete mode 100644 arch/arm64/kvm/emulate.c
 create mode 100644 virt/kvm/arm/aarch32.c

-- 
2.1.4

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

end of thread, other threads:[~2016-09-06 11:14 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-06  8:28 [PATCH v2 0/7] arm64: KVM: vgic-v2: Allow unsafe GICV accesses Marc Zyngier
2016-09-06  8:28 ` [PATCH v2 1/7] arm64: KVM: Move kvm_vcpu_get_condition out of emulate.c Marc Zyngier
2016-09-06 10:47   ` Christoffer Dall
2016-09-06  8:28 ` [PATCH v2 2/7] arm64: KVM: Move the AArch32 conditional execution to common code Marc Zyngier
2016-09-06 10:47   ` Christoffer Dall
2016-09-06  8:28 ` [PATCH v2 3/7] arm: KVM: Use common AArch32 conditional execution code Marc Zyngier
2016-09-06 10:53   ` Christoffer Dall
2016-09-06  8:28 ` [PATCH v2 4/7] arm64: KVM: Make kvm_skip_instr32 available to HYP Marc Zyngier
2016-09-06 10:53   ` Christoffer Dall
2016-09-06  8:28 ` [PATCH v2 5/7] arm64: KVM: vgic-v2: Add the GICV emulation infrastructure Marc Zyngier
2016-09-06 10:53   ` Christoffer Dall
2016-09-06  8:28 ` [PATCH v2 6/7] arm64: KVM: vgic-v2: Add GICV access from HYP Marc Zyngier
2016-09-06  8:28 ` [PATCH v2 7/7] arm64: KVM: vgic-v2: Enable GICV access from HYP if access from guest is unsafe Marc Zyngier
2016-09-06 11:14 ` [PATCH v2 0/7] arm64: KVM: vgic-v2: Allow unsafe GICV accesses Christoffer Dall

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).