iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
To: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>,
	Paul Mackerras <paulus-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>,
	Michael Ellerman <mpe-Gsx/Oe8HsFggBc27wqDAHg@public.gmane.org>,
	Tony Luck <tony.luck-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Fenghua Yu <fenghua.yu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	linux-ia64-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>,
	Konrad Rzeszutek Wilk
	<konrad.wilk-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH 17/20] powerpc/dma-swiotlb: use generic swiotlb_dma_ops
Date: Thu, 09 Aug 2018 11:57:53 +1000	[thread overview]
Message-ID: <777010cd04645b55aa4197eddcc880f010f0ef6d.camel@kernel.crashing.org> (raw)
In-Reply-To: <556a4302d13b1caafb223112c4de43d959146215.camel-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>

On Thu, 2018-08-09 at 10:54 +1000, Benjamin Herrenschmidt wrote:
> On Mon, 2018-07-30 at 18:38 +0200, Christoph Hellwig wrote:
> > These are identical to the arch specific ones, so remove them.
> > 
> > Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
> 
> Acked-by: Benjamin Herrenschmidt <benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>

Note: We will still need to implement some custom variant of this
for our secure VMs ... 

Basically we'll need to use the existing bounce bufferring as-is but
the condition will be different, it won't be whether the address is
below a certain limit, it will be *always*.

Cheers,
Ben.

> > ---
> >  arch/powerpc/include/asm/dma-direct.h |  4 ++++
> >  arch/powerpc/include/asm/swiotlb.h    |  2 --
> >  arch/powerpc/kernel/dma-swiotlb.c     | 28 ++-------------------------
> >  arch/powerpc/sysdev/fsl_pci.c         |  2 +-
> >  4 files changed, 7 insertions(+), 29 deletions(-)
> > 
> > diff --git a/arch/powerpc/include/asm/dma-direct.h b/arch/powerpc/include/asm/dma-direct.h
> > index 0fba19445ae8..657f84ddb20d 100644
> > --- a/arch/powerpc/include/asm/dma-direct.h
> > +++ b/arch/powerpc/include/asm/dma-direct.h
> > @@ -30,4 +30,8 @@ static inline phys_addr_t __dma_to_phys(struct device *dev, dma_addr_t daddr)
> >  		return daddr - PCI_DRAM_OFFSET;
> >  	return daddr - dev->archdata.dma_offset;
> >  }
> > +
> > +u64 swiotlb_powerpc_get_required(struct device *dev);
> > +#define swiotlb_get_required_mask swiotlb_powerpc_get_required
> > +
> >  #endif /* ASM_POWERPC_DMA_DIRECT_H */
> > diff --git a/arch/powerpc/include/asm/swiotlb.h b/arch/powerpc/include/asm/swiotlb.h
> > index f65ecf57b66c..1d8c1da26ab3 100644
> > --- a/arch/powerpc/include/asm/swiotlb.h
> > +++ b/arch/powerpc/include/asm/swiotlb.h
> > @@ -13,8 +13,6 @@
> >  
> >  #include <linux/swiotlb.h>
> >  
> > -extern const struct dma_map_ops powerpc_swiotlb_dma_ops;
> > -
> >  extern unsigned int ppc_swiotlb_enable;
> >  int __init swiotlb_setup_bus_notifier(void);
> >  
> > diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/dma-swiotlb.c
> > index 25986fcd1e5e..0c269de61f39 100644
> > --- a/arch/powerpc/kernel/dma-swiotlb.c
> > +++ b/arch/powerpc/kernel/dma-swiotlb.c
> > @@ -24,7 +24,7 @@
> >  
> >  unsigned int ppc_swiotlb_enable;
> >  
> > -static u64 swiotlb_powerpc_get_required(struct device *dev)
> > +u64 swiotlb_powerpc_get_required(struct device *dev)
> >  {
> >  	u64 end, mask, max_direct_dma_addr = dev->archdata.max_direct_dma_addr;
> >  
> > @@ -38,30 +38,6 @@ static u64 swiotlb_powerpc_get_required(struct device *dev)
> >  	return mask;
> >  }
> >  
> > -/*
> > - * At the moment, all platforms that use this code only require
> > - * swiotlb to be used if we're operating on HIGHMEM.  Since
> > - * we don't ever call anything other than map_sg, unmap_sg,
> > - * map_page, and unmap_page on highmem, use normal dma_ops
> > - * for everything else.
> > - */
> > -const struct dma_map_ops powerpc_swiotlb_dma_ops = {
> > -	.alloc = dma_direct_alloc,
> > -	.free = dma_direct_free,
> > -	.mmap = dma_nommu_mmap_coherent,
> > -	.map_sg = swiotlb_map_sg_attrs,
> > -	.unmap_sg = swiotlb_unmap_sg_attrs,
> > -	.dma_supported = swiotlb_dma_supported,
> > -	.map_page = swiotlb_map_page,
> > -	.unmap_page = swiotlb_unmap_page,
> > -	.sync_single_for_cpu = swiotlb_sync_single_for_cpu,
> > -	.sync_single_for_device = swiotlb_sync_single_for_device,
> > -	.sync_sg_for_cpu = swiotlb_sync_sg_for_cpu,
> > -	.sync_sg_for_device = swiotlb_sync_sg_for_device,
> > -	.mapping_error = swiotlb_dma_mapping_error,
> > -	.get_required_mask = swiotlb_powerpc_get_required,
> > -};
> > -
> >  void pci_dma_dev_setup_swiotlb(struct pci_dev *pdev)
> >  {
> >  	struct pci_controller *hose;
> > @@ -88,7 +64,7 @@ static int ppc_swiotlb_bus_notify(struct notifier_block *nb,
> >  
> >  	/* May need to bounce if the device can't address all of DRAM */
> >  	if ((dma_get_mask(dev) + 1) < memblock_end_of_DRAM())
> > -		set_dma_ops(dev, &powerpc_swiotlb_dma_ops);
> > +		set_dma_ops(dev, &swiotlb_dma_ops);
> >  
> >  	return NOTIFY_DONE;
> >  }
> > diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
> > index 918be816b097..daf44bc0108d 100644
> > --- a/arch/powerpc/sysdev/fsl_pci.c
> > +++ b/arch/powerpc/sysdev/fsl_pci.c
> > @@ -118,7 +118,7 @@ static void setup_swiotlb_ops(struct pci_controller *hose)
> >  {
> >  	if (ppc_swiotlb_enable) {
> >  		hose->controller_ops.dma_dev_setup = pci_dma_dev_setup_swiotlb;
> > -		set_pci_dma_ops(&powerpc_swiotlb_dma_ops);
> > +		set_pci_dma_ops(&swiotlb_dma_ops);
> >  	}
> >  }
> >  #else

  parent reply	other threads:[~2018-08-09  1:57 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-30 16:38 use generic DMA mapping code in powerpc Christoph Hellwig
     [not found] ` <20180730163824.10064-1-hch-jcswGhMUV9g@public.gmane.org>
2018-07-30 16:38   ` [PATCH 01/20] kernel/dma/direct: take DMA offset into account in dma_direct_supported Christoph Hellwig
     [not found]     ` <20180730163824.10064-2-hch-jcswGhMUV9g@public.gmane.org>
2018-08-08 23:44       ` Benjamin Herrenschmidt
     [not found]         ` <74068e4d2135ecad8645048ed97b1114891ccace.camel-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2018-08-22  6:53           ` Christoph Hellwig
     [not found]             ` <20180822065359.GB19284-jcswGhMUV9g@public.gmane.org>
2018-08-22 23:59               ` Benjamin Herrenschmidt
     [not found]                 ` <079a961eaf548644250719df83930d3d72e34cac.camel-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2018-08-23  5:24                   ` Christoph Hellwig
     [not found]                     ` <20180823052403.GA14388-jcswGhMUV9g@public.gmane.org>
2018-08-23  5:24                       ` Benjamin Herrenschmidt
2018-07-30 16:38   ` [PATCH 02/20] kernel/dma/direct: refine dma_direct_alloc zone selection Christoph Hellwig
     [not found]     ` <20180730163824.10064-3-hch-jcswGhMUV9g@public.gmane.org>
2018-08-08 23:54       ` Benjamin Herrenschmidt
     [not found]         ` <7177553cdb5cd1b968f653a52d7e88bd71aae4d8.camel-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2018-08-22  6:58           ` Christoph Hellwig
     [not found]             ` <20180822065856.GC19284-jcswGhMUV9g@public.gmane.org>
2018-08-23  0:01               ` Benjamin Herrenschmidt
     [not found]                 ` <d9866d44704073ecc418f62da0ba7587ce7c9af8.camel-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2018-08-23  5:26                   ` Christoph Hellwig
2018-07-30 16:38   ` [PATCH 03/20] dma-mapping: make the get_required_mask method available unconditionally Christoph Hellwig
2018-07-30 16:38   ` [PATCH 04/20] ia64: remove get_required_mask implementation Christoph Hellwig
2018-07-30 16:38   ` [PATCH 05/20] swiotlb: allow the architecture to provide a get_required_mask hook Christoph Hellwig
     [not found]     ` <20180730163824.10064-6-hch-jcswGhMUV9g@public.gmane.org>
2018-08-27 16:06       ` Konrad Rzeszutek Wilk
2018-07-30 16:38   ` [PATCH 06/20] dma-noncoherent: add an optional arch hook for ->get_required_mask Christoph Hellwig
2018-07-30 16:38   ` [PATCH 07/20] powerpc/dma: remove the unused ARCH_HAS_DMA_MMAP_COHERENT define Christoph Hellwig
     [not found]     ` <20180730163824.10064-8-hch-jcswGhMUV9g@public.gmane.org>
2018-08-08 23:56       ` Benjamin Herrenschmidt
2018-07-30 16:38   ` [PATCH 08/20] powerpc/dma: remove the unused dma_nommu_ops export Christoph Hellwig
     [not found]     ` <20180730163824.10064-9-hch-jcswGhMUV9g@public.gmane.org>
2018-07-31 12:16       ` Christoph Hellwig
     [not found]         ` <20180731121625.GA29793-jcswGhMUV9g@public.gmane.org>
2018-08-09  0:01           ` Benjamin Herrenschmidt
     [not found]             ` <f7daffa5481ab82f345aa5bf9f63f40caa068456.camel-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2018-08-22  6:45               ` Christoph Hellwig
     [not found]                 ` <20180822064531.GA19284-jcswGhMUV9g@public.gmane.org>
2018-08-22 23:50                   ` Benjamin Herrenschmidt
2018-07-30 16:38   ` [PATCH 09/20] powerpc/dma: remove the unused ISA_DMA_THRESHOLD export Christoph Hellwig
     [not found]     ` <20180730163824.10064-10-hch-jcswGhMUV9g@public.gmane.org>
2018-08-09  0:14       ` Benjamin Herrenschmidt
2018-07-30 16:38   ` [PATCH 10/20] powerpc/dma-noncoherent: don't disable irqs over kmap_atomic Christoph Hellwig
     [not found]     ` <20180730163824.10064-11-hch-jcswGhMUV9g@public.gmane.org>
2018-08-09  0:27       ` Benjamin Herrenschmidt
     [not found]         ` <bfa22816fee0759cfee28705b427be3586c7d2e3.camel-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2018-08-22  7:02           ` Christoph Hellwig
     [not found]             ` <20180822070241.GD19284-jcswGhMUV9g@public.gmane.org>
2018-08-22 23:45               ` Benjamin Herrenschmidt
2018-07-30 16:38   ` [PATCH 11/20] powerpc/dma: split the two __dma_alloc_coherent implementations Christoph Hellwig
     [not found]     ` <20180730163824.10064-12-hch-jcswGhMUV9g@public.gmane.org>
2018-08-09  0:40       ` Benjamin Herrenschmidt
2018-07-30 16:38   ` [PATCH 12/20] powerpc/dma: use phys_to_dma instead of get_dma_offset Christoph Hellwig
     [not found]     ` <20180730163824.10064-13-hch-jcswGhMUV9g@public.gmane.org>
2018-08-09  0:43       ` Benjamin Herrenschmidt
2018-07-30 16:38   ` [PATCH 13/20] powerpc/dma: remove get_dma_offset Christoph Hellwig
     [not found]     ` <20180730163824.10064-14-hch-jcswGhMUV9g@public.gmane.org>
2018-08-09  0:45       ` Benjamin Herrenschmidt
2018-07-30 16:38   ` [PATCH 14/20] powerpc/dma: replace dma_nommu_dma_supported with dma_direct_supported Christoph Hellwig
     [not found]     ` <20180730163824.10064-15-hch-jcswGhMUV9g@public.gmane.org>
2018-08-09  0:49       ` Benjamin Herrenschmidt
2018-07-30 16:38   ` [PATCH 15/20] powerpc/dma: remove the unused unmap_page and unmap_sg methods Christoph Hellwig
     [not found]     ` <20180730163824.10064-16-hch-jcswGhMUV9g@public.gmane.org>
2018-08-09  0:49       ` Benjamin Herrenschmidt
2018-07-30 16:38   ` [PATCH 16/20] powerpc/dma: use dma_direct_{alloc,free} Christoph Hellwig
     [not found]     ` <20180730163824.10064-17-hch-jcswGhMUV9g@public.gmane.org>
2018-08-09  0:52       ` Benjamin Herrenschmidt
2018-08-27  8:51         ` Scott Wood
2018-07-30 16:38   ` [PATCH 17/20] powerpc/dma-swiotlb: use generic swiotlb_dma_ops Christoph Hellwig
     [not found]     ` <20180730163824.10064-18-hch-jcswGhMUV9g@public.gmane.org>
2018-08-09  0:54       ` Benjamin Herrenschmidt
     [not found]         ` <556a4302d13b1caafb223112c4de43d959146215.camel-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2018-08-09  1:57           ` Benjamin Herrenschmidt [this message]
     [not found]             ` <777010cd04645b55aa4197eddcc880f010f0ef6d.camel-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2018-08-22  7:04               ` Christoph Hellwig
2018-07-30 16:38   ` [PATCH 18/20] powerpc/dma-noncoherent: use generic dma_noncoherent_ops Christoph Hellwig
     [not found]     ` <20180730163824.10064-19-hch-jcswGhMUV9g@public.gmane.org>
2018-08-09  1:00       ` Benjamin Herrenschmidt
2018-07-30 16:38   ` [PATCH 19/20] powerpc/dma: use the generic dma-direct map_page and map_sg routines Christoph Hellwig
2018-07-30 16:38   ` [PATCH 20/20] powerpc/dma: remove dma_nommu_mmap_coherent Christoph Hellwig
     [not found]     ` <20180730163824.10064-21-hch-jcswGhMUV9g@public.gmane.org>
2018-08-09  1:05       ` Benjamin Herrenschmidt

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=777010cd04645b55aa4197eddcc880f010f0ef6d.camel@kernel.crashing.org \
    --to=benh-xvmvhmargas8u2djnn8i7kb+6bgklq7r@public.gmane.org \
    --cc=fenghua.yu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=hch-jcswGhMUV9g@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=konrad.wilk-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
    --cc=linux-ia64-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=mpe-Gsx/Oe8HsFggBc27wqDAHg@public.gmane.org \
    --cc=paulus-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org \
    --cc=robin.murphy-5wv7dgnIgG8@public.gmane.org \
    --cc=tony.luck-ral2JQCrhuEAvxtiuMwx3w@public.gmane.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).