[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH qemu] RFC: spapr/iommu: Enable in-kernel TCE acc
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH qemu] RFC: spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device |
Date: |
Tue, 19 Dec 2017 12:12:35 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 |
On 12/12/2017 06:46, Alex Williamson wrote:
>> +enum IOMMUMemoryRegionAttr {
>> + IOMMU_ATTR_KVM_FD
>
> You're generalizing the wrong thing here, this is specifically a
> SPAPR_TCE_FD, call it that.
... and you're not even implementing set_attr, so let's drop it.
My suggestion is to add a function in hw/vfio:
int vfio_container_attach_kvm_spapr_tce(VFIOContainer *cont,
int tablefd);
and an IOMMUMemoryRegionClass member:
int (*set_vfio_container_attrs)(IOMMUMemoryRegion *iommu,
VFIOContainer *cont)
Then your implementation for the latter is as simple as this:
if (!kvm_enabled() || !kvmppc_has_cap_spapr_vfio()) {
sPAPRTCETable *tcet = container_of(iommu, sPAPRTCETable, iommu);
return vfio_container_attach_kvm_spapr_tce(cont, tcet->fd);
}
Thanks,
Paolo
>> +};
>> +
>> typedef struct IOMMUMemoryRegionClass {
>> /* private */
>> struct DeviceClass parent_class;
>> @@ -210,6 +214,12 @@ typedef struct IOMMUMemoryRegionClass {
>> IOMMUNotifierFlag new_flags);
>> /* Set this up to provide customized IOMMU replay function */
>> void (*replay)(IOMMUMemoryRegion *iommu, IOMMUNotifier *notifier);
>> +
>> + /* Get/set IOMMU misc attributes */
>> + int (*get_attr)(IOMMUMemoryRegion *iommu, enum IOMMUMemoryRegionAttr,
>> + void *data);
>> + int (*set_attr)(IOMMUMemoryRegion *iommu, enum IOMMUMemoryRegionAttr,
>> + void *data);
- [Qemu-devel] [PATCH qemu] RFC: spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device, Alexey Kardashevskiy, 2017/12/12
- Re: [Qemu-devel] [PATCH qemu] RFC: spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device, Alex Williamson, 2017/12/12
- Re: [Qemu-devel] [PATCH qemu] RFC: spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device,
Paolo Bonzini <=
- Re: [Qemu-devel] [PATCH qemu] RFC: spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device, Alex Williamson, 2017/12/19
- Re: [Qemu-devel] [PATCH qemu] RFC: spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device, Paolo Bonzini, 2017/12/19
- Re: [Qemu-devel] [PATCH qemu] RFC: spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device, Alexey Kardashevskiy, 2017/12/19
- Re: [Qemu-devel] [PATCH qemu] RFC: spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device, Paolo Bonzini, 2017/12/20
- Re: [Qemu-devel] [PATCH qemu] RFC: spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device, Alexey Kardashevskiy, 2017/12/20
- Re: [Qemu-devel] [PATCH qemu] RFC: spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device, Paolo Bonzini, 2017/12/20