From: Christoph Hellwig <hch@lst.de>
To: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Cc: linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org,
linux-arch@vger.kernel.org,
Vineet Gupta <Vineet.Gupta1@synopsys.com>,
Alexey Brodkin <Alexey.Brodkin@synopsys.com>,
hch@lst.de
Subject: Re: [RFC] ARC: allow to use IOC and non-IOC DMA devices simultaneously
Date: Fri, 15 Jun 2018 15:17:10 +0200 [thread overview]
Message-ID: <20180615131710.GA30776@lst.de> (raw)
In-Reply-To: <20180615125819.527-1-Eugeniy.Paltsev@synopsys.com>
> +#ifndef ASM_ARC_DMA_MAPPING_H
> +#define ASM_ARC_DMA_MAPPING_H
> +
> +#define arch_setup_dma_ops arch_setup_dma_ops
> +
> +#include <asm-generic/dma-mapping.h>
> +
> +void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
> + const struct iommu_ops *iommu, bool coherent);
Can you keep the #define for arch_setup_dma_ops right next to the
prototype?
> index 000000000000..9d0d310bbf5a
> --- /dev/null
> +++ b/arch/arc/mm/dma-mapping.c
> @@ -0,0 +1,20 @@
> +// SPDX-License-Identifier: GPL-2.0
> +// (C) 2018 Synopsys, Inc. (www.synopsys.com)
> +
> +#include <linux/dma-mapping.h>
> +
> +void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
> + const struct iommu_ops *iommu, bool coherent)
> +{
> + const struct dma_map_ops *dma_ops = &dma_noncoherent_ops;
> +
> + /*
> + * IOC hardware snoops all DMA traffic keeping the caches consistent
> + * with memory - eliding need for any explicit cache maintenance of
> + * DMA buffers - so we can use dma_direct cache ops.
> + */
> + if (is_isa_arcv2() && ioc_enable && coherent)
> + dma_ops = &dma_direct_ops;
> +
> + set_dma_ops(dev, dma_ops);
> +}
Why not just write the routines as:
void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
const struct iommu_ops *iommu, bool coherent)
{
if (is_isa_arcv2() && ioc_enable && coherent)
set_dma_ops(dev, &dma_direct_ops);
else
set_dma_ops(dev, &dma_noncoherent_ops);
}
Also a new file just for this routine seems a little wasteful. Can't
you just squeeze it into setup.c or some other file?
next prev parent reply other threads:[~2018-06-15 13:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-15 12:58 [RFC] ARC: allow to use IOC and non-IOC DMA devices simultaneously Eugeniy Paltsev
2018-06-15 12:58 ` Eugeniy Paltsev
2018-06-15 13:17 ` Christoph Hellwig [this message]
2018-06-15 13:17 ` Christoph Hellwig
2018-06-18 22:53 ` Vineet Gupta
2018-06-18 22:53 ` Vineet Gupta
2018-06-22 14:30 ` Eugeniy Paltsev
2018-06-22 14:30 ` Eugeniy Paltsev
2018-06-25 15:45 ` Alexey Brodkin
2018-06-25 15:45 ` Alexey Brodkin
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=20180615131710.GA30776@lst.de \
--to=hch@lst.de \
--cc=Alexey.Brodkin@synopsys.com \
--cc=Eugeniy.Paltsev@synopsys.com \
--cc=Vineet.Gupta1@synopsys.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-snps-arc@lists.infradead.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