All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] KVM: PPC: Implement passthrough of emulated devices for nested guests
@ 2018-12-07  3:43 ` Suraj Jitindar Singh
  0 siblings, 0 replies; 29+ messages in thread
From: Suraj Jitindar Singh @ 2018-12-07  3:43 UTC (permalink / raw)
  To: kvm-ppc; +Cc: aik, linuxppc-dev, kvm, sjitindarsingh

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 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\000:00:00.0

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

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               |  28 +++++++-
 arch/powerpc/mm/fault.c                  |   1 +
 11 files changed, 323 insertions(+), 15 deletions(-)

-- 
2.13.6

^ permalink raw reply	[flat|nested] 29+ messages in thread
* [PATCH] KVM: PPC: Book3S PR: Set hflag to indicate that POWER9 supports 1T segments
@ 2018-12-07  1:17 Suraj Jitindar Singh
  0 siblings, 0 replies; 29+ messages in thread
From: Suraj Jitindar Singh @ 2018-12-07  1:17 UTC (permalink / raw)
  To: kvm-ppc

When booting a kvm-pr guest on a POWER9 machine the following message is
observed:
"qemu-system-ppc64: KVM does not support 1TiB segments which guest expects"

This is because the guest is expecting to be able to use 1T segments
however we don't indicate support for it. This is because we don't set
the BOOK3S_HFLAG_MULTI_PGSIZE flag in the hflags in kvmppc_set_pvr_pr()
on POWER9.

POWER9 does indeed have support for 1T segments, so add a case for
POWER9 to the switch statement to ensure it is set.

Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
---
 arch/powerpc/kvm/book3s_pr.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index 4efd65d9e828..82840160c606 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -587,6 +587,7 @@ void kvmppc_set_pvr_pr(struct kvm_vcpu *vcpu, u32 pvr)
 	case PVR_POWER8:
 	case PVR_POWER8E:
 	case PVR_POWER8NVL:
+	case PVR_POWER9:
 		vcpu->arch.hflags |= BOOK3S_HFLAG_MULTI_PGSIZE |
 			BOOK3S_HFLAG_NEW_TLBIE;
 		break;
-- 
2.13.6

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

end of thread, other threads:[~2018-12-18  1:10 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-07  3:43 [PATCH 0/8] KVM: PPC: Implement passthrough of emulated devices for nested guests Suraj Jitindar Singh
2018-12-07  3:43 ` Suraj Jitindar Singh
2018-12-07  3:43 ` [PATCH] KVM: PPC: Book3S PR: Set hflag to indicate that POWER9 supports 1T segments Suraj Jitindar Singh
2018-12-07  3:43   ` Suraj Jitindar Singh
2018-12-07 11:08   ` Michael Ellerman
2018-12-07 11:08     ` Michael Ellerman
2018-12-07 11:42     ` Paul Mackerras
2018-12-07 11:42       ` Paul Mackerras
2018-12-18  1:00   ` Paul Mackerras
2018-12-18  1:00     ` Paul Mackerras
2018-12-07  3:43 ` [PATCH 1/8] KVM: PPC: Only report KVM_CAP_SPAPR_TCE_VFIO on powernv machines Suraj Jitindar Singh
2018-12-07  3:43   ` Suraj Jitindar Singh
2018-12-07  3:43 ` [PATCH 2/8] KVM: PPC: Book3S HV: Add function kvmhv_vcpu_is_radix() Suraj Jitindar Singh
2018-12-07  3:43   ` Suraj Jitindar Singh
2018-12-07  3:43 ` [PATCH 3/8] KVM: PPC: Book3S HV: Implement functions to access quadrants 1 & 2 Suraj Jitindar Singh
2018-12-07  3:43   ` Suraj Jitindar Singh
2018-12-07  3:43 ` [PATCH 4/8] KVM: PPC: Add load_from_eaddr and store_to_eaddr to the kvmppc_ops struct Suraj Jitindar Singh
2018-12-07  3:43   ` Suraj Jitindar Singh
2018-12-07  3:43 ` [PATCH 5/8] KVM: PPC: Update kvmppc_st and kvmppc_ld to use quadrants Suraj Jitindar Singh
2018-12-07  3:43   ` Suraj Jitindar Singh
2018-12-07  3:43 ` [PATCH 6/8] KVM: PPC: Book3S HV: Allow passthrough of an emulated device to an L2 guest Suraj Jitindar Singh
2018-12-07  3:43   ` Suraj Jitindar Singh
2018-12-07  3:43 ` [PATCH 7/8] KVM: PPC: Introduce new hcall H_COPY_TOFROM_GUEST to access quadrants 1 & 2 Suraj Jitindar Singh
2018-12-07  3:43   ` Suraj Jitindar Singh
2018-12-07  3:43 ` [PATCH 8/8] KVM: PPC: Book3S HV: Allow passthrough of an emulated device to an L3 guest Suraj Jitindar Singh
2018-12-07  3:43   ` Suraj Jitindar Singh
2018-12-07  3:45 ` [PATCH 0/8] KVM: PPC: Implement passthrough of emulated devices for nested guests Suraj Jitindar Singh
2018-12-07  3:45   ` Suraj Jitindar Singh
  -- strict thread matches above, loose matches on Subject: below --
2018-12-07  1:17 [PATCH] KVM: PPC: Book3S PR: Set hflag to indicate that POWER9 supports 1T segments Suraj Jitindar Singh

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.