From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Nishanth Aravamudan <nacc@us.ibm.com>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
linux-kernel@vger.kernel.org, miltonm@bga.com,
Paul Mackerras <paulus@samba.org>,
Andrew Morton <akpm@linux-foundation.org>,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [RFC PATCH 02/11] ppc: allow direct and iommu to coexist
Date: Sat, 09 Oct 2010 10:38:56 +1100 [thread overview]
Message-ID: <1286581136.2463.421.camel@pasglop> (raw)
In-Reply-To: <1286559192-10898-3-git-send-email-nacc@us.ibm.com>
On Fri, 2010-10-08 at 10:33 -0700, Nishanth Aravamudan wrote:
> Replace the union with just the multiple fields, ifdef on CONFIG_PPC64.
>
> Future pseries boxes will allow a 64 bit dma mapping covering all
> memory, coexisting with a smaller iommu window in 32 bit pci space.
>
> The cell fixed mapping would also like both to coexist.
>
> Signed-off-by: Milton Miller <miltonm@bga.com>
> Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
> ---
> I used the ifdef guard of CONFIG_PPC64 according to the current makefile
> for iommu.c. One set is burried in the middle of iommu.h.
I dislike the ifdef's ...
Also, why remove the union ? IE. Do we really them to co-exist for a
given device ? I'm doing something similar for another (not released
yet) processor where I'm flicking between direct and iommu at
set_dma_mask time, it's easy enough to change the union content.
Cheers,
Ben.
> ---
> arch/powerpc/include/asm/device.h | 14 ++++++--------
> arch/powerpc/include/asm/dma-mapping.h | 4 ++--
> arch/powerpc/include/asm/iommu.h | 6 ++++--
> 3 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/device.h b/arch/powerpc/include/asm/device.h
> index 16d25c0..ed883ea 100644
> --- a/arch/powerpc/include/asm/device.h
> +++ b/arch/powerpc/include/asm/device.h
> @@ -19,14 +19,12 @@ struct dev_archdata {
> /* DMA operations on that device */
> struct dma_map_ops *dma_ops;
>
> - /*
> - * When an iommu is in use, dma_data is used as a ptr to the base of the
> - * iommu_table. Otherwise, it is a simple numerical offset.
> - */
> - union {
> - dma_addr_t dma_offset;
> - void *iommu_table_base;
> - } dma_data;
> + /* dma_offset is used by swiotlb and direct dma ops, but no iommu */
> + dma_addr_t dma_offset;
> +
> +#ifdef CONFIG_PPC64
> + void *iommu_table_base;
> +#endif
>
> #ifdef CONFIG_SWIOTLB
> dma_addr_t max_direct_dma_addr;
> diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h
> index 8c9c6ad..644103a 100644
> --- a/arch/powerpc/include/asm/dma-mapping.h
> +++ b/arch/powerpc/include/asm/dma-mapping.h
> @@ -100,7 +100,7 @@ static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops)
> static inline dma_addr_t get_dma_offset(struct device *dev)
> {
> if (dev)
> - return dev->archdata.dma_data.dma_offset;
> + return dev->archdata.dma_offset;
>
> return PCI_DRAM_OFFSET;
> }
> @@ -108,7 +108,7 @@ static inline dma_addr_t get_dma_offset(struct device *dev)
> static inline void set_dma_offset(struct device *dev, dma_addr_t off)
> {
> if (dev)
> - dev->archdata.dma_data.dma_offset = off;
> + dev->archdata.dma_offset = off;
> }
>
> /* this will be removed soon */
> diff --git a/arch/powerpc/include/asm/iommu.h b/arch/powerpc/include/asm/iommu.h
> index edfc980..0f605a4 100644
> --- a/arch/powerpc/include/asm/iommu.h
> +++ b/arch/powerpc/include/asm/iommu.h
> @@ -70,15 +70,17 @@ struct iommu_table {
>
> struct scatterlist;
>
> +#ifdef CONFIG_PPC64
> static inline void set_iommu_table_base(struct device *dev, void *base)
> {
> - dev->archdata.dma_data.iommu_table_base = base;
> + dev->archdata.iommu_table_base = base;
> }
>
> static inline void *get_iommu_table_base(struct device *dev)
> {
> - return dev->archdata.dma_data.iommu_table_base;
> + return dev->archdata.iommu_table_base;
> }
> +#endif
>
> /* Frees table for an individual device node */
> extern void iommu_free_table(struct iommu_table *tbl, const char *node_name);
next prev parent reply other threads:[~2010-10-08 23:39 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-08 17:33 [RFC PATCH 00/11] ppc: enable dynamic dma window support Nishanth Aravamudan
2010-10-08 17:33 ` [RFC PATCH 01/11] macio: ensure all dma routines get copied over Nishanth Aravamudan
2010-10-08 17:33 ` [RFC PATCH 02/11] ppc: allow direct and iommu to coexist Nishanth Aravamudan
2010-10-08 23:38 ` Benjamin Herrenschmidt [this message]
2010-10-08 17:33 ` [RFC PATCH 03/11] ppc: Create ops to choose between direct window and iommu based on device mask Nishanth Aravamudan
2010-10-08 23:43 ` Benjamin Herrenschmidt
2010-10-08 23:44 ` Benjamin Herrenschmidt
2010-10-10 15:09 ` FUJITA Tomonori
2010-10-10 23:41 ` Benjamin Herrenschmidt
2010-10-08 17:33 ` [RFC PATCH 04/11] ppc: add memory_hotplug_max Nishanth Aravamudan
2010-10-08 17:33 ` [RFC PATCH 05/11] ppc: do not search for dma-window property on dlpar remove Nishanth Aravamudan
2010-10-08 17:33 ` [RFC PATCH 06/11] ppc: checking for pdn->parent is redundant Nishanth Aravamudan
2010-10-08 17:33 ` [RFC PATCH 07/11] ppc/iommu: do not need to check for dma_window == NULL Nishanth Aravamudan
2010-10-08 17:33 ` [RFC PATCH 08/11] ppc/iommu: remove unneeded pci_dma_bus_setup_pSeriesLP Nishanth Aravamudan
2010-10-08 17:33 ` [RFC PATCH 09/11] ppc/iommu: pass phb only to iommu_table_setparms_lpar Nishanth Aravamudan
2010-10-08 17:33 ` [RFC PATCH 10/11] ppc/iommu: add routines to pseries iommu to map tces 1-1 Nishanth Aravamudan
2010-10-08 17:33 ` [RFC PATCH 11/11] ppc: add dynamic dma window support Nishanth Aravamudan
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=1286581136.2463.421.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=akpm@linux-foundation.org \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=miltonm@bga.com \
--cc=nacc@us.ibm.com \
--cc=paulus@samba.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).