linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: Jason Wang <jasowang@redhat.com>, mst@redhat.com
Cc: virtualization@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH] virtio: Simplify DMA setting
Date: Mon, 10 Jan 2022 19:16:28 +0100	[thread overview]
Message-ID: <97ef1b73-a9a4-6018-d52c-4108ff9de7ca@wanadoo.fr> (raw)
In-Reply-To: <42ba2840-bfa8-d530-4bcf-3eeee9403a31@redhat.com>

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@infradead.org/

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

      reply	other threads:[~2022-01-10 18:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-08  7:08 [PATCH] virtio: Simplify DMA setting Christophe JAILLET
2022-01-10  6:14 ` Jason Wang
2022-01-10 18:16   ` Christophe JAILLET [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=97ef1b73-a9a4-6018-d52c-4108ff9de7ca@wanadoo.fr \
    --to=christophe.jaillet@wanadoo.fr \
    --cc=hch@lst.de \
    --cc=jasowang@redhat.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).