> From: Paolo Bonzini <pbonzini@xxxxxxxxxx> > Sent: Saturday, June 5, 2021 2:22 PM > > On 04/06/21 19:22, Jason Gunthorpe wrote: > > 4) The KVM interface is the very simple enable/disable WBINVD. > > Possessing a FD that can do IOMMU_EXECUTE_WBINVD is required > > to enable WBINVD at KVM. > > The KVM interface is the same kvm-vfio device that exists already. The > userspace API does not need to change at all: adding one VFIO file > descriptor with WBINVD enabled to the kvm-vfio device lets the VM use > WBINVD functionality (see kvm_vfio_update_coherency). > > Alternatively you can add a KVM_DEV_IOASID_{ADD,DEL} pair of ioctls. > But it seems useless complication compared to just using what we have > now, at least while VMs only use IOASIDs via VFIO. > A new IOASID variation may make more sense in case non-vfio subsystems want to handle similar coherency problem. Per other discussions looks it's still an open whether vDPA wants it or not. and there could be other passthrough frameworks in the future. Having them all use vfio-naming sounds not very clean. Anyway the coherency attribute must be configured on IOASID in the end, then it looks reasonable for KVM to learn the info from an unified place. Just FYI we are also planning new IOASID-specific ioctl in KVM for other usages. Future Intel platforms support a new ENQCMD instruction for scalable work submission to the device. This instruction includes a 64- bytes payload plus a PASID retrieved from a CPU MSR register (covered by xsave). When supporting this instruction in the guest, the value in the MSR is a guest PASID which must be translated to a host PASID. A new VMCS structure (PASID translation table) is introduced for this purpose. In this /dev/ioasid proposal, we propose VFIO_{UN}MAP_ IOASID for user to update the VMCS structure properly. The user is expected to provide {ioasid_fd, ioasid, vPASID} to KVM which then calls ioasid helper function to figure out the corresponding hPASID to update the specified entry. Thanks Kevin