Messages in this thread | | | From | "Tian, Kevin" <> | Subject | RE: [PATCH v1 14/14] iommu/arm-smmu-v3: Add arm_smmu_cache_invalidate_user | Date | Fri, 31 Mar 2023 08:09:51 +0000 |
| |
> From: Jason Gunthorpe <jgg@nvidia.com> > Sent: Tuesday, March 28, 2023 8:27 PM > > On Tue, Mar 28, 2023 at 02:48:31AM +0000, Tian, Kevin wrote: > > > But emulated vIOMMUs are typically MMIO-based ring structure > > which requires 1) kvm provides a synchronous ioeventfd for MMIO > > based head/tail emulation; 2) userspace vIOMMU shares its virtual > > register page with the kernel which can then update virtual tail/head > > registers w/o exiting to the userspace; 3) the kernel thread can > > selectively exit to userspace for cmds which it cannot directly handle. > > What is needed is for the kvm side to capture the store execute it to > some backing memory, and also trigger the eventfd. > > It shouldn't need to be synchronous.
Correct
> > For SMMU the interface is layed out with unique 4k pages per-CMDQ that > contains the 3 relevant 8 byte values.
VT-d has only one invalidation queue with relevant registers mixed with other VT-d registers in 4k page. But this should be fine as long as the new mechanism allows specifying which offsets in mapped page fall into the fast path.
> > So we could mmap a page from the kernel that has the 3 values. qemu > would install the page in the kvm memory map and it would > arrange things so that stores reach the 8 bytes and trigger an > eventfd. > > Kernel simply reads the cons index after the eventfd, looks in the > IOAS to get the queue memory and does the operation async. > > It is not especially conceptually difficult.. >
Looks so, at least in concept.
btw regarding to the initial nesting support on smmu do you want to follow this unique 4k layout plus native cmdq format or just the latter (i.e. cmd format is native but head/tail/start is defined in a sw customized way)?
If the latter I wonder whether it's necessary to generalize it so the batching format is vendor-agnostic while the specific cmd/ descriptor format is vendor specific.
Thanks Kevin
| |