提交 e82becfc 编写于 作者: C Christian Borntraeger 提交者: Michael S. Tsirkin

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: NChristian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: NJoerg Roedel <jroedel@suse.de>
Acked-by: NCornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: NSebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: NAndy Lutomirski <luto@kernel.org>
Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
上级 6aca0503
...@@ -124,6 +124,7 @@ config S390 ...@@ -124,6 +124,7 @@ config S390
select HAVE_CMPXCHG_DOUBLE select HAVE_CMPXCHG_DOUBLE
select HAVE_CMPXCHG_LOCAL select HAVE_CMPXCHG_LOCAL
select HAVE_DEBUG_KMEMLEAK select HAVE_DEBUG_KMEMLEAK
select HAVE_DMA_API_DEBUG
select HAVE_DYNAMIC_FTRACE select HAVE_DYNAMIC_FTRACE
select HAVE_DYNAMIC_FTRACE_WITH_REGS select HAVE_DYNAMIC_FTRACE_WITH_REGS
select HAVE_FTRACE_MCOUNT_RECORD select HAVE_FTRACE_MCOUNT_RECORD
...@@ -619,10 +620,6 @@ config HAS_IOMEM ...@@ -619,10 +620,6 @@ config HAS_IOMEM
config IOMMU_HELPER config IOMMU_HELPER
def_bool PCI def_bool PCI
config HAS_DMA
def_bool PCI
select HAVE_DMA_API_DEBUG
config NEED_SG_DMA_LENGTH config NEED_SG_DMA_LENGTH
def_bool PCI def_bool PCI
......
...@@ -3,5 +3,9 @@ ...@@ -3,5 +3,9 @@
* *
* This file is released under the GPLv2 * This file is released under the GPLv2
*/ */
#include <asm-generic/device.h> struct dev_archdata {
struct dma_map_ops *dma_ops;
};
struct pdev_archdata {
};
...@@ -11,11 +11,13 @@ ...@@ -11,11 +11,13 @@
#define DMA_ERROR_CODE (~(dma_addr_t) 0x0) #define DMA_ERROR_CODE (~(dma_addr_t) 0x0)
extern struct dma_map_ops s390_dma_ops; extern struct dma_map_ops s390_pci_dma_ops;
static inline struct dma_map_ops *get_dma_ops(struct device *dev) static inline struct dma_map_ops *get_dma_ops(struct device *dev)
{ {
return &s390_dma_ops; if (dev && dev->archdata.dma_ops)
return dev->archdata.dma_ops;
return &dma_noop_ops;
} }
static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size, static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
......
...@@ -643,6 +643,7 @@ int pcibios_add_device(struct pci_dev *pdev) ...@@ -643,6 +643,7 @@ int pcibios_add_device(struct pci_dev *pdev)
zdev->pdev = pdev; zdev->pdev = pdev;
pdev->dev.groups = zpci_attr_groups; pdev->dev.groups = zpci_attr_groups;
pdev->dev.archdata.dma_ops = &s390_pci_dma_ops;
zpci_map_resources(pdev); zpci_map_resources(pdev);
for (i = 0; i < PCI_BAR_COUNT; i++) { for (i = 0; i < PCI_BAR_COUNT; i++) {
......
...@@ -544,7 +544,7 @@ static int __init dma_debug_do_init(void) ...@@ -544,7 +544,7 @@ static int __init dma_debug_do_init(void)
} }
fs_initcall(dma_debug_do_init); fs_initcall(dma_debug_do_init);
struct dma_map_ops s390_dma_ops = { struct dma_map_ops s390_pci_dma_ops = {
.alloc = s390_dma_alloc, .alloc = s390_dma_alloc,
.free = s390_dma_free, .free = s390_dma_free,
.map_sg = s390_dma_map_sg, .map_sg = s390_dma_map_sg,
...@@ -555,7 +555,7 @@ struct dma_map_ops s390_dma_ops = { ...@@ -555,7 +555,7 @@ struct dma_map_ops s390_dma_ops = {
.is_phys = 0, .is_phys = 0,
/* dma_supported is unconditionally true without a callback */ /* dma_supported is unconditionally true without a callback */
}; };
EXPORT_SYMBOL_GPL(s390_dma_ops); EXPORT_SYMBOL_GPL(s390_pci_dma_ops);
static int __init s390_iommu_setup(char *str) static int __init s390_iommu_setup(char *str)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册