Re: AMD SME encrpytion and PCI BAR pages to user space

2020-10-27 Thread Jason Gunthorpe
On Tue, Oct 27, 2020 at 08:43:57AM +, Christoph Hellwig wrote: > On Wed, Oct 21, 2020 at 01:03:22PM -0300, Jason Gunthorpe wrote: > > Oh, interesting.. Yes the issue is no userspace DMA stuff uses the DMA > > API correctly (because it is in userspace) > > > > So SWIOTLB tricks don't work, I wi

Re: AMD SME encrpytion and PCI BAR pages to user space

2020-10-27 Thread Christoph Hellwig
On Wed, Oct 21, 2020 at 01:03:22PM -0300, Jason Gunthorpe wrote: > Oh, interesting.. Yes the issue is no userspace DMA stuff uses the DMA > API correctly (because it is in userspace) > > So SWIOTLB tricks don't work, I wish the dma_map could fail for these > situations Userspace DMA by definition

Re: AMD SME encrpytion and PCI BAR pages to user space

2020-10-21 Thread Jason Gunthorpe
On Wed, Oct 21, 2020 at 10:30:23AM -0500, Tom Lendacky wrote: > On 10/21/20 6:59 AM, Jason Gunthorpe wrote: > > On Mon, Oct 19, 2020 at 11:36:16AM -0500, Tom Lendacky wrote: > > > >>> io_remap_pfn_range()? Is there use cases where a caller actually wants > >>> encrypted io memory? > >> > >> As lon

Re: AMD SME encrpytion and PCI BAR pages to user space

2020-10-21 Thread Tom Lendacky
On 10/21/20 6:59 AM, Jason Gunthorpe wrote: > On Mon, Oct 19, 2020 at 11:36:16AM -0500, Tom Lendacky wrote: > >>> io_remap_pfn_range()? Is there use cases where a caller actually wants >>> encrypted io memory? >> >> As long as you never have physical memory / ram being mapped in this path, >> it s

Re: AMD SME encrpytion and PCI BAR pages to user space

2020-10-21 Thread Jason Gunthorpe
On Mon, Oct 19, 2020 at 11:36:16AM -0500, Tom Lendacky wrote: > > io_remap_pfn_range()? Is there use cases where a caller actually wants > > encrypted io memory? > > As long as you never have physical memory / ram being mapped in this path, > it seems that applying pgprot_decrypted() would be ok.

Re: AMD SME encrpytion and PCI BAR pages to user space

2020-10-19 Thread Jason Gunthorpe
On Mon, Oct 19, 2020 at 12:11:36PM -0500, Tom Lendacky wrote: > > Hum, I assume it is broken also. Actually quite a swath of drivers > > and devices will be broken under this :\ > > Not sure what you mean by the last statement - in general or when running > under VFIO/DPDK? In general, traditiona

Re: AMD SME encrpytion and PCI BAR pages to user space

2020-10-19 Thread Tom Lendacky
On 10/19/20 12:00 PM, Jason Gunthorpe wrote: > On Mon, Oct 19, 2020 at 11:36:16AM -0500, Tom Lendacky wrote: > >>> Is RDMA missing something? I don't see anything special in VFIO for >>> instance and the two are very similar - does VFIO work with SME, eg >>> DPDK or something unrelated to virtuali

Re: AMD SME encrpytion and PCI BAR pages to user space

2020-10-19 Thread Jason Gunthorpe
On Mon, Oct 19, 2020 at 11:36:16AM -0500, Tom Lendacky wrote: > > Is RDMA missing something? I don't see anything special in VFIO for > > instance and the two are very similar - does VFIO work with SME, eg > > DPDK or something unrelated to virtualization? > > If user space is mapping un-encrypte

Re: AMD SME encrpytion and PCI BAR pages to user space

2020-10-19 Thread Tom Lendacky
On 10/19/20 10:25 AM, Jason Gunthorpe wrote: > Hi Tom, Hi Jason, > > We've found a bug where systems that have the AMD SME turned on are > not able to run RDMA work loads. It seems the kernel is automatically > encrypting VMA's pointing at PCI BAR memory created by > io_remap_pfn_range() - addin