Skip to contentSkip to conversation

spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device

PATCH In review Alexey Kardashevskiy 5 participants 11 messages Jan 2, 2018 – Jan 19, 2018

lore
Share & tools
lore
#0 lore raw

cover spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device

This is my current queue of the in-kernel TCE acceleration enablement.

Changes since https://lists.gnu.org/archive/html/qemu-devel/2017-12/msg01918.html :
* 3 patches instead of one, one per maintainership area;
* added memory_region_iommu_get_attr();
* removed set_attr() as there is no use for it now;
* folded the chunk in vfio_listener_region_add() under VFIO_SPAPR_TCE_v2_IOMMU branch as the acceleration is only
enabled when DMA memory is preregistered and this is only supported
by the v2 IOMMU.

This is based on sha1
ad59cde Cédric Le Goater "target/ppc: more use of the PPC_*() macros".

Please comment. Thanks.

Alexey Kardashevskiy (3):
memory/iommu: Add get_attr()
vfio/spapr: Use iommu memory region's get_attr() spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device

 include/exec/memory.h | 22 ++++++++++++++++++++++
 target/ppc/kvm_ppc.h  |  6 ++++++
 hw/ppc/spapr_iommu.c  | 19 +++++++++++++++++++
 hw/vfio/common.c      | 26 ++++++++++++++++++++++++++
 memory.c              | 13 +++++++++++++
 target/ppc/kvm.c      |  7 ++++++-
 hw/vfio/trace-events  |  1 +
 7 files changed, 93 insertions(+), 1 deletion(-)
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/3 memory/iommu: Add get_attr()

This adds get_attr() to IOMMUMemoryRegionClass, like iommu_ops::domain_get_attr in the Linux kernel.

This defines the first attribute - IOMMU_ATTR_SPAPR_TCE_FD - which will be used between the pSeries machine and VFIO-PCI.

---
 include/exec/memory.h | 22 ++++++++++++++++++++++
 memory.c              | 13 +++++++++++++
 2 files changed, 35 insertions(+)
include/exec/memory.h +22 -0
index a4cabdf..e1e0a8e 100644
@@ -190,6 +190,10 @@ struct MemoryRegionOps {
     const MemoryRegionMmio old_mmio;
 };
 
+enum IOMMUMemoryRegionAttr {
+    IOMMU_ATTR_SPAPR_TCE_FD
+};
+
 typedef struct IOMMUMemoryRegionClass {
     /* private */
     struct DeviceClass parent_class;
@@ -210,6 +214,10 @@ typedef struct IOMMUMemoryRegionClass {
                                 IOMMUNotifierFlag new_flags);
     /* Set this up to provide customized IOMMU replay function */
     void (*replay)(IOMMUMemoryRegion *iommu, IOMMUNotifier *notifier);
+
+    /* Get IOMMU misc attributes */
+    int (*get_attr)(IOMMUMemoryRegion *iommu, enum IOMMUMemoryRegionAttr,
+                    void *data);
 } IOMMUMemoryRegionClass;
 
 typedef struct CoalescedMemoryRange CoalescedMemoryRange;
@@ -924,6 +932,20 @@ void memory_region_unregister_iommu_notifier(MemoryRegion *mr,
                                              IOMMUNotifier *n);
 
 /**
+ * memory_region_iommu_get_attr: return an IOMMU attr if get_attr() is
+ * defined on the IOMMU.
+ *
+ * Returns 0 if succeded, error code otherwise.
+ *
+ * @iommu_mr: the memory region
+ * @attr: the requested attribute
+ * @data: a pointer to the requested attribute data
+ */
+int memory_region_iommu_get_attr(IOMMUMemoryRegion *iommu_mr,
+                                 enum IOMMUMemoryRegionAttr attr,
+                                 void *data);
+
+/**
  * memory_region_name: get a memory region's name
  *
  * Returns the string that was used to initialize the memory region.
memory.c +13 -0
index 4b41fb8..39ab25a 100644
@@ -1920,6 +1920,19 @@ void memory_region_notify_iommu(IOMMUMemoryRegion *iommu_mr,
     }
 }
 
+int memory_region_iommu_get_attr(IOMMUMemoryRegion *iommu_mr,
+                                 enum IOMMUMemoryRegionAttr attr,
+                                 void *data)
+{
+    IOMMUMemoryRegionClass *imrc = IOMMU_MEMORY_REGION_GET_CLASS(iommu_mr);
+
+    if (!imrc->get_attr) {
+        return -EINVAL;
+    }
+
+    return imrc->get_attr(iommu_mr, attr, data);
+}
+
 void memory_region_set_log(MemoryRegion *mr, bool log, unsigned client)
 {
     uint8_t mask = 1 << client;
Signature · 1 line
2.11.0
#2 lore raw

PATCH 2/3 vfio/spapr: Use iommu memory region's get_attr()

In reply to Alexey Kardashevskiy

In order to enable TCE operations support in KVM, we have to inform the KVM about VFIO groups being attached to specific LIOBNs. The KVM already knows about VFIO groups, the only bit missing is which in-kernel TCE table (the one with user visible TCEs) should update the attached broups. There is an KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE attribute of the VFIO KVM device which receives a groupfd/tablefd couple.

This uses a new memory_region_iommu_get_attr() helper to get the IOMMU fd and calls KVM to establish the link.

As get_attr() is not implemented yet, this should cause no behavioural change.

---
 hw/vfio/common.c     | 26 ++++++++++++++++++++++++++
 hw/vfio/trace-events |  1 +
 2 files changed, 27 insertions(+)
hw/vfio/common.c +26 -0
index b77be3a..ebe28fe 100644
@@ -457,6 +457,32 @@ static void vfio_listener_region_add(MemoryListener *listener,
         vfio_host_win_add(container, section->offset_within_address_space,
                           section->offset_within_address_space +
                           int128_get64(section->size) - 1, pgsize);
+#ifdef CONFIG_KVM
+        if (kvm_enabled()) {
+            VFIOGroup *group;
+            IOMMUMemoryRegion *iommu_mr = IOMMU_MEMORY_REGION(section->mr);
+            struct kvm_vfio_spapr_tce param;
+            struct kvm_device_attr attr = {
+                .group = KVM_DEV_VFIO_GROUP,
+                .attr = KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE,
+                .addr = (uint64_t)(unsigned long)&param,
+            };
+
+            if (!memory_region_iommu_get_attr(iommu_mr, IOMMU_ATTR_SPAPR_TCE_FD,
+                                              &param.tablefd)) {
+                QLIST_FOREACH(group, &container->group_list, container_next) {
+                    param.groupfd = group->fd;
+                    if (ioctl(vfio_kvm_device_fd, KVM_SET_DEVICE_ATTR, &attr)) {
+                        error_report("vfio: failed to setup fd %d for a group with fd %d: %s",
+                                     param.tablefd, param.groupfd,
+                                     strerror(errno));
+                        return;
+                    }
+                    trace_vfio_spapr_group_attach(param.groupfd, param.tablefd);
+                }
+            }
+        }
+#endif
     }
 
     hostwin_found = false;
hw/vfio/trace-events +1 -0
index fae096c..3d34fe8 100644
@@ -123,3 +123,4 @@ vfio_prereg_register(uint64_t va, uint64_t size, int ret) "va=0x%"PRIx64" size=0
 vfio_prereg_unregister(uint64_t va, uint64_t size, int ret) "va=0x%"PRIx64" size=0x%"PRIx64" ret=%d"
 vfio_spapr_create_window(int ps, uint64_t ws, uint64_t off) "pageshift=0x%x winsize=0x%"PRIx64" offset=0x%"PRIx64
 vfio_spapr_remove_window(uint64_t off) "offset=0x%"PRIx64
+vfio_spapr_group_attach(int groupfd, int tablefd) "Attached groupfd %d to liobn fd %d"
Signature · 1 line
2.11.0
#3 lore raw

PATCH 3/3 spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device

In reply to Alexey Kardashevskiy

In order to enable TCE operations support in KVM, we have to inform the KVM about VFIO groups being attached to specific LIOBNs; the necessary bits are implemented already by IOMMU MR and VFIO.

This defines get_attr() for the SPAPR TCE IOMMU MR which makes VFIO call the KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE ioctl and establish LIOBN-to-IOMMU link.

This changes spapr_tce_set_need_vfio() to avoid TCE table reallocation if the kernel supports the TCE acceleration.

---
 target/ppc/kvm_ppc.h |  6 ++++++
 hw/ppc/spapr_iommu.c | 19 +++++++++++++++++++
 target/ppc/kvm.c     |  7 ++++++-
 3 files changed, 31 insertions(+), 1 deletion(-)
target/ppc/kvm_ppc.h +6 -0
index ecb5549..c55bb67 100644
@@ -46,6 +46,7 @@ void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t page_shift,
 int kvmppc_remove_spapr_tce(void *table, int pfd, uint32_t window_size);
 int kvmppc_reset_htab(int shift_hint);
 uint64_t kvmppc_rma_size(uint64_t current_size, unsigned int hash_shift);
+bool kvmppc_has_cap_spapr_vfio(void);
 #endif /* !CONFIG_USER_ONLY */
 bool kvmppc_has_cap_epr(void);
 int kvmppc_define_rtas_kernel_token(uint32_t token, const char *function);
@@ -229,6 +230,11 @@ static inline bool kvmppc_is_mem_backend_page_size_ok(const char *obj_path)
     return true;
 }
 
+static inline bool kvmppc_has_cap_spapr_vfio(void)
+{
+    return false;
+}
+
 #endif /* !CONFIG_USER_ONLY */
 
 static inline bool kvmppc_has_cap_epr(void)
hw/ppc/spapr_iommu.c +19 -0
index 5ccd785..f45538c 100644
@@ -17,6 +17,7 @@
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 #include "qemu/osdep.h"
+#include <sys/ioctl.h>
 #include "qemu/error-report.h"
 #include "hw/hw.h"
 #include "qemu/log.h"
@@ -160,6 +161,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 +298,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 +661,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 = {
target/ppc/kvm.c +6 -1
index 518dd06..6faeb25 100644
@@ -133,7 +133,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
     cap_spapr_tce = kvm_check_extension(s, KVM_CAP_SPAPR_TCE);
     cap_spapr_tce_64 = kvm_check_extension(s, KVM_CAP_SPAPR_TCE_64);
     cap_spapr_multitce = kvm_check_extension(s, KVM_CAP_SPAPR_MULTITCE);
-    cap_spapr_vfio = false;
+    cap_spapr_vfio = kvm_vm_check_extension(s, KVM_CAP_SPAPR_TCE_VFIO);
     cap_one_reg = kvm_check_extension(s, KVM_CAP_ONE_REG);
     cap_hior = kvm_check_extension(s, KVM_CAP_PPC_HIOR);
     cap_epr = kvm_check_extension(s, KVM_CAP_PPC_EPR);
@@ -2456,6 +2456,11 @@ bool kvmppc_has_cap_mmu_hash_v3(void)
     return cap_mmu_hash_v3;
 }
 
+bool kvmppc_has_cap_spapr_vfio(void)
+{
+    return cap_spapr_vfio;
+}
+
 PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void)
 {
     uint32_t host_pvr = mfpvr();
Signature · 1 line
2.11.0
#4 lore raw
In reply to Alexey Kardashevskiy
This series seems to have some coding style problems. See output below for more information:

Hi,

This series seems to have some coding style problems. See output below for more information:

Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PATCH qemu 0/3] spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do

    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))

done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
3326930d99 spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device f3cd0c81b8 vfio/spapr: Use iommu memory region's get_attr() 6790f4414e memory/iommu: Add get_attr()

=== OUTPUT BEGIN ===
Checking PATCH 1/3: memory/iommu: Add get_attr()...
Checking PATCH 2/3: vfio/spapr: Use iommu memory region's get_attr()...
ERROR: line over 90 characters
#46: FILE: hw/vfio/common.c:476:
+ error_report("vfio: failed to setup fd %d for a group with fd %d: %s",

total: 1 errors, 0 warnings, 36 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

Checking PATCH 3/3: spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device... === OUTPUT END ===

Test command exited with code: 1

---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]

#5 lore raw
In reply to Alexey Kardashevskiy
Quoted 24 lines · Alexey Kardashevskiy

This is my current queue of the in-kernel TCE acceleration enablement.

Changes since https://lists.gnu.org/archive/html/qemu-devel/2017-12/msg01918.html :
* 3 patches instead of one, one per maintainership area;
* added memory_region_iommu_get_attr();
* removed set_attr() as there is no use for it now;
* folded the chunk in vfio_listener_region_add() under VFIO_SPAPR_TCE_v2_IOMMU branch as the acceleration is only
enabled when DMA memory is preregistered and this is only supported
by the v2 IOMMU.

This is based on sha1
ad59cde Cédric Le Goater "target/ppc: more use of the PPC_*() macros".

Please comment. Thanks.

Alexey Kardashevskiy (3):
memory/iommu: Add get_attr()
vfio/spapr: Use iommu memory region's get_attr() spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device

Quoted 9 lines
 include/exec/memory.h | 22 ++++++++++++++++++++++
 target/ppc/kvm_ppc.h  |  6 ++++++
 hw/ppc/spapr_iommu.c  | 19 +++++++++++++++++++
 hw/vfio/common.c      | 26 ++++++++++++++++++++++++++
 memory.c              | 13 +++++++++++++
 target/ppc/kvm.c      |  7 ++++++-
 hw/vfio/trace-events  |  1 +
 7 files changed, 93 insertions(+), 1 deletion(-)

Alex, if this is okay for you, please pick it up yourself.

Thanks,

Paolo

#6 lore raw
Quoted 35 lines · Paolo Bonzini
Quoted 24 lines · Alexey Kardashevskiy

This is my current queue of the in-kernel TCE acceleration enablement.

Changes since https://lists.gnu.org/archive/html/qemu-devel/2017-12/msg01918.html :
* 3 patches instead of one, one per maintainership area;
* added memory_region_iommu_get_attr();
* removed set_attr() as there is no use for it now;
* folded the chunk in vfio_listener_region_add() under VFIO_SPAPR_TCE_v2_IOMMU branch as the acceleration is only
enabled when DMA memory is preregistered and this is only supported
by the v2 IOMMU.

This is based on sha1
ad59cde Cédric Le Goater "target/ppc: more use of the PPC_*() macros".

Please comment. Thanks.

Alexey Kardashevskiy (3):
memory/iommu: Add get_attr()
vfio/spapr: Use iommu memory region's get_attr() spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device

Quoted 9 lines
 include/exec/memory.h | 22 ++++++++++++++++++++++
 target/ppc/kvm_ppc.h  |  6 ++++++
 hw/ppc/spapr_iommu.c  | 19 +++++++++++++++++++
 hw/vfio/common.c      | 26 ++++++++++++++++++++++++++
 memory.c              | 13 +++++++++++++
 target/ppc/kvm.c      |  7 ++++++-
 hw/vfio/trace-events  |  1 +
 7 files changed, 93 insertions(+), 1 deletion(-)
Quoted 1 line

Alex, if this is okay for you, please pick it up yourself.

Alex, ping?

Quoted 5 lines

Thanks,

Paolo

Signature · 1 line
Alexey
#7 lore raw
Quoted 36 lines · On Mon, 15 Jan 2018 15:12:07 +1100 Alexey Kardashevskiy <[email protected]> wrote:
Quoted 35 lines · Paolo Bonzini
Quoted 33 lines · Alexey Kardashevskiy

This is my current queue of the in-kernel TCE acceleration enablement.

Changes since https://lists.gnu.org/archive/html/qemu-devel/2017-12/msg01918.html :
* 3 patches instead of one, one per maintainership area;
* added memory_region_iommu_get_attr();
* removed set_attr() as there is no use for it now;
* folded the chunk in vfio_listener_region_add() under VFIO_SPAPR_TCE_v2_IOMMU branch as the acceleration is only
enabled when DMA memory is preregistered and this is only supported
by the v2 IOMMU.

This is based on sha1
ad59cde Cédric Le Goater "target/ppc: more use of the PPC_*() macros".

Please comment. Thanks.

Alexey Kardashevskiy (3):
memory/iommu: Add get_attr()
vfio/spapr: Use iommu memory region's get_attr() spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device

 include/exec/memory.h | 22 ++++++++++++++++++++++
 target/ppc/kvm_ppc.h  |  6 ++++++
 hw/ppc/spapr_iommu.c  | 19 +++++++++++++++++++
 hw/vfio/common.c      | 26 ++++++++++++++++++++++++++
 memory.c              | 13 +++++++++++++
 target/ppc/kvm.c      |  7 ++++++-
 hw/vfio/trace-events  |  1 +
 7 files changed, 93 insertions(+), 1 deletion(-)
Quoted 3 lines
Quoted 1 line

Alex, if this is okay for you, please pick it up yourself.

Alex, ping?

Yeah, I'll pick these up. Paolo, do you want to throw an explicit Ack for the first patch? David, R-b/A-b? Thanks,

Alex

#8 lore raw
Quoted 39 lines · Alex Williamson
Quoted 36 lines · On Mon, 15 Jan 2018 15:12:07 +1100 Alexey Kardashevskiy <[email protected]> wrote:
Quoted 35 lines · Paolo Bonzini
Quoted 33 lines · Alexey Kardashevskiy

This is my current queue of the in-kernel TCE acceleration enablement.

Changes since https://lists.gnu.org/archive/html/qemu-devel/2017-12/msg01918.html :
* 3 patches instead of one, one per maintainership area;
* added memory_region_iommu_get_attr();
* removed set_attr() as there is no use for it now;
* folded the chunk in vfio_listener_region_add() under VFIO_SPAPR_TCE_v2_IOMMU branch as the acceleration is only
enabled when DMA memory is preregistered and this is only supported
by the v2 IOMMU.

This is based on sha1
ad59cde Cédric Le Goater "target/ppc: more use of the PPC_*() macros".

Please comment. Thanks.

Alexey Kardashevskiy (3):
memory/iommu: Add get_attr()
vfio/spapr: Use iommu memory region's get_attr() spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device

 include/exec/memory.h | 22 ++++++++++++++++++++++
 target/ppc/kvm_ppc.h  |  6 ++++++
 hw/ppc/spapr_iommu.c  | 19 +++++++++++++++++++
 hw/vfio/common.c      | 26 ++++++++++++++++++++++++++
 memory.c              | 13 +++++++++++++
 target/ppc/kvm.c      |  7 ++++++-
 hw/vfio/trace-events  |  1 +
 7 files changed, 93 insertions(+), 1 deletion(-)
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Alex, if this is okay for you, please pick it up yourself.

Alex, ping?

Yeah, I'll pick these up. Paolo, do you want to throw an explicit Ack for the first patch? David, R-b/A-b? Thanks,

Sorry, I've been so buried in bugs that performance improvements just haven't made my radar to look at.

From my first look these look workable, though somewhat uglier than necessary.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
Acked-by
#9 lore raw
In reply to Alex Williamson
Quoted 39 lines · Alex Williamson
Quoted 36 lines · On Mon, 15 Jan 2018 15:12:07 +1100 Alexey Kardashevskiy <[email protected]> wrote:
Quoted 35 lines · Paolo Bonzini
Quoted 33 lines · Alexey Kardashevskiy

This is my current queue of the in-kernel TCE acceleration enablement.

Changes since https://lists.gnu.org/archive/html/qemu-devel/2017-12/msg01918.html :
* 3 patches instead of one, one per maintainership area;
* added memory_region_iommu_get_attr();
* removed set_attr() as there is no use for it now;
* folded the chunk in vfio_listener_region_add() under VFIO_SPAPR_TCE_v2_IOMMU branch as the acceleration is only
enabled when DMA memory is preregistered and this is only supported
by the v2 IOMMU.

This is based on sha1
ad59cde Cédric Le Goater "target/ppc: more use of the PPC_*() macros".

Please comment. Thanks.

Alexey Kardashevskiy (3):
memory/iommu: Add get_attr()
vfio/spapr: Use iommu memory region's get_attr() spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device

 include/exec/memory.h | 22 ++++++++++++++++++++++
 target/ppc/kvm_ppc.h  |  6 ++++++
 hw/ppc/spapr_iommu.c  | 19 +++++++++++++++++++
 hw/vfio/common.c      | 26 ++++++++++++++++++++++++++
 memory.c              | 13 +++++++++++++
 target/ppc/kvm.c      |  7 ++++++-
 hw/vfio/trace-events  |  1 +
 7 files changed, 93 insertions(+), 1 deletion(-)
Quoted 9 lines
Quoted 3 lines
Quoted 1 line

Alex, if this is okay for you, please pick it up yourself.

Alex, ping?

Yeah, I'll pick these up. Paolo, do you want to throw an explicit Ack for the first patch? David, R-b/A-b? Thanks,

Alex

Acked-by
#10 lore raw
Quoted 42 lines · Paolo Bonzini
Quoted 41 lines · Alex Williamson
Quoted 38 lines · On Mon, 15 Jan 2018 15:12:07 +1100 Alexey Kardashevskiy <[email protected]> wrote:
Quoted 36 lines · Paolo Bonzini
Quoted 24 lines · Alexey Kardashevskiy

This is my current queue of the in-kernel TCE acceleration enablement.

Changes since https://lists.gnu.org/archive/html/qemu-devel/2017-12/msg01918.html :
* 3 patches instead of one, one per maintainership area;
* added memory_region_iommu_get_attr();
* removed set_attr() as there is no use for it now;
* folded the chunk in vfio_listener_region_add() under VFIO_SPAPR_TCE_v2_IOMMU branch as the acceleration is only
enabled when DMA memory is preregistered and this is only supported
by the v2 IOMMU.

This is based on sha1
ad59cde Cédric Le Goater "target/ppc: more use of the PPC_*() macros".

Please comment. Thanks.

Alexey Kardashevskiy (3):
memory/iommu: Add get_attr()
vfio/spapr: Use iommu memory region's get_attr() spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device

Quoted 9 lines
 include/exec/memory.h | 22 ++++++++++++++++++++++
 target/ppc/kvm_ppc.h  |  6 ++++++
 hw/ppc/spapr_iommu.c  | 19 +++++++++++++++++++
 hw/vfio/common.c      | 26 ++++++++++++++++++++++++++
 memory.c              | 13 +++++++++++++
 target/ppc/kvm.c      |  7 ++++++-
 hw/vfio/trace-events  |  1 +
 7 files changed, 93 insertions(+), 1 deletion(-)

Alex, if this is okay for you, please pick it up yourself.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Alex, ping?

Yeah, I'll pick these up. Paolo, do you want to throw an explicit Ack for the first patch? David, R-b/A-b? Thanks,

Alex

I don't love the interface, I preferred some of the things Paolo suggested in the earlier thread. Still, it's something Paolo and Alex seem to have agreed on, and it's not exposed to user or guest, so it's fixable later. So,

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson