qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH qemu 0/3] spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device
@ 2018-01-02  5:28 Alexey Kardashevskiy
  2018-01-02  5:28 ` [Qemu-devel] [PATCH qemu 1/3] memory/iommu: Add get_attr() Alexey Kardashevskiy
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Alexey Kardashevskiy @ 2018-01-02  5:28 UTC (permalink / raw)
  To: qemu-devel
  Cc: Alexey Kardashevskiy, qemu-ppc, David Gibson, Alex Williamson,
	Paolo Bonzini

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

-- 
2.11.0

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

* [Qemu-devel] [PATCH qemu 1/3] memory/iommu: Add get_attr()
  2018-01-02  5:28 [Qemu-devel] [PATCH qemu 0/3] spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device Alexey Kardashevskiy
@ 2018-01-02  5:28 ` Alexey Kardashevskiy
  2018-01-02  5:28 ` [Qemu-devel] [PATCH qemu 2/3] vfio/spapr: Use iommu memory region's get_attr() Alexey Kardashevskiy
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Alexey Kardashevskiy @ 2018-01-02  5:28 UTC (permalink / raw)
  To: qemu-devel
  Cc: Alexey Kardashevskiy, qemu-ppc, David Gibson, Alex Williamson,
	Paolo Bonzini

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.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 include/exec/memory.h | 22 ++++++++++++++++++++++
 memory.c              | 13 +++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/include/exec/memory.h b/include/exec/memory.h
index a4cabdf..e1e0a8e 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -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.
diff --git a/memory.c b/memory.c
index 4b41fb8..39ab25a 100644
--- a/memory.c
+++ b/memory.c
@@ -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;
-- 
2.11.0

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

* [Qemu-devel] [PATCH qemu 2/3] vfio/spapr: Use iommu memory region's get_attr()
  2018-01-02  5:28 [Qemu-devel] [PATCH qemu 0/3] spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device Alexey Kardashevskiy
  2018-01-02  5:28 ` [Qemu-devel] [PATCH qemu 1/3] memory/iommu: Add get_attr() Alexey Kardashevskiy
@ 2018-01-02  5:28 ` Alexey Kardashevskiy
  2018-01-02  5:28 ` [Qemu-devel] [PATCH qemu 3/3] spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device Alexey Kardashevskiy
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Alexey Kardashevskiy @ 2018-01-02  5:28 UTC (permalink / raw)
  To: qemu-devel
  Cc: Alexey Kardashevskiy, qemu-ppc, David Gibson, Alex Williamson,
	Paolo Bonzini

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.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 hw/vfio/common.c     | 26 ++++++++++++++++++++++++++
 hw/vfio/trace-events |  1 +
 2 files changed, 27 insertions(+)

diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index b77be3a..ebe28fe 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -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;
diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events
index fae096c..3d34fe8 100644
--- a/hw/vfio/trace-events
+++ b/hw/vfio/trace-events
@@ -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"
-- 
2.11.0

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

* [Qemu-devel] [PATCH qemu 3/3] spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device
  2018-01-02  5:28 [Qemu-devel] [PATCH qemu 0/3] spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device Alexey Kardashevskiy
  2018-01-02  5:28 ` [Qemu-devel] [PATCH qemu 1/3] memory/iommu: Add get_attr() Alexey Kardashevskiy
  2018-01-02  5:28 ` [Qemu-devel] [PATCH qemu 2/3] vfio/spapr: Use iommu memory region's get_attr() Alexey Kardashevskiy
@ 2018-01-02  5:28 ` Alexey Kardashevskiy
  2018-01-02  5:50 ` [Qemu-devel] [PATCH qemu 0/3] " no-reply
  2018-01-02 17:51 ` Paolo Bonzini
  4 siblings, 0 replies; 11+ messages in thread
From: Alexey Kardashevskiy @ 2018-01-02  5:28 UTC (permalink / raw)
  To: qemu-devel
  Cc: Alexey Kardashevskiy, qemu-ppc, David Gibson, Alex Williamson,
	Paolo Bonzini

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.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 target/ppc/kvm_ppc.h |  6 ++++++
 hw/ppc/spapr_iommu.c | 19 +++++++++++++++++++
 target/ppc/kvm.c     |  7 ++++++-
 3 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/target/ppc/kvm_ppc.h b/target/ppc/kvm_ppc.h
index ecb5549..c55bb67 100644
--- a/target/ppc/kvm_ppc.h
+++ b/target/ppc/kvm_ppc.h
@@ -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)
diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c
index 5ccd785..f45538c 100644
--- a/hw/ppc/spapr_iommu.c
+++ b/hw/ppc/spapr_iommu.c
@@ -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 = {
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index 518dd06..6faeb25 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -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();
-- 
2.11.0

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

* Re: [Qemu-devel] [PATCH qemu 0/3] spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device
  2018-01-02  5:28 [Qemu-devel] [PATCH qemu 0/3] spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device Alexey Kardashevskiy
                   ` (2 preceding siblings ...)
  2018-01-02  5:28 ` [Qemu-devel] [PATCH qemu 3/3] spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device Alexey Kardashevskiy
@ 2018-01-02  5:50 ` no-reply
  2018-01-02 17:51 ` Paolo Bonzini
  4 siblings, 0 replies; 11+ messages in thread
From: no-reply @ 2018-01-02  5:50 UTC (permalink / raw)
  To: aik; +Cc: famz, qemu-devel, pbonzini, alex.williamson, qemu-ppc, david

Hi,

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

Type: series
Message-id: 20180102052805.20498-1-aik@ozlabs.ru
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 patchew-devel@freelists.org

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

* Re: [Qemu-devel] [PATCH qemu 0/3] spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device
  2018-01-02  5:28 [Qemu-devel] [PATCH qemu 0/3] spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device Alexey Kardashevskiy
                   ` (3 preceding siblings ...)
  2018-01-02  5:50 ` [Qemu-devel] [PATCH qemu 0/3] " no-reply
@ 2018-01-02 17:51 ` Paolo Bonzini
  2018-01-15  4:12   ` Alexey Kardashevskiy
  4 siblings, 1 reply; 11+ messages in thread
From: Paolo Bonzini @ 2018-01-02 17:51 UTC (permalink / raw)
  To: Alexey Kardashevskiy, qemu-devel; +Cc: qemu-ppc, David Gibson, Alex Williamson

On 02/01/2018 06:28, Alexey Kardashevskiy wrote:
> 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(-)
> 

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

Thanks,

Paolo

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

* Re: [Qemu-devel] [PATCH qemu 0/3] spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device
  2018-01-02 17:51 ` Paolo Bonzini
@ 2018-01-15  4:12   ` Alexey Kardashevskiy
  2018-01-16 20:46     ` Alex Williamson
  0 siblings, 1 reply; 11+ messages in thread
From: Alexey Kardashevskiy @ 2018-01-15  4:12 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: qemu-ppc, David Gibson, Alex Williamson

On 03/01/18 04:51, Paolo Bonzini wrote:
> On 02/01/2018 06:28, Alexey Kardashevskiy wrote:
>> 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(-)
>>
> 
> Alex, if this is okay for you, please pick it up yourself.

Alex, ping?


> 
> Thanks,
> 
> Paolo
> 


-- 
Alexey

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

* Re: [Qemu-devel] [PATCH qemu 0/3] spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device
  2018-01-15  4:12   ` Alexey Kardashevskiy
@ 2018-01-16 20:46     ` Alex Williamson
  2018-01-18  5:48       ` David Gibson
  2018-01-18  8:13       ` Paolo Bonzini
  0 siblings, 2 replies; 11+ messages in thread
From: Alex Williamson @ 2018-01-16 20:46 UTC (permalink / raw)
  To: Alexey Kardashevskiy; +Cc: Paolo Bonzini, qemu-devel, qemu-ppc, David Gibson

On Mon, 15 Jan 2018 15:12:07 +1100
Alexey Kardashevskiy <aik@ozlabs.ru> wrote:

> On 03/01/18 04:51, Paolo Bonzini wrote:
> > On 02/01/2018 06:28, Alexey Kardashevskiy wrote:  
> >> 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(-)
> >>  
> > 
> > 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

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

* Re: [Qemu-devel] [PATCH qemu 0/3] spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device
  2018-01-16 20:46     ` Alex Williamson
@ 2018-01-18  5:48       ` David Gibson
  2018-01-18  8:13       ` Paolo Bonzini
  1 sibling, 0 replies; 11+ messages in thread
From: David Gibson @ 2018-01-18  5:48 UTC (permalink / raw)
  To: Alex Williamson; +Cc: Alexey Kardashevskiy, Paolo Bonzini, qemu-devel, qemu-ppc

[-- Attachment #1: Type: text/plain, Size: 2282 bytes --]

On Tue, Jan 16, 2018 at 01:46:14PM -0700, Alex Williamson wrote:
> On Mon, 15 Jan 2018 15:12:07 +1100
> Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
> 
> > On 03/01/18 04:51, Paolo Bonzini wrote:
> > > On 02/01/2018 06:28, Alexey Kardashevskiy wrote:  
> > >> 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(-)
> > >>  
> > > 
> > > 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.

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [Qemu-devel] [PATCH qemu 0/3] spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device
  2018-01-16 20:46     ` Alex Williamson
  2018-01-18  5:48       ` David Gibson
@ 2018-01-18  8:13       ` Paolo Bonzini
  2018-01-19  4:51         ` David Gibson
  1 sibling, 1 reply; 11+ messages in thread
From: Paolo Bonzini @ 2018-01-18  8:13 UTC (permalink / raw)
  To: Alex Williamson, Alexey Kardashevskiy; +Cc: qemu-devel, qemu-ppc, David Gibson

On 16/01/2018 21:46, Alex Williamson wrote:
> On Mon, 15 Jan 2018 15:12:07 +1100
> Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
> 
>> On 03/01/18 04:51, Paolo Bonzini wrote:
>>> On 02/01/2018 06:28, Alexey Kardashevskiy wrote:  
>>>> 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(-)
>>>>  
>>>
>>> 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: Paolo Bonzini <pbonzini@redhat.com>

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

* Re: [Qemu-devel] [PATCH qemu 0/3] spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device
  2018-01-18  8:13       ` Paolo Bonzini
@ 2018-01-19  4:51         ` David Gibson
  0 siblings, 0 replies; 11+ messages in thread
From: David Gibson @ 2018-01-19  4:51 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Alex Williamson, Alexey Kardashevskiy, qemu-devel, qemu-ppc

[-- Attachment #1: Type: text/plain, Size: 2507 bytes --]

On Thu, Jan 18, 2018 at 09:13:34AM +0100, Paolo Bonzini wrote:
> On 16/01/2018 21:46, Alex Williamson wrote:
> > On Mon, 15 Jan 2018 15:12:07 +1100
> > Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
> > 
> >> On 03/01/18 04:51, Paolo Bonzini wrote:
> >>> On 02/01/2018 06:28, Alexey Kardashevskiy wrote:  
> >>>> 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(-)
> >>>>  
> >>>
> >>> 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: Paolo Bonzini <pbonzini@redhat.com>

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,

Acked-by: David Gibson <david@gibson.dropbear.id.au>

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2018-01-19  4:51 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-02  5:28 [Qemu-devel] [PATCH qemu 0/3] spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device Alexey Kardashevskiy
2018-01-02  5:28 ` [Qemu-devel] [PATCH qemu 1/3] memory/iommu: Add get_attr() Alexey Kardashevskiy
2018-01-02  5:28 ` [Qemu-devel] [PATCH qemu 2/3] vfio/spapr: Use iommu memory region's get_attr() Alexey Kardashevskiy
2018-01-02  5:28 ` [Qemu-devel] [PATCH qemu 3/3] spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device Alexey Kardashevskiy
2018-01-02  5:50 ` [Qemu-devel] [PATCH qemu 0/3] " no-reply
2018-01-02 17:51 ` Paolo Bonzini
2018-01-15  4:12   ` Alexey Kardashevskiy
2018-01-16 20:46     ` Alex Williamson
2018-01-18  5:48       ` David Gibson
2018-01-18  8:13       ` Paolo Bonzini
2018-01-19  4:51         ` David Gibson

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