Message ID | 1446551679-33492-4-git-send-email-borntraeger@de.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Tue, 3 Nov 2015 12:54:39 +0100 Christian Borntraeger <borntraeger@de.ibm.com> wrote: > As virtio-ccw now has dma ops, we can no longer default to the PCI 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 is not PCI. To compile without PCI > support we also have to enable the DMA api with virtio. Not only with virtio, but generally, right? > Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> > Reviewed-by: Joerg Roedel <jroedel@suse.de> > Acked-by: Sebastian Ott <sebott@linux.vnet.ibm.com> > --- > arch/s390/Kconfig | 3 ++- > arch/s390/include/asm/device.h | 6 +++++- > arch/s390/include/asm/dma-mapping.h | 6 ++++-- > arch/s390/pci/pci.c | 1 + > arch/s390/pci/pci_dma.c | 4 ++-- > 5 files changed, 14 insertions(+), 6 deletions(-) > > diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig > index 1d57000..04f0e02 100644 > --- a/arch/s390/Kconfig > +++ b/arch/s390/Kconfig > @@ -113,6 +113,7 @@ config S390 > select GENERIC_FIND_FIRST_BIT > select GENERIC_SMP_IDLE_THREAD > select GENERIC_TIME_VSYSCALL > + select HAS_DMA > select HAVE_ALIGNED_STRUCT_PAGE if SLUB > select HAVE_ARCH_AUDITSYSCALL > select HAVE_ARCH_EARLY_PFN_TO_NID > @@ -124,6 +125,7 @@ config S390 > select HAVE_CMPXCHG_DOUBLE > select HAVE_CMPXCHG_LOCAL > select HAVE_DEBUG_KMEMLEAK > + select HAVE_DMA_ATTRS > select HAVE_DYNAMIC_FTRACE > select HAVE_DYNAMIC_FTRACE_WITH_REGS > select HAVE_FTRACE_MCOUNT_RECORD > @@ -580,7 +582,6 @@ config QDIO > > menuconfig PCI > bool "PCI support" > - select HAVE_DMA_ATTRS > select PCI_MSI > help > Enable PCI support. Hm. Further down in this file, there's config HAS_DMA def_bool PCI select HAVE_DMA_API_DEBUG Should we maybe select HAVE_DMA_API_DEBUG above, drop the HAS_DMA config option and rely on not defining NO_DMA instead? Otherwise, the patch looks good to me. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Am 03.11.2015 um 13:26 schrieb Cornelia Huck: > On Tue, 3 Nov 2015 12:54:39 +0100 > Christian Borntraeger <borntraeger@de.ibm.com> wrote: > >> As virtio-ccw now has dma ops, we can no longer default to the PCI 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 is not PCI. To compile without PCI >> support we also have to enable the DMA api with virtio. > > Not only with virtio, but generally, right? Yes, will update the patch description. > >> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> >> Reviewed-by: Joerg Roedel <jroedel@suse.de> >> Acked-by: Sebastian Ott <sebott@linux.vnet.ibm.com> >> --- >> arch/s390/Kconfig | 3 ++- >> arch/s390/include/asm/device.h | 6 +++++- >> arch/s390/include/asm/dma-mapping.h | 6 ++++-- >> arch/s390/pci/pci.c | 1 + >> arch/s390/pci/pci_dma.c | 4 ++-- >> 5 files changed, 14 insertions(+), 6 deletions(-) >> >> diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig >> index 1d57000..04f0e02 100644 >> --- a/arch/s390/Kconfig >> +++ b/arch/s390/Kconfig >> @@ -113,6 +113,7 @@ config S390 >> select GENERIC_FIND_FIRST_BIT >> select GENERIC_SMP_IDLE_THREAD >> select GENERIC_TIME_VSYSCALL >> + select HAS_DMA >> select HAVE_ALIGNED_STRUCT_PAGE if SLUB >> select HAVE_ARCH_AUDITSYSCALL >> select HAVE_ARCH_EARLY_PFN_TO_NID >> @@ -124,6 +125,7 @@ config S390 >> select HAVE_CMPXCHG_DOUBLE >> select HAVE_CMPXCHG_LOCAL >> select HAVE_DEBUG_KMEMLEAK >> + select HAVE_DMA_ATTRS >> select HAVE_DYNAMIC_FTRACE >> select HAVE_DYNAMIC_FTRACE_WITH_REGS >> select HAVE_FTRACE_MCOUNT_RECORD >> @@ -580,7 +582,6 @@ config QDIO >> >> menuconfig PCI >> bool "PCI support" >> - select HAVE_DMA_ATTRS >> select PCI_MSI >> help >> Enable PCI support. > > Hm. Further down in this file, there's > > config HAS_DMA > def_bool PCI > select HAVE_DMA_API_DEBUG > > Should we maybe select HAVE_DMA_API_DEBUG above, drop the HAS_DMA > config option and rely on not defining NO_DMA instead? Hmm, yes. That would simplify things a lot. Right now we include lib/Kconfig (which defines HAS_DMA) and define it ourselfes in arch/s390/Kconfig. WHoever comes first wins. Adding a select statement would make this even more complicated. Andy, I will simply send you a respin of this patch. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 11/05/2015 01:33 AM, Christian Borntraeger wrote: > Am 03.11.2015 um 13:26 schrieb Cornelia Huck: >> On Tue, 3 Nov 2015 12:54:39 +0100 >> Christian Borntraeger <borntraeger@de.ibm.com> wrote: >> >>> As virtio-ccw now has dma ops, we can no longer default to the PCI 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 is not PCI. To compile without PCI >>> support we also have to enable the DMA api with virtio. >> >> Not only with virtio, but generally, right? > > Yes, will update the patch description. >> >>> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> >>> Reviewed-by: Joerg Roedel <jroedel@suse.de> >>> Acked-by: Sebastian Ott <sebott@linux.vnet.ibm.com> >>> --- >>> arch/s390/Kconfig | 3 ++- >>> arch/s390/include/asm/device.h | 6 +++++- >>> arch/s390/include/asm/dma-mapping.h | 6 ++++-- >>> arch/s390/pci/pci.c | 1 + >>> arch/s390/pci/pci_dma.c | 4 ++-- >>> 5 files changed, 14 insertions(+), 6 deletions(-) >>> >>> diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig >>> index 1d57000..04f0e02 100644 >>> --- a/arch/s390/Kconfig >>> +++ b/arch/s390/Kconfig >>> @@ -113,6 +113,7 @@ config S390 >>> select GENERIC_FIND_FIRST_BIT >>> select GENERIC_SMP_IDLE_THREAD >>> select GENERIC_TIME_VSYSCALL >>> + select HAS_DMA >>> select HAVE_ALIGNED_STRUCT_PAGE if SLUB >>> select HAVE_ARCH_AUDITSYSCALL >>> select HAVE_ARCH_EARLY_PFN_TO_NID >>> @@ -124,6 +125,7 @@ config S390 >>> select HAVE_CMPXCHG_DOUBLE >>> select HAVE_CMPXCHG_LOCAL >>> select HAVE_DEBUG_KMEMLEAK >>> + select HAVE_DMA_ATTRS >>> select HAVE_DYNAMIC_FTRACE >>> select HAVE_DYNAMIC_FTRACE_WITH_REGS >>> select HAVE_FTRACE_MCOUNT_RECORD >>> @@ -580,7 +582,6 @@ config QDIO >>> >>> menuconfig PCI >>> bool "PCI support" >>> - select HAVE_DMA_ATTRS >>> select PCI_MSI >>> help >>> Enable PCI support. >> >> Hm. Further down in this file, there's >> >> config HAS_DMA >> def_bool PCI >> select HAVE_DMA_API_DEBUG >> >> Should we maybe select HAVE_DMA_API_DEBUG above, drop the HAS_DMA >> config option and rely on not defining NO_DMA instead? > > Hmm, yes. That would simplify things a lot. Right now we include > lib/Kconfig (which defines HAS_DMA) and define it ourselfes in > arch/s390/Kconfig. WHoever comes first wins. Adding a select statement > would make this even more complicated. > > Andy, I will simply send you a respin of this patch. > I'm slightly concerned that I'm going to screw this all up and apply the wrong version. Could you resend the whole series with git format-patch -vN for some appropriate N (or similar)? Thanks, Andy -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 1d57000..04f0e02 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -113,6 +113,7 @@ config S390 select GENERIC_FIND_FIRST_BIT select GENERIC_SMP_IDLE_THREAD select GENERIC_TIME_VSYSCALL + select HAS_DMA select HAVE_ALIGNED_STRUCT_PAGE if SLUB select HAVE_ARCH_AUDITSYSCALL select HAVE_ARCH_EARLY_PFN_TO_NID @@ -124,6 +125,7 @@ config S390 select HAVE_CMPXCHG_DOUBLE select HAVE_CMPXCHG_LOCAL select HAVE_DEBUG_KMEMLEAK + select HAVE_DMA_ATTRS select HAVE_DYNAMIC_FTRACE select HAVE_DYNAMIC_FTRACE_WITH_REGS select HAVE_FTRACE_MCOUNT_RECORD @@ -580,7 +582,6 @@ config QDIO menuconfig PCI bool "PCI support" - select HAVE_DMA_ATTRS select PCI_MSI help Enable PCI support. diff --git a/arch/s390/include/asm/device.h b/arch/s390/include/asm/device.h index d8f9872..4a9f35e 100644 --- a/arch/s390/include/asm/device.h +++ b/arch/s390/include/asm/device.h @@ -3,5 +3,9 @@ * * This file is released under the GPLv2 */ -#include <asm-generic/device.h> +struct dev_archdata { + struct dma_map_ops *dma_ops; +}; +struct pdev_archdata { +}; diff --git a/arch/s390/include/asm/dma-mapping.h b/arch/s390/include/asm/dma-mapping.h index b3fd54d..cb05f5c 100644 --- a/arch/s390/include/asm/dma-mapping.h +++ b/arch/s390/include/asm/dma-mapping.h @@ -11,11 +11,13 @@ #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) { - 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, diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c index 7ef12a3..fa41605 100644 --- a/arch/s390/pci/pci.c +++ b/arch/s390/pci/pci.c @@ -649,6 +649,7 @@ int pcibios_add_device(struct pci_dev *pdev) zdev->pdev = pdev; pdev->dev.groups = zpci_attr_groups; + pdev->dev.archdata.dma_ops = &s390_pci_dma_ops; zpci_map_resources(pdev); 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 37505b8..ea39c3f 100644 --- a/arch/s390/pci/pci_dma.c +++ b/arch/s390/pci/pci_dma.c @@ -495,7 +495,7 @@ static int __init dma_debug_do_init(void) } 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, .free = s390_dma_free, .map_sg = s390_dma_map_sg, @@ -506,7 +506,7 @@ struct dma_map_ops s390_dma_ops = { .is_phys = 0, /* 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) {