diff options
| author | Christian Borntraeger <borntraeger@de.ibm.com> | 2016-02-03 00:46:34 -0500 |
|---|---|---|
| committer | Michael S. Tsirkin <mst@redhat.com> | 2016-03-02 10:01:56 -0500 |
| commit | e82becfc1879a43aa29492ae90ea6eb6c68b60fc (patch) | |
| tree | 58a5bb902a9ee27cf0a4242ba3fcdf86fa60a315 | |
| parent | 6aca0503847f6329460b15b3ab2b0e30bb752793 (diff) | |
s390/dma: Allow per device dma ops
As virtio-ccw will have dma ops, we can no longer default to the
zPCI ones. Make use of dev_archdata to keep the dma_ops per device.
The pci devices now use that to override the default, and the
default is changed to use the noop ops for everything that does not
specify a device specific one.
To compile without PCI support we will enable HAS_DMA all the time,
via the default config in lib/Kconfig.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Joerg Roedel <jroedel@suse.de>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
| -rw-r--r-- | arch/s390/Kconfig | 5 | ||||
| -rw-r--r-- | arch/s390/include/asm/device.h | 6 | ||||
| -rw-r--r-- | arch/s390/include/asm/dma-mapping.h | 6 | ||||
| -rw-r--r-- | arch/s390/pci/pci.c | 1 | ||||
| -rw-r--r-- | arch/s390/pci/pci_dma.c | 4 |
5 files changed, 13 insertions, 9 deletions
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 3be9c832dec1..b29c66e77e32 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig | |||
| @@ -124,6 +124,7 @@ config S390 | |||
| 124 | select HAVE_CMPXCHG_DOUBLE | 124 | select HAVE_CMPXCHG_DOUBLE |
| 125 | select HAVE_CMPXCHG_LOCAL | 125 | select HAVE_CMPXCHG_LOCAL |
| 126 | select HAVE_DEBUG_KMEMLEAK | 126 | select HAVE_DEBUG_KMEMLEAK |
| 127 | select HAVE_DMA_API_DEBUG | ||
| 127 | select HAVE_DYNAMIC_FTRACE | 128 | select HAVE_DYNAMIC_FTRACE |
| 128 | select HAVE_DYNAMIC_FTRACE_WITH_REGS | 129 | select HAVE_DYNAMIC_FTRACE_WITH_REGS |
| 129 | select HAVE_FTRACE_MCOUNT_RECORD | 130 | select HAVE_FTRACE_MCOUNT_RECORD |
| @@ -619,10 +620,6 @@ config HAS_IOMEM | |||
| 619 | config IOMMU_HELPER | 620 | config IOMMU_HELPER |
| 620 | def_bool PCI | 621 | def_bool PCI |
| 621 | 622 | ||
| 622 | config HAS_DMA | ||
| 623 | def_bool PCI | ||
| 624 | select HAVE_DMA_API_DEBUG | ||
| 625 | |||
| 626 | config NEED_SG_DMA_LENGTH | 623 | config NEED_SG_DMA_LENGTH |
| 627 | def_bool PCI | 624 | def_bool PCI |
| 628 | 625 | ||
diff --git a/arch/s390/include/asm/device.h b/arch/s390/include/asm/device.h index d8f9872b0e2d..4a9f35e0973f 100644 --- a/arch/s390/include/asm/device.h +++ b/arch/s390/include/asm/device.h | |||
| @@ -3,5 +3,9 @@ | |||
| 3 | * | 3 | * |
| 4 | * This file is released under the GPLv2 | 4 | * This file is released under the GPLv2 |
| 5 | */ | 5 | */ |
| 6 | #include <asm-generic/device.h> | 6 | struct dev_archdata { |
| 7 | struct dma_map_ops *dma_ops; | ||
| 8 | }; | ||
| 7 | 9 | ||
| 10 | struct pdev_archdata { | ||
| 11 | }; | ||
diff --git a/arch/s390/include/asm/dma-mapping.h b/arch/s390/include/asm/dma-mapping.h index e64bfcb9702f..3249b7464889 100644 --- a/arch/s390/include/asm/dma-mapping.h +++ b/arch/s390/include/asm/dma-mapping.h | |||
| @@ -11,11 +11,13 @@ | |||
| 11 | 11 | ||
| 12 | #define DMA_ERROR_CODE (~(dma_addr_t) 0x0) | 12 | #define DMA_ERROR_CODE (~(dma_addr_t) 0x0) |
| 13 | 13 | ||
| 14 | extern struct dma_map_ops s390_dma_ops; | 14 | extern struct dma_map_ops s390_pci_dma_ops; |
| 15 | 15 | ||
| 16 | static inline struct dma_map_ops *get_dma_ops(struct device *dev) | 16 | static inline struct dma_map_ops *get_dma_ops(struct device *dev) |
| 17 | { | 17 | { |
| 18 | return &s390_dma_ops; | 18 | if (dev && dev->archdata.dma_ops) |
| 19 | return dev->archdata.dma_ops; | ||
| 20 | return &dma_noop_ops; | ||
| 19 | } | 21 | } |
| 20 | 22 | ||
| 21 | static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size, | 23 | static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size, |
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c index 8f19c8f9d660..b63265a7f178 100644 --- a/arch/s390/pci/pci.c +++ b/arch/s390/pci/pci.c | |||
| @@ -643,6 +643,7 @@ int pcibios_add_device(struct pci_dev *pdev) | |||
| 643 | 643 | ||
| 644 | zdev->pdev = pdev; | 644 | zdev->pdev = pdev; |
| 645 | pdev->dev.groups = zpci_attr_groups; | 645 | pdev->dev.groups = zpci_attr_groups; |
| 646 | pdev->dev.archdata.dma_ops = &s390_pci_dma_ops; | ||
| 646 | zpci_map_resources(pdev); | 647 | zpci_map_resources(pdev); |
| 647 | 648 | ||
| 648 | for (i = 0; i < PCI_BAR_COUNT; i++) { | 649 | for (i = 0; i < PCI_BAR_COUNT; i++) { |
diff --git a/arch/s390/pci/pci_dma.c b/arch/s390/pci/pci_dma.c index 4638b93c7632..a79173ec54b9 100644 --- a/arch/s390/pci/pci_dma.c +++ b/arch/s390/pci/pci_dma.c | |||
| @@ -544,7 +544,7 @@ static int __init dma_debug_do_init(void) | |||
| 544 | } | 544 | } |
| 545 | fs_initcall(dma_debug_do_init); | 545 | fs_initcall(dma_debug_do_init); |
| 546 | 546 | ||
| 547 | struct dma_map_ops s390_dma_ops = { | 547 | struct dma_map_ops s390_pci_dma_ops = { |
| 548 | .alloc = s390_dma_alloc, | 548 | .alloc = s390_dma_alloc, |
| 549 | .free = s390_dma_free, | 549 | .free = s390_dma_free, |
| 550 | .map_sg = s390_dma_map_sg, | 550 | .map_sg = s390_dma_map_sg, |
| @@ -555,7 +555,7 @@ struct dma_map_ops s390_dma_ops = { | |||
| 555 | .is_phys = 0, | 555 | .is_phys = 0, |
| 556 | /* dma_supported is unconditionally true without a callback */ | 556 | /* dma_supported is unconditionally true without a callback */ |
| 557 | }; | 557 | }; |
| 558 | EXPORT_SYMBOL_GPL(s390_dma_ops); | 558 | EXPORT_SYMBOL_GPL(s390_pci_dma_ops); |
| 559 | 559 | ||
| 560 | static int __init s390_iommu_setup(char *str) | 560 | static int __init s390_iommu_setup(char *str) |
| 561 | { | 561 | { |
