Skip to content

KVM: PPC: Implement passthrough of emulated devices for nested guests

Suraj Jitindar Singh kvm kvm-ppc linuxppc-dev 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest8 patches 1 replyIn review
  2. v38 patches 0 repliesSuperseded
  3. v28 patches 2 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v18 patches1 replySuperseded

V2 -> V3 from the cover letter

1/8: None
2/8: None
3/8: None
4/8: None
5/8: None
6/8: Add if def to fix compilation for some platforms 7/8: None
8/8: None

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8KVM: PPC: Only report KVM_CAP_SPAPR_TCE_VFIO on powernv machinesarch/powerpc/kvm/powerpc.c+5 -10 replies
2/8KVM: PPC: Book3S HV: Add function kvmhv_vcpu_is_radix()arch/powerpc/include/asm/kvm_book3s_64.h arch/powerpc/kvm/book3s_hv_nested.c+14 -00 replies
3/8KVM: PPC: Book3S HV: Implement functions to access quadrants 1 & 2arch/powerpc/include/asm/kvm_book3s.h arch/powerpc/kernel/exceptions-64s.S arch/powerpc/kvm/book3s_64_mmu_radix.c +1 more+111 -00 replies
4/8KVM: PPC: Add load_from_eaddr and store_to_eaddr to the kvmppc_ops structarch/powerpc/include/asm/kvm_ppc.h arch/powerpc/kvm/book3s_hv.c+44 -00 replies
5/8KVM: PPC: Update kvmppc_st and kvmppc_ld to use quadrantsarch/powerpc/kvm/powerpc.c+16 -20 replies
6/8KVM: PPC: Book3S HV: Allow passthrough of an emulated device to an L2 guestarch/powerpc/include/asm/kvm_book3s.h arch/powerpc/include/asm/kvm_host.h arch/powerpc/kvm/book3s_hv.c +2 more+57 -110 replies
7/8KVM: PPC: Introduce new hcall H_COPY_TOFROM_GUEST to access quadrants 1 & 2arch/powerpc/include/asm/hvcall.h arch/powerpc/include/asm/kvm_book3s.h arch/powerpc/kvm/book3s_64_mmu_radix.c +2 more+89 -40 replies
8/8KVM: PPC: Book3S HV: Allow passthrough of an emulated device to an L3 guestarch/powerpc/kvm/book3s_64_mmu_radix.c arch/powerpc/kvm/book3s_hv_nested.c+4 -100 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCH V4 0/8] KVM: PPC: Implement passthrough of emulated devices for nested guests

This patch series allows for emulated devices to be passed through to nested guests, irrespective of at which level the device is being emulated.

Note that the emulated device must be using dma, not virtio.

For example, passing through an emulated e1000:

1. Emulate the device at L(n) for L(n+1)

qemu-system-ppc64 -netdev type=user,id=net0 -device e1000,netdev=net0

2. Assign the VFIO-PCI driver at L(n+1)

echo vfio-pci > /sys/bus/pci/devices/0000:00:00.0/driver_override echo 0000:00:00.0 > /sys/bus/pci/drivers/e1000/unbind echo 0000:00:00.0 > /sys/bus/pci/drivers/vfio-pci/bind chmod 666 /dev/vfio/0

3. Pass the device through from L(n+1) to L(n+2)

qemu-system-ppc64 -device vfio-pci,host=0000:00:00.0

4. L(n+2) can now access the device which will be emulated at L(n)

V2 -> V3:
1/8: None
2/8: None
3/8: None
4/8: None
5/8: None
6/8: Add if def to fix compilation for some platforms 7/8: None
8/8: None

Suraj Jitindar Singh (8):
KVM: PPC: Only report KVM_CAP_SPAPR_TCE_VFIO on powernv machines
KVM: PPC: Book3S HV: Add function kvmhv_vcpu_is_radix()
KVM: PPC: Book3S HV: Implement functions to access quadrants 1 & 2
KVM: PPC: Add load_from_eaddr and store_to_eaddr to the kvmppc_ops
struct
KVM: PPC: Update kvmppc_st and kvmppc_ld to use quadrants
KVM: PPC: Book3S HV: Allow passthrough of an emulated device to an L2
guest
KVM: PPC: Introduce new hcall H_COPY_TOFROM_GUEST to access quadrants

    1 & 2

KVM: PPC: Book3S HV: Allow passthrough of an emulated device to an L3
guest

 arch/powerpc/include/asm/hvcall.h        |   1 +
 arch/powerpc/include/asm/kvm_book3s.h    |  10 ++-
 arch/powerpc/include/asm/kvm_book3s_64.h |  13 ++++
 arch/powerpc/include/asm/kvm_host.h      |   3 +
 arch/powerpc/include/asm/kvm_ppc.h       |   4 ++
 arch/powerpc/kernel/exceptions-64s.S     |   9 +++
 arch/powerpc/kvm/book3s_64_mmu_radix.c   |  97 ++++++++++++++++++++++++++
 arch/powerpc/kvm/book3s_hv.c             |  58 ++++++++++++++--
 arch/powerpc/kvm/book3s_hv_nested.c      | 114 +++++++++++++++++++++++++++++--
 arch/powerpc/kvm/powerpc.c               |  32 ++++++++-
 arch/powerpc/mm/fault.c                  |   1 +
 11 files changed, 327 insertions(+), 15 deletions(-)
Signature · 1 line
2.13.6