Re: [PATCH] virtio: Simplify DMA setting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le 10/01/2022 à 07:14, Jason Wang a écrit :

在 2022/1/8 下午3:08, Christophe JAILLET 写道:
As stated in [1], dma_set_mask() with a 64-bit mask will never fail if
dev->dma_mask is non-NULL.
So, if it fails, the 32 bits case will also fail for the same reason.


I'd expect to be more verbose here. E.g I see dma_supported() who has a brunch of checks need to be called if dma_mask is non-NULL.

Thanks



Hi,

If Christoph Hellwig's references ([1], [2]) are not enough, here is my own analysis.
I put him in copy in case he has be better wording or explanation than me.



I've searched all dma_supported() function with grep
    grep -r --include=*.[ch]  \\.dma_supported * > dma_supported.txt

I've removed duplicates, then, I've audited audit all functions.
Short summary below.

Adding all this in the commit looks an overkill to me.
Maybe we can add a link to this mail if it looks good to you.

CJ



arch/arm/common/dmabounce.c:			.dma_supported =	dmabounce_dma_supported
==> Same as arm_dma_supported()

arch/arm/mm/dma-mapping.c:			.dma_supported =	arm_dma_supported
==> If a mask fails, smaller masks will fail as well.

arch/alpha/kernel/pci_iommu.c:			.dma_supported =	alpha_pci_supported
==> If a mask fails, smaller masks will fail as well.

arch/x86/kernel/amd_gart_64.c:			.dma_supported =	dma_direct_supported
==> Succeeds if >= 32 bits. If a mask fails, smaller masks will fail as well.

arch/powerpc/kernel/dma-iommu.c:		.dma_supported =	dma_iommu_dma_supported
==> Tricky because of dma_iommu_bypass_supported(), but if a mask fails, smaller masks will fail as well.

arch/powerpc/platforms/ps3/system-bus.c:	.dma_supported =	ps3_dma_supported
==> Succeeds if >= 32 bits

arch/powerpc/platforms/pseries/ibmebus.c: .dma_supported = ibmebus_dma_supported
==> Succeeds if == 64 bits

arch/sparc/kernel/iommu.c:			.dma_supported =	dma_4u_supported
==> One corner case which accept only 31 bits
==> If a mask fails, smaller masks will fail as well

arch/sparc/kernel/pci_sun4v.c:			.dma_supported =	dma_4v_supported
==> Same as dma_4u_supported() above

arch/ia64/hp/common/sba_iommu.c:		.dma_supported =	sba_dma_supported
==> Succeeds if >= 32 bits

drivers/xen/swiotlb-xen.c:			.dma_supported =	xen_swiotlb_dma_supported
==> If a mask fails, smaller masks will fail as well.

drivers/parisc/ccio-dma.c:			.dma_supported =	ccio_dma_supported
==> Succeeds if >= 32 bits

drivers/parisc/sba_iommu.c:			.dma_supported =	sba_dma_supported
==> If a mask fails, smaller masks will fail as well.

kernel/dma/dummy.c:				.dma_supported =	dma_dummy_supported
==> Always fails, whatever the value of the mask


[1]: https://lore.kernel.org/linux-kernel/YL3vSPK5DXTNvgdx@xxxxxxxxxxxxx/

[2]: https://lore.kernel.org/kernel-janitors/YdK4IIFvi5O5eXHC@xxxxxxxxxxxxx/



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux