aboutsummaryrefslogtreecommitdiff
path: root/hw/ppc
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-02-07 14:38:53 +0000
committerPeter Maydell <peter.maydell@linaro.org>2018-02-07 14:38:53 +0000
commitea62da0913d20338b8a47bbfaef2e8f2763ee13f (patch)
tree916e3f25f4bf7799c77a9045e8097ccb59ecb6a1 /hw/ppc
parent0833df03f4206a6cf416fbb3d380fa95c8e61fba (diff)
parentdb32d0f43839627f54a1a7f8eee17baa770f52d2 (diff)
downloadqemu-ea62da0913d20338b8a47bbfaef2e8f2763ee13f.zip
qemu-ea62da0913d20338b8a47bbfaef2e8f2763ee13f.tar.gz
qemu-ea62da0913d20338b8a47bbfaef2e8f2763ee13f.tar.bz2
Merge remote-tracking branch 'remotes/awilliam/tags/vfio-update-20180206.0' into staging
VFIO updates 2018-02-06 - SPAPR in-kernel TCE accleration (Alexey Kardashevskiy) - MSI-X relocation (Alex Williamson) - Add missing platform mutex init (Eric Auger) - Redundant variable cleanup (Alexey Kardashevskiy) - Option to disable GeForce quirks (Alex Williamson) # gpg: Signature made Tue 06 Feb 2018 18:21:22 GMT # gpg: using RSA key 239B9B6E3BB08B22 # gpg: Good signature from "Alex Williamson <alex.williamson@redhat.com>" # gpg: aka "Alex Williamson <alex@shazbot.org>" # gpg: aka "Alex Williamson <alwillia@redhat.com>" # gpg: aka "Alex Williamson <alex.l.williamson@gmail.com>" # Primary key fingerprint: 42F6 C04E 540B D1A9 9E7B 8A90 239B 9B6E 3BB0 8B22 * remotes/awilliam/tags/vfio-update-20180206.0: vfio/pci: Add option to disable GeForce quirks vfio/common: Remove redundant copy of local variable hw/vfio/platform: Init the interrupt mutex vfio/pci: Allow relocating MSI-X MMIO qapi: Create DEFINE_PROP_OFF_AUTO_PCIBAR vfio/pci: Emulate BARs vfio/pci: Add base BAR MemoryRegion vfio/pci: Fixup VFIOMSIXInfo comment spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device vfio/spapr: Use iommu memory region's get_attr() memory/iommu: Add get_attr() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/ppc')
-rw-r--r--hw/ppc/spapr_iommu.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c
index 5ccd785..aaa6010 100644
--- a/hw/ppc/spapr_iommu.c
+++ b/hw/ppc/spapr_iommu.c
@@ -160,6 +160,19 @@ static uint64_t spapr_tce_get_min_page_size(IOMMUMemoryRegion *iommu)
return 1ULL << tcet->page_shift;
}
+static int spapr_tce_get_attr(IOMMUMemoryRegion *iommu,
+ enum IOMMUMemoryRegionAttr attr, void *data)
+{
+ sPAPRTCETable *tcet = container_of(iommu, sPAPRTCETable, iommu);
+
+ if (attr == IOMMU_ATTR_SPAPR_TCE_FD && kvmppc_has_cap_spapr_vfio()) {
+ *(int *) data = tcet->fd;
+ return 0;
+ }
+
+ return -EINVAL;
+}
+
static void spapr_tce_notify_flag_changed(IOMMUMemoryRegion *iommu,
IOMMUNotifierFlag old,
IOMMUNotifierFlag new)
@@ -284,6 +297,10 @@ void spapr_tce_set_need_vfio(sPAPRTCETable *tcet, bool need_vfio)
tcet->need_vfio = need_vfio;
+ if (!need_vfio || (tcet->fd != -1 && kvmppc_has_cap_spapr_vfio())) {
+ return;
+ }
+
oldtable = tcet->table;
tcet->table = spapr_tce_alloc_table(tcet->liobn,
@@ -643,6 +660,7 @@ static void spapr_iommu_memory_region_class_init(ObjectClass *klass, void *data)
imrc->translate = spapr_tce_translate_iommu;
imrc->get_min_page_size = spapr_tce_get_min_page_size;
imrc->notify_flag_changed = spapr_tce_notify_flag_changed;
+ imrc->get_attr = spapr_tce_get_attr;
}
static const TypeInfo spapr_iommu_memory_region_info = {