linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Christoph Hellwig <hch@infradead.org>, ysionneau@kalrayinc.com
Cc: linux-kernel@vger.kernel.org, "Will Deacon" <will@kernel.org>,
	"Aneesh Kumar K.V" <aneesh.kumar@kernel.org>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Nick Piggin" <npiggin@gmail.com>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Paul Walmsley" <paul.walmsley@sifive.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Albert Ou" <aou@eecs.berkeley.edu>,
	"Jonathan Borne" <jborne@kalrayinc.com>,
	"Julian Vetter" <jvetter@kalrayinc.com>,
	"Clement Leger" <clement@clement-leger.fr>,
	"Guillaume Thouvenin" <thouveng@gmail.com>,
	"Jean-Christophe Pince" <jcpince@gmail.com>,
	"Jules Maselbas" <jmaselbas@zdiv.net>,
	"Julien Hascoet" <jhascoet@kalrayinc.com>,
	"Louis Morhet" <lmorhet@kalrayinc.com>,
	"Marc Poulhiès" <dkm@kataplop.net>,
	"Marius Gligor" <mgligor@kalrayinc.com>,
	"Vincent Chardon" <vincent.chardon@elsys-design.com>,
	linux-arch@vger.kernel.org, linux-mm@kvack.org,
	linux-riscv@lists.infradead.org
Subject: Re: [RFC PATCH v3 24/37] kvx: Add memory management
Date: Tue, 30 Jul 2024 14:48:21 +0100	[thread overview]
Message-ID: <dc2a28b6-566c-4c17-9834-874513f1d4f1@arm.com> (raw)
In-Reply-To: <Zp5zrkwyagnkoY7F@infradead.org>

On 22/07/2024 3:58 pm, Christoph Hellwig wrote:
>> +#include "../../../drivers/iommu/dma-iommu.h"
> 
> This is not a public header as you can guess from the file path.
> 
>> +	switch (dir) {
>> +	case DMA_TO_DEVICE:
>> +		break;
>> +	case DMA_FROM_DEVICE:
>> +		break;
>> +
>> +	case DMA_BIDIRECTIONAL:
>> +		inval_dcache_range(paddr, size);
> 
> Doing this just for bidirectional is weird unless your architecture
> never does any speculative prefetching.  Other architectures
> include DMA_FROM_DEVICE here.
> 
>> +#ifdef CONFIG_IOMMU_DMA
>> +void arch_teardown_dma_ops(struct device *dev)
>> +{
>> +	dev->dma_ops = NULL;
>> +}
>> +#endif /* CONFIG_IOMMU_DMA*/
> 
> This should not be needed right now.

More than that, per 8b80549f1bc6, it's now actually a latent bug.

>  And will be completley
> useless once we do the direct calls to dma-iommu which we plan
> to do for Linux 6.12.
> 
>> +void arch_setup_dma_ops(struct device *dev, bool coherent)
>> +{
>> +	dev->dma_coherent = coherent;
>> +	if (device_iommu_mapped(dev))
>> +		iommu_setup_dma_ops(dev);
>> +}
> 
> And this seems odd, as iommu_setup_dma_ops is called from the iommu
> code and you shouldn't need it here.

Yeah, this smells like it was based on the old arm64 code, but then 
rebased without reference to the equivalent arm64 changes, hence the 
#include hack. Enabling iommu-dma for an architecture should now be a 
one-liner in drivers/iommu/Kconfig, however I don't see an IOMMU driver 
being added in this series so it's not clear it's actually necessary (yet).

Thanks,
Robin.


  reply	other threads:[~2024-07-30 13:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20240722094226.21602-1-ysionneau@kalrayinc.com>
2024-07-22  9:41 ` [RFC PATCH v3 12/37] kvx: Add ELF-related definitions ysionneau
2024-07-22  9:41 ` [RFC PATCH v3 24/37] kvx: Add memory management ysionneau
2024-07-22 14:58   ` Christoph Hellwig
2024-07-30 13:48     ` Robin Murphy [this message]
2024-08-23 16:02     ` Yann Sionneau
2024-07-22  9:41 ` [RFC PATCH v3 27/37] kvx: Add ELF relocations and module support ysionneau

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=dc2a28b6-566c-4c17-9834-874513f1d4f1@arm.com \
    --to=robin.murphy@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@kernel.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=clement@clement-leger.fr \
    --cc=dkm@kataplop.net \
    --cc=hch@infradead.org \
    --cc=jborne@kalrayinc.com \
    --cc=jcpince@gmail.com \
    --cc=jhascoet@kalrayinc.com \
    --cc=jmaselbas@zdiv.net \
    --cc=jvetter@kalrayinc.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=lmorhet@kalrayinc.com \
    --cc=mgligor@kalrayinc.com \
    --cc=npiggin@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=peterz@infradead.org \
    --cc=thouveng@gmail.com \
    --cc=vincent.chardon@elsys-design.com \
    --cc=will@kernel.org \
    --cc=ysionneau@kalrayinc.com \
    /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