Re: [PATCH/RFC 0/6] Allow compile-testing NO_DMA
On Tue, Feb 6, 2018 at 2:05 PM, Robin Murphywrote: > > It looks like we have only one real arch (score) without IOMEM, and two > (s390 and tile) where it is possible to configure out, so it does seem like > a reasonable feature to assume. Maybe we could have something like > asm-generic/no-io.h to provide an "unimplemented" version of those > interfaces. Agreed, there is no use trying to optimize for any of those three cases: For s390, all new machines come with PCI, so distros will enable it all the time. Few users run their own kernels even on older machines. score has been de-facto unmaintained for a few years, and tile has recently been orphaned with the hardware platform being abandoned by Mellanox. Arnd ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
Re: [PATCH/RFC 0/6] Allow compile-testing NO_DMA
On Tue, Feb 6, 2018 at 11:14 AM, Geert Uytterhoevenwrote: > Hi all, > > If NO_DMA=y, get_dma_ops() returns a reference to the non-existing > symbol bad_dma_ops, thus causing a link failure if it is ever used. > > The intention of this is twofold: > 1. To catch users of the DMA API on systems that do no support the DMA > mapping API, > 2. To avoid building drivers that cannot work on such systems anyway. > > However, the disadvantage is that we have to keep on adding dependencies > on HAS_DMA all over the place. > > Thanks to the COMPILE_TEST symbol, lots of drivers now depend on one or > more platform dependencies (that imply HAS_DMA) || COMPILE_TEST, thus > already covering intention #2. Having to add an explicit dependency on > HAS_DMA here is cumbersome, and hinders compile-testing. > > Hence I think the time is ripe to reconsider the link failure. > This patch series: > - Changes get_dma_ops() to return NULL instead, > - Adds a few more dummies to enable compile-testing, > - Removes dependencies on HAS_DMA for symbols that already have > platform dependencies implying HAS_DMA. > > Note that adding more platform dependencies and/or dependencies on > COMPILE_TEST is encouraged! > > This may make life harder for UML, though, as UML usually satisfies all > other platform dependencies for HAS_DMA. Similarly, HAS_IOMEM is even > more complicated. Can/do we want to do something similar for > HAS_IOMEM? > > This series is against my current local tree, which has a few more > "depends on HAS_DMA" than upstream. Of course I will rebase, and split > the last patch per subsystem, if this RFC is welcomed positively. > > Compile-tested with allmodconfig and allyesconfig for m68k/sun3. David Woodhouse has been looking at some other structures with indirect pointers (kvm_x86_ops) to reduce the overhead that was added for avoiding speculative execution of those pointers. I wonder if there are any dma_map_ops operations that are in a fastpath that needs a similar optimization. If yes, we might want to think about how to do that part first to avoid rewriting the same code more than once. Otherwise, your approach seems fine. Arnd ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
Re: [PATCH/RFC 0/6] Allow compile-testing NO_DMA
On 06/02/18 10:14, Geert Uytterhoeven wrote: Hi all, If NO_DMA=y, get_dma_ops() returns a reference to the non-existing symbol bad_dma_ops, thus causing a link failure if it is ever used. The intention of this is twofold: 1. To catch users of the DMA API on systems that do no support the DMA mapping API, 2. To avoid building drivers that cannot work on such systems anyway. However, the disadvantage is that we have to keep on adding dependencies on HAS_DMA all over the place. Thanks to the COMPILE_TEST symbol, lots of drivers now depend on one or more platform dependencies (that imply HAS_DMA) || COMPILE_TEST, thus already covering intention #2. Having to add an explicit dependency on HAS_DMA here is cumbersome, and hinders compile-testing. Hence I think the time is ripe to reconsider the link failure. This patch series: - Changes get_dma_ops() to return NULL instead, - Adds a few more dummies to enable compile-testing, - Removes dependencies on HAS_DMA for symbols that already have platform dependencies implying HAS_DMA. Note that adding more platform dependencies and/or dependencies on COMPILE_TEST is encouraged! This may make life harder for UML, though, as UML usually satisfies all other platform dependencies for HAS_DMA. Similarly, HAS_IOMEM is even more complicated. Can/do we want to do something similar for HAS_IOMEM? It looks like we have only one real arch (score) without IOMEM, and two (s390 and tile) where it is possible to configure out, so it does seem like a reasonable feature to assume. Maybe we could have something like asm-generic/no-io.h to provide an "unimplemented" version of those interfaces. Anyway, for this series: Acked-by: Robin MurphyThanks, Robin. This series is against my current local tree, which has a few more "depends on HAS_DMA" than upstream. Of course I will rebase, and split the last patch per subsystem, if this RFC is welcomed positively. Compile-tested with allmodconfig and allyesconfig for m68k/sun3. Thanks for your comments! Geert Uytterhoeven (6): [RFC] dma-mapping: Convert NO_DMA get_dma_ops() into a real dummy [RFC] dma-coherent: Add NO_DMA dummies for managed DMA API [RFC] usb: gadget: Add NO_DMA dummies for DMA mapping API [RFC] mm: Add NO_DMA dummies for DMA pool API [RFC] scsi: Add NO_DMA dummies for SCSI DMA mapping API [RFC] Treewide: Remove depends on HAS_DMA in case of platform dependency drivers/ata/Kconfig | 2 -- drivers/crypto/Kconfig | 14 +++-- drivers/firewire/Kconfig| 1 - drivers/fpga/Kconfig| 1 - drivers/gpu/ipu-v3/Kconfig | 1 - drivers/i2c/busses/Kconfig | 3 -- drivers/iio/adc/Kconfig | 3 -- drivers/iommu/Kconfig | 5 ++-- drivers/lightnvm/Kconfig| 2 +- drivers/mailbox/Kconfig | 2 -- drivers/media/pci/dt3155/Kconfig| 1 - drivers/media/pci/solo6x10/Kconfig | 1 - drivers/media/pci/sta2x11/Kconfig | 1 - drivers/media/pci/tw5864/Kconfig| 1 - drivers/media/pci/tw686x/Kconfig| 1 - drivers/media/platform/Kconfig | 40 - drivers/media/platform/am437x/Kconfig | 2 +- drivers/media/platform/atmel/Kconfig| 4 +-- drivers/media/platform/blackfin/Kconfig | 1 - drivers/media/platform/davinci/Kconfig | 6 drivers/media/platform/marvell-ccic/Kconfig | 3 +- drivers/media/platform/rcar-vin/Kconfig | 2 +- drivers/media/platform/soc_camera/Kconfig | 3 +- drivers/media/platform/sti/c8sectpfe/Kconfig| 2 +- drivers/mmc/host/Kconfig| 10 ++- drivers/mtd/nand/Kconfig| 8 ++--- drivers/mtd/spi-nor/Kconfig | 2 +- drivers/net/ethernet/amd/Kconfig| 2 +- drivers/net/ethernet/apm/xgene-v2/Kconfig | 1 - drivers/net/ethernet/apm/xgene/Kconfig | 1 - drivers/net/ethernet/arc/Kconfig| 6 ++-- drivers/net/ethernet/broadcom/Kconfig | 2 -- drivers/net/ethernet/calxeda/Kconfig| 2 +- drivers/net/ethernet/hisilicon/Kconfig | 2 +- drivers/net/ethernet/marvell/Kconfig| 8 ++--- drivers/net/ethernet/mellanox/mlxsw/Kconfig | 2 +- drivers/net/ethernet/renesas/Kconfig| 2 -- drivers/net/ethernet/socionext/Kconfig | 4 +-- drivers/net/wireless/broadcom/brcm80211/Kconfig | 1 - drivers/net/wireless/quantenna/qtnfmac/Kconfig | 2 +- drivers/remoteproc/Kconfig | 1 - drivers/scsi/hisi_sas/Kconfig | 2 +- drivers/spi/Kconfig
Re: [PATCH RFC 1/1] iommu/arm-smmu: Fix context fault message considering non-NTS
Hi Robin, On Tue, Feb 6, 2018 at 5:22 PM, Robin Murphywrote: > Hi Vivek, > > On 06/02/18 10:16, Vivek Gautam wrote: >> >> SMMU_CBn_FSYNR0 definition from SMMU v2 architecture document >> says that, the S1CBNDX[23:16] field is only valid if SMMU_IDR0.NTS==1. >> So, update the fsynr in context bank fault handler, so that the >> fault message displays cbndx only when we have nested translations >> enabled. >> Otherwise, it is confusing when 'cb' gives the actual context >> bank, while the 'fsynr' gives a different value. >> >> Example, on a sdm845 system: >> Before this patch - >> arm-smmu 1500.apps-smmu: Unhandled context fault: >>fsr=0x402, iova=0x9e0fb600, fsynr=0x3c0020, >> cb=0 >> After this patch - >> arm-smmu 1500.apps-smmu: Unhandled context fault: >>fsr=0x402, iova=0x9e0aa000, fsynr=0x20, cb=0 >> >> Signed-off-by: Vivek Gautam >> Cc: Robin Murphy >> --- >> >> Hi Robin, >> Does it make sense to mask fsynr like this? >> Would it still be confusing for CB==0? >> Tagging the patch as RFC to get your comments. If looks good, >> then i will send the patch for your ack. >> Thanks. > > > I would expect that anyone who knows how to decode a raw FSYNR0 value should > also be aware of when various fields are valid or not. I have page 302 of > IHI0062D.c open next to this email, and to me it seems virtually impossible > to read the definition of S1CBNDX without inherently seeing all the > conditions under which it is UNKNOWN (which incidentally are more than this > patch would cover). Yea, I agree with you. To fully decode the S1CBNDX, one has to refer the spec, and once one has the knowledge of the smmu implementation on the one's target platform, it becomes unimportant to look at the cbndx again. > > In general, I don't agree with this - we're dumping the raw state of a > register, and it's already a cryptic hex value that you have to refer to the > architecture spec to decode. There is perhaps some argument for > pretty-printing faults with everything fully decoded, but given that they > should never be seen under normal operation (especially global faults), I > really don't think that's worth the bother either. Sure. We can drop this patch. Thanks. > > Robin. > >> drivers/iommu/arm-smmu.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c >> index 69e7c60792a8..827659515b22 100644 >> --- a/drivers/iommu/arm-smmu.c >> +++ b/drivers/iommu/arm-smmu.c >> @@ -550,6 +550,9 @@ static irqreturn_t arm_smmu_context_fault(int irq, >> void *dev) >> fsynr = readl_relaxed(cb_base + ARM_SMMU_CB_FSYNR0); >> iova = readq_relaxed(cb_base + ARM_SMMU_CB_FAR); >> + if (!smmu->features & ARM_SMMU_FEAT_TRANS_NESTED) >> + fsynr &= 0x; >> + >> dev_err_ratelimited(smmu->dev, >> "Unhandled context fault: fsr=0x%x, iova=0x%08lx, fsynr=0x%x, >> cb=%d\n", >> fsr, iova, fsynr, cfg->cbndx); >> > -- > To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
Re: [PATCH/RFC 0/6] Allow compile-testing NO_DMA
On Tue, Feb 06, 2018 at 11:14:46AM +0100, Geert Uytterhoeven wrote: > The intention of this is twofold: > 1. To catch users of the DMA API on systems that do no support the DMA > mapping API, > 2. To avoid building drivers that cannot work on such systems anyway. > > However, the disadvantage is that we have to keep on adding dependencies > on HAS_DMA all over the place. > Thanks to the COMPILE_TEST symbol, lots of drivers now depend on one or > more platform dependencies (that imply HAS_DMA) || COMPILE_TEST, thus > already covering intention #2. Having to add an explicit dependency on > HAS_DMA here is cumbersome, and hinders compile-testing. Thanks for doing this, hopefully it'll make everyone's life easier! Reviwed-by: Mark Brownsignature.asc Description: PGP signature ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
Re: [PATCH RFC 1/1] iommu/arm-smmu: Fix context fault message considering non-NTS
Hi Vivek, On 06/02/18 10:16, Vivek Gautam wrote: SMMU_CBn_FSYNR0 definition from SMMU v2 architecture document says that, the S1CBNDX[23:16] field is only valid if SMMU_IDR0.NTS==1. So, update the fsynr in context bank fault handler, so that the fault message displays cbndx only when we have nested translations enabled. Otherwise, it is confusing when 'cb' gives the actual context bank, while the 'fsynr' gives a different value. Example, on a sdm845 system: Before this patch - arm-smmu 1500.apps-smmu: Unhandled context fault: fsr=0x402, iova=0x9e0fb600, fsynr=0x3c0020, cb=0 After this patch - arm-smmu 1500.apps-smmu: Unhandled context fault: fsr=0x402, iova=0x9e0aa000, fsynr=0x20, cb=0 Signed-off-by: Vivek GautamCc: Robin Murphy --- Hi Robin, Does it make sense to mask fsynr like this? Would it still be confusing for CB==0? Tagging the patch as RFC to get your comments. If looks good, then i will send the patch for your ack. Thanks. I would expect that anyone who knows how to decode a raw FSYNR0 value should also be aware of when various fields are valid or not. I have page 302 of IHI0062D.c open next to this email, and to me it seems virtually impossible to read the definition of S1CBNDX without inherently seeing all the conditions under which it is UNKNOWN (which incidentally are more than this patch would cover). In general, I don't agree with this - we're dumping the raw state of a register, and it's already a cryptic hex value that you have to refer to the architecture spec to decode. There is perhaps some argument for pretty-printing faults with everything fully decoded, but given that they should never be seen under normal operation (especially global faults), I really don't think that's worth the bother either. Robin. drivers/iommu/arm-smmu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 69e7c60792a8..827659515b22 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -550,6 +550,9 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev) fsynr = readl_relaxed(cb_base + ARM_SMMU_CB_FSYNR0); iova = readq_relaxed(cb_base + ARM_SMMU_CB_FAR); + if (!smmu->features & ARM_SMMU_FEAT_TRANS_NESTED) + fsynr &= 0x; + dev_err_ratelimited(smmu->dev, "Unhandled context fault: fsr=0x%x, iova=0x%08lx, fsynr=0x%x, cb=%d\n", fsr, iova, fsynr, cfg->cbndx); ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
[PATCH/RFC 2/6] dma-coherent: Add NO_DMA dummies for managed DMA API
Add dummies for dmam_{alloc,free}_coherent(), to allow compile-testing if NO_DMA=y. This prevents the following from showing up later: ERROR: "dmam_alloc_coherent" [drivers/net/ethernet/arc/arc_emac.ko] undefined! ERROR: "dmam_free_coherent" [drivers/net/ethernet/apm/xgene/xgene-enet.ko] undefined! ERROR: "dmam_alloc_coherent" [drivers/net/ethernet/apm/xgene/xgene-enet.ko] undefined! ERROR: "dmam_alloc_coherent" [drivers/mtd/nand/hisi504_nand.ko] undefined! ERROR: "dmam_alloc_coherent" [drivers/mmc/host/dw_mmc.ko] undefined! Signed-off-by: Geert Uytterhoeven--- include/linux/dma-mapping.h | 9 + 1 file changed, 9 insertions(+) diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index d78d7541f784875b..4d92956a4ddb8a5c 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -776,10 +776,19 @@ static inline void dma_deconfigure(struct device *dev) {} /* * Managed DMA API */ +#ifdef CONFIG_HAS_DMA extern void *dmam_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t gfp); extern void dmam_free_coherent(struct device *dev, size_t size, void *vaddr, dma_addr_t dma_handle); +#else /* !CONFIG_HAS_DMA */ +static inline void *dmam_alloc_coherent(struct device *dev, size_t size, + dma_addr_t *dma_handle, gfp_t gfp) +{ return NULL; } +static inline void dmam_free_coherent(struct device *dev, size_t size, + void *vaddr, dma_addr_t dma_handle) { } +#endif /* !CONFIG_HAS_DMA */ + extern void *dmam_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs); -- 2.7.4 ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
[PATCH/RFC 0/6] Allow compile-testing NO_DMA
Hi all, If NO_DMA=y, get_dma_ops() returns a reference to the non-existing symbol bad_dma_ops, thus causing a link failure if it is ever used. The intention of this is twofold: 1. To catch users of the DMA API on systems that do no support the DMA mapping API, 2. To avoid building drivers that cannot work on such systems anyway. However, the disadvantage is that we have to keep on adding dependencies on HAS_DMA all over the place. Thanks to the COMPILE_TEST symbol, lots of drivers now depend on one or more platform dependencies (that imply HAS_DMA) || COMPILE_TEST, thus already covering intention #2. Having to add an explicit dependency on HAS_DMA here is cumbersome, and hinders compile-testing. Hence I think the time is ripe to reconsider the link failure. This patch series: - Changes get_dma_ops() to return NULL instead, - Adds a few more dummies to enable compile-testing, - Removes dependencies on HAS_DMA for symbols that already have platform dependencies implying HAS_DMA. Note that adding more platform dependencies and/or dependencies on COMPILE_TEST is encouraged! This may make life harder for UML, though, as UML usually satisfies all other platform dependencies for HAS_DMA. Similarly, HAS_IOMEM is even more complicated. Can/do we want to do something similar for HAS_IOMEM? This series is against my current local tree, which has a few more "depends on HAS_DMA" than upstream. Of course I will rebase, and split the last patch per subsystem, if this RFC is welcomed positively. Compile-tested with allmodconfig and allyesconfig for m68k/sun3. Thanks for your comments! Geert Uytterhoeven (6): [RFC] dma-mapping: Convert NO_DMA get_dma_ops() into a real dummy [RFC] dma-coherent: Add NO_DMA dummies for managed DMA API [RFC] usb: gadget: Add NO_DMA dummies for DMA mapping API [RFC] mm: Add NO_DMA dummies for DMA pool API [RFC] scsi: Add NO_DMA dummies for SCSI DMA mapping API [RFC] Treewide: Remove depends on HAS_DMA in case of platform dependency drivers/ata/Kconfig | 2 -- drivers/crypto/Kconfig | 14 +++-- drivers/firewire/Kconfig| 1 - drivers/fpga/Kconfig| 1 - drivers/gpu/ipu-v3/Kconfig | 1 - drivers/i2c/busses/Kconfig | 3 -- drivers/iio/adc/Kconfig | 3 -- drivers/iommu/Kconfig | 5 ++-- drivers/lightnvm/Kconfig| 2 +- drivers/mailbox/Kconfig | 2 -- drivers/media/pci/dt3155/Kconfig| 1 - drivers/media/pci/solo6x10/Kconfig | 1 - drivers/media/pci/sta2x11/Kconfig | 1 - drivers/media/pci/tw5864/Kconfig| 1 - drivers/media/pci/tw686x/Kconfig| 1 - drivers/media/platform/Kconfig | 40 - drivers/media/platform/am437x/Kconfig | 2 +- drivers/media/platform/atmel/Kconfig| 4 +-- drivers/media/platform/blackfin/Kconfig | 1 - drivers/media/platform/davinci/Kconfig | 6 drivers/media/platform/marvell-ccic/Kconfig | 3 +- drivers/media/platform/rcar-vin/Kconfig | 2 +- drivers/media/platform/soc_camera/Kconfig | 3 +- drivers/media/platform/sti/c8sectpfe/Kconfig| 2 +- drivers/mmc/host/Kconfig| 10 ++- drivers/mtd/nand/Kconfig| 8 ++--- drivers/mtd/spi-nor/Kconfig | 2 +- drivers/net/ethernet/amd/Kconfig| 2 +- drivers/net/ethernet/apm/xgene-v2/Kconfig | 1 - drivers/net/ethernet/apm/xgene/Kconfig | 1 - drivers/net/ethernet/arc/Kconfig| 6 ++-- drivers/net/ethernet/broadcom/Kconfig | 2 -- drivers/net/ethernet/calxeda/Kconfig| 2 +- drivers/net/ethernet/hisilicon/Kconfig | 2 +- drivers/net/ethernet/marvell/Kconfig| 8 ++--- drivers/net/ethernet/mellanox/mlxsw/Kconfig | 2 +- drivers/net/ethernet/renesas/Kconfig| 2 -- drivers/net/ethernet/socionext/Kconfig | 4 +-- drivers/net/wireless/broadcom/brcm80211/Kconfig | 1 - drivers/net/wireless/quantenna/qtnfmac/Kconfig | 2 +- drivers/remoteproc/Kconfig | 1 - drivers/scsi/hisi_sas/Kconfig | 2 +- drivers/spi/Kconfig | 12 ++-- drivers/staging/media/davinci_vpfe/Kconfig | 1 - drivers/staging/media/omap4iss/Kconfig | 1 - drivers/staging/vc04_services/Kconfig | 1 - drivers/tty/serial/Kconfig | 4 --- drivers/usb/gadget/udc/Kconfig | 4 +-- drivers/usb/mtu3/Kconfig| 2 +- drivers/video/fbdev/Kconfig | 3 +- include/linux/dma-mapping.h | 19
[PATCH RFC 1/1] iommu/arm-smmu: Fix context fault message considering non-NTS
SMMU_CBn_FSYNR0 definition from SMMU v2 architecture document says that, the S1CBNDX[23:16] field is only valid if SMMU_IDR0.NTS==1. So, update the fsynr in context bank fault handler, so that the fault message displays cbndx only when we have nested translations enabled. Otherwise, it is confusing when 'cb' gives the actual context bank, while the 'fsynr' gives a different value. Example, on a sdm845 system: Before this patch - arm-smmu 1500.apps-smmu: Unhandled context fault: fsr=0x402, iova=0x9e0fb600, fsynr=0x3c0020, cb=0 After this patch - arm-smmu 1500.apps-smmu: Unhandled context fault: fsr=0x402, iova=0x9e0aa000, fsynr=0x20, cb=0 Signed-off-by: Vivek GautamCc: Robin Murphy --- Hi Robin, Does it make sense to mask fsynr like this? Would it still be confusing for CB==0? Tagging the patch as RFC to get your comments. If looks good, then i will send the patch for your ack. Thanks. drivers/iommu/arm-smmu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 69e7c60792a8..827659515b22 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -550,6 +550,9 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev) fsynr = readl_relaxed(cb_base + ARM_SMMU_CB_FSYNR0); iova = readq_relaxed(cb_base + ARM_SMMU_CB_FAR); + if (!smmu->features & ARM_SMMU_FEAT_TRANS_NESTED) + fsynr &= 0x; + dev_err_ratelimited(smmu->dev, "Unhandled context fault: fsr=0x%x, iova=0x%08lx, fsynr=0x%x, cb=%d\n", fsr, iova, fsynr, cfg->cbndx); -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
[PATCH/RFC 6/6] Treewide: Remove depends on HAS_DMA in case of platform dependency
Remove dependencies on HAS_DMA where a Kconfig symbol depends on another symbol that implies HAS_DMA, and, optionally, on "|| COMPILE_TEST". In most cases this other symbol is an architecture or platform specific symbol, or PCI. Generic symbols and drivers without platform dependencies keep their dependencies on HAS_DMA, to prevent compiling subsystems or drivers that cannot work anyway. This simplifies the dependencies, and allows to improve compile-testing. Notes: - FSL_FMAN keeps its dependency on HAS_DMA, as it calls set_dma_ops(), which does not exist if HAS_DMA=n (Do we need a dummy? The use of set_dma_ops() in this driver is questionable), - SND_SOC_LPASS_IPQ806X and SND_SOC_LPASS_PLATFORM loose their dependency on HAS_DMA, as they are selected from SND_SOC_APQ8016_SBC. Signed-off-by: Geert Uytterhoeven--- drivers/ata/Kconfig | 2 -- drivers/crypto/Kconfig | 14 +++-- drivers/firewire/Kconfig| 1 - drivers/fpga/Kconfig| 1 - drivers/gpu/ipu-v3/Kconfig | 1 - drivers/i2c/busses/Kconfig | 3 -- drivers/iio/adc/Kconfig | 3 -- drivers/iommu/Kconfig | 5 ++-- drivers/lightnvm/Kconfig| 2 +- drivers/mailbox/Kconfig | 2 -- drivers/media/pci/dt3155/Kconfig| 1 - drivers/media/pci/solo6x10/Kconfig | 1 - drivers/media/pci/sta2x11/Kconfig | 1 - drivers/media/pci/tw5864/Kconfig| 1 - drivers/media/pci/tw686x/Kconfig| 1 - drivers/media/platform/Kconfig | 40 - drivers/media/platform/am437x/Kconfig | 2 +- drivers/media/platform/atmel/Kconfig| 4 +-- drivers/media/platform/blackfin/Kconfig | 1 - drivers/media/platform/davinci/Kconfig | 6 drivers/media/platform/marvell-ccic/Kconfig | 3 +- drivers/media/platform/rcar-vin/Kconfig | 2 +- drivers/media/platform/soc_camera/Kconfig | 3 +- drivers/media/platform/sti/c8sectpfe/Kconfig| 2 +- drivers/mmc/host/Kconfig| 10 ++- drivers/mtd/nand/Kconfig| 8 ++--- drivers/mtd/spi-nor/Kconfig | 2 +- drivers/net/ethernet/amd/Kconfig| 2 +- drivers/net/ethernet/apm/xgene-v2/Kconfig | 1 - drivers/net/ethernet/apm/xgene/Kconfig | 1 - drivers/net/ethernet/arc/Kconfig| 6 ++-- drivers/net/ethernet/broadcom/Kconfig | 2 -- drivers/net/ethernet/calxeda/Kconfig| 2 +- drivers/net/ethernet/hisilicon/Kconfig | 2 +- drivers/net/ethernet/marvell/Kconfig| 8 ++--- drivers/net/ethernet/mellanox/mlxsw/Kconfig | 2 +- drivers/net/ethernet/renesas/Kconfig| 2 -- drivers/net/ethernet/socionext/Kconfig | 4 +-- drivers/net/wireless/broadcom/brcm80211/Kconfig | 1 - drivers/net/wireless/quantenna/qtnfmac/Kconfig | 2 +- drivers/remoteproc/Kconfig | 1 - drivers/scsi/hisi_sas/Kconfig | 2 +- drivers/spi/Kconfig | 12 ++-- drivers/staging/media/davinci_vpfe/Kconfig | 1 - drivers/staging/media/omap4iss/Kconfig | 1 - drivers/staging/vc04_services/Kconfig | 1 - drivers/tty/serial/Kconfig | 4 --- drivers/usb/gadget/udc/Kconfig | 4 +-- drivers/usb/mtu3/Kconfig| 2 +- drivers/video/fbdev/Kconfig | 3 +- sound/soc/bcm/Kconfig | 3 +- sound/soc/kirkwood/Kconfig | 1 - sound/soc/pxa/Kconfig | 1 - sound/soc/qcom/Kconfig | 6 ++-- 54 files changed, 58 insertions(+), 141 deletions(-) diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index a7120d6211546949..9eaeed1fb237fa33 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig @@ -398,7 +398,6 @@ config SATA_DWC_VDEBUG config SATA_HIGHBANK tristate "Calxeda Highbank SATA support" - depends on HAS_DMA depends on ARCH_HIGHBANK || COMPILE_TEST help This option enables support for the Calxeda Highbank SoC's @@ -408,7 +407,6 @@ config SATA_HIGHBANK config SATA_MV tristate "Marvell SATA support" - depends on HAS_DMA depends on PCI || ARCH_DOVE || ARCH_MV78XX0 || \ ARCH_MVEBU || ARCH_ORION5X || COMPILE_TEST select GENERIC_PHY diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig index 4b741b83e23ff4de..3d27da7a430c0bc2 100644 --- a/drivers/crypto/Kconfig +++ b/drivers/crypto/Kconfig @@ -419,7 +419,7 @@ config CRYPTO_DEV_EXYNOS_RNG config CRYPTO_DEV_S5P
[PATCH/RFC 1/6] dma-mapping: Convert NO_DMA get_dma_ops() into a real dummy
If NO_DMA=y, get_dma_ops() returns a reference to the non-existing symbol bad_dma_ops, thus causing a link failure if it is ever used. Make get_dma_ops() return NULL instead, to avoid the link failure. This allows to improve compile-testing, and limits the need to keep on sprinkling dependencies on HAS_DMA all over the place. Signed-off-by: Geert Uytterhoeven--- include/linux/dma-mapping.h | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 34fe8463d10ea3be..d78d7541f784875b 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -212,14 +212,14 @@ static inline void set_dma_ops(struct device *dev, } #else /* - * Define the dma api to allow compilation but not linking of - * dma dependent code. Code that depends on the dma-mapping - * API needs to set 'depends on HAS_DMA' in its Kconfig + * Define the dma api to allow compilation of dma dependent code. + * Code that depends on the dma-mapping API needs to set 'depends on HAS_DMA' + * in its Kconfig, unless it already depends on || COMPILE_TEST, + * where guarantuees the availability of the dma-mapping API. */ -extern const struct dma_map_ops bad_dma_ops; static inline const struct dma_map_ops *get_dma_ops(struct device *dev) { - return _dma_ops; + return NULL; } #endif -- 2.7.4 ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
[PATCH/RFC 3/6] usb: gadget: Add NO_DMA dummies for DMA mapping API
Add dummies for usb_gadget_{,un}map_request{,_by_dev}(), to allow compile-testing if NO_DMA=y. This prevents the following from showing up later: ERROR: "usb_gadget_unmap_request_by_dev" [drivers/usb/renesas_usbhs/renesas_usbhs.ko] undefined! ERROR: "usb_gadget_map_request_by_dev" [drivers/usb/renesas_usbhs/renesas_usbhs.ko] undefined! ERROR: "usb_gadget_map_request" [drivers/usb/mtu3/mtu3.ko] undefined! ERROR: "usb_gadget_unmap_request" [drivers/usb/mtu3/mtu3.ko] undefined! ERROR: "usb_gadget_map_request" [drivers/usb/gadget/udc/renesas_usb3.ko] undefined! ERROR: "usb_gadget_unmap_request" [drivers/usb/gadget/udc/renesas_usb3.ko] undefined! Signed-off-by: Geert Uytterhoeven--- include/linux/usb/gadget.h | 12 1 file changed, 12 insertions(+) diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 66a5cff7ee142d6a..b68e7f9b210be122 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -805,6 +805,7 @@ int usb_otg_descriptor_init(struct usb_gadget *gadget, /* utility to simplify map/unmap of usb_requests to/from DMA */ +#ifdef CONFIG_HAS_DMA extern int usb_gadget_map_request_by_dev(struct device *dev, struct usb_request *req, int is_in); extern int usb_gadget_map_request(struct usb_gadget *gadget, @@ -814,6 +815,17 @@ extern void usb_gadget_unmap_request_by_dev(struct device *dev, struct usb_request *req, int is_in); extern void usb_gadget_unmap_request(struct usb_gadget *gadget, struct usb_request *req, int is_in); +#else /* !CONFIG_HAS_DMA */ +static inline int usb_gadget_map_request_by_dev(struct device *dev, + struct usb_request *req, int is_in) { return -ENOSYS; } +static inline int usb_gadget_map_request(struct usb_gadget *gadget, + struct usb_request *req, int is_in) { return -ENOSYS; } + +static inline void usb_gadget_unmap_request_by_dev(struct device *dev, + struct usb_request *req, int is_in) { } +static inline void usb_gadget_unmap_request(struct usb_gadget *gadget, + struct usb_request *req, int is_in) { } +#endif /* !CONFIG_HAS_DMA */ /*-*/ -- 2.7.4 ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
[PATCH/RFC 5/6] scsi: Add NO_DMA dummies for SCSI DMA mapping API
Add dummies for scsi_dma_{,un}map(), to allow compile-testing if NO_DMA=y. This prevents the following from showing up later: ERROR: "scsi_dma_unmap" [drivers/firewire/firewire-sbp2.ko] undefined! ERROR: "scsi_dma_map" [drivers/firewire/firewire-sbp2.ko] undefined! Signed-off-by: Geert Uytterhoeven--- include/scsi/scsi_cmnd.h | 5 + 1 file changed, 5 insertions(+) diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index d8d4a902a88dedbc..6a123d1dd2f80624 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -171,8 +171,13 @@ extern void scsi_kunmap_atomic_sg(void *virt); extern int scsi_init_io(struct scsi_cmnd *cmd); +#ifdef CONFIG_SCSI_DMA extern int scsi_dma_map(struct scsi_cmnd *cmd); extern void scsi_dma_unmap(struct scsi_cmnd *cmd); +#else /* !CONFIG_SCSI_DMA */ +static inline int scsi_dma_map(struct scsi_cmnd *cmd) { return -ENOSYS; } +static inline void scsi_dma_unmap(struct scsi_cmnd *cmd) { } +#endif /* !CONFIG_SCSI_DMA */ static inline unsigned scsi_sg_count(struct scsi_cmnd *cmd) { -- 2.7.4 ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
[PATCH/RFC 4/6] mm: Add NO_DMA dummies for DMA pool API
Add dummies for dma{,m}_pool_{create,destroy,alloc,free}(), to allow compile-testing if NO_DMA=y. This prevents the following from showing up later: ERROR: "dma_pool_destroy" [drivers/usb/mtu3/mtu3.ko] undefined! ERROR: "dma_pool_free" [drivers/usb/mtu3/mtu3.ko] undefined! ERROR: "dma_pool_alloc" [drivers/usb/mtu3/mtu3.ko] undefined! ERROR: "dma_pool_create" [drivers/usb/mtu3/mtu3.ko] undefined! ERROR: "dma_pool_destroy" [drivers/scsi/hisi_sas/hisi_sas_main.ko] undefined! ERROR: "dma_pool_free" [drivers/scsi/hisi_sas/hisi_sas_main.ko] undefined! ERROR: "dma_pool_alloc" [drivers/scsi/hisi_sas/hisi_sas_main.ko] undefined! ERROR: "dma_pool_create" [drivers/scsi/hisi_sas/hisi_sas_main.ko] undefined! ERROR: "dma_pool_alloc" [drivers/mailbox/bcm-pdc-mailbox.ko] undefined! ERROR: "dma_pool_free" [drivers/mailbox/bcm-pdc-mailbox.ko] undefined! ERROR: "dma_pool_create" [drivers/mailbox/bcm-pdc-mailbox.ko] undefined! ERROR: "dma_pool_destroy" [drivers/mailbox/bcm-pdc-mailbox.ko] undefined! Signed-off-by: Geert Uytterhoeven--- include/linux/dmapool.h | 21 +++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/include/linux/dmapool.h b/include/linux/dmapool.h index 53ba737505df31c7..adeb5e56c3ad73a8 100644 --- a/include/linux/dmapool.h +++ b/include/linux/dmapool.h @@ -16,6 +16,7 @@ struct device; +#ifdef CONFIG_HAS_DMA struct dma_pool *dma_pool_create(const char *name, struct device *dev, size_t size, size_t align, size_t allocation); @@ -23,6 +24,17 @@ void dma_pool_destroy(struct dma_pool *pool); void *dma_pool_alloc(struct dma_pool *pool, gfp_t mem_flags, dma_addr_t *handle); +void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t addr); +#else /* !CONFIG_HAS_DMA */ +static inline struct dma_pool *dma_pool_create(const char *name, + struct device *dev, size_t size, size_t align, size_t allocation) +{ return NULL; } +static inline void dma_pool_destroy(struct dma_pool *pool) { } +static inline void *dma_pool_alloc(struct dma_pool *pool, gfp_t mem_flags, + dma_addr_t *handle) { return NULL; } +static inline void dma_pool_free(struct dma_pool *pool, void *vaddr, +dma_addr_t addr) { } +#endif /* !CONFIG_HAS_DMA */ static inline void *dma_pool_zalloc(struct dma_pool *pool, gfp_t mem_flags, dma_addr_t *handle) @@ -30,14 +42,19 @@ static inline void *dma_pool_zalloc(struct dma_pool *pool, gfp_t mem_flags, return dma_pool_alloc(pool, mem_flags | __GFP_ZERO, handle); } -void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t addr); - /* * Managed DMA pool */ +#ifdef CONFIG_HAS_DMA struct dma_pool *dmam_pool_create(const char *name, struct device *dev, size_t size, size_t align, size_t allocation); void dmam_pool_destroy(struct dma_pool *pool); +#else /* !CONFIG_HAS_DMA */ +static inline struct dma_pool *dmam_pool_create(const char *name, + struct device *dev, size_t size, size_t align, size_t allocation) +{ return NULL; } +static inline void dmam_pool_destroy(struct dma_pool *pool) { } +#endif /* !CONFIG_HAS_DMA */ #endif -- 2.7.4 ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu