Re: [PATCH 3/5] hyperv/IOMMU: Enable swiotlb bounce buffer for Isolation VM
On 11/26/2021 3:40 PM, Christoph Hellwig wrote: On Wed, Nov 17, 2021 at 10:00:08PM +0800, Tianyu Lan wrote: On 11/17/2021 6:01 PM, Christoph Hellwig wrote: This doesn't really have much to do with normal DMA mapping, so why does this direct through the dma ops? According to the previous discussion, dma_alloc_noncontigous() and dma_vmap_noncontiguous() may be used to handle the noncontigous memory alloc/map in the netvsc driver. So add alloc/free and vmap/vunmap callbacks here to handle the case. The previous patch v4 & v5 handles the allocation and map in the netvsc driver. If this should not go though dma ops, We also may make it as vmbus specific function and keep the function in the vmbus driver. But that only makes sense if they can actually use the normal DMA ops. If you implement your own incomplete ops and require to use them you do nothing but adding indirect calls to your fast path and making the code convoluted. Because the generic part implementation can't meet the netvsc driver requests that allocate 16M memory and map pages via vmap_pfn(). So add Hyperv alloc_noncontiguous and vmap_noncontiguous callbacks. If this is not a right way. we should call these hyper-V functions in the netvsc driver directly, right? Could you have a look at Michael summary about this series we made and give some guides? https://www.mail-archive.com/xen-devel@lists.xenproject.org/msg109284.html Thanks. ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
Re: [PATCH 3/5] hyperv/IOMMU: Enable swiotlb bounce buffer for Isolation VM
On Wed, Nov 17, 2021 at 10:00:08PM +0800, Tianyu Lan wrote: > On 11/17/2021 6:01 PM, Christoph Hellwig wrote: >> This doesn't really have much to do with normal DMA mapping, >> so why does this direct through the dma ops? >> > > According to the previous discussion, dma_alloc_noncontigous() > and dma_vmap_noncontiguous() may be used to handle the noncontigous > memory alloc/map in the netvsc driver. So add alloc/free and vmap/vunmap > callbacks here to handle the case. The previous patch v4 & v5 handles > the allocation and map in the netvsc driver. If this should not go though > dma ops, We also may make it as vmbus specific function and keep > the function in the vmbus driver. But that only makes sense if they can actually use the normal DMA ops. If you implement your own incomplete ops and require to use them you do nothing but adding indirect calls to your fast path and making the code convoluted. ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
Re: [PATCH 3/5] hyperv/IOMMU: Enable swiotlb bounce buffer for Isolation VM
On 11/17/2021 10:00 PM, Tianyu Lan wrote: On 11/17/2021 6:01 PM, Christoph Hellwig wrote: This doesn't really have much to do with normal DMA mapping, so why does this direct through the dma ops? According to the previous discussion, dma_alloc_noncontigous() and dma_vmap_noncontiguous() may be used to handle the noncontigous memory alloc/map in the netvsc driver. So add alloc/free and vmap/vunmap callbacks here to handle the case. The previous patch v4 & v5 handles the allocation and map in the netvsc driver. If this should not go though dma ops, We also may make it as vmbus specific function and keep the function in the vmbus driver. https://lkml.org/lkml/2021/9/28/51 Hi Christoph: Sorry to bother you. Could you have a look? Which solution do you prefer? If we need to call dma_alloc/map_noncontigous() function in the netvsc driver what patch 4 does. The Hyper-V specific implementation needs to be hided in some callbacks and call these callback in the dma_alloc/map_noncontigous(). I used dma ops here. If the allocation and map operation should be Hyper-V specific function, we may put these functions in the vmbus driver and other vmbus device drivers also may reuse these functions if necessary. Thanks. ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
Re: [PATCH 3/5] hyperv/IOMMU: Enable swiotlb bounce buffer for Isolation VM
On 11/17/2021 6:01 PM, Christoph Hellwig wrote: This doesn't really have much to do with normal DMA mapping, so why does this direct through the dma ops? According to the previous discussion, dma_alloc_noncontigous() and dma_vmap_noncontiguous() may be used to handle the noncontigous memory alloc/map in the netvsc driver. So add alloc/free and vmap/vunmap callbacks here to handle the case. The previous patch v4 & v5 handles the allocation and map in the netvsc driver. If this should not go though dma ops, We also may make it as vmbus specific function and keep the function in the vmbus driver. https://lkml.org/lkml/2021/9/28/51 ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
Re: [PATCH 3/5] hyperv/IOMMU: Enable swiotlb bounce buffer for Isolation VM
On 11/17/2021 3:12 AM, Borislav Petkov wrote: What you should do, instead, is add an isol. VM specific hv_cc_platform_has() just like amd_cc_platform_has() and handle the cc_attrs there for your platform, like return false for CC_ATTR_GUEST_MEM_ENCRYPT and then you won't need to add that hv_* thing everywhere. And then fix it up in __set_memory_enc_dec() too. Yes, agree. Will add hv cc_attrs and check via cc_platform_has(). ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
Re: [PATCH 3/5] hyperv/IOMMU: Enable swiotlb bounce buffer for Isolation VM
This doesn't really have much to do with normal DMA mapping, so why does this direct through the dma ops? ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu