Re: [PATCH] dma-direct: fix DMA_ATTR_NO_KERNEL_MAPPING

2021-11-01 Thread Christoph Hellwig
On Tue, Nov 02, 2021 at 11:21:16AM +0800, Walter Wu wrote: > Our platform is arch64. We need a dynamic allocated buffer from CMA is > not to read by CPU peculative execution, so we need to remove its > kernel mapping. If your CPU speculates into unused kernel direct mappings your have a worse prob

Re: [PATCH] dma-direct: fix DMA_ATTR_NO_KERNEL_MAPPING

2021-11-01 Thread Christoph Hellwig
As others pointed out, DMA_ATTR_NO_KERNEL_MAPPING just means the caller can't rely on a kernel mapping. So the "fix" here is wrong. That being said for cases where we can easily remove a page from the kernel mapping it would be nice to do to: a) improve security b) as a debug check to see that

Re: [PATCH] dma-direct: fix DMA_ATTR_NO_KERNEL_MAPPING

2021-11-01 Thread Walter Wu
On Mon, 2021-11-01 at 15:17 +0100, Ard Biesheuvel wrote: > On Mon, 1 Nov 2021 at 13:21, Walter Wu > wrote: > > > > Hi Ard, > > > > On Mon, 2021-11-01 at 09:34 +0100, Ard Biesheuvel wrote: > > > On Mon, 1 Nov 2021 at 04:17, Walter Wu > > > > > > wrote: > > > > > > > > DMA_ATTR_NO_KERNEL_MAPPING

Re: [PATCH] dma-direct: fix DMA_ATTR_NO_KERNEL_MAPPING

2021-11-01 Thread Ard Biesheuvel
On Mon, 1 Nov 2021 at 13:21, Walter Wu wrote: > > Hi Ard, > > On Mon, 2021-11-01 at 09:34 +0100, Ard Biesheuvel wrote: > > On Mon, 1 Nov 2021 at 04:17, Walter Wu > > wrote: > > > > > > DMA_ATTR_NO_KERNEL_MAPPING is to avoid creating a kernel mapping > > > for the allocated buffer, but current imp

Re: [RFC 02/20] vfio: Add device class for /dev/vfio/devices

2021-11-01 Thread Jason Gunthorpe via iommu
On Fri, Oct 29, 2021 at 09:47:27AM +, Liu, Yi L wrote: > Hi Jason, > > > From: Jason Gunthorpe > > Sent: Monday, October 25, 2021 8:53 PM > > > > On Mon, Oct 25, 2021 at 06:28:09AM +, Liu, Yi L wrote: > > >thanks for the guiding. will also refer to your vfio_group_cdev series. > > >

Re: [PATCH] dma-direct: fix DMA_ATTR_NO_KERNEL_MAPPING

2021-11-01 Thread Walter Wu
Hi Ard, On Mon, 2021-11-01 at 09:34 +0100, Ard Biesheuvel wrote: > On Mon, 1 Nov 2021 at 04:17, Walter Wu > wrote: > > > > DMA_ATTR_NO_KERNEL_MAPPING is to avoid creating a kernel mapping > > for the allocated buffer, but current implementation is that > > PTE of allocated buffer in kernel page

Re: [PATCH] dma-direct: fix DMA_ATTR_NO_KERNEL_MAPPING

2021-11-01 Thread Walter Wu
Hi Robin, On Mon, 2021-11-01 at 10:29 +, Robin Murphy wrote: > On 2021-11-01 03:15, Walter Wu wrote: > > DMA_ATTR_NO_KERNEL_MAPPING is to avoid creating a kernel mapping > > for the allocated buffer, but current implementation is that > > PTE of allocated buffer in kernel page table is valid.

Re: [PATCH] memory: mtk-smi: Fix a null dereference for the ostd

2021-11-01 Thread Yong Wu
On Mon, 2021-11-01 at 09:45 +0100, Krzysztof Kozlowski wrote: > On 01/11/2021 07:09, Yong Wu wrote: > > On Fri, 2021-10-29 at 19:35 +0200, Krzysztof Kozlowski wrote: > > > On 28/10/2021 07:50, Yong Wu wrote: > > > > We add the ostd setting for mt8195. It introduces a abort for > > > > the > > > > p

Re: [PATCH] dma-direct: fix DMA_ATTR_NO_KERNEL_MAPPING

2021-11-01 Thread Robin Murphy
On 2021-11-01 03:15, Walter Wu wrote: DMA_ATTR_NO_KERNEL_MAPPING is to avoid creating a kernel mapping for the allocated buffer, but current implementation is that PTE of allocated buffer in kernel page table is valid. So we should set invalid for PTE of allocate buffer so that there are no kerne

Re: [PATCH] iommu/dma: fix incorrect error return on iommu deferred attach

2021-11-01 Thread John Garry
On 27/10/2021 18:47, Logan Gunthorpe wrote: scsi_dma_map() was reporting a failure during boot on an AMD machine with the IOMMU enabled. scsi_dma_map failed: request for 36 bytes! The issue was tracked down to a mistake in logic: should not return an error if iommu_deferred_attach() returns

Re: [PATCH] memory: mtk-smi: Fix a null dereference for the ostd

2021-11-01 Thread Krzysztof Kozlowski
On 01/11/2021 07:09, Yong Wu wrote: > On Fri, 2021-10-29 at 19:35 +0200, Krzysztof Kozlowski wrote: >> On 28/10/2021 07:50, Yong Wu wrote: >>> We add the ostd setting for mt8195. It introduces a abort for the >>> previous SoC which doesn't have ostd setting. This is the log: >>> >>> Unable to handl

Re: [PATCH] dma-direct: fix DMA_ATTR_NO_KERNEL_MAPPING

2021-11-01 Thread Ard Biesheuvel
On Mon, 1 Nov 2021 at 04:17, Walter Wu wrote: > > DMA_ATTR_NO_KERNEL_MAPPING is to avoid creating a kernel mapping > for the allocated buffer, but current implementation is that > PTE of allocated buffer in kernel page table is valid. So we > should set invalid for PTE of allocate buffer so that t

[PATCH] dma-direct: fix DMA_ATTR_NO_KERNEL_MAPPING

2021-11-01 Thread Walter Wu
DMA_ATTR_NO_KERNEL_MAPPING is to avoid creating a kernel mapping for the allocated buffer, but current implementation is that PTE of allocated buffer in kernel page table is valid. So we should set invalid for PTE of allocate buffer so that there are no kernel mapping for the allocated buffer. In